1 #ifndef SZA_ANTENNA_CANBUS_CANDEVICE_H
2 #define SZA_ANTENNA_CANBUS_CANDEVICE_H
16 #include "carma/szautil/Rx.h"
26 #define CAN_MAX_CHAR 8
30 #define CAN_MAX_ERROR_LOG_ENTRY 64
34 #define CAN_STATUS_MSG_HANDLER(fn) void (fn)(void* arg1, unsigned arg2)
81 std::string boardName,
97 bool blankingFrameEnable,
98 bool slowMonitorEnable);
110 CanMonitorPoint* findMonitorPoint(
char* name);
114 virtual void setRxId(sza::util::Rx::Id rxId);
116 std::vector<carma::canbus::Message> sendDummyMsg(
bool send);
124 sza::util::Rx::Id rxId_;
131 CAN_STATUS_MSG_HANDLER(*handler_);
137 CAN_STATUS_MSG_HANDLER(*handler),
138 void* arg1,
unsigned arg2)
149 std::vector<HandlerInfo> handlers_;
154 CAN_STATUS_MSG_HANDLER(*handler),
178 std::map<carma::canbus::msgType, std::string>
184 std::map<carma::canbus::msgType, std::string>
190 virtual std::map<carma::canbus::msgType, std::string>
202 virtual std::map<carma::canbus::msgType, std::string>
208 virtual std::map<carma::canbus::msgType, std::string>
214 virtual std::map<carma::canbus::msgType, std::string>
220 virtual std::map<carma::canbus::msgType, std::string>
249 std::vector<carma::canbus::byteType>& data);
255 void postDummyMessage();
261 std::vector<carma::canbus::byteType>& data);
268 std::vector<carma::canbus::byteType>& data);
282 std::vector<carma::canbus::byteType>& data);
289 std::vector<carma::canbus::byteType>& data);
301 enum commonHostCommands
303 HOSTCMD_RESET = 0x000,
304 HOSTCMD_SET_TIME = 0x001,
305 HOSTCMD_STOP_CHAN1 = 0x002,
306 HOSTCMD_STOP_CHAN2 = 0x003,
307 HOSTCMD_START_CHAN1 = 0x004,
308 HOSTCMD_START_CHAN2 = 0x005,
315 enum commonEngineeringCommands
317 ENGCMD_ERROR_LOG = 0x3F0,
318 ENGCMD_ERROR_CLEAR = 0x3F4,
319 ENGCMD_MONITOR_ENABLE = 0x3FB,
320 ENGCMD_ID_REQUEST = 0x3FC,
321 ENGCMD_START_DOWNLOAD = 0x3FD,
322 ENGCMD_ASCII_STRING = 0x3FF
358 std::vector<carma::canbus::byteType>& data,
375 MONITOR_PACKET_1 = 0x0E0,
376 MONITOR_PACKET_2 = 0x0E1,
377 MONITOR_PACKET_3 = 0x0E2,
378 MONITOR_PACKET_4 = 0x0E3,
379 MONITOR_PACKET_5 = 0x0E4,
380 MONITOR_PACKET_6 = 0x0E5,
381 MONITOR_PACKET_7 = 0x0E6,
382 MONITOR_PACKET_8 = 0x0E7,
383 MONITOR_PACKET_9 = 0x0E8,
384 MONITOR_PACKET_10 = 0x0E9,
385 MONITOR_PACKET_11 = 0x0EA,
409 std::vector<carma::canbus::byteType>&
417 data,
bool isSim) {};
419 processBlankingFrameMonitor2(std::vector<carma::canbus::byteType>&
420 data,
bool isSim) {};
422 processBlankingFrameMonitor3(std::vector<carma::canbus::byteType>&
423 data,
bool isSim) {};
425 processBlankingFrameMonitor4(std::vector<carma::canbus::byteType>&
426 data,
bool isSim) {};
428 processBlankingFrameMonitor5(std::vector<carma::canbus::byteType>&
429 data,
bool isSim) {};
431 processBlankingFrameMonitor6(std::vector<carma::canbus::byteType>&
432 data,
bool isSim) {};
434 processBlankingFrameMonitor7(std::vector<carma::canbus::byteType>&
435 data,
bool isSim) {};
437 processBlankingFrameMonitor8(std::vector<carma::canbus::byteType>&
438 data,
bool isSim) {};
440 processBlankingFrameMonitor9(std::vector<carma::canbus::byteType>&
441 data,
bool isSim) {};
443 processBlankingFrameMonitor10(std::vector<carma::canbus::byteType>&
444 data,
bool isSim) {};
446 processBlankingFrameMonitor11(std::vector<carma::canbus::byteType>&
447 data,
bool isSim) {};
481 SLOW_MONITOR_1 = 0x120,
482 SLOW_MONITOR_2 = 0x121,
483 SLOW_MONITOR_3 = 0x122,
484 SLOW_MONITOR_4 = 0x123,
485 SLOW_MONITOR_5 = 0x124
493 unsigned short moduleSerialNo_;
495 unsigned int initRequest_;
496 unsigned int rxErrors_;
497 unsigned int txErrors_;
498 unsigned int memoryErrors_;
499 unsigned int systemErrors_;
500 unsigned short schedulerOverflowCount_;
501 unsigned short timedSchedulerOverflowCount_;
503 unsigned char softwareMajorVersion_;
504 unsigned char softwareMinorVersion_;
505 unsigned char softwareTestVersion_;
506 unsigned int swVersionStr_[3];
508 unsigned short communicationErrorCount_;
509 unsigned short timeErrorCount_;
510 unsigned short softwareErrorCount_;
511 unsigned short hardwareErrorCount_;
513 short timeStampInterval_;
514 short timeStampDelta_;
526 std::vector<carma::canbus::byteType>& data,
567 ENG_MONITOR_1 = 0x1F0,
568 ENG_MONITOR_2 = 0x1F1,
569 ENG_MONITOR_3 = 0x3FC,
570 ENG_MONITOR_4 = 0x3FF
578 unsigned int errLog_;
580 unsigned int mjdTime_;
581 unsigned int errCode_;
582 unsigned int errCnt_;
583 unsigned int serialNo_;
584 unsigned int errData_;
585 unsigned int moduleType_;
587 unsigned short apiNo_;
588 unsigned short dongleId_;
590 unsigned char asciiString_[CAN_MAX_CHAR+1];
602 std::vector<carma::canbus::byteType>& data,
608 processEngineeringMonitor1(std::vector<carma::canbus::byteType>& data,
bool isSim);
611 processEngineeringMonitor2(std::vector<carma::canbus::byteType>& data,
bool isSim);
614 processEngineeringMonitor3(std::vector<carma::canbus::byteType>& data,
bool isSim);
617 processEngineeringMonitor4(std::vector<carma::canbus::byteType>& data,
bool isSim);
642 virtual void processStatusMessage1(
bool isSim);
643 virtual void processStatusMessage2(
bool isSim);
644 virtual void processStatusMessage3(
bool isSim);
645 virtual void processGenericStatusMessage(
bool isSim);
654 void skipByte(std::vector<carma::canbus::byteType>& data,
655 unsigned short nByte);
657 std::string monthDayYearToString(
unsigned int month,
unsigned int day,
unsigned year);
666 #endif // End #ifndef
Tagged: Sat Oct 23 22:31:40 PDT 2004.
void postEngMessage(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data)
Post a message for this device.
bool isEngineeringMonitor(carma::canbus::msgType mid)
Return true if this is a valid Engineering packet.
virtual carma::canbus::Message simulateBlankingFrameMonitor(carma::canbus::msgType mid)
Simulate blanking frame monitor packets.
virtual void processBlankingFrameMonitor(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool isSim)
Process a blanking frame monitor packet.
carma::canbus::Message nodeMessage(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data)
Get an initialized node message.
engineeringMonitors
Engineering monitor packets.
bool isSlowMonitor(carma::canbus::msgType mid)
Return true if this is a slow monitor packet.
Class to encapsulate a CAN message.
virtual void requestId()
Request the module ID.
virtual void processStatusMessage(carma::canbus::msgType mid, bool isSim)
Process an status message.
bool isStatusMessage(carma::canbus::msgType mid)
Return true if this is a valid status message for this device.
slowMonitors
Slow monitor packets will be the same for all CAN nodes.
carma::canbus::idType createId(bool host, carma::canbus::msgType mid)
Return a CAN message ID constructed from the api, node and command ID.
virtual void processEngineeringMonitor(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool isSim)
Process an engineering monitor packet.
virtual std::map< carma::canbus::msgType, std::string > getSlowMonitors() const
Return a map of slow monitor points.
virtual carma::canbus::Message simulateMsg(carma::canbus::msgType mid)
Simulate messages to this device.
carma::canbus::Message nodeEngMessage(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data)
Get an initialized engineering node message.
void skipByte(std::vector< carma::canbus::byteType > &data, unsigned short nByte)
Skip a number of bytes in the data array.
virtual carma::canbus::Message simulateGenericBlankingFrameMonitor(carma::canbus::msgType mid)
Simulate a generic monitor packet.
virtual void processSlowMonitor1(std::vector< carma::canbus::byteType > &data, bool isSim)
Process the first slow monitor packet.
virtual void processMsg(carma::canbus::msgType messageId, std::vector< carma::canbus::byteType > &data, bool isSim)
Process a message for this device.
virtual void startDownLoad()
Start downloading a new program.
unsigned short apiType
Carma API id type.
CanDevice(sza::antenna::control::SzaShare *share, std::string boardName, carma::canbus::apiType api, carma::canbus::nodeType node, carma::canbus::CanOutput &io)
Constructor.
virtual void processSlowMonitor4(std::vector< carma::canbus::byteType > &data, bool isSim)
Process the fourth slow monitor packet.
virtual void processBlankingFrameMonitor1(std::vector< carma::canbus::byteType > &data, bool isSim)
Stubs for processing up to 10 monitor packets.
virtual std::map< carma::canbus::msgType, std::string > getHalfSecMonitors() const
Return a map of devices half second monitor points.
bool isBlankingFrameMonitor(carma::canbus::msgType mid)
Return true if this is a valid blanking frame monitor packet.
unsigned short nodeType
Carma Node Type id type.
virtual std::map< carma::canbus::msgType, std::string > getSpecificControls() const
Get module-specific controls.
A class for encapsulating devices for the SZA which will be attached to a CAN bus.
virtual void sendTimeStamp()
Send the current mjd.
std::map< carma::canbus::msgType, std::string > getControls()
Return a map of device controls.
virtual std::map< carma::canbus::msgType, std::string > getStatusMessages() const
Return a map of status messages.
defaultHalfSecMonitors
Blanking frame monitor packets are generally the same for all CAN nodes.
unsigned idOfBlankingFrameMonitorMsgType(carma::canbus::msgType mid)
Return a standard enumerator for monitor packets.
virtual void processSlowMonitor2(std::vector< carma::canbus::byteType > &data, bool isSim)
Process the second slow monitor packet.
void postMessage(carma::canbus::Message msg)
Post a fully constructed message to this device.
virtual void processSlowMonitor3(std::vector< carma::canbus::byteType > &data, bool isSim)
Process the third slow monitor packet.
A class which encapsulates resources of a board of the shared register map.
virtual std::map< carma::canbus::msgType, std::string > getEngineeringMonitors() const
Return a map of engineering monitor points.
virtual std::string controlPrefix()
Return an inheritor-specific prefix to use when constructing monitor points.
unsigned idOfStatusMessageMsgType(carma::canbus::msgType mid)
......................................................................
Abstract base class for all CAN Bus devices.
carma::canbus::Message hostMessage(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data)
Get an initialized host message.
std::map< carma::canbus::msgType, std::string > getCommonControls()
A map of controls common to all devices.
void initRegs()
Init registers common to all CAN devices.
virtual void processSlowMonitor5(std::vector< carma::canbus::byteType > &data, bool isSim)
Process the fifth slow monitor packet.
virtual void retrieveErrorLogEntry(unsigned short recordNo)
Retrieve a numbered error log entry.
unsigned int idType
Type for full 29 bit CAN id.
carma::canbus::idType createEngId(bool host, carma::canbus::msgType mid)
Return a CAN message ID constructed from the api, node and command ID.
Declaration of carma::canbus::Device class.
virtual void sendAsciiString(std::string sendStr)
Send a std::string of up to 8 characters to the CAN node.
virtual void processSlowMonitor(carma::canbus::msgType mid, std::vector< carma::canbus::byteType > &data, bool isSim)
Process a slow monitor packet.
virtual ~CanDevice()
Destructor.
unsigned short busIdType
Carma Bus Id type.
virtual void enableMonitorPackets(bool timeStampEnable, bool blankingFrameEnable, bool slowMonitorEnable)
Enable/Disable monitor packets.
unsigned short msgType
Carma Message id type.
void registerReceived(unsigned id, bool isSim)
Register receipt of this monitor packet.
carma::canbus::msgType msgTypeOfBlankingFrameMonitorId(unsigned int id)
Return the message id corresponding to a standard enumerator.
virtual void clearErrorLog()
Clear the error log.
Tagged: Sat Oct 23 22:15:09 PDT 2004.
Tagged: Thu Nov 13 16:53:34 UTC 2003.
An instance of this class is created by AntennaMaster and passed to the constructors of other tasks...
carma::canbus::busIdType getBusId()
Return a CAN bus ID suitable for passing to Message constructor.