-
public interface IThingGateway
The gateway class encapsulates the related operations of the Zigbee gateway, including controlling, querying sub-devices, and monitoring the status of the sub-devices.
-
-
Method Summary
Modifier and Type Method Description abstract void
publishDps(String nodeId, String dps, IResultCallback callback)
Publish commands to a single sub-device. abstract void
publishDpsByMqtt(String nodeId, String dps, IResultCallback callback)
Publish commands to a single sub-device by MQTT. abstract void
publishDpsByHttp(String nodeId, String dps, IResultCallback callback)
Use http to send control commands. abstract boolean
isMqttConnect()
Whether the MQTT is connected. abstract void
broadcastDps(String dps, IResultCallback callback)
Publish commands to all sub-devices under the gateway. abstract void
multicastDps(String nodeId, String dps, IResultCallback callback)
Publish commands to all devices in the same group as this sub-device. abstract void
getSubDevList(IThingDataCallback<List<DeviceBean>> callback)
Get the list of sub-devices under the gateway. abstract void
registerSubDevListener(ISubDevListener listener)
Register the sub-devices status change listener. abstract void
unRegisterSubDevListener()
Unregister the sub-devices status change listener. abstract void
onDestroy()
Recycle and release the resources. -
-
Method Detail
-
publishDps
abstract void publishDps(String nodeId, String dps, IResultCallback callback)
Publish commands to a single sub-device.
- Parameters:
nodeId
- Sub-device nodeId, nodeId field in sub-device's DeviceBeandps
- List of function points to be controlled, formatted as json stringcallback
- Send success or failure callback.
-
publishDpsByMqtt
abstract void publishDpsByMqtt(String nodeId, String dps, IResultCallback callback)
Publish commands to a single sub-device by MQTT.
- Parameters:
nodeId
- Sub-device nodeId, nodeId field in sub-device's DeviceBeandps
- List of function points to be controlled, formatted as json stringcallback
- Send success or failure callback.
-
publishDpsByHttp
abstract void publishDpsByHttp(String nodeId, String dps, IResultCallback callback)
Use http to send control commands.
- Parameters:
nodeId
- Sub-device nodeId, nodeId field in sub-device's DeviceBeandps
- List of function points to be controlled, formatted as json stringcallback
- Send success or failure callback.
-
isMqttConnect
@Deprecated() abstract boolean isMqttConnect()
Whether the MQTT is connected.
Not recommended, it is recommended to use another interface isServerConnect, such as
{@code ThingHomeSdk.getServerInstance().isServerConnect()}
-
broadcastDps
abstract void broadcastDps(String dps, IResultCallback callback)
Publish commands to all sub-devices under the gateway.
- Parameters:
dps
- List of function points to be controlled, formatted as json stringcallback
- Send success or failure callback.
-
multicastDps
abstract void multicastDps(String nodeId, String dps, IResultCallback callback)
Publish commands to all devices in the same group as this sub-device.
- Parameters:
nodeId
- Sub-device nodeId, nodeId field in sub-device's DeviceBeandps
- List of function points to be controlled, formatted as json stringcallback
- Send success or failure callback.
-
getSubDevList
abstract void getSubDevList(IThingDataCallback<List<DeviceBean>> callback)
Get the list of sub-devices under the gateway.
- Parameters:
callback
- Callback list of sub-devices DeviceBean
-
registerSubDevListener
abstract void registerSubDevListener(ISubDevListener listener)
Register the sub-devices status change listener.
The sub-devices related information (dp data, device name, device online status and device removal),which will be synchronized here in real time.
- Parameters:
listener
- The listener ISubDevListener
-
unRegisterSubDevListener
abstract void unRegisterSubDevListener()
Unregister the sub-devices status change listener.
-
onDestroy
abstract void onDestroy()
Recycle and release the resources.
-
-
-
-