[zb4osgi-changeset] [scm] ZigBee 4 OSGi repository change: r531 - in /projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library: api/general/Scenes.java impl/general/ScenesCluster.java impl/general/scenes/RemoveAllScenesCommand.java
scm-notify at zb4osgi.aaloa.org
scm-notify at zb4osgi.aaloa.org
Fri Oct 19 17:07:45 CEST 2012
Author: stefano.lenzi
Date: Fri Oct 19 17:07:45 2012
New Revision: 531
Log:
Added missing groupId parameter to RemoveAllScenes command of the Scenes cluster ( fixes #135 )
Added:
projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/scenes/RemoveAllScenesCommand.java
Modified:
projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/general/Scenes.java
projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/ScenesCluster.java
Modified: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/general/Scenes.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/general/Scenes.java (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/api/general/Scenes.java Fri Oct 19 17:07:45 2012
@@ -34,7 +34,7 @@
*
* @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
* @author <a href="mailto:francesco.furfari at isti.cnr.it">Francesco Furfari</a>
- * @author <a href="mailto:alessandro.giari at isti.cnr.it">Alessandro Giari</a> *
+ * @author <a href="mailto:alessandro.giari at isti.cnr.it">Alessandro Giari</a>
* @version $LastChangedRevision$ ($LastChangedDate$)
* @since 0.1.0
*
@@ -63,7 +63,7 @@
public Response addScene(AddScenePayload scenepayload) throws ZigBeeClusterException; //TODO Create proper class
public Response viewScene(int groupId, short sceneId) throws ZigBeeClusterException;
public Response removeScene(int groupId, short sceneId) throws ZigBeeClusterException;
- public Response removeAllScenes() throws ZigBeeClusterException;
+ public Response removeAllScenes(int groupId) throws ZigBeeClusterException;
public Response storeScene(int groupId, short sceneId) throws ZigBeeClusterException;
public void recallScene(int groupId, short sceneId) throws ZigBeeClusterException;
public Response getSceneMembership(int groupId) throws ZigBeeClusterException;
Modified: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/ScenesCluster.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/ScenesCluster.java (original)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/ScenesCluster.java Fri Oct 19 17:07:45 2012
@@ -41,6 +41,7 @@
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.GetSceneMembershipCommand;
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.GetSceneMembershipResponseImpl;
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.RecallSceneCommand;
+import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.RemoveAllScenesCommand;
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.RemoveAllScenesResponseImpl;
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.RemoveSceneCommand;
import it.cnr.isti.zigbee.zcl.library.impl.general.scenes.RemoveSceneResponseImpl;
@@ -67,13 +68,7 @@
private final AttributeImpl lastConfiguredBy;
private final Attribute[] attributes;
-
- private static EmptyPayloadCommand CMD_REMOVE_ALL_SCENES = new EmptyPayloadCommand()
- .setId(Scenes.REMOVE_ALL_SCENES)
- .setClientServerDirection(true)
- .setClusterSpecific(true)
- .setManufacturerExtension(false);
-
+
public ScenesCluster(ZigBeeDevice zbDevice){
super(zbDevice);
sceneCount = new AttributeImpl(zbDevice,this,Attributes.SCENE_COUNT);
@@ -143,8 +138,9 @@
invoke(recallSceneCmd);
}
- public Response removeAllScenes() throws ZigBeeClusterException{
- Response response = invoke(CMD_REMOVE_ALL_SCENES);
+ public Response removeAllScenes(int groupId) throws ZigBeeClusterException{
+ RemoveAllScenesCommand removeAllScenes = new RemoveAllScenesCommand(groupId);
+ Response response = invoke(removeAllScenes);
return new RemoveAllScenesResponseImpl(response);
}
Added: projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/scenes/RemoveAllScenesCommand.java
==============================================================================
--- projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/scenes/RemoveAllScenesCommand.java (added)
+++ projects/zb4osgi/trunk/zigbee.zcl.library/src/main/java/it/cnr/isti/zigbee/zcl/library/impl/general/scenes/RemoveAllScenesCommand.java Fri Oct 19 17:07:45 2012
@@ -1,0 +1,53 @@
+/*
+ Copyright 2008-2010 CNR-ISTI, http://isti.cnr.it
+ Institute of Information Science and Technologies
+ of the Italian National Research Council
+
+
+ See the NOTICE file distributed with this work for additional
+ information regarding copyright ownership
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+package it.cnr.isti.zigbee.zcl.library.impl.general.scenes;
+
+import it.cnr.isti.zigbee.zcl.library.api.core.ZBSerializer;
+import it.cnr.isti.zigbee.zcl.library.api.general.Scenes;
+import it.cnr.isti.zigbee.zcl.library.impl.core.AbstractCommand;
+import it.cnr.isti.zigbee.zcl.library.impl.core.ByteArrayOutputStreamSerializer;
+/**
+ *
+ * @author <a href="mailto:stefano.lenzi at isti.cnr.it">Stefano "Kismet" Lenzi</a>
+ * @version $LastChangedRevision$ ($LastChangedDate$)
+ * @since 0.7.1
+ *
+ */
+public class RemoveAllScenesCommand extends AbstractCommand {
+
+ private int groupId;
+
+ public RemoveAllScenesCommand(int groupId){
+ super(Scenes.REMOVE_ALL_SCENES);
+ }
+
+ public byte[] getPayload(){
+ if( payload == null){
+ payload = new byte[3];
+ ZBSerializer serializer = new ByteArrayOutputStreamSerializer();
+ serializer.append_short((short)groupId);
+ payload = serializer.getPayload();
+ }
+ return payload;
+ }
+}
More information about the Commit
mailing list