====== FMStoIP ======
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:
* ITxPT and FMStoIP license
* A client, in our case linux debian 10
=== 1. Step ===
SERVICES -> ITxPT -> Configuration -> ITxPT Administratio enable.
Choose your LAN Interface, your client is connected to. In our case this is LAN1.
{{:itxpt_enable.png?600|}}
=== 2. Step ===
Go to FMStoIP Tab, and configure as followed:
{{:app-notes:enable_fms.png?600|}}
=== 3. Step ===
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 [[configuration:sdk-job|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\r\n');
fwrite(f, sprintf("%s", 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
=== 4. Step ===
* [[app-notes:avahi-on-LXC|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.
{{:app-notes:avahi-fmstopip.png?600|}}
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.
=== 5. Step ===
Please clone https://github.com/troglobit/mtools and build the mtools:
timm@debian:~/git$ git clone https://github.com/troglobit/mtools
Cloning into 'mtools'...
remote: Enumerating objects: 103, done.
remote: Total 103 (delta 0), reused 0 (delta 0), pack-reused 103
Receiving objects: 100% (103/103), 48.67 KiB | 2.32 MiB/s, done.
Resolving deltas: 100% (53/53), done.
timm@debian:~/git$ cd mtools/
timm@debian:~/git/mtools$ make
CC msend.o
LINK msend
CC mreceive.o
LINK mreceive
timm@debian:~/git/mtools$
=== 6. Step ===
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: F001FF0000FFFFFFFFDD1671119801118ABS Fully OperationalNot availableF001FF0000FFFFFFFFDD1671119801118ABS Fully OperationalNot available
Receive msg 2 from 192.168.1.1:60429: F002FF0000FFFFFFFFDD1671119811052Percent Clutch Slip%102.0F002FF0000FFFFFFFFDD1671119811051Percent Clutch Slip%102.0
F001
FF0000FFFFFFFFDD
1671119801118
ABS Fully Operational
Not available
F001
FF0000FFFFFFFFDD
1671119801118
ABS Fully Operational
Not available
F002
FF0000FFFFFFFFDD
1671119811052
Percent Clutch Slip
%
102.0
F002
FF0000FFFFFFFFDD
1671119811051
Percent Clutch Slip
%
102.0