Socket
Socket
Sign inDemoInstall

node-ble

Package Overview
Dependencies
119
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.8.0 to 1.9.0

10

package.json
{
"name": "node-ble",
"description": "Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus",
"version": "1.8.0",
"version": "1.9.0",
"repository": "https://github.com/chrvadala/node-ble.git",

@@ -42,6 +42,6 @@ "author": "chrvadala",

"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.20.0",
"@types/jest": "^29.2.0",
"@types/node": "^18.11.7",
"jest": "^29.2.2",
"@babel/plugin-proposal-decorators": "^7.20.2",
"@types/jest": "^29.2.2",
"@types/node": "^18.11.9",
"jest": "^29.3.1",
"jsdoc-to-markdown": "^7.1.1",

@@ -48,0 +48,0 @@ "standard": "^17.0.0",

@@ -121,2 +121,3 @@ # node-ble

- **1.8** - Upgrades deps and gh-actions os; Adds `Bluetooth.activeAdapters()` func [#45](https://github.com/chrvadala/node-ble/pull/45);
- **1.9** - Upgrades deps; Adds `writeValueWithoutResponse()` and `writeValueWithResponse` methods [#47](https://github.com/chrvadala/node-ble/pull/47); Improves typescript definition [#48](https://github.com/chrvadala/node-ble/pull/48)

@@ -128,2 +129,4 @@ # Contributors

- [altaircunhajr](https://github.com/altaircunhajr)
- [derwehr](https://github.com/derwehr)
- [mxc42](https://github.com/mxc42)

@@ -130,0 +133,0 @@ # References

@@ -84,2 +84,22 @@ const EventEmitter = require('events')

/**
* Write the value of the characteristic without waiting for the response.
* @param {Buffer} value - Buffer containing the characteristic value.
* @param {number} [offset = 0] - Starting offset.
* @returns {Promise}
*/
async writeValueWithoutResponse (value, offset = 0) {
return this.writeValue(value, { offset, type: 'command' })
}
/**
* Write the value of the characteristic and wait for the response.
* @param {Buffer} value - Buffer containing the characteristic value.
* @param {number} [offset = 0] - Starting offset.
* @returns {Promise}
*/
async writeValueWithResponse (value, offset = 0) {
return this.writeValue(value, { offset, type: 'request' })
}
/**
* Starts a notification session from this characteristic.

@@ -86,0 +106,0 @@ * It emits valuechanged event when receives a notification.

@@ -64,3 +64,3 @@ import events = require('events');

getDevice(uuid: string): Promise<Device>;
waitDevice(uuid: string): Promise<Device>;
waitDevice(uuid: string, timeout?: number, discoveryInterval?: number): Promise<Device>;
toString(): Promise<string>;

@@ -67,0 +67,0 @@ }

@@ -44,2 +44,4 @@ /* global test, expect, jest */

await expect(characteristic.writeValue('not_a_buffer')).rejects.toThrow('Only buffers can be wrote')
await expect(characteristic.writeValueWithResponse('not_a_buffer')).rejects.toThrow('Only buffers can be wrote')
await expect(characteristic.writeValueWithoutResponse('not_a_buffer')).rejects.toThrow('Only buffers can be wrote')

@@ -61,2 +63,8 @@ await expect(characteristic.writeValue(Buffer.from('hello'), 5)).resolves.toBeUndefined()

await expect(characteristic.writeValueWithResponse(Buffer.from('hello'))).resolves.toBeUndefined()
expect(characteristic.helper.callMethod).toHaveBeenCalledWith('WriteValue', expect.anything(), writeValueOptions(0, 'request'))
await expect(characteristic.writeValueWithoutResponse(Buffer.from('hello'))).resolves.toBeUndefined()
expect(characteristic.helper.callMethod).toHaveBeenCalledWith('WriteValue', expect.anything(), writeValueOptions(0, 'command'))
characteristic.helper.callMethod.mockResolvedValueOnce([255, 100, 0])

@@ -63,0 +71,0 @@ await expect(characteristic.readValue()).resolves.toEqual(Buffer.from([255, 100, 0]))

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc