automotive-message-broker
0.14.803
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Groups
Pages
plugins
common
cansocketbcm.h
1
/*
2
Copyright (C) 2012 Intel Corporation
3
Copyright (C) 2015 Cogent Embedded Inc.
4
Copyright (C) 2015 Renesas Electronics Corporation
5
6
This library is free software; you can redistribute it and/or
7
modify it under the terms of the GNU Lesser General Public
8
License as published by the Free Software Foundation; either
9
version 2.1 of the License, or (at your option) any later version.
10
11
This library is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
Lesser General Public License for more details.
15
16
You should have received a copy of the GNU Lesser General Public
17
License along with this library; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19
*/
20
21
#ifndef CANSOCKETBCM_H
22
#define CANSOCKETBCM_H
23
29
#include <net/if.h>
30
#include <sys/poll.h>
31
#include <string>
32
#include <stdlib.h>
33
#include <linux/can/bcm.h>
34
#include <linux/can/raw.h>
35
36
#include "cansocket.h"
37
42
class
CANSocketBCM
:
public
CANSocket
43
{
44
public
:
45
CANSocketBCM
();
46
virtual
~
CANSocketBCM
(){}
/*LCOV_EXCL_LINE*/
47
54
virtual
bool
start
(
const
char
* ifName);
59
virtual
void
stop
();
67
virtual
bool
write
(
const
struct
CANFrameInfo
&message);
75
virtual
CANSocket::CANSocketReadSuccess
read
(
struct
CANFrameInfo
& message,
unsigned
int
timeout = 1000);
84
virtual
bool
registerCyclicMessageForReceive
(
int
canId,
double
minCycleTime,
double
maxCycleTime);
91
virtual
bool
unregisterMessageForReceive
(
int
canId);
92
93
private
:
97
bool
createSocket();
98
bool
locateInterfaceIndex(
struct
ifreq& ifr);
99
bool
connectSocket(
struct
sockaddr_can& addr);
100
bool
closeSocket();
101
int
waitData(
unsigned
int
timeout);
102
bool
writeFrameOneTime(
const
can_frame& frame);
103
CANSocket::CANSocketReadSuccess
readMessage(
CANFrameInfo
& message);
104
105
private
:
111
int
mSocket;
117
struct
pollfd mPoll;
118
};
119
120
#endif // CANSOCKETBCM_H
121
Generated by
1.8.2