Tizen(Headless) Native API  6.0
Bluetooth GATT Server

Bluetooth GATT (Generic Attribute Profile) Server API provides functions for modifying attributes and registering services, characteristics and descriptors.

Required Header

#include <bluetooth.h>

Overview

Two roles are defined for devices that implement GATT. The Server is the device that accepts incoming commands and requests from a client and sends responses, indications and notifications to the client. The Client is the device that initiates commands and requests towards a server and can receive responses, indications and notifications sent by the server.

Related Features

This API supports both Server role in GATT.
This API is related with the following features:

  • http://tizen.org/feature/network.bluetooth.le.gatt.server

It is recommended to create an application with regard to features, to increase reliability.

You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Functions

int bt_gatt_service_destroy (bt_gatt_h gatt_handle)
 Destroys the GATT handle of service.
int bt_gatt_characteristic_destroy (bt_gatt_h gatt_handle)
 Destroys the GATT handle of characteristic.
int bt_gatt_descriptor_destroy (bt_gatt_h gatt_handle)
 Destroys the GATT handle of descriptor.
int bt_gatt_service_create (const char *uuid, bt_gatt_service_type_e type, bt_gatt_h *service)
 Creates the GATT service.
int bt_gatt_service_add_characteristic (bt_gatt_h service, bt_gatt_h characteristic)
 Adds a characteristic to a specified service.
int bt_gatt_service_add_included_service (bt_gatt_h service, bt_gatt_h included_service)
 Adds a service to a specified service as included service.
int bt_gatt_service_get_server (bt_gatt_h service, bt_gatt_server_h *server)
 Gets the GATT server handle to which the specified service belongs.
int bt_gatt_characteristic_add_descriptor (bt_gatt_h characteristic, bt_gatt_h descriptor)
 Adds a descriptor to a specified characteristic.
int bt_gatt_server_initialize (void)
 Initializes the GATT Server.
int bt_gatt_server_deinitialize (void)
 DeInitializes the GATT server.
int bt_gatt_server_create (bt_gatt_server_h *server)
 Creates the GATT server's handle.
int bt_gatt_server_destroy (bt_gatt_server_h server)
 Destroys the GATT server's handle.
int bt_gatt_server_set_read_value_requested_cb (bt_gatt_h gatt_handle, bt_gatt_server_read_value_requested_cb callback, void *user_data)
 Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client).
int bt_gatt_server_set_characteristic_notification_state_change_cb (bt_gatt_h gatt_handle, bt_gatt_server_characteristic_notification_state_changed_cb callback, void *user_data)
 Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.
int bt_gatt_server_set_write_value_requested_cb (bt_gatt_h gatt_handle, bt_gatt_server_write_value_requested_cb callback, void *user_data)
 Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request.
int bt_gatt_server_register_service (bt_gatt_server_h server, bt_gatt_h service)
 Registers a specified service to the specified GATT server that the local device is hosting.
int bt_gatt_server_unregister_service (bt_gatt_server_h server, bt_gatt_h service)
 Unregisters a specified service from the specified GATT server that the local device is hosting.
int bt_gatt_server_unregister_all_services (bt_gatt_server_h server)
 Unregisters all services from the specified GATT server that the local device is hosting.
int bt_gatt_server_start (void)
 Registers the application along with the GATT services of the application it is hosting.
int bt_gatt_server_send_response (int request_id, bt_gatt_att_request_type_e request_type, int offset, int resp_status, char *value, int value_length)
 Sends a response to the remote device as a result of a read/write request.
int bt_gatt_server_notify_characteristic_changed_value (bt_gatt_h characteristic, bt_gatt_server_notification_sent_cb callback, const char *device_address, void *user_data)
 Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor.
int bt_gatt_server_get_service (bt_gatt_server_h server, const char *uuid, bt_gatt_h *service)
 Gets a service's GATT handle which has specific UUID.
int bt_gatt_server_foreach_services (bt_gatt_server_h server, bt_gatt_foreach_cb callback, void *user_data)
 Invokes callback function on each service that belongs to the specified GATT server.
int bt_gatt_server_get_device_mtu (const char *remote_address, unsigned int *mtu)
 Gets an ATT MTU value for a connection.

Typedefs

typedef void * bt_gatt_server_h
 The handle of a GATT server.
typedef void(* bt_gatt_server_write_value_requested_cb )(const char *remote_address, int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle, bool response_needed, int offset, const char *value, int len, void *user_data)
 Called when a value of a characteristic or descriptor's GATT handle has been changed.
