[Adapt: HAL] Handle TODO cases in authorization request from Stack 30/81730/1
authorAnupam Roy <anupam.r@samsung.com>
Sat, 23 Jul 2016 14:16:02 +0000 (19:46 +0530)
committerAnupam Roy <anupam.r@samsung.com>
Thu, 28 Jul 2016 06:02:22 +0000 (11:32 +0530)
1/ Reject incoming authorization request
    if device is not 'Paired' or 'Trusted'
2/ Reject authorization if device proxy fetch is failed
3/ Reject authorization if device address is NULL
4/ Accept authorization if device is already 'Trusted'

Change-Id: Iad991d7f258342c545bc34f62bba2a8603104098
Signed-off-by: Anupam Roy <anupam.r@samsung.com>
bt-oal/bluez_hal/src/bt-hal-agent.c

index 2a4e8e5..08e7e93 100644 (file)
@@ -586,11 +586,11 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
        GVariant *reply_temp = NULL;
        GVariant *tmp_value;
 
-       DBG("Authorize Request from Bluez STack: UUID [%s]", uuid);
+       DBG("Authorize Request from Bluez Stack: UUID [%s]", uuid);
 
        reply_temp = __bt_hal_service_getall(device, BT_HAL_DEVICE_INTERFACE);
        if (reply_temp == NULL) {
-               /* TODO Reject Authorization request */
+               gap_agent_reply_authorize(agent, GAP_AGENT_REJECT, NULL);
                goto done;
        }
 
@@ -600,7 +600,7 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
        g_variant_get(tmp_value, "s", &address);
        G_VARIANT_UNREF(tmp_value);
        if (!address) {
-               /* TODO Reject Authorization request */
+               gap_agent_reply_authorize(agent, GAP_AGENT_REJECT, NULL);
                goto done;
        }
 
@@ -619,7 +619,7 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
        G_VARIANT_UNREF(tmp_value);
        if ((paired == FALSE) && (trust == FALSE)) {
                ERR("No paired & No trusted device");
-               /* TODO Reject Authorization request */
+               gap_agent_reply_authorize(agent, GAP_AGENT_REJECT, NULL);
                goto done;
        }
 
@@ -627,7 +627,7 @@ static gboolean __bt_hal_authorize_request(GapAgentPrivate *agent, GDBusProxy *d
 
        if (trust) {
                INFO("Trusted device, so authorize\n");
-               /* TODO Accept Authorization request */
+               gap_agent_reply_authorize(agent, GAP_AGENT_ACCEPT, NULL);
                goto done;
        }