diff --git a/src/lib/dataman_client/DatamanClient.cpp b/src/lib/dataman_client/DatamanClient.cpp index 1fa4820fef16..aeaa65c55c1a 100644 --- a/src/lib/dataman_client/DatamanClient.cpp +++ b/src/lib/dataman_client/DatamanClient.cpp @@ -42,7 +42,7 @@ DatamanClient::DatamanClient() _dataman_request_pub.advertise(); _dataman_response_sub = orb_subscribe(ORB_ID(dataman_response)); - if (_dataman_response_sub < 0) { + if (!orb_sub_valid(_dataman_response_sub)) { PX4_ERR("Failed to subscribe (%i)", errno); } else { @@ -74,7 +74,7 @@ DatamanClient::DatamanClient() DatamanClient::~DatamanClient() { - if (_dataman_response_sub >= 0) { + if (orb_sub_valid(_dataman_response_sub)) { orb_unsubscribe(_dataman_response_sub); } } diff --git a/src/lib/dataman_client/DatamanClient.hpp b/src/lib/dataman_client/DatamanClient.hpp index 3fa6d8206505..4d6dbd12cbf4 100644 --- a/src/lib/dataman_client/DatamanClient.hpp +++ b/src/lib/dataman_client/DatamanClient.hpp @@ -32,6 +32,8 @@ ****************************************************************************/ #pragma once +#include + #include #include #include @@ -178,7 +180,7 @@ class DatamanClient Request _active_request{}; uint8_t _response_status{}; - int32_t _dataman_response_sub{}; + orb_sub_t _dataman_response_sub{}; uORB::Publication _dataman_request_pub{ORB_ID(dataman_request)}; px4_pollfd_struct_t _fds; diff --git a/src/modules/dataman/dataman.cpp b/src/modules/dataman/dataman.cpp index eb25328a5bf0..1b1a0b600ec0 100644 --- a/src/modules/dataman/dataman.cpp +++ b/src/modules/dataman/dataman.cpp @@ -655,9 +655,9 @@ task_main(int argc, char *argv[]) g_task_should_exit = false; uORB::Publication dataman_response_pub{ORB_ID(dataman_response)}; - const int dataman_request_sub = orb_subscribe(ORB_ID(dataman_request)); + const orb_sub_t dataman_request_sub = orb_subscribe(ORB_ID(dataman_request)); - if (dataman_request_sub < 0) { + if (!orb_sub_valid(dataman_request_sub)) { PX4_ERR("Failed to subscribe (%i)", errno); }