Code Monkey home page Code Monkey logo

ts-xbee-api's Introduction

ts-xbee-api

A user-friendly interface to Digi's XBee line of RF modules. This is made up of two parts:

  • a library for parsing and building XBee frames, especially in association with Node streams, such as those provided by the serialport package.
  • a high-level API for interacting with XBee modules, including a simple API for sending and receiving data.

Originally based on xbee-api, but has been extensively modified, especially as of v2.0.0.

GETTING STARTED

Installation: npm install ts-xbee-api

import { XBee } from 'ts-xbee-api';

const xbee = await XBee.discover('/dev/ttyUSB0', [9600, 115200]);
const routerAddress = await xbee.address();
const remoteAddress = '0013A20040B3B3B3';
await xbee.transmit(Uint8Array.from([0x01, 0x02, 0x03]), remoteAddress);

SUPPORTED FIRMWARES AND DEVICES

This module supports the 802.15.4 and ZigBee (including ZNet) protocol stacks.

From the XBee family, Series 1 (802.15.4) and Series 2 (ZNet 2.5 and ZigBee) modules are supported, since they come with firmwares talking either one of these stacks.

These documents are used as reference: 90000976.pdf (for Series 2) and 90000982.pdf (for Series 1). Some frame types are 802.15.4, ZNet or ZigBee specific. Be sure to use the correct ones for your module (as described in the documents and the list below). Also check out this utility from Digi.

Modules must run in API mode. Both AP=1 (without escaping) and AP=2 (with escaping) modes are supported (set the api_mode parameter accordingly).

Since ZigBee is more robust and offers more features than ZNet (none of which are yet implemented here, though!), you might be interested in upgrading your Series 2 modules from ZNet 2.5 to ZigBee: upgradingfromznettozb.pdf.

SUPPORTED FRAME TYPES

The following frame types are implemented:

  • 0x00: TX (Transmit) Request: 64-bit address (802.15.4)
  • 0x01: TX (Transmit) Request: 16-bit address (802.15.4)
  • 0x08: AT Command (802.15.4, ZNet, ZigBee)
  • 0x09: AT Command Queue Parameter Value (802.15.4, ZNet, ZigBee)
  • 0x17: Remote Command Request (802.15.4, ZNet, ZigBee)
  • 0x21: Create Source Route (ZigBee)
  • 0x80: RX (Receive) Packet: 64-bit Address (802.15.4)
  • 0x81: RX (Receive) Packet: 16-bit Address (802.15.4)
  • 0x82: RX (Receive) Packet: 64-bit Address IO (802.15.4)
  • 0x83: RX (Receive) Packet: 16-bit Address IO (802.15.4)
  • 0x88: AT Command Response (802.15.4, ZNet, ZigBee)
  • 0x89: TX (Transmit) Status (802.15.4)
  • 0x8A: Modem Status (802.15.4, ZNet, ZigBee)
  • 0x97: Remote Command Response (802.15.4, ZNet, ZigBee)
  • 0x10: ZigBee Transmit Request (ZNet, ZigBee)
  • 0x11: Explicit Addressing ZigBee Command Frame (ZNet, ZigBee)
  • 0x8B: ZigBee Transmit Status (ZNet, ZigBee)
  • 0x90: ZigBee Receive Packet (AO=0) (ZNet, ZigBee)
  • 0x91: ZigBee Explicit Rx Indicator (AO=1) (ZNet, ZigBee)
  • 0x92: ZigBee IO Data Sample Rx Indicator (ZNet, ZigBee)
  • 0x94: XBee Sensor Read Indicator (AO=0) (ZNet, ZigBee)
  • 0x95: Node Identification Indicator (AO=0) (ZNet, ZigBee)
  • 0xA1: Route Record Indicator (ZigBee)

NOT IMPLEMENTED YET

These (more esoteric) frame types have not been implemented yet, Open a new issue if you need something in particular:

  • 0x24: Register Joining Device (ZigBee)
  • 0xA0: Over-the-Air Firmware Update Status (ZigBee)
  • 0xA2: Device Authenticated Indicator (ZigBee)
  • 0xA3: Many-to-One Route Request Indicator (ZigBee)
  • 0xA4: Register Joining Device Status (ZigBee)
  • 0xA5: Join Notification Status (ZigBee)

Building

Run nx build new to build the library.

Running unit tests

Run nx test new to execute the unit tests via Jest.

ts-xbee-api's People

Contributors

101100 avatar codebudo avatar exsilium avatar flaviut avatar geekoftheweek avatar hwestbrook avatar jankolkmeier avatar joshperry avatar mozz100 avatar ntokos avatar tibeoh avatar xseignard avatar

Watchers

 avatar

Forkers

gp3098

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.