@iotize/device-com-ble.cordova 3.5.1 → 3.6.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../../../src/lib/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CharacteristicProperties } from \"@iotize/tap/protocol/ble/common\";\n\nexport interface CordovaBLEScanResult {\n name: string;\n address: string;\n rssi?: number;\n}\n\n/**\n * @deprecated\n * use CordovaBLEScanResult instead\n */\nexport type DiscoveredDeviceType = CordovaBLEScanResult;\n\nexport interface RequestDeviceOptions {\n filters: BluetoothLEScanFilter[];\n // optionalServices?: BluetoothServiceUUID[] | undefined;\n // optionalManufacturerData?: number[] | undefined;\n}\n\ninterface BluetoothLEScanFilter {\n // readonly name?: string | undefined;\n // readonly namePrefix?: string | undefined;\n readonly services?: BluetoothServiceUUID[] | undefined;\n // readonly manufacturerData?: BluetoothManufacturerDataFilter[] | undefined;\n // readonly serviceData?: BluetoothServiceDataFilter[] | undefined;\n}\n\ntype BluetoothServiceUUID = string;\n\ntype BluetoothCharacteristicUUID = string;\n\ntype BluetoothDescriptorUUID = string;\n\nexport interface ServiceDescription {\n uuid: BluetoothServiceUUID;\n characteristics?: CharacteristicList;\n [key: string]: any;\n}\n\nexport type ServiceList = ServiceDescription[];\n\nexport interface CharacteristicDescription {\n uuid: BluetoothCharacteristicUUID;\n descriptors?: DescriptorList;\n properties: CharacteristicProperties;\n [key: string]: any;\n}\n\nexport type CharacteristicList = CharacteristicDescription[];\n\nexport interface DescriptorDescription {\n uuid: BluetoothDescriptorUUID;\n [key: string]: any;\n}\n\nexport type DescriptorList = DescriptorDescription[];\n"]}
1
+ {"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../../../src/lib/definitions.ts"],"names":[],"mappings":"","sourcesContent":["import { CharacteristicProperties } from '@iotize/tap/protocol/ble/common';\n\nexport interface CordovaBLEScanResult {\n name: string;\n address: string;\n rssi?: number;\n txPower?: number;\n scanRecord?: number[];\n}\n\n/**\n * @deprecated\n * use CordovaBLEScanResult instead\n */\nexport type DiscoveredDeviceType = CordovaBLEScanResult;\n\nexport interface RequestDeviceOptions {\n filters: BluetoothLEScanFilter[];\n // optionalServices?: BluetoothServiceUUID[] | undefined;\n // optionalManufacturerData?: number[] | undefined;\n}\n\ninterface BluetoothLEScanFilter {\n // readonly name?: string | undefined;\n // readonly namePrefix?: string | undefined;\n readonly services?: BluetoothServiceUUID[] | undefined;\n // readonly manufacturerData?: BluetoothManufacturerDataFilter[] | undefined;\n // readonly serviceData?: BluetoothServiceDataFilter[] | undefined;\n}\n\ntype BluetoothServiceUUID = string;\n\ntype BluetoothCharacteristicUUID = string;\n\ntype BluetoothDescriptorUUID = string;\n\nexport interface ServiceDescription {\n uuid: BluetoothServiceUUID;\n characteristics?: CharacteristicList;\n [key: string]: any;\n}\n\nexport type ServiceList = ServiceDescription[];\n\nexport interface CharacteristicDescription {\n uuid: BluetoothCharacteristicUUID;\n descriptors?: DescriptorList;\n properties: CharacteristicProperties;\n [key: string]: any;\n}\n\nexport type CharacteristicList = CharacteristicDescription[];\n\nexport interface DescriptorDescription {\n uuid: BluetoothDescriptorUUID;\n [key: string]: any;\n}\n\nexport type DescriptorList = DescriptorDescription[];\n"]}
@@ -1,8 +1,10 @@
1
- import { CharacteristicProperties } from "@iotize/tap/protocol/ble/common";
1
+ import { CharacteristicProperties } from '@iotize/tap/protocol/ble/common';
2
2
  export interface CordovaBLEScanResult {
3
3
  name: string;
4
4
  address: string;
5
5
  rssi?: number;
6
+ txPower?: number;
7
+ scanRecord?: number[];
6
8
  }
