File

advertisement
Instruction Encoding Between the Application and the
Server:
Instructions are one answer pairs.
Instruction encoding:
Every instruction from the server to the client uses an odd identifier.
Every instruction from the client to the server uses an even identifier.
If an error occurs, the server returns the FF command. The client receives
this command and parses the error code and the corresponding error
message:
Exception Information: (ProtocolException)
{
code: 1 (Integer)
info: "Can not find the specified device" (String)
}
Device Information (socket, wall switch, light switch) (device Status
inherited Device):
{
id: "00112233445566" (String [original type 7 byte
array]) (case of 00 at the beginning of the content
behind the MAC address)
pid: "00112233445566" (String [parent device id, the
original type 7 byte array])
name: "socket" (String)
place: "living room" (String)
version: 0 (Integer)
type: 0 (Integer)
online: true (Boolean)
power: [{way: 0, on: false}] (Array [false: OFF]) (List
<Power>)
}
Control Type Value
CODE_SWITCH = 0x0A; // switch commands
CODE_SCENE = 0x10; // Scene mode
CODE_QUERY = (byte) 0xA0; // ON or OFF status query
CODE_QUERY_SN_LIST_VERSION = (byte) 0xAB; // WIFI host
requests query list version
CODE_SN_LIST = (byte) 0xAC; under // Set the hanging
device list
User Information: (UserInfo)
{
name: "username" (String)
pass: "password" (String)
userid: "xxxxxxxx" (String)
phone: "13888888888" (String)
email: "email@addr.com" (String)
offset: 480 (double [time zone offset, hour])
appid: .. (appid)
}
Common Device Information: (NormalDevice)
{
devid: "00112233445566" (String [original type 7 byte
array])
order: 0 (Integer [vendor identification code])
}
Timing Tasks: (TimerTask)
{
id: "xxxxxxxx" (String [original type 16 byte GUID])
hour: 13 (Integer)
minute: 30 (Integer)
day: [false, true, true, true, true, true, false]
(Array [day of the week to perform this task, as a])
repeated: true (Boolean)
enabled: true (Boolean)
repeatOption: 0, 1, 2 ... (0: Repeat mode original Week
1: hour, 2: Day 3: Week 4: April 5: Quarterly, 6: Year
7: The first Tuesday of each month week )
repeatTime: -1,0, 1, 2 ... (-1 infinite loop, 0 not
cycle, ...).
repeatGap: 0,1, 2, 3, 4 (repeat interval)
year, date, month: 1,2,3,4,5,6 (Time)
weekNumMonthly: 1, 2,3 (per month in the first few
weeks)
weekNumYear: 1 .. 54 (per year in the first few weeks)
dayNumYear: 1-366 (per year in the first few days)
Remark1-5
}
Scenarios: (SceneMode)
{
id: "xxxxxxxx" (String [original type 16 byte GUID])
imageno: 1 (Integer)
name: "Home" (String)
}
Preset 16 on the server for the new user profile, the following table
Scenario Device: (SceneDevice)
{
sceneid: "xxxxxxxx" (String [original type 16 byte
GUID])
enabled: true (Boolean)
}
App: Refer to Table Options command to carry between APP and server
FF: abnormal packets returned by the server
Exception information
FE: The client sends heartbeat packets
No Parameters
FD: Server successfully returns heartbeat
No Parameters
FC: Client successfully returns heartbeat
No Parameters
FB: Service sends heartbeat packets
No Parameters
00: The client initiates the connection
No Parameters
01: The server sends landing permission
{
key: "xxxxxxxxxxx" (String)
}
02: The client sends the user name and password information
User Information
03: The server indicates whether the user login is successful
{
result: true (Boolean)
info: User Information
}
04: Client accesses a list of all devices
No Parameters
05: The server returns the user's list of all devices [Device Information array]
[1 device information, device information 2]
06: The client queries the status of individual devices
{
devid: "00112233445566" (String)
}
07: The server returns a single device status
Device Information
08: The client sends the command for device information
Device Information
09: The server returns control results
Device Information
0A: The client sends a request to the server user registration
User Information
0B: The server returns the results of a user registration request
{
result: true (Boolean)
info: 用户信息
}
0C: The client sends commands to add WiFi device information
{
pass: "123" (String)
mac: "001122334455" (String)
name: "2.4G air conditioning" (String)
place: "living room" (String)
}
0D: The server returns the results of adding WiFi devices
{
result: true (Boolean)
info: Device information (Device class is a subclass,
according to the type Device type to make a judgment,
specific device into the appropriate entity class)
}
0E: The client sends a command to add 2.4G device information
{
pass: "123" (String)
sn: "00112233445566" (String)
pid: "11223344556677" (String [parent device id])
name: "2.4G air conditioning" (String)
place: "living room" (String)
}
0F: The server returns the results of adding a 2.4G device
{
result: true (Boolean)
info: Device information (Device class is a subclass,
according to the type Device type to make a judgment,
specific device into the appropriate entity class)
}
10: The client sends the command to delete device information
{
devid: "00112233445566" (String)
}
11: The server returns the results of deleting a device
{
result ": true (Boolean)
info: Device information (Device class is a subclass,
according to the type Device type to make a judgment,
specific device into the appropriate entity class)
}
12: The client sends commands to modify a device information
{
devid: "00112233445566" (String)
name: "2.4G air conditioning" (String)
place: "living room" (String)
}
13: The server returns the results to modify a device
{
result: true (Boolean)
info: Device information (Device class is a subclass,
according to the type Device type to make a judgment,
specific device into the appropriate entity class)
}
14: The client sends to the server to modify user information request
User Information
15: The server returns the results to modify user information
{
result: true (Boolean)
info: User Information
}
16: The client sends a query to the server user information request
No Parameters
17: The server returns the query results of user information
User Information
18: The client sends the command to add a single timed task
{
schedinfo: timing information
ctrlinfo: Device Information
}
19: The server returns the results to add timing tasks
{
result: true (Boolean)
schedinfo: timing information
ctrlinfo: Device information (This class is a subclass
of the Device type, representing the specific device
for this entity)
}
20: The client sends commands to modify a single timed task
{
schedinfo: timing information
ctrlinfo: Device Information
}
21: The server returns the results to modify a timing task
{
result: true (Boolean)
schedinfo: timing information
ctrlinfo: Device information (This class is a subclass
of the Device type, representing the specific device
for this entity)
}
22: The client sends the command to delete a single timed task
{
schedid: "xxxxxxxx" (String [Scheduled Task GUID])
}
23: Delete timed task results returned by the server
{
result: true (Boolean)
schedinfo: timing information
}
24: The client sends a query to a device for all regular tasks Instruction
{
devid: "00112233445566" (String [Device GUID])
}
25: The server returns the query a device timed tasks Instruction
{
devid: "001122233445566"
timerList:
[
{schedinfo: timing information, ctrlinfo: device
information}
{schedinfo: timing information, ctrlinfo: Device
Information}
]
}
26: The client sends the command to add a single common device
Common Device Information
27: The server returns the results to add commonly used device
{
result: true (Boolean)
info: Common Device Information
}
28: The client sends the command to delete a single common device
Common Device Information
29: The server returns the results to delete commonly used device
{
result: true (Boolean)
info: Common Device Information
}
2A: The client sends commands to modify sort commonly used device
{
Common device information,
Common Device Information
}
2B: The server returns the modified device used to sort the results
{
result: true (Boolean)
info:
[
Common device information,
Common Device Information
]
}
2C: The client sends a query commonly device directive
No options
2D: The server returns the query used device directive
{
{devid: "00112233445566", order: 0},
{devid: "11223344556677", order: 1},
}
2E: The client sends the command to add a single profile
Profiles
2F: The server returns the results to add profile
{
result: true (Boolean)
scene: profile
}
30: The client sends the command to delete a single profile
{
sceneid: "xxxxxxxx" (String [scenario GUID])
}
31: The server returns the results to delete profile
{
result: true (Boolean)
sceneid: "xxxxxxxx" (String [scenario GUID])
}
32: The client sends commands to modify a single profile
Profiles
33: The server returns the results to modify profile
{
result: true (Boolean)
scene: profile
}
34: The client sends a query profile list command
No Content
35: The server returns a list of commands query profile
{
Scenarios, scenarios
}
36: The client sends the command to add a single scenario device
{
scenedev: Scenario device
ctrlinfo: Device Information
}
37: The server returns the device to add the scenario results
{
result: true (Boolean)
scenedev: Scenario device
ctrlinfo: Device Information
}
38: The client sends the command to delete a single scene device
{
sceneid: "xxxxxxxx" (String [scenario GUID])
devid: "xxxxxxxx" (String [Device GUID])
}
39: The server returns the deleted scene device results
{
result: true (Boolean)
scenedev: Scenario device
ctrlinfo: Device Information
}
3A: The client sends commands to modify the scenario device
{
scenedev: Scenario device
ctrlinfo: Device Information
}
3B: The server returns the device to modify the scenario results
{
result: true (Boolean)
scenedev: Scenario device
ctrlinfo: Device Information
}
3C: The client sends a query to a profile in all scenarios device directive
{
sceneid: "xxxxxxxx" (String [scenario GUID])
}
3D: The server returns the query scenario device directive
{
{scenedev: Scenario device, ctrlinfo: device information}
{scenedev: Scenario device, ctrlinfo: Device Information}
}
56: The client sends a query device directive (temporarily not)
{
mac: "001122334455" (String)
[sn: "123455789"] (String) [optional]
[hexstr: "FFEEABC05"] (String [byte original format
string]) [optional]
}
57: The server returns the query device results (temporarily not)
{
mac: "001122334455" (String)
[sn: "123455789"] (String) [optional]
[hexstr: "FFEEABC05"] (String [byte original format
string]) [optional]
}
58: The client sends a command to change the password
{
username: "username" (String)
oldPassword: "oldPass" (String
newPassword: "newPass" (String)
}
59: The server returns the result to change the password
No Parameters
50: The client sends logout command
No Parameters
51: The server indicates successful logout
No Parameters
52: The server sends a jump instruction
{
ip: "192.168.1.100" (String)
Port: 50000 (Integer)
}
53: The client indicates successful jump
No Parameters
54: The client sends control device directive (temporarily not)
{
mac: "001122334455" (String)
[sn: "123455789"] (String) [optional]
hexstr: "FFEEABC05" (String [byte original format
string])
}
55: The server returns control results (temporarily not)
{
mac: "001122334455" (String)
[sn: "123455789"] (String) [optional]
hexstr: "FFEEABC05" (String [byte original format
string])
}
60: The client sends the “Forgot Password” command
{
username: "user" (String)
email: "email" (String) [optional]
}
61: The server successfully returns for a “Forgot Password” command
No Parameters
62: The client forgot password verification code sent to the mailbox
{
username: "user" (String)
email: "email" (String)
}
63: The server returns the verification code and UUID
{
uuid: "UUID" (String)
}
64: The client sends the password to the mailbox Forgot Password
{
username: "user" (String)
email: "email" (String)
password: "newPass" (String)
uuid: "UUID" (String)
code: "code" (String)
}
65: The server returns successfully sent Forgot Password (failure to return FF
command)
No Parameters
66: The client sends authentication user name is available
{
username: "user" (String)
}
67: The server returns whether or not the user name is available (returns FF
if it is not)
No Parameters
68: Client registration verification code sent to the mailbox
{
username: "user" (String)
email: "email" (String)
}
69: The server returns the verification code and UUID
{
uuid: " UUID " (String)
}
6A: The client sends the registration information
{
username: "user" (String)
email: "email" (String)
pass: "pass" (String)
phone: "xxxxxxx" (String)
uuid: " UUID " (String)
code: "code" (String)
}
6B: The server returns whether or not the registration is successful (returns
FF if it is not)
No Parameters
6C: The client sends infrared mode control device
{
sn: "0011223344" (String)
mode: "0" (Integer [0 Normal mode, an infrared setting
mode])
}
6D: The server returns the device's infrared mode.
{
sn: "0011223344" (String)
mode: "0" (Integer [0 Normal mode, an infrared setting
mode])
}
6E: The server returned with the original device side of the IR button is
pressed (paired first step).
{
sn: "0011223344" (String)
}
Device receives an IR code
6F: The client sends a command button bindings infrared (paired Step).
{
sn: "0011223344" (String)
button: "1" (Integer [IR keys 1 to 9])
}
App send button and receive infrared codes bind
70: The server returns a successful bind infrared command buttons (paired
third step).
{
sn: "0011223344" (String)
button: "1" (Integer [IR keys 1 to 9])
}
Successful receipt of the device to bind message sent to notify app
71: The client sends the verification code to the server.
{
uuid: " UUID " (String)
code: "code" (String [authentication code])
}
72: Check whether or not the server returns a successful verification code.
No Parameters
73: The client sends parameters to the server for the server to set.
{
appid: "1" (Integer)
locale: "en" (String [Set Language, English: en,
Chinese: ch ...])
}
74: The server returns whether or not it successfully set parameters.
No Parameters
75: The client tells the server to add a device group.
{
groupName: "group1" (String [group name])
}
76: The server successfully returns after adding a device group.
{
groupId: "1" (String [group number])
groupName: "group1" (String [group name])
}
77: The client tells the server to delete a device group.
{
groupId: "1" (String [group number to be deleted])
}
78: The server returns whether or not it successfully removed a device
group.
{
groupId: "1" (String [group number to be deleted])
}
79: The client tells to the server to modify a device group.
{
groupId: "1" (String [group number])
groupName: "group1" (String [group name])
}
7A: The server successfully returns after modifying a device group.
{
groupId: "1" (String [group number])
groupName: "group1" (String [group name])
}
7B: Get all the information sent by the client to the server for all device
groups (group information, group information, and set a timer device
information).
No Parameters
7C: The server returns all information on all device groups (group
information, group information, and set a timer device information).
{
groupId: "1"
groupName: "group1"
deviceList: [Device Information 1, device 2, ...],
timerList: [{schedinfo: timing information, ctrlinfo:
device information (socket device, you only need to use
the power of this field)}, ...]
}
7D: Add a set of devices to the server.
{
groupId: "1" (String [group number])
devid: "0011223344" (String [device ID, beginning with
a length of 14,00 Wifi device, otherwise the attached
device])
}
7E: The server returns whether or not it successfully added a set of devices.
{
groupId: "1" (String [group number])
devid: "0011223344" (String [device ID, beginning with
a length of 14,00 Wifi device, otherwise the attached
device])
}
7F: The client tells the server to remove a device from a device group.
{
groupId: "1" (String [group number])
devid: "0011223344" (String [device ID, beginning with
a length of 14,00 Wifi device, otherwise the attached
device])
}
80: The server returns whether or not it successfully removed a device from
a device group.
{
groupId: "1" (String [group number])
devid: "0011223344" (String [device ID, beginning with
a length of 14,00 Wifi device, otherwise the attached
device])
}
81: The client tells the server to modify a device or devices in a device group.
{
groupId: "1" (String [group number])
deviceList: [devid1, devid2, ..] (ArrayList [String],
device id list)
}
82: The server returns whether or not it successfully modified a device or
devices in a device group.
{
groupId: "1" (String [group number])
deviceList: [devid1, devid2, ..] (ArrayList [String],
device id list)
}
83: The client queries the server for information pertaining to all devices in a
given device group.
{
groupId: "1" (String [ group number ] )
}
84: The server returns information for all devices in a given device group.
{
groupId: "1" (String [ group number ] )
deviceList: [ Device Information 1, device 2 , ... ] ,
}
85: The client tells the server to add a group timer.
{
groupId: "1" (String [ group number ] )
schedinfo: timing information ( timer (TimerTask))
ctrlinfo: Device Information
controlType: "0" (Integer [0, full control , a control
MAC, 2, the control SN])
deviceTypeList: [0,1,2, ...] ( Device Type list WIFI
devices , used to specify when controlType 1:00 , group
control of what wifi device ) (controlType is 0:00 ,
not to set this value )
snTypeList: [{deviceType: "0", subType: "0"},
{deviceType: "0", subType: "1"}, ...] linked list of
device types ( next to determine when controlType is
2:00 , the group What controls the attached device )
(controlType is 0:00 , not to set this value )
}
86: The server returns the result of adding a group timer.
{
groupId: "1" (String [ group number ] )
schedinfo: timing information
ctrlinfo: Device Information
}
87: The client tells the server to delete a group timer.
{
groupId: "1" (String [ group number ] )
schedid: "xxxxxxxx" (String [Scheduled Task GUID])
}
88: The server returns the result of removing a group timer.
{
groupId: "1" (String [ group number ] )
schedid: "xxxxxxxx" (String [Scheduled Task GUID])
}
89: The client tells the server to modify a group timer.
{
groupId: "1" (String [ group number ] )
schedinfo: timing information
ctrlinfo: Device Information
controlType: "0" (Boolean [0, full control, a control
MAC, 2, control SN])
deviceTypeList: [0,1,2, ...] ( Device Type list WIFI
devices , used to specify when controlType 1:00 , group
control of what wifi device ) (controlType is 0:00 ,
not to set this value )
snTypeList: [{deviceType: "0", subType: "0"},
{deviceType: "0", subType: "1"}, ..] linked list of
device types ( next to determine when controlType is
2:00 , the group What controls the attached device )
(controlType is 0:00 , not to set this value )
}
8A: The server returns the result of modifying a group timer success.
{
groupId: "1" (String [ group number ] )
schedinfo: timing information
ctrlinfo: Device Information
}
8B: The client queries the server for timing information pertaining to all
timers in a device group.
{
groupId: "1" (String [group number])
}
8C: The server returns information pertaining to all timers in a device group.
{
groupId: "1" (String [group number])
timerList:
[
{schedinfo: timing information, ctrlinfo: device
information}
{schedinfo: timing information, ctrlinfo: Device
Information}
]
}
8D: The client tells the server to add a device control group.
{
groupId: "1" (String [group number])
ctrlinfo: Device Information
controlType: "0" (Boolean [0, full control, a control
MAC, 2, control SN])
deviceTypeList: [0,1,2, ...] (Device Type list WIFI
devices, used to specify when controlType 1:00, group
control of what wifi device) (controlType is 0:00, not
to set this value)
snTypeList: [{deviceType: "0", subType: "0"},
{deviceType: "0", subType: "1"}, ..] linked list of
device types (next to determine when controlType is
2:00, the group What controls the attached device)
(controlType is 0:00, not to set this value)
}
8E: The server returns the result of adding a device control group.
{
groupId: "1" (String [group number])
ctrlinfo: Device Information
}
User Action:
Added: 0A
Delete:
Change: 14
Charles: 16
Individual device status, location, name Operation:
Added: 0C, 0E
Delete: 10
Change: 12 (08 control device)
Charles: 06
Operation timing tasks:
Increase: 18
Delete: 22
Change: 20
Charles: 24
Common device operation
Increase: 26
Delete: 28
Change: 2A
Charles: 2C
Scenario Mode Operation:
Added: 2E
Delete: 30
Change: 32
Charles: 34
Scenario device operation
Increase: 36
Delete: 38
Change: 3A
Charles: 3C
Download