Search in sources :

Example 1 with ExtensionFieldSet

use of com.zsmartsystems.zigbee.zcl.field.ExtensionFieldSet in project com.zsmartsystems.zigbee by zsmartsystems.

the class AddScenesCommandTest method testAddSceneCommand.

@Test
public void testAddSceneCommand() throws Exception {
    int[] packet = getPacketData("01 00 02 03 00 0A 54 65 73 74 20 53 63 65 6E 65 04 00 05 06");
    AddSceneCommand request = new AddSceneCommand();
    request.setGroupId(1);
    request.setSceneId(2);
    request.setSceneName("Test Scene");
    request.setTransitionTime(3);
    final List<ExtensionFieldSet> list = new ArrayList<ExtensionFieldSet>();
    final ExtensionFieldSet data = new ExtensionFieldSet();
    data.setClusterId(4);
    data.setData(new int[] { 5, 6 });
    list.add(data);
    request.setExtensionFieldSets(list);
    System.out.println(request);
    DefaultSerializer serializer = new DefaultSerializer();
    ZclFieldSerializer fieldSerializer = new ZclFieldSerializer(serializer);
    request.serialize(fieldSerializer);
    assertTrue(Arrays.equals(packet, serializer.getPayload()));
}
Also used : ExtensionFieldSet(com.zsmartsystems.zigbee.zcl.field.ExtensionFieldSet) DefaultSerializer(com.zsmartsystems.zigbee.serialization.DefaultSerializer) ArrayList(java.util.ArrayList) ZclFieldSerializer(com.zsmartsystems.zigbee.zcl.ZclFieldSerializer) CommandTest(com.zsmartsystems.zigbee.CommandTest) Test(org.junit.Test)

Aggregations

CommandTest (com.zsmartsystems.zigbee.CommandTest)1 DefaultSerializer (com.zsmartsystems.zigbee.serialization.DefaultSerializer)1 ZclFieldSerializer (com.zsmartsystems.zigbee.zcl.ZclFieldSerializer)1 ExtensionFieldSet (com.zsmartsystems.zigbee.zcl.field.ExtensionFieldSet)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1