GATT Server Common Exported Functions
- group GATT_SERVER_COMMON_Exported_Functions
-
Functions
-
void server_init(uint8_t service_num)
-
Initialize parameters of GATT Server.
Example usage
void app_le_profile_init(void) { server_init(service_num); }
- Parameters:
-
service_num -- [in] Set the number of services that need to register.
-
void server_builtin_service_reg(bool reg)
-
Register built-in services including GAP and GATT services.
If the application does not need to register GAP and GATT services, the application shall call server_builtin_service_reg (false) before server_init.
Example usage
void app_le_profile_init(void) { server_builtin_service_reg(false); server_init(service_num); simp_srv_id = simp_ble_service_add_service(app_profile_callback); server_register_app_cb(app_profile_callback); }
- Parameters:
-
reg -- [in] Whether to register built-in services. The default value is true.
-
uint16_t server_get_start_handle(T_SERVER_ID service_id)
-
Get the start handle of the service.
Example usage
void test(void) { uint16_t start_handle = server_get_start_handle(service_id); }
- Parameters:
-
service_id -- [in] Service ID.
- Return values:
0 -- Operation failure.
Others -- Start handle.
- Returns:
-
Start handle.
-
bool server_cfg_use_ext_api(bool use_ext)
-
Configure the server interface.
Example usage
void test(void) { bool ret = server_cfg_use_ext_api(true); }
- Parameters:
-
use_ext -- [in] Whether to use the extension API. The default value is false.
true: Use the API in GATT Server Extension API.
false: Use the API in GATT Server Legacy API.
- Return values:
true -- Operation success.
false -- Operation failure.
- Returns:
-
Operation result.
-
void server_init(uint8_t service_num)