mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 05:53:33 +08:00
Callback type made visible
This commit is contained in:
@@ -71,9 +71,9 @@ static Stream& operator<<(Stream& s, const ServiceCallResult<DataType>& scr)
|
|||||||
|
|
||||||
template <typename DataType_,
|
template <typename DataType_,
|
||||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
typename Callback = std::function<void (const ServiceCallResult<DataType_>&)>
|
typename Callback_ = std::function<void (const ServiceCallResult<DataType_>&)>
|
||||||
#else
|
#else
|
||||||
typename Callback = void (*)(const ServiceCallResult<DataType_>&)
|
typename Callback_ = void (*)(const ServiceCallResult<DataType_>&)
|
||||||
#endif
|
#endif
|
||||||
>
|
>
|
||||||
class ServiceClient
|
class ServiceClient
|
||||||
@@ -86,6 +86,7 @@ public:
|
|||||||
typedef typename DataType::Request RequestType;
|
typedef typename DataType::Request RequestType;
|
||||||
typedef typename DataType::Response ResponseType;
|
typedef typename DataType::Response ResponseType;
|
||||||
typedef ServiceCallResult<DataType> ServiceCallResultType;
|
typedef ServiceCallResult<DataType> ServiceCallResultType;
|
||||||
|
typedef Callback_ Callback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef ServiceClient<DataType, Callback> SelfType;
|
typedef ServiceClient<DataType, Callback> SelfType;
|
||||||
|
|||||||
@@ -21,11 +21,11 @@ namespace uavcan
|
|||||||
|
|
||||||
template <typename DataType_,
|
template <typename DataType_,
|
||||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
typename Callback = std::function<void (const ReceivedDataStructure<typename DataType_::Request>&,
|
typename Callback_ = std::function<void (const ReceivedDataStructure<typename DataType_::Request>&,
|
||||||
typename DataType_::Response&)>,
|
typename DataType_::Response&)>,
|
||||||
#else
|
#else
|
||||||
typename Callback = void (*)(const ReceivedDataStructure<typename DataType_::Request>&,
|
typename Callback_ = void (*)(const ReceivedDataStructure<typename DataType_::Request>&,
|
||||||
typename DataType_::Response&),
|
typename DataType_::Response&),
|
||||||
#endif
|
#endif
|
||||||
unsigned NumStaticReceivers = 2,
|
unsigned NumStaticReceivers = 2,
|
||||||
unsigned NumStaticBufs = 1>
|
unsigned NumStaticBufs = 1>
|
||||||
@@ -38,6 +38,7 @@ public:
|
|||||||
typedef DataType_ DataType;
|
typedef DataType_ DataType;
|
||||||
typedef typename DataType::Request RequestType;
|
typedef typename DataType::Request RequestType;
|
||||||
typedef typename DataType::Response ResponseType;
|
typedef typename DataType::Response ResponseType;
|
||||||
|
typedef Callback_ Callback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef typename TransferListenerInstantiationHelper<RequestType, NumStaticReceivers, NumStaticBufs>::Type
|
typedef typename TransferListenerInstantiationHelper<RequestType, NumStaticReceivers, NumStaticBufs>::Type
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ namespace uavcan
|
|||||||
|
|
||||||
template <typename DataType_,
|
template <typename DataType_,
|
||||||
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
#if UAVCAN_CPP_VERSION >= UAVCAN_CPP11
|
||||||
typename Callback = std::function<void (const ReceivedDataStructure<DataType_>&)>,
|
typename Callback_ = std::function<void (const ReceivedDataStructure<DataType_>&)>,
|
||||||
#else
|
#else
|
||||||
typename Callback = void (*)(const ReceivedDataStructure<DataType_>&),
|
typename Callback_ = void (*)(const ReceivedDataStructure<DataType_>&),
|
||||||
#endif
|
#endif
|
||||||
unsigned NumStaticReceivers = 2,
|
unsigned NumStaticReceivers = 2,
|
||||||
unsigned NumStaticBufs = 1>
|
unsigned NumStaticBufs = 1>
|
||||||
@@ -32,6 +32,10 @@ class Subscriber : public GenericSubscriber<DataType_, DataType_,
|
|||||||
NumStaticReceivers,
|
NumStaticReceivers,
|
||||||
NumStaticBufs>::Type>
|
NumStaticBufs>::Type>
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef Callback_ Callback;
|
||||||
|
|
||||||
|
private:
|
||||||
typedef typename TransferListenerInstantiationHelper<DataType_, NumStaticReceivers, NumStaticBufs>::Type
|
typedef typename TransferListenerInstantiationHelper<DataType_, NumStaticReceivers, NumStaticBufs>::Type
|
||||||
TransferListenerType;
|
TransferListenerType;
|
||||||
typedef GenericSubscriber<DataType_, DataType_, TransferListenerType> BaseType;
|
typedef GenericSubscriber<DataType_, DataType_, TransferListenerType> BaseType;
|
||||||
|
|||||||
@@ -64,9 +64,13 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback_>
|
||||||
class TimerEventForwarder : public TimerBase
|
class TimerEventForwarder : public TimerBase
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
typedef Callback_ Callback;
|
||||||
|
|
||||||
|
private:
|
||||||
Callback callback_;
|
Callback callback_;
|
||||||
|
|
||||||
void handleTimerEvent(const TimerEvent& event)
|
void handleTimerEvent(const TimerEvent& event)
|
||||||
|
|||||||
Reference in New Issue
Block a user