/// <summary>
 /// Store SerialConnectionManagerSettings
 /// </summary>
 /// <param name="bluetoothConnectionManagerSettings">BluetoothConnectionManagerSettings</param>
 public void StoreSettings(BluetoothConnectionManagerSettings bluetoothConnectionManagerSettings)
 {
     var fileStream = File.Create(_settingsFileName);
     var serializer = new BinaryFormatter();
     serializer.Serialize(fileStream, bluetoothConnectionManagerSettings);
     fileStream.Close();
 }
 protected override sealed void ReadSettings()
 {
     if (!PersistentSettings)
     {
         return;
     }
     _bluetoothConnectionManagerSettings = _bluetoothConnectionStorer.RetrieveSettings();
 }
        /// <summary>
        /// Store SerialConnectionManagerSettings
        /// </summary>
        /// <param name="bluetoothConnectionManagerSettings">BluetoothConnectionManagerSettings</param>
        public void StoreSettings(BluetoothConnectionManagerSettings bluetoothConnectionManagerSettings)
        {
            var fileStream = File.Create(_settingsFileName);
            var serializer = new BinaryFormatter();

            serializer.Serialize(fileStream, bluetoothConnectionManagerSettings);
            fileStream.Close();
        }
 /// <summary>
 /// Retreive SerialConnectionManagerSettings
 /// </summary>
 /// <returns>SerialConnectionManagerSettings</returns>
 public BluetoothConnectionManagerSettings RetrieveSettings()
 {
     var bluetoothConnectionManagerSettings = new BluetoothConnectionManagerSettings();
     if (File.Exists(_settingsFileName))
     {
         var fileStream = File.OpenRead(_settingsFileName);
         var deserializer = new BinaryFormatter();
         bluetoothConnectionManagerSettings = (BluetoothConnectionManagerSettings)deserializer.Deserialize(fileStream);
         fileStream.Close();
     }
     return bluetoothConnectionManagerSettings;
 }
        /// <summary>
        /// Retreive SerialConnectionManagerSettings
        /// </summary>
        /// <returns>SerialConnectionManagerSettings</returns>
        public BluetoothConnectionManagerSettings RetrieveSettings()
        {
            var bluetoothConnectionManagerSettings = new BluetoothConnectionManagerSettings();

            if (File.Exists(_settingsFileName))
            {
                var fileStream   = File.OpenRead(_settingsFileName);
                var deserializer = new BinaryFormatter();
                bluetoothConnectionManagerSettings = (BluetoothConnectionManagerSettings)deserializer.Deserialize(fileStream);
                fileStream.Close();
            }
            return(bluetoothConnectionManagerSettings);
        }
        /// <summary>
        /// Connection manager for Bluetooth devices
        /// </summary>
        public BluetoothConnectionManager(BluetoothTransport bluetoothTransport, CmdMessenger cmdMessenger, int watchdogCommandId = 0, string uniqueDeviceId = null, IBluetoothConnectionStorer bluetoothConnectionStorer = null) :
            base(cmdMessenger, watchdogCommandId, uniqueDeviceId)
        {
            if (bluetoothTransport == null)
            {
                throw new ArgumentNullException("bluetoothTransport", "Transport is null.");
            }

            _bluetoothTransport = bluetoothTransport;

            _bluetoothConnectionManagerSettings = new BluetoothConnectionManagerSettings();
            _bluetoothConnectionStorer          = bluetoothConnectionStorer;
            PersistentSettings = (_bluetoothConnectionStorer != null);
            ReadSettings();

            _deviceList     = new List <BluetoothDeviceInfo>();
            _prevDeviceList = new List <BluetoothDeviceInfo>();

            DevicePins  = new Dictionary <string, string>();
            GeneralPins = new List <string>();
        }
        /// <summary>
        /// Connection manager for Bluetooth devices
        /// </summary>
        public BluetoothConnectionManager(BluetoothTransport bluetoothTransport, CmdMessenger cmdMessenger, int watchdogCommandId = 0, string uniqueDeviceId = null, IBluetoothConnectionStorer bluetoothConnectionStorer = null) :
            base(cmdMessenger, watchdogCommandId, uniqueDeviceId)
        {
            if (bluetoothTransport == null) 
                throw new ArgumentNullException("bluetoothTransport", "Transport is null.");

            _bluetoothTransport = bluetoothTransport;

            _bluetoothConnectionManagerSettings = new BluetoothConnectionManagerSettings();
            _bluetoothConnectionStorer = bluetoothConnectionStorer;
            PersistentSettings = (_bluetoothConnectionStorer != null);
            ReadSettings();

            _deviceList = new List<BluetoothDeviceInfo>();
            _prevDeviceList = new List<BluetoothDeviceInfo>();

            DevicePins = new Dictionary<string, string>();
            GeneralPins = new List<string>();
        }
 protected override sealed void ReadSettings()
 {
     if (!PersistentSettings) return;
     _bluetoothConnectionManagerSettings = _bluetoothConnectionStorer.RetrieveSettings();
 }