@autorunify/capacitor-nrfmesh 0.0.11 → 0.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -344,6 +344,8 @@ class BleManager {
344
344
 
345
345
  return isConnected.value!!
346
346
  } catch (ex: Exception) {
347
+
348
+ async.emit(JSObject(), MESH_STATE_DISCONNECTED)
347
349
  return false
348
350
  }
349
351
  }
@@ -477,10 +477,12 @@ class MeshManager {
477
477
  }
478
478
 
479
479
  fun disconnect() {
480
+ if(!isConnected) return
480
481
  gatt.disconnect().timeout(2000).await()
481
482
  }
482
483
 
483
484
  fun connect(device: MeshDevice) {
485
+ if (isConnected) disconnect()
484
486
  gatt.connect(device.device).retry(20, 500).await()
485
487
  }
486
488
 
@@ -466,6 +466,7 @@ class NrfMeshPlugin : Plugin {
466
466
  CoroutineScope(Dispatchers.Default).launch {
467
467
  try {
468
468
  ble.disconnect()
469
+ ble.isConnected.postValue(false)
469
470
  ble.scan(false)
470
471
  call.resolve()
471
472
  } catch (ex: Exception) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorunify/capacitor-nrfmesh",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "description": "nrf mesh plugin",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",