Apollo 10.0
自动驾驶开放平台
esd_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
22#pragma once
23
24#include <string>
25#include <vector>
26
27#include "esd_can/include/ntcan.h"
28#include "gflags/gflags.h"
29#include "modules/common_msgs/basic_msgs/error_code.pb.h"
32#include "modules/common_msgs/drivers_msgs/can_card_parameter.pb.h"
33
38namespace apollo {
39namespace drivers {
40namespace canbus {
41namespace can {
42
47class EsdCanClient : public CanClient {
48 public:
54 bool Init(const CANCardParameter &parameter) override;
55
59 virtual ~EsdCanClient();
60
67
71 void Stop() override;
72
80 apollo::common::ErrorCode Send(const std::vector<CanFrame> &frames,
81 int32_t *const frame_num) override;
82
90 apollo::common::ErrorCode Receive(std::vector<CanFrame> *const frames,
91 int32_t *const frame_num) override;
92
97 std::string GetErrorString(const int32_t status) override;
98
99 private:
100 NTCAN_HANDLE dev_handler_;
102 CMSG send_frames_[MAX_CAN_SEND_FRAME_LEN];
103 CMSG recv_frames_[MAX_CAN_RECV_FRAME_LEN];
104};
105
106} // namespace can
107} // namespace canbus
108} // namespace drivers
109} // namespace apollo
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 an ESD CAN client which inherits CanClient.
void Stop() override
Stop the ESD CAN client.
apollo::common::ErrorCode Receive(std::vector< CanFrame > *const frames, int32_t *const frame_num) override
Receive messages
bool Init(const CANCardParameter &parameter) override
Initialize the ESD CAN client by specified CAN card parameters.
apollo::common::ErrorCode Send(const std::vector< CanFrame > &frames, int32_t *const frame_num) override
Send messages
apollo::common::ErrorCode Start() override
Start the ESD CAN client.
std::string GetErrorString(const int32_t status) override
Get the error string.
const int32_t MAX_CAN_RECV_FRAME_LEN
const int32_t MAX_CAN_SEND_FRAME_LEN
class register implement
Definition arena_queue.h:37