Main Page
Namespaces
Classes
Files
File List
File Members
include
kvaser_interface
kvaser_interface.h
Go to the documentation of this file.
1
/*
2
* Unpublished Copyright (c) 2009-2017 AutonomouStuff, LLC, All Rights Reserved.
3
*
4
* This file is part of the Kvaser ROS 1.0 driver which is released under the MIT license.
5
* See file LICENSE included with this software or go to https://opensource.org/licenses/MIT for full license details.
6
*/
7
8
// Define a class that supports a basic CAN interface that's independent of the hardware and driver library used
9
// Different libraries can be created to define all these functions for a specific driver library
10
11
#ifndef KVASER_INTERFACE_HPP
12
#define KVASER_INTERFACE_HPP
13
14
//C++ Includes
15
#include <iostream>
16
17
//OS Includes
18
#include <unistd.h>
19
20
namespace
AS
21
{
22
namespace
CAN
23
{
24
enum
return_statuses
25
{
26
OK
= 0,
27
INIT_FAILED
= -1,
28
BAD_PARAM
= -2,
29
NO_CHANNELS_FOUND
= -3,
30
CHANNEL_CLOSED
= -4,
31
NO_MESSAGES_RECEIVED
= -5,
32
READ_FAILED
= -6,
33
WRITE_FAILED
= -7,
34
CLOSE_FAILED
= -8
35
};
36
37
class
KvaserCan
38
{
39
public
:
40
KvaserCan
();
41
42
~KvaserCan
();
43
44
// Called to pass in parameters and open can link
45
return_statuses
open
(
const
int
&
hardware_id
,
46
const
int
&
circuit_id
,
47
const
int
& bitrate,
48
const
bool
& echo_on =
true
);
49
50
// Close the can link
51
return_statuses
close
();
52
53
// Check to see if the CAN link is open
54
bool
is_open
();
55
56
// Read a message
57
return_statuses
read
(
long
*
id
,
58
unsigned
char
*msg,
59
unsigned
int
*size,
60
bool
*extended,
61
unsigned
long
*time);
62
63
// Send a message
64
return_statuses
write
(
const
long
&
id
,
65
unsigned
char
*msg,
66
const
unsigned
int
& size,
67
const
bool
& extended);
68
69
private
:
70
void
*
handle
;
71
bool
on_bus
;
72
};
73
74
// Converts error messages to human-readable strings
75
std::string
return_status_desc
(
const
return_statuses
& ret);
76
}
77
}
78
#endif
AS::CAN::BAD_PARAM
Definition:
kvaser_interface.h:28
AS::CAN::KvaserCan::KvaserCan
KvaserCan()
Definition:
linuxcan.cpp:15
AS::CAN::KvaserCan::close
return_statuses close()
Definition:
linuxcan.cpp:141
AS::CAN::KvaserCan::on_bus
bool on_bus
Definition:
kvaser_interface.h:71
AS::CAN::KvaserCan::handle
void * handle
Definition:
kvaser_interface.h:70
AS
Definition:
kvaser_interface.h:20
hardware_id
int hardware_id
Definition:
kvaser_can_bridge.cpp:19
AS::CAN::KvaserCan::is_open
bool is_open()
Definition:
linuxcan.cpp:122
AS::CAN::NO_MESSAGES_RECEIVED
Definition:
kvaser_interface.h:31
AS::CAN::CLOSE_FAILED
Definition:
kvaser_interface.h:34
AS::CAN::return_statuses
return_statuses
Definition:
kvaser_interface.h:24
AS::CAN::KvaserCan::open
return_statuses open(const int &hardware_id, const int &circuit_id, const int &bitrate, const bool &echo_on=true)
Definition:
linuxcan.cpp:32
AS::CAN::OK
Definition:
kvaser_interface.h:26
circuit_id
int circuit_id
Definition:
kvaser_can_bridge.cpp:20
AS::CAN::KvaserCan
Definition:
kvaser_interface.h:37
AS::CAN::NO_CHANNELS_FOUND
Definition:
kvaser_interface.h:29
AS::CAN::KvaserCan::read
return_statuses read(long *id, unsigned char *msg, unsigned int *size, bool *extended, unsigned long *time)
Definition:
linuxcan.cpp:161
AS::CAN::INIT_FAILED
Definition:
kvaser_interface.h:27
AS::CAN::CHANNEL_CLOSED
Definition:
kvaser_interface.h:30
AS::CAN::KvaserCan::~KvaserCan
~KvaserCan()
Definition:
linuxcan.cpp:22
AS::CAN::WRITE_FAILED
Definition:
kvaser_interface.h:33
AS::CAN::READ_FAILED
Definition:
kvaser_interface.h:32
AS::CAN::KvaserCan::write
return_statuses write(const long &id, unsigned char *msg, const unsigned int &size, const bool &extended)
Definition:
linuxcan.cpp:216
AS::CAN::return_status_desc
std::string return_status_desc(const return_statuses &ret)
Definition:
utils.cpp:10
kvaser_interface
Author(s): Joshua Whitley
, Daniel Stanek
autogenerated on Wed Jun 19 2019 19:36:17