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-ble-peripheral
Advanced tools
Readme
A Cordova plugin for implementing BLE (Bluetooth Low Energy) peripherals.
Need a BLE central module? See cordova-plugin-ble-central.
Register callbacks to receive notifications from the plugin
blePeripheral.onWriteRequest(app.didReceiveWriteRequest);
blePeripheral.onBluetoothStateChange(app.onBluetoothStateChange);
Define your Bluetooth Service using JSON
var uartService = {
uuid: SERVICE_UUID,
characteristics: [
{
uuid: TX_UUID,
properties: property.WRITE,
permissions: permission.WRITEABLE,
descriptors: [
{
uuid: '2901',
value: 'Transmit'
}
]
},
{
uuid: RX_UUID,
properties: property.READ | property.NOTIFY,
permissions: permission.READABLE,
descriptors: [
{
uuid: '2901',
value: 'Receive'
}
]
}
]
};
Create the service and start advertising
Promise.all([
blePeripheral.createServiceFromJSON(uartService),
blePeripheral.startAdvertising(uartService.uuid, 'UART')
]).then(
function() { console.log ('Created UART Service'); },
app.onError
);
Instead of using JSON, you can create services programtically. Note that for 1.0 descriptors are only supported with the JSON format.
Promise.all([
blePeripheral.createService(SERVICE_UUID),
blePeripheral.addCharacteristic(SERVICE_UUID, TX_UUID, property.WRITE, permission.WRITEABLE),
blePeripheral.addCharacteristic(SERVICE_UUID, RX_UUID, property.READ | property.NOTIFY, permission.READABLE),
blePeripheral.publishService(SERVICE_UUID),
blePeripheral.startAdvertising(SERVICE_UUID, 'UART')
]).then(
function() { console.log ('Created UART Service'); },
app.onError
);
See the examples for more ideas on how this plugin can be used.
$ cordova plugin add cordova-plugin-ble-peripheral
$ phonegap plugin add cordova-plugin-ble-peripheral
Edit config.xml to install the plugin for PhoneGap Build.
<gap:plugin name="cordova-plugin-ble-peripheral" source="npm" />
Apache 2.0
Try the code. If you find an problem or missing feature please create a github issue. When you're submitting an issue please include a sample project that recreates the problem.
FAQs
Bluetooth Low Energy (BLE) Peripheral Plugin
The npm package cordova-plugin-ble-peripheral receives a total of 5 weekly downloads. As such, cordova-plugin-ble-peripheral popularity was classified as not popular.
We found that cordova-plugin-ble-peripheral 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.