public GattDescriptor(IGattCharacteristic characteristic, PeripheralContext context, BluetoothGattDescriptor native) : base(characteristic, native.Uuid.ToString()) { this.context = context; this.native = native; }
public Peripheral( ManagerContext centralContext, BluetoothDevice native ) : base( native.Name, ToDeviceId(native.Address).ToString() ) { this.connSubject = new Subject <ConnectionState>(); this.Context = new PeripheralContext(centralContext, native); }
public GattService( IPeripheral peripheral, PeripheralContext context, BluetoothGattService native ) : base( peripheral, native.Uuid.ToString(), native.Type == GattServiceType.Primary ) { this.context = context; this.native = native; }
public GattCharacteristic( PeripheralContext context, Native native, IGattService service ) : base( service, native.Uuid.ToString(), (CharacteristicProperties)native.CharacteristicProperties ) { this.context = context; this.Native = native; }
public GattCharacteristic( IGattService service, PeripheralContext context, BluetoothGattCharacteristic native ) : base( service, native.Uuid.ToString(), (CharacteristicProperties)(int)native.Properties ) { this.context = context; this.native = native; }
// BluetoothLEAdvertisementWatcher private void OnWatcherReceived(BluetoothLEAdvertisementWatcher watcher, BluetoothLEAdvertisementReceivedEventArgs args) { // Utils.Info("OnWatcherReceived: {0}", args.Advertisement.ManufacturerData.Count); lock (mLockObject) { if (mStatus != Status.Scan) { Utils.Error("invalid status: {0}", mStatus.ToString()); return; } if (mDiscoveredPeripherals.Exists(ctx => ctx.Address == args.BluetoothAddress)) { return; } string deviceName = args.Advertisement.LocalName; if (string.IsNullOrEmpty(deviceName)) { // HACK: ScanResponseが取得できないので暫定 deviceName = args.BluetoothAddress.ToString(); /* * Utils.Error("device-name not exists"); * return; */ } var context = new PeripheralContext(args.BluetoothAddress, mNextPeripheralId++, deviceName); mDiscoveredPeripherals.Add(context); Utils.Info("discover deviceName: {0} deviceId: {1}", context.Name, context.Id); mCallback.OnDiscover(context.Name, context.Id); } }
public GattService(PeripheralContext context, Native native) : base(context.Peripheral, native.Uuid.ToString(), false) { this.context = context; this.native = native; }
public Peripheral(ManagerContext managerContext, BluetoothLEDevice native) { this.context = new PeripheralContext(managerContext, this, native); this.Name = native.Name; this.Uuid = native.GetDeviceId().ToString(); }
public GattReliableWriteTransaction(PeripheralContext context) { this.context = context; this.context.Gatt.BeginReliableWrite(); }