-
Notifications
You must be signed in to change notification settings - Fork 0
Home
jack edited this page Mar 10, 2017
·
5 revisions
freebird-netcore-zigbee is the network controller (netcore) with management facilities ready for freebird IoT framework.
$ npm install freebird-netcore-zigbee --save
- To use this netcore, simply register it when creating the freebird server:
var Freebird = require('freebird'),
zbCore = require('freebird-netcore-zigbee')('/dev/ttyACM0');
// Create the freebird server and register the freebird-netcore-zigbee to it
var freebird = new Freebird([zbCore]);
// Start the freebird server
freebird.start(function (err) {
// Let your zigbee machines join the network
freebird.permitJoin(180);
});
Netcore provides you with APIs summarized in the following table, please go to Netcore APIs for their usage. The only thing you should know here is the createZigbeeCore()
API that exported by the freebird-netcore-zigbee module.
The freebird-netcore-zigbee module exports a function createZigbeeCore()
for you to create a ZigBee netcore.
Arguments
-
path
(String): A string that refers to system path of the serial port connecting to your ZNP (CC253X), e.g.,'/dev/ttyUSB0'
. -
opts
(Object): This value-object has three propertiessp
,net
anddbPath
to configure the serial port, zigbee network settings and database file path.-
sp
(Object): An optional object to configure the seiralport. Default is{ baudrate: 115200, rtscts: true }
. -
net
(Object): An object to configure the network settings, and all properties in this object are optional. The descriptions are shown in the following table. -
dbPath
(String): Set database file path, default is__dirname + '/database/dev.db'
.
-
-
name
(String): The netcore name. A default name'freebird-netcore-zigbee'
will be used if not given.
Property | Type | Mandatory | Description | Default value |
---|---|---|---|---|
panId | Number | Optional | Identify the ZigBee PAN. This id should be a value between 0 and 0x3FFF. You can also set it to 0xFFFF to let ZNP choose a random PAN-ID on its own. | 0xFFFF |
channelList | Array | Optional | Pick possible channels for your ZNP to start a PAN with. If only a single channel is given, ZNP will start a PAN with the channel you've picked. | [ 11 ] |
precfgkey | Array | Optional | This is for securing and un-securing packets. It must be an array with 16 uint8 integers. | [ 0x01, 0x03, 0x05, 0x07, 0x09, 0x0B, 0x0D, 0x0F, 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0D ] |
precfgkeysEnable | Boolean | Optional | To distribute the security key to all devices in the network or not. | true |
startoptClearState | Boolean | Optional | If this option is set, the device will clear its previous network state. This is typically used during application development. | false |
Returns
- (Object): netcore
Example
- Create a netcore and name it
var createZigbeeCore = require('freebird-netcore-zigbee');
var zbCore = createZigbeeCore('/dev/ttyACM0', 'my_zigbee_core');
- Create a netcore that will start on a specified panId
var createZigbeeCore = require('freebird-netcore-zigbee');
var zbCore = createZigbeeCore('/dev/ttyACM0', {
net: {
panId: 0x1234
}
});
Method | Description |
---|---|
getName | Get name of this netcore. |
isEnabled | To see if this netcore is enabled. |
isRegistered | To see if this netcore is registered to freebird framework. |
isJoinable | To see if this netcore is currently allowing devices to join the network. |
enable | Enable this netcore. |
disable | Disable this netcore. |
dump | Dump information about the netcore. |
Method | Description |
---|---|
start | Start the network. To allow devices to join the network, use permitJoin() . |
stop | Stop the network. All functions are disabled. |
reset | Reset the netcore. Soft reset just restart the netcore, and hard reset will clear the blacklist. |
permitJoin | Allow or disallow devices to join the network. |
remove | Remove a remote device from the network. |
ban | Ban a device from the network. Banned device can never join the network unless you unban it. |
unban | Unban a device. |
ping | Ping a remote device. |
maintain | Maintain all remote devices managed by the netcore. |
getTraffic | Get traffic records. |
resetTraffic | Reset record of the traffic. |
getBlacklist | Get blacklist of the banned devices. Use ban() to put a device into blacklist. |
clearBlacklist | Clear the blacklist. Use unban() to release a device from blacklist. |
isBlacklisted | To see if a device is banned. |