use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspSingleResponseTransactionTest method testResponseMatches.
@Test
public void testResponseMatches() {
EzspVersionRequest version = new EzspVersionRequest();
version.setSequenceNumber(3);
version.setDesiredProtocolVersion(4);
EzspTransaction versionTransaction = new EzspSingleResponseTransaction(version, EzspVersionResponse.class);
EzspVersionResponse versionResponse = new EzspVersionResponse(getPacketData("03 80 00 04 02 00 58"));
assertTrue(versionTransaction.isMatch(versionResponse));
versionTransaction.getRequest();
assertEquals(1, versionTransaction.getResponses().size());
assertNotNull(versionTransaction.getResponses());
assertEquals(versionTransaction.getResponses().get(0), versionTransaction.getResponse());
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspSingleResponseTransactionTest method testResponseMatchFails.
@Test
public void testResponseMatchFails() {
EzspVersionRequest version = new EzspVersionRequest();
version.setSequenceNumber(4);
version.setDesiredProtocolVersion(4);
EzspTransaction versionTransaction = new EzspSingleResponseTransaction(version, EzspVersionResponse.class);
EzspVersionResponse versionResponse = new EzspVersionResponse(getPacketData("03 80 00 04 02 00 58"));
assertFalse(versionTransaction.isMatch(versionResponse));
assertNull(versionTransaction.getResponse());
assertNull(versionTransaction.getResponses());
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class AshFrameHandlerTest method testAshFrameData.
@Test
public void testAshFrameData() {
AshFrameData frame;
EzspVersionRequest request = new EzspVersionRequest();
request.setSequenceNumber(1);
request.setDesiredProtocolVersion(4);
frame = new AshFrameData(request);
System.out.println(frame);
assertTrue(Arrays.equals(new int[] { 0, 67, 33, 168, 80, 155, 152, 126 }, frame.getOutputBuffer()));
request = new EzspVersionRequest();
request.setSequenceNumber(2);
request.setDesiredProtocolVersion(4);
frame = new AshFrameData(request);
frame.setAckNum(3);
frame.setFrmNum(4);
System.out.println(frame);
assertTrue(Arrays.equals(new int[] { 67, 64, 33, 168, 80, 255, 254, 126 }, frame.getOutputBuffer()));
request = new EzspVersionRequest();
request.setSequenceNumber(3);
request.setDesiredProtocolVersion(4);
frame = new AshFrameData(request);
frame.setAckNum(6);
frame.setFrmNum(2);
frame.setReTx();
System.out.println(frame);
assertTrue(Arrays.equals(new int[] { 46, 65, 33, 168, 80, 177, 236, 126 }, frame.getOutputBuffer()));
AshFrame inFrame = AshFrame.createFromInput(new int[] { 46, 65, 33, 168, 80, 177, 236 });
assertTrue(inFrame instanceof AshFrameData);
assertEquals(6, inFrame.getAckNum());
assertEquals(2, inFrame.getFrmNum());
assertEquals(FrameType.DATA, inFrame.getFrameType());
}
use of com.zsmartsystems.zigbee.dongle.ember.internal.ezsp.command.EzspVersionRequest in project com.zsmartsystems.zigbee by zsmartsystems.
the class EmberNcp method getVersion.
/**
* The command allows the Host to specify the desired EZSP version and must be sent before any other command. The
* response provides information about the firmware running on the NCP.
*
* @param desiredVersion the requested version we support
* @return the {@link EzspVersionResponse}
*/
public EzspVersionResponse getVersion(int desiredVersion) {
EzspVersionRequest request = new EzspVersionRequest();
request.setDesiredProtocolVersion(EzspFrame.getEzspVersion());
EzspTransaction transaction = ashHandler.sendEzspTransaction(new EzspSingleResponseTransaction(request, EzspVersionResponse.class));
EzspVersionResponse response = (EzspVersionResponse) transaction.getResponse();
logger.debug(response.toString());
lastStatus = null;
return response;
}
Aggregations