-
public class DeviceUtil
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumDeviceUtil.OperateDevActionTypeEnumeration types for operating devices
-
Field Summary
Fields Modifier and Type Field Description private final StringTAGpublic final static DeviceUtilINSTANCE
-
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<DeviceBean>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 UnitpassThroughByLocal(String localId, Integer sceneId, String btnId, String devId, Integer action, IResultCallback<Unit> callback)A local pass-through channel for vendor model final UnitoperateSceneUnderSigmesh(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 UnitoperateSceneUnderSigMesh(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 BooleanisModeWR(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 BooleanisDeviceDpOk(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, IResultCallback callback)Device control other than mesh, sigMesh devices final <ERROR CLASS>infraredPublishDps(String infraGwId, String subDeviceId, String actionDps, String reportDps, IResultCallback callback)Device control only for infrared devices final <ERROR CLASS>groupPublishDps(Long groupId, String dps, IResultCallback callback)Group control except mesh, sigMesh group devices final <ERROR CLASS>executeLocalSceneNew(String gatewayId, String sceneId, IResultCallback callback)Execute a new local scene final <ERROR CLASS>executeSceneMqtt(String gatewayId, String sceneId, IResultCallback callback)Gateway scenario execution through mqtt channel final <ERROR CLASS>executeLocalScene(String gatewayId, String gid, String sid, IResultCallback callback)Standard scenario execution. final <ERROR CLASS>meshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, IResultCallback callback)Mesh device control final <ERROR CLASS>sigMeshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, IResultCallback callback)sigMesh device control final <ERROR CLASS>meshGroupPublishDps(String meshId, String localId, String category, String dps, IResultCallback callback)mesh device group control final <ERROR CLASS>sigMeshGroupPublishDps(String meshId, String localId, String category, String dps, IResultCallback callback)sigMesh device group control final UnitbatchExecuteDeviceDps(List<BatchExecutionDps> batchExecutionDpsList, Integer retryCount)final UnitregisterMeshDeviceListener(String meshId, Function2<String, String, Unit> listener)Register mesh device listening final UnitregisterSigMeshDeviceListener(String meshId, Function2<String, String, Unit> listener)Register sigMesh device listening final UnitregisterDeviceListener(String deviceId, Function2<String, String, Unit> listener)Register for general device monitoring (including Wi-Fi, single-point bluetooth, zigbee) final UnitregisterGroupDeviceListener(Long groupId, Function2<Long, String, Unit> listener)Register group device monitoring final UnitunRegisterMeshDevListener(String meshId)Remove mesh device listening final UnitunRegisterSigMeshDevListener(String meshId)Remove sigMesh device listening final UnitunRegisterDevListener(String deviceId)Remove device monitoring final UnitunRegisterGroupListener(Long groupId)Remove group device monitoring final <T extends Any> UnitregisterDeviceMqttListener(Class<T> clazz, IDeviceMqttProtocolListener<T> listener)Register device mqtt listener final <T extends Any> UnitunRegisterDeviceMqttListener(Class<T> clazz, IDeviceMqttProtocolListener<T> listener)Remove device mqtt listener final UnitregisterGwMqttListener(Function4<Integer, String, List<String>, List<Integer>, Unit> listener)Register gateway device mqtt listener final UnitunRegisterGwMqttListener()Remove gateway device mqtt listener final StringgetTAG()-
-
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<DeviceBean> 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 networksceneId- the id of the scenebtnId- the virtual button id from paneldevId- the id of the deviceaction- action typecallback- 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 panellocalId- local id, the unique identity of each mesh group in the mesh networktype- operate type OperateDevActionTypedps- dp set to be distributed to the devicenodeId- device node ID of the scenario to be distributednodeIdList- device List of actions to performcallback- 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 panellocalId- local id, the unique identity of each mesh group in the mesh networktype- operate type OperateDevActionTypedps- dp set to be distributed to the devicenodeId- device node ID of the scenario to be distributednodeIdList- device List of actions to performmeshId- 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 scenedeviceId- 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 deviceexecutorProperty- 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 deviceexecutorProperty- 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 gatewaysidGid- 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 idssidGid- sid, gid, gwId in StandardSceneInfo
-
publishDps
final <ERROR CLASS> publishDps(String deviceId, String dps, IResultCallback callback)
Device control other than mesh, sigMesh devices
- Parameters:
deviceId- the id of the devicedps- the dps that deliver controlcallback- callback IResultCallback
-
infraredPublishDps
final <ERROR CLASS> infraredPublishDps(String infraGwId, String subDeviceId, String actionDps, String reportDps, IResultCallback callback)
Device control only for infrared devices
- Parameters:
infraGwId- the id of the gatewaysubDeviceId- the id of the sub-deviceactionDps- the dps that deliver controlreportDps- the dps that deliver reportcallback- callback IResultCallback
-
groupPublishDps
final <ERROR CLASS> groupPublishDps(Long groupId, String dps, IResultCallback callback)
Group control except mesh, sigMesh group devices
- Parameters:
groupId- the id of the devicedps- the dps that deliver controlcallback- callback IResultCallback
-
executeLocalSceneNew
final <ERROR CLASS> executeLocalSceneNew(String gatewayId, String sceneId, IResultCallback callback)
Execute a new local scene
- Parameters:
gatewayId- the id of gateway to execute scenesceneId- the id of scene to executecallback- callback IResultCallback
-
executeSceneMqtt
final <ERROR CLASS> executeSceneMqtt(String gatewayId, String sceneId, IResultCallback callback)
Gateway scenario execution through mqtt channel
- Parameters:
gatewayId- the id of gateway to execute scenesceneId- the id of scene to executecallback- callback IResultCallback
-
executeLocalScene
final <ERROR CLASS> executeLocalScene(String gatewayId, String gid, String sid, IResultCallback callback)
Standard scenario execution. which use gid, sid, gwId
- Parameters:
gatewayId- the id of gateway to execute scenegid- similar group id, but not a regular group idsid- similar scene id, but not a regular scene idcallback- callback IResultCallback
-
meshDevicePublishDps
final <ERROR CLASS> meshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, IResultCallback 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 pointscallback- callback IResultCallback
-
sigMeshDevicePublishDps
final <ERROR CLASS> sigMeshDevicePublishDps(String meshId, String nodeId, String pcc, String dps, IResultCallback 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 pointscallback- callback IResultCallback
-
meshGroupPublishDps
final <ERROR CLASS> meshGroupPublishDps(String meshId, String localId, String category, String dps, IResultCallback 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 networkcategory- category mark of equipmentdps- data pointscallback- callback IResultCallback
-
sigMeshGroupPublishDps
final <ERROR CLASS> sigMeshGroupPublishDps(String meshId, String localId, String category, String dps, IResultCallback 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 networkcategory- category mark of equipmentdps- data pointscallback- callback IResultCallback
-
batchExecuteDeviceDps
final Unit batchExecuteDeviceDps(List<BatchExecutionDps> 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 devicelistener- listener
-
registerGroupDeviceListener
final Unit registerGroupDeviceListener(Long groupId, Function2<Long, String, Unit> listener)
Register group device monitoring
- Parameters:
groupId- the id of the grouplistener- 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, IDeviceMqttProtocolListener<T> listener)
Register device mqtt listener
- Parameters:
clazz- the mqtt msg which you care aboutlistener- IDeviceMqttProtocolListener
-
unRegisterDeviceMqttListener
final <T extends Any> Unit unRegisterDeviceMqttListener(Class<T> clazz, IDeviceMqttProtocolListener<T> listener)
Remove device mqtt listener
- Parameters:
clazz- the mqtt msg which you care aboutlistener- 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)
-
unRegisterGwMqttListener
final Unit unRegisterGwMqttListener()
Remove gateway device mqtt listener
-
getTAG
final String getTAG()
-
-
-