diff --git a/src/drivers/drv_orb_dev.h b/src/drivers/drv_orb_dev.h index 060704deaa..42f8e0c35a 100644 --- a/src/drivers/drv_orb_dev.h +++ b/src/drivers/drv_orb_dev.h @@ -73,7 +73,7 @@ /** Get the minimum interval at which the topic can be seen to be updated for this subscription */ #define ORBIOCGETINTERVAL _ORBIOC(16) -/** Check whether the topic is published, sets *(unsigned long *)arg to 1 if published, 0 otherwise */ -#define ORBIOCISPUBLISHED _ORBIOC(17) +/** Check whether the topic is advertised, sets *(unsigned long *)arg to 1 if advertised, 0 otherwise */ +#define ORBIOCISADVERTISED _ORBIOC(17) #endif /* _DRV_UORB_H */ diff --git a/src/modules/uORB/uORBDeviceMaster.cpp b/src/modules/uORB/uORBDeviceMaster.cpp index 6ccdc4d016..b792e0cf1d 100644 --- a/src/modules/uORB/uORBDeviceMaster.cpp +++ b/src/modules/uORB/uORBDeviceMaster.cpp @@ -123,7 +123,7 @@ uORB::DeviceMaster::advertise(const struct orb_metadata *meta, int *instance, in * something has been published yet. */ uORB::DeviceNode *existing_node = getDeviceNodeLocked(meta, group_tries); - if ((existing_node != nullptr) && !(existing_node->is_published())) { + if (existing_node != nullptr && !existing_node->is_advertised()) { /* nothing has been published yet, lets claim it */ existing_node->set_priority(priority); ret = PX4_OK; diff --git a/src/modules/uORB/uORBDeviceNode.cpp b/src/modules/uORB/uORBDeviceNode.cpp index 2d78787663..b08627daa2 100644 --- a/src/modules/uORB/uORBDeviceNode.cpp +++ b/src/modules/uORB/uORBDeviceNode.cpp @@ -275,7 +275,7 @@ uORB::DeviceNode::write(cdev::file_t *filp, const char *buffer, size_t buflen) /* wrap-around happens after ~49 days, assuming a publisher rate of 1 kHz */ _generation++; - _published = true; + _advertised = true; ATOMIC_LEAVE; @@ -368,8 +368,8 @@ uORB::DeviceNode::ioctl(cdev::file_t *filp, int cmd, unsigned long arg) return OK; - case ORBIOCISPUBLISHED: - *(unsigned long *)arg = _published; + case ORBIOCISADVERTISED: + *(unsigned long *)arg = _advertised; return OK; @@ -447,7 +447,7 @@ int uORB::DeviceNode::unadvertise(orb_advert_t handle) * of subscribers and publishers. But we also do not have a leak since future * publishers reuse the same DeviceNode object. */ - devnode->_published = false; + devnode->_advertised = false; return PX4_OK; } diff --git a/src/modules/uORB/uORBDeviceNode.hpp b/src/modules/uORB/uORBDeviceNode.hpp index 9e5c9916a1..03d5077b78 100644 --- a/src/modules/uORB/uORBDeviceNode.hpp +++ b/src/modules/uORB/uORBDeviceNode.hpp @@ -156,11 +156,11 @@ public: void remove_internal_subscriber(); /** - * Return true if this topic has been published. + * Return true if this topic has been advertised. * * This is used in the case of multi_pub/sub to check if it's valid to advertise * and publish to this node or if another node should be tried. */ - bool is_published() const { return _published; } + bool is_advertised() const { return _advertised; } /** * Try to change the size of the queue. This can only be done as long as nobody published yet. @@ -228,7 +228,7 @@ private: hrt_abstime _last_update{0}; /**< time the object was last updated */ volatile unsigned _generation{0}; /**< object generation count */ uint8_t _priority; /**< priority of the topic */ - bool _published{false}; /**< has ever data been published */ + bool _advertised{false}; /**< has ever been advertised (not necessarily published data yet) */ uint8_t _queue_size; /**< maximum number of elements in the queue */ int8_t _subscriber_count{0}; diff --git a/src/modules/uORB/uORBManager.cpp b/src/modules/uORB/uORBManager.cpp index 20c9bf8432..1d11513404 100644 --- a/src/modules/uORB/uORBManager.cpp +++ b/src/modules/uORB/uORBManager.cpp @@ -105,7 +105,7 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance) uORB::DeviceNode *node = _device_master->getDeviceNode(meta, instance); if (node != nullptr) { - if (node->is_published()) { + if (node->is_advertised()) { return PX4_OK; } } @@ -139,10 +139,10 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance) int fd = px4_open(path, 0); if (fd >= 0) { - unsigned long is_published; + unsigned long is_advertised; - if (px4_ioctl(fd, ORBIOCISPUBLISHED, (unsigned long)&is_published) == 0) { - if (!is_published) { + if (px4_ioctl(fd, ORBIOCISADVERTISED, (unsigned long)&is_advertised) == 0) { + if (!is_advertised) { ret = PX4_ERROR; } }