-
public interface IThingMqttChannelMqtt send and receive channels.
Send messages to or receive messages from the device via MQTT.
This feature is only needed if you need to customize the embedded firmware, which will handle the corresponding mqtt messages.
IThingMqttChannel mqttChannelInstance = ThingHomeSdk.getMqttChannelInstance(); mqttChannelInstance.registerMqttRetainChannelListener(new IThingMqttRetainChannelListener() {
-
-
Method Summary
Modifier and Type Method Description abstract voidregisterMqttRetainChannelListener(IThingMqttRetainChannelListener listener)Register MQTT listener, listen to mqtt messages received by all devices. abstract voidunRegisterMqttRetainChannelListener(IThingMqttRetainChannelListener listener)Unregister MQTT listener abstract voidsendDeviceMqttMessage(String devId, HashMap<String, Object> data, int protocol, IResultCallback callback)Send custom MQTT message to device. -
-
Method Detail
-
registerMqttRetainChannelListener
abstract void registerMqttRetainChannelListener(IThingMqttRetainChannelListener listener)
Register MQTT listener, listen to mqtt messages received by all devices.
This feature is only needed if you need to customize the embedded firmware,which will handle the corresponding mqtt messages.
- Parameters:
listener- IThingMqttRetainChannelListener
-
unRegisterMqttRetainChannelListener
abstract void unRegisterMqttRetainChannelListener(IThingMqttRetainChannelListener listener)
Unregister MQTT listener
- Parameters:
listener- IThingMqttRetainChannelListener
-
sendDeviceMqttMessage
abstract void sendDeviceMqttMessage(String devId, HashMap<String, Object> data, int protocol, IResultCallback callback)
Send custom MQTT message to device.
- Parameters:
devId- Device id.data- The key-value pairs you need to send to the device.protocol- Custom MQTT protocol number.callback- Callback that will be notified when message deliveryhas completed.
-
-
-
-