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
"
34
#include "
modules/v2x/common/v2x_proxy_gflags.h
"
35
36
namespace
apollo
{
37
namespace
v2x {
38
39
class
GrpcClientImpl
{
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
46
~GrpcClientImpl
() {}
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
apollo::v2x::GrpcClientImpl
Definition
grpc_client.h:39
apollo::v2x::GrpcClientImpl::~GrpcClientImpl
~GrpcClientImpl()
Definition
grpc_client.h:46
apollo::v2x::GrpcClientImpl::InitFlag
bool InitFlag()
Definition
grpc_client.h:48
apollo::v2x::GrpcClientImpl::SendMsgToGrpc
void SendMsgToGrpc(const std::shared_ptr<::apollo::v2x::CarStatus > &msg)
Definition
grpc_client.cc:46
cyber.h
apollo
class register implement
Definition
arena_queue.h:37
v2x_proxy_gflags.h
The gflags used by v2x proxy module
modules
v2x
v2x_proxy
obu_interface
grpc_interface
grpc_client.h