Gateway and subdevice function

How sub-devices are added to network in FastCon extension mode:

  1. The user sets sub-device to smart configuration mode
  2. The master enters scanning mode
  3. The master gets device list to be configured
  4. The user tap on app to add sub-device
  5. The app retrieves the status of sub-device until it shows 0
  6. The master quits scanning mode

1. Description of Interfaces

You can find related interfaces in “Controller” class of “BLLetCore” library and invoke them encapsulated by SDK:

1.1 Enable Scanning Mode

The sub-devices only respond to scanning commands when they are in smart configuration mode. The default timeout is 30s for two-way 433MHz RF sub-devices.

public static BLSubdevResult subDevScanStart(String did, String subPid)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
subPid String Scanned sub-device DID N,If empty, all subdevices are searched

Return Parameter

Description of BLSubdevResult

PARAMETER NAME PARAMETER TYPE NOTE
subdevStatus int Status of sub-device Non-zero means failure

1.2 Get Scanned Sub-Device List

public static BLSubDevListResult devSubDevNewListQuery(String did, String subpid, int index, int count)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
subPid String Scanned sub-device DID N,If empty, all subdevices are searched
index int Start index Y
count int Number of requests Y

Return Parameter

Description of BLSubDevListResult

PARAMETER NAME PARAMETER TYPE NOTE
subdevStatus int Status of sub-device Non-zero means failure
total int Total number of scanned sub-devices
index int This index is set by application layer and only used for return here.
list List Device information list

Description of BLDNADevice

Sub-device information, usually contain the following content

PARAMETER NAME PARAMETER TYPE NOTE
did String Sub-device ID
pid String Sub-device type
name String Accessory name
state int Online/offline status of sub-devices (only available for FastCon sub-devices

1.3 Stop Sub-Device Scanning Mode

public static BLSubdevResult subDevScanStop(String did)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y

1.4 Add Sub-Device

public static BLSubdevResult subDevAdd(String did, BLDNADevice subDevInfo)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
subDevInfo BLDNADevice Scanned info of subdevce Y

During the process of adding sub-devices, the SDK will get the URL downloaded by Profile of sub-device and send to the gateway. Then the gateway will download the Profile according to this URL.

1.5 Get Result of Adding Sub-Device

public static BLSubDevAddResult devSubDevAddResultQuery(String did, String sDid)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
sdid String Subdevice DID Y

Return Parameter

Description of BLSubDevAddResult

PARAMETER NAME PARAMETER TYPE NOTE
subdevStatus int Status Failed if the value is not 0
download_status int Result of adding sub-device The sub-device is added only if the value is 0

Values for download_status

* 0:Success
* 1: downloading profile
* 2: download profile fail
* 3: no flash
* 4: profile error

1.6 Get Sub-Device List

public static BLSubDevListResult devSubDevListQuery(String did,int index, int count)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
index int Start index Y
count int Number of requests Y

Return Parameter

Description of BLSubDevListResult

PARAMETER NAME PARAMETER TYPE NOTE
subdevStatus int Status Failed if the value is not 0
total int Total number of scanned sub-devices
index int This index is set by application layer and only used for return here.
list List Device information list

Description of BLDNADevice

Sub-device information, usually contain the following content

PARAMETER NAME PARAMETER TYPE NOTE
did String Sub-device ID
pid String Sub-device type
name String Accessory name
state int Online/offline status of sub-devices (only available for FastCon sub-devices

1.7 Delete Sub-Device

public static BLSubdevResult subDevDel(String did, String sDid)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
sdid String The DID of sub-devices to be deleted Y

1.8 Get Firmware Version of Sub-Device

public static BLFirmwareVersionResult devSubDevVersion(String did, String sDid, BLConfigParam configParam)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
sdid String The DID of sub-devices to be deleted Y
configParam BLConfigParam Send parameter N

Return Parameter

Description of BLFirmwareVersionResult

PARAMETER NAME PARAMETER TYPE NOTE
subdevStatus int Status Failed if the value is not 0
version String Firmware version

Description of version:
Sub-device version : version = hwversion * 1000 + fwversion

1.9 Firmware Update for Sub-Device

public BLSubdevResult devSubDevUpgradeFirmware(String did, String sDid, String url, BLConfigParam configParam)

Request Parameter

PARAMETER NAME PARAMETER TYPE NOTE Is it necessary
did String Gateway DID Y
sdid String The DID of sub-devices to be deleted Y
url String Firmware URL for update Y, Url domain only supports HTTP protocol
configParam BLConfigParam Send parameter N

This command only sends the updating URL to sub-device and the sub-device will acknowledge immediately after the command is received before firmware updating process. The acknowledgment does not mean success of firmware update. The firmware update can be only considered successful if the version becomes newer.