Beispiel #1
0
        public BLEService(CBService nativeService)
        {
            _nativeService  = nativeService;
            Characteristics = new List <IBLECharacteristic>();

            Guid      = Guid.Parse(_nativeService.UUID.ToString());
            IsPrimary = _nativeService.Primary;

            foreach (var item in _nativeService.Characteristics)
            {
                var characteristic = new BLECharacteristic(item);
                Characteristics.Add(characteristic);
            }
        }
Beispiel #2
0
        //TODO Submit Bug to change the methid name to "DiscoveredCharacteristics" as this method will fire only when all the Characteristics are discovered
        public override void DiscoveredCharacteristic(CBPeripheral peripheral, CBService service, NSError error)
        {
            base.DiscoveredCharacteristic(peripheral, service, error);

            foreach (var item in service.Characteristics)
            {
                var characteristic = new BLECharacteristic(item);

                if (peripheral.Delegate == null)
                {
                    peripheral.Delegate = this;
                }

                characteristicList.Add(characteristic);
            }

            _deviceTaskCompletitionSource.CharacteristicDiscoveryTCS.SetResult(characteristicList);
        }