mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 02:43:34 +08:00
uorb: allow an orb subscription to retrieve data that was published prior to subscribe
This commit is contained in:
@@ -146,13 +146,8 @@ uORB::DeviceNode::open(device::file_t *filp)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If queue size >1, allow the subscriber to read the data in the queue. Otherwise, assume subscriber is up to date.*/
|
/* If there were any previous publications, allow the subscriber to read them */
|
||||||
if (_queue_size <= 1) {
|
sd->generation = _generation - (_queue_size < _generation ? _queue_size : _generation);
|
||||||
sd->generation = _generation;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
sd->generation = _generation - (_queue_size < _generation ? _queue_size : _generation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* set priority */
|
/* set priority */
|
||||||
sd->set_priority(_priority);
|
sd->set_priority(_priority);
|
||||||
|
|||||||
@@ -186,6 +186,9 @@ public:
|
|||||||
* in order to wait for updates to a topic, as well as topic_read,
|
* in order to wait for updates to a topic, as well as topic_read,
|
||||||
* orb_check and orb_stat.
|
* orb_check and orb_stat.
|
||||||
*
|
*
|
||||||
|
* If there were any publications of the topic prior to the subscription,
|
||||||
|
* an orb_check right after orb_subscribe will return true.
|
||||||
|
*
|
||||||
* Subscription will succeed even if the topic has not been advertised;
|
* Subscription will succeed even if the topic has not been advertised;
|
||||||
* in this case the topic will have a timestamp of zero, it will never
|
* in this case the topic will have a timestamp of zero, it will never
|
||||||
* signal a poll() event, checking will always return false and it cannot
|
* signal a poll() event, checking will always return false and it cannot
|
||||||
@@ -213,6 +216,9 @@ public:
|
|||||||
* in order to wait for updates to a topic, as well as topic_read,
|
* in order to wait for updates to a topic, as well as topic_read,
|
||||||
* orb_check and orb_stat.
|
* orb_check and orb_stat.
|
||||||
*
|
*
|
||||||
|
* If there were any publications of the topic prior to the subscription,
|
||||||
|
* an orb_check right after orb_subscribe_multi will return true.
|
||||||
|
*
|
||||||
* Subscription will succeed even if the topic has not been advertised;
|
* Subscription will succeed even if the topic has not been advertised;
|
||||||
* in this case the topic will have a timestamp of zero, it will never
|
* in this case the topic will have a timestamp of zero, it will never
|
||||||
* signal a poll() event, checking will always return false and it cannot
|
* signal a poll() event, checking will always return false and it cannot
|
||||||
|
|||||||
Reference in New Issue
Block a user