7
9
  /**
8
10
  * @deprecated
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "IoTize <contact@iotize.com>",
3
3
  "license": "MIT",
4
4
  "name": "@iotize/device-com-ble.cordova",
5
- "version": "3.5.1",
5
+ "version": "3.6.0",
6
6
  "cordova": {
7
7
  "id": "@iotize/device-com-ble.cordova",
8
8
  "platforms": [
package/plugin.xml CHANGED
@@ -1,5 +1,5 @@
1
1
  <?xml version="1.0" encoding="utf-8"?>
2
- <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="@iotize/device-com-ble.cordova" version="2.0.0">
2
+ <plugin xmlns="http://apache.org/cordova/ns/plugins/1.0" id="@iotize/device-com-ble.cordova" version="3.5.3">
3
3
 
4
4
  <name>@iotize/device-com-ble.cordova</name>
5
5
  <description>Bluetooth Low Energy (BLE) Plugin for IoTize devices</description>
@@ -35,7 +35,6 @@ import com.iotize.android.communication.protocol.ble.exception.CannotWriteCharac
35
35
  import com.iotize.android.communication.protocol.ble.exception.CharacteristicNotAvailableException;
36
36
  import com.iotize.android.communication.protocol.ble.exception.ServiceNotAvailableException;
37
37
  import com.iotize.android.communication.protocol.ble.exception.WritePacketIsTooBigException;
38
- import com.iotize.android.communication.protocol.ble.scanner.BLEScanner;
39
38
  import com.iotize.android.core.util.Helper;
40
39
  import com.iotize.android.device.api.device.scanner.IOnDeviceDiscovered;
41
40
  import com.iotize.plugin.cordova.ble.models.RequestDeviceOptions;
@@ -311,7 +310,7 @@ public class BLECom extends CordovaPlugin {
311
310
  if (options != null) {
312
311
  this.scanner = new BLEScanner(cordova.getContext(), BluetoothAdapter.getDefaultAdapter(), options.getScanFilters());
313
312
  } else {
314
- this.scanner = new BLEScanner(cordova.getContext(), BluetoothAdapter.getDefaultAdapter());
313
+ this.scanner = new BLEScanner(cordova.getContext(), BluetoothAdapter.getDefaultAdapter(), TapUtility.createTapFilter());
315
314
  }
316
315
 
317
316
  if (onDeviceDiscoveredCallback == null) {
@@ -6,6 +6,16 @@
6
6
  //
7
7
  package com.iotize.plugin.cordova.ble;
8
8
 
9
+ import android.bluetooth.le.ScanFilter;
10
+ import android.os.Build;
11
+ import android.os.ParcelUuid;
12
+
13
+ import com.iotize.android.communication.protocol.ble.Constants;
14
+
15
+ import java.util.ArrayList;
16
+ import java.util.Collections;
17
+ import java.util.List;
18
+
9
19
  public class BLEComError extends Exception {
10
20
 
11
21
  private final String code;
@@ -105,4 +115,5 @@ public class BLEComError extends Exception {
105
115
  String NOT_CONNECTED_ERROR = "NotConnectedError";
106
116
  String BLE_STATUS_CODE_ERROR = "StatusCodeError";
107
117
  }
118
+
108
119
  }
@@ -0,0 +1,284 @@
1
+ package com.iotize.plugin.cordova.ble;
2
+
3
+
4
+ import static android.os.Build.VERSION_CODES.LOLLIPOP;
5
+
6
+ import android.bluetooth.BluetoothAdapter;
7
+ import android.bluetooth.BluetoothDevice;
8
+ import android.bluetooth.le.BluetoothLeScanner;
9
+ import android.bluetooth.le.ScanCallback;
10
+ import android.bluetooth.le.ScanFilter;
11
+ import android.bluetooth.le.ScanRecord;
12
+ import android.bluetooth.le.ScanResult;
13
+ import android.bluetooth.le.ScanSettings;
14
+ import android.content.Context;
15
+ import android.content.pm.PackageManager;
16
+ import android.os.Build;
17
+ import android.util.Log;
18
+
19
+ import androidx.annotation.NonNull;
20
+ import androidx.annotation.RequiresApi;
21
+
22
+ import com.iotize.android.device.api.device.scanner.IDeviceScanner;
23
+ import com.iotize.android.device.api.device.scanner.IOnDeviceDiscovered;
24
+
25
+ import java.util.List;
26
+
27
+ /**
28
+ *
29
+ */
30
+ @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
31
+ public class BLEScanner implements IDeviceScanner<BLEScanner.BLEScanData> {
32
+
33
+ private static final String TAG = "BLEScanner";
34
+
35
+ @NonNull
36
+ private final BluetoothAdapter mBluetoothAdapter;
37
+ @NonNull
38
+ private final Context mContext;
39
+ @NonNull
40
+ private final List<ScanFilter> filters;
41
+
42
+ // Device scan callback.
43
+ protected BLE_Callback mLeScanCallback;
44
+ protected BLE_Callback_API21 mLeScanCallback_API21;
45
+ private BluetoothLeScanner mBluetoothScanner;
46
+ private IOnDeviceDiscovered<BLEScanData> onDeviceDiscovered;
47
+ private boolean mRunning;
48
+
49
+ public BLEScanner(@NonNull Context context,
50
+ @NonNull BluetoothAdapter bluetoothAdapter,
51
+ @NonNull List<ScanFilter> filters) {
52
+ this.mBluetoothAdapter = bluetoothAdapter;
53
+ if (Build.VERSION.SDK_INT < LOLLIPOP)
54
+ mLeScanCallback = new BLE_Callback();
55
+ else {
56
+ mLeScanCallback_API21 = new BLE_Callback_API21();
57
+ }
58
+ this.mContext = context;
59
+ this.filters = filters;
60
+ }
61
+
62
+ public void setOnDeviceDiscoveredCallback(IOnDeviceDiscovered<BLEScanData> onDeviceDiscovered) {
63
+ this.onDeviceDiscovered = onDeviceDiscovered;
64
+ }
65
+
66
+ public void start() {
67
+ if (mRunning) {
68
+ Log.w(TAG, "Scan is already running... ignoring this call");
69
+ return;
70
+ }
71
+ mRunning = true;
72
+ if (Build.VERSION.SDK_INT < LOLLIPOP) {
73
+ Log.i(TAG, "Starting Bluetooth scan...");
74
+ mBluetoothAdapter.startLeScan(mLeScanCallback);
75
+ } else {
76
+ Log.i(TAG, "Starting Bluetooth Low Energy scan...");
77
+ try {
78
+ ScanSettings.Builder buildSettings = new ScanSettings.Builder();
79
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
80
+ buildSettings.setCallbackType(ScanSettings.CALLBACK_TYPE_ALL_MATCHES);
81
+ }
82
+ buildSettings.setScanMode(ScanSettings.SCAN_MODE_LOW_LATENCY);
83
+ buildSettings.setReportDelay(0); // we want the result immediately
84
+ ScanSettings settings = buildSettings.build();
85
+ mBluetoothScanner = mBluetoothAdapter.getBluetoothLeScanner();
86
+ mBluetoothScanner.startScan(this.filters, settings, mLeScanCallback_API21);
87
+ } catch (Exception e) {
88
+ Log.e(TAG, "Cannot run bluetooth scan: " + e.getMessage(), e);
89
+ stop();
90
+ }
91
+ }
92
+ }
93
+
94
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
95
+ public void stop() {
96
+ try {
97
+ if (mBluetoothAdapter != null && mBluetoothAdapter.isEnabled()) {
98
+ if (mBluetoothScanner != null) {
99
+ mBluetoothScanner.stopScan(mLeScanCallback_API21);
100
+ }
101
+ mBluetoothAdapter.cancelDiscovery();
102
+ }
103
+ } catch (Throwable e) {
104
+ Log.e(TAG, "Error while stopping ble scan: " + e.getMessage(), e);
105
+ } finally {
106
+ mRunning = false;
107
+ }
108
+ }
109
+
110
+ protected void onDeviceDiscovered(BLEScanData device) {
111
+ Log.v(TAG, "onDeviceDiscovered() " + device.getDevice().getName());
112
+
113
+ if (this.onDeviceDiscovered != null) {
114
+ this.onDeviceDiscovered.onDeviceDiscovered(device);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * @return true if device has bluetooth feature
120
+ */
121
+ public boolean isAvailable() {
122
+ PackageManager pm = mContext.getPackageManager();
123
+ return pm.hasSystemFeature(PackageManager.FEATURE_BLUETOOTH);
124
+ }
125
+
126
+ /**
127
+ * @return true if device bluetooth is enabled
128
+ */
129
+ public boolean isEnabled() {
130
+ return mBluetoothAdapter != null && mBluetoothAdapter.isEnabled();
131
+ }
132
+
133
+
134
+ @RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR2)
135
+ class BLE_Callback implements BluetoothAdapter.LeScanCallback {
136
+ @Override
137
+ public void onLeScan(final BluetoothDevice device, int rssi, final byte[] scanRecord) {
138
+ Log.v(TAG, "Scan result: " + device + " RSSI: " + rssi);
139
+ onDeviceDiscovered(new BluetoothDeviceAdpaterBeforeLollipop(device, rssi, scanRecord));
140
+ }
141
+
142
+ }
143
+
144
+ //YRT170410 @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
145
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
146
+ private class BLE_Callback_API21 extends ScanCallback {
147
+ @Override
148
+ public void onScanResult(int callbackType, android.bluetooth.le.ScanResult result) {
149
+ super.onScanResult(callbackType, result);
150
+ Log.v(TAG, "Scan result: " + result);
151
+ //if (callbackType == ScanSettings.CALLBACK_TYPE_ALL_MATCHES) {
152
+ BluetoothDevice device = result.getDevice();
153
+ onDeviceDiscovered(new BluetoothDeviceAdpaterFromLollipop(result));
154
+ //}
155
+ }
156
+
157
+ @Override
158
+ public void onScanFailed(int errorCode) {
159
+ Log.e(TAG, "Scan failed with error code: " + errorCode);
160
+ BLEScanner.this.onScanFailed(errorCode);
161
+ }
162
+ }
163
+
164
+ private void onScanFailed(int errorCode) {
165
+ if (this.onDeviceDiscovered != null) {
166
+ this.onDeviceDiscovered.onScanFailed(
167
+ new BleScanError(errorCode)
168
+ );
169
+ }
170
+ }
171
+
172
+
173
+ public interface BLEScanData {
174
+
175
+ int getRssi();
176
+
177
+ int getTxPower();
178
+
179
+ BluetoothDevice getDevice();
180
+
181
+ byte[] getScanRecordBytes();
182
+
183
+ }
184
+
185
+ @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
186
+ public class BluetoothDeviceAdpaterFromLollipop implements BLEScanner.BLEScanData {
187
+ private final ScanResult result;
188
+
189
+ public BluetoothDeviceAdpaterFromLollipop(ScanResult result) {
190
+ this.result = result;
191
+ }
192
+
193
+ @Override
194
+ public int getRssi() {
195
+ return this.result.getRssi();
196
+ }
197
+
198
+ @Override
199
+ public int getTxPower() {
200
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
201
+ return this.result.getTxPower();
202
+ }
203
+ else {
204
+ return 0;
205
+ }
206
+ }
207
+
208
+ @Override
209
+ public BluetoothDevice getDevice() {
210
+ return this.result.getDevice();
211
+ }
212
+ @Override
213
+ public byte[] getScanRecordBytes() {
214
+ final ScanRecord scanRecord = this.result.getScanRecord();
215
+ if (scanRecord == null) {
216
+ return new byte[0];
217
+ }
218
+ return scanRecord.getBytes();
219
+ }
220
+
221
+ @Override
222
+ public boolean equals(Object obj) {
223
+ if (obj == null) {
224
+ return this.getDevice() == null;
225
+ }
226
+ if (!(obj instanceof BLEScanner.BLEScanData)) {
227
+ return false;
228
+ }
229
+ return this.result.getDevice().equals(((BLEScanner.BLEScanData) obj).getDevice());
230
+ }
231
+ }
232
+
233
+ public class BluetoothDeviceAdpaterBeforeLollipop implements BLEScanner.BLEScanData {
234
+
235
+ private final BluetoothDevice device;
236
+ private final int rssi;
237
+ private final byte[] scanRecord;
238
+
239
+ public BluetoothDeviceAdpaterBeforeLollipop(BluetoothDevice device, int rssi, final byte[] scanRecord) {
240
+ this.device = device;
241
+ this.rssi = rssi;
242
+ this.scanRecord = scanRecord;
243
+ }
244
+
245
+ @Override
246
+ public int getRssi() {
247
+ return this.rssi;
248
+ }
249
+
250
+ @Override
251
+ public int getTxPower() {
252
+ return 0;
253
+ }
254
+
255
+ @Override
256
+ public BluetoothDevice getDevice() {
257
+ return this.device;
258
+ }
259
+
260
+ @Override
261
+ public byte[] getScanRecordBytes() {
262
+ return this.scanRecord;
263
+ }
264
+
265
+ @Override
266
+ public boolean equals(Object obj) {
267
+ if (obj == null) {
268
+ return this.getDevice() == null;
269
+ }
270
+ if (!(obj instanceof BLEScanner.BLEScanData)) {
271
+ return false;
272
+ }
273
+ return this.device.equals(((BLEScanner.BLEScanData) obj).getDevice());
274
+ }
275
+ }
276
+
277
+ class BleScanError extends Exception {
278
+ public BleScanError(int errorCode) {
279
+ super("BLE scan failed (error code: " + errorCode + ")");
280
+ }
281
+ }
282
+
283
+
284
+ }
@@ -13,9 +13,9 @@ import android.util.Log;
13
13
 
