@@ -256,7 +256,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
256256 // MARK: Scan
257257
258258 func scanStart( serviceUuids: [ String ] ? , promise: Promise ) {
259- print ( " [BleLibrary] scanStart( \( serviceUuids, default : " [] " ) " )
259+ print ( " [BleLibrary] scanStart( \( serviceUuids ?? [ ] ) " )
260260 guard self . isModuleInitialized else {
261261 print ( " [BleLibrary] manager is not initialized " )
262262 return promise. reject (
@@ -310,7 +310,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
310310 promise: Promise
311311 ) {
312312 print (
313- " [BleLibrary] connect( \( deviceId) , \( mtu) , \( options, default : " null " ) ) "
313+ " [BleLibrary] connect( \( deviceId) , \( mtu) , \( options ?? [ : ] ) "
314314 )
315315 guard self . isModuleInitialized else {
316316 print ( " [BleLibrary] module is not initialized " )
@@ -799,7 +799,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
799799 error: Error ?
800800 ) {
801801 print (
802- " [BleLibrary] error connecting to peripheral \( peripheral) (error: \( error , default : " nil " ) "
802+ " [BleLibrary] error connecting to peripheral \( peripheral) (error: \( String ( describing : error ) ) "
803803 )
804804
805805 // Cancel connection promise if present
@@ -913,7 +913,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
913913 ) {
914914 if let error = error {
915915 print (
916- " [BleLibrary] error discovering characteristics for service \( service. uuid) (error: \( error , default : " null " ) "
916+ " [BleLibrary] error discovering characteristics for service \( service. uuid) (error: \( String ( describing : error ) ) "
917917 )
918918 // Cancel connection promise if present
919919 if let p = connectionPromise {
@@ -1030,7 +1030,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
10301030 )
10311031 } else {
10321032 print (
1033- " [BleLibrary] disconnected from peripheral \( peripheral) failed (error: \( error , default : " null " ) . Trigger new connection "
1033+ " [BleLibrary] disconnected from peripheral \( peripheral) failed (error: \( String ( describing : error ) ) . Trigger new connection "
10341034 )
10351035
10361036 module. sendEvent (
@@ -1090,7 +1090,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
10901090 print ( " [BleLibrary] read RSSI success, RSSI = \( RSSI) " )
10911091 t. succeed ( RSSI)
10921092 } else {
1093- print ( " [BleLibrary] read RSSI error (error: \( error , default : " null " ) " )
1093+ print ( " [BleLibrary] read RSSI error (error: \( String ( describing : error ) ) " )
10941094 t. fail ( ERROR_GATT, ( error! as NSError ) . description)
10951095 }
10961096 transactionById. removeValue ( forKey: t. transactionId)
@@ -1145,7 +1145,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
11451145 }
11461146 } else {
11471147 print (
1148- " [BleLibrary] write value failure (error: \( error , default : " null " ) "
1148+ " [BleLibrary] write value failure (error: \( String ( describing : error ) ) "
11491149 )
11501150 write. fail ( ERROR_GATT, error? . localizedDescription ?? " " )
11511151 transactionById. removeValue ( forKey: write. transactionId)
@@ -1200,7 +1200,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
12001200 }
12011201 } else {
12021202 print (
1203- " [BleLibrary] read value failure (error: \( error , default : " null " ) "
1203+ " [BleLibrary] read value failure (error: \( String ( describing : error ) ) "
12041204 )
12051205 read. fail ( ERROR_GATT, " error reading characteristic " )
12061206 transactionById. removeValue ( forKey: read. transactionId)
@@ -1253,7 +1253,7 @@ private final class BleLibraryImpl: NSObject, CBCentralManagerDelegate,
12531253 transaction. succeed ( nil )
12541254 } else {
12551255 print (
1256- " [BleLibrary] characteristic \( characteristic. uuid) notification state update (error: \( error , default : " null " ) "
1256+ " [BleLibrary] characteristic \( characteristic. uuid) notification state update (error: \( String ( describing : error ) ) "
12571257 )
12581258 transaction. fail ( ERROR_GATT, " error setting notification " )
12591259 }
@@ -1338,6 +1338,7 @@ public final class ReactNativeBleLibraryModule: Module {
13381338 OnStartObserving {
13391339 print ( " [BleLibrary] NativeEventListener registered " )
13401340 }
1341+
13411342 OnStopObserving {
13421343 print ( " [BleLibrary] NativeEventListener removed " )
13431344 }
0 commit comments