Search in sources :

Example 1 with ConBeeTransaction

use of com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeTransaction in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeSingleResponseTransactionTest method testResponseMatches.

@Test
public void testResponseMatches() {
    ConBeeDeviceStateRequest request = new ConBeeDeviceStateRequest();
    ConBeeTransaction transaction = new ConBeeSingleResponseTransaction(request, ConBeeDeviceStateResponse.class);
    ConBeeDeviceStateResponse response = new ConBeeDeviceStateResponse(new int[] { 0x07, 0x00, 0x00, 0x08, 0x00, 0xA2, 0x00, 0x00, 0x4F, 0xFF });
    assertTrue(transaction.isMatch(response));
    transaction.getRequest();
    assertEquals(1, transaction.getResponses().size());
    assertNotNull(transaction.getResponses());
    assertEquals(transaction.getResponses().get(0), transaction.getResponse());
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ConBeeDeviceStateRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateRequest) ConBeeTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeTransaction) ConBeeDeviceStateResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateResponse) Test(org.junit.Test)

Example 2 with ConBeeTransaction

use of com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeTransaction in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeSingleResponseTransactionTest method testResponseMatchFails.

@Test
public void testResponseMatchFails() {
    ConBeeDeviceStateRequest request = new ConBeeDeviceStateRequest();
    ConBeeTransaction transaction = new ConBeeSingleResponseTransaction(request, ConBeeDeviceStateResponse.class);
    ConBeeEnqueueSendDataResponse response = new ConBeeEnqueueSendDataResponse(new int[] { 0x12, 0x0D, 0x00, 0x09, 0x00, 0x02, 0x00, 0x22, 0x00, 0xB4, 0xFF });
    assertFalse(transaction.isMatch(response));
    assertNull(transaction.getResponse());
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ConBeeDeviceStateRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateRequest) ConBeeTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeTransaction) ConBeeEnqueueSendDataResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeEnqueueSendDataResponse) Test(org.junit.Test)

Aggregations

ConBeeDeviceStateRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateRequest)2 ConBeeSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction)2 ConBeeTransaction (com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeTransaction)2 Test (org.junit.Test)2 ConBeeDeviceStateResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateResponse)1 ConBeeEnqueueSendDataResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeEnqueueSendDataResponse)1