Apollo 10.0
自动驾驶开放平台
hermes_can_client.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
17#pragma once
18
19#include <string>
20#include <vector>
21
22#include "gflags/gflags.h"
23
24#include "modules/common_msgs/basic_msgs/error_code.pb.h"
25#include "modules/common_msgs/drivers_msgs/can_card_parameter.pb.h"
26
30
36namespace apollo {
37namespace drivers {
38namespace canbus {
39namespace can {
40
46class HermesCanClient : public CanClient {
47 public:
52 // explicit HermesCanClient(const CANCardParameter &parameter);
53
57 virtual ~HermesCanClient();
58
64 bool Init(const CANCardParameter &parameter) override;
65
72
77 virtual void Stop();
78
86 virtual apollo::common::ErrorCode Send(const std::vector<CanFrame> &frames,
87 int32_t *const frame_num);
88
96 virtual apollo::common::ErrorCode Receive(std::vector<CanFrame> *const frames,
97 int32_t *const frame_num);
102 virtual std::string GetErrorString(const int32_t status);
107 void SetInited(bool init);
108
109 private:
110 bool is_init_ = false;
111 bcan_hdl_t dev_handler_;
115};
116
117} // namespace can
118} // namespace canbus
119} // namespace drivers
120} // namespace apollo
121
122/* vim: set expandtab ts=4 sw=4 sts=4 tw=100: */
uint64_t bcan_hdl_t
Definition bcan.h:48
Defines the CanFrame struct and CanClient interface.
The class which defines the CAN client to send and receive message.
Definition can_client.h:92
The class which defines a BCAN client which inherits CanClient.
virtual ~HermesCanClient()
Initialize the BCAN client by specified CAN card parameters.
bool Init(const CANCardParameter &parameter) override
Start the ESD CAN client.
virtual std::string GetErrorString(const int32_t status)
Get the error string.
virtual apollo::common::ErrorCode Receive(std::vector< CanFrame > *const frames, int32_t *const frame_num)
Receive messages
void SetInited(bool init)
Set inited status.
virtual void Stop()
Stop the ESD CAN client.
apollo::common::ErrorCode Start() override
Start the ESD CAN client.
virtual apollo::common::ErrorCode Send(const std::vector< CanFrame > &frames, int32_t *const frame_num)
Send messages
const int32_t MAX_CAN_RECV_FRAME_LEN
const int32_t MAX_CAN_SEND_FRAME_LEN
class register implement
Definition arena_queue.h:37