Example #1
0
 /// <summary>
 /// Registers a specified service to this server.
 /// </summary>
 /// <param name="service">The service, which needs to be registered with this server.</param>
 /// <exception cref="NotSupportedException">Thrown when the BT/BTLE is not supported.</exception>
 /// <exception cref="InvalidOperationException">Thrown when the register service fails.</exception>
 /// <since_tizen> 3 </since_tizen>
 public void RegisterGattService(BluetoothGattService service)
 {
     if (service.IsRegistered())
     {
         BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter);
     }
     _impl.RegisterGattService(this, service);
 }
Example #2
0
        /// <summary>
        /// Includes a service to this service.
        /// </summary>
        /// <param name="service">The service to be included.</param>
        /// <returns>true on success, false otherwise</returns>
        /// <exception cref="InvalidOperationException">Thrown when the add GATT service procedure fails.</exception>///
        /// <since_tizen> 3 </since_tizen>
        public void AddService(BluetoothGattService service)
        {
            if (GetGattClient() != null)
            {
                BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotSupported);
            }

            if (service.IsRegistered())
            {
                BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.InvalidParameter);
            }

            _impl.AddIncludeService(service);
            service.SetParent(this);
        }