Created
October 2, 2013 17:00
-
-
Save nsantorello/6796885 to your computer and use it in GitHub Desktop.
How to test new COMMAND_CLASS_FIRMWARE_UPDATE_MD XML.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Insert this properly into the command classes section of the XML file --> | |
<cmd_class key="0x7A" version="3" name="COMMAND_CLASS_FIRMWARE_UPDATE_MD" help="Command Class Firmware Update Md" read_only="False" comment=""> | |
<cmd key="0x01" name="FIRMWARE_MD_GET" help="Firmware Md Get" comment="" /> | |
<cmd key="0x02" name="FIRMWARE_MD_REPORT" help="Firmware Md Report" comment=""> | |
<param key="0x00" name="Manufacturer ID" type="WORD" typehashcode="0x02" comment=""> | |
<word key="0x00" hasdefines="False" showhex="True" /> | |
</param> | |
<param key="0x01" name="Zwave Firmware ID" type="WORD" typehashcode="0x02" comment=""> | |
<word key="0x00" hasdefines="False" showhex="True" /> | |
</param> | |
<param key="0x02" name="Checksum" type="WORD" typehashcode="0x02" comment=""> | |
<word key="0x00" hasdefines="False" showhex="True" /> | |
</param> | |
<param key="0x03" name="Upgradable" type="CONST" typehashcode="0x0B" comment=""> | |
<const key="0x00" flagname="false" flagmask="0x00" /> | |
<const key="0x01" flagname="true" flagmask="0xFF" /> | |
</param> | |
<param key="0x04" name="Number of Firmware Targets" type="BYTE" typehashcode="0x01" comment=""> | |
<valueattrib key="0x00" hasdefines="False" showhex="True" /> | |
</param> | |
<param key="0x05" name="Max Fragment Size" type="WORD" typehashcode="0x02" comment=""> | |
<word key="0x00" hasdefines="False" showhex="True" /> | |
</param> | |
<param key="0x06" name="Variant Values" type="VARIANT" typehashcode="0x0C" comment=""> | |
<variant paramoffs="0xFF" showhex="True" signed="True" sizemask="0xFF" sizeoffs="0" /> | |
</param> | |
</cmd> | |
</cmd_class> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add this to FrameParsingTests.java | |
@Test | |
public void testPeterAddition() { | |
CommandData data; | |
VariantComponentData comp; | |
ArrayList<Byte> byteQueue = new ArrayList<Byte>(); | |
byteQueue.addAll(Arrays.asList(new Byte[] { 0x01, 0x14, 0x00, 0x04, 0x00, 0x02, 0x0E, (byte)0x7A, 0x02, 0x01, 0x13, (byte)0x03, (byte)0x43, 0x00, 0x00, (byte)0xFF, 0x01, 0x00, 0x2C, 0x01, 0x00, 0x1A })); | |
ReceivedFrame frame = Frame.parseFrame(byteQueue); | |
data = CommandClass.parseFrameData(8, frame.getData().get("pCmd")); | |
byte[] bytes; | |
bytes = WordComponentData.getComponentFrom(data.getData().get("Manufacturer ID")).getBytes(); | |
System.out.println("Manufacturer ID:" + ((int)bytes[0] * 256 + (int)bytes[1])); | |
bytes = WordComponentData.getComponentFrom(data.getData().get("Zwave Firmware ID")).getBytes(); | |
System.out.println("Zwave Firmware ID:" + ((int)bytes[0] * 256 + (int)bytes[1])); | |
bytes = WordComponentData.getComponentFrom(data.getData().get("Checksum")).getBytes(); | |
System.out.println("Checksum:" + ((int)bytes[0] * 256 + (int)bytes[1])); | |
System.out.println("Upgradable:" + ConstComponentData.getComponentFrom(data.getData().get("Upgradable")).getFlagname()); | |
System.out.println("Number of Firmware Targets:" + (int)ValueComponentData.getComponentFrom(data.getData().get("Number of Firmware Targets")).getValue()); | |
bytes = WordComponentData.getComponentFrom(data.getData().get("Max Fragment Size")).getBytes(); | |
System.out.println("Max Fragment Size:" + ((int)bytes[0] * 256 + (int)bytes[1])); | |
bytes = VariantComponentData.getComponentFrom(data.getData().get("Variant Values")).getBytes(); | |
System.out.println("Variant Values:" + Arrays.toString(bytes)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. ZWOS cannot currently handle multiple command class versions. Thus, it always uses the most recent version of the command class. | |
2. ZWOS does not actually have support for variant_group tags (!). Thus, we're using a variant that fills the remainder of the data array with its contents. This will work for this specific command because the variable length components are all at the end of the data array. If you ever NEED support for variant_group tags, this will be something we'll have to implement. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment