#endif
#ifdef TIZEN_GATT_CLIENT
-/* LCOV_EXCL_STOP */
int bt_gatt_connect(const char *address, bool auto_connect)
{
int ret;
return ret;
}
+/* LCOV_EXCL_STOP */
int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb callback,
void *user_data)
return BT_ERROR_NONE;
}
+/* LCOV_EXCL_START */
static void __bt_gatt_free_descriptor(bt_gatt_h gatt_handle)
{
bt_gatt_descriptor_s *desc = (bt_gatt_descriptor_s *)gatt_handle;
__bt_gatt_free_service(gatt_handle);
}
-/* LCOV_EXCL_START */
static unsigned int __convert_int_to_signed_bits(int i, int size)
{
unsigned int signed_bits;
return BT_ERROR_NONE; /* LCOV_EXCL_LINE */
}
+/* LCOV_EXCL_START */
static bt_gatt_service_s* __bt_gatt_service_create(const char *uuid,
bt_gatt_service_type_e type)
{
return svc;
}
-/* LCOV_EXCL_START */
int bt_gatt_service_create(const char *uuid, bt_gatt_service_type_e type,
bt_gatt_h *service)
{
BT_CHECK_INPUT_PARAMETER(characteristic);
- if (chr->type != BT_GATT_TYPE_CHARACTERISTIC) {
- BT_ERR("Wrong type of GATT handle : %d", chr->type); /* LCOV_EXCL_LINE */
- return BT_ERROR_INVALID_PARAMETER; /* LCOV_EXCL_LINE */
+ if (chr->type != BT_GATT_TYPE_CHARACTERISTIC) { /* LCOV_EXCL_START */
+ BT_ERR("Wrong type of GATT handle : %d", chr->type);
+ return BT_ERROR_INVALID_PARAMETER;
}
ret = __get_write_prop(write_type, &property);
chr->write_type = write_type;
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_characteristic_get_descriptor(bt_gatt_h characteristic,
const char *uuid, bt_gatt_h *descriptor)
BT_CHECK_GATT_SERVER_SUPPORT();
BT_CHECK_INIT_STATUS();
- int ret = BT_ERROR_NONE;
+ int ret = BT_ERROR_NONE; /* LCOV_EXCL_START */
BT_INFO("gatt_server_initialized [%d] gatt_server_started[%d] instance_id [%d]",
is_gatt_server_initialized, is_gatt_server_started, instance_id);
BT_INFO("Gatt-service already initialized");
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_deinitialize(void)
{
BT_CHECK_GATT_SERVER_SUPPORT();
BT_CHECK_INIT_STATUS();
- int ret = BT_ERROR_NONE;
+ int ret = BT_ERROR_NONE; /* LCOV_EXCL_START */
BT_INFO("gatt_server_initialized [%d] gatt_server_started[%d] instance_id [%d]",
is_gatt_server_initialized, is_gatt_server_started, instance_id);
BT_INFO("Gatt-service is not initialized");
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_create(bt_gatt_server_h *server)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(server);
- if (is_gatt_server_started) {
+ if (is_gatt_server_started) { /* LCOV_EXCL_START */
BT_ERR("Already Server started");
return BT_ERROR_OPERATION_FAILED;
}
gatt_handle_list = g_slist_append(gatt_handle_list, (gpointer)serv);
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_destroy(bt_gatt_server_h server)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(server);
BT_VALIDATE_GATT_HANDLE(server);
- BT_INFO("Destroy GATT Server");
+ BT_INFO("Destroy GATT Server"); /* LCOV_EXCL_START */
/* Remove Server from list of GATT handles */
if (gatt_handle_list)
g_free(serv);
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_set_read_value_requested_cb(bt_gatt_h gatt_handle,
bt_gatt_server_read_value_requested_cb callback,
BT_VALIDATE_GATT_HANDLE(gatt_handle);
- if (handle->type == BT_GATT_TYPE_CHARACTERISTIC) {
+ if (handle->type == BT_GATT_TYPE_CHARACTERISTIC) { /* LCOV_EXCL_START */
chr->read_requested_cb = callback;
chr->read_requested_user_data = user_data;
} else if (handle->type == BT_GATT_TYPE_DESCRIPTOR) {
_bt_set_cb(BT_EVENT_GATT_SERVER_READ_REQUESTED, callback, user_data);
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_set_characteristic_notification_state_change_cb(bt_gatt_h gatt_handle,
bt_gatt_server_characteristic_notification_state_changed_cb callback,
BT_VALIDATE_GATT_HANDLE(gatt_handle);
- chr->notification_changed_cb = callback;
+ chr->notification_changed_cb = callback; /* LCOV_EXCL_START */
chr->notification_changed_user_data = user_data;
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
#ifdef TIZEN_FEATURE_GATT_RELAY
+/* LCOV_EXCL_START */
static int __gatt_service_add_num_handle(bt_gatt_service_s *service)
{
int handles_count = 0;
return BT_ERROR_NONE;
}
+/* LCOV_EXCL_STOP */
int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service)
{
BT_CHECK_INPUT_PARAMETER(service);
BT_VALIDATE_GATT_HANDLE(server);
- if (g_slist_find(serv->services, svc)) {
+ if (g_slist_find(serv->services, svc)) { /* LCOV_EXCL_START */
BT_ERR("Already added service.");
return BT_ERROR_ALREADY_DONE;
}
return ret;
}
- for (char_l = svc->characteristics; char_l; char_l = g_slist_next(char_l)) { /* LCOV_EXCL_START */
+ for (char_l = svc->characteristics; char_l; char_l = g_slist_next(char_l)) {
GSList *desc_l;
bt_gatt_characteristic_s *chr = char_l->data;
}
}
- } /* LCOV_EXCL_STOP */
+ }
serv->services = g_slist_append(serv->services, svc);
svc->parent = (void *)server;
bluetooth_gatt_unregister_service(svc->path);
return ret;
-}
+} /* LCOV_EXCL_STOP */
#else
int bt_gatt_server_register_service(bt_gatt_server_h server, bt_gatt_h service)
{
BT_CHECK_INPUT_PARAMETER(server);
BT_CHECK_INPUT_PARAMETER(service);
- if (!g_slist_find(serv->services, svc)) {
+ if (!g_slist_find(serv->services, svc)) { /* LCOV_EXCL_START */
BT_ERR("Service is NOT found.");
return BT_ERROR_SERVICE_NOT_FOUND;
}
bt_gatt_service_destroy(svc);
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_unregister_all_services(bt_gatt_server_h server)
{
BT_CHECK_GATT_SERVER_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(server);
- g_slist_free_full(serv->services, __bt_gatt_free_service);
+ g_slist_free_full(serv->services, __bt_gatt_free_service); /* LCOV_EXCL_START */
serv->services = NULL;
#ifndef TIZEN_FEATURE_GATT_RELAY
is_gatt_server_started = false;
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_start(void)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_GATT_SERVER_INIT_STATUS();
- if (!is_gatt_server_started) {
+ if (!is_gatt_server_started) { /* LCOV_EXCL_START */
#ifdef TIZEN_FEATURE_GATT_RELAY
{
GSList *l;
BT_DBG("Gatt-service already Running");
return ret;
-}
+} /* LCOV_EXCL_STOP */
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)
int ret = BT_ERROR_NONE;
BT_CHECK_GATT_SERVER_SUPPORT();
BT_CHECK_INIT_STATUS();
+ BT_CHECK_INPUT_PARAMETER(value);
- if (request_type == BT_GATT_REQUEST_TYPE_READ &&
+ if (request_type == BT_GATT_REQUEST_TYPE_READ && /* LCOV_EXCL_START */
resp_status == BT_ATT_ERROR_NONE) {
- BT_CHECK_INPUT_PARAMETER(value);
-
if (value_length < 0)
return BT_ERROR_INVALID_PARAMETER;
}
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_notify_characteristic_changed_value(bt_gatt_h characteristic,
bt_gatt_server_notification_sent_cb callback,
BT_VALIDATE_GATT_HANDLE(characteristic);
- _bt_convert_address_to_hex(&addr_hex, device_address);
+ _bt_convert_address_to_hex(&addr_hex, device_address); /* LCOV_EXCL_START */
#ifdef TIZEN_FEATURE_GATT_RELAY
{
return BT_ERROR_OPERATION_FAILED;
}
}
- } /* LCOV_EXCL_STOP */
+ }
/* Save the Remote GATT client address to be used for notification later on */
memcpy(&chr->address.addr, &addr_hex.addr, BLUETOOTH_ADDRESS_LENGTH);
chr->notified_user_data = user_data;
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_set_write_value_requested_cb(bt_gatt_h gatt_handle,
bt_gatt_server_write_value_requested_cb callback,
BT_VALIDATE_GATT_HANDLE(gatt_handle);
- if (handle->type == BT_GATT_TYPE_CHARACTERISTIC) {
+ if (handle->type == BT_GATT_TYPE_CHARACTERISTIC) { /* LCOV_EXCL_START */
chr->write_value_requested_cb = callback;
chr->write_value_requested_user_data = user_data;
} else if (handle->type == BT_GATT_TYPE_DESCRIPTOR) {
}
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_get_service(bt_gatt_server_h server, const char *uuid,
bt_gatt_h *service)
BT_CHECK_INPUT_PARAMETER(uuid);
BT_CHECK_INPUT_PARAMETER(service);
- ret = __get_gatt_handle_by_uuid(server_s->services,
+ ret = __get_gatt_handle_by_uuid(server_s->services, /* LCOV_EXCL_START */
uuid, &gatt_handle);
if (ret == BT_ERROR_NONE && gatt_handle != NULL) {
*service = gatt_handle;
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_get_device_mtu(const char *remote_address, unsigned int *mtu)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(remote_address);
- _bt_convert_address_to_hex(&addr_hex, remote_address);
+ _bt_convert_address_to_hex(&addr_hex, remote_address); /* LCOV_EXCL_START */
ret = _bt_get_error_code(bluetooth_get_att_mtu(&addr_hex, &mtu_value));
*mtu = mtu_value;
return ret;
-
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_server_foreach_services(bt_gatt_server_h server,
bt_gatt_foreach_cb callback, void *user_data)
BT_CHECK_INPUT_PARAMETER(server);
BT_CHECK_INPUT_PARAMETER(callback);
- total = g_slist_length(server_s->services);
+ total = g_slist_length(server_s->services); /* LCOV_EXCL_START */
for (l = server_s->services; l; l = g_slist_next(l)) {
if (!callback(total, index++, (bt_gatt_h)l->data, user_data))
}
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
/* LCOV_EXCL_START */
int bt_gatt_server_set_att_mtu_changed_cb(bt_gatt_server_h server, bt_gatt_server_att_mtu_changed_cb callback, void *user_data)
*client = (bt_gatt_client_h)client_s;
gatt_client_list = g_slist_append(gatt_client_list, client_s);
- return ret; /* LCOV_EXCL_STOP */
-}
+ return ret;
+} /* LCOV_EXCL_STOP */
#else
int bt_gatt_client_create(const char *remote_address, bt_gatt_client_h *client)
{
BT_CHECK_INPUT_PARAMETER(characteristic);
BT_CHECK_INPUT_PARAMETER(callback);
- chr->value_changed_cb = callback;
+ chr->value_changed_cb = callback; /* LCOV_EXCL_START */
chr->value_changed_user_data = user_data;
#ifdef TIZEN_GATT_CLIENT
}
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_unset_characteristic_value_changed_cb(bt_gatt_h characteristic)
{
BT_CHECK_INPUT_PARAMETER(uuid);
BT_CHECK_INPUT_PARAMETER(service);
- BT_INFO("Get Service from UUID [%s]", uuid);
+ BT_INFO("Get Service from UUID [%s]", uuid); /* LCOV_EXCL_START */
ret = __get_gatt_handle_by_uuid(client_s->services, uuid, &gatt_handle);
if (ret == BT_ERROR_NONE && gatt_handle != NULL) {
*service = gatt_handle;
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_foreach_services(bt_gatt_client_h client,
bt_gatt_foreach_cb callback,
BT_CHECK_GATT_CLIENT_SUPPORT();
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(client);
- BT_CHECK_INPUT_PARAMETER(callback); /* LCOV_EXCL_LINE */
+ BT_CHECK_INPUT_PARAMETER(callback);
- total = g_slist_length(client_s->services); /* LCOV_EXCL_LINE */
+ total = g_slist_length(client_s->services); /* LCOV_EXCL_START */
- for (l = client_s->services; l; l = g_slist_next(l)) { /* LCOV_EXCL_LINE */
+ for (l = client_s->services; l; l = g_slist_next(l)) {
BT_INFO("Call one service callback");
if (!callback(total, index++,
- (bt_gatt_h)l->data, user_data)) /* LCOV_EXCL_LINE */
+ (bt_gatt_h)l->data, user_data))
break;
}
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_set_service_changed_cb(bt_gatt_client_h client,
bt_gatt_client_service_changed_cb callback, void *user_data)
BT_CHECK_INPUT_PARAMETER(client);
BT_CHECK_INPUT_PARAMETER(callback);
- if (client_s->service_changed_cb) {
+ if (client_s->service_changed_cb) { /* LCOV_EXCL_START */
BT_INFO("Already registered");
client_s->service_changed_cb = callback;
client_s->service_changed_user_data = user_data;
}
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_unset_service_changed_cb(bt_gatt_client_h client)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(client);
- _bt_convert_address_to_hex(&bd_addr, client_s->remote_address);
+ _bt_convert_address_to_hex(&bd_addr, client_s->remote_address); /* LCOV_EXCL_START */
#ifdef TIZEN_GATT_CLIENT
ret = _bt_get_error_code(bluetooth_gatt_client_set_service_change_watcher(&bd_addr, FALSE));
#else
}
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
#ifdef TIZEN_GATT_CLIENT
/* LCOV_EXCL_START */
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(client);
- _bt_convert_address_to_hex(&addr_hex, client_s->remote_address);
+ _bt_convert_address_to_hex(&addr_hex, client_s->remote_address); /* LCOV_EXCL_START */
ret = _bt_get_error_code(bluetooth_request_att_mtu(&addr_hex, mtu));
if (BT_ERROR_NONE != ret)
BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(ret), ret);
return ret;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_get_att_mtu(bt_gatt_client_h client, unsigned int *mtu)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(client);
- _bt_convert_address_to_hex(&addr_hex, client_s->remote_address);
+ _bt_convert_address_to_hex(&addr_hex, client_s->remote_address); /* LCOV_EXCL_START */
ret = _bt_get_error_code(bluetooth_get_att_mtu(&addr_hex, &mtu_value));
*mtu = mtu_value;
return ret;
-
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_set_att_mtu_changed_cb(bt_gatt_client_h client, bt_gatt_client_att_mtu_changed_cb callback, void *user_data)
{
BT_CHECK_INPUT_PARAMETER(callback);
BT_CHECK_INPUT_PARAMETER(client);
- if (client_s->att_mtu_changed_cb) {
+ if (client_s->att_mtu_changed_cb) { /* LCOV_EXCL_START */
BT_INFO("Already registered");
client_s->att_mtu_changed_cb = callback;
client_s->att_mtu_changed_user_data = user_data;
client_s->att_mtu_changed_user_data = user_data;
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
int bt_gatt_client_unset_att_mtu_changed_cb(bt_gatt_client_h client)
{
BT_CHECK_INIT_STATUS();
BT_CHECK_INPUT_PARAMETER(client);
- BT_INFO("MTU Changed callback unregistered [%s]", client_s->remote_address);
+ BT_INFO("MTU Changed callback unregistered [%s]", client_s->remote_address); /* LCOV_EXCL_START */
client_s->service_changed_cb = NULL;
client_s->service_changed_user_data = NULL;
return BT_ERROR_NONE;
-}
+} /* LCOV_EXCL_STOP */
/* LCOV_EXCL_START */
int bt_gatt_get_uuid_specification_name(const char *uuid, char **name)