Search in sources :

Example 1 with ConBeeReadParameterResponse

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeReadParameterResponseTest method readNwkAddress.

@Test
public void readNwkAddress() {
    ConBeeReadParameterResponse readParameter = new ConBeeReadParameterResponse(new int[] { 0x0A, 0x06, 0x00, 0x0A, 0x00, 0x03, 0x00, 0x07, 0x00, 0x00, 0xDC, 0xFF });
    System.out.println(readParameter);
    assertEquals(6, readParameter.getSequence());
    assertEquals(ConBeeStatus.SUCCESS, readParameter.getStatus());
    assertEquals(ConBeeNetworkParameter.NWK_ADDRESS, readParameter.getParameter());
    assertEquals(Integer.valueOf(0), readParameter.getValue());
}
Also used : ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) Test(org.junit.Test)

Example 2 with ConBeeReadParameterResponse

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeReadParameterResponseTest method readNwkExtendedPanId.

@Test
public void readNwkExtendedPanId() {
    ConBeeReadParameterResponse readParameter = new ConBeeReadParameterResponse(new int[] { 0x0A, 0x07, 0x00, 0x10, 0x00, 0x09, 0x00, 0x08, 0x8C, 0x0A, 0x01, 0xFF, 0xFF, 0x2E, 0x21, 0x00, 0xEA, 0xFC });
    System.out.println(readParameter);
    assertEquals(7, readParameter.getSequence());
    assertEquals(ConBeeStatus.SUCCESS, readParameter.getStatus());
    assertEquals(ConBeeNetworkParameter.NWK_EXTENDED_PANID, readParameter.getParameter());
    assertEquals(new ExtendedPanId("00212EFFFF010A8C"), readParameter.getValue());
}
Also used : ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) Test(org.junit.Test)

Example 3 with ConBeeReadParameterResponse

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZigBeeDongleConBee method initialize.

@Override
public ZigBeeInitializeResponse initialize() {
    logger.debug("ConBee transport initialize");
    zigbeeNetworkReceive.setNetworkState(ZigBeeTransportState.UNINITIALISED);
    if (!serialPort.open()) {
        logger.error("Unable to open ConBee serial port");
        return ZigBeeInitializeResponse.FAILED;
    }
    conbeeHandler = new ConBeeFrameHandler(serialPort, this);
    ConBeeVersionRequest versionRequest = new ConBeeVersionRequest();
    ConBeeVersionResponse versionResponse = (ConBeeVersionResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(versionRequest, ConBeeVersionResponse.class)).getResponse();
    firmwareVersion = String.format("%08X", versionResponse.getVersion());
    ConBeeReadParameterRequest readParameter;
    ConBeeReadParameterResponse readResponse;
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.DEVICE_TYPE);
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class));
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.MAC_ADDRESS);
    readResponse = (ConBeeReadParameterResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class)).getResponse();
    ieeeAddress = (IeeeAddress) readResponse.getValue();
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.NWK_PANID);
    readResponse = (ConBeeReadParameterResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class)).getResponse();
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.APS_EXTENDED_PANID);
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class));
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.NWK_ADDRESS);
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class));
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.NWK_EXTENDED_PANID);
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class));
    readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.CURRENT_CHANNEL);
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class));
    ConBeeDeviceStateRequest stateRequest = new ConBeeDeviceStateRequest();
    conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(stateRequest, ConBeeDeviceStateResponse.class));
    initialisationComplete = true;
    return ZigBeeInitializeResponse.JOINED;
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ConBeeDeviceStateRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateRequest) ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) ConBeeVersionRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionRequest) ConBeeVersionResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionResponse) ConBeeReadParameterRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest) ConBeeDeviceStateResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateResponse) ConBeeFrameHandler(com.zsmartsystems.zigbee.dongle.conbee.internal.ConBeeFrameHandler)

Example 4 with ConBeeReadParameterResponse

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeReadParameterResponseTest method readMacAddress.

@Test
public void readMacAddress() {
    ConBeeReadParameterResponse readParameter = new ConBeeReadParameterResponse(new int[] { 0x0A, 0x02, 0x00, 0x10, 0x00, 0x09, 0x00, 0x01, 0x8C, 0x0A, 0x01, 0xFF, 0xFF, 0x2E, 0x21, 0x00, 0xF6, 0xFC });
    System.out.println(readParameter);
    assertEquals(2, readParameter.getSequence());
    assertEquals(ConBeeStatus.SUCCESS, readParameter.getStatus());
    assertEquals(ConBeeNetworkParameter.MAC_ADDRESS, readParameter.getParameter());
    assertEquals(new IeeeAddress("00212EFFFF010A8C"), readParameter.getValue());
}
Also used : ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) IeeeAddress(com.zsmartsystems.zigbee.IeeeAddress) Test(org.junit.Test)

Example 5 with ConBeeReadParameterResponse

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse in project com.zsmartsystems.zigbee by zsmartsystems.

the class ConBeeReadParameterResponseTest method readCurrentChannel.

@Test
public void readCurrentChannel() {
    ConBeeReadParameterResponse readParameter = new ConBeeReadParameterResponse(new int[] { 0x0A, 0x08, 0x00, 0x09, 0x00, 0x02, 0x00, 0x1C, 0x19, 0xAE, 0xFF });
    System.out.println(readParameter);
    assertEquals(8, readParameter.getSequence());
    assertEquals(ConBeeStatus.SUCCESS, readParameter.getStatus());
    assertEquals(ConBeeNetworkParameter.CURRENT_CHANNEL, readParameter.getParameter());
    assertEquals(new Integer(25), readParameter.getValue());
}
Also used : ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) Test(org.junit.Test)

Aggregations

ConBeeReadParameterResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse)10 Test (org.junit.Test)6 ConBeeReadParameterRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest)4 ConBeeSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction)4 ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)3 IeeeAddress (com.zsmartsystems.zigbee.IeeeAddress)1 ConBeeFrameHandler (com.zsmartsystems.zigbee.dongle.conbee.internal.ConBeeFrameHandler)1 ConBeeDeviceStateRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateRequest)1 ConBeeDeviceStateResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeDeviceStateResponse)1 ConBeeVersionRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionRequest)1 ConBeeVersionResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionResponse)1