diff options
author | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-17 08:22:38 +0100 |
---|---|---|
committer | Thomas Gubler <thomasgubler@gmail.com> | 2014-12-17 08:22:38 +0100 |
commit | 9bad23e41852eba6657898d4ea46b0b303de4ae3 (patch) | |
tree | 66b456c21764057ade7b290fd9185189e606df6a /src/platforms/px4_nodehandle.h | |
parent | be269520382adbd4bea59c439599897a53109ad7 (diff) | |
download | px4-firmware-9bad23e41852eba6657898d4ea46b0b303de4ae3.tar.gz px4-firmware-9bad23e41852eba6657898d4ea46b0b303de4ae3.tar.bz2 px4-firmware-9bad23e41852eba6657898d4ea46b0b303de4ae3.zip |
add explicit non-callback contructor for nuttx/uorb subscriber to work around linker issues
Diffstat (limited to 'src/platforms/px4_nodehandle.h')
-rw-r--r-- | src/platforms/px4_nodehandle.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/platforms/px4_nodehandle.h b/src/platforms/px4_nodehandle.h index 8879148a3..160886810 100644 --- a/src/platforms/px4_nodehandle.h +++ b/src/platforms/px4_nodehandle.h @@ -179,6 +179,26 @@ public: } /** + * Subscribe without callback to function + * @param meta Describes the topic which nodehande should subscribe to + * @param interval Minimal interval between data fetches from orb + */ + + template<typename M> + Subscriber<M> *subscribe(const struct orb_metadata *meta, + unsigned interval) + { + SubscriberUORB<M> *sub_px4 = new SubscriberUORB<M>(meta, interval, &_subs); + + /* Check if this is the smallest interval so far and update _sub_min_interval */ + if (_sub_min_interval == nullptr || _sub_min_interval->getInterval() > sub_px4->getInterval()) { + _sub_min_interval = sub_px4; + } + + return (Subscriber<M> *)sub_px4; + } + + /** * Advertise topic * @param meta Describes the topic which is advertised */ |