forked from Archive/PX4-Autopilot
uORBDevices: set the priority when advertising a node that's already subscribed
This fixes the case where a topic instance is already subscribed, and advertised later. The subscriber will create the DeviceNode with default priority, and the advertiser will just use the existing DeviceNode, without updating to the requested priority.
This commit is contained in:
parent
c8a1050323
commit
2cb698f01f
|
@ -927,6 +927,7 @@ uORB::DeviceMaster::ioctl(device::file_t *filp, int cmd, unsigned long arg)
|
|||
|
||||
if ((existing_node != nullptr) && !(existing_node->is_published())) {
|
||||
/* nothing has been published yet, lets claim it */
|
||||
existing_node->set_priority(adv->priority);
|
||||
ret = PX4_OK;
|
||||
|
||||
} else {
|
||||
|
|
|
@ -185,6 +185,8 @@ public:
|
|||
unsigned int published_message_count() const { return _generation; }
|
||||
const struct orb_metadata *get_meta() const { return _meta; }
|
||||
|
||||
void set_priority(uint8_t priority) { _priority = priority; }
|
||||
|
||||
protected:
|
||||
virtual pollevent_t poll_state(device::file_t *filp);
|
||||
virtual void poll_notify_one(px4_pollfd_struct_t *fds, pollevent_t events);
|
||||
|
@ -215,7 +217,7 @@ private:
|
|||
uint8_t *_data; /**< allocated object buffer */
|
||||
hrt_abstime _last_update; /**< time the object was last updated */
|
||||
volatile unsigned _generation; /**< object generation count */
|
||||
const uint8_t _priority; /**< priority of the topic */
|
||||
uint8_t _priority; /**< priority of the topic */
|
||||
bool _published; /**< has ever data been published */
|
||||
uint8_t _queue_size; /**< maximum number of elements in the queue */
|
||||
int16_t _subscriber_count;
|
||||
|
|
Loading…
Reference in New Issue