4. QQ IoT SDK introduction and example explanation


1. Go to QQ IoT official website http://iot.open.qq.com to download the software SDK

S3C2440_20161122_1.6.205_r4288.tar.gz
Note:
In the actual development process, you may download a higher SDK version, don't be nervous.
There are few changes to the old and new SDKs, basically only the library files need to be replaced, and the software API interface is almost unchanged.
Of course, the higher version of the SDK has more functions.

 

2. The file description in the SDK
includes/*.h The definition of the data structure of the software, the declaration of the API interface function
lib library file, the function defined in the library file is the
demo_*.c called through the API interface function in the h file sample program

 


iconv (encoding conversion instruction)
-f: input encoding format
-t: output encoding format
-o: output file name

 


3. View the sample program demo_bind.c, and then explain the use process of QQ IoT devices

1) Sample program demo_bind.c

Core code: Initialize the SDK, establish the connection between the device and the QQ IoT backend
tx_init_device

 


2) When the device is initialized,

a. Device name: Baiwen wired air detector
b. Device PID
c. Device serial number
d. Key (to ensure data security)

This information needs to be stored inside the device, such as storage device nand flash, sd card, etc.,
which are generally stored in the form of files.


File name:
licence.sign.file.txt ---- "certification file
GUID_file.txt ----" device serial number
1000000004.pem ---- "public key (server public key)

 

tx_device_info info
info.device_name = "demo1"; //device name
info.device_serial_number = guid; //device serial number
info.device_license = license; //authentication file
info.server_pub_key = svrPubkey; //public key (server public key )
info.product_id = 1000000004; //device PID

 

tx_device_notify notify

tx_init_path init_path


In TXDeviceSDK.h:
Interface Description: Initialize Device SDK
tx_init_device(&info, ¬ify, &init_path);


Interface description: Exit all device SDK related logic
tx_exit_device();

 

Public and private keys
http://blog.csdn.net/21aspnet/article/details/7249401


Assignment
1. Preview: Explanation of terms, adding new equipment

 

Next lesson:
Refer to demo_bind.c and
use the license and key packages provided by Baiwen.com to demonstrate the connection between mobile QQ and QQ IoT devices

 

 

4. Use the license and key packages provided by Baiwen.com to demonstrate the connection between mobile QQ and QQ IoT devices

1) Modify the content of the config file
/etc/qq_iot/demo_bind/config file as follows:
1700003137
1700003137.pem
GUID_file[your device serial number SN].txt
licence.sign.file[your device serial number SN].txt

Modify the device serial number SN in the config file. If the device serial number SN is 1700003137000001, it becomes:
1700003137
1700003137.pem
GUID_file[1700003137000001].txt
licence.sign.file[1700003137000001].txt


On ubuntu system:

cp libtxdevicesdk.so /work/nfs_root/qq_iot/lib/

cp SDKDemo_bind /work/nfs_root/qq_iot/demo_bind/

mount -t nfs -o nolock 192.168.1.184:/work/nfs_root /mnt

 


On the development board system:
cp libtxdevicesdk.so /lib

cp SDKDemo_bind /qq_iot/

Copy the key file to the following directory /etc/qq_iot/demo_bind/
cp key/* /etc/qq_iot/demo_bind/


[1970-01-01 00:07:08][Main:935][CSProcessor:120]: WLAN connection with tencent iot server [112.90.78.168:443] is setting up
[1970-01-01 00:07:08][Main:935][CSProcessor:641]: CBICSProcessor::OnConnect fail [112.90.78.168:443]
[1970-01-01 00:07:08][Main:935][sso.list:200]: OnConnectCallback: bSuccess = 0 IP = 112.90.78.168 Port = 443
[1970-01-01 00:07:08][Main:935][sso.list:925]: PingNextServer: index = 10 ip = 112.90.78.168 port = 8080 wait time = 8


Set the network management
route add default gw 192.168.1.1

set dns server
cat /etc/resolv.conf


Note:
The license_key package can only be used by one user. It is recommended not to spread and publish it.
If other users use it, your device serial number may not be used by yourself.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325362180&siteId=291194637