Skip to content

Commit

Permalink
fix(hci): bumping node-bluetooth-hci-socket to address packet parse…
Browse files Browse the repository at this point in the history
…r issue
  • Loading branch information
stoprocent committed Dec 22, 2024
1 parent c3db116 commit f390337
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
22 changes: 15 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,12 @@ This fork of `noble` was created to introduce several key improvements and new f

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 central device.
3. **Windows Native Bindings Fix**: I have fixed the native bindings for Windows, adding support for `Service Data` from advertisements.

4. **New Features**:
- A `setAddress(...)` function has been added, allowing users to set the MAC address of the central device.
- A `connect(...)/connectAsync(...)` function has been added, allowing users to connect directly to specific device by address/identifier without a need to prior scan.
- A `waitForPoweredOn(...)` function to wait for the adapter to be powered on in await/async functions.
- 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.
Expand Down Expand Up @@ -49,14 +52,16 @@ const noble = require('@stoprocent/noble');

```javascript
// Read the battery level of the first found peripheral exposing the Battery Level characteristic
const noble = require('../');

const noble = require('@stoprocent/noble');

noble.on('stateChange', async (state) => {
if (state === 'poweredOn') {
async function run() {
try {
await noble.waitForPoweredOn();
await noble.startScanningAsync(['180f'], false);
} catch (error) {
console.error(error);
}
});
}

noble.on('discover', async (peripheral) => {
await noble.stopScanningAsync();
Expand All @@ -69,6 +74,9 @@ noble.on('discover', async (peripheral) => {
await peripheral.disconnectAsync();
process.exit(0);
});

run();

```
## Use Noble With BLE5 Extended Features With HCI

Expand Down
4 changes: 4 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ export declare function removeListener(event: string, listener: Function): event

export declare function removeAllListeners(event?: string): events.EventEmitter;

export var state: "unknown" | "resetting" | "unsupported" | "unauthorized" | "poweredOff" | "poweredOn";
/**
* @deprecated Use `state` instead.
*/
export var _state: "unknown" | "resetting" | "unsupported" | "unauthorized" | "poweredOff" | "poweredOn";

export var _bindings: any;
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"node-gyp-build": "^4.8.1"
},
"optionalDependencies": {
"@stoprocent/bluetooth-hci-socket": "^1.4.2"
"@stoprocent/bluetooth-hci-socket": "^1.4.3"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
Expand Down

0 comments on commit f390337

Please sign in to comment.