use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionResponse in project com.zsmartsystems.zigbee by zsmartsystems.
the class ConBeeVersionResponseTest method readMacAddress.
@Test
public void readMacAddress() {
ConBeeVersionResponse readParameter = new ConBeeVersionResponse(new int[] { 0x0D, 0x02, 0x00, 0x09, 0x00, 0x00, 0x05, 0x1B, 0x26, 0xA2, 0xFF });
System.out.println(readParameter);
assertEquals(2, readParameter.getSequence());
assertEquals(0x261B0500, readParameter.getVersion());
}
use of com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeVersionResponse 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;
}
Aggregations