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 🙏

© 2025 – Pkg Stats / Ryan Hefner

mbed-js-st-ble

v1.0.0

Published

JavaScript library for BLE on Mbed OS

Downloads

4

Readme

mbed BLE API for JerryScript

This library exposes the mbed BLE API to JerryScript targets forked from mbed-js-ble

The following objects are exposed:

  • BLEDevice - holds reference to the Bluetooth stack.
  • BLEService - references a GATT service.
  • BLECharacteristic - references a GATT characteristic.

Usage

// instantiate BLEDevice, only do this once
var ble = BLEDevice();

// takes in: characteristic UUID (16 bit only), array of properties (r/w/n), data size
var characteristic = BLECharacteristic('9101', ['read', 'write', 'notify'], 1);
// takes in: service UUID (16 bit only), array of BLECharacteristic objects
var service = BLEService('9100', [ characteristic ]);

// ready callback, wait before interacting with the API
ble.ready(function() {
    print("ble is ready");

    // takes in an array of BLEService objects
    ble.addServices([
        service
    ]);
    // takes: name to advertise, array of UUIDs (strings), advertisement interval (default: 1000)
    ble.startAdvertising("YOUR_NAME", [
        service.getUUID()
    ], 1000);
});

// connection callback
ble.onConnection(function() {
    print("GATT connection established");
});

// disconnection callback
ble.onDisconnection(function() {
    print("GATT disconnected, restarting advertisements");

    // call without parameters to use the last used set
    ble.startAdvertising();
});

// is connected? returns Boolean
print("BLE is connected? " + ble.isConnected());

Interacting with characteristics

// write to a characteristic
characteristic.write([ 0x98, 0x37 ]);

// reading a characteristic (returns an array)
var arr = characteristic.read();
print("Length is " + arr.length + ", first element is " + arr[0]);

// receiving updates when written over GATT
characteristic.onUpdate(function (newValue) {
    // newValue is an array (same value as read() returns)
    print("Updated! New value is " + newValue.length + ", first element is " + newValue[0]);
});

Fork Details

Implememted support for 128-bit UUIDs

Examples:


// BLECharacteristic
// takes in: characteristic UUID (16 bit or 128 bit), array of properties (r/w/n), data size
characteristic = BLECharacteristic('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', ['read', 'write', 'notify'], 1);
characteristic = BLECharacteristic('9100', ['read', 'write', 'notify'], 1);

// BLEService
// takes in: characteristic UUID (16 bit or 128 bit), array of characteristics
service = BLEService('9100', [ characteristic ]);
service = BLEService('XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX', [ characteristic ]);

Implemented Long UUID support in BLEService.GetUUID()

    uuid = service.GetUUID()

Added Manufacturer info in the startAdveritising method:

// Valid methods
// takes: name to advertise, array of UUIDs (strings)
BLE ble = BLEDevice();
ble.startAdvertising('advertisingName', [ service.getUUID() ]);

// takes: name to advertise, array of UUIDs (strings), advertisement interval (default: 1000),
ble.startAdvertising('advertisingName', [ service.getUUID() ], 100);

// takes: name to advertise, array of UUIDs (strings), advertisement interval (default: 1000), Manufacturer's info
ble.startAdvertising('advertisingName', [ service.getUUID() ], 100, '018000E00000');

// takes: name to advertise, array of UUIDs (strings), Manufacturer's info
ble.startAdvertising('advertisingName', [ service.getUUID() ], '018000E00000');