14
14
  import com.google.gson.Gson;
15
15
  import com.google.gson.GsonBuilder;
16
- import com.iotize.android.communication.protocol.ble.scanner.BLEScanner;
17
16
  import com.iotize.plugin.cordova.ble.models.ServiceDescription;
18
17
 
18
+ import org.json.JSONArray;
19
19
  import org.json.JSONException;
20
20
  import org.json.JSONObject;
21
21
 
@@ -39,6 +39,8 @@ public class JSONBuilder {
39
39
  json.put("address", bluetoothDevice.getAddress());
40
40
  // json.put("type", bluetoothDevice.getType());
41
41
  json.put("rssi", device.getRssi());
42
+ json.put("txPower", device.getTxPower());
43
+ json.put("scanRecord", JSONBuilder.toJSONObject(device.getScanRecordBytes()));
42
44
 
43
45
  return json;
44
46
  } catch (JSONException e) {
@@ -61,6 +63,15 @@ public class JSONBuilder {
61
63
  }
62
64
  }
63
65
 
66
+ static JSONArray toJSONObject(byte[] bytes) {
67
+ JSONArray json = new JSONArray();
68
+ for (byte aByte : bytes) {
69
+ json.put(aByte);
70
+ }
71
+ return json;
72
+ }
73
+
74
+
64
75
  public static ArrayList<ServiceDescription> toServicesDescription(List<BluetoothGattService> services) {
65
76
  ArrayList<ServiceDescription> result = new ArrayList<>();
66
77
  for (BluetoothGattService service : services) {
@@ -0,0 +1,27 @@
1
+ package com.iotize.plugin.cordova.ble;
2
+
3
+ import android.bluetooth.le.ScanFilter;
4
+ import android.os.Build;
5
+ import android.os.ParcelUuid;
6
+
7
+ import com.iotize.android.communication.protocol.ble.Constants;
8
+
9
+ import java.util.ArrayList;
10
+ import java.util.Collections;
11
+ import java.util.List;
12
+
13
+ public class TapUtility {
14
+
15
+ static List<ScanFilter> createTapFilter() {
16
+ if (Build.VERSION.SDK_INT >= 21) {
17
+ List<ScanFilter> filters = new ArrayList();
18
+ ScanFilter.Builder buildFilterTapService = new ScanFilter.Builder();
19
+ buildFilterTapService.setServiceUuid(new ParcelUuid(Constants.SERVICE_SPP_OVER_LE));
20
+ filters.add(buildFilterTapService.build());
21
+ return filters;
22
+ } else {
23
+ return Collections.emptyList();
24
+ }
25
+ }
26
+
27
+ }
@@ -13,7 +13,7 @@ import CoreBluetooth
13
13
  public func printBLE(_ object: Any...) {
14
14
  #if true
15
15
  for item in object {
16
- Swift.print("BLE:", object)
16
+ Swift.print("BLE:", item)
17
17
  }
18
18
  #endif
19
19
  }
@@ -213,14 +213,14 @@ class BLEManager: NSObject, CBCentralManagerDelegate
213
213
  if ( connectionChangeCompletion != nil){
214
214
 
215
215
  if (useBLETapPeripheral) {
216
- bleTapPeripheral?.connect(device: peripheral, manager: self)
216
+ bleTapPeripheral?.connect(device: peripheral, manager: self, connectionChangeCompletion: connectionChangeCompletion)
217
217
  } else {
218
218
  bleGenericPeripheral?.connect(device: peripheral, manager: self)
219
219
  }
220
220
 
221
221
  //callback without error
222
222
 
223
- connectionChangeCompletion!("CONNECTED", nil)
223
+ // connectionChangeCompletion!("CONNECTED", nil) callback moved to didDiscoverCharacteristics
224
224
  // connectionChangeCompletion = nil
225
225
 
226
226
  }
@@ -254,10 +254,9 @@ class BLEManager: NSObject, CBCentralManagerDelegate
254
254
  //callback without error, if we have requested this disconnection
255
255
  if ( disconnectionCompletion != nil){
256
256
  disconnectionCompletion!(nil)
257
- disconnectionCompletion = nil
258
- connectionChangeCompletion = nil
259
- return
260
257
  }
258
+ disconnectionCompletion = nil
259
+ connectionChangeCompletion = nil
261
260
 
262
261
  if (bleGenericPeripheral != nil) {
263
262
  bleGenericPeripheral!.connectedDevice = nil
@@ -265,7 +264,8 @@ class BLEManager: NSObject, CBCentralManagerDelegate
265
264
  }
266
265
  if (bleTapPeripheral != nil) {
267
266
  bleTapPeripheral!.bleDevice = nil
268
- } }
267
+ }
268
+ }
269
269
 
