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 {
25  {
26  OK = 0,
28  BAD_PARAM = -2,
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
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
return_statuses close()
Definition: linuxcan.cpp:141
int hardware_id
return_statuses open(const int &hardware_id, const int &circuit_id, const int &bitrate, const bool &echo_on=true)
Definition: linuxcan.cpp:32
int circuit_id
return_statuses read(long *id, unsigned char *msg, unsigned int *size, bool *extended, unsigned long *time)
Definition: linuxcan.cpp:161
return_statuses write(const long &id, unsigned char *msg, const unsigned int &size, const bool &extended)
Definition: linuxcan.cpp:216
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