Search in sources :

Example 1 with ZigBeeGroupAddress

use of com.zsmartsystems.zigbee.ZigBeeGroupAddress in project com.zsmartsystems.zigbee by zsmartsystems.

the class ZigBeeGroupAddressTest method testGroupAddress.

@Test
public void testGroupAddress() {
    ZigBeeGroupAddress group1 = new ZigBeeGroupAddress(1);
    assertTrue(group1.isGroup());
    ZigBeeGroupAddress group2 = new ZigBeeGroupAddress(1);
    assertTrue(group1.equals(group2));
    assertEquals(0, group1.compareTo(group2));
    assertEquals(1, group1.getGroupId());
    // Test that label doesn't matter
    group2 = new ZigBeeGroupAddress(1, "Test Label");
    assertTrue(group1.equals(group2));
    assertEquals("Test Label", group2.getLabel());
    group2 = new ZigBeeGroupAddress();
    group2.setGroupId(1);
    assertEquals(1, group1.getGroupId());
    group2.setLabel("Test Label");
    assertEquals("Test Label", group2.getLabel());
    group2.setGroupId(2);
    assertEquals(1, group1.compareTo(group2));
}
Also used : ZigBeeGroupAddress(com.zsmartsystems.zigbee.ZigBeeGroupAddress) Test(org.junit.Test)

Example 2 with ZigBeeGroupAddress

use of com.zsmartsystems.zigbee.ZigBeeGroupAddress 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)

Aggregations

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