From c9a313e9f5ab97834345d3b0ce93a8d423ae01bc Mon Sep 17 00:00:00 2001 From: ivangrimaldi Date: Fri, 7 Nov 2014 16:18:19 +0100 Subject: [PATCH] Updated ApplianceControlCluster: added Fridge parameters --- ...PowerAndControlClusterProxySimpleTest.java | 42 +++++++ .../zigbee/eh/ApplianceControlServer.java | 18 +++ .../cluster/eh/ZclApplianceControlServer.java | 112 ++++++++++++++++++ 3 files changed, 172 insertions(+) diff --git a/jemma.osgi.ah.energyathome/src/main/java/org/energy_home/jemma/internal/ah/eh/esp/PowerAndControlClusterProxySimpleTest.java b/jemma.osgi.ah.energyathome/src/main/java/org/energy_home/jemma/internal/ah/eh/esp/PowerAndControlClusterProxySimpleTest.java index 89f8c4d7..c39d92e7 100644 --- a/jemma.osgi.ah.energyathome/src/main/java/org/energy_home/jemma/internal/ah/eh/esp/PowerAndControlClusterProxySimpleTest.java +++ b/jemma.osgi.ah.energyathome/src/main/java/org/energy_home/jemma/internal/ah/eh/esp/PowerAndControlClusterProxySimpleTest.java @@ -255,6 +255,48 @@ public int getTemperatureTarget1(IEndPointRequestContext context) public short getSpin(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { // TODO Auto-generated method stub return 0; + } + + @Override + public boolean getEcoMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getNormalMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getHolidayMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getIceParty(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getSuperCoolMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean getSuperFreezeMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + // TODO Auto-generated method stub + return false; } }; } diff --git a/jemma.osgi.ah.hac.lib/src/main/java/org/energy_home/jemma/ah/cluster/zigbee/eh/ApplianceControlServer.java b/jemma.osgi.ah.hac.lib/src/main/java/org/energy_home/jemma/ah/cluster/zigbee/eh/ApplianceControlServer.java index 2f21dabf..9f3f59b3 100644 --- a/jemma.osgi.ah.hac.lib/src/main/java/org/energy_home/jemma/ah/cluster/zigbee/eh/ApplianceControlServer.java +++ b/jemma.osgi.ah.hac.lib/src/main/java/org/energy_home/jemma/ah/cluster/zigbee/eh/ApplianceControlServer.java @@ -30,6 +30,13 @@ public interface ApplianceControlServer { final static String ATTR_TemperatureTarget0_NAME = "TemperatureTarget0"; final static String ATTR_TemperatureTarget1_NAME = "TemperatureTarget1"; final static String ATTR_Spin_NAME = "Spin"; + final static String ATTR_SuperCoolMode_NAME = "SuperCoolMode"; + final static String ATTR_SuperFreezeMode_NAME = "SuperFreezeMode"; + final static String ATTR_NormalMode_NAME = "NormalMode"; + final static String ATTR_EcoMode_NAME="EcoMode"; + final static String ATTR_HolidayMode_NAME = "HolidayMode"; + final static String ATTR_IceParty_NAME = "IceParty"; + final static String CMD_CommandExecution_NAME = "CommandExecution"; final static String CMD_SignalState_NAME = "SignalState"; final static String CMD_WriteFunctions_NAME = "WriteFunctions"; @@ -72,4 +79,15 @@ public void execOverloadWarning(short WarningEvent, IEndPointRequestContext cont public short getSpin(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + public boolean getEcoMode(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + + public boolean getNormalMode(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + + public boolean getHolidayMode(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + + public boolean getIceParty(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + + public boolean getSuperCoolMode(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; + + public boolean getSuperFreezeMode(IEndPointRequestContext context) throws ApplianceException,ServiceClusterException; } diff --git a/jemma.osgi.ah.zigbee/src/main/java/org/energy_home/jemma/ah/zigbee/zcl/cluster/eh/ZclApplianceControlServer.java b/jemma.osgi.ah.zigbee/src/main/java/org/energy_home/jemma/ah/zigbee/zcl/cluster/eh/ZclApplianceControlServer.java index e3d24a92..54fd09b9 100644 --- a/jemma.osgi.ah.zigbee/src/main/java/org/energy_home/jemma/ah/zigbee/zcl/cluster/eh/ZclApplianceControlServer.java +++ b/jemma.osgi.ah.zigbee/src/main/java/org/energy_home/jemma/ah/zigbee/zcl/cluster/eh/ZclApplianceControlServer.java @@ -36,6 +36,7 @@ import org.energy_home.jemma.ah.zigbee.zcl.ZclValidationException; import org.energy_home.jemma.ah.zigbee.zcl.lib.ZclServiceCluster; import org.energy_home.jemma.ah.zigbee.zcl.lib.types.ZclAbstractDataType; +import org.energy_home.jemma.ah.zigbee.zcl.lib.types.ZclDataTypeBoolean; import org.energy_home.jemma.ah.zigbee.zcl.lib.types.ZclDataTypeEnum8; import org.energy_home.jemma.ah.zigbee.zcl.lib.types.ZclDataTypeI16; import org.energy_home.jemma.ah.zigbee.zcl.lib.types.ZclDataTypeUI16; @@ -65,6 +66,19 @@ public class ZclApplianceControlServer extends ZclServiceCluster implements Appl ATTR_TemperatureTarget1_NAME, new ZclDataTypeI16(), null, true, 1)); attributesMapByName.put(ATTR_Spin_NAME, new ZclAttributeDescriptor(10, //spin attribute id: 0x000a ATTR_Spin_NAME, new ZclDataTypeI16(), null, true, 1)); + attributesMapByName.put(ATTR_SuperCoolMode_NAME, new ZclAttributeDescriptor(11, //SuperCoolMode attribute id: 0x000b + ATTR_SuperCoolMode_NAME, new ZclDataTypeBoolean(), null, true, 1)); + attributesMapByName.put(ATTR_SuperFreezeMode_NAME, new ZclAttributeDescriptor(12, //SuperFreezeMode attribute id: 0x000c + ATTR_SuperFreezeMode_NAME, new ZclDataTypeBoolean(), null, true, 1)); + attributesMapByName.put(ATTR_NormalMode_NAME, new ZclAttributeDescriptor(13, //NormalMode attribute id: 0x000d + ATTR_NormalMode_NAME, new ZclDataTypeBoolean(), null, true, 1)); + attributesMapByName.put(ATTR_EcoMode_NAME, new ZclAttributeDescriptor(14, //EcoMode attribute id: 0x000e + ATTR_EcoMode_NAME, new ZclDataTypeBoolean(), null, true, 1)); + attributesMapByName.put(ATTR_HolidayMode_NAME, new ZclAttributeDescriptor(15, //EcoMode attribute id: 0x000f + ATTR_HolidayMode_NAME, new ZclDataTypeBoolean(), null, true, 1)); + attributesMapByName.put(ATTR_IceParty_NAME, new ZclAttributeDescriptor(20, //IceParty attribute id: 0x0014 + ATTR_IceParty_NAME, new ZclDataTypeBoolean(), null, true, 1)); + } public ZclApplianceControlServer() throws ApplianceException { @@ -308,4 +322,102 @@ public short getSpin(IEndPointRequestContext context) throws ApplianceException, return v.shortValue(); } + @Override + public boolean getEcoMode(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(14 //EcoMode attribute ID: 0x000e + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(14, context);//EcoMode attribute ID: 0x000e + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(14, v); + return v; + } + + @Override + public boolean getNormalMode(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(13 //NormalMode attribute ID: 0x000d + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(13, context);//NormalMode attribute ID: 0x000d + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(13, v); + return v; + } + + @Override + public boolean getHolidayMode(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(15 //HolidayMode attribute ID: 0x000f + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(15, context);//HolidayMode attribute ID: 0x000f + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(15, v); + return v; + } + + @Override + public boolean getIceParty(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(20 //IceParty attribute ID: 0x0014 + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(20, context);//IceParty attribute ID: 0x0014 + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(20, v); + return v; + } + + @Override + public boolean getSuperCoolMode(IEndPointRequestContext context) throws ApplianceException, ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(11 //SuperCool attribute ID: 0x000b + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(11, context); //SuperCool attribute ID: 0x000b + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(11, v); + return v; + } + + @Override + public boolean getSuperFreezeMode(IEndPointRequestContext context) throws ApplianceException, + ServiceClusterException { + if (context != null) { + Boolean objectResult = null; + objectResult = ((Boolean) getValidCachedAttributeObject(12 //SuperFreeze attribute ID: 0x000c + , context.getMaxAgeForAttributeValues())); + if (objectResult != null) { + return objectResult; + } + } + IZclFrame zclFrame = readAttribute(12, context); //SuperFreeze attribute ID: 0x000c + Boolean v = ZclDataTypeBoolean.zclParse(zclFrame); + setCachedAttributeObject(12,v); + return v; + + } + }