@@ -56,18 +56,14 @@ function nativeEncoding(encoding: string) {
5656
5757function valueToNSData ( value : any , encoding = 'iso-8859-1' ) {
5858 if ( value instanceof NSData ) {
59- // console.log('valueToNSData converting from NSData');
6059 return value ;
6160 } else if ( value instanceof ArrayBuffer ) {
6261 // for ArrayBuffer to NSData
63- // console.log('valueToNSData converting from ArrayBuffer');
6462 return NSData . dataWithData ( value as any ) ;
6563 } else if ( value . buffer ) {
6664 // typed array
67- // console.log('valueToNSData converting from Typed array', Object.prototype.toString.call(value), value[0], value[1], value[2], value[3]);
6865 return NSData . dataWithData ( value . buffer ) ;
6966 } else if ( Array . isArray ( value ) ) {
70- // console.log('valueToNSData converting from Array');
7167 return NSData . dataWithData ( new Uint8Array ( value ) . buffer as any ) ;
7268 }
7369 const type = typeof value ;
@@ -663,7 +659,9 @@ export class Bluetooth extends BluetoothCommon {
663659 _state : CBManagerState = CBManagerState . Unsupported ;
664660 set state ( state : CBManagerState ) {
665661 if ( this . _state !== state ) {
666- console . log ( 'on ble state change' , state ) ;
662+ if ( Trace . isEnabled ( ) ) {
663+ CLog ( CLogTypes . info , 'BLE state change' , state ) ;
664+ }
667665 this . _state = state ;
668666 this . sendEvent ( BluetoothCommon . bluetooth_status_event , {
669667 state : state === CBManagerState . Unsupported ? 'unsupported' : state === CBManagerState . PoweredOn ? 'on' : 'off' ,
@@ -682,17 +680,15 @@ export class Bluetooth extends BluetoothCommon {
682680 }
683681
684682 ensureCentralManager ( ) {
683+
685684 if ( ! this . _centralManager ) {
686685 const options : NSMutableDictionary < any , any > = new ( NSMutableDictionary as any ) ( [ this . showPowerAlertPopup ] , [ CBCentralManagerOptionShowPowerAlertKey ] ) ;
687686 if ( this . restoreIdentifier ) {
688687 options . setObjectForKey ( this . restoreIdentifier , CBCentralManagerOptionRestoreIdentifierKey ) ;
689688 }
690689 this . _centralManager = CBCentralManager . alloc ( ) . initWithDelegateQueueOptions ( this . centralDelegate , null , options ) ;
691- // setTimeout(() => {
692- // this.state = this._centralManager.state;
693- // }, 100);
694690 if ( Trace . isEnabled ( ) ) {
695- CLog ( CLogTypes . info , `this._centralManager : ${ this . _centralManager } ` ) ;
691+ CLog ( CLogTypes . info , `creating CBCentralManager : ${ this . _centralManager } ` ) ;
696692 }
697693 }
698694 }
@@ -703,7 +699,9 @@ export class Bluetooth extends BluetoothCommon {
703699
704700 constructor ( private restoreIdentifier : string = 'ns_bluetooth' , private showPowerAlertPopup = false ) {
705701 super ( ) ;
706- console . log ( `*** iOS Bluetooth Constructor *** ${ restoreIdentifier } ` ) ;
702+ if ( Trace . isEnabled ( ) ) {
703+ CLog ( CLogTypes . info , 'Creating Bluetooth instance' , restoreIdentifier ) ;
704+ }
707705 }
708706
709707 onListenerAdded ( eventName : string , count : number ) {
0 commit comments