The Gizwits App SDK for APICloud (hereinafter referred to as the SDK) mainly helps developers to maintain the user system, the binding relationship between users and devices, the device configuration of network access, the acquisition of the device status, and the device commands.
The latest version is 1.3.0. For the native Gizwits App SDKs, the latest version is 2.04.04.
The SDK startup API startWithAppID gets new parameters of the domain name and the productKey filter.
Device configuration API setDeviceOnboarding adds a custom enumeration value for the module type parameter for developers to use their own configuration library.
The scheduled task API will be updated in the next release. The current scheduled task API has been deprecated and it is not recommended to use it.
About backwards compatibility with versions prior to 1.2.4#
Some APIs have been deprecated in the current release. However, they allow for backwards compatibility with versions prior to 1.2.4. Your Apps can continue using the APIs with no API call changes, but pay attention to the following three points:
When the new gizWifiSDK module reports device Data Points, the Data Point values of Boolean type are returned as true or false strictly following the JSON format, while the old gizWifiSDK module returns 1 or 0. When the App receives a Boolean type Data Point, please update the variable receiving method using Boolean type.
In the new gizWifiSDK module, all APIs except the following deprecated APIs now return values using new error codes. The App can convert the new error code value to the old error code value through the error codes conversion function errorCodeConversion. The errorCodeConversion function description is showed on the Constant page below the old and new error codes comparison table.
When any API is successfully executed, the returned msg field corresponding to the error code 0 uses the string “GIZ_SDK_SUCCESS” based on the new error codes.
In addition, the SDK will issue device commands in strict accordance with the JSON format. For example, if a device’s Data Point is defined as Boolean type, the corresponding command can only be sent with true/false. If it is 1/0 or “1” / “0”, it will fail to issue.
Function comparison between deprecated API and new API#
It is not mandatory for the deprecated API (allowing for backwards compatibility with versions prior to 1.2.4.) to be replaced. Apps that have already been developed can continue to use them, but it is recommended for newly developed Apps to use the new API directly. For developers who don’t care about deprecated API, skip this section.
Enumeration value changes:
GizWifiConfigureMode
1 2
COPIEDDescription: The sequence number of the enumeration value starts from 0. See the Constant page. Method: the SoftAP mode value that was 1, now is changed to 0; the AirLink mode value that was 2, now is changed to 1.
Deprecated API:
gizWifiSDK class
setDeviceWifi
1 2
COPIEDDescription: the API name is changed. Alternative: setDeviceOnboarding, the enumeration values of the parameter mode are changed (0 = GizWifiSoftAP, 1 = GizWifiAirLink).
updateDeviceFromServer
1 2
COPIEDDescription: The Gizwits App SDK will automatically download and update the device configuration file, and the App doesn’t need to use this API. Alternative: None.
bindDevice
1 2
COPIEDDescription: For device security reasons, it is recommended to use a more secure device binding API. The Gizwits App SDK will automatically bind the logged-in LAN devices, so for LAN devices, the App does not need to call the binding API. Alternative: bindRemoteDevice, requires product productKey and corresponding productSecret, and device MAC to bind devices.
registerUserByPhoneAndCode
registerUserByEmail
1 2
COPIEDDescription: These two APIs are merged into one API. Alternative: registerUser
transAnonymousUserToNormalUser
transAnonymousUserToPhoneUser
1 2
COPIEDDescription: These two APIs are merged into one API. Alternative: transAnonymousUser
changeUserPasswordByCode
changeUserPasswordByEmail
1 2
COPIEDDescription: These two APIs are merged into one API. Alternative: resetPassword
changeUserEmail
changeUserPhone
changeUserAdditionalInfo
1 2
COPIEDDescription: These three APIs are merged into one API. Alternative: resetPassword
gizWifiDevice class, GizWifiCentralControlDevice class
login
disconnect
1 2
COPIEDDescription: The device login mechanism has been changed. The Gizwits App SDK supports device automatic login and automatic reconnection after device disconnection. When the reconnection is successful, the device will report the device current status. Alternative: setSubscribe
getIsBind
1 2
COPIEDDescription: To optimize the API usage, the Gizwits App SDK can determine the device binding status, and the App does not need to pass other parameters. Alternative: Using the isBind parameter of the getDeviceInfo method
Deprecated parameters:
passcode
1 2 3 4 5 6
COPIEDDescription: No longer return the valid device password string for security reasons
Related APIs: The devices information returned by getBoundDevices in GizWifiSDK class The devices information returned by getDeviceInfo in GizWifiDevice class The devices information returned by getDeviceInfo in GizWifiCentralControlDevice class
isOnline
isConnected
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
COPIEDDescription: These two parameters are merged and replaced by parameter netStatus. netStatus set to 2 is equivalent to isConnect equal to true netStatus set to 0 or 1 is equivalent to isConnect equal to false netStatus set to 0 is equivalent to isOnline equal to false netStatus set to 1 or 2 is equivalent to isOnline equal to true
Related APIs: The devices information returned by getBoundDevices in GizWifiSDK class The returned value of registerNotifications in GizWifiDevice class The returned value of registerNotifications in GizWifiCentralControlDevice class The returned value of GetSubDevices in GizWifiCentralControlDevice class The returned value of addSubDevice in GizWifiCentralControlDevice class The returned value of deleteSubDevice in GizWifiCentralControlDevice class The returned value of registerNotifications in GizWifiSubDevice class The returned value of getDeviceInfo in GizWifiSubDevice class
cmd
entity0
1 2 3 4 5 6
COPIEDDescription: To optimize the parameter format for the issued commands, when the command is issued, directly pass the Data Point names and values. When the data is reported, the Data Point names and values can also be directly reported.
Related APIs: To issue commands using write in GizWifiDevice class To issue commands using write in GizWifiCentralControlDevice class To issue commands using write in GizWifiSubDevice class
status
1 2 3 4 5 6 7 8 9 10
COPIEDDescription: To optimize the data reporting format, directly report the Data Point names and values.
Related APIs: The returned value of registerNotifications in GizWifiDevice class The returned value of registerNotifications in GizWifiCentralControlDevice class The returned value of registerNotifications in GizWifiSubDevice class
The returned value of write in GizWifiDevice class The returned value of write in GizWifiCentralControlDevice class The returned value of write in GizWifiSubDevice class
The gizWifiSDK class is the base class of Gizwits App SDK. This class provides the basic APIs for the SDK initialization, settings, user management, and device management.
It is used to start the SDK. Note that other API functions can be performed normally after this API function is successfully executed. The SDK startup may take 1 to 2 seconds on the Android platform. It is recommended that you continue to call other API functions when you receive the returned ret value 8316 (it means the SDK startup success) or delays about 2 seconds after startup.
Description: The application ID that you applied for on the Gizwits website.
cloudServiceInfo:
Type: numeric array
Default: 0
Description: The domain information of the server to be used. Developers who use the Gizwits production cloud service do not need to use this parameter, which is required only when you want to connect to other cloud services. If the domain name information does not specify a port number, the SDK uses the default service port. In this case, write the domain name like this: api.gizwits.com. If you need to specify a special port, you need to specify both the HTTP and HTTPS ports. In this case, write the domain name like this: api.gizwits.com:81&8443
Internal fields
1 2 3 4 5
COPIED{ openAPIInfo: // API service domain name siteInfo: // site service domain name pushInfo: // push notification service domain name }
specialProductKeys:
Type: string array
Default: none
Description: A list of productKeys of devices to be filtered. Omit to get all discovered devices. Once specified, the SDK will only return the devices after filtered.
COPIED// do not specify the domain name and the productKey filter, the code for reference is as follows: var gizWifiSDK = api.require('gizWifiSDK'); gizWifiSDK.startWithAppID({"appID": "your_app_id"}, function(ret, err) { alert("ret = " + JSON.stringify(ret) + "err = " + JSON.stringify(err)) });
// to specify cloudServiceInfo and productKey filter, the code for reference is as follows: var gizWifiSDK = api.require('gizWifiSDK'); gizWifiSDK.startWithAppID({"appID": "your_app_id", "specialProductKeys": ["your_product_key"], "cloudServiceInfo": {"openAPIInfo": "xxx.xxxx.com", "siteInfo": "xxx.xxxx.com ”}}, function(ret, err) { alert("ret = " + JSON.stringify(ret) + "err = " + JSON.stringify(err)) });
COPIED{ GizEventSDK: // SDK event {errorCode: xxx, msg: "xxx"}, // event code (see GizWifiErrorCode, numeric type) GizEventDevice: // device exception event {errorCode: xxx, msg: "xxx"}, // event code (see GizWifiErrorCode, numeric type) GizEventM2MService: // M2M exception event {errorCode: xxx, msg: "xxx"}, // event code (see GizWifiErrorCode, numeric type) GizEventToken: // Token expiration {errorCode: xxx, msg: "xxx"}, // event code (see GizWifiErrorCode, numeric type) devices: [{ // device array (the following fields are device object information), array type mac: // device MAC address, string type did: // device unique identifier, string type ip: // device IP address, string type productKey: // product identifier of the device, the string type productName: // product name of the device, string type remark: // device remark information, string type alias: // device alias, string type type: // device type (see enumeration definition GizWifiDeviceType), numeric type netStatus: // device network state (see enumeration definition GizWifiDeviceNetStatus), numeric type isLAN: // Whether the device is in the same LAN, boolean type isBind: // Whether the device is bound, boolean type isDisabled: // Whether the device has been logged out in the cloud, boolean type isProductDefined: // Whether the device defines a Data Point, boolean type isSubscribed: // Whether the device is subscribed, boolean type }] }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type }
COPIED{ openAPIDomain: // api domain name, string type openAPIPort": // api port, numeric type siteDomain: // site domain name, string type sitePort: // site port, numeric type }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type }
COPIED{ devices: [{ // device array (the following fields are device object information), array type mac: // device MAC address, string type did: // device unique identifier, string type ip: // device IP address, string type productKey: // product identifier of the device, the string type productName: // product name of the device, string type remark: // device remark information, string type alias: // device alias, string type type: // device type (see enumeration definition GizWifiDeviceType), numeric netStatus: // device network state (see enumeration definition GizWifiDeviceNetStatus), numeric type isLAN: // Whether the device is in the same LAN device, boolean type isBind: // Whether the device is bound, boolean type isDisabled: // Whether the device has been logged out in the cloud, boolean type isProductDefined: // Whether the device defines a Data Point, boolean type isSubscribed: // Whether the device is subscribed, boolean type }] }
It is used to configure the device routing. To be able to connect the device to a Wi-Fi network, you need to configure the device with the Wi-Fi router first. When configuring, you need to send the router SSID and password to be configured to the device.
The device configuration supports two modes: SoftAP and AirLink. Pressing different buttons on the device allows the device to enter the corresponding configuration mode. For the detailed operation, please visit the Gizwits website.
When configuring the SoftAP mode, the device module will create a hotspot, to which the mobile phone must be connected before it can be configured. If the device firmware is provided by Gizwits, the module hotspot name prefix is “XPG-GAgent-“ and the password is “123456789”. When the device is in AirLink mode, the phone can start configuration at any time. However, regardless of any configuration mode, when the device is online, the mobile phone must be connected to the WLAN to be configured so as to confirm that the device has been configured successfully. When the device is configured successfully, the device MAC address is returned in the callback. If the device is reset, the device did may be available in the device discovery callback.
Description: Device configuration mode (see GizWifiConfigureMode enumeration definition).
softAPSSIDPrefix:
Type: string
Default: none
Description: The full SSID name in SoftAPMode mode of Gizwits Gokit with the default prefix is “XPG-GAgent-“.
timeout:
Type: numeric
Default: 30
Description: Configure the timeout period. The timeout is recommended to be set to 60 seconds.
gagentTypes:
Type: numeric array
Default: 4
Description: Module type (see GAgentType enumeration definition). If you do not specify this parameter, the Espressif module is configured by default. GizWifiGAgentType defines all the module types supported by the SDK. GizWifiGAgentType also defines a GizGAgentOther enumeration value for developers to use their own configuration library for device configuration.
COPIED{ device:{ // the successfully configured device. The following fields are device information: "mac": // device MAC "did": // device did "productKey":// device type identifier } }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type }
Get a list of device hotspots. When the device Wi-Fi module is in the SoftAP mode, you can obtain a list of Wi-Fi hotspots that the device searches for. This API requires the phone to connect to the SoftAP hotspot of the device module before it can work.
Get a list of bound devices. There are different ways for different network environments: When the mobile phone can access the external network, the API initiates a request for obtaining a bound device list to the cloud; When the mobile phone cannot access the external network, the devices in the current WLAN are discovered in real time, but retains the bound device that has been acquired before; When the mobile phone has no connection, the unbound devices in the WLAN will disappear, but the bound devices that have been acquired before will be retained.
COPIED{ devices: [{ // device array (the following fields are device object information), array type Mac: // device MAC address, string type did: // device unique identifier, string type ip: // device IP address, string type productKey: // product identifier of the device, string type productName: // product name of the device, string type remark: // device remark information, string type alias: // device alias, string type type: // device type (see enumeration definition GizWifiDeviceType), numeric netStatus: // device network state (see enumeration definition GizWifiDeviceNetStatus), numeric isLAN: // Whether the device is in the same LAN, boolean type isBind: // Whether the device is bound, boolean type isDisabled: // Whether the device has been logged out in the cloud, boolean type isProductDefined: // Whether the device defines a Data Point, boolean type isSubscribed: // Whether the device is subscribed, boolean type }] }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type }
User login. You need to log in with the registered user name and password, which can be the mobile phone user name, email user name or regular user name.
Login with third party account which supports Baidu, Sina, and QQ. You need to use the third-party shareSDK tool or the corresponding SDK to obtain the uid and token before using this API.
COPIED{ uid: // uid obtained after logging in to Gizwits IoT Cloud, string type token: // token obtained after logging in to Gizwits IoT Cloud, string type }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type }
Verify the SMS verification code. Note that after verifying the SMS verification code, the verification code will be invalid and can no longer be used for registration with the mobile phone.
User registration with specified user type. The user name of the mobile phone user is the mobile phone number, the user name of the Email user is the Email address, and the user name of the regular user can be the normal user name.
Description: SMS verification code, invalid after registration and cannot be used again.
accountType:
Type: string type
Default: none
Description: User type, see the GizUserAccountType enumeration definition for details. When registering with mobile phone number, this parameter is specified as the mobile phone user. When registering with Email address, this parameter is specified as the Email user. When registering with a normal user name, this parameter is specified as the regular user.
The user type conversion for anonymous user who can be converted to a mobile phone user or regular user. Note that the target user account must be unregistered.
Description: The token obtained when the user logs in or registers.
userName:
Type: string
Default: none
Description: The target user account of regular user or mobile phone user
password:
Type: string
Default: none
Description: The user password after conversion
verifyCode:
Type: string
Default: none
Description: SMS verification code to be used when converted to a mobile phone user
accountType:
Type: numeric
Default: none
Description: User type, see the GizThirdAccountType enumeration definition for details. When the target user name is a mobile phone number, this parameter is specified as 1. When the target user name is a regular user account, this parameter is specified as 0.
Description: The mobile phone number or Email address of the user account whose password is to be reset
verifyCode:
Type: string
Default: none
Description: SMS verification code used when resetting a mobile phone user password.
newPassword:
Type: string
Default: none
Description: New password
accountType:
Type: numeric type
Default: none
Description: User type, see the GizThirdAccountType enumeration definition for details. When the user name of the password to be reset is a mobile phone number, this parameter is specified as mobile phone user. When the user name of the password to be reset is an Email address, this parameter is specified as Email user.
Description: The token obtained when the user logs in or registers.
userName:
Type: string
Default: none
Description: The mobile phone number or Email address to be modified
verifyCode:
Type: string
Default: none
Description: SMS verification code to be used when modifying the mobile phone number
accountType:
Type: string
Default: none
Description: User type, see the GizThirdAccountType enumeration definition for details. When the mobile phone number is modified, the accountType is set to 1; when the regular user name is modified, the accountType is set to 2; when the personal information is modified, the accountType is set to 0; when the user name and personal information are modified at the same time, the accountType is specifed according to the mobile phone number or Email address to be modified.
additionalInfo:
Type: string
Default: none
Description: The personal information to be modified, as detailed in the GizUserInfo class definition. If you only want to modify your personal information, you need to specify the token and omit username and code.
Internal fields:
1 2 3 4 5 6 7
COPIED{ "name": // nickname, string type "gender": // gender, see UserGenderType enumeration, numeric type "birthday": // birthday, string type "address": // address, string type "remark": // comment, string type }
COPIED{ "uid": // user uid, string type "username": // username, string type "email": // Email address, string type "phone": // mobile phone number, string type "isAnonymous": // Whether it is an anonymous user, boolean type "name": // nickname, string type "gender": // gender, UserGenderType enumeration type "birthday": // birthday, string type "address": // address, string type "remark": // comment, string type }
err
Type: JSON object
Internal fields
1 2 3 4
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type }
Get a list of device groups under the user account. You need to complete the user login before you can get the device grouping list. Device grouping refers to dividing the devices managed by a central control gateway into multiple groups, which facilitates batch operation of devices. A device group can only contain one type of devices. For the common application scenarios, such as turning off all the lights in a room before going to bed, dimming the two floor lamps on the bedside, you can divide the devices into two groups, one is the switch light group, and the other is floor lamp group.
Description: The uid obtained when the user logs in or registers.
token:
Type: string
Default: none
Description: The token obtained when the user logs in or registers.
productKey:
Type: string
Default: none
Description: Specify the group type identifier
groupName:
Type: string
Default: none
Description: Specify the group name
specialDevices:
Type: JSON object
Default: none
Description: Specify the devices to be added into the group. Omit not to add devices.
Internal fields
1 2 3 4 5
COPIED{ "mac": // MAC address of the central control gateway to which the child device belongs, string type "did": // did of the central control gateway to which the child device belongs, string type "subDid": // child device's did, string type }
Description: The uid obtained when the user logs in or registers.
token:
Type: string
Default: none
Description: The token obtained when the user logs in or registers.
gid:
Type: string
Default: none
Description: The ID of the group to be edited
groupName:
Type: string
Default: none
Description: The name of the group to be edited
specialDevices:
Type: JSON object
Default: none
Description: The device information in the group to be edited. Omit not to specify a device.
Internal fields
1 2 3 4 5
COPIED{ "mac": // MAC address of the central control gateway to which the child device belongs, string type "did": // ID of the central control gateway to which the child device belongs, string type "subDid": // child device's did, string type }
Register to receive device status change notifications. You can register with the device’s MAC address and did. After registration, the device’s subsequent login state changes and running state changes are reported to the App in real time. After the device is unbound or disconnected, the data will not be reported again.
COPIED{ device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } netStatus: // device online state (see enumeration definition GizWifiDeviceNetStatus), numeric type data: { // device state, string type "attrName": "attrValue", // Data Point name: operation value } alerts: { // alarm, array type "attrName": "attrValue" // Data Point name: Alarm message } faults: { // fault, array type "attrName": "attrValue" // Data Point name: Fault message } binary: // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } }
Manage the device subscription. Subscribe to the device to receive the device push notifications and unsubscribe not to receive the device push notifications. After subscribing to the device, the SDK will automatically log in and automatically bind the device. After unsubscribing, the device will be automatically disconnected, but will not be automatically unbound. In general, device subscriptions will succeed, and the SDK will remember if you subscribe to a device.
COPIED{ isSubscribed: // Whether you subscribe the device or unsubscribe, boolean type device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } }
Get the device status. Performing subscription makes a device controllable in order to obtain its states, including the running states, alarms, faults, and data via transparent transmission.
COPIED{ device:{ // The device object on which the operation command is executed successfully (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } "data": { // device status, object type "attrName": "attrValue", // Data Point name: Operation value. If the Data Point is an extension type, the operation value is a base64 encoded string. } "alerts": { // alarm, object type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, object type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } }
It is used to send commands to devices. Performing subscription makes a device controllable in order to issues commands. Device control supports both Macro Cycle and Micro Cycle (i.e. WAN and LAN environments), and the SDK will give priority to Micro Cycle. Device control of Macro Cycle is only performed when the device can only be accessed through Macro Cycle. After the commands from Apps reach the device, the device current state changes will be reported. The Apps can obtain status data through the callback functions, including the device running status, alarms, faults, and data via transparent transmission.
Hardware product developers define the device’s operational command set based on product capabilities. On the App side, the device’s operation commands are formatted as Data Points and sent to the device. Data Points can be defined as Boolean, string, numeric, and extension type. How to define Data Points, please visit the Gizwits website.
If commands of device control need to transferred via transparent transmission, it can be implemented by defining Data Points of the extension type. For the binary data, it should be encoded as a base64 string and then passed in the data parameter of the write API. Similarly, for the binary data transparently transmitted by the device to the App, after received, it must first be decoded into binary data from base64 to be used correctly. Please note that you must use base64 codec, otherwise the binary data cannot be transparently transmitted correctedly.
Requirement: The format of the issued command should be delivered in the correct JSON type. For example, a boolean value issued with 0 or 1 may result in failure to deliver.
Description: The device object to which the operation commands is to be sent, the device object information can be obtained when the device list is acquired.
Internal fields
1 2 3 4
COPIED{ "mac": // device MAC address, string type "did": // device did, string type }
sn:
Type: numeric type
Default: none
Description: The command sequence number can be carried when the operation command is sent. The command sequence number is generated and maintained by the App.
data:
Type: JSON object
Default: none
Description: The operation command to be sent.
Internal fields
1 2 3 4 5 6 7 8 9
COPIED{ "data": { // device Data Point object type ...... "attrName": "attrValue", // Operation command: Data Point name, operation value // The Data Point name is a string type, and the type of the operation value is defined in the Data Point. // If the Data Point is an extension type, the operation value needs to be a base64 encoded string ...... } }
COPIED{ device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } "sn": // The sequence number of the issued command "data": { // state, object type "attrName": "attrValue", // Data Point name: operation value. If the Data Point is an extension type, the operation value needs to be a base64 encoded string. } "alerts": { // alarm, object type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, object type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type device:{ // device object, object type "mac": // device MAC address, string type "did": // device did, string type } }
COPIED{ device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type } hardwareInfo: { // device hardware information, object type "wifiHardVer": // Wi-Fi hardware version number, string type "wifiSoftVer": // Wi-Fi software version number, string type "mcuHardVer": // device hardware version number, string type "mcuSoftVer": // device software version number, string type "firmwareId": // firmware fid, string type "firmwareVer": // firmware version number, string type "productKey": // product type identifier } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // device object, object type "mac": // device MAC address, string type "did": // device did, string type } }
Exit the End-of-line test mode. This API can be called without subscribing to the device, and the device will respond when it enters the End-of-line test mode.
COPIED{ device: { // device object (the following field is device information), object type mac: // device MAC address, string type did: // device unique identifier, string type ip: // device IP address, string type productKey: // product identifier of the device, string type productName: // product name of the device, string type remark: // device remark information, string type alias: // device alias, string type type: // device type (see enumeration definition GizWifiDeviceType), numeric type netStatus: // device network status (see enumeration definition GizWifiDeviceNetStatus), numeric type isLAN: // Whether the device is in the same WLAN, boolean type isBind: // Whether the device is bound, boolean type isDisabled: // Whether the device has been logged out in the cloud, boolean type isProductDefined: // Whether the device defines a Data Point, boolean type isSubscribed: // Whether the device is subscribed, boolean type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device: { // device object (the following field is device object information), object type "mac": // device MAC address, string type "did": // device did, string type } }
This is the Gizwits central control Wi-Fi device class. This class provides the functions of the central control device to obtain the child device list, add child devices, and delete child devices. The central control device class inherits from the GizWifiDevice class and can use all APIs in the GizWifiDevice class.
After the device list is obtained, the type field in the getDeviceInfo() of the GizWifiDevice class can be used to know whether the device is a central control device. After the central control device logs in, it can perform operations such as adding and deleting child devices.
Register to get the child device list change notifications. When the central control device is in the state of adding a child device, it will actively report the child device that is currently connected to the network. After notification registration, the SDK will report the list of child devices to the App.
Description: the central control device object whose notifications are to be received after registration, the device object information can be obtained when getting the device list.
Internal fields
1 2 3 4
COPIED{ "mac": // central control device MAC address, string type "did": // central control device did, string type }
COPIED{ device:{ // central control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } netStatus: // The network state of the central control device (see the enumeration definition GizWifiDeviceNetStatus), numeric type subDevices: { // list of child devices reported by the control device, object array type "mac": // central control device MAC, string type "did": // central control device did, string type "subDid": // central control child device did, string type "netStatus": // Whether the central control child device is online (see the enumeration definition GizWifiDeviceNetStatus), numeric type "subProductKey": // central control child device type identifier, string type "subProductName": // central control child device product name, string type "type": // central control child device type (see enumeration definition GizWifiDeviceType), numeric type "productKey": // central control device type identifier, string type "productName": // central control device product name, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device: { // device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } }
COPIED{ device: { // central control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } subDevices: { // list of child devices reported by the control device, object array type "mac": // central control device MAC, string type "did": // central control device did, string type "subDid": // child device did, string type "subProductKey": // child device type identifier, string type "subProductName": // child device product name, string type "type": // child device type, numeric type "netStatus": // Whether the central control child device is online (see the enumeration definition GizWifiDeviceNetStatus), numeric type "productKey": // central control device type identifier, string type "productName": // central control device product name, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } }
COPIED{ device:{ // central control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } subDevices: { // list of child devices reported by the central control device, object array type "mac": // central control device MAC, string type "did": // central control device did, string type "subDid": // child device did, string type "subProductKey": // child device type identifier, string type "subProductName": // child device product name, string type "type": // child device type, numeric type "netStatus": // Whether the central control child device is online (see the enumeration definition GizWifiDeviceNetStatus), numeric type "productKey": // central control device type identifier, string type "productName": // central control device product name, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // central control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } }
COPIED{ device:{ // central control device object (the following fields are device object information), object type "mac": // central control device MAC address, string type "did": // central control device did, string type } subDevices: { // list of child devices reported by the central control device, object array type "mac": // central control device MAC, string type "did": // central control device did, string type "subDid": // child device did, string type "subProductKey": // child device type identifier, string type "subProductName": // child device product name, string type "type": // child device type, numeric type "netStatus": // Whether the central control child device is online (see the enumeration definition GizWifiDeviceNetStatus), numeric type "productKey": // central control device type identifier, string type "productName": // central control device product name, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // central control device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type } }
This is the Gizwits Wi-Fi child device class. This class provides child device control and child device status reporting. This class inherits from the GizWifiDevice class and can use all APIs in the GizWifiDevice class.
Description: The child device object whose notifications are to be received. The child device object information can be obtained when getting the child device list.
Internal fields
1 2 3 4 5
COPIED{ "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type }
COPIED{ device:{ // child device object, object type "mac": // central control device MAC address, string type "did": // central control device did, string type "subDid": // child device did, string type } netStatus: // Whether the child device is online (see GizWifiDeviceNetStatus), numeric type "data": { // device status, object type "attrName": "attrValue", // Data Point name: Operation value. If the Data Point is an extension type, the operation value needs to be a base64 encoded string. } "alerts": { // alarm, object type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, object type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8 9
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } }
Get the device status. Only when a subscribed device becomes controllable, its states can be obtained, including the running state, alarms, faults, and data via transparent transmission.
COPIED{ device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } "data": { // device status, object type "attrName": "attrValue", // Data Point name: Operation value. If the Data Point is an extension type, the operation value needs to be a base64 encoded string. } "alerts": { // alarm, object type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, object type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8 9
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), number type msg: // error description, string type device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } }
Description: The device object to which the operation commands are to be sent, the device object information can be obtained when getting the device list.
Internal fields
1 2 3 4 5
COPIED{ "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type }
sn:
Type: JSON object
Default: none
Description: The sequence number of the command to be sent, generated and maintained by the App
data:
Type: JSON object
Default: none
Description: The command to be sent, the format is the same as the normal device control.
Internal fields
1 2 3 4 5 6 7 8 9 10 11 12
COPIED{ "data": { // device status, string type "attrName": "attrValue", // Data Point name: Operation value. If the Data Point is an extension type, the operation value needs to be a base64 encoded string. } "alerts": { // alarm, array type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, array type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
COPIED{ device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } "sn": // command sequence number, corresponding to the sending sequence by the App, numeric type "data": { // device status, object type "attrName": "attrValue", // Data Point name: Operation value. If the Data Point is an extension type, the operation value needs to be a base64 encoded string. } "alerts": { // alarm, object type "attrName": "attrValue" // Data Point name: Alarm message } "faults": { // fault, object type "attrName": "attrValue" // Data Point name: Fault message } "binary": // binary data for transparent transmission, base64 encoded string, string type }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8 9
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric msg: // error description, string type device: { // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } }
Description: The child device object, the device MAC and did can be obtained when getting the device list.
Internal fields
1 2 3 4 5
COPIED{ "mac": // central control device MAC address, string type "did": // central control device did, string type "subDid": // child device did, string type }
COPIED{ device: { // child device object (the following fields are child device information), object type "mac": // central control device MAC address, string type "did": // central control device did, string type "subDid": // child device did, string type "subProductKey": // child device type identifier, string type "subProductName": // child device product name, string type "type": // subdevice type (see GizWifiDeviceType), numeric type "netStatus": // Whether the child device is online (see GizWifiDeviceNetStatus), numeric type "productKey": // central control device type identifier, string type "productName": // central control device product name, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7 8 9
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type device:{ // device object (the following fields are device object information), object type "mac": // device MAC address, string type "did": // device did, string type "subDid": // child device did, string type } }
COPIED{ group: { // group object, object type "gid": // group ID, string type } devices: [{ // child device list of the group, object array "mac": // device MAC, string type "did": // device did, string type "subDid": // child device did, string type }] }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type group:{ // group object, object type "gid": // group ID, string type } }
COPIED{ group: { // group object, object type "gid": // group ID, string type } devices: [{ // child device list of the group, object array "mac": // device MAC, string type "did": // device did, string type "subDid": // child device did, string type }] }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type group: { // group object, object type "gid": // group ID, string type } }
Description: group object which can be obtained when getting the group list.
Internal fields
1 2 3
COPIED{ "gid": // group ID, string type }
device:
Type: JSON object
Default: none
Description: The device object to be deleted, the device object information can be obtained when obtaining the device list of the group.
Internal fields
1 2 3 4 5
COPIED{ "mac": // central control device MAC address, string type "did": // central control device did, string type "subDid": // child device did, string type }
COPIED{ group: { // group object, object type "gid": // group ID, string type } devices: [{ // child device list of the group, object array "mac": // device MAC, string type "did": // device did, string type "subDid": // child device did, string type }] }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type group:{ // group object, object type "gid": // group ID, string type } }
COPIED{ group: { // group object, object type "gid": // group ID, string type "groupName": // group name, string type "productKey": // group type identifier, string type } }
err
Type: JSON object
Internal fields
1 2 3 4 5 6 7
COPIED{ errorCode: // error code (see enumeration definition GizWifiErrorCode), numeric type msg: // error description, string type group:{ // group object, object type "gid": // group ID, string type } }
This function is specially designed for the error code compatibility of the App, which can save the time to update the code for the App. The old error code will be returned after passing the new error code according to the above mapping table.