Implement local LE features adapter property
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / bluez_hal / src / bt-hal-adapter-dbus-handler.c
index d3fdb56..e51c87e 100644 (file)
@@ -33,6 +33,7 @@
 #include "bt-hal-log.h"
 #include "bt-hal-msg.h"
 #include "bt-hal-utils.h"
+#include "bt-hal-adapter-le.h"
 
 #include <bt-hal-adapter-dbus-handler.h>
 #include <bt-hal-dbus-common-utils.h>
@@ -475,34 +476,6 @@ int _bt_hal_dbus_stop_discovery(void)
        return BT_STATUS_SUCCESS;
 }
 
-static void ___bt_fill_le_supported_features(const char *item,
-               const char *value, uint8_t *le_features)
-{
-       DBG("+");
-
-       if (g_strcmp0(item, "adv_inst_max") == 0)
-               le_features[1] = atoi(value);
-       else if (g_strcmp0(item, "rpa_offloading") == 0)
-               le_features[2] = atoi(value);
-       else if (g_strcmp0(item, "max_filter") == 0)
-               le_features[4] = atoi(value);
-       else
-               DBG("No registered item");
-
-       /*
-        * TODO: Need to check these usages for Bluez Case. In Bluedroid case,
-        * these are used, so just setting all to 0
-        */
-       le_features[3] = 0; /* Adapter MAX IRK List Size */
-       /* lo byte */
-       le_features[5] = 0; /* Adapter Scan result storage size */
-       /* hi byte */
-       le_features[6] = 0;
-       le_features[7] = 0; /* Adapter Activity energy info supported */
-
-       DBG("-");
-}
-
 static gboolean __bt_adapter_all_properties_cb(gpointer user_data)
 {
        GVariant *result = user_data;
@@ -656,23 +629,25 @@ static gboolean __bt_adapter_all_properties_cb(gpointer user_data)
                        char *name = NULL;
                        char *val = NULL;
                        GVariantIter *iter = NULL;
-                       uint8_t le_features[8];
+                       bt_local_le_features_t le_features;
                        gboolean le_features_present = FALSE;
 
+                       memset(&le_features, 0x00, sizeof(le_features));
+
                        g_variant_get(value, "as", &iter);
                        if (iter) {
                                while (g_variant_iter_loop(iter, "s", &name)) {
                                        DBG("name = %s", name);
                                        g_variant_iter_loop(iter, "s", &val);
                                        DBG("Value = %s", val);
-                                       ___bt_fill_le_supported_features(name, val, le_features);
+                                       _bt_hal_update_le_feature_support(name, val, &le_features);
                                        le_features_present = TRUE;
                                }
                                g_variant_iter_free(iter);
 
                                if (le_features_present) {
                                        size += __bt_insert_hal_properties(buf + size,
-                                                       HAL_PROP_ADAPTER_LOCAL_LE_FEAT, sizeof(le_features), le_features);
+                                                       HAL_PROP_ADAPTER_LOCAL_LE_FEAT, sizeof(le_features), &le_features);
                                        ev->num_props++;
                                } else {
                                        DBG("le supported features values are NOT provided by Stack");