In this example enable ITxPT on Netmodule NG800 and receive specific CAN Data of the router via ITxPT implementation. As a client, we use a pc with linux-debian 10.
Requirements:
SERVICES → ITxPT → Configuration → ITxPT Administratio enable. Choose your LAN Interface, your client is connected to. In our case this is LAN1.
To get any FMS data from the database on the webserver, once we need to enable all possible PGN IDs on the fmstoip service. Therefore we will use a simple http request sdk script. Please configure a sdk job with eventbased trigger set to “sdk-startup”. Then add the following script into the script section:
/*DESC: This script add all avaliable PGNs fmsv4.json to the FMStoIP database. * Copyright (C) 2013-2022) NetModule AG, Switzerland */ url = 'http://192.168.1.1:8085/fmstoip/addpgn'; usr = ""; pwd = ""; path = ""; pp = ""; resp = ""; //define headers header = "content-type: text/xml"; // ALL POSSIBLE PGN VALUES [HEX] pgn= mkarray("F000", "F001", "F002", "F003", "F004", "F005", "F009", "FD09", "FD7D", "FDA4", "FDA5", "FDD1", "FE4E", "FE56", "FE6B", "FE6C", "FE70", "FEAE", "FEBF", "FEC0", "FEC1", "FED5", "FEE5", "FEE9", "FEEA", "FEEC", "FEEE", "FEEF", "FEF1", "FEF2", "FEF5", "FEF6", "FEF8", "FEF8", "FEFB", "FEFC"); for(i=0; i<length(pgn); i++) { // POST request f = fopen("content", "w"); fwrite(f, '<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n'); fwrite(f, sprintf("<PGNReq>%s</PGNReq>", pgn[i])); fclose(f); req = nb_transfer_post(usr ,pwd ,url ,path ,pp ,resp ,header); printf("added PGN:%s\n\n", pgn[i]); }
Don't forget to edit your router IP in the url! It is set to default 192.168.1.1
* How to set up the discovery tool avahi under an LXC container
Almost done, now we need to discover the services offered by netmodule ITxPT service. As discovery tool, we use avahi-discover. Once, started, we can click on a service to get detail information.
Now we have the multicast address for the fmstoip service discovered, we can join the multicast group and recvice the udp messages.
Note: If you are connected to other networks too, make sure to add a route 239.0.0.0/8 via 192.168.1.1 for the multicast address.
Please clone https://github.com/troglobit/mtools and build the mtools:
CC msend.o LINK msend CC mreceive.o LINK mreceive
timm@debian:~/git/mtools$
Now we can start mrecevie, with multiacast IP and port: ./mreceive -g 239.255.42.21 -p 15015
timm@debian:~/git/mtools$ ./mreceive -g 239.255.42.21 -p 15015 Now receiving from multicast group: 239.255.42.21 Receive msg 1 from 192.168.1.1:60429: <?xml version="1.0"?><FMStoIPDelivery version="1.1a"><FMStoIP FMSVersion="0000"><Frame Status="OK"><PGN>F001</PGN><Data>FF0000FFFFFFFFDD</Data><RelativeTime>1671119801118</RelativeTime><SPN id="1243"><Name>ABS Fully Operational</Name><Value>Not available</Value></SPN></Frame><Frame Status="OK"><PGN>F001</PGN><Data>FF0000FFFFFFFFDD</Data><RelativeTime>1671119801118</RelativeTime><SPN id="1243"><Name>ABS Fully Operational</Name><Value>Not available</Value></SPN></Frame></FMStoIP></FMStoIPDelivery> Receive msg 2 from 192.168.1.1:60429: <?xml version="1.0"?><FMStoIPDelivery version="1.1a"><FMStoIP FMSVersion="0000"><Frame Status="OK"><PGN>F002</PGN><Data>FF0000FFFFFFFFDD</Data><RelativeTime>1671119811052</RelativeTime><SPN id="522"><Name>Percent Clutch Slip</Name><Unit>%</Unit><Value>102.0</Value></SPN></Frame><Frame Status="OK"><PGN>F002</PGN><Data>FF0000FFFFFFFFDD</Data><RelativeTime>1671119811051</RelativeTime><SPN id="522"><Name>Percent Clutch Slip</Name><Unit>%</Unit><Value>102.0</Value></SPN></Frame></FMStoIP></FMStoIPDelivery>
<?xml version="1.0"?> <FMStoIPDelivery version="1.1a"> <FMStoIP FMSVersion="0000"> <Frame Status="OK"> <PGN>F001</PGN> <Data>FF0000FFFFFFFFDD</Data> <RelativeTime>1671119801118</RelativeTime> <SPN id="1243"> <Name>ABS Fully Operational</Name> <Value>Not available</Value> </SPN> </Frame> <Frame Status="OK"> <PGN>F001</PGN> <Data>FF0000FFFFFFFFDD</Data> <RelativeTime>1671119801118</RelativeTime> <SPN id="1243"> <Name>ABS Fully Operational</Name> <Value>Not available</Value> </SPN> </Frame> </FMStoIP> </FMStoIPDelivery> <?xml version="1.0"?> <FMStoIPDelivery version="1.1a"> <FMStoIP FMSVersion="0000"> <Frame Status="OK"> <PGN>F002</PGN> <Data>FF0000FFFFFFFFDD</Data> <RelativeTime>1671119811052</RelativeTime> <SPN id="522"> <Name>Percent Clutch Slip</Name> <Unit>%</Unit> <Value>102.0</Value> </SPN> </Frame> <Frame Status="OK"> <PGN>F002</PGN> <Data>FF0000FFFFFFFFDD</Data> <RelativeTime>1671119811051</RelativeTime> <SPN id="522"> <Name>Percent Clutch Slip</Name> <Unit>%</Unit> <Value>102.0</Value> </SPN> </Frame> </FMStoIP> </FMStoIPDelivery>