use of com.zsmartsystems.zigbee.ZigBeeApsFrame in project com.zsmartsystems.zigbee by zsmartsystems.
the class EzspIncomingMessageHandlerTest method testReceive2.
@Test
public void testReceive2() {
EzspFrame.setEzspVersion(4);
// This tests a number of stages - not just this class
// We process the received frame, make sure the dongle sends it to the networkManager
EzspIncomingMessageHandler incomingMessageHandler = new EzspIncomingMessageHandler(getPacketData("01 90 45 00 00 00 01 80 00 00 40 00 00 00 EE FF 00 00 00 FF FF 0C 00 81 F0 F0 00 20 00 00 00 00 00 01"));
System.out.println(incomingMessageHandler);
assertEquals(0x45, incomingMessageHandler.getFrameId());
assertTrue(incomingMessageHandler.isResponse());
assertEquals(EmberIncomingMessageType.EMBER_INCOMING_UNICAST, incomingMessageHandler.getType());
ZigBeeTransportReceive transportReceiveMock = Mockito.mock(ZigBeeTransportReceive.class);
ArgumentCaptor<ZigBeeApsFrame> apsFrame = ArgumentCaptor.forClass(ZigBeeApsFrame.class);
Mockito.doNothing().when(transportReceiveMock).receiveCommand(apsFrame.capture());
ZigBeeDongleEzsp dongle = new ZigBeeDongleEzsp(null);
dongle.setZigBeeTransportReceive(transportReceiveMock);
dongle.handlePacket(incomingMessageHandler);
assertEquals(1, apsFrame.getAllValues().size());
assertEquals(0, apsFrame.getValue().getSourceAddress());
assertEquals(0, apsFrame.getValue().getDestinationAddress());
assertEquals(0, apsFrame.getValue().getProfile());
assertEquals(238, apsFrame.getValue().getApsCounter());
assertEquals(0x8001, apsFrame.getValue().getCluster());
assertEquals(0, apsFrame.getValue().getSourceEndpoint());
assertEquals(0, apsFrame.getValue().getDestinationEndpoint());
assertTrue(Arrays.equals(apsFrame.getValue().getPayload(), getPacketData("00 81 F0 F0 00 20 00 00 00 00 00 01")));
}
use of com.zsmartsystems.zigbee.ZigBeeApsFrame in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZigBeeDongleTiCc2531 method notify.
@Override
public boolean notify(final AF_INCOMING_MSG clusterMessage) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(clusterMessage.getClusterId());
apsFrame.setDestinationEndpoint(clusterMessage.getDstEndpoint());
apsFrame.setSourceEndpoint(clusterMessage.getSrcEndpoint());
apsFrame.setProfile(getEndpointProfile(clusterMessage.getDstEndpoint()));
// nwkHeader.setDestinationAddress(clusterMessage.geta);
apsFrame.setSourceAddress(clusterMessage.getSrcAddr());
apsFrame.setSequence(clusterMessage.getTransId());
apsFrame.setPayload(clusterMessage.getData());
zigbeeNetworkReceive.receiveCommand(apsFrame);
return true;
}
use of com.zsmartsystems.zigbee.ZigBeeApsFrame in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZdoManagementLeave method create.
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.MANAGEMENT_LEAVE_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
use of com.zsmartsystems.zigbee.ZigBeeApsFrame in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZdoManagementRouting method create.
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.MANAGEMENT_ROUTING_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
use of com.zsmartsystems.zigbee.ZigBeeApsFrame in project com.zsmartsystems.zigbee by zsmartsystems.
the class ZdoPowerDescriptor method create.
public static ZigBeeApsFrame create(ZToolPacket packet) {
ZigBeeApsFrame apsFrame = new ZigBeeApsFrame();
apsFrame.setCluster(ZdoCommandType.POWER_DESCRIPTOR_RESPONSE.getClusterId());
apsFrame.setDestinationEndpoint(0);
apsFrame.setSourceAddress(packet.getPacket()[4] + (packet.getPacket()[5] << 8));
apsFrame.setSourceEndpoint(0);
apsFrame.setProfile(0);
apsFrame.setPayload(Arrays.copyOfRange(packet.getPacket(), 5, packet.getPacket().length - 1));
return apsFrame;
}
Aggregations