cisst-saw
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
osaRTSocketCAN.h
Go to the documentation of this file.
1 /*
2 
3  Author(s): Simon Leonard
4  Created on: Dec 02 2009
5 
6  (C) Copyright 2009 Johns Hopkins University (JHU), All Rights
7  Reserved.
8 
9 --- begin cisst license - do not edit ---
10 
11 This software is provided "as is" under an open source license, with
12 no warranty. The complete license can be found in license.txt and
13 http://www.cisst.org/cisst/license.txt.
14 
15 --- end cisst license ---
16 */
17 
18 
19 #ifndef _osaRTSocketCAN_h
20 #define _osaRTSocketCAN_h
21 
22 #include <sawCANBus/osaCANBus.h> // the CAN base class
23 #include <rtdm/rtcan.h> // Defines for the RT CAN socket
24 
26 
28 
39 
40  private:
41 
43  std::string devicename;
44 
46  int canfd;
47 
49  struct sockaddr_can addr;
50 
52 
56  static const size_t MAX_NUM_FILTERS = 32;
57  struct can_filter filters[MAX_NUM_FILTERS];
58  size_t filterscnt;
59 
60 public:
61 
63 
68  osaRTSocketCAN( const std::string& devicename,
69  osaCANBus::Rate rate,
71 
73  ~osaRTSocketCAN();
74 
76 
80 
83 
85 
91  osaCANBus::Errno Send( const osaCANBusFrame& frame,
93 
95 
103 
106 
107 };
108 
109 #endif
#define CISST_EXPORT
Definition: cmnExportMacros.h:50
virtual osaCANBus::Errno AddFilter(const osaCANBus::Filter &filter)=0
Add a CAN filter to the device.
virtual osaCANBus::Errno Open()=0
Open the CAN device.
virtual osaCANBus::Errno Close()=0
Close the CAN device.
Errno
The different CAN rates.
Definition: osaCANBus.h:25
CAN frame implementation.
Definition: osaCANBusFrame.h:16
Generic CAN bus.
Definition: osaCANBus.h:15
Flags
Definition: osaCANBus.h:28
virtual osaCANBus::Errno Send(const osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)=0
Send a CAN frame on the bus.
Definition: osaCANBus.h:28
Loopback
Definition: osaCANBus.h:32
Definition: osaCANBus.h:32
virtual osaCANBus::Errno Recv(osaCANBusFrame &frame, osaCANBus::Flags flags=osaCANBus::MSG_NOFLAG)=0
Receive a CAN frame.
A Real Time Socket CAN device.
Definition: osaRTSocketCAN.h:38
Rate
The different CAN rates.
Definition: osaCANBus.h:20
Definition: osaCANBus.h:41