Skip to content
FantomJAC edited this page Dec 28, 2014 · 1 revision

Table of Contents

Setup

Configure basic system properties (Using XBee)

com.valleycampus.zigbee.managerClass=com.valleycampus.xbee.XBeeDeviceManager
com.valleycampus.zigbee.appProperties=/path_to_your_folder/application.properties
com.valleycampus.xbee.comPort=/dev/ttyX

Basic Example

Send an APS data packet. (APSDE-DATA.request)

ZigBeeDataPacket packet = connection.createZigBeeDataPacket();
packet.setAddress(IEEEAddress.getByAddress(0x0013A200400A0127L));
packet.setData(new byte[]{0x54, 0x78, 0x44, 0x61, 0x74, 0x61, 0x30, 0x41});
packet.setEndpoint(0xe8);
packet.setClusterId(0xc105);

connection.send(packet, 0, ZigBeeDataConnection.OPTION_ACK);

byte txStatus = packet.getStatus();

Receive an APS data packet. (APSDE-DATA.inidication)

ZigBeeDataPacket packet = connection.createZigBeeDataPacket();
connection.receive(packet, 0);
byte status = packet.getStatus();
if (status == ZigBeeConst.SUCCESS) {
	// Continue...
}