Apollo 11.0
自动驾驶开放平台
grpc_client.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2018 The Apollo Authors. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *****************************************************************************/
16
22#pragma once
23
24#include <memory>
25#include <mutex>
26
27#include <grpc++/grpc++.h>
28
29#include "modules/v2x/proto/v2x_car_status.pb.h"
30#include "modules/v2x/proto/v2x_obu_traffic_light.pb.h"
31#include "modules/v2x/proto/v2x_service_car_to_obu.grpc.pb.h"
32
33#include "cyber/cyber.h"
35
36namespace apollo {
37namespace v2x {
38
40 public:
41 /* construct function
42 @param input car_status type msg shared ptr
43 */
44 explicit GrpcClientImpl(std::shared_ptr<grpc::Channel> channel);
45
47
48 bool InitFlag() { return init_flag_; }
49
50 /*function that send car status msg through grpc
51 @param input car_status type msg shared ptr
52 */
53 void SendMsgToGrpc(const std::shared_ptr<::apollo::v2x::CarStatus> &msg);
54
55 private:
56 // grpc service stub
57 std::unique_ptr<::apollo::v2x::CarToObu::Stub> stub_;
58 int car_status_tv_nsec_ = 0;
59 bool init_flag_ = false;
60};
61
62} // namespace v2x
63} // namespace apollo
void SendMsgToGrpc(const std::shared_ptr<::apollo::v2x::CarStatus > &msg)
class register implement
Definition arena_queue.h:37
The gflags used by v2x proxy module