Repalcing libnet-client API with connection CAPI 32/206832/4 accepted/tizen_5.5_unified accepted/tizen_5.5_unified_mobile_hotfix accepted/tizen_5.5_unified_wearable_hotfix tizen_5.5 tizen_5.5_mobile_hotfix tizen_5.5_tv tizen_5.5_wearable_hotfix accepted/tizen/5.5/unified/20191031.024947 accepted/tizen/5.5/unified/mobile/hotfix/20201027.084730 accepted/tizen/5.5/unified/wearable/hotfix/20201027.115345 accepted/tizen/unified/20190703.110652 submit/tizen/20190703.064827 submit/tizen_5.5/20191031.000003 submit/tizen_5.5_mobile_hotfix/20201026.185103 submit/tizen_5.5_wearable_hotfix/20201026.184303 tizen_5.5.m2_release
authorAvichal <avichal.a@samsung.com>
Mon, 27 May 2019 13:33:04 +0000 (19:03 +0530)
committerAvichal <avichal.a@samsung.com>
Tue, 2 Jul 2019 13:33:50 +0000 (19:03 +0530)
Change-Id: I06a31652a7e64b66e1c7ee12915465e573c54e32
Signed-off-by: Avichal <avichal.a@samsung.com>
CMakeLists.txt
geofence-server/src/geofence_server.c
geofence-server/src/geofence_server.h
geofence-server/src/geofence_server_private.h
geofence-server/src/server.c
geofence-server/src/server.h
packaging/geofence-server.spec

index 8e226f5..88c85b2 100644 (file)
@@ -7,7 +7,7 @@ SET(BIN_DIR "${PREFIX}/bin")
 #Dependencies
 
 SET(common_dp "glib-2.0 geofence-dbus dlog gio-2.0 capi-appfw-app-manager")
-SET(server_dp "${common_dp} network vconf vconf-internal-keys capi-system-info gthread-2.0  gio-unix-2.0 sqlite3 db-util alarm-service deviced capi-location-manager capi-network-bluetooth capi-network-wifi-manager libcore-context-manager capi-system-device libtzplatform-config")
+SET(server_dp "${common_dp} vconf vconf-internal-keys capi-system-info gthread-2.0  gio-unix-2.0 sqlite3 db-util alarm-service deviced capi-network-connection capi-location-manager capi-network-bluetooth capi-network-wifi-manager libcore-context-manager capi-system-device libtzplatform-config")
 SET(module_dp "${common_dp} gmodule-2.0 capi-geofence-manager")
 
 # Set required packages
index d8cff49..5cb8ea8 100644 (file)
@@ -35,7 +35,6 @@
 #include "geofence_server_internal.h"
 #include "geofence_server_bluetooth.h"
 #include <wifi-manager.h>
-#include <network-wifi-intf.h>
 #include <system_info.h>
 
 #define TIZEN_ENGINEER_MODE
@@ -1014,7 +1013,7 @@ void bt_adapter_device_discovery_state_cb(int result, bt_adapter_device_discover
 #endif
 }
 
