Beispiel #1
0
        void OnRead(object sender, CBATTRequestEventArgs args)
        {
            if (!args.Request.Characteristic.Equals(this.native))
            {
                return;
            }

            var result = this.onRead.Invoke(new ReadRequest(
                                                this,
                                                this.cache.GetOrAdd(args.Request.Central),
                                                (int)args.Request.Offset)
                                            );

            if (result.Status == GattState.Success)
            {
                args.Request.Value = NSData.FromArray(result.Data);
                this.manager.RespondToRequest(args.Request, CBATTError.Success);
            }
            else
            {
                this.manager.RespondToRequest(args.Request, CBATTError.InsufficientEncryption);
            }
        }
Beispiel #2
0
 private void HandleReadRequestReceived(object sender, CBATTRequestEventArgs e)
 {
     Covi.Features.BluetoothTracing.TracingState.Instance.SetAdvertisingState(true);
 }