Preparations
UDP device simulation tool download
NetAssist network debugging assistant, is a TCP/IP network debugging tool developed under the Windows platform, integrating TCP/UDP server and client, is one of the necessary professional tools for network application development and debugging, can help network application design, development, testers check the data transmission and reception status of the developed network application software/hardware, improve the development speed, simplify the complexity of development, and become a powerful assistant for TCP/UDP application development and debugging.
http://www.cmsoft.cn/resource/102.html
The platform creates a simulated device
Create a conversion script
First assume that the uploaded data is the modbus return value: 01 03 02 00 38 B9 96
var teleData = {};
teleData.source = params;
tempVal = params;
teleData.test = (parseInt('0x'+tempVal.substr(6, 4))).toFixed(2);
/*必填:将数据返回*/
out.datas = teleData;
/*必填:true表示设备上报的遥测数据,false表示命令下发的响应数据*/
out.telemetry = true;
prompt
This test script converts the 0x0038 of registers in the data uploaded to the platform to decimal 56 and preserves the output to two decimal places.
note
The created script is closed by default and needs to be manually enabled before it can be invoked.
Create a gateway product
prompt
The access protocol used here is TCP because the platform can also access the UDP protocol by selecting "Access TCP Protocol" when the platform is accessed.
Create a gateway subdevice product
prompt
The parsing script used by the gateway sub-device needs to be configured separately, and you can directly select it here and after the configuration is used.
note
The gateway child device creation Solids model identifier must match the property name passed in the method.
Create a gateway device
prompt
If you don't have an organization, you can add a new organization.
prompt
After creating the gateway device, the gateway device's credentials are modified, that is, the Access Token value, and the simulation tool needs to send the registration package according to the modified credentials, and the content of the registration package is the Access Token value.
Create a gateway subdevice
note
The gateway subdevice must be in the same organization as the gateway device.
prompt
The device representation filled in when creating the gateway subdevice is the address bit in the data returned by modbus, and the return of this test is 01.
Simulate UDP device access
Use tools to connect platforms
prompt
If you cannot connect to the platform, check whether the corresponding port is occupied, or check for network problems.
note
The server address and port used in the test need to be filled in according to the actual situation, and the software fills in the address and port in the "remote host" after opening the corresponding port of the PC.
Use tools to deliver data
The first thing to do is to send the registration package with the test tool:
prompt
When using the test tool to send the registration package, you need to select ASCII code to send it, and the content of the sending registration package must be consistent with the certificate.
note
To send data using the test tool is required to select HEX Send.
prompt
After sending data to the platform using the simulation tool, the value displayed by the TSL model is the decimal number 56 of the 0x4A.