Exemple #1
0
        /// <summary>
        /// Adds a descriptor to this characteristic.
        /// </summary>
        /// <param name="descriptor">The descriptor to be added.</param>
        /// <returns>true on success, false otherwise.</returns>
        /// <exception cref="InvalidOperationException">Thrown when the add GATT descriptor procedure fails.</exception>
        /// <since_tizen> 3 </since_tizen>
        public void AddDescriptor(BluetoothGattDescriptor descriptor)
        {
            if (Client != null)
            {
                BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotSupported);
            }

            if (descriptor.GetCharacteristic() != null)
            {
                BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter);
            }

            _impl.AddDescriptor(descriptor);
            descriptor.SetParent(this);
        }