File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -211,6 +211,9 @@ Set `GENERIC_BLE_TRACE=true` on starting Node-RED and you can find the precise l
211211
212212* 3.0.0
213213 - Refactor entire architecture
214+ - Peripheral connections are retained until it disconnects
215+ - Characteristic subscriptions are retained while the ongoing flows are running (will be unsubscribed on stopping them though)
216+ - The max number of concurrent BLE connections is 5 or 6 according to [ this document] ( https://github.com/noble/noble#maximum-simultaneous-connections )
214217
215218* 2.0.4
216219 - Fix an issue where this node don't work with
[email protected]
Original file line number Diff line number Diff line change @@ -244,7 +244,8 @@ export default function(RED) {
244244 } ,
245245 unsubscribe : ( ) => {
246246 return new Promise ( ( resolve ) => {
247- if ( obj . notifiable ) {
247+ let peripheral = noble . _peripherals [ obj . _peripheralId ] ;
248+ if ( obj . notifiable && peripheral && peripheral . state === 'connected' ) {
248249 delete obj . dataListener ;
249250 obj . object . unsubscribe ( resolve ) ;
250251 } else {
@@ -304,8 +305,8 @@ export default function(RED) {
304305 } , [ ] ) . map ( ( c ) => toCharacteristic ( c ) ) ;
305306 } ) ;
306307 } ) ;
308+ peripheral . connect ( ) ; // peripheral.state => connecting
307309 }
308- peripheral . connect ( ) ; // peripheral.state => connecting
309310 connecting = true ;
310311 break ;
311312 }
@@ -552,6 +553,7 @@ export default function(RED) {
552553 }
553554 } ) ;
554555 } ) ;
556+ this . emit ( 'disconnected' ) ;
555557 this . on ( 'close' , ( done ) => {
556558 Object . keys ( configBleDevices ) . forEach ( k => delete configBleDevices [ k ] ) ;
557559 this . operations . shutdown ( ) . then ( done ) . catch ( done ) ;
You can’t perform that action at this time.
0 commit comments