[Download] Check for ethernet network type
authorPrzemyslaw Ciezkowski <p.ciezkowski@samsung.com>
Tue, 26 May 2015 08:40:31 +0000 (10:40 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 28 May 2015 11:14:45 +0000 (20:14 +0900)
If networkType is set to ALL, check if ethernet is
available.
Fixes a bug where on tv networkType ALL is throwing
an error that it is not supported.

[Verification]
On tv will make it possible to download with networkType ALL.
100% TCT pass rate on mobile.

Change-Id: Ifa66442ede3d8c659bddcfeff67eb3fe2e00cd4d
Signed-off-by: Przemyslaw Ciezkowski <p.ciezkowski@samsung.com>
src/download/download_instance.cc

index 69cc524e50aa67b3f9306f1cfab8f06e68196140..69ce642fd9a9ba63a055583d8fb58f29e5a00d3a 100644 (file)
@@ -406,6 +406,12 @@ void DownloadInstance::DownloadManagerStart
   bool network_support = false;
   bool cell_support = false;
   bool wifi_support = false;
+  // todo retrieve this from system_info
+#ifdef TIZEN_TV
+  bool ethernet_support = true;
+#else
+  bool ethernet_support = false;
+#endif
 
   system_info_get_platform_bool("http://tizen.org/feature/network.telephony",
                                 &cell_support);
@@ -417,14 +423,17 @@ void DownloadInstance::DownloadManagerStart
 
   connection_cellular_state_e cell_state = CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE;
   connection_wifi_state_e wifi_state = CONNECTION_WIFI_STATE_DEACTIVATED;
+  connection_ethernet_state_e ethernet_state = CONNECTION_ETHERNET_STATE_DEACTIVATED;
 
   connection_get_cellular_state(connection, &cell_state);
   connection_get_wifi_state(connection, &wifi_state);
+  connection_get_ethernet_state(connection, &ethernet_state);
   connection_destroy(connection);
 
   bool network_available = false;
   bool cell_available = (CONNECTION_CELLULAR_STATE_CONNECTED == cell_state);
   bool wifi_available = (CONNECTION_WIFI_STATE_CONNECTED == wifi_state);
+  bool ethernet_available = CONNECTION_ETHERNET_STATE_CONNECTED == ethernet_state;
 
   if (networkType == "CELLULAR") {
     network_support = cell_support;
@@ -435,8 +444,8 @@ void DownloadInstance::DownloadManagerStart
     network_available = wifi_available;
     diPtr->network_type = DOWNLOAD_NETWORK_WIFI;
   } else if (networkType == "ALL") {
-    network_support = cell_support || wifi_support;
-    network_available = cell_available || wifi_available;
+    network_support = cell_support || wifi_support || ethernet_support;
+    network_available = cell_available || wifi_available || ethernet_available;
     diPtr->network_type = DOWNLOAD_NETWORK_ALL;
   } else {
     LoggerE("The input parameter contains an invalid network type");