typedef void(* bt_gatt_server_read_value_requested_cb )(const char *remote_address, int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle, int offset, void *user_data)
 Called when the remote device requests to read a value on a GATT server.
typedef void(* bt_gatt_server_characteristic_notification_state_changed_cb )(bool notify, bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data)
 Called when the remote device enables or disables the Notification/Indication for particular characteristics.
typedef void(* bt_hrp_sensor_characteristic_notification_state_changed_cb )(bool notify, bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data)
 Called when the remote device enables or disables the Notification/Indication for particular characteristics for HRP.
typedef void(* bt_gatt_server_notification_sent_cb )(int result, const char *remote_address, bt_gatt_server_h server, bt_gatt_h characteristic, bool completed, void *user_data)
 Called when the sending notification / indication is done.

Typedef Documentation

typedef void(* bt_gatt_server_characteristic_notification_state_changed_cb)(bool notify, bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data)

Called when the remote device enables or disables the Notification/Indication for particular characteristics.

By using this callback function, server can know notification state.

Since :
3.0
Remarks:
The server must not be freed by application.
The gatt_handle must not be freed by application.
Parameters:
[in]notifyIndicates whether the Notification/Indication is enabled or not
[in]serverThe GATT server handle
[in]gatt_handleThe characteristic's GATT handle to be read
[in]user_dataThe user data passed from the registration function
See also:
bt_gatt_server_set_read_value_requested_cb()
typedef void* bt_gatt_server_h

The handle of a GATT server.

Since :
3.0
typedef void(* bt_gatt_server_notification_sent_cb)(int result, const char *remote_address, bt_gatt_server_h server, bt_gatt_h characteristic, bool completed, void *user_data)

Called when the sending notification / indication is done.

Since :
3.0
Remarks:
The remote_address must not be freed by application.
The server must not be freed by application.
The characteristic must not be freed by application.
In case of an indication, once a confirmation is received from the remote device this callback will be called.
This callback will be called several times if there are two or more remote devices which enable a Client Characteristic Configuration Descriptor(CCCD).
For the last remote device, completed will be set as true.
Parameters:
[in]resultThe result of a sending operation
[in]remote_addressThe address of the remote device
[in]serverThe GATT server handle
[in]characteristicThe characteristic's GATT handle
[in]completedIf this callback is for the last remote device which enables a CCCD, it will be true. Or it will be false.
[in]user_dataThe user data passed from the requesting function
See also:
bt_gatt_server_notify_characteristic_changed_value()
typedef void(* bt_gatt_server_read_value_requested_cb)(const char *remote_address, int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle, int offset, void *user_data)

Called when the remote device requests to read a value on a GATT server.

For finishing the request, call the function bt_gatt_server_send_response in callback.

Since :
3.0
Remarks:
The remote_address must not be freed by application.
The server must not be freed by application.
The gatt_handle must not be freed by application.
Parameters:
[in]remote_addressThe address of the requesting remote device
[in]request_idThe identification of this request. It will be used to send a response.
[in]serverThe GATT server handle
[in]gatt_handleThe characteristic or descriptor's GATT handle to be read
[in]offsetThe requested offset from where the GATT handle's value is read
[in]user_dataThe user data passed from the registration function
See also:
bt_gatt_server_set_read_value_requested_cb()
bt_gatt_server_send_response()
typedef void(* bt_gatt_server_write_value_requested_cb)(const char *remote_address, int request_id, bt_gatt_server_h server, bt_gatt_h gatt_handle, bool response_needed, int offset, const char *value, int len, void *user_data)

Called when a value of a characteristic or descriptor's GATT handle has been changed.

For finishing the request, call the function bt_gatt_server_send_response in callback.

Since :
3.0
Remarks:
After this function is returned, a changed value is automatically
applied to gatt_handle. Before that, gatt_handle has an old value.
The remote_address must not be freed by application.
The server must not be freed by application.
The gatt_handle must not be freed by application.
The value must not be freed by application.
Parameters:
[in]remote_addressThe address of the remote device which requests a change
[in]request_idThe identification of this request. It will be used to send a response.
[in]serverThe GATT server handle
[in]gatt_handleThe characteristic or descriptor's GATT handle which has an old value
[in]response_neededIndicates whether a response is required by the remote device - true if required, false if not
[in]offsetThe requested offset from where the gatt_handle value will be updated
[in]valueThe new value
[in]lenThe length of value
[in]user_dataThe user data passed from the registration function
See also:
bt_gatt_server_set_write_value_requested_cb()
bt_gatt_server_send_response()
typedef void(* bt_hrp_sensor_characteristic_notification_state_changed_cb)(bool notify, bt_gatt_server_h server, bt_gatt_h gatt_handle, void *user_data)

