Package 

Object DeviceUtil

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final String TAG
      public final static DeviceUtil INSTANCE
    • Method Summary

      Modifier and Type Method Description
      final <ERROR CLASS> getDevice(String deviceId) Get device bean
      final <ERROR CLASS> getGroupDevice(Long groupId) Get group bean.
      final List<<ERROR CLASS>> getGroupDevices(Long groupId) Get the device bean in group.
      final <ERROR CLASS> getDeviceCommunication(String deviceId) Get device communication id
      final <ERROR CLASS> getDeviceNodeId(String deviceId) Get device node id
      final Unit passThroughByLocal(String localId, Integer sceneId, String btnId, String devId, Integer action, IResultCallback<Unit> callback) A local pass-through channel for vendor model
      final Unit operateSceneUnderSigmesh(Integer btnId, String localId, DeviceUtil.OperateDevActionType type, String dps, String nodeId, List<String> nodeIdList, IResultCallback<Unit> callback) Write scene data to sub-device in without-gateway scenario
      final Unit operateSceneUnderSigMesh(Integer btnId, String localId, DeviceUtil.OperateDevActionType type, String dps, String nodeId, List<String> nodeIdList, String meshId, IResultCallback<Unit> callback) Write scene data to sub-device in without-gateway scenario
      final Boolean ,String)>groupHasDevice(<ERROR CLASS> action, String deviceId) Determine whether the current group action includes the device
      final Unit )>executeDeviceDp(<ERROR CLASS> action) Distribute dp operation device
      final Boolean isModeWR(String devId, Map<String, Object> executorProperty) Determine whether it is Write-Only authority
      final <ERROR CLASS><Boolean, Map<String, Object>> isAllModeWR(String devId, Map<String, Object> executorProperty) Judging all the actions to be executed, whether the dp is only issued but not reported<p>1.
      final Boolean isDeviceDpOk(String devId, Map<String, Object> executorProperty) Determine whether the real dp state of the device is the same as the state to be set
      final <ERROR CLASS><Boolean, Map<String, Object>> isAllDeviceDpOk(String devId, Map<String, Object> executorProperty) Judging all the actions to be executed, whether the dp state is ok
      • pair-first true, pair-second is empty map

      • pair-first false, pair-second is the map of dp that is not the target state

      final Unit )>addGidSid(List<String> cids, <ERROR CLASS> sidGid) Write the gid and sid of the scene to the gateway.
      final Unit )>clearGidSid(List<String> cids, <ERROR CLASS> sidGid) Remove the scene's gid and sid from the gateway.
      final <ERROR CLASS> )>publishDps(String deviceId, String dps, <ERROR CLASS> callback) Device control other than mesh, sigMesh devices
      final <ERROR CLASS> )>groupPublishDps(Long groupId, String dps, <ERROR CLASS> callback) Group control except mesh, sigMesh group devices
      final <ERROR CLASS> )>executeLocalSceneNew(String gatewayId, String sceneId, <ERROR CLASS> callback) Execute a new local scene
      final <ERROR CLASS> )>executeSceneMqtt(String gatewayId, String sceneId, <ERROR CLASS> callback) Gateway scenario execution through mqtt channel
      final <ERROR CLASS> )>executeLocalScene(String gatewayId, String gid, String sid, <ERROR CLASS> callback) Standard scenario execution.
      final <ERROR CLASS> )>meshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, <ERROR CLASS> callback) Mesh device control
      final <ERROR CLASS> )>sigMeshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, <ERROR CLASS> callback) sigMesh device control
      final <ERROR CLASS> )>meshGroupPublishDps(String meshId, String localId, String category, String dps, <ERROR CLASS> callback) mesh device group control
      final <ERROR CLASS> )>sigMeshGroupPublishDps(String meshId, String localId, String category, String dps, <ERROR CLASS> callback) sigMesh device group control
      final Unit batchExecuteDeviceDps(List<<ERROR CLASS>> batchExecutionDpsList, Integer retryCount)
      final Unit registerMeshDeviceListener(String meshId, Function2<String, String, Unit> listener) Register mesh device listening
      final Unit registerSigMeshDeviceListener(String meshId, Function2<String, String, Unit> listener) Register sigMesh device listening
      final Unit registerDeviceListener(String deviceId, Function2<String, String, Unit> listener) Register for general device monitoring (including Wi-Fi, single-point bluetooth, zigbee)
      final Unit registerGroupDeviceListener(Long groupId, Function2<Long, String, Unit> listener) Register group device monitoring
      final Unit unRegisterMeshDevListener(String meshId) Remove mesh device listening
      final Unit unRegisterSigMeshDevListener(String meshId) Remove sigMesh device listening
      final Unit unRegisterDevListener(String deviceId) Remove device monitoring
      final Unit unRegisterGroupListener(Long groupId) Remove group device monitoring
      final <T extends Any> Unit )>registerDeviceMqttListener(Class<)>T> clazz, <ERROR CLASS><)>T> listener) Register device mqtt listener
      final <T extends Any> Unit )>unRegisterDeviceMqttListener(Class<)>T> clazz, <ERROR CLASS><)>T> listener) Remove device mqtt listener
      final Unit registerGwMqttListener(Function4<Integer, String, List<String>, List<Integer>, Unit> listener) Register gateway device mqtt listener
      final Unit unRegisterGwMqttListener() Remove gateway device mqtt listener
      final String getTAG()
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getDevice

         final <ERROR CLASS> getDevice(String deviceId)

        Get device bean

        Parameters:
        deviceId - the id of the device
      • getGroupDevice

         final <ERROR CLASS> getGroupDevice(Long groupId)

        Get group bean. Does not include device beans in the group

        Parameters:
        groupId - the id of the group
      • getGroupDevices

         final List<<ERROR CLASS>> getGroupDevices(Long groupId)

        Get the device bean in group. include device beans in the group

        Parameters:
        groupId - the id of the group
      • getDeviceCommunication

         final <ERROR CLASS> getDeviceCommunication(String deviceId)

        Get device communication id

        Parameters:
        deviceId - the id of the device
      • getDeviceNodeId

         final <ERROR CLASS> getDeviceNodeId(String deviceId)

        Get device node id

        Parameters:
        deviceId - the id of the device
      • passThroughByLocal

         final Unit passThroughByLocal(String localId, Integer sceneId, String btnId, String devId, Integer action, IResultCallback<Unit> callback)

        A local pass-through channel for vendor model

        Parameters:
        localId - local id, the unique identity of each mesh group in the mesh network
        sceneId - the id of the scene
        btnId - the virtual button id from panel
        devId - the id of the device
        action - action type
        callback - Callback for ack message {@link IResultCallback}
      • operateSceneUnderSigmesh

        @Deprecated(message = This method has been recalled and the function is unavailable, replaceWith = @ReplaceWith(imports = {}, expression = operateSceneUnderSigMesh(btnId, localId, type, dps, nodeId, nodeIdList, meshId, callback)), level = DeprecationLevel.ERROR) final Unit operateSceneUnderSigmesh(Integer btnId, String localId, DeviceUtil.OperateDevActionType type, String dps, String nodeId, List<String> nodeIdList, IResultCallback<Unit> callback)

        Write scene data to sub-device in without-gateway scenario

        Parameters:
        btnId - the virtual button id from panel
        localId - local id, the unique identity of each mesh group in the mesh network
        type - operate type OperateDevActionType
        dps - dp set to be distributed to the device
        nodeId - device node ID of the scenario to be distributed
        nodeIdList - device List of actions to perform
        callback - callback IResultCallback
      • operateSceneUnderSigMesh

         final Unit operateSceneUnderSigMesh(Integer btnId, String localId, DeviceUtil.OperateDevActionType type, String dps, String nodeId, List<String> nodeIdList, String meshId, IResultCallback<Unit> callback)

        Write scene data to sub-device in without-gateway scenario

        Parameters:
        btnId - the virtual button id from panel
        localId - local id, the unique identity of each mesh group in the mesh network
        type - operate type OperateDevActionType
        dps - dp set to be distributed to the device
        nodeId - device node ID of the scenario to be distributed
        nodeIdList - device List of actions to perform
        meshId - If the device is a sigmesh or thingmesh sub-device, meshId is mesh id (top-level virtual node id).
        callback - callback IResultCallback
      • groupHasDevice

         final Boolean ,String)>groupHasDevice(<ERROR CLASS> action, String deviceId)

        Determine whether the current group action includes the device

        Parameters:
        action - an action of scene
        deviceId - the id of the device
      • executeDeviceDp

         final Unit )>executeDeviceDp(<ERROR CLASS> action)

        Distribute dp operation device

        Parameters:
        action - an action of the scene
      • isModeWR

         final Boolean isModeWR(String devId, Map<String, Object> executorProperty)

        Determine whether it is Write-Only authority

        Parameters:
        devId - the id of the device
        executorProperty - the dps to judge
      • isAllModeWR

         final <ERROR CLASS><Boolean, Map<String, Object>> isAllModeWR(String devId, Map<String, Object> executorProperty)

        Judging all the actions to be executed, whether the dp is only issued but not reported

        <p>1. pair-first true, pair-second is empty map</p> <p>2. pair-first false, pair-second is the map of dp that is not mode WR or can't judge</p>
      • isDeviceDpOk

         final Boolean isDeviceDpOk(String devId, Map<String, Object> executorProperty)

        Determine whether the real dp state of the device is the same as the state to be set

        Parameters:
        devId - the id of the device
        executorProperty - the dps to be execute
      • isAllDeviceDpOk

         final <ERROR CLASS><Boolean, Map<String, Object>> isAllDeviceDpOk(String devId, Map<String, Object> executorProperty)

        Judging all the actions to be executed, whether the dp state is ok

        • pair-first true, pair-second is empty map

        • pair-first false, pair-second is the map of dp that is not the target state

      • addGidSid

         final Unit )>addGidSid(List<String> cids, <ERROR CLASS> sidGid)

        Write the gid and sid of the scene to the gateway. if write actionType is 0

        Parameters:
        cids - the child node ids under same gateway
        sidGid - sid, gid, gwId in StandardSceneInfo
      • clearGidSid

         final Unit )>clearGidSid(List<String> cids, <ERROR CLASS> sidGid)

        Remove the scene's gid and sid from the gateway. if clear actionType is 1

        Parameters:
        cids - the child node ids
        sidGid - sid, gid, gwId in StandardSceneInfo
      • publishDps

         final <ERROR CLASS> )>publishDps(String deviceId, String dps, <ERROR CLASS> callback)

        Device control other than mesh, sigMesh devices

        Parameters:
        deviceId - the id of the device
        dps - the dps that deliver control
        callback - callback IResultCallback
      • groupPublishDps

         final <ERROR CLASS> )>groupPublishDps(Long groupId, String dps, <ERROR CLASS> callback)

        Group control except mesh, sigMesh group devices

        Parameters:
        groupId - the id of the device
        dps - the dps that deliver control
        callback - callback IResultCallback
      • executeLocalSceneNew

         final <ERROR CLASS> )>executeLocalSceneNew(String gatewayId, String sceneId, <ERROR CLASS> callback)

        Execute a new local scene

        Parameters:
        gatewayId - the id of gateway to execute scene
        sceneId - the id of scene to execute
        callback - callback IResultCallback
      • executeSceneMqtt

         final <ERROR CLASS> )>executeSceneMqtt(String gatewayId, String sceneId, <ERROR CLASS> callback)

        Gateway scenario execution through mqtt channel

        Parameters:
        gatewayId - the id of gateway to execute scene
        sceneId - the id of scene to execute
        callback - callback IResultCallback
      • executeLocalScene

         final <ERROR CLASS> )>executeLocalScene(String gatewayId, String gid, String sid, <ERROR CLASS> callback)

        Standard scenario execution. which use gid, sid, gwId

        Parameters:
        gatewayId - the id of gateway to execute scene
        gid - similar group id, but not a regular group id
        sid - similar scene id, but not a regular scene id
        callback - callback IResultCallback
      • meshDevicePublishDps

         final <ERROR CLASS> )>meshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, <ERROR CLASS> callback)

        Mesh device control

        Parameters:
        meshId - the mesh id of the device, which is useful when the device is a sub-device.
        nodeId - the node id of the device, which is useful when the device is a sub-device.
        pcc - Bluetooth Mesh product category.
        dps - data points
        callback - callback IResultCallback
      • sigMeshDevicePublishDps

         final <ERROR CLASS> )>sigMeshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, <ERROR CLASS> callback)

        sigMesh device control

        Parameters:
        meshId - the mesh id of the device, which is useful when the device is a sub-device.
        nodeId - the node id of the device, which is useful when the device is a sub-device.
        pcc - Bluetooth Mesh product category.
        dps - data points
        callback - callback IResultCallback
      • meshGroupPublishDps

         final <ERROR CLASS> )>meshGroupPublishDps(String meshId, String localId, String category, String dps, <ERROR CLASS> callback)

        mesh device group control

        Parameters:
        meshId - the mesh id of the group.
        localId - local id, the unique identity of each mesh group in the mesh network
        category - category mark of equipment
        dps - data points
        callback - callback IResultCallback
      • sigMeshGroupPublishDps

         final <ERROR CLASS> )>sigMeshGroupPublishDps(String meshId, String localId, String category, String dps, <ERROR CLASS> callback)

        sigMesh device group control

        Parameters:
        meshId - the mesh id of the group.
        localId - local id, the unique identity of each mesh group in the mesh network
        category - category mark of equipment
        dps - data points
        callback - callback IResultCallback
      • batchExecuteDeviceDps

         final Unit batchExecuteDeviceDps(List<<ERROR CLASS>> batchExecutionDpsList, Integer retryCount)
      • registerMeshDeviceListener

         final Unit registerMeshDeviceListener(String meshId, Function2<String, String, Unit> listener)

        Register mesh device listening

        Parameters:
        meshId - The mesh id of the device, which is useful when the device is a sub-device.
        listener - listener
      • registerSigMeshDeviceListener

         final Unit registerSigMeshDeviceListener(String meshId, Function2<String, String, Unit> listener)

        Register sigMesh device listening

        Parameters:
        meshId - The mesh id of the device, which is useful when the device is a sub-device.
        listener - listener
      • registerDeviceListener

         final Unit registerDeviceListener(String deviceId, Function2<String, String, Unit> listener)

        Register for general device monitoring (including Wi-Fi, single-point bluetooth, zigbee)

        Parameters:
        deviceId - the id of the device
        listener - listener
      • registerGroupDeviceListener

         final Unit registerGroupDeviceListener(Long groupId, Function2<Long, String, Unit> listener)

        Register group device monitoring

        Parameters:
        groupId - the id of the group
        listener - listener
      • unRegisterMeshDevListener

         final Unit unRegisterMeshDevListener(String meshId)

        Remove mesh device listening

        Parameters:
        meshId - the mesh id of the device
      • unRegisterSigMeshDevListener

         final Unit unRegisterSigMeshDevListener(String meshId)

        Remove sigMesh device listening

        Parameters:
        meshId - the mesh id of the device
      • unRegisterDevListener

         final Unit unRegisterDevListener(String deviceId)

        Remove device monitoring

        Parameters:
        deviceId - the id of the device
      • unRegisterGroupListener

         final Unit unRegisterGroupListener(Long groupId)

        Remove group device monitoring

        Parameters:
        groupId - the id of the group
      • registerDeviceMqttListener

         final <T extends Any> Unit )>registerDeviceMqttListener(Class<)>T> clazz, <ERROR CLASS><)>T> listener)

        Register device mqtt listener

        Parameters:
        clazz - the mqtt msg which you care about
        listener - IDeviceMqttProtocolListener
      • unRegisterDeviceMqttListener

         final <T extends Any> Unit )>unRegisterDeviceMqttListener(Class<)>T> clazz, <ERROR CLASS><)>T> listener)

        Remove device mqtt listener

        Parameters:
        clazz - the mqtt msg which you care about
        listener - IDeviceMqttProtocolListener
      • registerGwMqttListener

         final Unit registerGwMqttListener(Function4<Integer, String, List<String>, List<Integer>, Unit> listener)

        Register gateway device mqtt listener

        Parameters:
        listener - listener“rets”: 0, -- <0-6> 0: create success 1: Exceeds the maximum number of scenes 2: Subdevice timed out 3: Setting value out of range 4: write file error 5: other errors default 6: Gateway timeout (gateway timeout means no response from hardware, which is the local default setting)
      • getTAG

         final String getTAG()