diff --git a/README.md b/README.md index dcf9ab782..0719dcdf0 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ The following clusters are currently supported -: | 0009 | ALARMS | Attributes and commands for sending alarm notifications and configuring alarm functionality. | | 000A | TIME | This cluster provides a basic interface to a real-time clock. The clock time MAY be read and also written, in order to synchronize the clock (as close as practical) to a time standard. This time standard is the number of seconds since 0 hrs 0 mins 0 sec on 1st January 2000 UTC (Universal Coordinated Time). | | 000B | RSSI_LOCATION | This cluster provides a means for exchanging Received Signal Strength Indication (RSSI) information among one hop devices as well as messages to report RSSI data to a centralized device that collects all the RSSI data in the network. | +| 000C | ANALOG_INPUT_BASIC | The Analog Input (Basic) cluster provides an interface for reading the value of an analog measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures an analog physical quantity. | | 000F | BINARY_INPUT_BASIC | The Binary Input (Basic) cluster provides an interface for reading the value of a binary measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures a two-state physical quantity. | | 0012 | MULTISTATE_INPUT_BASIC | The Multistate Input (Basic) cluster provides an interface for reading the value of a multistate measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures a physical quantity that can take on one of a number of discrete states. | | 0013 | MULTISTATE_OUTPUT_BASIC | The Multistate Output (Basic) cluster provides an interface for setting the value of an output that can take one of a number of discrete values, and accessing characteristics of that value. | diff --git a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZclDataType.java b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZclDataType.java index 2f51aa9cf..0001bea17 100644 --- a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZclDataType.java +++ b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZclDataType.java @@ -99,8 +99,10 @@ public static class DataTypeMap { dataTypeMapping.put("BITMAP_48_BIT", new DataTypeMap("Integer", 0x1d, 6, false)); dataTypeMapping.put("BITMAP_56_BIT", new DataTypeMap("Integer", 0x1e, 7, false)); dataTypeMapping.put("BITMAP_64_BIT", new DataTypeMap("Integer", 0x1f, 8, false)); - dataTypeMapping.put("ENUMERATION_16_BIT", new DataTypeMap("Integer", 0x31, 2, false, 0xffff)); dataTypeMapping.put("ENUMERATION_8_BIT", new DataTypeMap("Integer", 0x30, 1, false, 0xff)); + dataTypeMapping.put("ENUMERATION_16_BIT", new DataTypeMap("Integer", 0x31, 2, false, 0xffff)); + dataTypeMapping.put("ENUMERATION_32_BIT", new DataTypeMap("Integer", 0x33, 4, false, 0xffffffff)); + dataTypeMapping.put("FLOAT_32_BIT", new DataTypeMap("Double", 0x39, 4, true)); dataTypeMapping.put("DATA_8_BIT", new DataTypeMap("Integer", 0x08, 1, false)); dataTypeMapping.put("OCTET_STRING", new DataTypeMap("ByteArray", 0x41, -1, false)); dataTypeMapping.put("UTCTIME", new DataTypeMap("Calendar", 0xe2, 4, true, 0xffffffff)); diff --git a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java index 6201d98a9..dbd080c11 100644 --- a/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java +++ b/com.zsmartsystems.zigbee.autocode/src/main/java/com/zsmartsystems/zigbee/autocode/ZigBeeCodeGenerator.java @@ -57,6 +57,7 @@ public static void main(final String[] args) { zclParser.addFile("src/main/resources/0009_Alarms.xml"); zclParser.addFile("src/main/resources/000A_Time.xml"); zclParser.addFile("src/main/resources/000B_RssiLocation.xml"); + zclParser.addFile("src/main/resources/000C_AnalogInputBasic.xml"); zclParser.addFile("src/main/resources/000F_BinaryInputBasic.xml"); zclParser.addFile("src/main/resources/0012_MultistateInputBasic.xml"); zclParser.addFile("src/main/resources/0013_MultistateOutputBasic.xml"); diff --git a/com.zsmartsystems.zigbee.autocode/src/main/resources/000C_AnalogInputBasic.xml b/com.zsmartsystems.zigbee.autocode/src/main/resources/000C_AnalogInputBasic.xml new file mode 100644 index 000000000..bbcbc9cd8 --- /dev/null +++ b/com.zsmartsystems.zigbee.autocode/src/main/resources/000C_AnalogInputBasic.xml @@ -0,0 +1,93 @@ + + Analog Input (Basic) + The Analog Input (Basic) cluster provides an interface for reading the value of an analog measurement and accessing various characteristics of that measurement. The cluster is typically used to implement a sensor that measures an analog physical quantity. + + + Description + The Description attribute, of type Character string, MAY be used to hold a description of the usage of the input, output or value, as appropriate to the cluster. The character set used SHALL be ASCII, and the at- tribute SHALL contain a maximum of 16 characters, which SHALL be printable but are otherwise unrestricted. + + + Max Present Value + The MaxPresentValue attribute, of type Single precision, indicates the highest value that can be reliably obtained for the PresentValue attribute of an Analog Input cluster, or which can reliably be used for the PresentValue attribute of an Analog Output or Analog Value cluster. + + + Min Present Value + The MinPresentValue attribute, of type Single precision, indicates the lowest value that can be reliably ob- tained for the PresentValue attribute of an Analog Input cluster, or which can reliably be used for the PresentValue attribute of an Analog Output or Analog Value cluster. + + + Out Of Service + + + + Present Value + The PresentValue attribute indicates the current value of the input, output or value, as appropriate for the cluster. For Analog clusters it is of type single precision, for Binary clusters it is of type Boolean, and for multistate clusters it is of type Unsigned 16-bit integer. The PresentValue attribute of an input cluster SHALL be writable when OutOfService is TRUE. When the PriorityArray attribute is implemented, writing to PresentValue SHALL be equivalent to writing to element 16 of PriorityArray, i.e., with a priority of 16. + + + Reliability + The Reliability attribute, of type 8-bit enumeration, provides an indication of whether the PresentValueor the operation of the physical input, output or value in question (as appropriate for the cluster) is “reliable” as far as can be determined and, if not, why not. The Reliability attribute MAY have any of the following values: + NO-FAULT-DETECTED (0) OVER-RANGE (2) UNDER-RANGE (3) OPEN-LOOP (4) SHORTED-LOOP (5) UNRELIABLE-OTHER (7) PROCESS-ERROR (8) MULTI-STATE-FAULT (9) CONFIGURATION-ERROR (10) + + + Resolution + This attribute, of type Single precision, indicates the smallest recognizable change to PresentValue. + + + Status Flags + This attribute, of type bitmap, represents four Boolean flags that indicate the general “health” of the analog sensor. Three of the flags are associated with the values of other optional attributes of this cluster. A more detailed status could be determined by reading the optional attributes (if supported) that are linked to these flags. The relationship between individual flags is not defined. + The four flags are Bit 0 = IN_ALARM, Bit 1 = FAULT, Bit 2 = OVERRIDDEN, Bit 3 = OUT OF SERVICE + where: + IN_ALARM -Logical FALSE (0) if the EventStateattribute has a value of NORMAL, otherwise logical TRUE (1). This bit is always 0 unless the cluster implementing the EventState attribute is implemented on the same endpoint. + FAULT -Logical TRUE (1) if the Reliability attribute is present and does not have a value of NO FAULT DETECTED, otherwise logical FALSE (0). + OVERRIDDEN -Logical TRUE (1) if the cluster has been overridden by some mechanism local to the device. Otherwise, the value is logical FALSE (0). In this context, for an input cluster, “overridden” is taken to mean that the PresentValue and Reliability(optional) attributes are no longer tracking changes to the physical input. For an Output cluster, “overridden” is taken to mean that the physical output is no longer tracking changes to the PresentValue attribute and the Reliability attribute is no longer a reflection of the physical output. For a Value cluster, “overridden” is taken to mean that the PresentValue attribute is not writeable. + OUT OF SERVICE -Logical TRUE (1) if the OutOfService attribute has a value of TRUE, otherwise logical FALSE (0). + + + Engineering Units + The EngineeringUnits attribute indicates the physical units associated with the value of the PresentValue attribute of an Analog cluster. + Values 0x0000 to 0x00fe are reserved for the list of engineering units with corresponding values specified in Clause 21 of the BACnet standard. 0x00ff represents 'other'. Values 0x0100 to 0xffff are available for proprietary use. + If the ApplicationType attribute is implemented, and is set to a value with a defined physical unit, the physical unit defined in ApplicationType takes priority over EngineeringUnits. + This attribute is defined to be Read Only, but a vendor can decide to allow this to be written to if ApplicationType is also supported. If this attribute is written to, how the device handles invalid units (e.g., changing Deg F to Cubic Feet per Minute), any local display or other vendor-specific operation (upon the change) is a local matter. + + + Application Type + The ApplicationType attribute is an unsigned 32 bit integer that indicates the specific application usage for this cluster. (Note: This attribute has no BACnet equivalent). ApplicationType is subdivided into Group, Type and an Index number, as follows. + Group = Bits 24-31 An indication of the cluster this attribute is part of. + Type = Bits 16-23 For Analog clusters, the physical quantity that the Present Value attribute of the cluster represents. For Binary and Multistate clusters, the application usage domain. + Index = Bits 0-15The specific application usage of the cluster. + + + + Reliability + + + + + + + + + + + + + + + + + + + + + Status Flags + + + + + + + + + + + diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclAnalogInputBasicCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclAnalogInputBasicCluster.java index 506030e6a..c3001b52f 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclAnalogInputBasicCluster.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclAnalogInputBasicCluster.java @@ -7,19 +7,30 @@ */ package com.zsmartsystems.zigbee.zcl.clusters; -import com.zsmartsystems.zigbee.ZigBeeEndpoint; -import com.zsmartsystems.zigbee.zcl.ZclAttribute; -import com.zsmartsystems.zigbee.zcl.ZclCluster; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.Future; + import javax.annotation.Generated; +import com.zsmartsystems.zigbee.CommandResult; +import com.zsmartsystems.zigbee.ZigBeeEndpoint; +import com.zsmartsystems.zigbee.zcl.ZclAttribute; +import com.zsmartsystems.zigbee.zcl.ZclCluster; +import com.zsmartsystems.zigbee.zcl.field.Double; +import com.zsmartsystems.zigbee.zcl.protocol.ZclClusterType; +import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType; + /** * Analog Input (Basic) cluster implementation (Cluster ID 0x000C). *

+ * The Analog Input (Basic) cluster provides an interface for reading the value of an analog + * measurement and accessing various characteristics of that measurement. The cluster is + * typically used to implement a sensor that measures an analog physical quantity. + *

* Code is auto-generated. Modifications may be overwritten! */ -@Generated(value = "com.zsmartsystems.zigbee.autocode.ZclProtocolCodeGenerator", date = "2018-10-24T19:40:52Z") +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:49:59Z") public class ZclAnalogInputBasicCluster extends ZclCluster { /** * The ZigBee Cluster Library Cluster ID @@ -31,9 +42,136 @@ public class ZclAnalogInputBasicCluster extends ZclCluster { */ public static final String CLUSTER_NAME = "Analog Input (Basic)"; - // Attribute initialisation + // Attribute constants + /** + * The Description attribute, of type Character string, may be used to hold a description + * of the usage of the input, output or value, as appropriate to the cluster. The character + * set used shall be ASCII, and the at- tribute shall contain a maximum of 16 characters, + * which shall be printable but are otherwise unrestricted. + */ + public static final int ATTR_DESCRIPTION = 0x001C; + /** + * The MaxPresentValue attribute, of type Single precision, indicates the highest value + * that can be reliably obtained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + */ + public static final int ATTR_MAXPRESENTVALUE = 0x0041; + /** + * The MinPresentValue attribute, of type Single precision, indicates the lowest value + * that can be reliably ob- tained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + */ + public static final int ATTR_MINPRESENTVALUE = 0x0045; + /** + */ + public static final int ATTR_OUTOFSERVICE = 0x0051; + /** + * The PresentValue attribute indicates the current value of the input, output or value, + * as appropriate for the cluster. For Analog clusters it is of type single precision, for + * Binary clusters it is of type Boolean, and for multistate clusters it is of type Unsigned + * 16-bit integer. The PresentValue attribute of an input cluster shall be writable when + * OutOfService is TRUE. When the PriorityArray attribute is implemented, writing to + * PresentValue shall be equivalent to writing to element 16 of PriorityArray, i.e., with + * a priority of 16. + */ + public static final int ATTR_PRESENTVALUE = 0x0055; + /** + * The Reliability attribute, of type 8-bit enumeration, provides an indication of + * whether the PresentValueor the operation of the physical input, output or value in + * question (as appropriate for the cluster) is “reliable” as far as can be determined and, + * if not, why not. The Reliability attribute may have any of the following values: + *

+ * NO-FAULT-DETECTED (0) OVER-RANGE (2) UNDER-RANGE (3) OPEN-LOOP (4) SHORTED-LOOP (5) + * UNRELIABLE-OTHER (7) PROCESS-ERROR (8) MULTI-STATE-FAULT (9) CONFIGURATION-ERROR + * (10) + */ + public static final int ATTR_RELIABILITY = 0x0067; + /** + * This attribute, of type Single precision, indicates the smallest recognizable change + * to PresentValue. + */ + public static final int ATTR_RESOLUTION = 0x006A; + /** + * This attribute, of type bitmap, represents four Boolean flags that indicate the + * general “health” of the analog sensor. Three of the flags are associated with the values + * of other optional attributes of this cluster. A more detailed status could be + * determined by reading the optional attributes (if supported) that are linked to these + * flags. The relationship between individual flags is not defined. + *

+ * The four flags are Bit 0 = IN_ALARM, Bit 1 = FAULT, Bit 2 = OVERRIDDEN, Bit 3 = OUT OF SERVICE + *

+ * where: + *

+ * IN_ALARM -Logical FALSE (0) if the EventStateattribute has a value of NORMAL, + * otherwise logical TRUE (1). This bit is always 0 unless the cluster implementing the + * EventState attribute is implemented on the same endpoint. + *

+ * FAULT -Logical TRUE (1) if the Reliability attribute is present and does not have a value + * of NO FAULT DETECTED, otherwise logical FALSE (0). + *

+ * OVERRIDDEN -Logical TRUE (1) if the cluster has been overridden by some mechanism local + * to the device. Otherwise, the value is logical FALSE (0). In this context, for an input + * cluster, “overridden” is taken to mean that the PresentValue and + * Reliability(optional) attributes are no longer tracking changes to the physical + * input. For an Output cluster, “overridden” is taken to mean that the physical output is + * no longer tracking changes to the PresentValue attribute and the Reliability + * attribute is no longer a reflection of the physical output. For a Value cluster, + * “overridden” is taken to mean that the PresentValue attribute is not writeable. + *

+ * OUT OF SERVICE -Logical TRUE (1) if the OutOfService attribute has a value of TRUE, + * otherwise logical FALSE (0). + */ + public static final int ATTR_STATUSFLAGS = 0x006F; + /** + * The EngineeringUnits attribute indicates the physical units associated with the + * value of the PresentValue attribute of an Analog cluster. + *

+ * Values 0x0000 to 0x00fe are reserved for the list of engineering units with + * corresponding values specified in Clause 21 of the BACnet standard. 0x00ff represents + * 'other'. Values 0x0100 to 0xffff are available for proprietary use. + *

+ * If the ApplicationType attribute is implemented, and is set to a value with a defined + * physical unit, the physical unit defined in ApplicationType takes priority over + * EngineeringUnits. + *

+ * This attribute is defined to be Read Only, but a vendor can decide to allow this to be + * written to if ApplicationType is also supported. If this attribute is written to, how + * the device handles invalid units (e.g., changing Deg F to Cubic Feet per Minute), any + * local display or other vendor-specific operation (upon the change) is a local matter. + */ + public static final int ATTR_ENGINEERINGUNITS = 0x0075; + /** + * The ApplicationType attribute is an unsigned 32 bit integer that indicates the + * specific application usage for this cluster. (Note: This attribute has no BACnet + * equivalent). ApplicationType is subdivided into Group, Type and an Index number, as + * follows. + *

+ * Group = Bits 24-31 An indication of the cluster this attribute is part of. + *

+ * Type = Bits 16-23 For Analog clusters, the physical quantity that the Present Value + * attribute of the cluster represents. For Binary and Multistate clusters, the + * application usage domain. + *

+ * Index = Bits 0-15The specific application usage of the cluster. + */ + public static final int ATTR_APPLICATIONTYPE = 0x0100; + + @Override protected Map initializeAttributes() { - Map attributeMap = new ConcurrentHashMap(0); + Map attributeMap = new ConcurrentHashMap<>(10); + + attributeMap.put(ATTR_DESCRIPTION, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_DESCRIPTION, "Description", ZclDataType.CHARACTER_STRING, false, true, true, false)); + attributeMap.put(ATTR_MAXPRESENTVALUE, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_MAXPRESENTVALUE, "Max Present Value", ZclDataType.FLOAT_32_BIT, false, true, true, false)); + attributeMap.put(ATTR_MINPRESENTVALUE, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_MINPRESENTVALUE, "Min Present Value", ZclDataType.FLOAT_32_BIT, false, true, true, false)); + attributeMap.put(ATTR_OUTOFSERVICE, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_OUTOFSERVICE, "Out Of Service", ZclDataType.BOOLEAN, false, true, true, false)); + attributeMap.put(ATTR_PRESENTVALUE, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_PRESENTVALUE, "Present Value", ZclDataType.FLOAT_32_BIT, false, true, true, false)); + attributeMap.put(ATTR_RELIABILITY, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_RELIABILITY, "Reliability", ZclDataType.ENUMERATION_8_BIT, false, true, true, false)); + attributeMap.put(ATTR_RESOLUTION, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_RESOLUTION, "Resolution", ZclDataType.FLOAT_32_BIT, false, true, true, false)); + attributeMap.put(ATTR_STATUSFLAGS, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_STATUSFLAGS, "Status Flags", ZclDataType.BITMAP_8_BIT, false, true, true, false)); + attributeMap.put(ATTR_ENGINEERINGUNITS, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_ENGINEERINGUNITS, "Engineering Units", ZclDataType.ENUMERATION_32_BIT, false, true, true, false)); + attributeMap.put(ATTR_APPLICATIONTYPE, new ZclAttribute(ZclClusterType.ANALOG_INPUT_BASIC, ATTR_APPLICATIONTYPE, "Application Type", ZclDataType.SIGNED_32_BIT_INTEGER, false, true, true, false)); return attributeMap; } @@ -41,9 +179,811 @@ protected Map initializeAttributes() { /** * Default constructor to create a Analog Input (Basic) cluster. * - * @param zigbeeEndpoint the {@link ZigBeeEndpoint} + * @param zigbeeEndpoint the {@link ZigBeeEndpoint} this cluster is contained within */ public ZclAnalogInputBasicCluster(final ZigBeeEndpoint zigbeeEndpoint) { super(zigbeeEndpoint, CLUSTER_ID, CLUSTER_NAME); } + + /** + * Set the Description attribute [attribute ID 0x001C]. + *

+ * The Description attribute, of type Character string, may be used to hold a description + * of the usage of the input, output or value, as appropriate to the cluster. The character + * set used shall be ASCII, and the at- tribute shall contain a maximum of 16 characters, + * which shall be printable but are otherwise unrestricted. + *

+ * The attribute is of type {@link String}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param description the {@link String} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setDescription(final String value) { + return write(attributes.get(ATTR_DESCRIPTION), value); + } + + /** + * Get the Description attribute [attribute ID 0x001C]. + *

+ * The Description attribute, of type Character string, may be used to hold a description + * of the usage of the input, output or value, as appropriate to the cluster. The character + * set used shall be ASCII, and the at- tribute shall contain a maximum of 16 characters, + * which shall be printable but are otherwise unrestricted. + *

+ * The attribute is of type {@link String}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getDescriptionAsync() { + return read(attributes.get(ATTR_DESCRIPTION)); + } + + /** + * Synchronously get the Description attribute [attribute ID 0x001C]. + *

+ * The Description attribute, of type Character string, may be used to hold a description + * of the usage of the input, output or value, as appropriate to the cluster. The character + * set used shall be ASCII, and the at- tribute shall contain a maximum of 16 characters, + * which shall be printable but are otherwise unrestricted. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link String}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link String} attribute value, or null on error + */ + public String getDescription(final long refreshPeriod) { + if (attributes.get(ATTR_DESCRIPTION).isLastValueCurrent(refreshPeriod)) { + return (String) attributes.get(ATTR_DESCRIPTION).getLastValue(); + } + + return (String) readSync(attributes.get(ATTR_DESCRIPTION)); + } + + /** + * Set the Max Present Value attribute [attribute ID 0x0041]. + *

+ * The MaxPresentValue attribute, of type Single precision, indicates the highest value + * that can be reliably obtained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param maxPresentValue the {@link Double} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setMaxPresentValue(final Double value) { + return write(attributes.get(ATTR_MAXPRESENTVALUE), value); + } + + /** + * Get the Max Present Value attribute [attribute ID 0x0041]. + *

+ * The MaxPresentValue attribute, of type Single precision, indicates the highest value + * that can be reliably obtained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getMaxPresentValueAsync() { + return read(attributes.get(ATTR_MAXPRESENTVALUE)); + } + + /** + * Synchronously get the Max Present Value attribute [attribute ID 0x0041]. + *

+ * The MaxPresentValue attribute, of type Single precision, indicates the highest value + * that can be reliably obtained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + */ + public Double getMaxPresentValue(final long refreshPeriod) { + if (attributes.get(ATTR_MAXPRESENTVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) attributes.get(ATTR_MAXPRESENTVALUE).getLastValue(); + } + + return (Double) readSync(attributes.get(ATTR_MAXPRESENTVALUE)); + } + + /** + * Set the Min Present Value attribute [attribute ID 0x0045]. + *

+ * The MinPresentValue attribute, of type Single precision, indicates the lowest value + * that can be reliably ob- tained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param minPresentValue the {@link Double} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setMinPresentValue(final Double value) { + return write(attributes.get(ATTR_MINPRESENTVALUE), value); + } + + /** + * Get the Min Present Value attribute [attribute ID 0x0045]. + *

+ * The MinPresentValue attribute, of type Single precision, indicates the lowest value + * that can be reliably ob- tained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getMinPresentValueAsync() { + return read(attributes.get(ATTR_MINPRESENTVALUE)); + } + + /** + * Synchronously get the Min Present Value attribute [attribute ID 0x0045]. + *

+ * The MinPresentValue attribute, of type Single precision, indicates the lowest value + * that can be reliably ob- tained for the PresentValue attribute of an Analog Input + * cluster, or which can reliably be used for the PresentValue attribute of an Analog + * Output or Analog Value cluster. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + */ + public Double getMinPresentValue(final long refreshPeriod) { + if (attributes.get(ATTR_MINPRESENTVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) attributes.get(ATTR_MINPRESENTVALUE).getLastValue(); + } + + return (Double) readSync(attributes.get(ATTR_MINPRESENTVALUE)); + } + + /** + * Set the Out Of Service attribute [attribute ID 0x0051]. + *

+ *

+ * The attribute is of type {@link Boolean}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param outOfService the {@link Boolean} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setOutOfService(final Boolean value) { + return write(attributes.get(ATTR_OUTOFSERVICE), value); + } + + /** + * Get the Out Of Service attribute [attribute ID 0x0051]. + *

+ *

+ * The attribute is of type {@link Boolean}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getOutOfServiceAsync() { + return read(attributes.get(ATTR_OUTOFSERVICE)); + } + + /** + * Synchronously get the Out Of Service attribute [attribute ID 0x0051]. + *

+ *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Boolean}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Boolean} attribute value, or null on error + */ + public Boolean getOutOfService(final long refreshPeriod) { + if (attributes.get(ATTR_OUTOFSERVICE).isLastValueCurrent(refreshPeriod)) { + return (Boolean) attributes.get(ATTR_OUTOFSERVICE).getLastValue(); + } + + return (Boolean) readSync(attributes.get(ATTR_OUTOFSERVICE)); + } + + /** + * Set the Present Value attribute [attribute ID 0x0055]. + *

+ * The PresentValue attribute indicates the current value of the input, output or value, + * as appropriate for the cluster. For Analog clusters it is of type single precision, for + * Binary clusters it is of type Boolean, and for multistate clusters it is of type Unsigned + * 16-bit integer. The PresentValue attribute of an input cluster shall be writable when + * OutOfService is TRUE. When the PriorityArray attribute is implemented, writing to + * PresentValue shall be equivalent to writing to element 16 of PriorityArray, i.e., with + * a priority of 16. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param presentValue the {@link Double} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setPresentValue(final Double value) { + return write(attributes.get(ATTR_PRESENTVALUE), value); + } + + /** + * Get the Present Value attribute [attribute ID 0x0055]. + *

+ * The PresentValue attribute indicates the current value of the input, output or value, + * as appropriate for the cluster. For Analog clusters it is of type single precision, for + * Binary clusters it is of type Boolean, and for multistate clusters it is of type Unsigned + * 16-bit integer. The PresentValue attribute of an input cluster shall be writable when + * OutOfService is TRUE. When the PriorityArray attribute is implemented, writing to + * PresentValue shall be equivalent to writing to element 16 of PriorityArray, i.e., with + * a priority of 16. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getPresentValueAsync() { + return read(attributes.get(ATTR_PRESENTVALUE)); + } + + /** + * Synchronously get the Present Value attribute [attribute ID 0x0055]. + *

+ * The PresentValue attribute indicates the current value of the input, output or value, + * as appropriate for the cluster. For Analog clusters it is of type single precision, for + * Binary clusters it is of type Boolean, and for multistate clusters it is of type Unsigned + * 16-bit integer. The PresentValue attribute of an input cluster shall be writable when + * OutOfService is TRUE. When the PriorityArray attribute is implemented, writing to + * PresentValue shall be equivalent to writing to element 16 of PriorityArray, i.e., with + * a priority of 16. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + */ + public Double getPresentValue(final long refreshPeriod) { + if (attributes.get(ATTR_PRESENTVALUE).isLastValueCurrent(refreshPeriod)) { + return (Double) attributes.get(ATTR_PRESENTVALUE).getLastValue(); + } + + return (Double) readSync(attributes.get(ATTR_PRESENTVALUE)); + } + + /** + * Set the Reliability attribute [attribute ID 0x0067]. + *

+ * The Reliability attribute, of type 8-bit enumeration, provides an indication of + * whether the PresentValueor the operation of the physical input, output or value in + * question (as appropriate for the cluster) is “reliable” as far as can be determined and, + * if not, why not. The Reliability attribute may have any of the following values: + *

+ * NO-FAULT-DETECTED (0) OVER-RANGE (2) UNDER-RANGE (3) OPEN-LOOP (4) SHORTED-LOOP (5) + * UNRELIABLE-OTHER (7) PROCESS-ERROR (8) MULTI-STATE-FAULT (9) CONFIGURATION-ERROR + * (10) + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param reliability the {@link Integer} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setReliability(final Integer value) { + return write(attributes.get(ATTR_RELIABILITY), value); + } + + /** + * Get the Reliability attribute [attribute ID 0x0067]. + *

+ * The Reliability attribute, of type 8-bit enumeration, provides an indication of + * whether the PresentValueor the operation of the physical input, output or value in + * question (as appropriate for the cluster) is “reliable” as far as can be determined and, + * if not, why not. The Reliability attribute may have any of the following values: + *

+ * NO-FAULT-DETECTED (0) OVER-RANGE (2) UNDER-RANGE (3) OPEN-LOOP (4) SHORTED-LOOP (5) + * UNRELIABLE-OTHER (7) PROCESS-ERROR (8) MULTI-STATE-FAULT (9) CONFIGURATION-ERROR + * (10) + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getReliabilityAsync() { + return read(attributes.get(ATTR_RELIABILITY)); + } + + /** + * Synchronously get the Reliability attribute [attribute ID 0x0067]. + *

+ * The Reliability attribute, of type 8-bit enumeration, provides an indication of + * whether the PresentValueor the operation of the physical input, output or value in + * question (as appropriate for the cluster) is “reliable” as far as can be determined and, + * if not, why not. The Reliability attribute may have any of the following values: + *

+ * NO-FAULT-DETECTED (0) OVER-RANGE (2) UNDER-RANGE (3) OPEN-LOOP (4) SHORTED-LOOP (5) + * UNRELIABLE-OTHER (7) PROCESS-ERROR (8) MULTI-STATE-FAULT (9) CONFIGURATION-ERROR + * (10) + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Integer} attribute value, or null on error + */ + public Integer getReliability(final long refreshPeriod) { + if (attributes.get(ATTR_RELIABILITY).isLastValueCurrent(refreshPeriod)) { + return (Integer) attributes.get(ATTR_RELIABILITY).getLastValue(); + } + + return (Integer) readSync(attributes.get(ATTR_RELIABILITY)); + } + + /** + * Set the Resolution attribute [attribute ID 0x006A]. + *

+ * This attribute, of type Single precision, indicates the smallest recognizable change + * to PresentValue. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param resolution the {@link Double} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setResolution(final Double value) { + return write(attributes.get(ATTR_RESOLUTION), value); + } + + /** + * Get the Resolution attribute [attribute ID 0x006A]. + *

+ * This attribute, of type Single precision, indicates the smallest recognizable change + * to PresentValue. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getResolutionAsync() { + return read(attributes.get(ATTR_RESOLUTION)); + } + + /** + * Synchronously get the Resolution attribute [attribute ID 0x006A]. + *

+ * This attribute, of type Single precision, indicates the smallest recognizable change + * to PresentValue. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Double}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Double} attribute value, or null on error + */ + public Double getResolution(final long refreshPeriod) { + if (attributes.get(ATTR_RESOLUTION).isLastValueCurrent(refreshPeriod)) { + return (Double) attributes.get(ATTR_RESOLUTION).getLastValue(); + } + + return (Double) readSync(attributes.get(ATTR_RESOLUTION)); + } + + /** + * Set the Status Flags attribute [attribute ID 0x006F]. + *

+ * This attribute, of type bitmap, represents four Boolean flags that indicate the + * general “health” of the analog sensor. Three of the flags are associated with the values + * of other optional attributes of this cluster. A more detailed status could be + * determined by reading the optional attributes (if supported) that are linked to these + * flags. The relationship between individual flags is not defined. + *

+ * The four flags are Bit 0 = IN_ALARM, Bit 1 = FAULT, Bit 2 = OVERRIDDEN, Bit 3 = OUT OF SERVICE + *

+ * where: + *

+ * IN_ALARM -Logical FALSE (0) if the EventStateattribute has a value of NORMAL, + * otherwise logical TRUE (1). This bit is always 0 unless the cluster implementing the + * EventState attribute is implemented on the same endpoint. + *

+ * FAULT -Logical TRUE (1) if the Reliability attribute is present and does not have a value + * of NO FAULT DETECTED, otherwise logical FALSE (0). + *

+ * OVERRIDDEN -Logical TRUE (1) if the cluster has been overridden by some mechanism local + * to the device. Otherwise, the value is logical FALSE (0). In this context, for an input + * cluster, “overridden” is taken to mean that the PresentValue and + * Reliability(optional) attributes are no longer tracking changes to the physical + * input. For an Output cluster, “overridden” is taken to mean that the physical output is + * no longer tracking changes to the PresentValue attribute and the Reliability + * attribute is no longer a reflection of the physical output. For a Value cluster, + * “overridden” is taken to mean that the PresentValue attribute is not writeable. + *

+ * OUT OF SERVICE -Logical TRUE (1) if the OutOfService attribute has a value of TRUE, + * otherwise logical FALSE (0). + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param statusFlags the {@link Integer} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setStatusFlags(final Integer value) { + return write(attributes.get(ATTR_STATUSFLAGS), value); + } + + /** + * Get the Status Flags attribute [attribute ID 0x006F]. + *

+ * This attribute, of type bitmap, represents four Boolean flags that indicate the + * general “health” of the analog sensor. Three of the flags are associated with the values + * of other optional attributes of this cluster. A more detailed status could be + * determined by reading the optional attributes (if supported) that are linked to these + * flags. The relationship between individual flags is not defined. + *

+ * The four flags are Bit 0 = IN_ALARM, Bit 1 = FAULT, Bit 2 = OVERRIDDEN, Bit 3 = OUT OF SERVICE + *

+ * where: + *

+ * IN_ALARM -Logical FALSE (0) if the EventStateattribute has a value of NORMAL, + * otherwise logical TRUE (1). This bit is always 0 unless the cluster implementing the + * EventState attribute is implemented on the same endpoint. + *

+ * FAULT -Logical TRUE (1) if the Reliability attribute is present and does not have a value + * of NO FAULT DETECTED, otherwise logical FALSE (0). + *

+ * OVERRIDDEN -Logical TRUE (1) if the cluster has been overridden by some mechanism local + * to the device. Otherwise, the value is logical FALSE (0). In this context, for an input + * cluster, “overridden” is taken to mean that the PresentValue and + * Reliability(optional) attributes are no longer tracking changes to the physical + * input. For an Output cluster, “overridden” is taken to mean that the physical output is + * no longer tracking changes to the PresentValue attribute and the Reliability + * attribute is no longer a reflection of the physical output. For a Value cluster, + * “overridden” is taken to mean that the PresentValue attribute is not writeable. + *

+ * OUT OF SERVICE -Logical TRUE (1) if the OutOfService attribute has a value of TRUE, + * otherwise logical FALSE (0). + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getStatusFlagsAsync() { + return read(attributes.get(ATTR_STATUSFLAGS)); + } + + /** + * Synchronously get the Status Flags attribute [attribute ID 0x006F]. + *

+ * This attribute, of type bitmap, represents four Boolean flags that indicate the + * general “health” of the analog sensor. Three of the flags are associated with the values + * of other optional attributes of this cluster. A more detailed status could be + * determined by reading the optional attributes (if supported) that are linked to these + * flags. The relationship between individual flags is not defined. + *

+ * The four flags are Bit 0 = IN_ALARM, Bit 1 = FAULT, Bit 2 = OVERRIDDEN, Bit 3 = OUT OF SERVICE + *

+ * where: + *

+ * IN_ALARM -Logical FALSE (0) if the EventStateattribute has a value of NORMAL, + * otherwise logical TRUE (1). This bit is always 0 unless the cluster implementing the + * EventState attribute is implemented on the same endpoint. + *

+ * FAULT -Logical TRUE (1) if the Reliability attribute is present and does not have a value + * of NO FAULT DETECTED, otherwise logical FALSE (0). + *

+ * OVERRIDDEN -Logical TRUE (1) if the cluster has been overridden by some mechanism local + * to the device. Otherwise, the value is logical FALSE (0). In this context, for an input + * cluster, “overridden” is taken to mean that the PresentValue and + * Reliability(optional) attributes are no longer tracking changes to the physical + * input. For an Output cluster, “overridden” is taken to mean that the physical output is + * no longer tracking changes to the PresentValue attribute and the Reliability + * attribute is no longer a reflection of the physical output. For a Value cluster, + * “overridden” is taken to mean that the PresentValue attribute is not writeable. + *

+ * OUT OF SERVICE -Logical TRUE (1) if the OutOfService attribute has a value of TRUE, + * otherwise logical FALSE (0). + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Integer} attribute value, or null on error + */ + public Integer getStatusFlags(final long refreshPeriod) { + if (attributes.get(ATTR_STATUSFLAGS).isLastValueCurrent(refreshPeriod)) { + return (Integer) attributes.get(ATTR_STATUSFLAGS).getLastValue(); + } + + return (Integer) readSync(attributes.get(ATTR_STATUSFLAGS)); + } + + /** + * Set the Engineering Units attribute [attribute ID 0x0075]. + *

+ * The EngineeringUnits attribute indicates the physical units associated with the + * value of the PresentValue attribute of an Analog cluster. + *

+ * Values 0x0000 to 0x00fe are reserved for the list of engineering units with + * corresponding values specified in Clause 21 of the BACnet standard. 0x00ff represents + * 'other'. Values 0x0100 to 0xffff are available for proprietary use. + *

+ * If the ApplicationType attribute is implemented, and is set to a value with a defined + * physical unit, the physical unit defined in ApplicationType takes priority over + * EngineeringUnits. + *

+ * This attribute is defined to be Read Only, but a vendor can decide to allow this to be + * written to if ApplicationType is also supported. If this attribute is written to, how + * the device handles invalid units (e.g., changing Deg F to Cubic Feet per Minute), any + * local display or other vendor-specific operation (upon the change) is a local matter. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param engineeringUnits the {@link Integer} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setEngineeringUnits(final Integer value) { + return write(attributes.get(ATTR_ENGINEERINGUNITS), value); + } + + /** + * Get the Engineering Units attribute [attribute ID 0x0075]. + *

+ * The EngineeringUnits attribute indicates the physical units associated with the + * value of the PresentValue attribute of an Analog cluster. + *

+ * Values 0x0000 to 0x00fe are reserved for the list of engineering units with + * corresponding values specified in Clause 21 of the BACnet standard. 0x00ff represents + * 'other'. Values 0x0100 to 0xffff are available for proprietary use. + *

+ * If the ApplicationType attribute is implemented, and is set to a value with a defined + * physical unit, the physical unit defined in ApplicationType takes priority over + * EngineeringUnits. + *

+ * This attribute is defined to be Read Only, but a vendor can decide to allow this to be + * written to if ApplicationType is also supported. If this attribute is written to, how + * the device handles invalid units (e.g., changing Deg F to Cubic Feet per Minute), any + * local display or other vendor-specific operation (upon the change) is a local matter. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getEngineeringUnitsAsync() { + return read(attributes.get(ATTR_ENGINEERINGUNITS)); + } + + /** + * Synchronously get the Engineering Units attribute [attribute ID 0x0075]. + *

+ * The EngineeringUnits attribute indicates the physical units associated with the + * value of the PresentValue attribute of an Analog cluster. + *

+ * Values 0x0000 to 0x00fe are reserved for the list of engineering units with + * corresponding values specified in Clause 21 of the BACnet standard. 0x00ff represents + * 'other'. Values 0x0100 to 0xffff are available for proprietary use. + *

+ * If the ApplicationType attribute is implemented, and is set to a value with a defined + * physical unit, the physical unit defined in ApplicationType takes priority over + * EngineeringUnits. + *

+ * This attribute is defined to be Read Only, but a vendor can decide to allow this to be + * written to if ApplicationType is also supported. If this attribute is written to, how + * the device handles invalid units (e.g., changing Deg F to Cubic Feet per Minute), any + * local display or other vendor-specific operation (upon the change) is a local matter. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Integer} attribute value, or null on error + */ + public Integer getEngineeringUnits(final long refreshPeriod) { + if (attributes.get(ATTR_ENGINEERINGUNITS).isLastValueCurrent(refreshPeriod)) { + return (Integer) attributes.get(ATTR_ENGINEERINGUNITS).getLastValue(); + } + + return (Integer) readSync(attributes.get(ATTR_ENGINEERINGUNITS)); + } + + /** + * Set the Application Type attribute [attribute ID 0x0100]. + *

+ * The ApplicationType attribute is an unsigned 32 bit integer that indicates the + * specific application usage for this cluster. (Note: This attribute has no BACnet + * equivalent). ApplicationType is subdivided into Group, Type and an Index number, as + * follows. + *

+ * Group = Bits 24-31 An indication of the cluster this attribute is part of. + *

+ * Type = Bits 16-23 For Analog clusters, the physical quantity that the Present Value + * attribute of the cluster represents. For Binary and Multistate clusters, the + * application usage domain. + *

+ * Index = Bits 0-15The specific application usage of the cluster. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param applicationType the {@link Integer} attribute value to be set + * @return the {@link Future} command result future + */ + public Future setApplicationType(final Integer value) { + return write(attributes.get(ATTR_APPLICATIONTYPE), value); + } + + /** + * Get the Application Type attribute [attribute ID 0x0100]. + *

+ * The ApplicationType attribute is an unsigned 32 bit integer that indicates the + * specific application usage for this cluster. (Note: This attribute has no BACnet + * equivalent). ApplicationType is subdivided into Group, Type and an Index number, as + * follows. + *

+ * Group = Bits 24-31 An indication of the cluster this attribute is part of. + *

+ * Type = Bits 16-23 For Analog clusters, the physical quantity that the Present Value + * attribute of the cluster represents. For Binary and Multistate clusters, the + * application usage domain. + *

+ * Index = Bits 0-15The specific application usage of the cluster. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @return the {@link Future} command result future + */ + public Future getApplicationTypeAsync() { + return read(attributes.get(ATTR_APPLICATIONTYPE)); + } + + /** + * Synchronously get the Application Type attribute [attribute ID 0x0100]. + *

+ * The ApplicationType attribute is an unsigned 32 bit integer that indicates the + * specific application usage for this cluster. (Note: This attribute has no BACnet + * equivalent). ApplicationType is subdivided into Group, Type and an Index number, as + * follows. + *

+ * Group = Bits 24-31 An indication of the cluster this attribute is part of. + *

+ * Type = Bits 16-23 For Analog clusters, the physical quantity that the Present Value + * attribute of the cluster represents. For Binary and Multistate clusters, the + * application usage domain. + *

+ * Index = Bits 0-15The specific application usage of the cluster. + *

+ * This method can return cached data if the attribute has already been received. + * The parameter refreshPeriod is used to control this. If the attribute has been received + * within refreshPeriod milliseconds, then the method will immediately return the last value + * received. If refreshPeriod is set to 0, then the attribute will always be updated. + *

+ * This method will block until the response is received or a timeout occurs unless the current value is returned. + *

+ * The attribute is of type {@link Integer}. + *

+ * The implementation of this attribute by a device is OPTIONAL + * + * @param refreshPeriod the maximum age of the data (in milliseconds) before an update is needed + * @return the {@link Integer} attribute value, or null on error + */ + public Integer getApplicationType(final long refreshPeriod) { + if (attributes.get(ATTR_APPLICATIONTYPE).isLastValueCurrent(refreshPeriod)) { + return (Integer) attributes.get(ATTR_APPLICATIONTYPE).getLastValue(); + } + + return (Integer) readSync(attributes.get(ATTR_APPLICATIONTYPE)); + } } diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclMeteringCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclMeteringCluster.java index 03c7cdfcc..63f82274a 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclMeteringCluster.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclMeteringCluster.java @@ -67,7 +67,7 @@ *