Called when the remote device enables or disables the Notification/Indication for particular characteristics for HRP.

By using this callback function, server can know notification state.

Since :
3.0
Remarks:
The server must not be freed by application.
The gatt_handle must not be freed by application.
Parameters:
[in]notifyIndicates whether the Notification/Indication is enabled or not
[in]serverThe GATT server handle
[in]gatt_handleThe characteristic's GATT handle to be read
[in]user_dataThe user data passed from the registration function

Enumeration Type Documentation

Enumerations of the remote device request types for attributes.

Since :
3.0
Enumerator:
BT_GATT_REQUEST_TYPE_READ 

Read Requested

BT_GATT_REQUEST_TYPE_WRITE 

Write Requested


Function Documentation

int bt_gatt_characteristic_add_descriptor ( bt_gatt_h  characteristic,
bt_gatt_h  descriptor 
)

Adds a descriptor to a specified characteristic.

Since :
3.0
Parameters:
[in]characteristicThe GATT handle of the characteristic
[in]descriptorThe descriptor's GATT handle to be added
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_characteristic_create()
bt_gatt_descriptor_create()

Destroys the GATT handle of characteristic.

Since :
3.0
Parameters:
[in]gatt_handleThe handle of characteristic
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_characteristic_create()
int bt_gatt_descriptor_destroy ( bt_gatt_h  gatt_handle)

Destroys the GATT handle of descriptor.

Since :
3.0
Parameters:
[in]gatt_handleThe handle of descriptor
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_descriptor_create()

Creates the GATT server's handle.

Since :
3.0
Remarks:
The server handle should be destroyed by using bt_gatt_server_destroy().
Parameters:
[out]serverThe GATT server's handle
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_OUT_OF_MEMORYOut of memory
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_destroy()

DeInitializes the GATT server.

Since :
3.0
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
See also:
bt_gatt_server_initialize()

Destroys the GATT server's handle.

Since :
3.0
Remarks:
All registered services to GATT server are unregistered.
Parameters:
[in]serverThe GATT server's handle
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_create()
int bt_gatt_server_foreach_services ( bt_gatt_server_h  server,
bt_gatt_foreach_cb  callback,
void *  user_data 
)

Invokes callback function on each service that belongs to the specified GATT server.

Since :
3.0
Parameters:
[in]serverThe GATT server's handle
[in]callbackThe function to be invoked on each service
[in]user_dataThe user data to be passed to callback function
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_foreach_cb()
int bt_gatt_server_get_device_mtu ( const char *  remote_address,
unsigned int *  mtu 
)

Gets an ATT MTU value for a connection.

Since :
5.5
Parameters:
[in]remote_addressThe address of the remote Bluetooth device
[out]mtuThe MTU value for a connection
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_SUPPORTEDNot supported
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
int bt_gatt_server_get_service ( bt_gatt_server_h  server,
const char *  uuid,
bt_gatt_h service 
)

Gets a service's GATT handle which has specific UUID.

Since :
3.0
Remarks:
The returned GATT handle must not be freed by application.
It will be freed when an associated server is destroyed by bt_gatt_server_destroy().
If there are multiple services which have same UUID, only the first matched one will be returned.
Parameters:
[in]serverThe GATT server's handle
[in]uuidThe service's GATT handle which has this UUID will be returned if it exists
[out]serviceThe service's GATT handle which has uuid if it exists
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NO_DATANo data available
BT_ERROR_NOT_SUPPORTEDNot supported
int bt_gatt_server_initialize ( void  )

Initializes the GATT Server.

Since :
3.0
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
See also:
bt_gatt_server_deinitialize()
int bt_gatt_server_notify_characteristic_changed_value ( bt_gatt_h  characteristic,
bt_gatt_server_notification_sent_cb  callback,
const char *  device_address,
void *  user_data 
)

Notifies value change of the characteristic to the remote devices which enable a Client Characteristic Configuration Descriptor.

Since :
3.0
Parameters:
[in]characteristicThe characteristic which has a changed value
[in]callbackThe function to be invoked on each remote device when a sending operation is done
[in]device_addressRemote device address to send notify or indicate and if set to NULL then notify/indicate all is enabled.
[in]user_dataThe user data to be passed to callback function
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_notification_sent_cb()

