public BleInfrastructure(IBluetoothLE bluetoothService, IBleExecutionProvider bleExecutionProvider, IBleLogger logger) { Executor = new Executor(logger); BleAvailability = new BleAvailabilityService(bluetoothService, logger); SearchManager = new BleSearchManager(bluetoothService.Adapter, BleAvailability, Executor, logger); ConnectionManager = new BleConnectionManager(bluetoothService.Adapter, BleAvailability, logger); CharacteristicFactory = new CharacteristicFactory(); ExecutionProvider = bleExecutionProvider; Logger = logger; }
public ConnectionManagerViewModel(EventLogger log, MetaPubSub hub) { _log = log; _hub = hub; _hub.Subscribe <ConnectDeviceCommand>(OnConnectDeviceCommand); _hub.Subscribe <StartDiscoveryCommand>(OnStartDiscoveryCommand); _hub.Subscribe <EnterBootCommand>(OnEnterBootCommand); _hub.Subscribe <DeviceWipedEvent>(OnDeviceWipedEvent); var commonAppData = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData); var bondsFilePath = Path.Combine(commonAppData, @"Hideez\bonds"); // ConnectionManager ============================ _connectionManager = new BleConnectionManager(log, bondsFilePath); _connectionManager.AdapterStateChanged += ConnectionManager_AdapterStateChanged; _connectionManager.AdvertismentReceived += ConnectionManager_AdvertismentReceived; // DeviceManager ============================ _deviceManager = new BleDeviceManager(log, _connectionManager); }