forked from boston-dynamics/spot-cpp-sdk
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdata_acquisition_client.h
More file actions
136 lines (103 loc) · 6.54 KB
/
Copy pathdata_acquisition_client.h
File metadata and controls
136 lines (103 loc) · 6.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* Copyright (c) 2023 Boston Dynamics, Inc. All rights reserved.
*
* Downloading, reproducing, distributing or otherwise using the SDK Software
* is subject to the terms and conditions of the Boston Dynamics Software
* Development Kit License (20191101-BDSDK-SL).
*/
#pragma once
#include <bosdyn/api/data_acquisition_service.grpc.pb.h>
#include <bosdyn/api/data_acquisition_service.pb.h>
#include "bosdyn/client/data_acquisition/data_acquisition_error_codes.h"
#include "bosdyn/client/service_client/service_client.h"
namespace bosdyn {
namespace client {
typedef Result<::bosdyn::api::AcquireDataResponse> DataAcquisitionAcquireDataResultType;
typedef Result<::bosdyn::api::GetStatusResponse> DataAcquisitionGetStatusResultType;
typedef Result<::bosdyn::api::GetServiceInfoResponse> DataAcquisitionServiceInfoResultType;
typedef Result<::bosdyn::api::CancelAcquisitionResponse> DataAcquisitionCancelAcquisitionResultType;
typedef Result<::bosdyn::api::LiveDataResponse> DataAcquisitionLiveDataResultType;
class DataAcquisitionClient : public ServiceClient {
public:
DataAcquisitionClient() = default;
~DataAcquisitionClient() = default;
// Asynchronous RPC to trigger data acquisition to save data and metadata to the data buffer.
std::shared_future<DataAcquisitionAcquireDataResultType> AcquireDataAsync(
::bosdyn::api::AcquireDataRequest& request,
const RPCParameters& parameters = RPCParameters());
// Synchronous RPC to trigger data acquisition to save data and metadata to the data buffer.
DataAcquisitionAcquireDataResultType AcquireData(
::bosdyn::api::AcquireDataRequest& request,
const RPCParameters& parameters = RPCParameters());
// Asynchronous RPC to query the status of a data acquisition.
std::shared_future<DataAcquisitionGetStatusResultType> GetStatusAsync(
::bosdyn::api::GetStatusRequest& request,
const RPCParameters& parameters = RPCParameters());
// Synchronous RPC to query the status of a data acquisition.
DataAcquisitionGetStatusResultType GetStatus(::bosdyn::api::GetStatusRequest& request,
const RPCParameters& parameters = RPCParameters());
// Asynchronous RPC to get service info from the data acquisition service.
std::shared_future<DataAcquisitionServiceInfoResultType> GetServiceInfoAsync(
const RPCParameters& parameters = RPCParameters());
// Synchronous RPC to get service info from the data acquisition service.
DataAcquisitionServiceInfoResultType GetServiceInfo(
const RPCParameters& parameters = RPCParameters());
// Asynchronous RPC to cancel an in-progress data acquisition.
std::shared_future<DataAcquisitionCancelAcquisitionResultType> CancelAcquisitionAsync(
::bosdyn::api::CancelAcquisitionRequest& request,
const RPCParameters& parameters = RPCParameters());
// Synchronous RPC to cancel an in-progress data acquisition.
DataAcquisitionCancelAcquisitionResultType CancelAcquisition(
::bosdyn::api::CancelAcquisitionRequest& request,
const RPCParameters& parameters = RPCParameters());
// Asynchronous RPC to request live data for each capability.
std::shared_future<DataAcquisitionLiveDataResultType> GetLiveDataAsync(
::bosdyn::api::LiveDataRequest& request, const RPCParameters& parameters = RPCParameters());
// Synchronous RPC to request live data for each capability.
DataAcquisitionLiveDataResultType GetLiveData(
::bosdyn::api::LiveDataRequest& request, const RPCParameters& parameters = RPCParameters());
// Start of ServiceClient overrides.
QualityOfService GetQualityOfService() const override;
void SetComms(const std::shared_ptr<grpc::ChannelInterface>& channel) override;
// End of ServiceClient overrides.
// Get the default service name the service will be registered in the directory with.
static std::string GetDefaultServiceName() { return s_default_service_name; }
// Get the default service type for the image service that will be registered in the directory.
static std::string GetServiceType() { return s_service_type; }
private:
// Callback function registered for the asynchronous calls to acquire data.
void OnAcquireDataComplete(MessagePumpCallBase* call,
const ::bosdyn::api::AcquireDataRequest& request,
::bosdyn::api::AcquireDataResponse&& response,
const grpc::Status& status,
std::promise<DataAcquisitionAcquireDataResultType> promise);
// Callback function registered for the asynchronous calls to get status.
void OnGetStatusComplete(MessagePumpCallBase* call,
const ::bosdyn::api::GetStatusRequest& request,
::bosdyn::api::GetStatusResponse&& response,
const grpc::Status& status,
std::promise<DataAcquisitionGetStatusResultType> promise);
// Callback function registered for the asynchronous calls to get service info.
void OnGetServiceInfoComplete(MessagePumpCallBase* call,
const ::bosdyn::api::GetServiceInfoRequest& request,
::bosdyn::api::GetServiceInfoResponse&& response,
const grpc::Status& status,
std::promise<DataAcquisitionServiceInfoResultType> promise);
// Callback function registered for the asynchronous calls to cancel acquisition.
void OnCancelAcquisitionComplete(
MessagePumpCallBase* call, const ::bosdyn::api::CancelAcquisitionRequest& request,
::bosdyn::api::CancelAcquisitionResponse&& response, const grpc::Status& status,
std::promise<DataAcquisitionCancelAcquisitionResultType> promise);
// Callback function registered for the asynchronous calls to get live data.
void OnLiveDataComplete(MessagePumpCallBase* call,
const ::bosdyn::api::LiveDataRequest& request,
::bosdyn::api::LiveDataResponse&& response, const grpc::Status& status,
std::promise<DataAcquisitionLiveDataResultType> promise);
std::unique_ptr<::bosdyn::api::DataAcquisitionService::StubInterface> m_stub;
// Default service name for the Data Acquisition service.
static const char* s_default_service_name;
// Default service type for the data acquisition service.
static const char* s_service_type;
};
} // namespace client
} // namespace bosdyn