uORB::Publication improvements and cleanup (#14784)

- create common uORB::PublicationBase
 - uORB::PublicationQueued types are now type aliases
 - ORB_PRIO use enum type everywhere to avoid accidental misuse
 - PX4Accelerometer/PX4Gyroscope/etc driver libs explicitly advertise on construction, unadvertise on destruction. This is a workaround for any potential issues that might appear when accel/gyro cdev and uORB indexing doesn't align.
This commit is contained in:
Daniel Agar
2020-05-04 11:09:30 -04:00
committed by GitHub
parent 8e2c52a31a
commit 466b5db36f
68 changed files with 218 additions and 381 deletions
-2
View File
@@ -43,8 +43,6 @@ if(NOT "${PX4_BOARD}" MATCHES "px4_io") # TODO: fix this hack (move uORB to plat
ORBSet.hpp
Publication.hpp
PublicationMulti.hpp
PublicationQueued.hpp
PublicationQueuedMulti.hpp
Subscription.cpp
Subscription.hpp
SubscriptionCallback.hpp
+55 -22
View File
@@ -40,16 +40,47 @@
#include <px4_platform_common/defines.h>
#include <systemlib/err.h>
#include <uORB/uORB.h>
#include "uORBDeviceNode.hpp"
#include <uORB/topics/uORBTopics.hpp>
namespace uORB
{
class PublicationBase
{
public:
bool advertised() const { return _handle != nullptr; }
bool unadvertise() { return (DeviceNode::unadvertise(_handle) == PX4_OK); }
orb_id_t get_topic() const { return get_orb_meta(_orb_id); }
protected:
PublicationBase(ORB_ID id) : _orb_id(id) {}
~PublicationBase()
{
if (_handle != nullptr) {
// don't automatically unadvertise queued publications (eg vehicle_command)
if (static_cast<DeviceNode *>(_handle)->get_queue_size() == 1) {
unadvertise();
}
}
}
orb_advert_t _handle{nullptr};
const ORB_ID _orb_id;
};
/**
* Base publication wrapper class
* uORB publication wrapper class
*/
template<typename T>
class Publication
template<typename T, uint8_t ORB_QSIZE = 1>
class Publication : public PublicationBase
{
public:
@@ -58,8 +89,17 @@ public:
*
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
*/
Publication(const orb_metadata *meta) : _meta(meta) {}
~Publication() { orb_unadvertise(_handle); }
Publication(ORB_ID id) : PublicationBase(id) {}
Publication(const orb_metadata *meta) : PublicationBase(static_cast<ORB_ID>(meta->o_id)) {}
bool advertise()
{
if (!advertised()) {
_handle = orb_advertise_queue(get_topic(), nullptr, ORB_QSIZE);
}
return advertised();
}
/**
* Publish the struct
@@ -67,25 +107,12 @@ public:
*/
bool publish(const T &data)
{
if (_handle != nullptr) {
return (orb_publish(_meta, _handle, &data) == PX4_OK);
} else {
orb_advert_t handle = orb_advertise(_meta, &data);
if (handle != nullptr) {
_handle = handle;
return true;
}
if (!advertised()) {
advertise();
}
return false;
return (DeviceNode::publish(get_topic(), _handle, &data) == PX4_OK);
}
protected:
const orb_metadata *_meta;
orb_advert_t _handle{nullptr};
};
/**
@@ -100,8 +127,8 @@ public:
*
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
*/
PublicationData(ORB_ID id) : Publication<T>(id) {}
PublicationData(const orb_metadata *meta) : Publication<T>(meta) {}
~PublicationData() = default;
T &get() { return _data; }
void set(const T &data) { _data = data; }
@@ -118,4 +145,10 @@ private:
T _data{};
};
template<class T>
using PublicationQueued = Publication<T, T::ORB_QUEUE_LENGTH>;
} // namespace uORB
+32 -25
View File
@@ -42,14 +42,16 @@
#include <systemlib/err.h>
#include <uORB/uORB.h>
#include "Publication.hpp"
namespace uORB
{
/**
* Base publication multi wrapper class
*/
template<typename T>
class PublicationMulti
template<typename T, uint8_t QSIZE = 1>
class PublicationMulti : public PublicationBase
{
public:
@@ -59,12 +61,25 @@ public:
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
* @param priority The priority for multi pub/sub, 0 means don't publish as multi
*/
PublicationMulti(const orb_metadata *meta, uint8_t priority = ORB_PRIO_DEFAULT) :
_meta(meta),
PublicationMulti(ORB_ID id, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
PublicationBase(id),
_priority(priority)
{}
~PublicationMulti() { orb_unadvertise(_handle); }
PublicationMulti(const orb_metadata *meta, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
PublicationBase(static_cast<ORB_ID>(meta->o_id)),
_priority(priority)
{}
bool advertise()
{
if (!advertised()) {
int instance = 0;
_handle = orb_advertise_multi_queue(get_topic(), nullptr, &instance, _priority, QSIZE);
}
return advertised();
}
/**
* Publish the struct
@@ -72,28 +87,15 @@ public:
*/
bool publish(const T &data)
{
if (_handle != nullptr) {
return (orb_publish(_meta, _handle, &data) == PX4_OK);
} else {
int instance = 0;
orb_advert_t handle = orb_advertise_multi(_meta, &data, &instance, _priority);
if (handle != nullptr) {
_handle = handle;
return true;
}
if (!advertised()) {
advertise();
}
return false;
return (orb_publish(get_topic(), _handle, &data) == PX4_OK);
}
protected:
const orb_metadata *_meta;
orb_advert_t _handle{nullptr};
const uint8_t _priority;
const ORB_PRIO _priority;
};
/**
@@ -109,12 +111,13 @@ public:
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
* @param priority The priority for multi pub
*/
PublicationMultiData(const orb_metadata *meta, uint8_t priority = ORB_PRIO_DEFAULT) :
PublicationMultiData(ORB_ID id, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
PublicationMulti<T>(id, priority)
{}
PublicationMultiData(const orb_metadata *meta, ORB_PRIO priority = ORB_PRIO_DEFAULT) :
PublicationMulti<T>(meta, priority)
{}
~PublicationMultiData() = default;
T &get() { return _data; }
void set(const T &data) { _data = data; }
@@ -130,4 +133,8 @@ private:
T _data{};
};
template<class T>
using PublicationQueuedMulti = PublicationMulti<T, T::ORB_QUEUE_LENGTH>;
} // namespace uORB
-94
View File
@@ -1,94 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file PublicationQueued.hpp
*
*/
#pragma once
#include <px4_platform_common/defines.h>
#include <systemlib/err.h>
#include <uORB/uORB.h>
namespace uORB
{
/**
* Queued publication with queue length set as a message constant (ORB_QUEUE_LENGTH)
*/
template<typename T>
class PublicationQueued
{
public:
/**
* Constructor
*
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
*/
PublicationQueued(const orb_metadata *meta) : _meta(meta) {}
~PublicationQueued()
{
//orb_unadvertise(_handle);
}
/**
* Publish the struct
* @param data The uORB message struct we are updating.
*/
bool publish(const T &data)
{
if (_handle != nullptr) {
return (orb_publish(_meta, _handle, &data) == PX4_OK);
} else {
orb_advert_t handle = orb_advertise_queue(_meta, &data, T::ORB_QUEUE_LENGTH);
if (handle != nullptr) {
_handle = handle;
return true;
}
}
return false;
}
protected:
const orb_metadata *_meta;
orb_advert_t _handle{nullptr};
};
} // namespace uORB
-101
View File
@@ -1,101 +0,0 @@
/****************************************************************************
*
* Copyright (c) 2020 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/**
* @file PublicationQueuedMulti.hpp
*
*/
#pragma once
#include <px4_platform_common/defines.h>
#include <systemlib/err.h>
#include <uORB/uORB.h>
namespace uORB
{
/**
* Queued publication with queue length set as a message constant (ORB_QUEUE_LENGTH)
*/
template<typename T>
class PublicationQueuedMulti
{
public:
/**
* Constructor
*
* @param meta The uORB metadata (usually from the ORB_ID() macro) for the topic.
*/
PublicationQueuedMulti(const orb_metadata *meta, uint8_t priority = ORB_PRIO_DEFAULT) :
_meta(meta),
_priority(priority)
{}
~PublicationQueuedMulti()
{
//orb_unadvertise(_handle);
}
/**
* Publish the struct
* @param data The uORB message struct we are updating.
*/
bool publish(const T &data)
{
if (_handle != nullptr) {
return (orb_publish(_meta, _handle, &data) == PX4_OK);
} else {
int instance = 0;
orb_advert_t handle = orb_advertise_multi_queue(_meta, &data, &instance, _priority, T::ORB_QUEUE_LENGTH);
if (handle != nullptr) {
_handle = handle;
return true;
}
}
return false;
}
protected:
const orb_metadata *_meta;
orb_advert_t _handle{nullptr};
const uint8_t _priority;
};
} // namespace uORB
+3 -4
View File
@@ -50,14 +50,13 @@ orb_advert_t orb_advertise_queue(const struct orb_metadata *meta, const void *da
return uORB::Manager::get_instance()->orb_advertise(meta, data, queue_size);
}
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
int priority)
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, ORB_PRIO priority)
{
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance, priority);
}
orb_advert_t orb_advertise_multi_queue(const struct orb_metadata *meta, const void *data, int *instance,
int priority, unsigned int queue_size)
ORB_PRIO priority, unsigned int queue_size)
{
return uORB::Manager::get_instance()->orb_advertise_multi(meta, data, instance, priority, queue_size);
}
@@ -113,7 +112,7 @@ int orb_group_count(const struct orb_metadata *meta)
return instance;
}
int orb_priority(int handle, int32_t *priority)
int orb_priority(int handle, enum ORB_PRIO *priority)
{
return uORB::Manager::get_instance()->orb_priority(handle, priority);
}
+4 -5
View File
@@ -152,13 +152,13 @@ extern orb_advert_t orb_advertise_queue(const struct orb_metadata *meta, const v
* @see uORB::Manager::orb_advertise_multi()
*/
extern orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
int priority) __EXPORT;
enum ORB_PRIO priority) __EXPORT;
/**
* @see uORB::Manager::orb_advertise_multi()
*/
extern orb_advert_t orb_advertise_multi_queue(const struct orb_metadata *meta, const void *data, int *instance,
int priority, unsigned int queue_size) __EXPORT;
enum ORB_PRIO priority, unsigned int queue_size) __EXPORT;
/**
* @see uORB::Manager::orb_unadvertise()
@@ -179,8 +179,7 @@ extern int orb_publish(const struct orb_metadata *meta, orb_advert_t handle, con
* @see uORB::Manager::orb_advertise_multi() for meaning of the individual parameters
*/
static inline int orb_publish_auto(const struct orb_metadata *meta, orb_advert_t *handle, const void *data,
int *instance,
int priority)
int *instance, enum ORB_PRIO priority)
{
if (!*handle) {
*handle = orb_advertise_multi(meta, data, instance, priority);
@@ -237,7 +236,7 @@ extern int orb_group_count(const struct orb_metadata *meta) __EXPORT;
/**
* @see uORB::Manager::orb_priority()
*/
extern int orb_priority(int handle, int32_t *priority) __EXPORT;
extern int orb_priority(int handle, enum ORB_PRIO *priority) __EXPORT;
/**
* @see uORB::Manager::orb_set_interval()
+1 -1
View File
@@ -47,7 +47,7 @@ static constexpr unsigned orb_maxpath = 64;
struct orb_advertdata {
const struct orb_metadata *meta;
int *instance;
int priority;
ORB_PRIO priority;
};
}
+1 -2
View File
@@ -58,8 +58,7 @@ uORB::DeviceMaster::~DeviceMaster()
px4_sem_destroy(&_lock);
}
int
uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, int priority)
int uORB::DeviceMaster::advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, ORB_PRIO priority)
{
int ret = PX4_ERROR;
+1 -1
View File
@@ -65,7 +65,7 @@ class uORB::DeviceMaster
{
public:
int advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, int priority);
int advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, ORB_PRIO priority);
/**
* Public interface for getDeviceNodeLocked(). Takes care of synchronization.
+4 -4
View File
@@ -55,11 +55,11 @@ uORB::DeviceNode::SubscriberData *uORB::DeviceNode::filp_to_sd(cdev::file_t *fil
}
uORB::DeviceNode::DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path,
uint8_t priority, uint8_t queue_size) :
ORB_PRIO priority, uint8_t queue_size) :
CDev(path),
_meta(meta),
_instance(instance),
_priority(priority),
_instance(instance),
_queue_size(queue_size)
{
}
@@ -432,7 +432,7 @@ int uORB::DeviceNode::unadvertise(orb_advert_t handle)
}
#ifdef ORB_COMMUNICATOR
int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta, int priority)
int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta, ORB_PRIO priority)
{
uORBCommunicator::IChannel *ch = uORB::Manager::get_instance()->get_uorb_communicator();
@@ -445,7 +445,7 @@ int16_t uORB::DeviceNode::topic_advertised(const orb_metadata *meta, int priorit
/*
//TODO: Check if we need this since we only unadvertise when things all shutdown and it doesn't actually remove the device
int16_t uORB::DeviceNode::topic_unadvertised(const orb_metadata *meta, int priority)
int16_t uORB::DeviceNode::topic_unadvertised(const orb_metadata *meta, ORB_PRIO priority)
{
uORBCommunicator::IChannel *ch = uORB::Manager::get_instance()->get_uorb_communicator();
if (ch != nullptr && meta != nullptr) {
+4 -4
View File
@@ -55,7 +55,7 @@ class SubscriptionCallback;
class uORB::DeviceNode : public cdev::CDev, public ListNode<uORB::DeviceNode *>
{
public:
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, uint8_t priority,
DeviceNode(const struct orb_metadata *meta, const uint8_t instance, const char *path, ORB_PRIO priority,
uint8_t queue_size = 1);
virtual ~DeviceNode();
@@ -116,8 +116,8 @@ public:
static int unadvertise(orb_advert_t handle);
#ifdef ORB_COMMUNICATOR
static int16_t topic_advertised(const orb_metadata *meta, int priority);
//static int16_t topic_unadvertised(const orb_metadata *meta, int priority);
static int16_t topic_advertised(const orb_metadata *meta, ORB_PRIO priority);
//static int16_t topic_unadvertised(const orb_metadata *meta, ORB_PRIO priority);
/**
* processes a request for add subscription from remote
@@ -263,8 +263,8 @@ private:
uint32_t _lost_messages = 0; /**< nr of lost messages for all subscribers. If two subscribers lose the same
message, it is counted as two. */
ORB_PRIO _priority; /**< priority of the topic */
const uint8_t _instance; /**< orb multi instance identifier */
uint8_t _priority; /**< priority of the topic */
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};
+26 -44
View File
@@ -168,7 +168,7 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance)
}
orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
int priority, unsigned int queue_size)
ORB_PRIO priority, unsigned int queue_size)
{
#ifdef ORB_USE_PUBLISHER_RULES
@@ -227,12 +227,14 @@ orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta,
uORB::DeviceNode::topic_advertised(meta, priority);
#endif /* ORB_COMMUNICATOR */
/* the advertiser must perform an initial publish to initialise the object */
result = orb_publish(meta, advertiser, data);
/* the advertiser may perform an initial publish to initialise the object */
if (data != nullptr) {
result = orb_publish(meta, advertiser, data);
if (result == PX4_ERROR) {
PX4_WARN("orb_publish failed");
return nullptr;
if (result == PX4_ERROR) {
PX4_ERR("orb_publish failed %s", meta->o_name);
return nullptr;
}
}
return advertiser;
@@ -305,7 +307,7 @@ int uORB::Manager::orb_check(int handle, bool *updated)
return px4_ioctl(handle, ORBIOCUPDATED, (unsigned long)(uintptr_t)updated);
}
int uORB::Manager::orb_priority(int handle, int32_t *priority)
int uORB::Manager::orb_priority(int handle, enum ORB_PRIO *priority)
{
return px4_ioctl(handle, ORBIOCGPRIORITY, (unsigned long)(uintptr_t)priority);
}
@@ -322,23 +324,7 @@ int uORB::Manager::orb_get_interval(int handle, unsigned *interval)
return ret;
}
int uORB::Manager::node_advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance, int priority)
{
int ret = PX4_ERROR;
if (get_device_master()) {
ret = _device_master->advertise(meta, is_advertiser, instance, priority);
}
/* it's PX4_OK if it already exists */
if ((PX4_OK != ret) && (EEXIST == errno)) {
ret = PX4_OK;
}
return ret;
}
int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, int *instance, int priority)
int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, int *instance, ORB_PRIO priority)
{
char path[orb_maxpath];
int fd = -1;
@@ -376,36 +362,32 @@ int uORB::Manager::node_open(const struct orb_metadata *meta, bool advertiser, i
/* we may need to advertise the node... */
if (fd < 0) {
/* try to create the node */
ret = node_advertise(meta, advertiser, instance, priority);
ret = PX4_ERROR;
if (get_device_master()) {
ret = _device_master->advertise(meta, advertiser, instance, priority);
}
/* it's OK if it already exists */
if ((ret != PX4_OK) && (EEXIST == errno)) {
ret = PX4_OK;
}
if (ret == PX4_OK) {
/* update the path, as it might have been updated during the node_advertise call */
/* update the path, as it might have been updated during the node advertise call */
ret = uORB::Utils::node_mkpath(path, meta, instance);
if (ret != PX4_OK) {
/* on success, try to open again */
if (ret == PX4_OK) {
fd = px4_open(path, (advertiser) ? PX4_F_WRONLY : PX4_F_RDONLY);
} else {
errno = -ret;
return PX4_ERROR;
}
}
/* on success, try to open again */
if (ret == PX4_OK) {
fd = px4_open(path, (advertiser) ? PX4_F_WRONLY : PX4_F_RDONLY);
}
}
/*
else if (advertiser) {
* We have a valid fd and are an advertiser.
* This can happen if the topic is already subscribed/published, and orb_advertise() is called,
* where instance==nullptr.
* We would need to set the priority here (via px4_ioctl(fd, ...) and a new IOCTL), but orb_advertise()
* uses ORB_PRIO_DEFAULT, and a subscriber also creates the node with ORB_PRIO_DEFAULT. So we don't need
* to do anything here.
}
*/
if (fd < 0) {
errno = EIO;
return PX4_ERROR;
+4 -10
View File
@@ -161,8 +161,8 @@ public:
* ORB_DEFINE with no corresponding ORB_DECLARE)
* this function will return -1 and set errno to ENOENT.
*/
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance,
int priority, unsigned int queue_size = 1);
orb_advert_t orb_advertise_multi(const struct orb_metadata *meta, const void *data, int *instance, ORB_PRIO priority,
unsigned int queue_size = 1);
/**
* Unadvertise a topic.
@@ -318,7 +318,7 @@ public:
* independent of the startup order of the associated publishers.
* @return OK on success, PX4_ERROR otherwise with errno set accordingly.
*/
int orb_priority(int handle, int32_t *priority);
int orb_priority(int handle, enum ORB_PRIO *priority);
/**
* Set the minimum interval between which updates are seen for a subscription.
@@ -376,12 +376,6 @@ public:
#endif /* ORB_COMMUNICATOR */
private: // class methods
/**
* Advertise a node; don't consider it an error if the node has
* already been advertised.
*/
int node_advertise(const struct orb_metadata *meta, bool is_advertiser, int *instance = nullptr,
int priority = ORB_PRIO_DEFAULT);
/**
* Common implementation for orb_advertise and orb_subscribe.
@@ -390,7 +384,7 @@ private: // class methods
* advertisers.
*/
int node_open(const struct orb_metadata *meta, bool advertiser, int *instance = nullptr,
int priority = ORB_PRIO_DEFAULT);
ORB_PRIO priority = ORB_PRIO_DEFAULT);
private: // data members
static Manager *_Instance;
@@ -386,7 +386,7 @@ int uORBTest::UnitTest::test_multi()
}
/* test priorities */
int prio;
ORB_PRIO prio;
if (PX4_OK != orb_priority(sfd0, &prio)) {
return test_fail("prio #0");