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()));
}
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;
}
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();
}
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();
}
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();
}
Aggregations