<commit_before>bleno
=====

[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/bleno?pixel)](https://github.com/igrigorik/ga-beacon)

A node.js module for implementing BLE (Bluetooth low energy) peripherals.

Need a BLE central module? See [noble](https://github.com/sandeepmistry/noble).

__Note:__ Mac OS X and Linux are currently the only supported OSes, and are still under development. Other platforms will be developed later on (see Roadmap below).

Prerequisites
------------

__OS X__

 * install [Xcode](https://itunes.apple.com/ca/app/xcode/id497799835?mt=12)
 * 10.9 or later

__Linux (Ubuntu)__

 * Kernel version 3.6 or above
 * ```sudo apt-get install bluetooth bluez-utils libbluetooth-dev```
 * Run as ```sudo``` or ```root```

Install
-------

    npm install bleno

Usage
-----

    var bleno = require('bleno');

See [examples folder](https://github.com/sandeepmistry/bleno/blob/master/examples) for code examples.

__Actions__

Start advertising:

    var name = 'name';
    var serviceUuids = ['fffffffffffffffffffffffffffffff0']

    bleno.startAdvertising(name, serviceUuids[, callback(error)]);

 __Note:__: there are limits on the name and service UUID's

  * name
    * maximum 26 bytes
  * service UUID's
    * 1 128-bit service UUID
    * 1 128-bit service UUID + 2 16-bit service UUID's
    * 7 16-bit service UUID


Start advertising iBeacon:

    var uuid = 'e2c56db5dffb48d2b060d0f5a71096e0';
    var major = 0; // 0x0000 - 0xffff
    var minor = 0; // 0x0000 - 0xffff
    var measuredPower = -59; // -128 - 127

    bleno.startAdvertisingIBeacon(uuid, major, minor, measuredPower[, callback(error)]);

 __Note:__: on OS X, in iBeacon mode your peripheral is non-connectable!

Start advertising with EIR data (__Linux only__):

    var scanData = new Buffer(...); // maximum 31 bytes
    var advertisementData = new Buffer(...); // maximum 31 bytes

    bleno.startAdvertisingWithEIRData(advertisementData, scanData[, callback(error)]);

  * For EIR format section [Bluetooth Core Specification](https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=229737) sections and 8 and 18 for more information the data format.

Stop advertising:

    bleno.stopAdvertising([callback]);

Set services:

    var services = [
       ... // see PrimaryService for data type
    ];

    bleno.setServices(services[, callback(error)]);

Disconnect client:

    bleno.disconnect(); // Linux only
<commit_msg>- update read me, OS X 10.10 iBeacon advertising not supported<commit_after>bleno
=====

[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/bleno?pixel)](https://github.com/igrigorik/ga-beacon)

A node.js module for implementing BLE (Bluetooth low energy) peripherals.

Need a BLE central module? See [noble](https://github.com/sandeepmistry/noble).

__Note:__ Mac OS X and Linux are currently the only supported OSes, and are still under development. Other platforms will be developed later on (see Roadmap below).

Prerequisites
------------

__OS X__

 * install [Xcode](https://itunes.apple.com/ca/app/xcode/id497799835?mt=12)
 * 10.9 or later

__Linux (Ubuntu)__

 * Kernel version 3.6 or above
 * ```sudo apt-get install bluetooth bluez-utils libbluetooth-dev```
 * Run as ```sudo``` or ```root```

Install
-------

    npm install bleno

Usage
-----

    var bleno = require('bleno');

See [examples folder](https://github.com/sandeepmistry/bleno/blob/master/examples) for code examples.

__Actions__

Start advertising:

    var name = 'name';
    var serviceUuids = ['fffffffffffffffffffffffffffffff0']

    bleno.startAdvertising(name, serviceUuids[, callback(error)]);

 __Note:__: there are limits on the name and service UUID's

  * name
    * maximum 26 bytes
  * service UUID's
    * 1 128-bit service UUID
    * 1 128-bit service UUID + 2 16-bit service UUID's
    * 7 16-bit service UUID


Start advertising iBeacon:

    var uuid = 'e2c56db5dffb48d2b060d0f5a71096e0';
    var major = 0; // 0x0000 - 0xffff
    var minor = 0; // 0x0000 - 0xffff
    var measuredPower = -59; // -128 - 127

    bleno.startAdvertisingIBeacon(uuid, major, minor, measuredPower[, callback(error)]);

 __Notes:__:
  * OS X:
    * in iBeacon mode your peripheral is non-connectable!
    * not supported by OS X 10.10 (Yosemite)

Start advertising with EIR data (__Linux only__):

    var scanData = new Buffer(...); // maximum 31 bytes
    var advertisementData = new Buffer(...); // maximum 31 bytes

    bleno.startAdvertisingWithEIRData(advertisementData, scanData[, callback(error)]);

  * For EIR format section [Bluetooth Core Specification](https://www.bluetooth.org/docman/handlers/downloaddoc.ashx?doc_id=229737) sections and 8 and 18 for more information the data format.

Stop advertising:

    bleno.stopAdvertising([callback]);

Set services:

    var services = [
       ... // see PrimaryService for data type
    ];

    bleno.setServices(services[, callback(error)]);

Disconnect client:

    bleno.disconnect(); // Linux only

{'fraction_non_alphanumeric': 0.12260765550239235, 'fraction_numerical': 0.039473684210526314, 'mean_word_length': 3.5733819507748406, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 12, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '437416', 'n_tokens_mistral': 1821, 'n_tokens_neox': 1582, 'n_words': 472}