* Code is auto-generated. Modifications may be overwritten! */ -@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-02-26T20:57:36Z") +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:30:33Z") public class ZclMeteringCluster extends ZclCluster { /** * The ZigBee Cluster Library Cluster ID @@ -2659,9 +2659,9 @@ protected Map initializeAttributes() { attributeMap.put(ATTR_DFTSUMMATION, new ZclAttribute(ZclClusterType.METERING, ATTR_DFTSUMMATION, "Dft Summation", ZclDataType.UNSIGNED_48_BIT_INTEGER, false, true, false, false)); attributeMap.put(ATTR_DAILYFREEZETIME, new ZclAttribute(ZclClusterType.METERING, ATTR_DAILYFREEZETIME, "Daily Freeze Time", ZclDataType.UNSIGNED_16_BIT_INTEGER, false, true, false, false)); attributeMap.put(ATTR_POWERFACTOR, new ZclAttribute(ZclClusterType.METERING, ATTR_POWERFACTOR, "Power Factor", ZclDataType.SIGNED_8_BIT_INTEGER, false, true, false, false)); - attributeMap.put(ATTR_READINGSNAPSHOTTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_READINGSNAPSHOTTIME, "Reading Snapshot Time", ZclDataType.UTCTIME, true, true, true, false)); - attributeMap.put(ATTR_CURRENTMAXDEMANDDELIVEREDTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_CURRENTMAXDEMANDDELIVEREDTIME, "Current Max Demand Delivered Time", ZclDataType.UTCTIME, true, true, true, false)); - attributeMap.put(ATTR_CURRENTMAXDEMANDRECEIVEDTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_CURRENTMAXDEMANDRECEIVEDTIME, "Current Max Demand Received Time", ZclDataType.UTCTIME, true, true, true, false)); + attributeMap.put(ATTR_READINGSNAPSHOTTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_READINGSNAPSHOTTIME, "Reading Snapshot Time", ZclDataType.UTCTIME, true, true, false, false)); + attributeMap.put(ATTR_CURRENTMAXDEMANDDELIVEREDTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_CURRENTMAXDEMANDDELIVEREDTIME, "Current Max Demand Delivered Time", ZclDataType.UTCTIME, true, true, false, false)); + attributeMap.put(ATTR_CURRENTMAXDEMANDRECEIVEDTIME, new ZclAttribute(ZclClusterType.METERING, ATTR_CURRENTMAXDEMANDRECEIVEDTIME, "Current Max Demand Received Time", ZclDataType.UTCTIME, true, true, false, false)); attributeMap.put(ATTR_DEFAULTUPDATEPERIOD, new ZclAttribute(ZclClusterType.METERING, ATTR_DEFAULTUPDATEPERIOD, "Default Update Period", ZclDataType.UNSIGNED_8_BIT_INTEGER, false, true, false, false)); attributeMap.put(ATTR_FASTPOLLUPDATEPERIOD, new ZclAttribute(ZclClusterType.METERING, ATTR_FASTPOLLUPDATEPERIOD, "Fast Poll Update Period", ZclDataType.UNSIGNED_8_BIT_INTEGER, false, true, false, false)); attributeMap.put(ATTR_CURRENTBLOCKPERIODCONSUMPTIONDELIVERED, new ZclAttribute(ZclClusterType.METERING, ATTR_CURRENTBLOCKPERIODCONSUMPTIONDELIVERED, "Current Block Period Consumption Delivered", ZclDataType.UNSIGNED_48_BIT_INTEGER, false, true, false, false)); @@ -4067,25 +4067,6 @@ public Integer getPowerFactor(final long refreshPeriod) { return (Integer) readSync(attributes.get(ATTR_POWERFACTOR)); } - /** - * Set the Reading Snapshot Time attribute [attribute ID 0x0007]. - *

- * The ReadingSnapshotTime attribute represents the last time all of the - * CurrentSummationDelivered, CurrentSummationReceived, - * CurrentMaxDemandDelivered, and CurrentMaxDemandReceived attributes that are - * supported by the device were updated. - *

- * The attribute is of type {@link Calendar}. - *

- * The implementation of this attribute by a device is MANDATORY - * - * @param readingSnapshotTime the {@link Calendar} attribute value to be set - * @return the {@link Future} command result future - */ - public Future setReadingSnapshotTime(final Calendar value) { - return write(attributes.get(ATTR_READINGSNAPSHOTTIME), value); - } - /** * Get the Reading Snapshot Time attribute [attribute ID 0x0007]. *

@@ -4155,23 +4136,6 @@ public Future setReadingSnapshotTimeReporting(final int minInterv return setReporting(attributes.get(ATTR_READINGSNAPSHOTTIME), minInterval, maxInterval, reportableChange); } - /** - * Set the Current Max Demand Delivered Time attribute [attribute ID 0x0008]. - *

- * The CurrentMaxDemandDeliveredTime attribute represents the time when - * CurrentMaxDemandDelivered reading was captured. - *

- * The attribute is of type {@link Calendar}. - *

- * The implementation of this attribute by a device is MANDATORY - * - * @param currentMaxDemandDeliveredTime the {@link Calendar} attribute value to be set - * @return the {@link Future} command result future - */ - public Future setCurrentMaxDemandDeliveredTime(final Calendar value) { - return write(attributes.get(ATTR_CURRENTMAXDEMANDDELIVEREDTIME), value); - } - /** * Get the Current Max Demand Delivered Time attribute [attribute ID 0x0008]. *

@@ -4235,23 +4199,6 @@ public Future setCurrentMaxDemandDeliveredTimeReporting(final int return setReporting(attributes.get(ATTR_CURRENTMAXDEMANDDELIVEREDTIME), minInterval, maxInterval, reportableChange); } - /** - * Set the Current Max Demand Received Time attribute [attribute ID 0x0009]. - *

- * The CurrentMaxDemandReceivedTime attribute represents the time when - * CurrentMaxDemandReceived reading was captured. - *

- * The attribute is of type {@link Calendar}. - *

- * The implementation of this attribute by a device is MANDATORY - * - * @param currentMaxDemandReceivedTime the {@link Calendar} attribute value to be set - * @return the {@link Future} command result future - */ - public Future setCurrentMaxDemandReceivedTime(final Calendar value) { - return write(attributes.get(ATTR_CURRENTMAXDEMANDRECEIVEDTIME), value); - } - /** * Get the Current Max Demand Received Time attribute [attribute ID 0x0009]. *

diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPriceCluster.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPriceCluster.java index b267c69bd..390871e3b 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPriceCluster.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/ZclPriceCluster.java @@ -72,7 +72,7 @@ *

* Code is auto-generated. Modifications may be overwritten! */ -@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-02-26T20:57:36Z") +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:30:33Z") public class ZclPriceCluster extends ZclCluster { /** * The ZigBee Cluster Library Cluster ID @@ -4324,7 +4324,7 @@ protected Map initializeAttributes() { attributeMap.put(ATTR_CREDITCARDPAYMENTREF4, new ZclAttribute(ZclClusterType.PRICE, ATTR_CREDITCARDPAYMENTREF4, "Credit Card Payment Ref 4", ZclDataType.OCTET_STRING, false, true, false, false)); attributeMap.put(ATTR_CREDITCARDPAYMENT5, new ZclAttribute(ZclClusterType.PRICE, ATTR_CREDITCARDPAYMENT5, "Credit Card Payment 5", ZclDataType.UNSIGNED_32_BIT_INTEGER, false, true, false, false)); attributeMap.put(ATTR_CREDITCARDPAYMENTDATE5, new ZclAttribute(ZclClusterType.PRICE, ATTR_CREDITCARDPAYMENTDATE5, "Credit Card Payment Date 5", ZclDataType.UTCTIME, false, true, false, false)); - attributeMap.put(ATTR_CREDITCARDPAYMENTREF5, new ZclAttribute(ZclClusterType.PRICE, ATTR_CREDITCARDPAYMENTREF5, "Credit Card Payment Ref 5", ZclDataType.OCTET_STRING, false, true, true, false)); + attributeMap.put(ATTR_CREDITCARDPAYMENTREF5, new ZclAttribute(ZclClusterType.PRICE, ATTR_CREDITCARDPAYMENTREF5, "Credit Card Payment Ref 5", ZclDataType.OCTET_STRING, false, true, false, false)); attributeMap.put(ATTR_RECEIVEDTIER1PRICELABEL, new ZclAttribute(ZclClusterType.PRICE, ATTR_RECEIVEDTIER1PRICELABEL, "Received Tier 1 Price Label", ZclDataType.OCTET_STRING, false, true, true, false)); attributeMap.put(ATTR_RECEIVEDTIER2PRICELABEL, new ZclAttribute(ZclClusterType.PRICE, ATTR_RECEIVEDTIER2PRICELABEL, "Received Tier 2 Price Label", ZclDataType.OCTET_STRING, false, true, true, false)); attributeMap.put(ATTR_RECEIVEDTIER3PRICELABEL, new ZclAttribute(ZclClusterType.PRICE, ATTR_RECEIVEDTIER3PRICELABEL, "Received Tier 3 Price Label", ZclDataType.OCTET_STRING, false, true, true, false)); @@ -9616,20 +9616,6 @@ public Calendar getCreditCardPaymentDate5(final long refreshPeriod) { return (Calendar) readSync(attributes.get(ATTR_CREDITCARDPAYMENTDATE5)); } - /** - * Set the Credit Card Payment Ref 5 attribute [attribute ID 0x0852]. - *

- * The attribute is of type {@link ByteArray}. - *

- * The implementation of this attribute by a device is OPTIONAL - * - * @param creditCardPaymentRef5 the {@link ByteArray} attribute value to be set - * @return the {@link Future} command result future - */ - public Future setCreditCardPaymentRef5(final ByteArray value) { - return write(attributes.get(ATTR_CREDITCARDPAYMENTREF5), value); - } - /** * Get the Credit Card Payment Ref 5 attribute [attribute ID 0x0852]. *

diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputReliabilityEnum.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputReliabilityEnum.java new file mode 100644 index 000000000..fbc45709c --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputReliabilityEnum.java @@ -0,0 +1,93 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters.analoginputbasic; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Generated; + +/** + * Reliability value enumeration. + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:49:59Z") +public enum AnalogInputReliabilityEnum { + + /** + * No - Fault - Detected + */ + NO_FAULT_DETECTED(0x0000), + + /** + * Over - Range + */ + OVER_RANGE(0x0002), + + /** + * Under - Range + */ + UNDER_RANGE(0x0003), + + /** + * Open - Loop + */ + OPEN_LOOP(0x0004), + + /** + * Shorted - Loop + */ + SHORTED_LOOP(0x0005), + + /** + * Unreliable - Other + */ + UNRELIABLE_OTHER(0x0007), + + /** + * Process - Error + */ + PROCESS_ERROR(0x0008), + + /** + * Multi - State - Fault + */ + MULTI_STATE_FAULT(0x0009), + + /** + * Configuration - Error + */ + CONFIGURATION_ERROR(0x000A); + + /** + * A mapping between the integer code and its corresponding AnalogInputReliabilityEnum type to facilitate lookup by value. + */ + private static Map idMap; + + static { + idMap = new HashMap(); + for (AnalogInputReliabilityEnum enumValue : values()) { + idMap.put(enumValue.key, enumValue); + } + } + + private final int key; + + private AnalogInputReliabilityEnum(final int key) { + this.key = key; + } + + public int getKey() { + return key; + } + + public static AnalogInputReliabilityEnum getByValue(final int value) { + return idMap.get(value); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputStatusFlagsBitmap.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputStatusFlagsBitmap.java new file mode 100644 index 000000000..2ef1a6039 --- /dev/null +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/clusters/analoginputbasic/AnalogInputStatusFlagsBitmap.java @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2016-2019 by the respective copyright holders. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + */ +package com.zsmartsystems.zigbee.zcl.clusters.analoginputbasic; + +import java.util.HashMap; +import java.util.Map; + +import javax.annotation.Generated; + +/** + * Status Flags value enumeration. + *

+ * Code is auto-generated. Modifications may be overwritten! + */ +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:49:59Z") +public enum AnalogInputStatusFlagsBitmap { + + /** + * In_Alarm + */ + IN_ALARM(0x0001), + + /** + * Fault + */ + FAULT(0x0002), + + /** + * Overridden + */ + OVERRIDDEN(0x0004), + + /** + * Out Of Service + */ + OUT_OF_SERVICE(0x0008); + + /** + * A mapping between the integer code and its corresponding AnalogInputStatusFlagsBitmap type to facilitate lookup by value. + */ + private static Map idMap; + + static { + idMap = new HashMap(); + for (AnalogInputStatusFlagsBitmap enumValue : values()) { + idMap.put(enumValue.key, enumValue); + } + } + + private final int key; + + private AnalogInputStatusFlagsBitmap(final int key) { + this.key = key; + } + + public int getKey() { + return key; + } + + public static AnalogInputStatusFlagsBitmap getByValue(final int value) { + return idMap.get(value); + } +} diff --git a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java index 359fa7b79..65e800004 100644 --- a/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java +++ b/com.zsmartsystems.zigbee/src/main/java/com/zsmartsystems/zigbee/zcl/protocol/ZclClusterType.java @@ -14,6 +14,7 @@ import com.zsmartsystems.zigbee.zcl.ZclCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclAlarmsCluster; +import com.zsmartsystems.zigbee.zcl.clusters.ZclAnalogInputBasicCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclBasicCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclBinaryInputBasicCluster; import com.zsmartsystems.zigbee.zcl.clusters.ZclColorControlCluster; @@ -65,7 +66,7 @@ * @author Chris Jackson */ -@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-02-09T19:25:17Z") +@Generated(value = "com.zsmartsystems.zigbee.autocode.ZigBeeCodeGenerator", date = "2019-04-13T12:30:33Z") public enum ZclClusterType { BASIC(0x0000, ZclBasicCluster.class, "Basic"), POWER_CONFIGURATION(0x0001, ZclPowerConfigurationCluster.class, "Power Configuration"), @@ -78,6 +79,7 @@ public enum ZclClusterType { ALARMS(0x0009, ZclAlarmsCluster.class, "Alarms"), TIME(0x000A, ZclTimeCluster.class, "Time"), RSSI_LOCATION(0x000B, ZclRssiLocationCluster.class, "RSSI Location"), + ANALOG_INPUT_BASIC(0x000C, ZclAnalogInputBasicCluster.class, "Analog Input (Basic)"), BINARY_INPUT_BASIC(0x000F, ZclBinaryInputBasicCluster.class, "Binary Input (Basic)"), MULTISTATE_INPUT_BASIC(0x0012, ZclMultistateInputBasicCluster.class, "Multistate Input (Basic)"), MULTISTATE_OUTPUT_BASIC(0x0013, ZclMultistateOutputBasicCluster.class, "Multistate Output (Basic)"),