270
270
  func checkConnection(completion: @escaping Completion){
271
271
  if (useBLETapPeripheral) {
@@ -66,6 +66,12 @@ class BLETapPeripheral: NSObject, CBPeripheralDelegate{
66
66
  private static var LEN_PACKET = 19 // MTU = 23 - 3 - 1 num packet
67
67
  private let requestQueueManagementDelay = 0.002
68
68
 
69
+ var connectionStateCompletion: CompletionWithResponse?
70
+
71
+ init(connectionState: CompletionWithResponse?) {
72
+ connectionStateCompletion = connectionState
73
+ }
74
+
69
75
  override init(){
70
76
  super.init()
71
77
  DispatchQueue.global(qos: .background).async {
@@ -73,11 +79,12 @@ class BLETapPeripheral: NSObject, CBPeripheralDelegate{
73
79
  }
74
80
  }
75
81
 
76
- func connect( device: CBPeripheral, manager: BLEManager){
82
+ func connect( device: CBPeripheral, manager: BLEManager, connectionChangeCompletion: CompletionWithResponse?){
77
83
  bleManager = manager
78
84
  lastError = nil
79
85
  bleDevice = device
80
86
  bleDevice.delegate = self
87
+ connectionStateCompletion = connectionChangeCompletion
81
88
  bleDevice.discoverServices([UUID_UPGRADE_SERVICE, SPPoverLE_SERVICE_UUID, SPPoverLE_SERVICE_UUID_FAST])
82
89
  }
83
90
 
@@ -155,6 +162,7 @@ class BLETapPeripheral: NSObject, CBPeripheralDelegate{
155
162
  lastError = IoTizeBleError.CharacteristicSPPNotFound(peripheral: peripheral)
156
163
  } else {
157
164
  self.isReady = true
165
+ connectionStateCompletion?("CONNECTED", nil)
158
166
  }
159
167
  }
160
168