Changes

no edit summary
Line 179: Line 179:     
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.
 
The value of the first byte is highlighted in <span style="color:blue">'''blue'''</span> and, in this case, it denotes that the APN value should be changed for the first SIM card. The value of the APN string itself is highlighted in <span style="color:green">'''green'''</span>. Use an ASCII to Decimal online converter to convert individual letters to Decimal code.
 +
 +
===Send SMS message===
 +
----
 +
To send an SMS message from the router using Modbus, first, we would need to specify the recipient‘s number and the message itself. This information should be stored in register address <b>397</b>, of which the first <b>10</b> registers are dedicated to a phone number while the remaining <b>80</b> registers – are for message content. Afterward, we would need to set the <b>396</b> register to a value of 1.
 +
 +
* Phone number:
 +
 +
Let’s say we have the following phone number, which would be used as a recipient <b>0011123456789</b> (where 00 is a substitute for a plus sign and 111 represents the country code). This number’s representation in hexadecimal format would be 30 30 31 31 31 32 33 34 35 36 37 38 39, but since <b>10</b> registers are reserved for a phone number, the remaining spaces should be filled with zeroes, resulting in the following phone number representation: <b>0x3030 0x3131 0x3132 0x3334 0x3536 0x3738 0x3900 0 0 0</b>. Here 0x characters are needed for the modbus-cli application to treat input as hexadecimal values.
 +
 +
* Message:
 +
 +
If we would want to send <b>Hello, this is a test SMS message</b>, this message’s representation in hexadecimal format would be <b>0x4865 0x6C6C 0x6F2C 0x2074 0x6869 0x7320 0x6973 0x2061 0x2074 0x6573 0x7400</b>.
 +
 +
* Full command:
 +
 +
Executing the following two modbus-cli commands would allow us to send SMS message:
 +
$ modbus write -D -p 502 192.168.1.1 %MW397 0x3030 0x3131 0x3132 0x3334 0x3536 0x3738 0x3900 0 0 0 0x4865 0x6C6C 0x6F2C 0x2074 0x6869 0x7320 0x6973 0x2061 0x2074 0x6573 0x7400
 +
$ modbus write -D -p 502 192.168.1.1 %MW396 1
 
}}
 
}}
  

Navigation menu