36 #include "uORBCommon.hpp" 37 #include "uORBDeviceMaster.hpp" 39 #include <lib/cdev/CDev.hpp> 57 uint8_t queue_size = 1);
116 #ifdef ORB_COMMUNICATOR 117 static int16_t topic_advertised(
const orb_metadata *meta,
int priority);
128 int16_t process_add_subscription(int32_t rateInHz);
133 int16_t process_remove_subscription();
138 int16_t process_received_message(int32_t length, uint8_t *data);
181 uint8_t get_queue_size()
const {
return _queue_size; }
183 int8_t subscriber_count()
const {
return _subscriber_count; }
185 uint32_t lost_message_count()
const {
return _lost_messages; }
187 unsigned published_message_count()
const {
return _generation; }
191 const char *get_name()
const {
return _meta->
o_name; }
193 uint8_t get_instance()
const {
return _instance; }
195 int get_priority()
const {
return _priority; }
196 void set_priority(uint8_t priority) { _priority = priority; }
205 struct UpdateIntervalData {
208 uint64_t last_update;
211 bool update_reported;
213 struct SubscriberData {
214 ~SubscriberData() {
if (update_interval) {
delete (update_interval); } }
217 UpdateIntervalData *update_interval;
220 bool update_reported()
const {
return update_interval ? update_interval->update_reported :
false; }
221 void set_update_reported(
bool update_reported_flag)
222 {
if (update_interval) { update_interval->update_reported = update_reported_flag; } }
226 const uint8_t _instance;
227 uint8_t *_data{
nullptr};
229 volatile unsigned _generation{0};
231 bool _published{
false};
233 int8_t _subscriber_count{0};
235 px4_task_t _publisher{0};
239 uint32_t _lost_messages = 0;
242 inline static SubscriberData *filp_to_sd(
cdev::file_t *filp);
247 void update_deferred();
254 static void update_deferred_trampoline(
void *arg);
264 bool appears_updated(SubscriberData *sd);
ssize_t read(cdev::file_t *filp, char *buffer, size_t buflen) override
reads data from a subscriber node to the buffer provided.
Definition: uORBDeviceNode.cpp:168
An intrusive linked list.
int close(cdev::file_t *filp) override
Method to close a subscriber for this topic.
Definition: uORBDeviceNode.cpp:143
int update_queue_size(unsigned int queue_size)
Try to change the size of the queue.
Definition: uORBDeviceNode.cpp:771
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
Definition: uORB.h:134
Definition: uORBFastRpcChannel.hpp:44
void add_internal_subscriber()
Add the subscriber to the node's list of subscriber.
Definition: uORBDeviceNode.cpp:687
bool print_statistics(bool reset)
Print statistics (nr of lost messages)
Definition: uORBDeviceNode.cpp:667
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...
Definition: uORBDeviceNode.cpp:74
void reset(enum BMP280_BUS busid)
Reset the driver.
Definition: bmp280.cpp:743
static ssize_t publish(const orb_metadata *meta, orb_advert_t handle, const void *data)
Method to publish a data to this node.
Definition: uORBDeviceNode.cpp:383
int ioctl(cdev::file_t *filp, int cmd, unsigned long arg) override
IOCTL control for the subscriber.
Definition: uORBDeviceNode.cpp:289
void poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events) override
Internal implementation of poll_notify.
Definition: uORBDeviceNode.cpp:496
__BEGIN_DECLS typedef uint64_t hrt_abstime
Absolute time, in microsecond units.
Definition: drv_hrt.h:58
bool is_published() const
Return true if this topic has been published.
Definition: uORBDeviceNode.hpp:163
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. ...
Definition: uORBDeviceNode.cpp:221
Definition: cdev_platform.hpp:20
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...
Definition: uORBDeviceNode.cpp:481
Definition: rc_loss_alarm.cpp:50
Abstract class for any character device.
Definition: CDev.hpp:58
Definition: video_device.h:50
Callout record.
Definition: drv_hrt.h:72
Per-object device instance.
Definition: uORBDeviceNode.hpp:53
void remove_internal_subscriber()
Removes the subscriber from the list.
Definition: uORBDeviceNode.cpp:707