Skip to content

Commit

Permalink
lib/dataman: Port dataman/datamanclient to new uORB
Browse files Browse the repository at this point in the history
  • Loading branch information
pussuw committed Dec 11, 2023
1 parent 64762fe commit bd6ac83
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/lib/dataman_client/DatamanClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/lib/dataman_client/DatamanClient.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
****************************************************************************/
#pragma once

#include <px4_platform_common/posix.h>

#include <uORB/uORB.h>
#include <uORB/Publication.hpp>
#include <uORB/Subscription.hpp>
Expand Down Expand Up @@ -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_s> _dataman_request_pub{ORB_ID(dataman_request)};

px4_pollfd_struct_t _fds;
Expand Down
4 changes: 2 additions & 2 deletions src/modules/dataman/dataman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,9 +655,9 @@ task_main(int argc, char *argv[])
g_task_should_exit = false;

uORB::Publication<dataman_response_s> 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);
}

Expand Down

0 comments on commit bd6ac83

Please sign in to comment.