Search in sources :

Example 1 with ConBeeReadParameterRequest

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

the class ConBeeReadParameterRequestTest method test.

@Test
public void test() {
    ConBeeReadParameterRequest request = new ConBeeReadParameterRequest();
    request.setParameter(ConBeeNetworkParameter.MAC_ADDRESS);
    request.setSequence(0x15);
    System.out.println(request);
    assertTrue(Arrays.equals(new int[] { 0x0A, 0x15, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0xD7, 0xff }, request.getOutputBuffer()));
}
Also used : ConBeeReadParameterRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest) Test(org.junit.Test)

Example 2 with ConBeeReadParameterRequest

use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest 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 3 with ConBeeReadParameterRequest

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

the class ZigBeeDongleConBee method getZigBeePanId.

@Override
public int getZigBeePanId() {
    ConBeeReadParameterRequest readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.NWK_PANID);
    ConBeeReadParameterResponse response = (ConBeeReadParameterResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class)).getResponse();
    return (int) response.getValue();
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) ConBeeReadParameterRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest)

Example 4 with ConBeeReadParameterRequest

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

the class ZigBeeDongleConBee method getZigBeeChannel.

@Override
public int getZigBeeChannel() {
    ConBeeReadParameterRequest readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.CURRENT_CHANNEL);
    ConBeeReadParameterResponse response = (ConBeeReadParameterResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class)).getResponse();
    return (int) response.getValue();
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) ConBeeReadParameterRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest)

Example 5 with ConBeeReadParameterRequest

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

the class ZigBeeDongleConBee method getZigBeeExtendedPanId.

@Override
public ExtendedPanId getZigBeeExtendedPanId() {
    ConBeeReadParameterRequest readParameter = new ConBeeReadParameterRequest();
    readParameter.setParameter(ConBeeNetworkParameter.NWK_EXTENDED_PANID);
    ConBeeReadParameterResponse response = (ConBeeReadParameterResponse) conbeeHandler.sendTransaction(new ConBeeSingleResponseTransaction(readParameter, ConBeeReadParameterResponse.class)).getResponse();
    return (ExtendedPanId) response.getValue();
}
Also used : ConBeeSingleResponseTransaction(com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction) ExtendedPanId(com.zsmartsystems.zigbee.ExtendedPanId) ConBeeReadParameterResponse(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse) ConBeeReadParameterRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest)

Aggregations

ConBeeReadParameterRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterRequest)5 ConBeeReadParameterResponse (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeReadParameterResponse)4 ConBeeSingleResponseTransaction (com.zsmartsystems.zigbee.dongle.conbee.internal.transaction.ConBeeSingleResponseTransaction)4 ExtendedPanId (com.zsmartsystems.zigbee.ExtendedPanId)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 Test (org.junit.Test)1