bare-bluetooth-android
Advanced tools
+9
-0
@@ -43,2 +43,6 @@ import { EventEmitter, EventMap } from 'bare-events' | ||
| unsubscribe: [deviceAddress: string, characteristicUuid: string] | ||
| connecting: [deviceAddress: string] | ||
| connected: [deviceAddress: string] | ||
| disconnecting: [deviceAddress: string] | ||
| disconnected: [deviceAddress: string] | ||
| notifySent: [deviceAddress: string, status: number] | ||
@@ -78,2 +82,7 @@ error: [error: BluetoothError] | ||
| static readonly CONNECTION_STATE_DISCONNECTED: number | ||
| static readonly CONNECTION_STATE_CONNECTING: number | ||
| static readonly CONNECTION_STATE_CONNECTED: number | ||
| static readonly CONNECTION_STATE_DISCONNECTING: number | ||
| static readonly ATT_SUCCESS: number | ||
@@ -80,0 +89,0 @@ static readonly ATT_INVALID_HANDLE: number |
+24
-1
@@ -33,3 +33,4 @@ const EventEmitter = require('bare-events') | ||
| this._onchannelopen, | ||
| this._onnotifysent | ||
| this._onnotifysent, | ||
| this._onconnectionstatechange | ||
| ) | ||
@@ -195,2 +196,19 @@ } | ||
| _onconnectionstatechange(deviceAddress, newState) { | ||
| switch (newState) { | ||
| case binding.CONNECTION_STATE_DISCONNECTED: | ||
| this.emit('disconnected', deviceAddress) | ||
| break | ||
| case binding.CONNECTION_STATE_CONNECTING: | ||
| this.emit('connecting', deviceAddress) | ||
| break | ||
| case binding.CONNECTION_STATE_CONNECTED: | ||
| this.emit('connected', deviceAddress) | ||
| break | ||
| case binding.CONNECTION_STATE_DISCONNECTING: | ||
| this.emit('disconnecting', deviceAddress) | ||
| break | ||
| } | ||
| } | ||
| _onnotifysent(deviceAddress, status) { | ||
@@ -217,2 +235,7 @@ this.emit('notifySent', deviceAddress, status) | ||
| exports.CONNECTION_STATE_DISCONNECTED = binding.CONNECTION_STATE_DISCONNECTED | ||
| exports.CONNECTION_STATE_CONNECTING = binding.CONNECTION_STATE_CONNECTING | ||
| exports.CONNECTION_STATE_CONNECTED = binding.CONNECTION_STATE_CONNECTED | ||
| exports.CONNECTION_STATE_DISCONNECTING = binding.CONNECTION_STATE_DISCONNECTING | ||
| exports.ATT_SUCCESS = binding.ATT_SUCCESS | ||
@@ -219,0 +242,0 @@ exports.ATT_INVALID_HANDLE = binding.ATT_INVALID_HANDLE |
+1
-1
| { | ||
| "name": "bare-bluetooth-android", | ||
| "version": "0.4.0", | ||
| "version": "0.5.0", | ||
| "description": "Android Bluetooth bindings for Bare", | ||
@@ -5,0 +5,0 @@ "addon": true, |
Sorry, the diff of this file is too big to display
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
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
4688177
0.14%1475
2.01%