public UwpGattCharacteristic(IGattService service, Guid characteristicUuid, CharacteristicProperties properties, GattPermissions permissions) : base(service, characteristicUuid, properties, permissions) { this.nativeReady = new Subject <GattLocalCharacteristic>(); this.connectedDevices = new List <IDevice>(); this.SubscribedDevices = new ReadOnlyCollection <IDevice>(this.connectedDevices); }
protected AbstractGattCharacteristic(IGattService service, Guid characteristicUuid, CharacteristicProperties properties, GattPermissions permissions) { this.Service = service; this.Uuid = characteristicUuid; this.Properties = properties; this.Permissions = permissions; this.InternalDescriptors = new List <IGattDescriptor>(); this.Descriptors = new ReadOnlyCollection <IGattDescriptor>(this.InternalDescriptors); }
public static Android.Bluetooth.GattPermission ToDroidGattPermission(this GattPermissions gattPermission) { int permissionCode = 0; if (gattPermission.Read) { permissionCode |= (int)Android.Bluetooth.GattPermission.Read; } if (gattPermission.Write) { permissionCode |= (int)Android.Bluetooth.GattPermission.Write; } return((Android.Bluetooth.GattPermission)permissionCode); }
public static GattPermissions ToGattPermissions(this Android.Bluetooth.GattPermission self) { int permissionsCode = (int)self; GattPermissions permissions = new GattPermissions(); if ((self &= Android.Bluetooth.GattPermission.Read) != 0) { permissions.Read = true; } if ((self &= Android.Bluetooth.GattPermission.Write) != 0) { permissions.Write = true; } return(permissions); }
public GattCharacteristic(CBPeripheralManager manager, IGattService service, Guid characteristicUuid, CharacteristicProperties properties, GattPermissions permissions) : base(service, characteristicUuid, properties, permissions) { this.manager = manager; this.subscribers = new ConcurrentDictionary <NSUuid, IDevice>(); this.Native = new CBMutableCharacteristic( characteristicUuid.ToCBUuid(), properties.ToNative(), null, (CBAttributePermissions)(int)permissions // TODO ); }
public GattCharacteristic(GattContext context, IGattService service, Guid uuid, CharacteristicProperties properties, GattPermissions permissions) : base(service, uuid, properties, permissions) { this.context = context; this.subscribers = new Dictionary <string, IDevice>(); this.Native = new BluetoothGattCharacteristic( uuid.ToUuid(), properties.ToNative(), permissions.ToNative() ); this.NotificationDescriptor = new BluetoothGattDescriptor( NotifyDescriptorId.ToUuid(), GattDescriptorPermission.Write | GattDescriptorPermission.Read ); this.Native.AddDescriptor(this.NotificationDescriptor); }
protected override IGattCharacteristic CreateNative(Guid uuid, CharacteristicProperties properties, GattPermissions permissions) { return(new GattCharacteristic(this.context, this, uuid, properties, permissions)); }
public static GattPermission ToNative(this GattPermissions permissions) => (GattPermission)Enum.Parse(typeof(GattPermission), permissions.ToString());
public GattServerCharacteristic(Guid uuid, GattCharacteristicProperties properties, GattPermissions permission) { DroidCharacteristic = new Android.Bluetooth.BluetoothGattCharacteristic(uuid.ToJavaUuid(), properties.ToDroidGattProperty(), permission.ToDroidGattPermission()); _Descritptor = new List <GattServerDescriptor>(); }
public IGattDescriptorBuilder SetPermissions(GattPermissions permissions) { Permissions = permissions; return(this); }
protected override IGattCharacteristic CreateNative(Guid uuid, CharacteristicProperties properties, GattPermissions permissions) => new UwpGattCharacteristic(this, uuid, properties, permissions);
public GattServerDescriptor(Guid uuid, GattPermissions permissions) { DroidDescriptor = new Android.Bluetooth.BluetoothGattDescriptor(uuid.ToJavaUuid(), permissions.ToDroidGattDescriptorPermission()); }
protected abstract IGattCharacteristic CreateNative(Guid uuid, CharacteristicProperties properties, GattPermissions permissions);
public virtual IGattCharacteristic AddCharacteristic(Guid uuid, CharacteristicProperties properties, GattPermissions permissions) { var characteristic = this.CreateNative(uuid, properties, permissions); this.internalList.Add(characteristic); return(characteristic); }
public IGattCharacteristicBuilder SetPermissions(GattPermissions permissions) { Permissions = permissions; return(this); }
protected override IGattCharacteristic CreateNative(Guid uuid, CharacteristicProperties properties, GattPermissions permissions) { var ch = new GattCharacteristic(this.context, this, uuid, properties, permissions); this.Native.AddCharacteristic(ch.Native); return(ch); }