Search in sources :

Example 1 with ConBeeEnqueueSendDataRequest

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

the class ZigBeeDongleConBee method sendCommand.

@Override
public void sendCommand(final ZigBeeApsFrame apsFrame) {
    ConBeeEnqueueSendDataRequest request = new ConBeeEnqueueSendDataRequest();
    request.setRequestId(apsFrame.getSequence());
    request.setClusterId(apsFrame.getCluster());
    switch(apsFrame.getAddressMode()) {
        case DEVICE:
            request.setDestinationAddress(new ZigBeeEndpointAddress(apsFrame.getDestinationAddress(), apsFrame.getDestinationEndpoint()));
            request.setDestinationAddressMode(ConBeeAddressMode.NWK);
            if (apsFrame.getDestinationAddress() > 0xfff8) {
                // 
                request.setTxOptions(0);
            }
            break;
        case GROUP:
            request.setDestinationAddress(new ZigBeeGroupAddress(apsFrame.getDestinationAddress()));
            request.setDestinationAddressMode(ConBeeAddressMode.GROUP);
            break;
        default:
            break;
    }
    request.setProfileId(apsFrame.getProfile());
    request.setRadius(apsFrame.getRadius());
    request.setSourceEndpoint(apsFrame.getSourceEndpoint());
    // request.setTxOptions(txOptions);
    request.setAdsuData(apsFrame.getPayload());
    conbeeHandler.queueFrame(request);
}
Also used : ConBeeEnqueueSendDataRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeEnqueueSendDataRequest) ZigBeeEndpointAddress(com.zsmartsystems.zigbee.ZigBeeEndpointAddress) ZigBeeGroupAddress(com.zsmartsystems.zigbee.ZigBeeGroupAddress)

Example 2 with ConBeeEnqueueSendDataRequest

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

the class ConBeeEnqueueSendDataRequestTest method doRequest.

@Test
public void doRequest() {
    ConBeeEnqueueSendDataRequest request = new ConBeeEnqueueSendDataRequest();
    request.setSequence(0x11);
    request.setRequestId(0x22);
    request.setDestinationAddress(new ZigBeeEndpointAddress(0x9876, 0x54));
    request.setDestinationAddressMode(ConBeeAddressMode.NWK);
    request.setProfileId(0x4444);
    request.setClusterId(0x0000);
    request.setRadius(0x1F);
    request.setSourceEndpoint(0x33);
    request.setAdsuData(new int[] { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF });
    System.out.println(request);
    assertTrue(Arrays.equals(new int[] { 0x12, 0x11, 0x00, 0x1C, 0x00, 0x15, 0x00, 0x22, 0x00, 0x02, 0x76, 0x98, 0x54, 0x44, 0x44, 0x00, 0x00, 0x33, 0x06, 0x00, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff, 0x04, 0x1f, 0x47, 0xf8 }, request.getOutputBuffer()));
}
Also used : ConBeeEnqueueSendDataRequest(com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeEnqueueSendDataRequest) ZigBeeEndpointAddress(com.zsmartsystems.zigbee.ZigBeeEndpointAddress) Test(org.junit.Test)

Aggregations

ZigBeeEndpointAddress (com.zsmartsystems.zigbee.ZigBeeEndpointAddress)2 ConBeeEnqueueSendDataRequest (com.zsmartsystems.zigbee.dongle.conbee.internal.frame.ConBeeEnqueueSendDataRequest)2 ZigBeeGroupAddress (com.zsmartsystems.zigbee.ZigBeeGroupAddress)1 Test (org.junit.Test)1