Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
app-notes:fmstoip-itxpt [2022/12/15 15:22] dodenhoeftapp-notes:fmstoip-itxpt [2024/05/23 10:22] (current) klueppel
Line 1: Line 1:
 ====== FMStoIP ====== ====== 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 11+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:  Requirements: 
-  * Netmodule Router with licensed ITxPTand FMStoIP+  * ITxPT and FMStoIP license 
   * A client, in our case linux debian 10   * A client, in our case linux debian 10
  
-1. Step +=== 1. Step ===
 SERVICES -> ITxPT -> Configuration -> ITxPT Administratio enable. SERVICES -> ITxPT -> Configuration -> ITxPT Administratio enable.
 Choose your LAN Interface, your client is connected to. In our case this is LAN1. Choose your LAN Interface, your client is connected to. In our case this is LAN1.
  
-{{ :itxpt_enable.png?400 |}}+{{:itxpt_enable.png?600|}}
  
-Go to FMStoIP Tab, and enable configuration. +=== 2. Step === 
-{{:enable_fms.png?400 |}}+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:
  
 +<code c fms-add-all-pgn.are>
 +/*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]);
 +}
 +</code>
 +
 +<WRAP center round tip 100%>
 +Don't forget to edit your router IP in the url! It is set to default 192.168.1.1
 +</WRAP>
 +
 +=== 4. Step ===
 Almost done, now we need to discover the services offered by netmodule ITxPT service. Almost done, now we need to discover the services offered by netmodule ITxPT service.
 As discovery tool, we use avahi-discover. As discovery tool, we use avahi-discover.
 Once, started, we can click on a service to get detail information. Once, started, we can click on a service to get detail information.
  
-{{:avahi-fmstopip.png?400|}}+{{:app-notes:avahi-fmstopip.png?600|}}
  
-Now we have the multicast address for the gnss service discovered, we can join the multicast group and recvice the udp messages. +Now we have the multicast address for the fmstoip service discovered, we can join the multicast group and recvice the udp messages.  
 +<WRAP center round tip 100%> 
 +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.  
 +</WRAP>
  
-Note: If you are connected to other networks too, make sure to add a route for the multicast address.  
-In my case, I add the route:  
- 
-<konsole> 
-sudo ip route add 239.0.0.0/8 dev enp5s0 
-</konsole> 
  
 +=== 5. Step ===
 Please clone https://github.com/troglobit/mtools and build the mtools: Please clone https://github.com/troglobit/mtools and build the mtools:
  
 <konsole> <konsole>
-timm@debian:/git$ git clone https://github.com/troglobit/mtools+timm@debian:~/git$ git clone https://github.com/troglobit/mtools
 Cloning into 'mtools'... Cloning into 'mtools'...
 remote: Enumerating objects: 103, done. remote: Enumerating objects: 103, done.
Line 43: Line 78:
 Receiving objects: 100% (103/103), 48.67 KiB | 2.32 MiB/s, done. Receiving objects: 100% (103/103), 48.67 KiB | 2.32 MiB/s, done.
 Resolving deltas: 100% (53/53), done.          Resolving deltas: 100% (53/53), done.         
-klueppel@fang:/tmp$ cd mtools/ +timm@debian:~/git$ cd mtools/ 
-klueppel@fang:/tmp/mtools$ make+timm@debian:~/git/mtools$ make
   CC      msend.o   CC      msend.o
   LINK    msend   LINK    msend
   CC      mreceive.o   CC      mreceive.o
   LINK    mreceive   LINK    mreceive
-klueppel@fang:/tmp/mtools$ +timm@debian:~/git/mtools$ 
 </konsole> </konsole>
  
 +=== 6. Step ===
 Now we can start mrecevie, with multiacast IP and port: Now we can start mrecevie, with multiacast IP and port:
-./mreceive -g 239.255.42.21  -p 14005 +./mreceive -g 239.255.42.21  -p 15015 
-<konsole+ 
-./mreceive -g 239.255.42.21  -p 14005+<code sh output.txt
 +timm@debian:~/git/mtools$ ./mreceive -g 239.255.42.21 -p 15015
 Now receiving from multicast group: 239.255.42.21 Now receiving from multicast group: 239.255.42.21
-Receive msg 1 from 192.168.1.1:59277: <?xml version="1.0"?><GNSSLocationDelivery version="1.1a"><GNSSLocation><Data>$GNRMC,094445.00,A,5005.47450,N,00840.68303,E,0.015,,151121,,,D*60$GNVTG,,T,,M,0.015,N,0.028,K,D*36$GNGGA,094445.00,5005.47450,N,00840.68303,E,2,12,0.78,119.1,M,47.5,M,,0000*4B$GNGSA,A,3,04,06,19,09,07,03,22,02,26,,,,1.21,0.78,0.93*1A$GNGSA,A,3,85,70,69,84,79,68,78,77,,,,,1.21,0.78,0.93*1D$GNGSA,A,3,312,304,321,309,319,311,336,,,,,,1.21,0.78,0.93*28$GPGSV,4,1,15,02,27,313,45,03,31,106,29,04,63,064,27,06,61,267,47*75$GPGSV,4,2,15,07,22,175,26,09,76,235,31,11,32,309,46,16,01,089,*7B$GPGSV,4,3,15,17,01,217,,19,13,235,46,20,06,295,,22,11,113,21*7F$GPGSV,4,4,15,26,09,052,27,36,29,151,,49,33,185,30*4B$GLGSV,3,1,09,68,31,066,25,69,71,355,27,70,25,273,28,77,12,015,21*62$GLGSV,3,2,09,78,33,069,30,79,20,125,25,84,42,224,20,85,40,311,23*64$GLGSV,3,3,09,86,06,345,*56$GAGSV,3,1,10,301,11,105,,304,76,062,26,309,46,250,47,311,47,205,28*6A$GAGSV,3,2,10,312,06,168,22,318,16,274,,319,17,066,28,321,16,058,21*63$GAGSV,3,3,10,327,04,011,29,336,49,290,45 +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> 
-</konsole>+Receive msg 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> 
 +</code> 
  
-Done+<code xml result.xml> 
 +<?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> 
 +</code>