Comparing version 1.2.0 to 1.3.0
{ | ||
"name": "node-ble", | ||
"description": "Bluetooth Low Energy (BLE) library written with pure Node.js (no bindings) - baked by Bluez via DBus", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"repository": "https://github.com/chrvadala/node-ble.git", | ||
@@ -9,2 +9,3 @@ "author": "chrvadala", | ||
"main": "./src/index.js", | ||
"typings": "./src/index.d.ts", | ||
"files": [ | ||
@@ -32,3 +33,4 @@ "*.md", | ||
"standard": "standard", | ||
"ci": "npm-run-all standard coverage", | ||
"ci": "npm-run-all standard coverage typescript", | ||
"typescript": "tsc --strict src/index.d.ts", | ||
"build": "exit 0" | ||
@@ -43,6 +45,8 @@ }, | ||
"@types/jest": "^25.2.3", | ||
"@types/node": "^14.0.13", | ||
"dotenv": "^8.2.0", | ||
"jest": "^26.0.1", | ||
"npm-run-all": "^4.1.5", | ||
"standard": "^14.3.4" | ||
"standard": "^14.3.4", | ||
"typescript": "^3.9.5" | ||
}, | ||
@@ -49,0 +53,0 @@ "standard": { |
@@ -22,3 +22,3 @@ # node-ble | ||
Create the file `/etc/dbus-1/system.d/node-ble.conf` with the following content (customize with your userid) | ||
Create the file `/etc/dbus-1/system.d/node-ble.conf` with the following content (customize with userid) | ||
@@ -29,3 +29,3 @@ ```xml | ||
<busconfig> | ||
<policy user="yourusername"> | ||
<policy user="%userid%"> | ||
<allow own="org.bluez"/> | ||
@@ -107,3 +107,3 @@ <allow send_destination="org.bluez"/> | ||
| --- | --- | | ||
| `String[] adapters()` | List of available adapters | | ||
| `Promise<String[]> adapters()` | List of available adapters | | ||
| `Promise<Adapter> defaultAdapter()` | Get an available adapter | | ||
@@ -154,3 +154,3 @@ | `Promise<Adapter> getAdapter(String adapter)` | Get a specific adapter (one of available in `adapters()`)| | ||
| `Promise<String[]> services()` | List of available services | | ||
| `Promise<GattService[]> getPrimaryService(String uuid)` | Returns a specific Primary Service | | ||
| `Promise<GattService> getPrimaryService(String uuid)` | Returns a specific Primary Service | | ||
@@ -173,3 +173,3 @@ ## `GattService` | ||
| `Promise<Buffer> readValue(Number offset = 0)` | Issues a request to read the value of the characteristic and returns the value if the operation was successful. | | ||
| `Promise<Buffer> writeValue(Buffer buffer, Number offset = 0)` | Issues a request to write the value of the characteristic. | | ||
| `Promise<void> writeValue(Buffer buffer, Number offset = 0)` | Issues a request to write the value of the characteristic. | | ||
| `Promise<void> startNotifications()` | Starts a notification session from this characteristic if it supports value notifications or indications. | | ||
@@ -183,3 +183,38 @@ | `Promise<void> stopNotifications()` | This method will cancel any previous StartNotify transaction. | | ||
## Compatibility | ||
This library works on many architectures supported by Linux. | ||
It leverages on Bluez driver, a component supported by the following platforms and distributions https://www.bluez.org/about | ||
*Node-ble* has been tested on the following environment: | ||
- Raspbian GNU/Linux 10 (buster) | ||
- Ubuntu 18.04.4 LTS | ||
## Changelog | ||
- **0.x** - Beta version | ||
- **1.0** - First official version | ||
- **1.1** - Migrates to gh-workflows | ||
- **1.2** - Upgrades deps | ||
- **1.3** - Adds typescript definitions [#10](https://github.com/chrvadala/node-ble/pull/10) | ||
## Contributors | ||
- [chrvadala](https://github.com/chrvadala) (author) | ||
- [pascalopitz](https://github.com/pascalopitz) | ||
## Run tests | ||
In order to run test suite you have to set up right DBus permissions. | ||
Create the file `/etc/dbus-1/system.d/node-ble-test.conf` with the following content (customize with userid) | ||
```xml | ||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
<policy user="%userid%"> | ||
<allow own="org.test"/> | ||
<allow send_destination="org.test"/> | ||
<allow send_interface="org.test.iface"/> | ||
</policy> | ||
</busconfig> | ||
``` | ||
### Unit tests | ||
@@ -191,3 +226,6 @@ ``` | ||
### End to end (e2e) tests | ||
#### PC 1 | ||
The end to end test will try to connect to a real bluetooth device and read some characteristics. To do that, you need two different devices. | ||
#### Device 1 | ||
```shell script | ||
@@ -198,5 +236,6 @@ wget https://git.kernel.org/pub/scm/bluetooth/bluez.git/plain/test/example-advertisement | ||
python example-gatt-server | ||
hcitool dev #this command shows bluetooth mac address | ||
``` | ||
#### PC 2 | ||
#### Device 2 | ||
```shell script | ||
@@ -211,15 +250,2 @@ # .env | ||
```xml | ||
<!-- /etc/dbus-1/system.d/node-ble-test.conf --> | ||
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" | ||
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd"> | ||
<busconfig> | ||
<policy user="my_username"> | ||
<allow own="org.test"/> | ||
<allow send_destination="org.test"/> | ||
<allow send_interface="org.test.iface"/> | ||
</policy> | ||
</busconfig> | ||
``` | ||
```shell script | ||
@@ -229,11 +255,2 @@ yarn test:e2e | ||
## Changelog | ||
- **0.x** - Beta version | ||
- **1.0** - First official version | ||
- **1.1** - Migrates to gh-workflows | ||
- **1.2** - Upgrades deps | ||
## Contributors | ||
- [chrvadala](https://github.com/chrvadala) (author) | ||
## References | ||
@@ -257,2 +274,3 @@ - https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/adapter-api.txt | ||
| hcitool dev | Adapter info (through Bluez) | | ||
| d-feet | DBus debugging tool | | ||
| nvram bluetoothHostControllerSwitchBehavior=never | Only on Parallels | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
55730
24
1158
266
9