uORB Subscription callbacks with WorkItem scheduling on publication (#12207)

This commit is contained in:
Daniel Agar
2019-06-17 16:26:06 +02:00
committed by GitHub
parent beaba44e5b
commit 136962d125
11 changed files with 375 additions and 6 deletions
+8
View File
@@ -45,6 +45,7 @@ namespace uORB
class DeviceNode;
class DeviceMaster;
class Manager;
class SubscriptionCallback;
}
/**
@@ -231,6 +232,12 @@ public:
*/
uint64_t copy_and_get_timestamp(void *dst, unsigned &generation);
// add item to list of work items to schedule on node update
bool register_callback(SubscriptionCallback *callback_sub);
// remove item from list of work items
void unregister_callback(SubscriptionCallback *callback_sub);
protected:
pollevent_t poll_state(cdev::file_t *filp) override;
@@ -269,6 +276,7 @@ private:
uint8_t *_data{nullptr}; /**< allocated object buffer */
hrt_abstime _last_update{0}; /**< time the object was last updated */
volatile unsigned _generation{0}; /**< object generation count */
List<uORB::SubscriptionCallback *> _callbacks;
uint8_t _priority; /**< priority of the topic */
bool _published{false}; /**< has ever data been published */
uint8_t _queue_size; /**< maximum number of elements in the queue */