Update CAPI interfaces to adapt tethering traffic statistics of WiNet 99/24999/1
authorZhang zhengguang <zhengguang.zhang@intel.com>
Fri, 25 Jul 2014 07:30:13 +0000 (15:30 +0800)
committerZhang zhengguang <zhengguang.zhang@intel.com>
Fri, 25 Jul 2014 07:36:09 +0000 (15:36 +0800)
Change-Id: I9fa133da4ed3db4bf8cf6975558d40b759c7aff7

CMakeLists.txt
packaging/capi-network-tethering.spec
src/tethering.c

index b10f8e5bb9f4cb350d07f5c0b7c8a05fe5933ecf..32e6bdbf353183cc5f008c6e52024fc09b8f55a5 100644 (file)
@@ -9,7 +9,7 @@ SET(PREFIX ${CMAKE_INSTALL_PREFIX})
 SET(INC_DIR include)
 INCLUDE_DIRECTORIES(${INC_DIR})
 
-SET(dependents "dlog glib-2.0 capi-base-common vconf connman-lib")
+SET(dependents "dlog glib-2.0 capi-base-common vconf connman-lib winet-lib")
 
 IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
        SET(CMAKE_BUILD_TYPE "Release")
index 325356ba904f702075c7dfbe74422752735df1c7..222bfd38461f4f9637fce6546c319dd6afe9956f 100644 (file)
@@ -10,6 +10,7 @@ Source1001:   capi-network-tethering.manifest
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(capi-base-common)
 BuildRequires: pkgconfig(connman-lib)
+BuildRequires: pkgconfig(winet-lib)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(vconf)
 BuildRequires: cmake
index 6966760ce12146a2b617490066b2ef1dd9d44523..1ff3e9d0441866f5bf5361acdcbbbf09d465bd5c 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <vconf.h>
 
+#include "winet-tether.h"
 #include "connman-lib.h"
 #include "connman-manager.h"
 #include "connman-technology.h"
@@ -643,6 +644,29 @@ static void __handle_passphrase_changed(struct connman_technology *technology, v
 
        return;
 }
+
+static void get_winet_tethering_data_usage(tethering_h tethering)
+{
+       unsigned long long rx_bytes, tx_bytes;
+
+       __tethering_h *th = (__tethering_h *)tethering;
+
+       if (th->data_usage_cb == NULL) {
+               ERR("There is no data_usage_cb\n");
+               return;
+       }
+
+       winet_tether_get_data_usages(&tx_bytes, &rx_bytes);
+
+       th->data_usage_cb(TETHERING_ERROR_NONE,
+                       rx_bytes, tx_bytes, th->data_usage_user_data);
+
+       th->data_usage_cb = NULL;
+       th->data_usage_user_data = NULL;
+
+       return;
+}
+
 /*
 static void __cfm_cb(DBusGProxy *remoteobj, guint event, guint info,
                GError *g_error, gpointer user_data)
@@ -1072,6 +1096,8 @@ API int tethering_create(tethering_h *tethering)
        if (connman_lib_init() != CONNMAN_LIB_ERR_NONE)
                return TETHERING_ERROR_OPERATION_FAILED;
 
+       winet_tether_init();
+
        connman_set_technology_added_cb(__handle_technology_added, th);
 
        return TETHERING_ERROR_NONE;
@@ -1603,6 +1629,8 @@ API int tethering_get_data_usage(tethering_h tethering, tethering_data_usage_cb
 /*     org_tizen_tethering_get_data_packet_usage_async(proxy,
                        __get_data_usage_cb, (gpointer)th);
 */
+       get_winet_tethering_data_usage(tethering);
+
        return TETHERING_ERROR_NONE;
 }