Tizen: Append extra wifi service property
authorArron Wang <arron.wang@intel.com>
Mon, 24 Sep 2012 06:42:02 +0000 (14:42 +0800)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Fri, 31 Oct 2014 08:06:20 +0000 (16:06 +0800)
Append wifi property bssid, maxrate, frequency, encryptionmode to wifi
service

Change-Id: I1d5987334ab288fc04ff931fda5108f4afe864f0

doc/service-api.txt
src/service.c

index c9dd7e2..74c8345 100644 (file)
@@ -191,6 +191,32 @@ Properties string State [readonly]
                        This property might be only present for WiFi
                        services.
 
+               string BSSID [readonly]
+
+                       If the service type is WiFi, then this property
+                       indicates the BSSID of the service.
+
+               uint32 MaxRate [readonly]
+
+                       If the service type is WiFi, then this property
+                       indicates the Maximum speed(bps) of the service.
+
+               uint16 Frequency [readonly]
+
+                       If the service type is WiFi, then this property
+                       indicates the frequency band(MHz) of the service.
+
+               string EncryptionMode [readonly]
+
+                       If the service type is WiFi, then this property
+                       indicates the key encryption mode.
+
+                       Possible values are "none", "wep", "tkip", "aes"
+                       and "mixed".
+
+                       This property might be only present for WiFi
+                       services.
+
                uint8 Strength [readonly]
 
                        Indicates the signal strength of the service. This
index 87a2f2c..d3b219f 100644 (file)
 
 #define CONNECT_TIMEOUT                120
 
+#if defined TIZEN_EXT
+#define WIFI_BSSID_STR_LEN     18
+#endif
+
 static DBusConnection *connection = NULL;
 
 static GList *service_list = NULL;
@@ -2252,6 +2256,37 @@ int __connman_service_iterate_services(service_iterate_cb cb, void *user_data)
        return 0;
 }
 
+#if defined TIZEN_EXT
+static void append_wifi_ext_info(DBusMessageIter *dict,
+                                       struct connman_network *network)
+{
+       char bssid_buff[WIFI_BSSID_STR_LEN] = {0,};
+       char *bssid_str = bssid_buff;
+       unsigned char *bssid;
+       unsigned int maxrate;
+       uint16_t frequency;
+       const char *enc_mode;
+
+       bssid = connman_network_get_bssid(network);
+       maxrate = connman_network_get_maxrate(network);
+       frequency = connman_network_get_frequency(network);
+       enc_mode = connman_network_get_enc_mode(network);
+
+       snprintf(bssid_str, WIFI_BSSID_STR_LEN, "%02x:%02x:%02x:%02x:%02x:%02x",
+                               bssid[0], bssid[1], bssid[2],
+                               bssid[3], bssid[4], bssid[5]);
+
+       connman_dbus_dict_append_basic(dict, "BSSID",
+                                       DBUS_TYPE_STRING, &bssid_str);
+       connman_dbus_dict_append_basic(dict, "MaxRate",
+                                       DBUS_TYPE_UINT32, &maxrate);
+       connman_dbus_dict_append_basic(dict, "Frequency",
+                                       DBUS_TYPE_UINT16, &frequency);
+       connman_dbus_dict_append_basic(dict, "EncryptionMode",
+                                       DBUS_TYPE_STRING, &enc_mode);
+}
+#endif
+
 static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                                        struct connman_service *service)
 {
@@ -2317,6 +2352,14 @@ static void append_properties(DBusMessageIter *dict, dbus_bool_t limited,
                                                append_ethernet, service);
                break;
        case CONNMAN_SERVICE_TYPE_WIFI:
+#if defined TIZEN_EXT
+               if (service->network != NULL)
+                       append_wifi_ext_info(dict, service->network);
+
+               connman_dbus_dict_append_dict(dict, "Ethernet",
+                                               append_ethernet, service);
+               break;
+#endif
        case CONNMAN_SERVICE_TYPE_ETHERNET:
        case CONNMAN_SERVICE_TYPE_BLUETOOTH:
        case CONNMAN_SERVICE_TYPE_GADGET: