From b0cfc2d1226c2b62a6bf3aac1809458b04902728 Mon Sep 17 00:00:00 2001 From: Thomas Gubler Date: Fri, 28 Nov 2014 13:59:32 +0100 Subject: [PATCH] uORB::SubscriptionNode stores interval --- src/modules/uORB/Subscription.hpp | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/src/modules/uORB/Subscription.hpp b/src/modules/uORB/Subscription.hpp index bab1ef2ea5..f82586285d 100644 --- a/src/modules/uORB/Subscription.hpp +++ b/src/modules/uORB/Subscription.hpp @@ -58,10 +58,10 @@ public: /** * Constructor * - * @param meta The uORB metadata (usually from the ORB_ID() + * @param meta The uORB metadata (usually from the ORB_ID() * macro) for the topic. * - * @param interval The minimum interval in milliseconds + * @param interval The minimum interval in milliseconds * between updates */ SubscriptionBase(const struct orb_metadata *meta, @@ -126,17 +126,18 @@ public: * Constructor * * - * @param meta The uORB metadata (usually from the ORB_ID() + * @param meta The uORB metadata (usually from the ORB_ID() * macro) for the topic. - * @param interval The minimum interval in milliseconds + * @param interval The minimum interval in milliseconds * between updates - * @param list A pointer to a list of subscriptions + * @param list A pointer to a list of subscriptions * that this should be appended to. */ SubscriptionNode(const struct orb_metadata *meta, unsigned interval=0, List * list=nullptr) : - SubscriptionBase(meta, interval) { + SubscriptionBase(meta, interval), + _interval(interval) { if (list != nullptr) list->add(this); } @@ -145,6 +146,12 @@ public: * updates, a child class must implement it. */ virtual void update() = 0; +// accessors + unsigned getInterval() { return _interval; } +protected: +// attributes + unsigned _interval; + }; /** @@ -159,14 +166,14 @@ public: /** * Constructor * - * @param meta The uORB metadata (usually from + * @param meta The uORB metadata (usually from * the ORB_ID() macro) for the topic. - * @param interval The minimum interval in milliseconds + * @param interval The minimum interval in milliseconds * between updates - * @param list A list interface for adding to + * @param list A list interface for adding to * list during construction */ - Subscription(const struct orb_metadata *meta, + Subscription(const struct orb_metadata *meta, unsigned interval=0, List * list=nullptr); /**