Пример #1
0
 public Characteristic(BluetoothGattCharacteristic nativeCharacteristic, BluetoothGatt gatt, GattCallback gattCallback)
 {
     _nativeCharacteristic = nativeCharacteristic;
     _gatt         = gatt;
     _gattCallback = gattCallback;
     if (_gattCallback != null)
     {
         _gattCallback.CharacteristicValueUpdated += ValueUpdatedFunction;
     }
 }
Пример #2
0
 public Device(BluetoothDevice nativeDevice, BluetoothGatt gatt, GattCallback gattCallback, int rssi) : base()
 {
     Disposed          = false;
     this.nativeDevice = nativeDevice;
     this.gatt         = gatt;
     this.gattCallback = gattCallback;
     this.rssi         = rssi;
     // when the services are discovered on the gatt callback, cache them here
     if (this.gattCallback != null)
     {
         this.gattCallback.ServicesDiscovered += (s, e) =>
         {
             var services = this.gatt.Services;
             this.services = new List <IService>();
             foreach (var item in services)
             {
                 this.services.Add(new Service(item, this.gatt, this.gattCallback));
             }
             this.ServicesDiscovered(this, e);
         };
     }
 }
Пример #3
0
 public Service(BluetoothGattService nativeService, BluetoothGatt gatt, GattCallback _gattCallback)
 {
     this._nativeService = nativeService;
     this._gatt          = gatt;
     this._gattCallback  = _gattCallback;
 }