Added getters for primary and secondary device type. 96/83996/1
authorNishant Chaprana <n.chaprana@samsung.com>
Tue, 16 Aug 2016 07:13:09 +0000 (12:43 +0530)
committerNishant Chaprana <n.chaprana@samsung.com>
Tue, 16 Aug 2016 07:13:09 +0000 (12:43 +0530)
This patch adds below method calls:-
1. GetPrimaryDevType - To get own device's Primary Device Type.
2. GetSecondaryDevType - To get own device's Secondary Device Type.

Change-Id: I4cbc0e5d11fe2593212deb9ba6f5c98814df68dd
Signed-off-by: Nishant Chaprana <n.chaprana@samsung.com>
include/wifi-direct-manager.h
packaging/wifi-direct-manager.spec
src/wifi-direct-iface.c
src/wifi-direct-manager.c

index fb4eecc..3964f1f 100644 (file)
@@ -38,6 +38,8 @@
 #              define DEFAULT_IFNAME "wlan0"
 #              define GROUP_IFNAME "p2p-wlan0-0"
 #      endif /* TIZEN_WLAN_BOARD_SPRD */
+#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE
+#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL
 #endif /* TIZEN_PROFILE_MOBILE */
 
 #if defined TIZEN_PROFILE_TV
@@ -48,6 +50,8 @@
 #              define DEFAULT_IFNAME "p2p0"
 #              define GROUP_IFNAME "p2p0"
 #      endif /* TIZEN_WIFI_MODULE_BUNDLE */
+#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_DISPLAY
+#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_DISPLAY_TV
 #endif /* TIZEN_PROFILE_TV */
 
 #ifndef DEFAULT_IFNAME
 #      define GROUP_IFNAME "p2p0"
 #endif
 
+#ifndef DEFAULT_PRIMARY_DEVICE_TYPE
+#      define DEFAULT_PRIMARY_DEVICE_TYPE WIFI_DIRECT_PRIMARY_DEVICE_TYPE_TELEPHONE
+#endif
+
+#ifndef DEFAULT_SECONDARY_DEVICE_TYPE
+#      define DEFAULT_SECONDARY_DEVICE_TYPE WIFI_DIRECT_SECONDARY_DEVICE_TYPE_TELEPHONE_SMARTPHONE_DUAL
+#endif
+
 #define WFD_MAX_CLIENT 16
 #define WFD_MAX_STATION 8
 
index 236c43a..40b1edc 100644 (file)
@@ -1,6 +1,6 @@
 Name:          wifi-direct-manager
 Summary:       Wi-Fi Direct manger
-Version:       1.2.194
+Version:       1.2.195
 Release:       1
 Group:      Network & Connectivity/Wireless
 License:    Apache-2.0
index c776824..ed90835 100644 (file)
@@ -310,6 +310,14 @@ const gchar wfd_manager_introspection_xml[] = {
                                "<arg type='b' name='enable' direction='in'/>"
                                "<arg type='i' name='error_code' direction='out'/>"
                        "</method>"
+                       "<method name='GetPrimaryDevType'>"
+                               "<arg type='i' name='pri_dev_type' direction='out'/>"
+                               "<arg type='i' name='error_code' direction='out'/>"
+                       "</method>"
+                       "<method name='GetSecondaryDevType'>"
+                               "<arg type='i' name='sec_dev_type' direction='out'/>"
+                               "<arg type='i' name='error_code' direction='out'/>"
+                       "</method>"
                "</interface>"
 #ifdef TIZEN_FEATURE_SERVICE_DISCOVERY
                "<interface name='net.wifidirect.service'>"
@@ -1604,7 +1612,6 @@ static void __wfd_manager_config_iface_handler(const gchar *method_name,
        } else if (!g_strcmp0(method_name, "SetAutoGroupRemoval")) {
                gboolean enable;
 
-
                g_variant_get(parameters, "(b)", &enable);
                WDS_LOGE("Activate Auto Group Removal Mode : [%s]",
                                enable ? "True" : "False");
@@ -1641,6 +1648,24 @@ static void __wfd_manager_config_iface_handler(const gchar *method_name,
                return_parameters = g_variant_new("(i)", ret);
                goto done;
 
+       } else if (!g_strcmp0(method_name, "GetPrimaryDevType")) {
+
+               int pri_dev_type = 0;
+               ret = WIFI_DIRECT_ERROR_NONE;
+               pri_dev_type = DEFAULT_PRIMARY_DEVICE_TYPE;
+               WDS_LOGD("Get primary dev type value is %d", pri_dev_type);
+               return_parameters = g_variant_new("(ii)", ret, pri_dev_type);
+               goto done;
+
+       } else if (!g_strcmp0(method_name, "GetSecondaryDevType")) {
+
+               int sec_dev_type = 0;
+               ret = WIFI_DIRECT_ERROR_NONE;
+               sec_dev_type = DEFAULT_SECONDARY_DEVICE_TYPE;
+               WDS_LOGD("Get secondary dev type value is %d", sec_dev_type);
+               return_parameters = g_variant_new("(ii)", ret, sec_dev_type);
+               goto done;
+
        }  else {
                WDS_LOGE("method not handled");
                ret = WIFI_DIRECT_ERROR_OPERATION_FAILED;
index 473564f..a8341ac 100644 (file)
@@ -464,6 +464,8 @@ int wfd_manager_local_config_set(wfd_manager_s *manager)
                return WIFI_DIRECT_ERROR_OPERATION_FAILED;
        }
 
+       local->pri_dev_type = DEFAULT_PRIMARY_DEVICE_TYPE;
+       local->sec_dev_type = DEFAULT_SECONDARY_DEVICE_TYPE;
        res = wfd_oem_set_dev_type(manager->oem_ops, local->pri_dev_type, local->sec_dev_type);
        if (res < 0) {
                WDS_LOGE("Failed to set device type");