-static void geofence_network_evt_cb(net_event_info_t *event_cb, void *user_data)
+static void geofence_network_evt_cb(connection_type_e type, void* user_data)
 {
        FUNC_ENTRANCE_SERVER;
        GeofenceServer *geofence_server = (GeofenceServer *) user_data;
@@ -1023,8 +1022,8 @@ static void geofence_network_evt_cb(net_event_info_t *event_cb, void *user_data)
        int wps_state = 0;
        int gps_state = 0;
 
-       switch (event_cb->Event) {
-       case NET_EVENT_WIFI_POWER_IND:
+       switch (type) {
+       case CONNECTION_TYPE_WIFI:
                LOGI_GEOFENCE("WIFI ON/OFF indication");
                vconf_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED, &wps_state);
                vconf_get_int(VCONFKEY_LOCATION_ENABLED, &gps_state);
@@ -1062,7 +1061,7 @@ static void geofence_network_evt_cb(net_event_info_t *event_cb, void *user_data)
                        LOGE_GEOFENCE("WPS is not supported");
                }
                break;
-       case NET_EVENT_OPEN_IND:
+       case CONNECTION_TYPE_CELLULAR:
                LOGI_GEOFENCE("Mobile internet connected");
                vconf_get_int(VCONFKEY_LOCATION_NETWORK_ENABLED, &wps_state);
                if (__is_support_wps() == true && geofence_server->running_geopoint_cnt > 0 && wps_state == 1 && __isWifiOn() == true && __isDataConnected() == true) {
@@ -1076,7 +1075,7 @@ static void geofence_network_evt_cb(net_event_info_t *event_cb, void *user_data)
                                LOGE_GEOFENCE("Fail to start wps positioning. Error[%d]", ret);
                }
                break;
-       case NET_EVENT_CLOSE_IND:
+       case CONNECTION_TYPE_DISCONNECTED:
                LOGI_GEOFENCE("Mobile internet disconnected");
                if (__is_support_wps() == true && geofence_server->running_geopoint_cnt > 0 && geofence_server->loc_wps_started == true) {
                        /***** Start standalone gps as mobile data is disconnected *****/
index 19a3044..7a6d811 100644 (file)
@@ -28,7 +28,7 @@
 #include <locations.h>
 #include <device/display.h>
 #include <device/callback.h>
-#include <network-wifi-intf.h>
+#include <net_connection.h>
 #include "geofence_server_data_types.h"
 
 #define PACKAGE_NAME   "geofence-server"
@@ -89,7 +89,7 @@ typedef void (*geofence_wifi_device_state_changed_cb)(wifi_manager_device_state_
  * @Param[in]   user_data       The user data to be returned
  * @see None.
  */
-typedef void (*geofence_network_event_cb)(net_event_info_t *event_cb, void *user_data);
+typedef void (*geofence_network_event_cb)(connection_type_e type, void* user_data);
 
 /**
  * @brief       BT Discovery status change callback
index e34b023..4b05c5b 100644 (file)
@@ -25,7 +25,6 @@
 #include <geofence_dbus_server.h>
 #include <locations.h>
 #include <alarm.h>
-#include <network-wifi-intf.h>
 #include "geofence_server_data_types.h"
 #include "geofence_server.h"
 #include <stdio.h>
index b063be9..25ef479 100644 (file)
 #endif
 /* for scan AP
 #include <lbs_wps.h>*/
-#include <network-cm-intf.h>
-#include <network-pm-intf.h>
-#include <network-wifi-intf.h>
-#include <network-pm-config.h>
 /* for telephony*/
 #if USE_TAPI
 #include <tapi_common.h>
@@ -71,6 +67,7 @@
 #endif
 geofence_callbacks g_fence_update_cb;
 void *g_fence_user_data;
+static connection_h  g_connection ;
 
 #if USE_TAPI
 typedef struct {
@@ -99,16 +96,16 @@ static void __deinitialize_geofence_data(void)
 }
 #endif
 
-static void __geofence_network_evt_cb(net_event_info_t *event_cb, void *user_data)
+static void __geofence_network_evt_cb(connection_type_e type, void* user_data)
 {
        GeofenceServer *geofence_server = (GeofenceServer *)user_data;
        g_return_if_fail(geofence_server);
 
-       LOGD_GEOFENCE("==CM Event callback==, Event[%d]", event_cb->Event);
+       LOGD_GEOFENCE("==CM Event callback==, Event[%d]", type);
 
        if (g_fence_update_cb.network_evt_cb) {
                LOGD_GEOFENCE("geofence_network_evt_cb");
-               g_fence_update_cb.network_evt_cb(event_cb, user_data);
+               g_fence_update_cb.network_evt_cb(type, user_data);
        }
 }
 
@@ -272,12 +269,14 @@ int _geofence_initialize_geofence_server(GeofenceServer *geofence_server)
                LOGE_GEOFENCE("wifi_manager_initialize() failed(%d).", ret);
                return -1;
        }
-
-       if (net_register_client((net_event_cb_t) __geofence_network_evt_cb, geofence_server) != NET_ERR_NONE) {
-               LOGD_GEOFENCE("net_register_client() failed");
-               return -1;
-       } else {
-               LOGD_GEOFENCE("net_register_client() succeeded");
+       ret = connection_create(&g_connection);
+       if(ret == CONNECTION_ERROR_NONE) {
+               connection_set_type_changed_cb(g_connection,
+                               __geofence_network_evt_cb,geofence_server);
+               LOGD_GEOFENCE("Create connection() succeeded");
+       }
+       else {
+               LOGD_GEOFENCE("Create connection failed () failed");
        }
 
        ret = wifi_manager_set_connection_state_changed_cb(geofence_server->wifi_h, __geofence_wifi_device_connection_state_changed_cb, geofence_server);
@@ -373,6 +372,8 @@ int _geofence_deinitialize_geofence_server(GeofenceServer *geofence_server)
                LOGD_GEOFENCE("GPS unsetting failed\n");
        else
                LOGD_GEOFENCE("GPS unsetting success\n");
+       connection_unset_type_changed_cb(g_connection);
+       connection_destroy(g_connection);
 #if USE_TAPI
        __deinitialize_geofence_data();
 #endif
index 8788c7a..cce4fb2 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "geofence_server.h"
 #include "geofence_server_private.h"
+#include <net_connection.h>
 #include <bluetooth.h>
 #include <wifi-manager.h>
 
index be86dca..0167bbd 100644 (file)
@@ -13,7 +13,6 @@ Requires(post):       sqlite
 Requires(post):        lbs-server
 BuildRequires:  cmake
 BuildRequires:  pkgconfig(glib-2.0)
-BuildRequires:  pkgconfig(network)
 BuildRequires:  pkgconfig(vconf)
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  pkgconfig(geofence-dbus)
@@ -28,6 +27,7 @@ BuildRequires:  pkgconfig(capi-system-info)
 BuildRequires:  pkgconfig(capi-appfw-app-manager)
 BuildRequires:  pkgconfig(capi-location-manager)
 BuildRequires:  pkgconfig(capi-network-wifi-manager)
+BuildRequires:  pkgconfig(capi-network-connection)
 BuildRequires:  pkgconfig(capi-network-bluetooth)
 BuildRequires:  pkgconfig(libcore-context-manager)
 BuildRequires:  pkgconfig(capi-system-device)