Пример #1
0
        public async static Task <IDevice> Get(string deviceId)
        {
            BluetoothLEDevice ble = await BluetoothLEDevice.FromIdAsync(deviceId);

            //TODO: check device model
            IModel model = new ModelB();

            return(await SensiDevice.Get(ble, model));
        }
Пример #2
0
        private async void SetDeviceByAdddressAsync(ulong bluetoothAddress)
        {
            try
            {
                Device?.Disconnect();
                if (bluetoothAddress != ulong.MaxValue)
                {
                    Device = new SensiDevice(bluetoothAddress);
                    await Device.Connect();

                    Device.OnDisconnect += DisconectDevice;
                    SetDevice(Device);
                }
            }
            catch (Exception ex) { }
        }