From: Avichal Agarwal Date: Fri, 7 Sep 2018 11:37:55 +0000 (+0530) Subject: Fixing BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED for notify X-Git-Tag: accepted/tizen/unified/20180910.172010~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git;a=commitdiff_plain;h=828b3845a0673853e825cd5fd48c7a16b990e92b Fixing BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED for notify using correct stucture parameter value. Change-Id: I6a59d53cbe9e1f003ced8823cfa953cd253f44f4 Signed-off-by: Avichal Agarwal --- diff --git a/bt-api/bt-gatt-client.c b/bt-api/bt-gatt-client.c index 3a7d842..a3258ee 100755 --- a/bt-api/bt-gatt-client.c +++ b/bt-api/bt-gatt-client.c @@ -2169,6 +2169,7 @@ static gboolean bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio, bt_event_info_t *event_info; buffer = g_malloc0(chr_info->mtu + 1); + memset(buffer, 0, chr_info->mtu + 1); status = g_io_channel_read_chars(gio, buffer, chr_info->mtu, &len, &err); @@ -2195,12 +2196,11 @@ static gboolean bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio, if (len > 0 && len < chr_info->mtu) { bt_gatt_char_property_t char_val; - BT_INFO("FD io sending value changed %s %d \ni", buffer, len); + BT_INFO("FD io sending value changed %x %x %x %x %x %x %x %d \n", buffer[0], buffer[1], buffer[3], buffer[4], buffer[5], buffer[6], buffer[7], len); - char_val.val = g_malloc0(len + 1); memcpy(char_val.prop.uuid, chr_info->UUID, 16); - memcpy(char_val.val, buffer, len); + memcpy(char_val.value, buffer, len); char_val.val_len = len; memcpy(char_val.address, chr_info->adress, 18); @@ -2215,8 +2215,6 @@ static gboolean bluetooth_gatt_client_notify_channel_watch_cb(GIOChannel *gio, BT_ERR("eventinfo failed"); } - g_free(char_val.val); - } else BT_ERR("Packet corrupted"); g_free(buffer);