/// <summary> /// Connection manager for Bluetooth devices /// </summary> public BluetoothConnectionManager(BluetoothTransport bluetoothTransport, CmdMessenger cmdMessenger, int challengeCommandId, int responseCommandId) : base(cmdMessenger, challengeCommandId, responseCommandId) { WatchdogTimeOut = 2000; WatchdogRetryTimeOut = 1000; MaxWatchdogTries = 3; if (bluetoothTransport == null) { return; } if (cmdMessenger == null) { return; } ControlToInvokeOn = null; _bluetoothTransport = bluetoothTransport; _bluetoothConfiguration = new BluetoothConfiguration(); ReadSettings(); _deviceList = new List <BluetoothDeviceInfo>(); _prevDeviceList = new List <BluetoothDeviceInfo>(); StartConnectionManager(); }
private void ReadSettings() { // Read from file if (File.Exists(SettingsFileName)) { var fileStream = File.OpenRead(SettingsFileName); var deserializer = new BinaryFormatter(); _bluetoothConfiguration = (BluetoothConfiguration)deserializer.Deserialize(fileStream); fileStream.Close(); } }