public class ZigbeeDevice extends Device
Constructor and Description |
---|
ZigbeeDevice(com.mmbnetworks.rotarrandevicemodel.DeviceModel deviceModel,
DeviceConnectionType deviceConnectionType,
com.mmbnetworks.dialogues.DialogueManager dialogueManager,
Executor clientExecutor) |
Modifier and Type | Method and Description |
---|---|
boolean |
abortOtaUpgrade()
Abort an ongoing OTA upgrade.
|
CompletableFuture<String> |
addGroup(int groupID,
String groupName)
Adds a group to this Device's group table.
|
CompletableFuture<String> |
addGroupIfIdentifying(int groupID,
String groupName)
Adds a group to this Device's group table if it is identifying itself.
|
CompletableFuture<String> |
enableDefaultReporting()
Configures the device to report changes to its properties to the
GatewayClient to which it is connected.
|
DeviceType |
getDeviceType()
Get the
DeviceType associated with the Device. |
CompletableFuture<String> |
getGroupMembership()
Get group membership of this Device.
|
CompletableFuture<String> |
getHardwareVersion()
Retrieves the Hardware Version Of This Device.
|
CompletableFuture<String> |
getManufacturerName()
Retrieves the Manufacturer Name Of This Device.
|
CompletableFuture<String> |
getModelNumber()
Retrieves the Model Identifier Of This Device.
|
CompletableFuture<Property> |
readAttribute(int clusterId,
int attributeId)
Read a zigbee attribute that lives on a server cluster (and is not manufacturing specific).
|
CompletableFuture<Property> |
readAttribute(int clusterId,
int attributeId,
int manufacturerCode,
boolean isServer)
Read a zigbee attribute.
|
CompletableFuture<String> |
removeGroup(int groupId)
Remove a group from this Device's group table.
|
CompletableFuture<Collection<Property>> |
sendZclBroadcastCommand(String broadcastAddress,
short commandId,
byte[] payload,
int clusterId,
int manufacturerCode,
boolean isServer,
boolean isClusterSpecific,
boolean requiresResponse)
Sends a zcl broadcast command.
|
CompletableFuture<Property> |
sendZclCommand(short commandId,
byte[] payload,
int clusterId)
Sends a zcl general command to a server cluster (that is not manufacturing specific).
|
CompletableFuture<Property> |
sendZclCommand(short commandId,
byte[] payload,
int clusterId,
int manufacturerCode,
boolean isServer,
boolean isClusterSpecific,
boolean requiresResponse)
Sends a zcl command.
|
CompletableFuture<Collection<Property>> |
sendZclMulticastCommand(int groupId,
short commandId,
byte[] payload,
int clusterId,
int manufacturerCode,
boolean isServer,
boolean isClusterSpecific,
boolean requiresResponse)
Sends a zcl multicast command.
|
boolean |
startOtaUpgrade()
Notify the remote device that an OTA image is available for upgrade.
|
CompletableFuture<String> |
viewGroup(int groupId)
View a group's information of this Device
|
CompletableFuture<Property> |
writeAttribute(int clusterId,
int attributeId,
short dataType,
byte[] value)
Write to a zigbee attribute that lives on a server cluster (and is not manufacturing specific).
|
CompletableFuture<Property> |
writeAttribute(int clusterId,
int attributeId,
short dataType,
byte[] value,
int manufacturerCode,
boolean isServer)
Write to a zigbee attribute.
|
accept, accept, addPropertyUpdateHandler, addProtocolHandler, addToGroup, bindDevice, callFunction, configureReporting, discoverAllProperties, getCachedProperties, getCachedProperty, getCachedProtocolProperties, getConnectedGatewayId, getDeviceConnectionType, getID, getProperties, getProperty, getProtocolProperties, leaveNetwork, ping, removeAllPropertyUpdateHandlers, removeAllProtocolHandlers, removeFromGroup, removePropertyUpdateHandler, removeProtocolHandler, sendProtocolMessage, unbindDevice, updateProperty
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
andThen
public ZigbeeDevice(com.mmbnetworks.rotarrandevicemodel.DeviceModel deviceModel, DeviceConnectionType deviceConnectionType, com.mmbnetworks.dialogues.DialogueManager dialogueManager, Executor clientExecutor)
public DeviceType getDeviceType()
DeviceType
associated with the Device.
For zigbee devices, this will include the device profile name, and the
device type (i.e. Lighting, Dimmable Light).getDeviceType
in class Device
DeviceType
object.public CompletableFuture<String> enableDefaultReporting() throws IllegalStateException
Device
enableDefaultReporting
in class Device
IllegalStateException
- if the function is called before
the device Properties have been discovered (i.e. through getProperties()).public CompletableFuture<Property> readAttribute(int clusterId, int attributeId)
clusterId
- The cluster on which the attribute exists.attributeId
- The attribute to read.public CompletableFuture<Property> readAttribute(int clusterId, int attributeId, int manufacturerCode, boolean isServer)
clusterId
- The cluster on which the attribute exists.attributeId
- The attribute to readmanufacturerCode
- The manufacturer code. 0 means "not manufacturer specific".isServer
- Whether it's a server cluster.public CompletableFuture<Property> writeAttribute(int clusterId, int attributeId, short dataType, byte[] value)
clusterId
- The cluster on which the attribute lives.attributeId
- The attribute to write to.dataType
- The zigbee data type of the attribute.value
- The value as a byte array. The value should be entered in LSB; example the number 2700 is entered as { (byte)0x8c, (byte)0x0a }.public CompletableFuture<Property> writeAttribute(int clusterId, int attributeId, short dataType, byte[] value, int manufacturerCode, boolean isServer)
clusterId
- The cluster on which the attribute lives.attributeId
- The attribute to write to.dataType
- The zigbee data type of the attribute.value
- The value as a byte array. The value should be entered in LSB; example the number 2700 is entered as { (byte)0x8c, (byte)0x0a }.manufacturerCode
- The manufacturer code. 0 means "not manufacturer specific".isServer
- Whether the cluster is a server cluster.public CompletableFuture<Property> sendZclCommand(short commandId, byte[] payload, int clusterId)
commandId
- The zcl command id.payload
- The payload in bytes. Each field in the payload is entered as LSB, so 2700 would be 8c 0a.clusterId
- The cluster to send the command to.public CompletableFuture<Property> sendZclCommand(short commandId, byte[] payload, int clusterId, int manufacturerCode, boolean isServer, boolean isClusterSpecific, boolean requiresResponse)
commandId
- The zcl command id.payload
- The payload in bytes. Each field in the payload is entered as LSB, so 2700 would be 8c 0a.clusterId
- The cluster to send the command to.manufacturerCode
- The manufacturer code. 0 means "not manufacturing specific".isServer
- Whether the cluster is a server cluster.isClusterSpecific
- Whether the command is cluster specific (as opposed to a zcl general command that works across all clusters).requiresResponse
- Whether the request requires a response. If true, the system will wait for one and complete with an error if no response arrives.public CompletableFuture<Collection<Property>> sendZclMulticastCommand(int groupId, short commandId, byte[] payload, int clusterId, int manufacturerCode, boolean isServer, boolean isClusterSpecific, boolean requiresResponse)
groupId
- The group id of the group to which the target devices belongcommandId
- The zcl command id.payload
- The payload in bytes. Each field in the payload is entered as LSB, so 2700 would be 8c 0a.clusterId
- The cluster to send the command to.manufacturerCode
- The manufacturer code. 0 means "not manufacturing specific".isServer
- Whether the cluster is a server cluster.isClusterSpecific
- Whether the command is cluster specific (as opposed to a zcl general command that works across all clusters).requiresResponse
- Whether the request requires a response. If true, the system will wait for one and complete with an error if no response arrives.
If false, there will be a default response indicating the transmission status. (0x00: successful transmission)public CompletableFuture<Collection<Property>> sendZclBroadcastCommand(String broadcastAddress, short commandId, byte[] payload, int clusterId, int manufacturerCode, boolean isServer, boolean isClusterSpecific, boolean requiresResponse)
broadcastAddress
- The broadcast address that indicates the range of target devices.commandId
- The zcl command id.payload
- The payload in bytes. Each field in the payload is entered as LSB, so 2700 would be 8c 0a.clusterId
- The cluster to send the command to.manufacturerCode
- The manufacturer code. 0 means "not manufacturing specific".isServer
- Whether the cluster is a server cluster.isClusterSpecific
- Whether the command is cluster specific (as opposed to a zcl general command that works across all clusters).requiresResponse
- Whether the request requires a response. If true, the system will wait for one and complete with an error if no response arrives.
If false, there will be a default response indicating the transmission status. (0x00: successful transmission)public boolean startOtaUpgrade()
startOtaUpgrade
in class Device
true
if OTA image notification is sent out successfully; false
otherwise.public boolean abortOtaUpgrade()
abortOtaUpgrade
in class Device
true
if aborting OTA upgrade is sent out successfully; false
otherwise.public CompletableFuture<String> getManufacturerName()
CompletableFuture
object will return immediately with the cached valuegetManufacturerName
in class Device
CompletableFuture
object. It will contain the manufacturer name if it exists.public CompletableFuture<String> getHardwareVersion()
CompletableFuture
object will return immediately with the cached valuegetHardwareVersion
in class Device
CompletableFuture
object. It will contain the hardware version if it exists.public CompletableFuture<String> getModelNumber()
CompletableFuture
object will return immediately with the cached valuegetModelNumber
in class Device
CompletableFuture
object. It will contain the model identifier if it exists.public CompletableFuture<String> addGroup(int groupID, String groupName)
groupID
- The group's idgroupName
- The group's nameCompletableFuture
object. It will contain a json array string containing the zcl or zdo response(s)
of the request to add group. Response payload: Status, Group ID.public CompletableFuture<String> addGroupIfIdentifying(int groupID, String groupName)
groupID
- The group's idgroupName
- The group's nameCompletableFuture
object. It will contain a json array string containing the zcl or zdo response(s)
of the request to add group if identifying.public CompletableFuture<String> removeGroup(int groupId)
groupId
- The group's id to be removedCompletableFuture
object. It will contain a json array string containing the zcl or zdo response(s)
of the request to remove group. Response payload: Status, Group ID.public CompletableFuture<String> getGroupMembership()
CompletableFuture
object. It will contain a json array string containing the zcl or zdo response(s)
of the request to get group membership. Response payload: Capacityk, Group count, Group list.public CompletableFuture<String> viewGroup(int groupId)
groupId
- The group's id to be viewedCompletableFuture
object. It will contain a json array string containing the zcl or zdo response(s)
of the request to view group. Response payload: Status, Group ID, Group Name.Copyright © 2020. All rights reserved.