Task <List <BluetoothRemoteGATTService> > DoGetPrimaryServices(Guid?service)
        {
            return(Task.Run(() =>
            {
                var services = new List <BluetoothRemoteGATTService>();

                EventWaitHandle handle = new EventWaitHandle(false, EventResetMode.AutoReset);

                BluetoothRemoteGATTService matchingService = null;

                ((CBPeripheral)Device).DiscoveredService += (sender, args) =>
                {
                    handle.Set();
                };

                if (service.HasValue)
                {
                    ((CBPeripheral)Device).DiscoverServices(new CBUUID[] { service.Value.ToCBUUID() });
                }
                else
                {
                    ((CBPeripheral)Device).DiscoverServices();
                }

                handle.WaitOne();

                foreach (CBService cbservice in ((CBPeripheral)Device).Services)
                {
                    services.Add(new BluetoothRemoteGATTService(Device, cbservice));
                }

                return services;
            }));
        }
Exemplo n.º 2
0
 internal GattCharacteristic(BluetoothRemoteGATTService service)
 {
     Service = service;
 }
Exemplo n.º 3
0
 internal GattCharacteristic(BluetoothRemoteGATTService service, Android.Bluetooth.BluetoothGattCharacteristic characteristic) : this(service)
 {
     _characteristic = characteristic;
 }
Exemplo n.º 4
0
 internal GattCharacteristic(BluetoothRemoteGATTService service, Uap.GattCharacteristic characteristic) : this(service)
 {
     _characteristic = characteristic;
 }