Exemplo n.º 1
0
        private static async Task <RfcommDeviceService> FromIdAsyncImpl(string deviceId)
        {
            if (deviceId.StartsWith("BLUETOOTH#"))
            {
                var parts  = deviceId.Split('#');
                var addr   = parts[1];
                var uuid   = parts[2];
                var device = await BluetoothDevice.FromBluetoothAddressAsync(ulong.Parse(addr, NumberStyles.HexNumber));

                var service = RfcommServiceId.FromUuid(new Guid(uuid));

                return(new RfcommDeviceService(device, service));
            }

            return(null);
        }
Exemplo n.º 2
0
 internal RfcommDeviceService(DeviceInformation deviceInformation)
 {
     _device  = new BluetoothDevice(deviceInformation._deviceInfo);
     _service = RfcommServiceId.FromUuid(deviceInformation._service);
 }