Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
cordova-plugin-rfduino
Advanced tools
Readme
This plugin enabled Bluetooth communication between a phone and an RFduino.
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.
Install with Cordova cli
$ cordova plugin add cordova-plugin-rfduino
Discover RFduino devices
rfduino.discover(seconds, success, failure);
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
}
rfduino.discover(3, function(device) {
console.log(JSON.stringify(device));
}, failure);
Lists known devices
rfduino.list(success, failure);
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
}]
rfduino.list(function(devices) {
devices.forEach(function(device) {
console.log(device.uuid);
})
}, failure);
Connect to a RFduino device.
rfduino.connect(uuid, connectSuccess, connectFailure);
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.
Disconnect.
rfduino.disconnect([success], [failure]);
Function disconnect
disconnects the current connection.
Adds a callback for processing data from the RFduino.
rfduino.onData(success, failure);
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.
Writes data to the currently connected device
rfduino.write(data, success, failure);
Function write
writes data to the connected device. Data must be an ArrayBuffer for this version.
var data = new ArrayBuffer(3);
data[0] = 0xFF;
data[1] = 0x00;
data[2] = 0x17;
rfduino.write(data.buffer, success, failure);
Reports the connection status.
rfduino.isConnected(success, failure);
Function isConnected
calls the success callback when connected to a peer and the failure callback when not connected.
rfduino.isConnected(
function() {
console.log("RFduino is connected");
},
function() {
console.log("RFduino is *not* connected");
}
);
Reports if bluetooth is enabled.
rfduino.isEnabled(success, failure);
Function isEnabled
calls the success callback when Bluetooth is enabled and the failure callback when Bluetooth is not enabled.
rfduino.isEnabled(
function() {
console.log("Bluetooth is enabled");
},
function() {
console.log("Bluetooth is *not* enabled");
}
);
Apache 2.0
Try the code. If you find an problem or missing feature, file an issue or create a pull request.
FAQs
Cordova Plugin for RFduino
The npm package cordova-plugin-rfduino receives a total of 2 weekly downloads. As such, cordova-plugin-rfduino popularity was classified as not popular.
We found that cordova-plugin-rfduino demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.