WIP, c++11 style callbacks for px4

This commit is contained in:
Thomas Gubler
2014-11-28 08:58:44 +01:00
parent 486d81cb95
commit 36bf0c04c8
6 changed files with 74 additions and 26 deletions
+19
View File
@@ -36,9 +36,28 @@
*
* PX4 Middleware Wrapper Nodehandle
*/
#include <px4.h>
#include <platforms/px4_nodehandle.h>
namespace px4
{
bool task_should_exit = false;
void NodeHandle::spinOnce() {
/* Loop through subscriptions, call callback for updated subscriptions */
uORB::SubscriptionNode *sub = _subs.getHead();
int count = 0;
while (sub != nullptr) {
if (count++ > kMaxSubscriptions) {
PX4_WARN("exceeded max subscriptions");
break;
}
sub->update();
sub = sub->getSibling();
}
}
}
-12
View File
@@ -59,16 +59,4 @@ bool ok()
return !task_should_exit;
}
void spin_once()
{
// XXX check linked list of topics with orb_check() here
}
void spin()
{
// XXX block waiting for updated topics here
}
}