public BTdevice(ref logging lg) { log = lg; try { preparePSWMD0C(); #if USE_SSAPI BTpower btPower = new BTpower(); if (btPower.IsBluetoothOn() == false) { log.WriteLog("BT power is OFF, trying to switch ON..."); btPower.TurnOnBluetooth(); if (btPower.IsBluetoothOn() == false) { log.WriteLog("BT power switch ON failed"); } else { log.WriteLog("BT power is now ON"); } } else { log.WriteLog("BT power was ON, no change"); } //btPower.Dispose(); #endif _deviceUtility = new DeviceUtility(); _deviceUtility.Initialize(xmlFileName); } catch (DeviceUtilityException ex) { log.WriteLog("DeviceUtilityException in BTdevice(): " + ex.Message); _deviceUtility = null; } catch (Exception ex) { log.WriteLog("Exception in BTdevice(): " + ex.Message); _deviceUtility = null; } log.WriteLog("BTdevice() OK"); }
public BTdevice(ref logging lg) { log = lg; try { preparePSWMD0C(); #if USE_SSAPI BTpower btPower = new BTpower(); if (btPower.IsBluetoothOn() == false) { log.WriteLog("BT power is OFF, trying to switch ON..."); btPower.TurnOnBluetooth(); if (btPower.IsBluetoothOn() == false) log.WriteLog("BT power switch ON failed"); else log.WriteLog("BT power is now ON"); } else log.WriteLog("BT power was ON, no change"); //btPower.Dispose(); #endif _deviceUtility = new DeviceUtility(); _deviceUtility.Initialize(xmlFileName); } catch (DeviceUtilityException ex) { log.WriteLog("DeviceUtilityException in BTdevice(): " + ex.Message); _deviceUtility = null; } catch (Exception ex) { log.WriteLog("Exception in BTdevice(): " + ex.Message); _deviceUtility = null; } log.WriteLog("BTdevice() OK"); }