Пример #1
0
        // Constructor
        public Racer(BluetoothLEDevice device)
        {
            XValue = 128;
            YValue = 128;
            ZValue = 255;
            BValue = 0;

            this._device   = device;
            _addressString = device.BluetoothAddress.ToString("x012");
            try
            {
                linkLossService = device.GetGattService(GattServiceUuids.LinkLoss);
            }
            catch (Exception)
            {
                // e.HResult == 0x80070490 means that the device doesn't have the requested service.
                // We can still alert on the phone upon disconnection, but cannot ask the device to alert.
                // linkLossServer will remain equal to null.
            }

            if (localSettings.Values.ContainsKey(_addressString))
            {
                string[] values = ((string)localSettings.Values[_addressString]).Split(',');
                alertOnPhone  = bool.Parse(values[0]);
                alertOnDevice = bool.Parse(values[1]);
                alertLevel    = (AlertLevel)Enum.Parse(typeof(AlertLevel), values[2]);
            }
        }
Пример #2
0
        // Constructor
        public KeyFob(BluetoothLEDevice device)
        {
            this.device = device;
            addressString = device.BluetoothAddress.ToString("x012");
            try
            {
                linkLossService = device.GetGattService(GattServiceUuids.LinkLoss);
            }
            catch (Exception)
            {
                // e.HResult == 0x80070490 means that the device doesn't have the requested service.
                // We can still alert on the phone upon disconnection, but cannot ask the device to alert.
                // linkLossServer will remain equal to null.
            }

            if (localSettings.Values.ContainsKey(addressString))
            {
                string[] values = ((string)localSettings.Values[addressString]).Split(',');
                alertOnPhone = bool.Parse(values[0]);
                alertOnDevice = bool.Parse(values[1]);
                alertLevel = (AlertLevel)Enum.Parse(typeof(AlertLevel), values[2]);
            }
        }
Пример #3
0
 public GattService(Native native, IDevice device) : base(device, native.Uuid, false)
 {
     this.native = native;
 }
Пример #4
0
 public GattService(DeviceContext context, Native native) : base(context.Device, native.Uuid, false)
 {
     this.context = context;
     this.native  = native;
 }
Пример #5
0
 private GattDeviceService(Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService service)
 {
     _service = service;
 }
Пример #6
0
 internal GattDeviceService(Windows.Devices.Bluetooth.BluetoothLEDevice device, Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService service)
 {
     _device  = device;
     _service = service;
 }
Пример #7
0
 private void DoDispose()
 {
     _service.Dispose();
     _service = null;
 }