diff --git a/libuavcan/include/uavcan/service_client.hpp b/libuavcan/include/uavcan/service_client.hpp index bc42b5eff6..9e0e07a99b 100644 --- a/libuavcan/include/uavcan/service_client.hpp +++ b/libuavcan/include/uavcan/service_client.hpp @@ -88,13 +88,14 @@ private: handleFatalError("Invalid caller callback"); } - void handleReceivedDataStruct(ReceivedDataStructure& request) + void handleReceivedDataStruct(ReceivedDataStructure& response) { + assert(response.getTransferType() == TransferTypeServiceResponse); const TransferListenerType* const listener = SubscriberType::getTransferListener(); if (listener) { const typename TransferListenerType::ExpectedResponseParams erp = listener->getExpectedResponseParams(); - ServiceCallResultType result(ServiceCallResultType::Success, erp.src_node_id, request); + ServiceCallResultType result(ServiceCallResultType::Success, erp.src_node_id, response); cancel(); invokeCallback(result); } diff --git a/libuavcan/include/uavcan/service_server.hpp b/libuavcan/include/uavcan/service_server.hpp index a3f37500c1..cbe8e436ff 100644 --- a/libuavcan/include/uavcan/service_server.hpp +++ b/libuavcan/include/uavcan/service_server.hpp @@ -38,6 +38,7 @@ private: void handleReceivedDataStruct(ReceivedDataStructure& request) { + assert(request.getTransferType() == TransferTypeServiceRequest); if (try_implicit_cast(callback_, true)) { response_ = ResponseType(); // The application needs newly initialized structure