SNoti provides enterprises with an SSL communication API for pushing device-related events in real time and controlling the corresponding devices.
Note: Before using the SNoti service, you must first apply for the SNoti service access and set the whitelist.
Download link:
Http://jingyan.baidu.com/article/bea41d435bc695b4c41be648.html
Installation process:
Http://jingyan.baidu.com/article/d7130635194f1513fcf47557.html
Installation process:
Http://jingyan.baidu.com/article/d7130635194f1513fcf47557.html
If you decide to use SNoti for your product, you need to contact Gizwits technical support and provide the following information for the product, including product key and product name.
SNoti demo source code download link:
https://github.com/gizwits/noti-java-demo/tree/v2.0.0-netty
Gizwits provides two sets of SNoti demo source code:
Find AuthId and AuthSecret as follows:
Note:
Types of writable data points include: Boolean, enumeration, numeric, and extended type. The format is “name1”: value1, of which “name1” refers to the name of the data point, and value1 refers to the value of the data point. The value might be true/false (bool), a Unicode encoded string such as \u62bd(enum), a number or byte array (such as [23,2,3], for extended type). See the following examples:
Following online UTF-8 encoder is recommended:
http://tool.chinaz.com/tools/utf-8.aspx
(1) Issue SNoti control instructions
The format for sending raw data looks like this: raw={1,22,33}
Note: the binary data should be converted to a byte array. If you want to send 010203, it should be
1 | { |
In general, a protocol payload is a hexadecimal array, such as [0x00, 0x00, 0x1a, …].
Here you need to convert it into a decimal array. For example, the payload of decimal 123 is supposed to be raw=[123]
(2) Device reports its state
After the device receives a control instruction issued by the cloud, the device actively reports its current state.
FF FF 00 09 05 00 00 00 04 01 02 03 18
Because the data received is transparently transmitted, it is base64 encoded, and you have to decode it yourself.
Online base64 decoder link:
http://www1.tc711.com/tool/BASE64.htm
(1) Right-click the project, select Run As->Maven Install, and then click Run.
(2) Run cmd.exe and open the target directory. Run java -jar gizwits-noti-demo-2.0.0-jar-with-dependencies.jar
(3) Input rc to issue a control instruction. Check the cloud communication log to see if it succeeds.
Figure 1: The project uses V4 product data point format to issue a control instruction
Figure 2: The project uses V4 product custom format (transparent transmission without data points) to issue a control instruction
(4) The device actively reports its current state.
FF FF 00 09 05 00 00 00 04 01 02 03 18
Because the data received is transparently transmitted, it is base64 encoded, and you have to decode it yourself.
Base64 decoding as follows
SNoti API:
http://docs.gizwits.com/en-us/cloud/NotificationAPI.html