Exemple #1
0
        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
                );
        }
Exemple #2
0
        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);
        }