Registers a specified service to the specified GATT server that the local device is hosting.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]serverThe GATT server that local device is hosting
[in]serviceThe service, which needs to be registered in server
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_ALREADY_DONEOperation is already done
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_create()
bt_gatt_service_create()
bt_gatt_server_start()
bt_gatt_server_unregister_service()
int bt_gatt_server_send_response ( int  request_id,
bt_gatt_att_request_type_e  request_type,
int  offset,
int  resp_status,
char *  value,
int  value_length 
)

Sends a response to the remote device as a result of a read/write request.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Until this function is called, a read/write request is not finished.
Parameters:
[in]request_idThe identification of a read/write request
[in]request_typeThe request type for read/write
[in]offsetThe offset from where a value is read
[in]resp_statusThe application error if any occurred or BT_ERROR_NONE for successful.
[in]valueThe value to be sent. It will be sent from offset. If it is NULL, a requested GATT handle's value will be sent from offset.
[in]value_lengthValue Length
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_read_value_requested_cb()

Registers a callback function to be invoked when the remote device enables or disables the Notification/Indication for particular characteristics.

Since :
3.0
Parameters:
[in]gatt_handleThe GATT handle of a characteristic
[in]callbackThe callback to be invoked
[in]user_dataThe user data to be passed to callback function
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_characteristic_notification_state_changed_cb()
int bt_gatt_server_set_read_value_requested_cb ( bt_gatt_h  gatt_handle,
bt_gatt_server_read_value_requested_cb  callback,
void *  user_data 
)

Registers a callback function to be invoked when a read request for a specified characteristic or descriptor is issued from a remote device(GATT client).

Since :
3.0
Parameters:
[in]gatt_handleThe GATT handle of a characteristic or descriptor
[in]callbackThe callback to be invoked
[in]user_dataThe user data to be passed to callback function
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_read_value_requested_cb()
bt_gatt_server_send_response()

Registers a callback function to be invoked when a value of a characteristic or descriptor has been changed by a remote device(GATT client)'s request.

Since :
3.0
Parameters:
[in]gatt_handleThe GATT handle of a characteristic or descriptor
[in]callbackThe callback to be invoked
[in]user_dataThe user data to be passed to callback function
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_write_value_requested_cb()
int bt_gatt_server_start ( void  )

Registers the application along with the GATT services of the application it is hosting.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_ALREADY_DONEOperation is already done
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_initialize()
bt_gatt_server_create()
bt_gatt_service_create()
bt_gatt_server_unregister_service()

Unregisters all services from the specified GATT server that the local device is hosting.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]serverThe GATT server that local device is hosting
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_register_service()

Unregisters a specified service from the specified GATT server that the local device is hosting.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]serverThe GATT server that local device is hosting
[in]serviceThe service, which needs to be unregistered from server
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_SERVICE_NOT_FOUNDService not found
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_register_service()
int bt_gatt_service_add_characteristic ( bt_gatt_h  service,
bt_gatt_h  characteristic 
)

Adds a characteristic to a specified service.

Since :
3.0
Parameters:
[in]serviceThe service's GATT handle
[in]characteristicThe characteristic's GATT handle to be added
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_service_create()
bt_gatt_characteristic_create()
int bt_gatt_service_add_included_service ( bt_gatt_h  service,
bt_gatt_h  included_service 
)

Adds a service to a specified service as included service.

Since :
3.0
Parameters:
[in]serviceThe service's GATT handle
[in]included_serviceThe service's GATT handle to be added as included service
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_service_create()
int bt_gatt_service_create ( const char *  uuid,
bt_gatt_service_type_e  type,
bt_gatt_h service 
)

Creates the GATT service.

Since :
3.0
Remarks:
The service should be destroyed by using bt_gatt_service_destroy().
Parameters:
[in]uuidThe UUID of the service
[in]typeThe type of the service
[out]serviceThe GATT handle of the created service
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_OUT_OF_MEMORYOut of memory
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_service_destroy()
int bt_gatt_service_destroy ( bt_gatt_h  gatt_handle)

Destroys the GATT handle of service.

Since :
3.0
Parameters:
[in]gatt_handleThe handle of service
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_service_create()
int bt_gatt_service_get_server ( bt_gatt_h  service,
bt_gatt_server_h server 
)

Gets the GATT server handle to which the specified service belongs.

Since :
3.0
Remarks:
The returned Server handle must not be freed by application.
Parameters:
[in]serviceThe service's GATT handle
[out]serverThe GATT server handle to which service belongs
Returns:
0 on success, otherwise a negative error value
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_server_create()
bt_gatt_service_create()
bt_gatt_server_register_service()