npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

freebird-netcore-ble

v0.2.0

Published

Freebird netcore of ble

Downloads

7

Readme

freebird-netcore-ble

A ble machine network core for freebird framework.

NPM

Travis branch npm npm

Table of Contents

  1. Overiew
  2. Installation
  3. Basic Usage
  4. APIs

1. Overview

freebird-netcore-ble is the network controller (netcore) with managment facilities ready for freebird.

2. Installation

$ npm install freebird-netcore-ble --save

3. Basic Usage

  • To use this netcore with freebird, register it to freebird in your app:
var Freebird = require('freebird'),
    createBleCore = require('freebird-netcore-ble');

var freebird,
    bleCore = createBleCore('noble');

// Create freebird server and register freeebird-netcore-ble
freebird = new Freebird([ bleCore ]);

// Simply start the freebird server
freebird.start(function (err) {
    freebird.permitJoin(180);  // Let your netcores allow peripheral machines to join the network
});

// That's it!

4. APIs

1. Basic API

freebird-netcore-ble exports a function createBleCore() to create BLE netcore, it will returns a Netcore instance for network operating

2. Netcore APIs

Netcore provides you with the following APIs, please go to Netcore APIs for their usage.

  • Basic Methods

| Medthod | 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. |

  • Network Management

| Medthod | 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 of 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. |

  • With cc-bnp sub-module: createBleCore('cc-bnp', spConfig)
  • With noble sub-module: createBleCore('noble')

Arguments

  • subModule (String): subModule can be either a string of 'cc-bnp' or 'noble' to specify the sub-module.

  • spConfig (Object): This value-object has two properties path and options to configure the serial port.

Returns

  • (Object): bleCore

Example

  • Using cc-bnp as a sub-module:
var createBleCore = require('freeebird-netcore-ble');

var bleCore = createBleCore('cc-bnp', {
        path: '/dev/ttyUSB0',
        options: {
            baudRate: 115200,   // default value
            rtscts: true,       // default value
            flowControl: true   // default value
        }
    });
  • Using noble as a sub-module:
var createBleCore = require('freeebird-netcore-ble');

var bleCore = createBleCore('noble');