13#define N2k_CAN_INT_PIN 21
33 Serial.println(
"Device analyzer is starting up...");
40 "N2k bus device analyzer",
41 "1.0.0.10 (2017-07-29)",
42 "1.0.0.0 (2017-07-12)"
61 Serial.println(
"Device analyzer started.");
62 Serial.println(
" - Analyzer will automatically print new list on list changes.");
63 Serial.println(
" - Send 'u' to print latest list");
71 for (i=0; List[i]!=0; i++) {
72 if (i>0) Serial.print(
", ");
73 Serial.print(List[i]);
80void PrintText(
const char *Text,
bool AddLineFeed=
true) {
81 if ( Text!=0 ) Serial.print(Text);
82 if ( AddLineFeed ) Serial.println();
87 if ( pDevice == 0 )
return;
89 Serial.println(
"----------------------------------------------------------------------");
91 Serial.print(
" Source: "); Serial.println(pDevice->
GetSource());
93 Serial.print(
" Unique number: "); Serial.println(pDevice->
GetUniqueNumber());
94 Serial.print(
" Software version: "); Serial.println(pDevice->
GetSwCode());
95 Serial.print(
" Model version: "); Serial.println(pDevice->
GetModelVersion());
104#define START_DELAY_IN_S 8
107 static bool StartDelayDone=
false;
108 static int StartDelayCount=0;
109 static unsigned long NextStartDelay=0;
110 if ( !StartDelayDone ) {
111 if (
millis()>NextStartDelay ) {
112 if ( StartDelayCount==0 ) {
113 Serial.print(
"Reading device information from bus ");
117 NextStartDelay+=1000;
129 Serial.println(
"**********************************************************************");
135 if (Serial.available()) {
136 char chr = Serial.read();
void PrintDevice(const tNMEA2000::tDevice *pDevice)
void PrintUlongList(const char *prefix, const unsigned long *List)
void ListDevices(bool force=false)
void PrintLabelValWithConversionCheckUnDef(const char *label, T val, double(*ConvFunc)(double val)=0, bool AddLf=false)
tN2kDeviceList * pN2kDeviceList
void PrintText(const char *Text, bool AddLineFeed=true)
#define N2kMaxBusDevices
Maximum allowed number of devices on the CAN BUS bus system is 254.
bool N2kIsNA(double v)
Verify that the specified value is equal to "Not available".
Automatic library selection according to the selected board.
Helper class to keep track of all devices on the bus.
bool ReadResetIsListUpdated()
Check if device list has updated.
const tNMEA2000::tDevice * FindDeviceBySource(uint8_t Source) const
Return device by it's bus source address.
This class represents a N2k device.
uint8_t GetSource() const
Returns the Source Address of this device.
virtual const unsigned long * GetTransmitPGNs() const
Get the list of transmitted PGNs from this device.
virtual const unsigned long * GetReceivePGNs() const
Get the list of received PGNs from this device.
virtual const char * GetManufacturerInformation() const
Get the manufacturer information from the configuration information of this device.
virtual const char * GetModelVersion() const =0
Get the model version from the product information of this device.
uint32_t GetUniqueNumber() const
Get the unique Number from the Device Information.
uint16_t GetManufacturerCode() const
Get the Manufacturer Code from the Device Information.
virtual const char * GetSwCode() const =0
Get the Software version code from the product information of this device.
virtual const char * GetModelID() const =0
Get the model ID from the product information of this device.
virtual const char * GetInstallationDescription2() const
Get the installation description 2 from the configuration information of this device.
virtual const char * GetInstallationDescription1() const
Get the installation description 1 from the configuration information of this device.
void SetProductInformation(const char *_ModelSerialCode, unsigned short _ProductCode=0xffff, const char *_ModelID=0, const char *_SwCode=0, const char *_ModelVersion=0, unsigned char _LoadEquivalency=0xff, unsigned short _N2kVersion=0xffff, unsigned char _CertificationLevel=0xff, int iDev=0)
Set the Product Information of this device.
void EnableForward(bool v=true)
Enable message forwarding to stream.
void ParseMessages()
Parse all incoming Messages.
void SetDeviceInformation(unsigned long _UniqueNumber, unsigned char _DeviceFunction=0xff, unsigned char _DeviceClass=0xff, uint16_t _ManufacturerCode=0xffff, unsigned char _IndustryGroup=4, int iDev=0)
Set the Device Information. See also NAME.
void SetForwardStream(N2kStream *_stream)
Set the Forward Stream object.
void SetN2kCANMsgBufSize(const uint8_t _MaxN2kCANMsgs)
Set incoming CAN message (tNMEA2000::N2kCANMsgBuf) buffer size.
bool Open()
Open the CAN device.
virtual void SetN2kCANReceiveFrameBufSize(const uint16_t _MaxCANReceiveFrames)
Set CAN receive frame buffer size.
void SetMode(tN2kMode _N2kMode, uint8_t _N2kSource=15)
Set the library mode and start source address.
void SetForwardType(tForwardType fwdType)
Set the Forward Streaming Type.