CARMA C++
CanDio.h
Go to the documentation of this file.
1 
11 #ifndef CARMA_CANBUS_CANDIO_H
12 #define CARMA_CANBUS_CANDIO_H
13 
14 #include "carma/canbus/CanIo.h"
15 #include "carma/canbus/Dio.h"
16 
17 #include <memory>
18 #include <utility>
19 #include <vector>
20 
21 namespace carma {
22 namespace canbus {
23 
48  class CanDio : public CanIo {
49  public:
50 
57  CanDio();
58 
66  CanDio( int boardId,
67  bool reset = true,
68  bool terminate = true );
69 
78  CanDio( int boardId,
79  int slotId,
80  bool reset = true,
81  bool terminate = true );
82 
86  typedef ::std::pair< int, int > BoardSlotPair;
87 
91  typedef ::std::pair< BoardSlotPair, bool > DevTermPair;
92 
99  CanDio( const std::vector< DevTermPair > & devTermPairs,
100  bool reset = true );
101 
110  void reset();
111 
116  bool isTerminated();
117 
119 
120  void
121  postMessage(
122  const carma::canbus::Message & msg,
123  carma::canbus::txPriorityType prio = carma::canbus::NORMAL );
124 
125  std::map<busIdType, carma::canbus::busStatusType>
126  getBusStatus( );
127 
128  void echoAll( bool enable );
129 
130  protected:
131 
132  void setTimestampEchoLatency(int tsLatency, busIdType busId);
133  void queueMessage(const Message &msg);
134  void clearReadQueue( );
135 
143  const long pulseWidth_;
144  const bool terminate_;
145  std::auto_ptr< carma::canbus::Dio > dio_;
146  std::auto_ptr< carma::canbus::CanIo > cio_;
147 
148  }; // End class CanDio
149  } // End namespace canbus
150 } // End namespace carma
151 #endif // CARMA_CANBUS_CANDIO_H
void reset()
Reset.
Class to control the CARMA specialized Janz CAN/DIO card.
Definition: CanDio.h:48
Class to encapsulate a CAN message.
Definition: Message.h:21
bool isTerminated()
Return termination state.
Declaration of carma::canbus::CanIo interface.
void queueMessage(const Message &msg)
Queue CAN message to be read for simulation purposes.
CanDio()
Default constructor.
void setTimestampEchoLatency(int tsLatency, busIdType busId)
Set timestamp echo latency.
const long pulseWidth_
Reset pulsewidth.
Definition: CanDio.h:143
void echoAll(bool enable)
Enable or disable echoing sent messages back through the read interface.
::std::pair< int, int > BoardSlotPair
Pair containing boardId (first) and slotId (second).
Definition: CanDio.h:86
Declaration of carma::canbus::Dio class.
txPriorityType
CAN Tx priority type.
Definition: Types.h:194
void clearReadQueue()
Clear any underlying read buffers.
unsigned short busIdType
Carma Bus Id type.
Definition: Types.h:70
carma::canbus::Message getMessage()
Retrieve a CAN message.
::std::pair< BoardSlotPair, bool > DevTermPair
Pair for board &amp; slot (first) and termination setting (second).
Definition: CanDio.h:91
void postMessage(const carma::canbus::Message &msg, carma::canbus::txPriorityType prio=carma::canbus::NORMAL)
Post a CAN message.
CanIo interface.
Definition: CanIo.h:22