mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 18:47:21 +08:00
uORB: Provide used group count
This commit is contained in:
@@ -260,6 +260,20 @@ int orb_exists(const struct orb_metadata *meta, int instance)
|
|||||||
return uORB::Manager::get_instance()->orb_exists(meta, instance);
|
return uORB::Manager::get_instance()->orb_exists(meta, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of published instances of a topic group
|
||||||
|
*
|
||||||
|
* @param meta ORB topic metadata.
|
||||||
|
* @return The number of published instances of this topic
|
||||||
|
*/
|
||||||
|
int orb_group_count(const struct orb_metadata *meta)
|
||||||
|
{
|
||||||
|
unsigned group_count = 0;
|
||||||
|
while (!uORB::Manager::get_instance()->orb_exists(meta, group_count++)) {};
|
||||||
|
|
||||||
|
return group_count;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the priority of the topic
|
* Return the priority of the topic
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -328,6 +328,14 @@ extern int orb_stat(int handle, uint64_t *time) __EXPORT;
|
|||||||
*/
|
*/
|
||||||
extern int orb_exists(const struct orb_metadata *meta, int instance) __EXPORT;
|
extern int orb_exists(const struct orb_metadata *meta, int instance) __EXPORT;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of published instances of a topic group
|
||||||
|
*
|
||||||
|
* @param meta ORB topic metadata.
|
||||||
|
* @return The number of published instances of this topic
|
||||||
|
*/
|
||||||
|
extern int orb_group_count(const struct orb_metadata *meta) __EXPORT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the priority of the topic
|
* Return the priority of the topic
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user