[OTP] Add support for OACP Read
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-event-handler.c
index 67ead44..8f6cc2b 100644 (file)
@@ -3145,6 +3145,28 @@ static void __bt_otp_event_filter(GDBusConnection *connection,
                }
                if (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;
+               int fd = -1;
+               gboolean connected = FALSE;
+               bluetooth_otc_info_t *otc_info = NULL;
+
+               /* Extract data from DBUS params */
+               g_variant_get(parameters, "(ib&sn)", &result, &connected, &address, &fd);
+               BT_DBG("Result  [%d]", result);
+               BT_DBG("Address [%s]", address);
+               BT_DBG("Connected [%d]", connected);
+               BT_DBG("Fd  [%d]", fd);
+
+               otc_info = g_malloc0(sizeof(bluetooth_otc_info_t));
+               otc_info->fd = fd;
+               otc_info->connected = connected;
+               otc_info->address = g_strdup(address);
+
+               _bt_common_event_cb(BLUETOOTH_EVENT_OTC_STATE_CHANGED,
+                               result, otc_info,
+                               event_info->cb, event_info->user_data);
        }
 
        BT_DBG("-");