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

cordova-plugin-rfduino

v0.1.4

Published

Cordova Plugin for RFduino

Downloads

2

Readme

RFduino Plugin for PhoneGap

This plugin enabled Bluetooth communication between a phone and an RFduino.

Supported Platforms

  • iOS
  • Android 4.3 or greater

Limitations

The can only connect to one RFduino at a time. Use the BLE plugin to connect to multiple devices at the same time.

rfduino.write() does not check if data exceeds the max size.

Installing

Install with Cordova cli

$ cordova plugin add cordova-plugin-rfduino

API

Methods

discover

Discover RFduino devices

rfduino.discover(seconds, success, failure);

Description

Function discover discovers the local RFduino devices. The success callback is called each time a peripheral is discovered.

{
    "name": "RFduino",
    "uuid": "BD922605-1B07-4D55-8D09-B66653E51BBA",
    "advertising": "echo",
    "rssi": -79
}

Parameters

  • seconds: Number of seconds to run discovery
  • success: Success callback function that is invoked with a list of bonded devices.
  • failure: Error callback function, invoked when error occurs. [optional]

Quick Example

rfduino.discover(3, function(device) {
    console.log(JSON.stringify(device));
}, failure);

list

Lists known devices

rfduino.list(success, failure);

Description

Function list lists the known RFduino devices. The success callback is called with a list of objects.

This will return an empty list unless discover have previously run. You should prefer discover to list.

[{
    "name": "RFduino",
    "uuid": "AEC00232-2F92-4033-8E80-FD4C2533769C",
    "advertising": "echo",
    "rssi": -79
}, {
    "name": "RFduino",
    "uuid": "AEC00232-2F92-4033-8E80-FD4C2533769C",
    "advertising": "temp",
    "rssi": -55
}]

Parameters

  • success: Success callback function that is invoked with a list of bonded devices.
  • failure: Error callback function, invoked when error occurs. [optional]

Quick Example

rfduino.list(function(devices) {
    devices.forEach(function(device) {
        console.log(device.uuid);
    })
}, failure);

connect

Connect to a RFduino device.

rfduino.connect(uuid, connectSuccess, connectFailure);

Description

Function connect connects to a RFduino device. The callback is long running. Success will be called when the connection is successful. Failure is called if the connection fails, or later if the connection disconnects. An error message is passed to the failure callback.

Parameters

  • uuid: UUID of the remote device
  • connectSuccess: Success callback function that is invoked when the connection is successful.
  • connectFailure: Error callback function, invoked when error occurs or the connection disconnects.

disconnect

Disconnect.

rfduino.disconnect([success], [failure]);

Description

Function disconnect disconnects the current connection.

Parameters

  • success: Success callback function that is invoked when the connection is successful. [optional]
  • failure: Error callback function, invoked when error occurs. [optional]

onData

Adds a callback for processing data from the RFduino.

rfduino.onData(success, failure);

Description

Function onData registers a function that is called whenever phone receives data from the RFduino.

Raw data is passed from ObjectiveC the callback as an ArrayBuffer and must be processed.

Parameters

  • success: Success callback function that is invoked when the connection is successful. [optional]
  • failure: Error callback function, invoked when error occurs. [optional]

write

Writes data to the currently connected device

rfduino.write(data, success, failure);

Description

Function write writes data to the connected device. Data must be an ArrayBuffer for this version.

Parameters

  • data: ArrayBuffer to write to the RFduino
  • success: Success callback function that is invoked when the connection is successful. [optional]
  • failure: Error callback function, invoked when error occurs. [optional]

Quick Example

var data = new ArrayBuffer(3);
data[0] = 0xFF;
data[1] = 0x00;
data[2] = 0x17;
rfduino.write(data.buffer, success, failure);

isConnected

Reports the connection status.

rfduino.isConnected(success, failure);

Description

Function isConnected calls the success callback when connected to a peer and the failure callback when not connected.

Parameters

  • success: Success callback function that is invoked with a boolean for connected status.
  • failure: Error callback function, invoked when error occurs. [optional]

Quick Example

rfduino.isConnected(
    function() {
        console.log("RFduino is connected");
    },
    function() {
        console.log("RFduino is *not* connected");
    }
);

isEnabled

Reports if bluetooth is enabled.

rfduino.isEnabled(success, failure);

Description

Function isEnabled calls the success callback when Bluetooth is enabled and the failure callback when Bluetooth is not enabled.

Parameters

  • success: Success callback function that is invoked with a boolean for connected status.
  • failure: Error callback function, invoked when error occurs. [optional]

Quick Example

rfduino.isEnabled(
    function() {
        console.log("Bluetooth is enabled");
    },
    function() {
        console.log("Bluetooth is *not* enabled");
    }
);

License

Apache 2.0

Feedback

Try the code. If you find an problem or missing feature, file an issue or create a pull request.