mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-22 10:03:35 +08:00
uORB Subscription callbacks with WorkItem scheduling on publication (#12207)
This commit is contained in:
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user