New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@stoprocent/bleno

Package Overview
Dependencies
Maintainers
0
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stoprocent/bleno - npm Package Compare versions

Comparing version

to
0.8.1

FUNDING.yml

31

examples/uart/main.js
const bleno = require('../../with-custom-binding')({
bindParams: {
uart: {
port: '/dev/tty...',
port: '/dev/tty...', // Specify the path to the UART device
baudRate: 1000000

@@ -10,2 +10,20 @@ }

function generateRandomBLEMacAddress () {
// Create an array to store 6 bytes for the MAC address
let macAddr = [];
// Generate 6 random bytes
for (let i = 0; i < 6; i++) {
// Generate a random byte between 0x00 and 0xFF
let randomByte = Math.floor(Math.random() * 256);
// Ensure the first byte is a locally administered unicast address
if (i === 0) {
randomByte = (randomByte & 0xFE) | 0x02; // Clear multicast bit and set locally administered bit
}
// Convert the byte to a two-character hexadecimal string
macAddr.push(randomByte.toString(16).padStart(2, '0'));
}
// Join the array into a MAC address string with colons
return macAddr.join(':');
}
let interval = null;
bleno.on('stateChange', state => {

@@ -15,4 +33,11 @@ console.log('on -> stateChange: ' + state);

if (state === 'poweredOn') {
bleno.setAddress('11:22:33:44:55:66');
bleno.startAdvertisingIBeacon('a2744045-7004-4da9-8ed3-6d2d9a208c0a', 1234, 5678);
clearInterval(interval);
interval = setInterval(() => {
// Stop advertising
bleno.stopAdvertising();
// Set a random MAC address
bleno.setAddress(generateRandomBLEMacAddress());
// Start advertising as an iBeacon
bleno.startAdvertisingIBeacon('a2744045-7004-4da9-8ed3-6d2d9a208c0a', 1234, 5678);
}, 4000);
} else {

@@ -19,0 +44,0 @@ bleno.stopAdvertising();

4

package.json
{
"name": "@stoprocent/bleno",
"version": "0.8.0",
"version": "0.8.1",
"description": "A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals",

@@ -73,3 +73,3 @@ "main": "./index.js",

"optionalDependencies": {
"@stoprocent/bluetooth-hci-socket": "^1.4.0",
"@stoprocent/bluetooth-hci-socket": "^1.4.1",
"bplist-parser": "0.3.2",

@@ -76,0 +76,0 @@ "xpc-connect": "^3.0.0"

# bleno
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/sandeepmistry/bleno?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![GitHub forks](
https://img.shields.io/github/forks/stoprocent/bleno.svg?style=social&label=Fork&maxAge=2592000
)](
https://GitHub.com/stoprocent/bleno/network/
)
[![license](
https://img.shields.io/badge/license-MIT-0.svg
)](MIT)
[![NPM](
https://img.shields.io/npm/v/@stoprocent/bleno.svg
)](
https://www.npmjs.com/package/@stoprocent/bleno
)
A Node.js module for implementing BLE (Bluetooth Low Energy) peripherals.
Need a BLE central module? See [noble](https://github.com/stoprocent/noble).
Need a BLE central module? See [@stoprocent/noble](https://github.com/stoprocent/noble).
__Note:__ Starting with version 0.6 bleno is basing on ES6 classes and supports Node.js 14.x and higher only. For older versions of Node.js use bleno 0.5.x.
## About This Fork
__Note:__ macOS / Mac OS X, Linux, FreeBSD and Windows are currently the only supported OSes.
This fork of `bleno` was created to introduce several key improvements and new features:
1. **HCI UART Support**: This version enables HCI UART communication through the `@stoprocent/node-bluetooth-hci-socket` dependency, allowing more flexible use of Bluetooth devices across platforms.
2. **macOS Native Bindings Fix**: I have fixed the native bindings for macOS, ensuring better compatibility and performance on Apple devices.
3. **New Features**: A `setAddress` function has been added, allowing users to set the MAC address of the peripheral device. Additionally, I plan to add raw L2CAP channel support, enhancing low-level Bluetooth communication capabilities.
If you appreciate these enhancements and the continued development of this project, please consider supporting my work.
[![Buy me a coffee](https://www.buymeacoffee.com/assets/img/custom_images/orange_img.png)](https://www.buymeacoffee.com/stoprocent)
## Install
```sh
npm install @stoprocent/bleno --save
```
## Usage
```javascript
const bleno = require('@stoprocent/bleno');
```
See [examples folder](https://github.com/stoprocent/bleno/blob/master/examples) for code examples.
## Prerequisites

@@ -116,16 +153,2 @@

## Install
```sh
npm install bleno@npm:@stoprocent/bleno
```
## Usage
```javascript
var bleno = require('bleno');
```
See [examples folder](https://github.com/stoprocent/bleno/blob/master/examples) for code examples.
### Actions

@@ -441,14 +464,1 @@

* [hcitool](http://linux.die.net/man/1/hcitool) and ```gatttool``` by [BlueZ](http://www.bluez.org) for Linux
## License
Copyright (C) 2015 Sandeep Mistry <sandeep.mistry@gmail.com>
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[![Analytics](https://ga-beacon.appspot.com/UA-56089547-1/sandeepmistry/bleno?pixel)](https://github.com/igrigorik/ga-beacon)

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet