10 #ifndef CARMA_CANBUS_DEVICE_H
11 #define CARMA_CANBUS_DEVICE_H
30 typedef ::std::map< ::carma::canbus::msgType, ::std::string >
MsgIdInfoMap;
249 virtual void setState(deviceStateType state);
301 std::vector<byteType>& data,
483 static const msgType STOP_CHANNEL_2_FAST_SAMPLING = 0x0003;
545 deviceStateType state;
546 unsigned int nLatePackets;
549 mutable pthread_mutex_t mutex;
559 #endif // CARMA_CANBUS_DEVICE_H
unsigned int keyType
Unique key identifier for each device.
Declaration of carma::canbus::CanOutput interface.
unsigned int getNlatePackets() const
Get number of late packets.
void setSerialNumber(serialNumberType sn)
Set serial number of device.
unsigned short boardType
Carma Board Type id type.
static const msgType START_CHANNEL_1_FAST_SAMPLING
Begin channel 1 fast sampling message id.
void setApiVersion(char api)
Set API Version.
Declaration of carma::canbus::Message class.
::std::map< ::carma::canbus::msgType,::std::string > MsgIdInfoMap
Alias for an ::std::map containing a string description of a message id, keyed by the described carma...
void setBoardType(boardType bt)
Set board type of device.
virtual MsgIdInfoMap getControls() const
Return a map of devices controls.
Declarations of carma::canbus types.
virtual void updateFrameData()
Update device or monitor data on frame timescale...
Device(apiType api, nodeType node, CanOutput &io)
Device constructor.
void stopChannelOneFastSampling()
Stop fast sampling on channel 1 This routine will stop fast sampling on channel 1 regardless of wheth...
Class to encapsulate a CAN message.
virtual MsgIdInfoMap getSlowMonitors() const =0
Return a map of devices slow monitor points.
serialNumberType getSerialNumber() const
Return serial number of device.
char getApiVersion() const
Get API Version of this Device.
bool isPacketLate(double window=100.0)
Determine if the last packet sent from this device was late.
virtual carma::canbus::Message simulateMsg(msgType messageId)=0
Simulate a CAN message.
static const msgType START_CHANNEL_2_FAST_SAMPLING
Begin channel 2 fast sampling message id.
virtual MsgIdInfoMap getHalfSecMonitors() const =0
Return a map of devices half second monitor points.
carma::canbus::Message createMsgToHost(msgType messageId) const
Create a CAN message addressed from this Device to the host.
unsigned short apiType
Carma API id type.
deviceStateType getState() const
Status access routine.
unsigned short serialNumberType
Carma Serial Number type.
busIdType getBusId() const
Return bus Id that node resides on.
boardType getBoardType() const
Return board type id of device.
unsigned short nodeType
Carma Node Type id type.
virtual void setLastRxTime(double rxMjd)
Set latest rx time.
void resetLatePacketCount()
Reset the late packet count to 0.
virtual void processMsg(msgType messageId, std::vector< byteType > &data, bool sim)=0
Process a CAN message.
void setBusId(busIdType busId)
Set busId of device.
keyType getKey() const
Create a key unique to this api and node.
void startChannelOneFastSampling(unsigned short fastItem)
Start fast sampling the specified data item on channel 1.
void startChannelTwoFastSampling(unsigned short fastItem)
Start fast sampling the specified data item on channel 2.
carma::canbus::Message createDummyMsg() const
Create a dummy CAN message.
void reset()
Perform a software reset of module.
static const msgType STOP_CHANNEL_1_FAST_SAMPLING
Stop channel 1 fast sampling message id.
carma::canbus::Message createMsgToAllNodes(msgType messageId) const
Create a CAN message addressed to all nodes of this type.
Abstract base class for all CAN Bus devices.
carma::canbus::Message createMsgToNode(msgType messageId) const
Create a CAN message addressed to this device from the host.
unsigned short busIdType
Carma Bus Id type.
nodeType getNode() const
Return node location code of device.
unsigned short msgType
Carma Message id type.
double getLastRxTime() const
Get Last RX Time for device.
virtual void setState(deviceStateType state)
Set state of device.
CanOutput & io_
Reference to CanOutput object.
apiType getApi() const
Return api code of device.
static const msgType RESET
Software reset message id.
void stopChannelTwoFastSampling()
Stop fast sampling on channel 2 This routine will stop fast sampling on channel 2 regardless of wheth...
virtual ~Device()
Device destructor.
void incrementLatePacketCount()
Increment the late packet count by 1.