Skip to content

Commit

Permalink
Add ZclAttributeDao
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Jackson <[email protected]>
  • Loading branch information
cdjackson committed Apr 21, 2019
1 parent 34760a8 commit d364c8e
Show file tree
Hide file tree
Showing 6 changed files with 434 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
target/
bin/
database/
*.iml
*.log
*.log.*
Expand Down Expand Up @@ -33,6 +32,9 @@ simple-network.xml
*.gbl
*.s37

com.zsmartsystems.zigbee.console.main/database/


# Gradle
.gradle
build/
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
/**
* 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.database;

import java.util.Calendar;

import com.zsmartsystems.zigbee.zcl.ZclAttribute;
import com.zsmartsystems.zigbee.zcl.protocol.ZclDataType;

/**
* This class provides a clean class to hold a data object for serialisation of a {@link ZclAttribute}
*
* @author Chris Jackson
*
*/
public class ZclAttributeDao {
/**
* The attribute identifier field is 16-bits in length and shall contain the
* identifier of the attribute that the reporting configuration details
* apply to.
*/
private int id;

/**
* Stores the name of this attribute;
*/
private String name;

/**
* Defines the ZigBee data type.
*/
private ZclDataType dataType;

/**
* Defines if this attribute is mandatory to be implemented
*/
private boolean mandatory;

/**
* Defines if the attribute is implemented by the device
*/
private boolean implemented;

/**
* True if this attribute is readable
*/
private boolean readable;

/**
* True if this attribute is writable
*/
private boolean writable;

/**
* True if this attribute is reportable
*/
private boolean reportable;

/**
* The minimum reporting interval field is 16-bits in length and shall
* contain the minimum interval, in seconds, between issuing reports for the
* attribute specified in the attribute identifier field. If the minimum
* reporting interval has not been configured, this field shall contain the
* value 0xffff.
*/
private int minimumReportingPeriod;

/**
* The maximum reporting interval field is 16-bits in length and shall
* contain the maximum interval, in seconds, between issuing reports for the
* attribute specified in the attribute identifier field. If the maximum
* reporting interval has not been configured, this field shall contain the
* value 0xffff.
*/
private int maximumReportingPeriod;

/**
* The reportable change field shall contain the minimum change to the
* attribute that will result in a report being issued. For attributes with
* 'analog' data type the field has the same data type as the attribute. If
* the reportable change has not been configured, this field shall contain
* the invalid value for the relevant data type
*/
private Object reportingChange;

/**
* The timeout period field is 16-bits in length and shall contain the
* maximum expected time, in seconds, between received reports for the
* attribute specified in the attribute identifier field. If the timeout
* period has not been configured, this field shall contain the value
* 0xffff.
*/
private int reportingTimeout;

/**
* Records the last time a report was received
*/
private Calendar lastReportTime;

/**
* Records the last value received
*/
private Object lastValue;

/**
* @return the id
*/
public int getId() {
return id;
}

/**
* @param id the id to set
*/
public void setId(int id) {
this.id = id;
}

/**
* @return the name
*/
public String getName() {
return name;
}

/**
* @param name the name to set
*/
public void setName(String name) {
this.name = name;
}

/**
* @return the dataType
*/
public ZclDataType getDataType() {
return dataType;
}

/**
* @param dataType the dataType to set
*/
public void setDataType(ZclDataType dataType) {
this.dataType = dataType;
}

/**
* @return the mandatory
*/
public boolean isMandatory() {
return mandatory;
}

/**
* @param mandatory the mandatory to set
*/
public void setMandatory(boolean mandatory) {
this.mandatory = mandatory;
}

/**
* @return the implemented
*/
public boolean isImplemented() {
return implemented;
}

/**
* @param implemented the implemented to set
*/
public void setImplemented(boolean implemented) {
this.implemented = implemented;
}

/**
* @return the readable
*/
public boolean isReadable() {
return readable;
}

/**
* @param readable the readable to set
*/
public void setReadable(boolean readable) {
this.readable = readable;
}

/**
* @return the writable flag
*/
public boolean isWritable() {
return writable;
}

/**
* @param writable the writable to set
*/
public void setWritable(boolean writable) {
this.writable = writable;
}

/**
* @return the reportable
*/
public boolean isReportable() {
return reportable;
}

/**
* @param reportable the reportable to set
*/
public void setReportable(boolean reportable) {
this.reportable = reportable;
}

/**
* @return the minimumReportingPeriod
*/
public int getMinimumReportingPeriod() {
return minimumReportingPeriod;
}

/**
* @param minimumReportingPeriod the minimumReportingPeriod to set
*/
public void setMinimumReportingPeriod(int minimumReportingPeriod) {
this.minimumReportingPeriod = minimumReportingPeriod;
}

/**
* @return the maximumReportingPeriod
*/
public int getMaximumReportingPeriod() {
return maximumReportingPeriod;
}

/**
* @param maximumReportingPeriod the maximumReportingPeriod to set
*/
public void setMaximumReportingPeriod(int maximumReportingPeriod) {
this.maximumReportingPeriod = maximumReportingPeriod;
}

/**
* @return the reportingChange
*/
public Object getReportingChange() {
return reportingChange;
}

/**
* @param reportingChange the reportingChange to set
*/
public void setReportingChange(Object reportingChange) {
this.reportingChange = reportingChange;
}

/**
* @return the reportingTimeout
*/
public int getReportingTimeout() {
return reportingTimeout;
}

/**
* @param reportingTimeout the reportingTimeout to set
*/
public void setReportingTimeout(int reportingTimeout) {
this.reportingTimeout = reportingTimeout;
}

/**
* @return the lastReportTime
*/
public Calendar getLastReportTime() {
return lastReportTime;
}

/**
* @param lastReportTime the lastReportTime to set
*/
public void setLastReportTime(Calendar lastReportTime) {
this.lastReportTime = lastReportTime;
}

/**
* @return the lastValue
*/
public Object getLastValue() {
return lastValue;
}

/**
* @param lastValue the lastValue to set
*/
public void setLastValue(Object lastValue) {
this.lastValue = lastValue;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.Set;

import com.zsmartsystems.zigbee.ZigBeeEndpoint;
import com.zsmartsystems.zigbee.zcl.ZclAttribute;

/**
* This class provides a clean class to hold a data object for serialisation of a {@link ZigBeeEndpoint}
Expand All @@ -27,7 +26,7 @@ public class ZclClusterDao {

private boolean isClient;

private Map<Integer, ZclAttribute> attributes;
private Map<Integer, ZclAttributeDao> attributes;

private Set<Integer> supportedCommandsReceived;

Expand All @@ -43,8 +42,8 @@ public void setLabel(String label) {
this.label = label;
}

public void setAttributes(Map<Integer, ZclAttribute> attributes) {
this.attributes = new HashMap<Integer, ZclAttribute>(attributes);
public void setAttributes(Map<Integer, ZclAttributeDao> attributes) {
this.attributes = new HashMap<>(attributes);
}

public void setSupportedCommandsReceived(Set<Integer> supportedCommandsReceived) {
Expand Down Expand Up @@ -85,7 +84,7 @@ public Set<Integer> getSupportedAttributes() {
return supportedAttributes;
}

public Map<Integer, ZclAttribute> getAttributes() {
public Map<Integer, ZclAttributeDao> getAttributes() {
return attributes;
}

Expand Down
Loading

0 comments on commit d364c8e

Please sign in to comment.