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