-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapi_srpc.pb.cpp
More file actions
61 lines (51 loc) · 2.09 KB
/
Copy pathapi_srpc.pb.cpp
File metadata and controls
61 lines (51 loc) · 2.09 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
//go:build deps_only
// Code generated by protoc-gen-starpc-cpp. DO NOT EDIT.
// protoc-gen-starpc-cpp version: v0.49.16
// source: github.com/aperturerobotics/controllerbus/bus/api/api.proto
#include "api_srpc.pb.hpp"
namespace bus::api {
starpc::Error SRPCControllerBusServiceClientImpl::GetBusInfo(const bus::api::GetBusInfoRequest& in, bus::api::GetBusInfoResponse* out) {
return cc_->ExecCall(service_id_, "GetBusInfo", in, out);
}
std::pair<std::unique_ptr<SRPCControllerBusService_ExecControllerClient>, starpc::Error> SRPCControllerBusServiceClientImpl::ExecController(const controller::exec::ExecControllerRequest& in) {
auto [strm, err] = cc_->NewStream(service_id_, "ExecController", &in);
if (err != starpc::Error::OK) {
return {nullptr, err};
}
err = strm->CloseSend();
if (err != starpc::Error::OK) {
return {nullptr, err};
}
return {std::make_unique<SRPCControllerBusService_ExecControllerClient>(std::move(strm)), starpc::Error::OK};
}
std::vector<std::string> SRPCControllerBusServiceHandler::GetMethodIDs() const {
return {
"GetBusInfo",
"ExecController",
};
}
std::pair<bool, starpc::Error> SRPCControllerBusServiceHandler::InvokeMethod(
const std::string& service_id,
const std::string& method_id,
starpc::Stream* strm) {
if (!service_id.empty() && service_id != service_id_) {
return {false, starpc::Error::OK};
}
if (method_id == "GetBusInfo") {
bus::api::GetBusInfoRequest req;
starpc::Error err = strm->MsgRecv(&req);
if (err != starpc::Error::OK) return {true, err};
bus::api::GetBusInfoResponse resp;
err = impl_->GetBusInfo(req, &resp);
if (err != starpc::Error::OK) return {true, err};
return {true, strm->MsgSend(resp)};
} else if (method_id == "ExecController") {
controller::exec::ExecControllerRequest req;
starpc::Error err = strm->MsgRecv(&req);
if (err != starpc::Error::OK) return {true, err};
SRPCControllerBusService_ExecControllerStream serverStrm(strm);
return {true, impl_->ExecController(req, &serverStrm)};
}
return {false, starpc::Error::OK};
}
} // namespace bus::api