/* Extract data from DBUS params */
g_variant_get(parameters, "(i&sn@ay)", &result, &handle, &data_len, &var);
+ if (!var) {
+ BT_ERR("No data");
+ return;
+ }
data = (char *)g_variant_get_data(var);
BT_DBG("Handle [%s]", handle);
g_free(info->data);
g_free(info);
}
- if (var)
- g_variant_unref(var);
+ g_variant_unref(var);
} else if (strcasecmp(signal_name, BT_OTP_NOTIFICATION_ENABLED) == 0) {
BT_DBG("OTP Notification Enabled event");
char *handle = NULL;
char *handle = NULL;
g_variant_get(parameters, "(i&s@ay)", &result, &handle, &byte_var);
+ if (!byte_var) {
+ BT_ERR("No Indication data from Server");
+ return;
+ }
ind_res = g_malloc0(sizeof(bluetooth_otp_resp_info_t));
ind_res->data_length = g_variant_get_size(byte_var);
g_free(ind_res->data);
g_free(ind_res);
}
- if (byte_var)
- g_variant_unref(byte_var);
+ g_variant_unref(byte_var);
} else if (strcasecmp(signal_name, BT_OTC_STATE_CHANGED) == 0) {
BT_DBG("OTC State Changed");
char *address = NULL;
eventsystem
dbus-1
gio-unix-2.0
+ cynara-client
)
INCLUDE(FindPkgConfig)
#include "bt-otpserver.h"
#include "bluetooth-api.h"
+#include <cynara-client.h>
#undef LOG_TAG
#define LOG_TAG "BLUETOOTH_OTP"
FILE *fp;
char file_path[BT_FILE_PATH_MAX_LEN] = {0, };
int length;
+ char err_msg[256] = {0, };
snprintf(file_path, BT_FILE_PATH_MAX_LEN, "%s%s",
directory, selected_object->name);
fp = fopen(file_path, "r");
if (!fp) {
- BT_DBG("fopen() failed : %s", strerror(errno));
+ cynara_strerror(errno, err_msg, sizeof(err_msg));
+ BT_ERR("fopen() failed : %s", err_msg);
return;
}
gsize len = 0;
int written;
int fd;
+ char err_msg[256] = {0, };
BT_DBG("");
BT_DBG("file_path = [%s]", file_path);
fp = fopen(file_path, "w");
if (!fp) {
- BT_DBG("fopen() failed : %s", strerror(errno));
+ cynara_strerror(errno, err_msg, sizeof(err_msg));
+ BT_ERR("fopen() failed : %s", err_msg);
goto fail;
}
oacp_op->fp = fp;
{
void *handle;
char *error;
- int ret;
+ int ret = BLUETOOTH_ERROR_NONE;
/* check ARCH 64 or 32*/
if (!access(FILEPATH_ARCH_64, 0)) {
dlerror(); /* Clear any existing error */
int (*fun)(char *) = (int (*)(char *))dlsym(handle,
- "bt_app_control_send_launch_request");
+ "bt_app_control_send_launch_request");
if ((error = dlerror()) != NULL) {
BT_ERR("Can not load symbol : %s", dlerror());
return BLUETOOTH_ERROR_INTERNAL;
}
- ret = fun(absolute_path);
+ if (fun)
+ ret = fun(absolute_path);
dlclose(handle);
return ret;
index = 0;
object = _bt_otp_client_find_object(otp_object_list, prev_obj_id, &index);
+ if (!object) {
+ BT_ERR("Object is NULL");
+ return;
+ }
oacp_create = FALSE;
update_obj_metadata_charc_value(object);
selected_object = object;
char new_abs_filepath[BT_FILE_PATH_MAX_LEN] = {0, };
int ret = BLUETOOTH_ERROR_NONE;
FILE *fp = NULL;
+ char err_msg[256] = {0, };
object = (struct object_metadata *) g_slist_nth_data(otp_object_list, curr_obj_index);
if (!object)
fp = fopen(new_abs_filepath, "a");
if (!fp) {
- BT_DBG("fopen() failed : %s", strerror(errno));
+ cynara_strerror(errno, err_msg, sizeof(err_msg));
+ BT_ERR("fopen() failed : %s", err_msg);
ret = BLUETOOTH_ATT_ERROR_INTERNAL;
goto fail;
}
int _bt_avrcp_transport_set_property(int type, unsigned int value)
{
- GValue *attr_value = NULL;
GDBusProxy *proxy = NULL;
GError *error = NULL;
GVariant *reply, *param;
uint16_t property_level = (uint16_t)value;
- g_value_init(attr_value, G_TYPE_STRING);
-
switch (type) {
case DELAY:
param = g_variant_new("q", property_level);
break;
default:
BT_ERR("Invalid property type: %d", type);
- g_value_unset(attr_value);
return BLUETOOTH_ERROR_INTERNAL;
}
}
g_variant_unref(reply);
- g_value_unset(attr_value);
return BLUETOOTH_ERROR_NONE;
}
info = __bt_otp_get_notification_info((char *)path);
if (info) {
- g_variant_get(msg, "(is@ay)", NULL, NULL, &value);
- len = g_variant_get_size(value);
- BT_DBG("Indication data from Server len[%d]", len);
- if (len > 0) {
- buffer = (unsigned char *)g_variant_get_data(value);
- /* DEBUG */
- for (i = 0; i < len; i++)
- BT_DBG("%.2x", buffer[i]);
- }
-
/* Reset Timer */
if (info->notification_timeout_id > 0)
g_source_remove(info->notification_timeout_id);
- /* Send Indication & info removed internally */
- __bt_otp_send_indication_event(info, buffer, len, BLUETOOTH_ERROR_NONE);
+ g_variant_get(msg, "(is@ay)", NULL, NULL, &value);
+
+ if (value) {
+ len = g_variant_get_size(value);
+ BT_DBG("Indication data from Server len[%d]", len);
+ if (len > 0) {
+ buffer = (unsigned char *)g_variant_get_data(value);
+ /* DEBUG */
+ for (i = 0; i < len; i++)
+ BT_DBG("%.2x", buffer[i]);
+ }
+
+ /* Send Indication & info removed internally */
+ __bt_otp_send_indication_event(info, buffer, len, BLUETOOTH_ERROR_NONE);
- if (value)
g_variant_unref(value);
+ } else {
+ BT_ERR("No Indication data from Server");
+ /* Send Error Indication & info removed internally */
+ __bt_otp_send_indication_event(info, NULL, 0, BLUETOOTH_ERROR_INTERNAL);
+ }
}
BT_DBG("-");
}