mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
orb_exists support for muorb
Also added builtin command wait_for_topic Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Lorenz Meier
parent
dc787830b5
commit
62a3e07423
@@ -131,11 +131,15 @@ int uORB::Manager::orb_exists(const struct orb_metadata *meta, int instance)
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
#ifdef __PX4_NUTTX
|
||||
#if __PX4_NUTTX
|
||||
struct stat buffer;
|
||||
return stat(path, &buffer);
|
||||
#else
|
||||
return px4_access(path, F_OK);
|
||||
ret = px4_access(path, F_OK);
|
||||
if (ret == -1 && meta != nullptr && _remote_topics.size() > 0) {
|
||||
ret = (_remote_topics.find(meta->o_name) != _remote_topics.end());
|
||||
}
|
||||
return ret;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -197,6 +201,9 @@ orb_advert_t uORB::Manager::orb_advertise_multi(const struct orb_metadata *meta,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//For remote systems call over and inform them
|
||||
uORB::DeviceNode::topic_advertised(meta, priority);
|
||||
|
||||
/* the advertiser must perform an initial publish to initialise the object */
|
||||
result = orb_publish(meta, advertiser, data);
|
||||
|
||||
@@ -433,6 +440,23 @@ uORBCommunicator::IChannel *uORB::Manager::get_uorb_communicator(void)
|
||||
return _comm_channel;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
int16_t uORB::Manager::process_remote_topic(const char *topic_name, bool isAdvertisement)
|
||||
{
|
||||
warnx("[posix-uORB::Manager::process_remote_topic(%d)] name: %s, isAdver: %d",
|
||||
__LINE__, topic_name, isAdvertisement);
|
||||
int16_t rc = 0;
|
||||
|
||||
if (isAdvertisement) {
|
||||
_remote_topics.insert(topic_name);
|
||||
} else {
|
||||
_remote_topics.erase(topic_name);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
int16_t uORB::Manager::process_add_subscription(const char *messageName,
|
||||
|
||||
Reference in New Issue
Block a user