Skip to content
Snippets Groups Projects
Commit 2cb698f0 authored by Beat Küng's avatar Beat Küng Committed by Lorenz Meier
Browse files

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.
parent c8a10503
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment