char *http_security_obj_path = NULL;
static GMainLoop *main_loop;
-static int property_sub_id = -1;
-static int adapter_sub_id = -1;
+static guint property_sub_id;
+static guint adapter_sub_id;
static http_request_state req_state;
#ifdef HPS_GATT_DB
static GDBusConnection *conn;
static GDBusConnection *g_conn;
static guint g_owner_id = 0;
-GDBusNodeInfo *hps_node_info = NULL;
char *g_uri = NULL;
char *g_header = NULL;
"</node>";
#ifdef HPS_GATT_DB
-static void _bt_hps_set_char_value(const char *obj_path, const char* value, int value_length);
+static void _bt_hps_set_char_value(const char *obj_path, const char* value, int value_length, int offset);
static void _hps_convert_address_to_hex(bluetooth_device_address_t *addr_hex, const char *addr_str)
{
- int i = 0;
- unsigned int addr[BLUETOOTH_ADDRESS_LENGTH] = { 0, };
+ char *ptr1, *ptr2, *ptr3, *ptr4, *ptr5;
if (addr_str == NULL || addr_str[0] == '\0')
return;
- i = sscanf(addr_str, "%X:%X:%X:%X:%X:%X", &addr[0], &addr[1], &addr[2], &addr[3], &addr[4], &addr[5]);
- if (i != BLUETOOTH_ADDRESS_LENGTH)
- BT_ERR("Invalid format string - [%s]", addr_str);
+ addr_hex->addr[0] = strtol(addr_str, &ptr5, 16);
+ addr_hex->addr[1] = strtol(ptr5 + 1, &ptr4, 16);
+ addr_hex->addr[2] = strtol(ptr4 + 1, &ptr3, 16);
+ addr_hex->addr[3] = strtol(ptr3 + 1, &ptr2, 16);
+ addr_hex->addr[4] = strtol(ptr2 + 1, &ptr1, 16);
+ addr_hex->addr[5] = strtol(ptr1 + 1, NULL, 16);
+}
+
+static char *__hps_convert_uuid_to_uuid128(const char *uuid)
+{
+ int len;
+ char *uuid128;
+
+ len = strlen(uuid);
+
+ switch (len) {
+ case 4:
+ /* UUID 16bits */
+ uuid128 = g_strdup_printf("0000%s-0000-1000-8000-00805F9B34FB", uuid);
+ break;
+
+ case 8:
+ /* UUID 32bits */
+ uuid128 = g_strdup_printf("%s-0000-1000-8000-00805F9B34FB", uuid);
+ break;
+
+ case 36:
+ /* UUID 128bits */
+ uuid128 = strdup(uuid);
+ break;
- for (i = 0; i < BLUETOOTH_ADDRESS_LENGTH; i++)
- addr_hex->addr[i] = (unsigned char)addr[i];
+ default:
+ return NULL;
+ }
+
+ return uuid128;
}
static void _bt_hps_send_status_notification(unsigned short http_status,
BT_DBG("Status %d %04x", http_status, http_status);
/* Store the status value */
- _bt_hps_set_char_value(http_status_obj_path, status, 3);
+ _bt_hps_set_char_value(http_status_obj_path, status, 3, 0);
/* Send unicast notification */
ret = bluetooth_gatt_server_set_notification(http_status_obj_path, unicast_address);
static void _bt_hps_on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
{
+ GDBusNodeInfo *node_info = NULL;
guint object_id;
GError *error = NULL;
g_conn = connection;
+ node_info = g_dbus_node_info_new_for_xml(hps_introspection_xml, &error);
+ if (!node_info) {
+ BT_ERR("Failed to install: %s", error->message);
+ g_clear_error(&error);
+ return;
+ }
+
object_id = g_dbus_connection_register_object(connection, BT_HPS_OBJECT_PATH,
- hps_node_info->interfaces[0],
+ node_info->interfaces[0],
&hps_method_table,
NULL, NULL, &error);
+ g_dbus_node_info_unref(node_info);
if (object_id == 0) {
BT_ERR("Failed to register method table: %s", error->message);
g_error_free(error);
- g_dbus_node_info_unref(hps_node_info);
}
return;
BT_DBG("");
g_object_unref(g_conn);
g_conn = NULL;
- g_dbus_node_info_unref(hps_node_info);
g_bus_unown_name(g_owner_id);
return;
int _bt_hps_register_interface(void)
{
- GError *error = NULL;
guint owner_id;
BT_DBG("");
- hps_node_info = g_dbus_node_info_new_for_xml(hps_introspection_xml, &error);
- if (!hps_node_info) {
- BT_ERR("Failed to install: %s", error->message);
- return BLUETOOTH_ERROR_INTERNAL;
- }
-
owner_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
BT_HPS_SERVICE_NAME,
G_BUS_NAME_OWNER_FLAGS_NONE,
g_object_unref(g_conn);
g_conn = NULL;
- g_dbus_node_info_unref(hps_node_info);
g_bus_unown_name(g_owner_id);
return;
return g_strcmp0(attrib1->char_path, attrib2->char_path);
}
-static void _bt_hps_set_char_value(const char *obj_path, const char* value, int value_length)
+static void _bt_hps_set_char_value(const char *obj_path, const char* value, int value_length, int offset)
{
GSList *tmp = NULL;
if (!value)
if (tmp->data) {
struct hps_char_info *char_info = tmp->data;
if (!g_strcmp0(char_info->char_path, obj_path)) {
- char_info->char_value = g_try_realloc(char_info->char_value, value_length);
- if (char_info->char_value) {
- memcpy(char_info->char_value, value, value_length);
- char_info->value_length = value_length;
- hps_char_list = g_slist_insert_sorted(hps_char_list,
- char_info, char_info_cmp);
+ gchar *data = NULL;
+ if (char_info->char_value == NULL) {
+ char_info->char_value = g_malloc0(offset + value_length);
+ char_info->value_length = offset + value_length;
+ } else if (char_info->value_length >= offset + value_length) {
+ /* Just change from offset */
+ memcpy(&char_info->char_value[offset], value, value_length);
+ } else {
+ /* Values crossing pervious allocated limit realloc */
+ data = g_memdup(char_info->char_value, char_info->value_length);
+ char_info->char_value = g_try_realloc(char_info->char_value, offset + value_length);
+ memcpy(char_info->char_value, data, char_info->value_length);
+ memcpy(&char_info->char_value[offset], value, value_length);
+ char_info->value_length = offset + value_length;
+ g_free(data);
}
+ hps_char_list = g_slist_insert_sorted(hps_char_list,
+ char_info, char_info_cmp);
return;
}
}
}
#endif
-int _bt_hps_uri_write_cb(char *uri, int len)
+int _bt_hps_uri_write_cb(char *uri, int len, int offset)
{
if ((len < 1) || (len > MAX_URI_LENGTH)) {
BT_ERR("Wrong URI length %d", len);
g_free(g_uri);
g_uri = g_strndup(uri, len);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_uri_obj_path, g_uri, len);
+ _bt_hps_set_char_value(http_uri_obj_path, g_uri, len, offset);
#endif
return BLUETOOTH_ERROR_NONE;
}
-int _bt_hps_http_header_write_cb(char *header, int len)
+int _bt_hps_http_header_write_cb(char *header, int len, int offset)
{
if ((len < 1) || (len > MAX_HEADER_LENGTH)) {
BT_ERR("Wrong Header length %d", len);
g_free(g_header);
g_header = g_strndup(header, len);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_hdr_obj_path, g_header, len);
+ _bt_hps_set_char_value(http_hdr_obj_path, g_header, len, offset);
#endif
return BLUETOOTH_ERROR_NONE;
}
-int _bt_hps_entity_body_write_cb(char *entity, int len)
+int _bt_hps_entity_body_write_cb(char *entity, int len, int offset)
{
if ((len < 1) || (len > MAX_ENTITY_LENGTH)) {
BT_ERR("Wrong Entity length %d", len);
g_free(g_entity);
g_entity = g_strndup(entity, len);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_entity_obj_path, g_entity, len);
+ _bt_hps_set_char_value(http_entity_obj_path, g_entity, len, offset);
#endif
return BLUETOOTH_ERROR_NONE;
if (!obj_path) {
BT_ERR("Wrong Obj path");
- return FALSE;
+ return data_status;
}
if (!g_strcmp0(http_hdr_obj_path, obj_path))
_bt_hps_set_notify_read_status(obj_path, offset + MAX_ENTITY_LENGTH,
data_status, notify_read_info->https_status);
*value = g_strdup(&info->char_value[offset]);
- *len = info->value_length;
+ *len = MAX_ENTITY_LENGTH;
} else if ((info->value_length - offset) > 0 &&
(info->value_length - offset) <= MAX_ENTITY_LENGTH) {
if (is_header)
data_status = DS_BODY_RECEIVED;
_bt_hps_set_notify_read_status(obj_path, offset, data_status, notify_read_info->https_status);
*value = g_strdup(&info->char_value[offset]);
- *len = info->value_length;
+ *len = info->value_length - offset;
}
} else if (notify_read_info && (notify_read_info->read_status == DS_BODY_RECEIVED ||
notify_read_info->read_status == DS_HEADER_RECEIVED)) {
// Write Data to Header Characteristic
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_hdr_obj_path, content, hdr_len);
+ _bt_hps_set_char_value(http_hdr_obj_path, content, hdr_len, 0);
#else
bluetooth_gatt_set_characteristic_value(http_hdr_obj_path, content, hdr_len);
#endif
// Write Data to Status Code Characteristic
#ifdef HPS_GATT_DB
data_status = (hdr_len > MAX_ENTITY_LENGTH) ? DS_HEADER_TRUNCATED : DS_HEADER_RECEIVED;
+
if (data_status == DS_BODY_TRUNCATED && SOUP_STATUS_IS_SUCCESSFUL(http_status))
- _bt_hps_set_notify_read_status(http_hdr_obj_path, data_status, 0, http_status);
+ _bt_hps_set_notify_read_status(http_hdr_obj_path, 0, data_status, http_status);
_bt_hps_send_status_notification(http_status, data_status, &addr_hex);
#else
}
// Write Data to Entity Body Characteristic
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_entity_obj_path, body->data, body->length);
+ _bt_hps_set_char_value(http_entity_obj_path, body->data, body->length, 0);
#else
bluetooth_gatt_set_characteristic_value(http_entity_obj_path, body->data, body->length);
#endif
// Write Data to Status Code Characteristic
#ifdef HPS_GATT_DB
data_status = (body->length > MAX_ENTITY_LENGTH) ? DS_BODY_TRUNCATED : DS_BODY_RECEIVED;
+
if (data_status == DS_BODY_TRUNCATED && SOUP_STATUS_IS_SUCCESSFUL(http_status))
- _bt_hps_set_notify_read_status(http_entity_obj_path, data_status, 0, http_status);
+ _bt_hps_set_notify_read_status(http_entity_obj_path, 0, data_status, http_status);
_bt_hps_send_status_notification(http_status, data_status, &addr_hex);
hdr_len = soup_message_headers_get_content_length(msg->response_headers);
// Write Data to Header Characteristic
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_hdr_obj_path, content, hdr_len);
+ _bt_hps_set_char_value(http_hdr_obj_path, content, hdr_len, 0);
#else
bluetooth_gatt_set_characteristic_value(http_hdr_obj_path, content, hdr_len);
#endif
// Write Data to Status Code Characteristic
#ifdef HPS_GATT_DB
data_status = (hdr_len > MAX_HEADER_LENGTH) ? DS_HEADER_TRUNCATED : DS_HEADER_RECEIVED;
+
if (data_status == DS_HEADER_TRUNCATED && SOUP_STATUS_IS_SUCCESSFUL(http_status))
- _bt_hps_set_notify_read_status(http_hdr_obj_path, data_status, 0, http_status);
+ _bt_hps_set_notify_read_status(http_hdr_obj_path, 0, data_status, http_status);
_bt_hps_send_status_notification(http_status, data_status, &addr_hex);
#else
BT_INFO("Opcode %0x", opcode);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_cp_obj_path, value, len);
+ _bt_hps_set_char_value(http_cp_obj_path, value, len, 0);
#endif
switch (opcode) {
#endif
https_status = soup_message_get_https_status(hps_soup_msg, &cert, &flags);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1);
+ _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1, 0);
#else
bluetooth_gatt_set_characteristic_value(http_security_obj_path, (char *)&https_status, 1);
#endif
#endif
https_status = soup_message_get_https_status(hps_soup_msg, &cert, &flags);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1);
+ _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1, 0);
#else
bluetooth_gatt_set_characteristic_value(http_security_obj_path, (char *)&https_status, 1);
#endif
#endif
https_status = soup_message_get_https_status(hps_soup_msg, &cert, &flags);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1);
+ _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1, 0);
#else
bluetooth_gatt_set_characteristic_value(http_security_obj_path, (char *)&https_status, 1);
#endif
#endif
https_status = soup_message_get_https_status(hps_soup_msg, &cert, &flags);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1);
+ _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1, 0);
#else
bluetooth_gatt_set_characteristic_value(http_security_obj_path, (char *)&https_status, 1);
#endif
https_status = soup_message_get_https_status(hps_soup_msg, &cert, &flags);
#ifdef HPS_GATT_DB
- _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1);
+ _bt_hps_set_char_value(http_security_obj_path, (const char *)&https_status, 1, 0);
#else
bluetooth_gatt_set_characteristic_value(http_security_obj_path, (char *)&https_status, 1);
#endif
while ((g_variant_iter_loop(&value_iter, "{sv}", &property, &var))) {
- if (property == NULL) {
- BT_ERR("Property NULL");
- return;
- }
-
if (!g_strcmp0(property, "WriteValue")) {
int len = 0;
BT_INFO("WriteValue");
len = g_variant_get_size(val);
- BT_DBG("Len = %d", len);
+ BT_DBG("Len = %d, Offset = %d", len, offset);
value = (char *) g_variant_get_data(val);
if (len != 0) {
if (!g_strcmp0(char_path, http_uri_obj_path)) {
/* Retrive URI */
- result = _bt_hps_uri_write_cb(value, len);
+ result = _bt_hps_uri_write_cb(value, len, offset);;
} else if (!g_strcmp0(char_path, http_hdr_obj_path)) {
/* Retrive HEADER */
- result = _bt_hps_http_header_write_cb(value, len);
+ result = _bt_hps_http_header_write_cb(value, len, offset);
} else if (!g_strcmp0(char_path, http_entity_obj_path)) {
/* Retrive ENTITY BODY */
- result = _bt_hps_entity_body_write_cb(value, len);
+ result = _bt_hps_entity_body_write_cb(value, len, offset);
} else if (!g_strcmp0(char_path, http_cp_obj_path)) {
result = _bt_hps_control_point_write_cb(value, len, addr);
} else {
} else {
if (data_status == DS_BODY_RECEIVED ||
data_status == DS_HEADER_RECEIVED) {
- _bt_hps_set_char_value(char_path, NULL, 0);
+ _bt_hps_set_char_value(char_path, NULL, 0, 0);
}
}
if (value)
if (property == NULL) {
BT_ERR("Property NULL");
- return;
+ break;
}
if (strcasecmp(property, "ChangedValue") == 0) {
g_byte_array_append(gp_byte_array,
(const guint8 *)g_variant_get_data(val), len);
if (gp_byte_array->len != 0) {
- GVariant *byte_array = NULL;
- byte_array = g_variant_new_from_data(
- G_VARIANT_TYPE_BYTESTRING,
- gp_byte_array->data,
- gp_byte_array->len,
- TRUE, NULL, NULL);
- param = g_variant_new("(is@ay)", result, char_handle,
- byte_array);
-
if (strcmp(path, http_uri_obj_path)) {
//Retrive URI
_bt_hps_uri_write_cb(NULL, len);
void _bt_hps_deinit_event_receiver(void)
{
BT_DBG("");
- g_dbus_connection_signal_unsubscribe(conn, property_sub_id);
- g_dbus_connection_signal_unsubscribe(conn, adapter_sub_id);
+
+ if (conn == NULL)
+ return;
+
+ if (property_sub_id > 0) {
+ g_dbus_connection_signal_unsubscribe(conn, property_sub_id);
+ property_sub_id = 0;
+ }
+
+ if (adapter_sub_id) {
+ g_dbus_connection_signal_unsubscribe(conn, adapter_sub_id);
+ adapter_sub_id = 0;
+ }
+
conn = NULL;
+
return;
}
int ret;
BT_DBG("");
- // Temporary UUID is used. SIG have not yet defined the UUID yet
- guint8 data[4] = {0x03, 0x02, 0x00, 0x19};
+ guint8 data[4] = {0x03, 0x02, 0x23, 0x18};
bluetooth_advertising_data_t adv;
BT_DBG("%x %x %x %x", data[0], data[1], data[2], data[3]);
goto fail;
}
- service_uuid = g_strdup(HPS_UUID);
+ service_uuid = __hps_convert_uuid_to_uuid128(HPS_UUID);
ret = bluetooth_gatt_add_service(service_uuid, &hps_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add service %d", ret);
}
/* Characteristic URI */
- props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
- BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
- char_uuid = g_strdup(HTTP_URI_UUID);
+ props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_URI_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_uri_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
/* Store requets information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_uri_obj_path);
- _bt_hps_set_char_value(http_uri_obj_path, value, MAX_URI_LENGTH);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_uri_obj_path, value, MAX_URI_LENGTH, 0);
#endif
/* Characteristic HTTP Headers */
props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
- char_uuid = g_strdup(HTTP_HDR_UUID);
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_HDR_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_hdr_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
/* Store Characterisitc information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_hdr_obj_path);
- _bt_hps_set_char_value(http_hdr_obj_path, value, MAX_HEADER_LENGTH);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_hdr_obj_path, value, MAX_HEADER_LENGTH, 0);
#endif
/* Characteristic HTTP Entity Body */
props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
- char_uuid = g_strdup(HTTP_ENTITY_UUID);
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_ENTITY_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_entity_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
/* Store Characterisitc information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_entity_obj_path);
- _bt_hps_set_char_value(http_entity_obj_path, value, MAX_ENTITY_LENGTH);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_entity_obj_path, value, MAX_ENTITY_LENGTH, 0);
#endif
/* Characteristic HTTP Control Point */
- props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
- BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
- char_uuid = g_strdup(HTTP_CP_UUID);
+ props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_CP_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_cp_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
/* Store Characterisitc information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_cp_obj_path);
- _bt_hps_set_char_value(http_cp_obj_path, &cp, 1);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_cp_obj_path, &cp, 1, 0);
#endif
/* Characteristic HTTP Status Code */
- props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
- BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE |
- BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY;
- char_uuid = g_strdup(HTTP_STATUS_UUID);
+ props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY;
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_STATUS_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_status_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
goto fail;
}
#endif
- desc_uuid = g_strdup(HTTP_STATUS_CCC_DESC_UUID);
+ desc_uuid = __hps_convert_uuid_to_uuid128(HTTP_STATUS_CCC_DESC_UUID);
ret = bluetooth_gatt_add_descriptor(http_status_obj_path, desc_uuid,
(BLUETOOTH_GATT_PERMISSION_READ | BLUETOOTH_GATT_PERMISSION_WRITE),
&http_status_desc_obj_path);
/* Store Characterisitc information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_status_obj_path);
- _bt_hps_set_char_value(http_status_obj_path, status, 3);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_status_obj_path, status, 3, 0);
#endif
/* Characteristic HTTPS Security */
- props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ |
- BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE;
- char_uuid = g_strdup(HTTP_SECURITY_UUID);
+ props = BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ;
+ char_uuid = __hps_convert_uuid_to_uuid128(HTTP_SECURITY_UUID);
ret = bluetooth_gatt_add_new_characteristic(hps_obj_path, char_uuid, 0, props, &http_security_obj_path);
if (ret != BLUETOOTH_ERROR_NONE) {
BT_ERR("Failed to add new char %d", ret);
/* Store Characterisitc information */
char_info = g_new0(struct hps_char_info, 1);
char_info->char_path = g_strdup(http_security_obj_path);
- _bt_hps_set_char_value(http_security_obj_path, &cp, 1);
hps_char_list = g_slist_append(hps_char_list, char_info);
+ _bt_hps_set_char_value(http_security_obj_path, &cp, 1, 0);
#endif
ret = bluetooth_gatt_register_service(hps_obj_path);
return -5;
}
- hps_soup_session = soup_session_async_new();
+ hps_soup_session = soup_session_new();
if (hps_soup_session == NULL) {
BT_ERR("Failed to soup_session_async_new");
return -6;