42 #include <px4_platform_common/atomic.h> 49 class SubscriptionCallback;
59 uint8_t queue_size = 1);
118 #ifdef ORB_COMMUNICATOR 119 static int16_t topic_advertised(
const orb_metadata *meta,
int priority);
130 int16_t process_add_subscription(int32_t rateInHz);
135 int16_t process_remove_subscription();
140 int16_t process_received_message(int32_t length, uint8_t *data);
213 bool copy(
void *dst,
unsigned &generation);
265 unsigned generation{0};
static ssize_t publish(const orb_metadata *meta, orb_advert_t handle, const void *data)
Method to publish a data to this node.
bool copy_locked(void *dst, unsigned &generation)
Copies data and the corresponding generation from a node to the buffer provided.
px4::atomic< unsigned > _generation
object generation count
void unregister_callback(SubscriptionCallback *callback_sub)
pollevent_t poll_state(cdev::file_t *filp) override
Check the current state of the device for poll events from the perspective of the file...
uint8_t get_queue_size() const
uint64_t last_update
time at which the last update was provided, used when update_interval is nonzero
const orb_metadata * _meta
object metadata information
int update_queue_size(unsigned int queue_size)
Try to change the size of the queue.
void poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events) override
Internal implementation of poll_notify.
void set_priority(uint8_t priority)
uint32_t lost_message_count() const
An intrusive linked list.
int8_t subscriber_count() const
int reset(enum LPS22HB_BUS busid)
Reset the driver.
static int update_interval
void mark_as_advertised()
int open(cdev::file_t *filp) override
Method to create a subscriber instance and return the struct pointing to the subscriber as a file poi...
uint8_t * _data
allocated object buffer
DeviceNode & operator=(const DeviceNode &)=delete
ssize_t write(cdev::file_t *filp, const char *buffer, size_t buflen) override
writes the published data to the internal buffer to be read by subscribers later. ...
uint8_t _priority
priority of the topic
Abstract class for any character device.
unsigned published_message_count() const
uint32_t _lost_messages
nr of lost messages for all subscribers.
Per-object device instance.
uint64_t copy_and_get_timestamp(void *dst, unsigned &generation)
Copies data and the corresponding generation from a node to the buffer provided.
void remove_internal_subscriber()
Removes the subscriber from the list.
hrt_abstime _last_update
time the object was last updated
bool appears_updated(SubscriberData *sd)
Check whether a topic appears updated to a subscriber.
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
bool is_advertised() const
Return true if this topic has been advertised.
const uint8_t _instance
orb multi instance identifier
uint8_t get_instance() const
int close(cdev::file_t *filp) override
Method to close a subscriber for this topic.
static SubscriberData * filp_to_sd(cdev::file_t *filp)
const orb_metadata * get_meta() const
ssize_t read(cdev::file_t *filp, char *buffer, size_t buflen) override
reads data from a subscriber node to the buffer provided.
void add_internal_subscriber()
Add the subscriber to the node's list of subscriber.
unsigned interval
if nonzero minimum interval between updates
bool copy(void *dst, unsigned &generation)
Copies data and the corresponding generation from a node to the buffer provided.
bool register_callback(SubscriptionCallback *callback_sub)
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, uint8_t priority, uint8_t queue_size=1)
List< uORB::SubscriptionCallback * > _callbacks
static int unadvertise(orb_advert_t handle)
int ioctl(cdev::file_t *filp, int cmd, unsigned long arg) override
IOCTL control for the subscriber.
bool print_statistics(bool reset)
Print statistics (nr of lost messages)
uint8_t _queue_size
maximum number of elements in the queue
const char * get_name() const
bool _advertised
has ever been advertised (not necessarily published data yet)