5 #ifndef UAVCAN_NODE_SUBSCRIBER_HPP_INCLUDED 6 #define UAVCAN_NODE_SUBSCRIBER_HPP_INCLUDED 12 #if !defined(UAVCAN_CPP_VERSION) || !defined(UAVCAN_CPP11) 13 # error UAVCAN_CPP_VERSION 16 #if UAVCAN_CPP_VERSION >= UAVCAN_CPP11 17 # include <functional> 38 template <
typename DataType_,
39 #if UAVCAN_CPP_VERSION >= UAVCAN_CPP11 40 typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>
42 typename Callback_ =
void (*)(
const ReceivedDataStructure<DataType_>&)
58 if (coerceOrFallback<bool>(callback_,
true))
75 StaticAssert<DataTypeKind(DataType::DataTypeKind) == DataTypeKindMessage>::check();
83 int start(
const Callback& callback)
87 if (!coerceOrFallback<bool>(callback,
true))
90 return -ErrInvalidParam;
94 return BaseType::startAsMessageListener();
97 using BaseType::allowAnonymousTransfers;
99 using BaseType::getFailureCount;
104 #endif // UAVCAN_NODE_SUBSCRIBER_HPP_INCLUDED
GenericSubscriber< DataType_, DataType_, TransferListener > BaseType
UAVCAN_EXPORT void handleFatalError(const char *msg)
#define UAVCAN_TRACE(...)
virtual void handleReceivedDataStruct(ReceivedDataStructure< DataType_ > &msg)
int start(const Callback &callback)