upload tizen1.0 source
authorKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:59:54 +0000 (16:59 +0900)
committerKim Kibum <kb0929.kim@samsung.com>
Sun, 29 Apr 2012 07:59:54 +0000 (16:59 +0900)
33 files changed:
.gitignore [deleted file]
Makefile.am
Makefile.plugins
configure.ac
debian/changelog
debian/connman.install.in
debian/connman.postinst [new file with mode: 0644]
debian/rules
doc/manager-api.txt
include/device.h
include/ipconfig.h
include/log.h
include/network.h
include/notifier.h
include/service.h
include/setting.h
packaging/connman.spec
plugins/alwayson.c [deleted file]
plugins/telephony.c [moved from plugins/sonet.c with 64% similarity]
resources/etc/rc.d/init.d/connman [moved from etc/rc.d/init.d/connman with 100% similarity]
resources/usr/share/dbus-1/services/net.connman.service [moved from debian/net.connman.service.in with 54% similarity]
resources/var/lib/connman/default.profile [new file with mode: 0644]
src/connman.h
src/device.c
src/ipconfig.c
src/log.c
src/main.c
src/main.conf
src/manager.c
src/network.c
src/notifier.c
src/rtnl.c
src/service.c

diff --git a/.gitignore b/.gitignore
deleted file mode 100644 (file)
index e9a306d..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
-build_log
-*.log
-*.pyc
-usr
-opt
-*.o
-*.a
-*.os
-*.exe
-packages
-binaries
-*.ipk
-*~
-*.lo
-*.la
-.deps
-.libs
-.dirstamp
-Makefile
-Makefile.in
-aclocal.m4
-build-stamp
-client/cm
-config.guess
-config.h
-config.h.in
-config.log
-config.status
-config.sub
-configure
-connman.pc
-debian/connman-dev.install
-debian/connman.install
-debian/net.connman.service
-debian/connman-dbg.substvars
-debian/connman-dbg
-debian/connman-dev.substvars
-debian/connman-dev
-debian/connman.substvars
-debian/connman
-debian/files
-debian/tmp
-depcomp
-compile
-doc/version.xml
-include/connman/
-include/version.h
-install-sh
-libtool
-ltmain.sh
-missing
-stamp-h1
-autom4te.cache
-
-connman.pc
-include/connman
-include/version.h
-src/builtin.h
-src/connmand
-src/connman.conf
-src/connman.service
-src/*-connman.rules
-plugins/connman.policy
-scripts/connman
-scripts/openconnect-script
-client/cm
-tools/wispr
-tools/dhcp-test
-tools/dhcp-server-test
-tools/addr-test
-tools/tap-test
-tools/web-test
-tools/wpad-test
-tools/resolv-test
-tools/polkit-test
-tools/iptables-test
-tools/supplicant-test
-tools/alg-test
-tools/dbus-test
-tools/stats-tool
-tools/stats-ringbuffer-dump
-tools/private-network-test
-unit/test-session
-
-doc/*.bak
-doc/*.stamp
-doc/connman.*
-doc/connman-*.txt
-doc/*.sgml
-doc/version.xml
-doc/xml
-doc/html
-.cproject
-.project
index 218c442..cc16ef0 100644 (file)
@@ -227,9 +227,8 @@ DISTCHECK_CONFIGURE_FLAGS = --disable-gtk-doc \
                                --enable-wifi \
                                --enable-bluetooth \
                                --enable-ofono \
-                               --enable-sonet \
+                               --enable-telephony \
                                --enable-tizen-ext \
-                               --enable-alwayson \
                                --enable-pacrunner \
                                --enable-google \
                                --enable-meego \
index ac34dee..d12be60 100644 (file)
@@ -83,27 +83,15 @@ plugins_ofono_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
-if SONET
-if SONET_BUILTIN
-builtin_modules += sonet
-builtin_sources += plugins/sonet.c
+if TELEPHONY
+if TELEPHONY_BUILTIN
+builtin_modules += telephony
+builtin_sources += plugins/telephony.c
 else
-plugin_LTLIBRARIES += plugins/sonet.la
-plugin_objects += $(plugins_sonet_la_OBJECTS)
-plugins_sonet_la_CFLAGS = $(plugin_cflags)
-plugins_sonet_la_LDFLAGS = $(plugin_ldflags)
-endif
-endif
-
-if ALWAYSON
-if ALWAYSON_BUILTIN
-builtin_modules += alwayson
-builtin_sources += plugins/alwayson.c
-else
-plugin_LTLIBRARIES += plugins/alwayson.la
-plugin_objects += $(plugins_alwayson_la_OBJECTS)
-plugins_alwayson_la_CFLAGS = $(plugin_cflags)
-plugins_alwayson_la_LDFLAGS = $(plugin_ldflags)
+plugin_LTLIBRARIES += plugins/telephony.la
+plugin_objects += $(plugins_telephony_la_OBJECTS)
+plugins_telephony_la_CFLAGS = $(plugin_cflags)
+plugins_telephony_la_LDFLAGS = $(plugin_ldflags)
 endif
 endif
 
index 2899994..4e69408 100755 (executable)
@@ -63,7 +63,7 @@ AC_ARG_ENABLE(threads,
 
 AC_ARG_ENABLE(ethernet,
        AC_HELP_STRING([--enable-ethernet], [enable Ethernet support]),
-                       [enable_ethernet=${enableval}], [enable_ethernet="no"])
+                       [enable_ethernet=${enableval}], [enable_ethernet="yes"])
 AM_CONDITIONAL(ETHERNET, test "${enable_ethernet}" != "no")
 AM_CONDITIONAL(ETHERNET_BUILTIN, test "${enable_ethernet}" = "builtin")
 
@@ -95,17 +95,11 @@ AC_ARG_ENABLE(ofono,
 AM_CONDITIONAL(OFONO, test "${enable_ofono}" != "no")
 AM_CONDITIONAL(OFONO_BUILTIN, test "${enable_ofono}" = "builtin")
 
-AC_ARG_ENABLE(sonet,
-       AC_HELP_STRING([--enable-sonet], [enable Sonet support]),
-                       [enable_sonet=${enableval}], [enable_sonet="no"])
-AM_CONDITIONAL(SONET, test "${enable_sonet}" != "no")
-AM_CONDITIONAL(SONET_BUILTIN, test "${enable_sonet}" = "builtin")
-
-AC_ARG_ENABLE(alwayson,
-       AC_HELP_STRING([--enable-alwayson], [enable AlwaysOn support]),
-                       [enable_alwayson=${enableval}], [enable_alwayson="no"])
-AM_CONDITIONAL(ALWAYSON, test "${enable_alwayson}" != "no")
-AM_CONDITIONAL(ALWAYSON_BUILTIN, test "${enable_alwayson}" = "builtin")
+AC_ARG_ENABLE(telephony,
+       AC_HELP_STRING([--enable-telephony], [enable Telephony support]),
+                       [enable_telephony=${enableval}], [enable_telephony="yes"])
+AM_CONDITIONAL(TELEPHONY, test "${enable_telephony}" != "no")
+AM_CONDITIONAL(TELEPHONY_BUILTIN, test "${enable_telephony}" = "builtin")
 
 AC_ARG_ENABLE(tizen-ext, AC_HELP_STRING([--enable-tizen-ext],
                        [enable TIZEN extensions]), [
index 68fadc3..b85758b 100644 (file)
@@ -1,3 +1,100 @@
+connman (0.77.2-0slp2+75) unstable; urgency=low
+
+  * Fix a bug which connman can't update MAC address of Wi-Fi
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+75
+
+ -- root <jeik01.kim@samsung.com>  Thu, 12 Apr 2012 18:23:04 +0900
+
+connman (0.77.2-0slp2+74) unstable; urgency=low
+
+  * Fix cellular profile add bugs
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+74
+
+ -- Jaehyun Kim <jeik01.kim@samsung.com>  Mon, 09 Apr 2012 17:47:31 +0900
+
+connman (0.77.2-0slp2+73) unstable; urgency=low
+
+  * Fix Wi-Fi tethering state bugs
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+73
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Mon, 02 Apr 2012 14:14:38 +0900
+
+connman (0.77.2-0slp2+72) unstable; urgency=low
+
+  * Fix default network info update
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+72
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Thu, 29 Mar 2012 21:48:36 +0900
+
+connman (0.77.2-0slp2+71) unstable; urgency=low
+
+  * Fix bugs on event handling(flight mode/data allowed/roaming)
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+71
+
+ -- Jaehyun Kim <jeik01.kim@samsung.com>  Fri, 23 Mar 2012 19:27:26 +0900
+
+connman (0.77.2-0slp2+70) unstable; urgency=low
+
+  * Enable ConnMan debug log for developers
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+70
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Thu, 22 Mar 2012 20:00:15 +0900
+
+connman (0.77.2-0slp2+69) unstable; urgency=low
+
+  * Revise Wi-Fi device scan
+  * If deivce is connecing, do no make scan
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+69
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Fri, 16 Mar 2012 17:09:01 +0900
+
+connman (0.77.2-0slp2+68) unstable; urgency=low
+
+  * Fix ConnMan __connman_service_connect_default
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+68
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Fri, 16 Mar 2012 16:46:34 +0900
+
+connman (0.77.2-0slp2+67) unstable; urgency=low
+
+  * Revise New Telephony DBus interface name
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+67
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Thu, 15 Mar 2012 13:31:17 +0900
+
+connman (0.77.2-0slp2+66) unstable; urgency=low
+
+  * Rename sonet plug-in to telephony plug-in
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+66
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Fri, 09 Mar 2012 17:37:20 +0900
+
+connman (0.77.2-0slp2+65) unstable; urgency=low
+
+  * Write log routine without syslogd
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+65
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Fri, 09 Mar 2012 16:35:07 +0900
+
+connman (0.77.2-0slp2+64) unstable; urgency=low
+
+  * Revise connection management of Tizen data network to fit New Telepony
+  * Git: pkgs/c/connman
+  * Tag: connman_0.77.2-0slp2+64
+
+ -- Danny Jeongseok Seo <s.seo@samsung.com>  Fri, 09 Mar 2012 11:33:46 +0900
+
 connman (0.77.2-0slp2+63) unstable; urgency=low
 
   * Change sonet's dbus service name
index e0434fc..a216068 100644 (file)
@@ -3,6 +3,7 @@
 @PREFIX@/share/dbus-1/services/*
 @PREFIX@/etc/dbus-1/system.d/*
 @PREFIX@/etc/connman/main.conf
+/var/lib/connman/default.profile
 /etc/rc.d/init.d/connman
 /etc/rc.d/rc3.d/S61connman
 /etc/rc.d/rc5.d/S61connman
diff --git a/debian/connman.postinst b/debian/connman.postinst
new file mode 100644 (file)
index 0000000..06380ec
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+chmod 600 /var/lib/connman/default.profile
+
index 54baee5..59cbabf 100755 (executable)
@@ -23,16 +23,12 @@ DATADIR ?= /opt
 CONFIGURE_ARGS = \
                --localstatedir=/var \
                --enable-threads \
-               --enable-sonet \
                --enable-tizen-ext \
-               --enable-alwayson \
                --enable-wifi=builtin \
                $(NULL)
 #              --enable-debug \
 #                $(NULL)
 
-
-
 configure: configure.ac
        ./autogen.sh
 
@@ -61,40 +57,57 @@ build-stamp:  config.status
 clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp 
+       rm -f build-stamp
 
        # Add here commands to clean up after the build process.
        -$(MAKE) distclean
-ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-       cp -f /usr/share/misc/config.sub config.sub
-endif
-ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-       cp -f /usr/share/misc/config.guess config.guess
-endif
 
        for f in `find $(CURDIR)/debian/ -name "*.in"`; do \
                rm -f $${f%.in}; \
        done
 
+       rm -f depcomp
+       rm -f compile
+       rm -f missing
+       rm -f ltmain.sh
+       rm -f install-sh
+       rm -f config.guess
+       rm -f configh.h
+       rm -f config.h.in
+       rm -f config.log
+       rm -f config.sub
+       rm -f config.guess
+       rm -f configure
+       rm -f Makefile.in
+       rm -f aclocal.m4
+       rm -f ../connman_*.deb
+       rm -f ../connman-*.deb
+       rm -f ../connman_*.changes
+       rm -f ../connman_*.dsc
+       rm -f ../connman_*.tar.gz
+
        dh_clean
 
 install: build
        dh_testdir
        dh_testroot
-       dh_clean -k 
+       dh_clean -k
        dh_installdirs
 
        # Add here commands to install the package into debian/connman.
        $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
 
+       mkdir -p $(CURDIR)/debian/tmp/var/lib/connman
+       cp -f $(CURDIR)/resources/var/lib/connman/default.profile \
+               $(CURDIR)/debian/tmp/var/lib/connman/default.profile
        mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services
-       cp -f $(CURDIR)/debian/net.connman.service \
-               $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services
-       mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/etc
+       cp -f $(CURDIR)/resources$(PREFIX)/share/dbus-1/services/net.connman.service \
+               $(CURDIR)/debian/tmp$(PREFIX)/share/dbus-1/services/net.connman.service
        mkdir -p $(CURDIR)/debian/tmp$(PREFIX)/etc/connman
-       cp -f $(CURDIR)/src/main.conf $(CURDIR)/debian/tmp$(PREFIX)/etc/connman
+       cp -f $(CURDIR)/src/main.conf $(CURDIR)/debian/tmp$(PREFIX)/etc/connman/main.conf
        mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/init.d
-       cp -f $(CURDIR)/etc/rc.d/init.d/connman $(CURDIR)/debian/tmp/etc/rc.d/init.d/connman
+       cp -f $(CURDIR)/resources/etc/rc.d/init.d/connman \
+               $(CURDIR)/debian/tmp/etc/rc.d/init.d/connman
        mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc3.d
        ln -s ../init.d/connman $(CURDIR)/debian/tmp/etc/rc.d/rc3.d/S61connman
        mkdir -p $(CURDIR)/debian/tmp/etc/rc.d/rc5.d
@@ -109,12 +122,12 @@ binary-indep: build install
 binary-arch: build install
        dh_testdir
        dh_testroot
-#      dh_installchangelogs 
+#      dh_installchangelogs
 #      dh_installdocs
 #      dh_installexamples
        dh_install --sourcedir=debian/tmp
 #      dh_installmenu
-#      dh_installdebconf       
+#      dh_installdebconf
 #      dh_installlogrotate
 #      dh_installemacsen
 #      dh_installpam
index fd233ab..4f25eb9 100755 (executable)
@@ -308,11 +308,3 @@ Properties string State [readonly]
                        method calls are disallowed.
 
                        The default value is false.
-                       
-               byte ScanMode [readwrite]
-                       This decides background scan interval. It should be one of 
-                       0(default-300s), 1(periodic-10s) and 2(exponential-4,8,16,...,128s).
-                       Background scan trigger is restarted if the same mode is set again.
-                       
-                       The default value is 0.
-                       
index 56211a0..bbc3680 100644 (file)
@@ -71,7 +71,6 @@ const char *connman_device_get_ident(struct connman_device *device);
 int connman_device_set_powered(struct connman_device *device,
                                                connman_bool_t powered);
 #if defined TIZEN_EXT
-int connman_device_set_cellular_service_enabled(struct connman_device *device, connman_bool_t enabled);
 /*
  * Description: It checks significant and effective Wi-Fi profiles which can make an auto-connection.
  *             It saves power consumption not to scan if there is no valid profile to make an auto-connection.
index a7132a2..34463eb 100644 (file)
@@ -101,11 +101,6 @@ int connman_ipconfig_set_method(struct connman_ipconfig *ipconfig,
 void __connman_ipconfig_disable_ipv6(struct connman_ipconfig *ipconfig);
 void __connman_ipconfig_enable_ipv6(struct connman_ipconfig *ipconfig);
 
-#if defined TIZEN_EXT
-const char *connman_ipconfig_get_local(struct connman_ipconfig *ipconfig);
-#endif 
-
-
 #ifdef __cplusplus
 }
 #endif
index a50de09..bab77a7 100644 (file)
@@ -44,7 +44,11 @@ void connman_debug(const char *format, ...)
 struct connman_debug_desc {
        const char *name;
        const char *file;
+#if defined TIZEN_EXT
+#define CONNMAN_DEBUG_FLAG_DEFAULT (1)
+#else
 #define CONNMAN_DEBUG_FLAG_DEFAULT (0)
+#endif
 #define CONNMAN_DEBUG_FLAG_PRINT   (1 << 0)
 #define CONNMAN_DEBUG_FLAG_ALIAS   (1 << 1)
        unsigned int flags;
@@ -69,11 +73,9 @@ struct connman_debug_desc {
        __attribute__((used, section("__debug"), aligned(8))) = { \
                .file = __FILE__, .flags = CONNMAN_DEBUG_FLAG_DEFAULT, \
        }; \
-       connman_debug("%s:%s() " fmt, __FILE__, __FUNCTION__ , ## arg); \
-       /*if (__connman_debug_desc.flags & CONNMAN_DEBUG_FLAG_PRINT) \
+       if (__connman_debug_desc.flags & CONNMAN_DEBUG_FLAG_PRINT) \
                connman_debug("%s:%s() " fmt, \
                                        __FILE__, __FUNCTION__ , ## arg); \
-       */\
 } while (0)
 
 #ifdef __cplusplus
index 2bce960..a69745a 100644 (file)
@@ -103,7 +103,7 @@ int connman_network_set_domain(struct connman_network *network,
                                     const char *domain);
 #if defined TIZEN_EXT
 /*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
  */
 int connman_network_set_proxy(struct connman_network *network,
                                const char *proxies);
@@ -121,6 +121,8 @@ unsigned int connman_network_get_maxrate(struct connman_network *network);
 int connman_network_set_enc_mode(struct connman_network *network,
                                const char *encryption_mode);
 const char *connman_network_get_enc_mode(struct connman_network *network);
+
+const char *connman_network_get_ifname(struct connman_network *network);
 #endif
 
 int connman_network_set_name(struct connman_network *network,
index 02ee675..74c3d6b 100644 (file)
@@ -49,9 +49,6 @@ struct connman_notifier {
        void (*service_enabled) (enum connman_service_type type,
                                                connman_bool_t enabled);
        void (*offline_mode) (connman_bool_t enabled);
-#if defined TIZEN_EXT
-       void (*cellular_service_enabled) (connman_bool_t enabled);
-#endif
        void (*proxy_changed) (struct connman_service *service);
        void (*service_state_changed) (struct connman_service *service,
                                        enum connman_service_state state);
index 175c6d8..08d362a 100644 (file)
@@ -105,15 +105,6 @@ const char *connman_service_get_proxy_url(struct connman_service *service);
 const char *connman_service_get_proxy_autoconfig(struct connman_service *service);
 
 #if defined TIZEN_EXT
-struct connman_ipconfig* connman_service_get_ipv4config(struct connman_service* service);
-struct connman_network* connman_service_get_network(struct connman_service* service);
-int connman_service_connect(struct connman_service* service);
-int connman_service_disconnect(struct connman_service* service);
-struct connman_service* connman_service_lookup_from_network(struct connman_network * network);
-void connman_service_set_alwayson(struct connman_service *service, connman_bool_t state);
-#endif
-
-#if defined TIZEN_EXT
 /*
  * Description: TIZEN implements system global connection management.
  *              It's only for PDP (cellular) bearer. Wi-Fi is managed by ConnMan automatically.
@@ -121,20 +112,20 @@ void connman_service_set_alwayson(struct connman_service *service, connman_bool_
  */
 
 /*
- * Increase reference count of user-initiated pdp connection
+ * Increase reference count of user-initiated packet data network connection
  */
-void connman_service_user_initiated_pdp_connection_ref(struct connman_service *service);
+void connman_service_user_initiated_pdn_connection_ref(struct connman_service *service);
 
 /*
- * Decrease reference count of user initiated pdp connection and return TRUE if counter is zero.
+ * Decrease reference count of user initiated packet data network connection and return TRUE if counter is zero.
  */
-connman_bool_t connman_service_user_initiated_pdp_connection_unref_and_test(struct connman_service *service);
+connman_bool_t connman_service_user_initiated_pdn_connection_unref_and_test(struct connman_service *service);
 
 /*
- * Test reference count of user initiated pdp connection and return TRUE if counter is zero.
+ * Test reference count of user initiated packet data network connection and return TRUE if counter is zero.
  * No impact to reference count
  */
-connman_bool_t connman_service_is_no_ref_user_initiated_pdp_connection(struct connman_service *service);
+connman_bool_t connman_service_is_no_ref_user_initiated_pdn_connection(struct connman_service *service);
 #endif
 
 #ifdef __cplusplus
index f0b6dd9..78adad7 100755 (executable)
@@ -28,9 +28,6 @@ extern "C" {
 
 connman_bool_t connman_setting_get_bool(const char *key);
 
-#if defined TIZEN_EXT
-connman_uint16_t connman_setting_get_int(const char * key);
-#endif
 #ifdef __cplusplus
 }
 #endif
index c5d43d8..422b186 100644 (file)
@@ -1,87 +1,79 @@
+#sbs-git:pkgs/c/connman connman 0.77.2
+
 Name:       connman
 Summary:    Connection Manager
-Version:    0.77.2
+Version:    0.77.2_75
 Release:    1
-Group:      System/Networking
-License:    GPLv2
-URL:        http://connman.net/
-Source0:    http://www.kernel.org/pub/linux/network/connman/connman-%{version}.tar.gz
-Patch0:     connman_args.patch
-Requires:   wpa_supplicant >= 0.7.1
-BuildRequires:  pkgconfig(libiptc)
-BuildRequires:  pkgconfig(xtables)
+Group:      System/Network
+License:    GNU General Public License version 2
+URL:        http://connman.net
+Source0:    %{name}-%{version}.tar.gz
 BuildRequires:  pkgconfig(glib-2.0)
 BuildRequires:  pkgconfig(dbus-1)
-BuildRequires:  pkgconfig(libudev) >= 145
-
+BuildRequires:  pkgconfig(xtables)
+BuildRequires:  pkgconfig(libiptc)
 
 %description
 Connection Manager provides a daemon for managing Internet connections
 within embedded devices running the Linux operating system.
 
+%prep
+%setup -q
 
 
-%package devel
-Summary:    Development files for Connection Manager
-Group:      Development/Libraries
-Requires:   %{name} = %{version}-%{release}
+%build
 
-%description devel
-connman-devel contains development files for use with connman.
+./autogen.sh
 
-%package test
-Summary:    Test Scripts for Connection Manager  
-Group:      Development/Tools  
-Requires:   %{name} = %{version}-%{release}  
-Requires:   dbus-python  
-Requires:   pygobject2  
-  
-%description test  
-Scripts for testing Connman and its functionality  
+./configure --prefix=/usr \
+            --localstatedir=/var \
+            --enable-threads \
+            --enable-tizen-ext \
+            --enable-wifi=builtin
 
-%prep
-%setup -q -n %{name}-%{version}
-%patch0 -p1
-
-%build
-./bootstrap
-%configure \
-                --localstatedir=/var \
-%ifarch %ix86
-               --enable-ethernet \
-               --enable-wifi \
-%endif
-                --enable-threads \
-                --enable-sonet \
-                --enable-tizen-ext \
-                --enable-alwayson \
-               --enable-test
 
 make %{?jobs:-j%jobs}
 
 %install
+rm -rf %{buildroot}
 %make_install
 
+mkdir -p %{buildroot}/var/lib/connman
+cp resources/var/lib/connman/default.profile %{buildroot}/var/lib/connman/default.profile
+mkdir -p %{buildroot}/usr/share/dbus-1/services
+cp resources/usr/share/dbus-1/services/net.connman.service %{buildroot}/usr/share/dbus-1/services/net.connman.service
+mkdir -p %{buildroot}/usr/etc/connman
+cp src/main.conf %{buildroot}/usr/etc/connman/main.conf
 mkdir -p %{buildroot}/etc/rc.d/init.d
-cp etc/rc.d/init.d/connman %{buildroot}/etc/rc.d/init.d/connman
+cp resources/etc/rc.d/init.d/connman %{buildroot}/etc/rc.d/init.d/connman
+mkdir -p %{buildroot}/etc/rc.d/rc3.d
+ln -s ../init.d/connman %{buildroot}/etc/rc.d/rc3.d/S61connman
+mkdir -p %{buildroot}/etc/rc.d/rc5.d
+ln -s ../init.d/connman %{buildroot}/etc/rc.d/rc5.d/S61connman
 
-%post
+rm -rf %{buildroot}/usr/include/
+rm -rf %{buildroot}/usr/lib/pkgconfig/
+rm %{buildroot}/etc/dbus-1/system.d/*.conf
 
-ln -sf ../init.d/connman /etc/rc.d/rc3.d/S61connman
-ln -sf ../init.d/connman /etc/rc.d/rc5.d/S61connman
+mkdir -p %{buildroot}/usr/etc/dbus-1/system.d/
+cp src/connman.conf %{buildroot}/usr/etc/dbus-1/system.d/
 
-%files
-%doc COPYING
-%{_sbindir}/*
-/usr/lib/connman/plugins/*.so
-/etc/rc.d/init.d/connman
-%config %{_sysconfdir}/dbus-1/system.d/*.conf
 
+%post
+#Resource
+chmod 600 /var/lib/connman/default.profile
 
-%files devel
-%{_includedir}/%{name}/*.h
-%{_libdir}/pkgconfig/*.pc
 
-%files test  
-%defattr(-,root,root,-)  
-%{_libdir}/%{name}/test/* 
+%files
+%defattr(-,root,root,-)
+#%doc AUTHORS COPYING INSTALL ChangeLog NEWS README
+%{_sbindir}/*
+%{_var}/lib/connman/default.profile
+%{_libdir}/connman/plugins/*.so
+%{_datadir}/dbus-1/services/*
+%{_prefix}/etc/dbus-1/system.d/*
+%{_prefix}/etc/connman/main.conf
+%{_prefix}/etc/dbus-1/system.d/*.conf
+%{_sysconfdir}/rc.d/init.d/connman
+%{_sysconfdir}/rc.d/rc3.d/S61connman
+%{_sysconfdir}/rc.d/rc5.d/S61connman
diff --git a/plugins/alwayson.c b/plugins/alwayson.c
deleted file mode 100644 (file)
index 3c0fb5d..0000000
+++ /dev/null
@@ -1,526 +0,0 @@
- /*
-  *
-  *  Connection Manager
-  *
-  *  Copyright (C) 2007-2010  Intel Corporation. All rights reserved.
-  *
-  *  This program is free software; you can redistribute it and/or modify
-  *  it under the terms of the GNU General Public License version 2 as
-  *  published by the Free Software Foundation.
-  *
-  *  This program is distributed in the hope that it will be useful,
-  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  *  GNU General Public License for more details.
-  *
-  *  You should have received a copy of the GNU General Public License
-  *  along with this program; if not, write to the Free Software
-  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301      USA
-  *
-  */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <glib.h>
-#include <string.h>
-#include <gdbus.h>
-#include <errno.h>
-#include <stdlib.h>
-
-#define CONNMAN_API_SUBJECT_TO_CHANGE
-#include <connman/plugin.h>
-#include <connman/notifier.h>
-#include <connman/service.h>
-#include <connman/network.h>
-#include <connman/ipconfig.h>
-#include <connman/dbus.h>
-#include <connman/log.h>
-
-#define TIMEOUT_DEFAULT                5
-#define TIMEOUT_MAX                    1280
-
-guint connection_timeout;
-guint  timer_src;
-static gboolean cellular_enabled = FALSE;
-
-static DBusConnection *connection;
-struct connman_service *celluar_default_service;
-struct connman_service *connected_default_service;
-
-int __request_service_connect(struct connman_service *service);
-void __request_service_disconnect(struct connman_service *service);
-void __unset_default_connected_service(struct connman_service *service, enum connman_service_state state);
-void __set_default_connected_service(struct connman_service *service, enum connman_service_state state);
-static gboolean __connect_timeout_handler(gpointer user_data);
-static void __reset_retry_timer(void);
-
-//tmp code - send the default connection info to sonet
-static int __dbus_request(const char *path, const char *interface, const char *method,
-                       DBusPendingCallNotifyFunction notify, void *user_data,
-                       DBusFreeFunction free_function, int type, ...);
-void __send_default_connection_info(struct connman_service *service, enum connman_service_state state);
-
-const char *__always_on_service_type2string(enum connman_service_type type)
-{
-       switch (type) {
-       case CONNMAN_SERVICE_TYPE_UNKNOWN:
-               break;
-       case CONNMAN_SERVICE_TYPE_SYSTEM:
-               return "system";
-       case CONNMAN_SERVICE_TYPE_ETHERNET:
-               return "ethernet";
-       case CONNMAN_SERVICE_TYPE_WIFI:
-               return "wifi";
-       case CONNMAN_SERVICE_TYPE_WIMAX:
-               return "wimax";
-       case CONNMAN_SERVICE_TYPE_BLUETOOTH:
-               return "bluetooth";
-       case CONNMAN_SERVICE_TYPE_CELLULAR:
-               return "cellular";
-       case CONNMAN_SERVICE_TYPE_GPS:
-               return "gps";
-       case CONNMAN_SERVICE_TYPE_VPN:
-               return "vpn";
-       case CONNMAN_SERVICE_TYPE_GADGET:
-               return "gadget";
-       }
-
-       return NULL;
-}
-
-const char *__always_on_state2string(enum connman_service_state state)
-{
-       switch (state) {
-       case CONNMAN_SERVICE_STATE_UNKNOWN:
-               break;
-       case CONNMAN_SERVICE_STATE_IDLE:
-               return "idle";
-       case CONNMAN_SERVICE_STATE_ASSOCIATION:
-               return "association";
-       case CONNMAN_SERVICE_STATE_CONFIGURATION:
-               return "configuration";
-       case CONNMAN_SERVICE_STATE_READY:
-               return "ready";
-       case CONNMAN_SERVICE_STATE_ONLINE:
-               return "online";
-       case CONNMAN_SERVICE_STATE_DISCONNECT:
-               return "disconnect";
-       case CONNMAN_SERVICE_STATE_FAILURE:
-               return "failure";
-       }
-
-       return NULL;
-}
-
-
-static void __always_on_service_added(struct connman_service *service, const char *name)
-{
-       DBG("service added notifier");
-       struct connman_network *network;
-       const char *path = NULL;
-       int service_type = 0, svc_category_id = 0;
-
-       service_type = connman_service_get_type(service);
-       network = connman_service_get_network(service);
-       path = connman_network_get_string(network,"Name");
-
-       if(service_type != CONNMAN_SERVICE_TYPE_CELLULAR){
-               DBG("service type is not cellular device");
-               return;
-       }
-
-       gchar **strv;
-       int index = 0;
-
-       strv = g_strsplit_set(path, "_", -1);
-       index = g_strv_length(strv);
-       svc_category_id = atoi(strv[index-1]);
-       g_strfreev(strv);
-
-       DBG("svc category id (%d)",svc_category_id);
-
-       //internet service
-       if(svc_category_id == 1){
-               celluar_default_service = service;
-
-               __reset_retry_timer();
-
-               DBG("cellular internet service path (%s), service(%p) added", path, service);
-
-               if(connected_default_service == NULL){
-                       DBG("request to connect default cellular service");
-                       __request_service_connect(service);
-               }
-       }
-
-       return;
-}
-
-static void __always_on_service_removed(struct connman_service *service)
-{
-       DBG("service removed notifier");
-       int service_type = 0;
-
-       service_type = connman_service_get_type(service);
-       if(service_type != CONNMAN_SERVICE_TYPE_CELLULAR){
-               DBG("service type is not cellular device");
-               return;
-       }
-
-       if(celluar_default_service == service){
-               DBG("cellular internet service removed");
-               celluar_default_service = NULL;
-
-               __reset_retry_timer();
-
-               if(connected_default_service == service){
-                       DBG("default connected service removed");
-                       connected_default_service = NULL;
-                       __send_default_connection_info(service, CONNMAN_SERVICE_STATE_IDLE);
-               }
-       }
-
-       return;
-}
-
-static void __always_on_service_enabled(enum connman_service_type type, connman_bool_t enabled)
-{
-       DBG("service enabled notifier");
-       return;
-}
-
-void __always_on_cellular_service_enabled(connman_bool_t enabled)
-{
-       cellular_enabled = enabled;
-
-       __reset_retry_timer();
-       DBG("device cellular service  enabled notifier");
-
-       if(celluar_default_service == NULL){
-               DBG("no cellular default service");
-               return;
-       }
-
-       if(enabled && connected_default_service == NULL){
-               DBG("connect default cellular service");
-               __request_service_connect(celluar_default_service);
-
-       }
-       else if(enabled == FALSE && connected_default_service == celluar_default_service){
-               DBG("disconnect default cellular service");
-               __request_service_disconnect(celluar_default_service);
-       }
-
-       return;
-}
-
-static void __always_on_service_state_changed(struct connman_service *service, enum connman_service_state state)
-{
-       if(state > CONNMAN_SERVICE_STATE_IDLE  && state < CONNMAN_SERVICE_STATE_READY){
-               return;
-       }
-
-       DBG("service state changed service type[%d] state[%d]",connman_service_get_type(service), state);
-
-       if(state == CONNMAN_SERVICE_STATE_IDLE){
-               __unset_default_connected_service(service, state);
-       }
-       else if(state == CONNMAN_SERVICE_STATE_READY){
-               __set_default_connected_service(service, state);
-       }
-       else if(state == CONNMAN_SERVICE_STATE_FAILURE && celluar_default_service == service){
-               DBG("fail to connect default cellular service(%p)", service);
-
-               if(connected_default_service == NULL && cellular_enabled ){
-                       timer_src = g_timeout_add_seconds(connection_timeout, __connect_timeout_handler, service);
-                       DBG("cellular service timer started timer src(%d), timeout(%d)", timer_src, connection_timeout);
-
-                       connection_timeout = connection_timeout*2;
-                       if(connection_timeout > TIMEOUT_MAX)
-                               connection_timeout = TIMEOUT_MAX;
-               }
-
-       }
-
-       return;
-}
-
-static void  __always_on_service_proxy_changed(struct connman_service *service)
-{
-       DBG("service proxy changed notifier");
-       int service_state = 0;
-
-       if(connected_default_service == NULL ||service != connected_default_service){
-               return;
-       }
-
-       service_state = CONNMAN_SERVICE_STATE_READY;
-       __send_default_connection_info(service, service_state);
-
-       return;
-}
-
-int __request_service_connect(struct connman_service *service)
-{
-       int err = 0;
-       int service_type = 0;
-
-       if (service == NULL) {
-               DBG("requested service is null");
-               return;
-       }
-
-       service_type = connman_service_get_type(service);
-       if (service_type == CONNMAN_SERVICE_TYPE_CELLULAR) {
-               connman_service_set_alwayson(service, TRUE);
-       }
-
-       err = connman_service_connect(service);
-       DBG("return value (%d)", err);
-
-       return err;
-}
-
-void __request_service_disconnect(struct connman_service *service)
-{
-       int service_type = 0;
-
-       if (service == NULL) {
-               DBG("requested service is null");
-               return;
-       }
-
-       service_type = connman_service_get_type(service);
-       if (service_type == CONNMAN_SERVICE_TYPE_CELLULAR) {
-               connman_service_set_alwayson(service, FALSE);
-       }
-
-       connman_service_disconnect(service);
-       return;
-}
-
-void __unset_default_connected_service(struct connman_service *service, enum connman_service_state state)
-{
-       int service_type = 0;
-       int err = 0;
-       service_type = connman_service_get_type(service);
-
-       if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service != service){
-               DBG("not a default cellular service");
-               return;
-       }
-
-       if(connected_default_service == NULL || connected_default_service == service){
-               DBG("request default cellular service connect");
-               connected_default_service = NULL;
-               __send_default_connection_info(service, state);
-               err = __request_service_connect(celluar_default_service);
-
-               if (err == -EISCONN) {
-                       __send_default_connection_info(celluar_default_service, CONNMAN_SERVICE_STATE_READY);
-               }
-               return;
-       }
-
-       DBG("current default connected service (%p)", connected_default_service);
-       return;
-}
-
-void __set_default_connected_service(struct connman_service *service, enum connman_service_state state)
-{
-       int service_type = 0;
-       service_type = connman_service_get_type(service);
-
-       if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service != service){
-               DBG("not a default cellular service");
-               return;
-       }
-
-       __reset_retry_timer();
-
-       //set default connection service
-       if(connected_default_service == NULL || connected_default_service == service ){
-               DBG("set connected default service");
-               connected_default_service = service;
-               __send_default_connection_info(service, state);
-               return;
-       }
-
-       //connected_default_service != service
-       if(connected_default_service == celluar_default_service){
-               DBG("set connected default service");
-               connected_default_service = service;
-               __send_default_connection_info(service, state);
-               //check cellualr connection user request
-               if(connman_service_is_no_ref_user_initiated_pdp_connection(celluar_default_service)){
-                       __request_service_disconnect(celluar_default_service);
-                       return;
-               }
-       }
-
-       //disconnect default cellular service when other service is connected
-       if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR && celluar_default_service == service){
-               DBG("disconnect lazy cellular service");
-               if(connman_service_is_no_ref_user_initiated_pdp_connection(celluar_default_service)){
-                       __request_service_disconnect(celluar_default_service);
-                       return;
-               }
-       }
-
-       DBG("current default connected service (%p)", connected_default_service);
-       return;
-}
-
-static int __dbus_request(const char *path, const char *interface, const char *method,
-                       DBusPendingCallNotifyFunction notify, void *user_data,
-                       DBusFreeFunction free_function, int type, ...){
-
-       DBG("dbus request");
-
-       DBusMessage *message;
-       DBusPendingCall *call;
-       dbus_bool_t ok;
-       va_list va;
-
-       DBG("path %s %s.%s", path, interface, method);
-
-       if (path == NULL)
-               return -EINVAL;
-
-       message = dbus_message_new_method_call("net.sonet", path, interface, method);
-       if (message == NULL)
-               return -ENOMEM;
-
-       dbus_message_set_auto_start(message, FALSE);
-
-       va_start(va, type);
-       ok = dbus_message_append_args_valist(message, type, va);
-       va_end(va);
-
-       if (!ok)
-               return -ENOMEM;
-
-       if (dbus_connection_send_with_reply(connection, message, &call, 40000) == FALSE) {
-               connman_error("Failed to call %s.%s", interface, method);
-               dbus_message_unref(message);
-               return -EINVAL;
-       }
-
-       if (call == NULL) {
-               connman_error("D-Bus connection not available");
-               dbus_message_unref(message);
-               return -EINVAL;
-       }
-
-       dbus_pending_call_set_notify(call, notify, user_data, free_function);
-
-       dbus_message_unref(message);
-
-       return -EINPROGRESS;
-}
-
-void __send_default_connection_info(struct connman_service *service, enum connman_service_state state)
-{
-       struct connman_ipconfig *ip_config = NULL;
-       gchar *connection_type = NULL, *connection_state = NULL, *ip_addr = NULL, *proxy_addr = NULL;
-       int service_type = 0;
-       gchar **proxy_list = NULL;
-
-       service_type = connman_service_get_type(service);
-       const char* tmp = __always_on_service_type2string(service_type);
-       connection_type = g_strdup(tmp);
-
-       tmp = __always_on_state2string(state);
-       connection_state = g_strdup(tmp);
-
-       ip_config = connman_service_get_ipv4config(service);
-       DBG("ip_config %p", ip_config);
-       if (ip_config == NULL)
-               return;
-
-       tmp = connman_ipconfig_get_local(ip_config);
-       ip_addr = g_strdup(tmp);
-
-       proxy_list = connman_service_get_proxy_servers(service);
-       if(proxy_list != NULL){
-               proxy_addr = g_strdup(proxy_list[0]);
-       }
-
-       if(ip_addr == NULL)
-               ip_addr = g_strdup("");
-
-       if(proxy_addr == NULL)
-               proxy_addr = g_strdup("");
-
-       __dbus_request("/", "net.sonet.master", "UpdateDefaultConnectionInfo",
-               NULL, NULL, NULL,
-               DBUS_TYPE_STRING,&connection_type, DBUS_TYPE_STRING,&connection_state,
-               DBUS_TYPE_STRING,&ip_addr, DBUS_TYPE_STRING,&proxy_addr,DBUS_TYPE_INVALID);
-
-       g_free(connection_type);
-       g_free(connection_state);
-       g_free(ip_addr);
-       g_free(proxy_addr);
-       g_strfreev(proxy_list);
-
-       return;
-}
-
-static gboolean __connect_timeout_handler(gpointer user_data)
-{
-       DBG("connection timeout");
-
-       struct connman_service *service = (struct connman_service *)user_data;
-
-       __request_service_connect(service);
-       timer_src = 0;
-
-       return FALSE;
-}
-
-static void __reset_retry_timer(void)
-{
-       connection_timeout = TIMEOUT_DEFAULT;
-
-       if (timer_src != 0) {
-               DBG("remove connection retry timer (%d)", timer_src);
-               g_source_remove(timer_src);
-               timer_src = 0;
-       }
-
-       return;
-}
-
-static struct connman_notifier notifier = {
-       .name           = "alwayson",
-       .priority       = CONNMAN_NOTIFIER_PRIORITY_HIGH,
-       .default_changed = NULL,
-       .service_add = __always_on_service_added,
-       .service_remove = __always_on_service_removed,
-       .service_enabled = __always_on_service_enabled,
-       .offline_mode = NULL,
-       .cellular_service_enabled = __always_on_cellular_service_enabled,
-       .proxy_changed = __always_on_service_proxy_changed,
-       .service_state_changed= __always_on_service_state_changed,
-       .ipconfig_changed = NULL,
-};
-
-static int alwayson_init(void)
-{
-       DBG("alwayson init");
-       connection = connman_dbus_get_connection();
-       connman_notifier_register(&notifier);
-       connection_timeout = TIMEOUT_DEFAULT;
-       return 0;
-}
-
-static void alwayson_exit(void)
-{
-       return;
-}
-
-CONNMAN_PLUGIN_DEFINE(alwayson, "AlwaysOn features plugin", VERSION,
-                       CONNMAN_PLUGIN_PRIORITY_DEFAULT, alwayson_init, alwayson_exit)
similarity index 64%
rename from plugins/sonet.c
rename to plugins/telephony.c
index a755210..7e0b795 100644 (file)
 #include <connman/technology.h>
 #include <connman/log.h>
 
-#define SONET_SERVICE                          "net.sonet"
+#define PS_DBUS_SERVICE                                "com.tcore.ps"
 
-#define SONET_MASTER_INTERFACE         SONET_SERVICE ".master"
-#define SONET_MODEM_INTERFACE          SONET_SERVICE ".modem"
-#define SONET_NETWORK_INTERFACE                SONET_SERVICE ".network"
+#define PS_MASTER_INTERFACE            PS_DBUS_SERVICE ".master"
+#define PS_MODEM_INTERFACE             PS_DBUS_SERVICE ".modem"
+#define PS_SERVICE_INTERFACE           PS_DBUS_SERVICE ".service"
+#define PS_CONTEXT_INTERFACE           PS_DBUS_SERVICE ".context"
 
 //methods
 #define GET_MODEMS                             "GetModems"
-#define GET_NETWORKS                   "GetNetworks"
-#define ACTIVATE_NETWORK               "Activate"
-#define DEACTIVATE_NETWORK             "Deactivate"
+#define GET_SERVICES                   "GetServices"
+#define GET_CONTEXTS                   "GetContexts"
+#define ACTIVATE_CONTEXT               "Activate"
+#define DEACTIVATE_CONTEXT             "Deactivate"
 #define GET_PROPERTIES                 "GetProperties"
 #define SET_PROPERTY                   "SetProperties"
 
 //signals
 #define MODEM_ADDED                            "ModemAdded"
 #define MODEM_REMOVED                  "ModemRemoved"
-#define NETWORK_ADDED                  "NetworkAdded"
-#define NETWORK_REMOVED                        "NetworkRemoved"
+#define SERVICE_ADDED                  "ServiceAdded"
+#define SERVICE_REMOVED                        "ServiceRemoved"
+#define CONTEXT_ADDED                  "ContextAdded"
+#define CONTEXT_REMOVED                        "ContextRemoved"
 #define PROPERTY_CHANGED               "PropertyChanged"
 
 #define TIMEOUT 40000
 
 static DBusConnection *connection;
 static GHashTable      *modem_hash;
+static GHashTable      *service_hash;
 static GHashTable      *network_hash;
 
-struct sonet_modem {
+struct telephony_service {
        char* path;
-       struct connman_device *device;
-
-       char *operator;
-       gboolean powered; //modem registered (if TAPI is not ready)
-       gboolean online; //flight_mode, data_allowed, sim_init
 
-       gboolean sim_init; //sim init
+       gpointer p_modem;
+       char *act;
        gboolean roaming; //global roaming state
        gboolean ps_attached; //packet service is available
+};
 
-       gboolean roaming_allowed; //roaming setting
+struct telephony_modem {
+       char* path;
+
+       char *operator;
+       gboolean powered;
+       gboolean sim_init;
+       gboolean flight_mode;
+       gboolean data_allowed;
+       gboolean roaming_allowed;
+
+       struct connman_device *device;
+       struct telephony_service *s_service;
 };
 
-struct sonet_network {
+struct telephony_network {
        char *path;
        struct connman_network *network;
 
@@ -74,9 +87,10 @@ struct sonet_network {
 };
 
 // function prototype
-static void sonet_connect(DBusConnection *connection, void *user_data);
-static void sonet_disconnect(DBusConnection *connection, void *user_data);
+static void telephony_connect(DBusConnection *connection, void *user_data);
+static void telephony_disconnect(DBusConnection *connection, void *user_data);
 static void __remove_modem(gpointer data);
+static void __remove_service(gpointer data);
 static void __remove_network(gpointer data);
 
 static int __modem_probe(struct connman_device *device);
@@ -97,33 +111,39 @@ static int __dbus_request(const char *path, const char *interface, const char *m
 
 static int __request_get_modems(void);
 static void __response_get_modems(DBusPendingCall *call, void *user_data);
-static int __request_get_networks(const char* path);
-static void __response_get_networks(DBusPendingCall *call, void *user_data);
+static int __request_get_services(const char* path);
+static void __response_get_services(DBusPendingCall *call, void *user_data);
+static int __request_get_contexts(struct telephony_modem* modem);
+static void __response_get_contexts(DBusPendingCall *call, void *user_data);
 static int __request_network_activate(struct connman_network *network);
 static void __response_network_activate(DBusPendingCall *call, void *user_data);
 static int __request_network_deactivate(struct connman_network *network);
 
-// sonet internal function
+// telephony internal function
 static void __add_modem(const char *path, DBusMessageIter *prop);
+static void __add_service(struct telephony_modem* modem, const char *service_path, DBusMessageIter *prop);
 static void __add_connman_device(const char* modem_path, const char* operator);
-static void __remove_connman_device(struct sonet_modem *modem);
+static void __remove_connman_device(struct telephony_modem *modem);
 static void __remove_connman_networks(struct connman_device *device);
-static void __set_device_online(struct sonet_modem *modem, gboolean online);
-static int __check_device_online(const char *path, gboolean online);
+static void __set_device_powered(struct telephony_modem *modem, gboolean powered);
+static int __check_device_powered(const char *path, gboolean online);
 static gboolean __check_network_available(struct connman_network *network);
 static void __create_service(struct connman_network *network);
-static int __add_network(struct connman_device *device, const char *path, DBusMessageIter *prop);
-static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessageIter *dict);
-static void __set_network_connected(struct sonet_network *network, gboolean connected);
+static int __add_context(struct connman_device *device, const char *path, DBusMessageIter *prop);
+static gboolean __set_network_ipconfig(struct telephony_network *network, DBusMessageIter *dict);
+static void __set_network_connected(struct telephony_network *network, gboolean connected);
 static char *__get_ident(const char *path);
 
 // signal handler
 static gboolean __changed_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
 static gboolean __added_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
 static gboolean __removed_modem(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __changed_network(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __added_network(DBusConnection *connection, DBusMessage *message, void *user_data);
-static gboolean __removed_network(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __changed_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __added_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __removed_service(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __changed_context(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __added_context(DBusConnection *connection, DBusMessage *message, void *user_data);
+static gboolean __removed_context(DBusConnection *connection, DBusMessage *message, void *user_data);
 
 // device driver
 static struct connman_device_driver modem_driver = {
@@ -146,16 +166,17 @@ static struct connman_network_driver network_driver = {
 };
 
 // local function
-static void sonet_connect(DBusConnection *connection, void *user_data)
+static void telephony_connect(DBusConnection *connection, void *user_data)
 {
        DBG("connection %p", connection);
        modem_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_modem);
+       service_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_service);
        network_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, __remove_network);
        __request_get_modems();
        return;
 }
 
-static void sonet_disconnect(DBusConnection *connection, void *user_data)
+static void telephony_disconnect(DBusConnection *connection, void *user_data)
 {
        DBG("connection %p", connection);
 
@@ -174,7 +195,7 @@ static void sonet_disconnect(DBusConnection *connection, void *user_data)
 
 static void __remove_modem(gpointer data)
 {
-       struct sonet_modem *modem = data;
+       struct telephony_modem *modem = data;
 
        __remove_connman_device(modem);
 
@@ -183,9 +204,18 @@ static void __remove_modem(gpointer data)
        g_free(modem);
 }
 
+static void __remove_service(gpointer data)
+{
+       struct telephony_service *service = data;
+
+       g_free(service->path);
+       g_free(service->act);
+       g_free(service);
+}
+
 static void __remove_network(gpointer data)
 {
-       struct sonet_network *info = data;
+       struct telephony_network *info = data;
        struct connman_device *device;
 
        device = connman_network_get_device(info->network);
@@ -214,7 +244,7 @@ static int __modem_enable(struct connman_device *device)
        const char *path = connman_device_get_string(device, "Path");
        DBG("device %p, path, %s", device, path);
 
-       return __check_device_online(path, TRUE);
+       return __check_device_powered(path, TRUE);
 }
 
 static int __modem_disable(struct connman_device *device)
@@ -222,7 +252,7 @@ static int __modem_disable(struct connman_device *device)
        const char *path = connman_device_get_string(device, "Path");
        DBG("device %p, path, %s", device, path);
 
-       return __check_device_online(path, FALSE);
+       return __check_device_powered(path, FALSE);
 }
 
 static int __network_probe(struct connman_network *network)
@@ -234,7 +264,7 @@ static int __network_probe(struct connman_network *network)
 static int __network_connect(struct connman_network *network)
 {
        struct connman_device *device;
-       struct sonet_modem *modem;
+       struct telephony_modem *modem;
 
        DBG("network %p", network);
 
@@ -249,11 +279,11 @@ static int __network_connect(struct connman_network *network)
        if (modem->powered == FALSE)
                return -ENOLINK;
 
-       if (modem->online == FALSE)
+/*     if (modem->online == FALSE)
                return -ENOLINK;
 
        if (modem->roaming_allowed == FALSE && modem->roaming == TRUE)
-               return -ENOLINK;
+               return -ENOLINK;*/
 
        return __request_network_activate(network);
 }
@@ -283,7 +313,7 @@ static int __dbus_request(const char *path, const char *interface, const char *m
                        DBusPendingCallNotifyFunction notify, void *user_data,
                        DBusFreeFunction free_function, int type, ...)
 {
-       DBG("sonet request");
+       DBG("telephony request");
 
        DBusMessage *message;
        DBusPendingCall *call;
@@ -295,7 +325,7 @@ static int __dbus_request(const char *path, const char *interface, const char *m
        if (path == NULL)
                return -EINVAL;
 
-       message = dbus_message_new_method_call(SONET_SERVICE, path, interface, method);
+       message = dbus_message_new_method_call(PS_DBUS_SERVICE, path, interface, method);
        if (message == NULL)
                return -ENOMEM;
 
@@ -331,7 +361,7 @@ static int __request_get_modems(void)
 {
        DBG("request get modem");
        //call connect master
-       return __dbus_request("/", SONET_MASTER_INTERFACE, GET_MODEMS,
+       return __dbus_request("/", PS_MASTER_INTERFACE, GET_MODEMS,
                        __response_get_modems, NULL, NULL, DBUS_TYPE_INVALID);
 }
 
@@ -384,27 +414,94 @@ done:
        return;
 }
 
-static int __request_get_networks(const char* path)
+static int __request_get_services(const char* path)
+{
+       DBG("request get service");
+       return __dbus_request(path,PS_MODEM_INTERFACE,GET_SERVICES,
+                       __response_get_services, g_strdup(path), g_free, DBUS_TYPE_INVALID);
+}
+
+static void __response_get_services(DBusPendingCall *call, void *user_data)
+{
+       DBusMessage *reply;
+       DBusError error;
+       DBusMessageIter args, dict;
+
+       const char *path = user_data;
+       struct telephony_modem *modem;
+
+       modem = g_hash_table_lookup(modem_hash, path);
+       if (modem == NULL)
+               return;
+       if (modem->device == NULL)
+               return;
+
+       DBG("");
+
+       reply = dbus_pending_call_steal_reply(call);
+
+       dbus_error_init(&error);
+
+       if (dbus_set_error_from_message(&error, reply)) {
+               connman_error("GetServices() %s %s",error.name, error.message);
+               dbus_error_free(&error);
+               goto done;
+       }
+
+       DBG("message signature (%s)", dbus_message_get_signature(reply));
+
+       if (dbus_message_iter_init(reply, &args) == FALSE)
+               goto done;
+
+       dbus_message_iter_recurse(&args, &dict);
+
+       //DBG("message type (%d) dic(%d)", dbus_message_iter_get_arg_type(&dict), DBUS_TYPE_DICT_ENTRY);
+
+       while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
+               DBusMessageIter entry, property;
+               const char *service_path;
+
+               dbus_message_iter_recurse(&dict, &entry);
+               dbus_message_iter_get_basic(&entry, &service_path);
+               DBG("service path (%s)", service_path);
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_recurse(&entry, &property);
+
+               __add_service(modem, service_path,&property);
+
+               dbus_message_iter_next(&dict);
+       }
+
+done:
+       dbus_message_unref(reply);
+       dbus_pending_call_unref(call);
+       return;
+}
+
+static int __request_get_contexts(struct telephony_modem* modem)
 {
-       DBG("request get networks");
-       return __dbus_request(path,SONET_MODEM_INTERFACE,GET_NETWORKS,
-               __response_get_networks, g_strdup(path), g_free, DBUS_TYPE_INVALID);
+       DBG("request get contexts");
+       return __dbus_request(modem->s_service->path,PS_SERVICE_INTERFACE,GET_CONTEXTS,
+               __response_get_contexts, g_strdup(modem->path), g_free, DBUS_TYPE_INVALID);
 }
 
-static void __response_get_networks(DBusPendingCall *call, void *user_data)
+static void __response_get_contexts(DBusPendingCall *call, void *user_data)
 {
        DBusError error;
        DBusMessage *reply;
        DBusMessageIter args, dict;
 
        const char *path = user_data;
-       struct sonet_modem *modem;
+       struct telephony_modem *modem;
 
        DBG("");
 
        modem = g_hash_table_lookup(modem_hash, path);
        if (modem == NULL)
                return;
+       if (modem->s_service == NULL)
+                       return;
        if (modem->device == NULL)
                return;
 
@@ -413,7 +510,7 @@ static void __response_get_networks(DBusPendingCall *call, void *user_data)
        dbus_error_init(&error);
 
        if (dbus_set_error_from_message(&error, reply)) {
-               connman_error("GetModem() %s %s",error.name, error.message);
+               connman_error("GetContexts() %s %s",error.name, error.message);
                dbus_error_free(&error);
                goto done;
        }
@@ -427,16 +524,16 @@ static void __response_get_networks(DBusPendingCall *call, void *user_data)
 
        while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
                DBusMessageIter entry, property;
-               const char *network_path;
+               const char *context_path;
 
                dbus_message_iter_recurse(&dict, &entry);
-               dbus_message_iter_get_basic(&entry, &network_path);
-               DBG("network path (%s)", network_path);
+               dbus_message_iter_get_basic(&entry, &context_path);
+               DBG("context path (%s)", context_path);
 
                dbus_message_iter_next(&entry);
                dbus_message_iter_recurse(&entry, &property);
 
-               __add_network(modem->device, network_path, &property);
+               __add_context(modem->device, context_path, &property);
 
                dbus_message_iter_next(&dict);
        }
@@ -454,7 +551,7 @@ static int __request_network_activate(struct connman_network *network)
        const char *path = connman_network_get_string(network, "Path");
        DBG("network %p, path %s", network, path);
 
-       return __dbus_request(path,SONET_NETWORK_INTERFACE,ACTIVATE_NETWORK,
+       return __dbus_request(path,PS_CONTEXT_INTERFACE,ACTIVATE_CONTEXT,
                __response_network_activate, g_strdup(path), NULL, DBUS_TYPE_INVALID);
 }
 
@@ -465,7 +562,7 @@ static void __response_network_activate(DBusPendingCall *call, void *user_data)
        DBusError error;
        DBusMessage *reply;
 
-       struct sonet_network *info;
+       struct telephony_network *info;
        const char* path = user_data;
 
        info = g_hash_table_lookup(network_hash, path);
@@ -490,9 +587,6 @@ static void __response_network_activate(DBusPendingCall *call, void *user_data)
                goto done;
        }
 
-       if (connman_network_get_index(info->network) >= 0)
-               __set_network_connected(info, TRUE);
-
 done:
        dbus_message_unref(reply);
        dbus_pending_call_unref(call);
@@ -506,23 +600,24 @@ static int __request_network_deactivate(struct connman_network *network)
        const char *path = connman_network_get_string(network, "Path");
        DBG("network %p, path %s", network, path);
 
-       return __dbus_request(path,SONET_NETWORK_INTERFACE,DEACTIVATE_NETWORK,
+       return __dbus_request(path,PS_CONTEXT_INTERFACE,DEACTIVATE_CONTEXT,
                NULL, NULL, NULL, DBUS_TYPE_INVALID);
 }
 
 static void __add_modem(const char *path, DBusMessageIter *prop)
 {
-       struct sonet_modem *modem;
+       struct telephony_modem *modem;
 
        modem = g_hash_table_lookup(modem_hash, path);
        if (modem != NULL)
                return;
 
-       modem = (struct sonet_modem *)malloc( sizeof(struct sonet_modem));
-       memset(modem, 0, sizeof(struct sonet_modem));
+       modem = (struct telephony_modem *)malloc( sizeof(struct telephony_modem));
+       memset(modem, 0, sizeof(struct telephony_modem));
 
        modem->path = g_strdup(path);
        modem->device = NULL;
+       modem->s_service = NULL;
 
        g_hash_table_insert(modem_hash, g_strdup(path), modem);
 
@@ -542,41 +637,77 @@ static void __add_modem(const char *path, DBusMessageIter *prop)
                        modem->powered = STRING2BOOL(tmp);
                } else if (g_str_equal(key, "operator") == TRUE) {
                        modem->operator = g_strdup(tmp);
-               } else if (g_str_equal(key, "roaming") == TRUE) {
-                       modem->roaming = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
-                       modem->roaming_allowed = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "online") == TRUE) {
-                       modem->online = STRING2BOOL(tmp);
                } else if (g_str_equal(key, "sim_init") == TRUE) {
                        modem->sim_init = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "ps_attached") == TRUE) {
-                       modem->ps_attached = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "flight_mode") == TRUE) {
+                       modem->flight_mode = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
+                       modem->roaming_allowed = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "data_allowed") == TRUE) {
+                       modem->data_allowed = STRING2BOOL(tmp);
                }
-
                dbus_message_iter_next(prop);
        }
 
+       __add_connman_device(path, modem->operator);
+       __set_device_powered(modem, modem->powered);
+
        if (modem->powered != TRUE) {
                DBG("modem is not powered");
                return;
        }
 
-       __set_device_online(modem, modem->online);
+       __request_get_services(modem->path);
+
+       return;
+}
+
+static void __add_service(struct telephony_modem* modem, const char *service_path, DBusMessageIter *prop)
+{
+       struct telephony_service *service;
 
-       if (modem->online != TRUE) {
-               DBG("modem is now off-line. do nothing");
+       if (modem->s_service != NULL)
                return;
+
+       service = (struct telephony_service *)malloc( sizeof(struct telephony_service));
+       memset(service, 0, sizeof(struct telephony_service));
+
+       service->path = g_strdup(service_path);
+       service->p_modem = modem;
+       g_hash_table_insert(service_hash, g_strdup(service_path), service);
+
+       while (dbus_message_iter_get_arg_type(prop) != DBUS_TYPE_INVALID) {
+               DBusMessageIter entry;
+               const char *key, *tmp;
+
+               dbus_message_iter_recurse(prop, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_get_basic(&entry, &tmp);
+
+               DBG("key (%s) value(%s)", key, tmp);
+
+               if (g_str_equal(key, "roaming") == TRUE) {
+                       service->roaming = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "act") == TRUE) {
+                       service->act = g_strdup(tmp);
+               } else if (g_str_equal(key, "ps_attached") == TRUE) {
+                       service->ps_attached = STRING2BOOL(tmp);
+               }
+
+               dbus_message_iter_next(prop);
        }
 
-       __add_connman_device(path, modem->operator);
+       modem->s_service = service;
+       __request_get_contexts(modem);
 
        return;
 }
 
 static void __add_connman_device(const char* modem_path, const char* operator)
 {
-       struct sonet_modem *modem;
+       struct telephony_modem *modem;
        struct connman_device *device;
 
        DBG("path %s operator %s", modem_path, operator);
@@ -616,13 +747,10 @@ static void __add_connman_device(const char* modem_path, const char* operator)
 
        modem->device = device;
 
-       if (modem->online == TRUE)
-               __request_get_networks(modem_path);
-
        return;
 }
 
-static void __remove_connman_device(struct sonet_modem *modem)
+static void __remove_connman_device(struct telephony_modem *modem)
 {
        DBG("modem %p path %s device %p", modem, modem->path, modem->device);
 
@@ -652,7 +780,7 @@ static void __remove_connman_networks(struct connman_device *device)
        g_hash_table_iter_init(&iter, network_hash);
 
        while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
-               struct sonet_network *info = value;
+               struct telephony_network *info = value;
 
                if (connman_network_get_device(info->network) != device)
                        continue;
@@ -661,35 +789,34 @@ static void __remove_connman_networks(struct connman_device *device)
        }
 
        for (list = info_list; list != NULL; list = list->next) {
-               struct sonet_network *info = list->data;
+               struct telephony_network *info = list->data;
                connman_device_remove_network(device, info->network);
        }
 
        g_slist_free(info_list);
 }
 
-static void __set_device_online(struct sonet_modem *modem, gboolean online)
+static void __set_device_powered(struct telephony_modem *modem, gboolean powered)
 {
-       DBG("set modem(%s) online(%d)", modem->path, online);
-       modem->online = online;
+       DBG("set modem(%s) powered(%d)", modem->path, powered);
 
        if (modem->device) {
-               connman_device_set_powered(modem->device, online);
+               connman_device_set_powered(modem->device, powered);
        }
 
        return;
 }
 
-static int __check_device_online(const char *path, gboolean online)
+static int __check_device_powered(const char *path, gboolean powered)
 {
-       struct sonet_modem *modem = g_hash_table_lookup(modem_hash, path);
+       struct telephony_modem *modem = g_hash_table_lookup(modem_hash, path);
 
        if (modem == NULL)
                return -ENODEV;
 
-       DBG("check modem (%s) online (%d)", modem->path, modem->online);
+       DBG("check modem (%s) powered (%d)", modem->path, modem->powered);
 
-       if (modem->online == online)
+       if (modem->powered == powered)
                return -EALREADY;
 
        return 0;
@@ -705,14 +832,14 @@ static gboolean __check_network_available(struct connman_network *network)
        return TRUE;
 }
 
-static int __add_network(struct connman_device *device, const char *path, DBusMessageIter *prop)
+static int __add_context(struct connman_device *device, const char *path, DBusMessageIter *prop)
 {
        char *ident;
        gboolean active = FALSE;
 
-       struct sonet_modem *modem = connman_device_get_data(device);
+       struct telephony_modem *modem = connman_device_get_data(device);
        struct connman_network *network;
-       struct sonet_network *info;
+       struct telephony_network *info;
 
        DBG("modem %p device %p path %s", modem, device, path);
 
@@ -736,8 +863,8 @@ static int __add_network(struct connman_device *device, const char *path, DBusMe
        if (network == NULL)
                return -ENOMEM;
 
-       info = (struct sonet_network *)malloc( sizeof(struct sonet_network));
-       memset(info, 0, sizeof(struct sonet_network));
+       info = (struct telephony_network *)malloc( sizeof(struct telephony_network));
+       memset(info, 0, sizeof(struct telephony_network));
 
        if (info == NULL) {
                connman_network_unref(network);
@@ -759,7 +886,7 @@ static int __add_network(struct connman_device *device, const char *path, DBusMe
 
        connman_network_set_available(network, TRUE);
        connman_network_set_index(network, -1);
-       connman_network_set_roaming(network, modem->roaming);
+       connman_network_set_roaming(network, modem->s_service->roaming);
 
        if (connman_device_add_network(device, network) != 0) {
                g_hash_table_remove(network_hash, path);
@@ -768,7 +895,7 @@ static int __add_network(struct connman_device *device, const char *path, DBusMe
 
        active = __set_network_ipconfig(info, prop);
 
-       if (active && connman_network_get_connecting(network) == TRUE)
+       if (active && (connman_network_get_connecting(network) || connman_network_get_associating(network)))
                __set_network_connected(info, active);
 
        return 0;
@@ -788,7 +915,7 @@ static void __create_service(struct connman_network *network)
        connman_network_set_group(network, group);
 }
 
-static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessageIter *dict)
+static gboolean __set_network_ipconfig(struct telephony_network *network, DBusMessageIter *dict)
 {
        DBG("set network info");
 
@@ -796,6 +923,7 @@ static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessag
        char *dev_name=NULL, *proxy_addr=NULL;
        char *ipv4_addr=NULL, *ipv4_gw=NULL, *ipv4_netmask=NULL, *ipv4_dns1=NULL, *ipv4_dns2=NULL;
        char *ipv6_addr=NULL, *ipv6_gw=NULL, *ipv6_netmask=NULL, *ipv6_dns1=NULL, *ipv6_dns2=NULL;
+       int index;
 
        while (dbus_message_iter_get_arg_type(dict) != DBUS_TYPE_INVALID) {
                DBusMessageIter entry;
@@ -837,6 +965,7 @@ static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessag
                        dbus_message_iter_get_basic(&entry, &ipv6_dns2);
                } else if (g_str_equal(key, "active") == TRUE) {
                        dbus_message_iter_get_basic(&entry, &tmp);
+                       DBG("active (%s)", tmp);
                        active = STRING2BOOL(tmp);
                }
 
@@ -844,7 +973,13 @@ static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessag
        }
 
        // interface index set
-       int index = connman_inet_ifindex(dev_name);
+       if (g_str_equal(dev_name ,"")) {
+               const char *ifname = NULL;
+               ifname = connman_network_get_ifname(network->network);
+               index = connman_inet_ifindex(ifname);
+       } else
+               index = connman_inet_ifindex(dev_name);
+
        DBG("interface %s, index %d", dev_name, index);
        connman_network_set_index(network->network, index);
 
@@ -873,10 +1008,13 @@ static gboolean __set_network_ipconfig(struct sonet_network *network, DBusMessag
                connman_network_set_nameservers(network->network, nameservers);
        }
 
+       if(active)
+               connman_network_set_associating(network->network, TRUE);
+
        return active;
 }
 
-static void __set_network_connected(struct sonet_network *network, gboolean connected)
+static void __set_network_connected(struct telephony_network *network, gboolean connected)
 {
        gboolean setip = FALSE;
 
@@ -944,8 +1082,7 @@ static gboolean __changed_modem(DBusConnection *connection, DBusMessage *message
 
        DBusMessageIter args, dict;
        const char *path = dbus_message_get_path(message);
-       struct sonet_modem *modem;
-       gboolean pre_online = TRUE, roaming_option = TRUE;
+       struct telephony_modem *modem;
 
        DBG("modem path %s", path);
 
@@ -980,52 +1117,38 @@ static gboolean __changed_modem(DBusConnection *connection, DBusMessage *message
                        modem->powered = STRING2BOOL(tmp);
                } else if (g_str_equal(key, "operator") == TRUE) {
                        modem->operator = g_strdup(tmp);
-               } else if (g_str_equal(key, "roaming") == TRUE) {
-                       modem->roaming = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
-                       modem->roaming_allowed = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "online") == TRUE) {
-                       pre_online = modem->online;
-                       modem->online = STRING2BOOL(tmp);
                } else if (g_str_equal(key, "sim_init") == TRUE) {
                        modem->sim_init = STRING2BOOL(tmp);
-               } else if (g_str_equal(key, "ps_attached") == TRUE) {
-                       modem->ps_attached = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "flight_mode") == TRUE) {
+                       modem->flight_mode = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "roaming_allowed") == TRUE) {
+                       modem->roaming_allowed = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "data_allowed") == TRUE) {
+                       modem->data_allowed = STRING2BOOL(tmp);
                }
 
                dbus_message_iter_next(&dict);
        }
 
-       if (modem->powered == FALSE) {
-               __remove_connman_device(modem);
-               return TRUE;
-       }
-
-       if (pre_online != modem->online) {
-               __set_device_online(modem, modem->online);
-
-               if (modem->online != TRUE) {
-                       return TRUE;
-               }
+       if (modem->device == NULL)
+               __add_connman_device(path, modem->operator);
 
-               if (modem->device == NULL) {
-                       __add_connman_device(path, modem->operator);
-               } else {
-                       __request_get_networks(path);
-               }
+       __set_device_powered(modem, modem->powered);
 
+       if (modem->powered != TRUE) {
+               DBG("modem is not powered");
                return TRUE;
        }
 
-       roaming_option &= (!modem->roaming && !modem->roaming_allowed) || modem->roaming_allowed;
-
-       if (modem->ps_attached == TRUE) {
-               connman_device_set_cellular_service_enabled(modem->device, roaming_option);
+       if(!modem->s_service){
+               __request_get_services(modem->path);
                return TRUE;
        }
 
-       if (roaming_option != TRUE)
-               connman_device_set_cellular_service_enabled(modem->device, roaming_option);
+       if(modem->flight_mode || !modem->data_allowed){
+               DBG("modem(%s) flight mode(%d) data allowed(%d)", modem->path, modem->flight_mode, modem->data_allowed);
+               return TRUE;
+       }
 
        return TRUE;
 }
@@ -1090,13 +1213,141 @@ static gboolean __removed_modem(DBusConnection *connection, DBusMessage *message
        return TRUE;
 }
 
-static gboolean __changed_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __changed_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+       DBG("service changed signal");
+
+       DBusMessageIter args, dict;
+       const char *service_path = dbus_message_get_path(message);
+       struct telephony_modem *modem;
+       struct telephony_service *s_service;
+       gboolean roaming_option = TRUE;
+
+       DBG("service path %s", service_path);
+
+       s_service = g_hash_table_lookup(service_hash, service_path);
+       if (s_service == NULL) {
+               DBG("service object does not exists");
+               return TRUE;
+       }
+
+       modem = s_service->p_modem;
+       if (modem == NULL) {
+               DBG("modem object does not exists");
+               return TRUE;
+       }
+
+       DBG("message signature (%s)", dbus_message_get_signature(message));
+
+       if (dbus_message_iter_init(message, &args) == FALSE) {
+               DBG("error to read message");
+               return TRUE;
+       }
+
+       dbus_message_iter_recurse(&args, &dict);
+
+       while (dbus_message_iter_get_arg_type(&dict) != DBUS_TYPE_INVALID) {
+               DBusMessageIter entry;
+               const char* key, *tmp;
+
+               dbus_message_iter_recurse(&dict, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_get_basic(&entry, &tmp);
+
+               DBG("key(%s), value(%s)", key, tmp);
+
+               if (g_str_equal(key, "roaming") == TRUE) {
+                       s_service->roaming = STRING2BOOL(tmp);
+               } else if (g_str_equal(key, "act") == TRUE) {
+                       s_service->act = g_strdup(tmp);
+               } else if (g_str_equal(key, "ps_attached") == TRUE) {
+                       s_service->ps_attached = STRING2BOOL(tmp);
+               }
+
+               dbus_message_iter_next(&dict);
+       }
+
+       roaming_option &= (!s_service->roaming && !modem->roaming_allowed) || modem->roaming_allowed;
+
+       return TRUE;
+}
+
+
+static gboolean __added_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+       DBG("service added signal");
+
+       const char *path = dbus_message_get_path(message);
+       const char *service_path = NULL;
+       DBusMessageIter args, dict, tmp;
+       struct telephony_modem *modem;
+
+       modem = g_hash_table_lookup(modem_hash, path);
+       if (modem == NULL || modem->device == NULL)
+               return TRUE;
+
+       DBG("message signature (%s)", dbus_message_get_signature(message));
+       if (dbus_message_iter_init(message, &args) == FALSE) {
+               DBG("error to read message");
+               return TRUE;
+       }
+
+       dbus_message_iter_recurse(&args, &dict);
+       memcpy(&tmp, &dict, sizeof(struct DBusMessageIter));
+
+       while (dbus_message_iter_get_arg_type(&tmp) != DBUS_TYPE_INVALID) {
+               DBusMessageIter entry;
+               const char *key, *value;
+
+               dbus_message_iter_recurse(&tmp, &entry);
+               dbus_message_iter_get_basic(&entry, &key);
+
+               dbus_message_iter_next(&entry);
+               dbus_message_iter_get_basic(&entry, &value);
+
+               DBG("key (%s) value(%s)", key, value);
+
+               if (g_str_equal(key, "path") == TRUE) {
+                       service_path = g_strdup(value);
+               }
+
+               dbus_message_iter_next(&tmp);
+       }
+
+       if (service_path != NULL) {
+               __add_service(modem, service_path, &dict);
+       }
+
+       return TRUE;
+}
+
+static gboolean __removed_service(DBusConnection *connection, DBusMessage *message, void *user_data)
+{
+       DBG("service removed signal");
+
+       DBusMessageIter iter;
+       const char *service_path;
+
+       if (dbus_message_iter_init(message, &iter) == FALSE) {
+               DBG("error to read message");
+               return TRUE;
+       }
+
+       dbus_message_iter_get_basic(&iter, &service_path);
+       g_hash_table_remove(service_hash, service_path);
+
+       return TRUE;
+}
+
+static gboolean __changed_context(DBusConnection *connection, DBusMessage *message, void *user_data)
 {
        DBG("network changed signal");
 
        gboolean active = FALSE;
        const char *path = dbus_message_get_path(message);
-       struct sonet_network *info;
+       struct telephony_network *info;
        DBusMessageIter args, dict;
 
        DBG("path %s", path);
@@ -1120,23 +1371,29 @@ static gboolean __changed_network(DBusConnection *connection, DBusMessage *messa
 
        if (active == FALSE)
                __set_network_connected(info, active);
-       else if (connman_network_get_connecting(info->network) == TRUE)
+       else if ( (connman_network_get_connecting(info->network) ||
+                       connman_network_get_associating(info->network)) )
                __set_network_connected(info, active);
 
        return TRUE;
 }
 
-static gboolean __added_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __added_context(DBusConnection *connection, DBusMessage *message, void *user_data)
 {
        DBG("network added signal");
 
        DBusMessageIter args, dict, tmp;
        const char *path = dbus_message_get_path(message);
        const char *network_path = NULL;
-       struct sonet_modem *modem;
+       struct telephony_service *service = NULL;
+       struct telephony_modem *modem = NULL;
 
-       modem = g_hash_table_lookup(modem_hash, path);
-       if (modem == NULL || modem->device == NULL)
+       service = g_hash_table_lookup(service_hash, path);
+       if (service == NULL || service->p_modem == NULL)
+               return TRUE;
+
+       modem = service->p_modem;
+       if(modem == NULL || modem->device == NULL)
                return TRUE;
 
        DBG("message signature (%s)", dbus_message_get_signature(message));
@@ -1168,23 +1425,24 @@ static gboolean __added_network(DBusConnection *connection, DBusMessage *message
        }
 
        if (network_path != NULL) {
-               __add_network(modem->device, network_path, &dict);
+               __add_context(modem->device, network_path, &dict);
        }
 
        return TRUE;
 }
 
-static gboolean __removed_network(DBusConnection *connection, DBusMessage *message, void *user_data)
+static gboolean __removed_context(DBusConnection *connection, DBusMessage *message, void *user_data)
 {
        DBG("network removed signal");
 
        DBusMessageIter iter;
        const char *path = dbus_message_get_path(message);
        const char *network_path = NULL;
-       struct sonet_modem *modem;
+       struct telephony_service *service = NULL;
+       struct telephony_modem *modem = NULL;
 
-       modem = g_hash_table_lookup(modem_hash, path);
-       if (modem == NULL || modem->device == NULL)
+       service = g_hash_table_lookup(service_hash, path);
+       if (service == NULL || service->p_modem == NULL)
                return TRUE;
 
        if (dbus_message_iter_init(message, &iter) == FALSE) {
@@ -1198,90 +1456,60 @@ static gboolean __removed_network(DBusConnection *connection, DBusMessage *messa
        return TRUE;
 }
 
-/*
-static void __response_network_deactivate(DBusPendingCall *call, void *user_data)
-{
-       struct sonet_network *network;
-       DBusMessage *reply;
-       DBusError error;
-       DBusMessageIter args, dict;
-
-       DBG("");
-       network = (struct sonet_network*) user_data;
-
-       reply = dbus_pending_call_steal_reply(call);
-
-       dbus_error_init(&error);
-
-       if (dbus_set_error_from_message(&error, reply)) {
-               connman_error("connection deactivate() %s %s",error.name, error.message);
-               dbus_error_free(&error);
-               goto done;
-       }
-
-       DBG("message signature (%s)", dbus_message_get_signature(reply));
-
-       if (dbus_message_iter_init(reply, &args) == FALSE)
-               goto done;
-
-       //extract network path
-       const char* network_path;
-       dbus_message_iter_get_basic(&args, &network_path);
-
-       DBG("network_path is (%s)", network_path);
-
-       //compare the path
-       __clean_network_ip_info(network);
-       __set_connman_connected(network, FALSE);
-
-done:
-       dbus_message_unref(reply);
-       dbus_pending_call_unref(call);
-       return;
-}
-*/
-
-// sonet initialization
+// telephony initialization
 static guint watch;
 static guint modem_watch;
 static guint modem_added_watch;
 static guint modem_removed_watch;
-static guint network_watch;
-static guint network_added_watch;
-static guint network_removed_watch;
-
-static int sonet_init(void)
+static guint service_watch;
+static guint service_added_watch;
+static guint service_removed_watch;
+static guint context_watch;
+static guint context_added_watch;
+static guint context_removed_watch;
+
+static int telephony_init(void)
 {
-       DBG("sonet plugin");
+       DBG("telephony plugin");
        int err;
 
        connection = connman_dbus_get_connection();
        if (connection == NULL)
                return -EIO;
 
-       // sonet watch
-       watch = g_dbus_add_service_watch(connection, SONET_SERVICE,     sonet_connect, sonet_disconnect, NULL, NULL);
+       // telephony watch
+       watch = g_dbus_add_service_watch(connection, PS_DBUS_SERVICE,   telephony_connect, telephony_disconnect, NULL, NULL);
 
-       modem_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
+       modem_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
                                                PROPERTY_CHANGED, __changed_modem, NULL, NULL);
 
-       modem_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MASTER_INTERFACE,
+       modem_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MASTER_INTERFACE,
                                                MODEM_ADDED, __added_modem, NULL, NULL);
 
-       modem_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MASTER_INTERFACE,
+       modem_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MASTER_INTERFACE,
                                                MODEM_REMOVED, __removed_modem, NULL, NULL);
 
-       network_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_NETWORK_INTERFACE,
-                                               PROPERTY_CHANGED, __changed_network, NULL, NULL);
+       service_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+                                               PROPERTY_CHANGED, __changed_service, NULL, NULL);
+
+       service_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
+                                               SERVICE_ADDED, __added_service, NULL, NULL);
+
+       service_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_MODEM_INTERFACE,
+                                               SERVICE_REMOVED, __removed_service, NULL, NULL);
+
+       context_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_CONTEXT_INTERFACE,
+                                               PROPERTY_CHANGED, __changed_context, NULL, NULL);
 
-       network_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
-                                               NETWORK_ADDED, __added_network, NULL, NULL);
+       context_added_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+                                               CONTEXT_ADDED, __added_context, NULL, NULL);
 
-       network_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, SONET_MODEM_INTERFACE,
-                                               NETWORK_REMOVED, __removed_network, NULL, NULL);
+       context_removed_watch = g_dbus_add_signal_watch(connection, NULL, NULL, PS_SERVICE_INTERFACE,
+                                               CONTEXT_REMOVED, __removed_context, NULL, NULL);
 
-       if (watch == 0 || modem_watch == 0 || modem_added_watch == 0 || modem_removed_watch == 0 ||
-                       network_watch == 0 || network_added_watch == 0 || network_removed_watch == 0) {
+       if (watch == 0 || modem_watch == 0 || modem_added_watch == 0 || modem_removed_watch == 0
+                       || service_watch == 0 || service_added_watch == 0 || service_removed_watch == 0
+                       || context_watch == 0 || context_added_watch == 0 || context_removed_watch == 0) {
                err = -EIO;
                goto remove;
        }
@@ -1303,25 +1531,31 @@ remove:
        g_dbus_remove_watch(connection, modem_watch);
        g_dbus_remove_watch(connection, modem_added_watch);
        g_dbus_remove_watch(connection, modem_removed_watch);
-       g_dbus_remove_watch(connection, network_watch);
-       g_dbus_remove_watch(connection, network_added_watch);
-       g_dbus_remove_watch(connection, network_removed_watch);
+       g_dbus_remove_watch(connection, service_watch);
+       g_dbus_remove_watch(connection, service_added_watch);
+       g_dbus_remove_watch(connection, service_removed_watch);
+       g_dbus_remove_watch(connection, context_watch);
+       g_dbus_remove_watch(connection, context_added_watch);
+       g_dbus_remove_watch(connection, context_removed_watch);
 
        dbus_connection_unref(connection);
        return err;
 }
 
-static void sonet_exit(void)
+static void telephony_exit(void)
 {
        g_dbus_remove_watch(connection, watch);
        g_dbus_remove_watch(connection, modem_watch);
        g_dbus_remove_watch(connection, modem_added_watch);
        g_dbus_remove_watch(connection, modem_removed_watch);
-       g_dbus_remove_watch(connection, network_watch);
-       g_dbus_remove_watch(connection, network_added_watch);
-       g_dbus_remove_watch(connection, network_removed_watch);
+       g_dbus_remove_watch(connection, service_watch);
+       g_dbus_remove_watch(connection, service_added_watch);
+       g_dbus_remove_watch(connection, service_removed_watch);
+       g_dbus_remove_watch(connection, context_watch);
+       g_dbus_remove_watch(connection, context_added_watch);
+       g_dbus_remove_watch(connection, context_removed_watch);
 
-       sonet_disconnect(connection, NULL);
+       telephony_disconnect(connection, NULL);
 
        connman_device_driver_unregister(&modem_driver);
        connman_network_driver_unregister(&network_driver);
@@ -1329,5 +1563,5 @@ static void sonet_exit(void)
        dbus_connection_unref(connection);
 }
 
-CONNMAN_PLUGIN_DEFINE(sonet, "Samsung OpenSrc Network Framework plugin", VERSION,
-               CONNMAN_PLUGIN_PRIORITY_DEFAULT, sonet_init, sonet_exit)
+CONNMAN_PLUGIN_DEFINE(telephony, "Samsung Telephony Framework plug-in", VERSION,
+               CONNMAN_PLUGIN_PRIORITY_DEFAULT, telephony_init, telephony_exit)
similarity index 54%
rename from debian/net.connman.service.in
rename to resources/usr/share/dbus-1/services/net.connman.service
index c330f99..4ef877b 100644 (file)
@@ -1,4 +1,4 @@
 [D-BUS Service]
 Name=net.connman
-Exec=@PREFIX@/sbin/connmand -W wext
+Exec=/usr/sbin/connmand -W wext
 User=root
diff --git a/resources/var/lib/connman/default.profile b/resources/var/lib/connman/default.profile
new file mode 100644 (file)
index 0000000..ab8d41c
--- /dev/null
@@ -0,0 +1,3 @@
+
+[device_Wireless]
+Powered=false
index 8df3065..3f70baf 100755 (executable)
@@ -384,11 +384,6 @@ const char *__connman_device_get_type(struct connman_device *device);
 
 int __connman_device_set_offlinemode(connman_bool_t offlinemode);
 
-#if defined TIZEN_EXT
-connman_uint8_t __connman_device_get_bgscan_mode();
-int __connman_device_set_bgscan_mode(connman_uint8_t scanmode);
-#endif
-
 #include <connman/network.h>
 
 int __connman_network_init(void);
@@ -546,7 +541,7 @@ void __connman_service_set_pac(struct connman_service *service,
                                        const char *pac);
 #if defined TIZEN_EXT
 /*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
  */
 void __connman_service_set_proxy(struct connman_service *service,
                                        const char *proxies);
@@ -629,9 +624,6 @@ void __connman_notifier_connect(enum connman_service_type type);
 void __connman_notifier_disconnect(enum connman_service_type type);
 void __connman_notifier_offlinemode(connman_bool_t enabled);
 #if defined TIZEN_EXT
-void __connman_notifier_cellular_service_enabled(connman_bool_t enabled);
-#endif
-#if defined TIZEN_EXT
 void __connman_notifier_scan_completed(connman_bool_t success);
 #endif
 void __connman_notifier_default_changed(struct connman_service *service);
@@ -707,12 +699,3 @@ void __connman_dnsproxy_flush(void);
 int __connman_6to4_probe(struct connman_service *service);
 void __connman_6to4_remove(struct connman_ipconfig *ipconfig);
 int __connman_6to4_check(struct connman_ipconfig *ipconfig);
-
-#if defined TIZEN_EXT
-enum connman_bgscan_mode
-{
-       CONNMAN_BGSCAN_MODE_DEFAULT,
-       CONNMAN_BGSCAN_MODE_PERIODIC,
-       CONNMAN_BGSCAN_MODE_EXPONENTIAL,
-};
-#endif
index f25bf0c..d98ebb1 100644 (file)
@@ -68,8 +68,8 @@ struct connman_device {
        GHashTable *networks;
 
 #if defined TIZEN_EXT
-       connman_bool_t cellular_service_enabled;
-       enum connman_bgscan_mode bgscan_mode;
+       /* It contains number of favorite Wi-Fi profile.
+        * If significant wifi profile is 0, Wi-Fi device does not trigger scan. */
        gint significant_wifi_profile_refcount;
 #endif
 };
@@ -77,15 +77,6 @@ struct connman_device {
 #define SCAN_INITIAL_DELAY 10
 
 #if defined TIZEN_EXT
-#define SCAN_PERIODIC_DELAY 10
-#define SCAN_DEFAULT_DELAY 300
-#define SCAN_EXPONENTIAL_MAX   128
-#define SCAN_EXPONENTIAL_MIN   4
-
-static void set_next_scan_trigger(struct connman_device * device);
-#endif
-
-#if defined TIZEN_EXT
 static void __connman_device_set_significant_wifi_profile_refcount(struct connman_device *device, gint refcount)
 {
        g_atomic_int_set(&device->significant_wifi_profile_refcount, refcount);
@@ -111,13 +102,6 @@ static connman_bool_t __connman_device_is_no_ref_significant_wifi_profile(struct
 
 static gboolean device_scan_trigger(gpointer user_data)
 {
-#if defined TIZEN_EXT
-       GHashTableIter iter;
-       gpointer key, value;
-       connman_bool_t connected = FALSE;
-       connman_bool_t connecting = FALSE;
-       connman_bool_t associating = FALSE;
-#endif
        struct connman_device *device = user_data;
 
        DBG("device %p", device);
@@ -127,47 +111,6 @@ static gboolean device_scan_trigger(gpointer user_data)
                return FALSE;
        }
 
-#if defined TIZEN_EXT
-       g_hash_table_iter_init(&iter, device->networks);
-
-       while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
-               struct connman_network *network = value;
-
-               if (connman_network_get_type(network) != CONNMAN_NETWORK_TYPE_WIFI)
-                       continue;
-
-               /*
-                * If there is a connected or connecting network, don't try to scan.
-                */
-               connected = connman_network_get_connected(network);
-               connecting = connman_network_get_connecting(network);
-               associating = connman_network_get_associating(network);
-
-               if (device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL) {
-                       if (connected == TRUE) {
-                               DBG("network(%s) is connected.", connman_network_get_string(network, "Name"));
-
-                               set_next_scan_trigger(device);
-                               return TRUE;
-                       } else if ((connecting == TRUE) || (associating == TRUE)) {
-                               DBG("network(%s) is connecting.", connman_network_get_string(network, "Name"));
-
-                               set_next_scan_trigger(device);
-                               return TRUE;
-                       }
-
-                       if (__connman_device_is_no_ref_significant_wifi_profile(device) == TRUE) {
-                               DBG("There is no saved profile and no need to scan.");
-
-                               set_next_scan_trigger(device);
-                               return TRUE;
-                       }
-               }
-       }
-
-       set_next_scan_trigger(device);
-#endif
-
        if (device->driver->scan)
                device->driver->scan(device);
 
@@ -182,65 +125,6 @@ static void clear_scan_trigger(struct connman_device *device)
        }
 }
 
-#if defined TIZEN_EXT
-static void create_scan_trigger(struct connman_device * device)
-{
-       clear_scan_trigger(device);
-
-       if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_PERIODIC)
-               device->scan_interval = SCAN_PERIODIC_DELAY;
-       else if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL)
-               device->scan_interval = SCAN_EXPONENTIAL_MIN;
-       else
-               device->scan_interval = SCAN_DEFAULT_DELAY;
-
-       DBG("interval %d", device->scan_interval);
-
-       device->scan_timeout = g_timeout_add_seconds(device->scan_interval,
-                               device_scan_trigger, device);
-}
-
-static void set_next_scan_trigger(struct connman_device * device)
-{
-       clear_scan_trigger(device);
-
-       DBG("bgscan mode (%d) , current interval (%d)", device->bgscan_mode, device->scan_interval);
-
-       if(device->scan_interval <= 0)
-               return;
-
-       guint interval;
-
-       if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_DEFAULT)
-       {
-               if (g_hash_table_size(device->networks) == 0) {
-                       if (device->backoff_interval >= device->scan_interval)
-                               device->backoff_interval = SCAN_INITIAL_DELAY;
-                       interval = device->backoff_interval;
-               } else
-                       interval = device->scan_interval;
-
-               device->backoff_interval *= 2;
-               if (device->backoff_interval > device->scan_interval)
-                       device->backoff_interval = device->scan_interval;
-       }
-       else if(device->bgscan_mode == CONNMAN_BGSCAN_MODE_EXPONENTIAL)
-       {
-               if(device->scan_interval >= SCAN_EXPONENTIAL_MAX)
-                       device->scan_interval = SCAN_EXPONENTIAL_MAX;
-               else
-                       device->scan_interval *= 2;
-       }
-
-       interval = device->scan_interval;
-
-       DBG("next interval (%d)", interval);
-
-       device->scan_timeout = g_timeout_add_seconds(interval,
-                               device_scan_trigger, device);
-}
-#endif
-
 static void reset_scan_trigger(struct connman_device *device)
 {
        clear_scan_trigger(device);
@@ -248,13 +132,6 @@ static void reset_scan_trigger(struct connman_device *device)
        if (device->scan_interval > 0) {
                guint interval;
 
-#if defined TIZEN_EXT
-               interval = device->scan_interval;
-
-               DBG("interval %d", interval);
-               device->scan_timeout = g_timeout_add_seconds(interval,
-                                       device_scan_trigger, device);
-#else
                if (g_hash_table_size(device->networks) == 0) {
                        if (device->backoff_interval >= device->scan_interval)
                                device->backoff_interval = SCAN_INITIAL_DELAY;
@@ -270,7 +147,6 @@ static void reset_scan_trigger(struct connman_device *device)
                device->backoff_interval *= 2;
                if (device->backoff_interval > device->scan_interval)
                        device->backoff_interval = device->scan_interval;
-#endif
        }
 }
 
@@ -712,9 +588,6 @@ struct connman_device *connman_device_create(const char *node,
        struct connman_device *device;
        enum connman_service_type service_type;
        connman_bool_t bg_scan;
-#if defined TIZEN_EXT
-       connman_uint8_t bg_scan_mode;
-#endif
 
        DBG("node %s type %d", node, type);
 
@@ -727,11 +600,6 @@ struct connman_device *connman_device_create(const char *node,
        device->refcount = 1;
 
        bg_scan = connman_setting_get_bool("BackgroundScanning");
-
-#if defined TIZEN_EXT
-       bg_scan_mode = connman_setting_get_int("BackgroundScanningMode");
-       device->cellular_service_enabled = TRUE;
-#endif
 #if defined TIZEN_EXT
        if (type == CONNMAN_DEVICE_TYPE_WIFI) {
                /* Load significant_wifi_profile_refcount */
@@ -766,16 +634,7 @@ struct connman_device *connman_device_create(const char *node,
                break;
        case CONNMAN_DEVICE_TYPE_WIFI:
                if (bg_scan == TRUE)
-               {
-#if defined TIZEN_EXT
-                       device->bgscan_mode = bg_scan_mode;
-#endif
                        device->scan_interval = 300;
-
-#if defined TIZEN_EXT
-                       create_scan_trigger(device);
-#endif
-               }
                else
                        device->scan_interval = 0;
                break;
@@ -918,21 +777,6 @@ const char *connman_device_get_ident(struct connman_device *device)
        return device->ident;
 }
 
-#if defined TIZEN_EXT
-int connman_device_set_cellular_service_enabled(struct connman_device *device, connman_bool_t enabled)
-{
-       if (device == NULL)
-                       return 0;
-
-       DBG("device (%p), cellular service enabled (%d)", device, enabled);
-
-       device->cellular_service_enabled = enabled;
-       __connman_notifier_cellular_service_enabled(enabled);
-
-       return 0;
-}
-#endif
-
 /**
  * connman_device_set_powered:
  * @device: device structure
@@ -961,10 +805,6 @@ int connman_device_set_powered(struct connman_device *device,
        if (err < 0 && err != -EINPROGRESS && err != -EALREADY)
                return err;
 
-#if defined TIZEN_EXT
-       device->cellular_service_enabled =powered;
-#endif
-
        device->powered = powered;
        device->powered_pending = powered;
 
@@ -1025,50 +865,31 @@ int __connman_device_scan(struct connman_device *device)
                return -ENOLINK;
 
 #if defined TIZEN_EXT
-       /* scan trigger should be started with initial interval */
-       create_scan_trigger(device);
-#else
-       reset_scan_trigger(device);
-#endif
-
-       return device->driver->scan(device);
-}
-
-#if defined TIZEN_EXT
-connman_uint8_t __connman_device_get_bgscan_mode()
-{
-       struct connman_device * device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
-
-       if ((device == NULL) || (!device->driver))
-               return -EOPNOTSUPP;
-
-       if (device->powered == FALSE)
-               return -ENOLINK;
-
-       DBG("current bgscan mode : %d", device->bgscan_mode);
-
-       return device->bgscan_mode;
-}
-
-int __connman_device_set_bgscan_mode(connman_uint8_t scanmode)
-{
-       struct connman_device * device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
+       GHashTableIter iter;
+       gpointer key, value;
 
-       if ((device == NULL) || (!device->driver))
-               return -EOPNOTSUPP;
+       g_hash_table_iter_init(&iter, device->networks);
 
-       if (device->powered == FALSE)
-               return -ENOLINK;
+       while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
+               struct connman_network *network = value;
 
-       DBG("bgscan mode : %d", scanmode);
+               DBG("network type %s", __connman_network_get_type(network));
+               if (connman_network_get_type(network) != CONNMAN_NETWORK_TYPE_WIFI)
+                       continue;
 
-       device->bgscan_mode = scanmode;
+               /* If there is a connected or connecting network, don't try to scan. */
+               if (connman_network_get_connecting(network) == TRUE ||
+                               connman_network_get_associating(network) == TRUE) {
+                       DBG("network(%s) is connecting", connman_network_get_string(network, "Name"));
+                       return 0;
+               }
+       }
+#endif
 
-       create_scan_trigger(device);
+       reset_scan_trigger(device);
 
-       return 0;
+       return device->driver->scan(device);
 }
-#endif
 
 int __connman_device_enable_persistent(struct connman_device *device)
 {
index 3775d76..9735ced 100755 (executable)
@@ -655,6 +655,13 @@ update:
                        ipconfig->ops->down(ipconfig);
        }
 
+#if defined TIZEN_EXT
+       if (g_strcmp0(ipdevice->address, address) != 0) {
+               g_free(ipdevice->address);
+               ipdevice->address = g_strdup(address);
+       }
+#endif
+
        if (lower_up)
                __connman_ipconfig_lower_up(ipdevice);
        if (lower_down)
@@ -1063,13 +1070,6 @@ const char *__connman_ipconfig_get_local(struct connman_ipconfig *ipconfig)
        return ipconfig->address->local;
 }
 
-#if defined TIZEN_EXT
-const char *connman_ipconfig_get_local(struct connman_ipconfig *ipconfig)
-{
-       return __connman_ipconfig_get_local(ipconfig);
-}
-#endif 
-
 void __connman_ipconfig_set_local(struct connman_ipconfig *ipconfig, const char *address)
 {
        if (ipconfig->address == NULL)
index ad89ad1..646bfbb 100644 (file)
--- a/src/log.c
+++ b/src/log.c
 
 #include "connman.h"
 
+#if defined TIZEN_EXT
+#include <stdio.h>
+#include <unistd.h>
+#include <sys/stat.h>
+
+#define LOG_FILE_PATH "/var/log/connman.log"
+#define MAX_LOG_SIZE   2 * 1024 * 1024
+#define MAX_LOG_COUNT  9
+
+#define openlog __connman_log_open
+#define closelog __connman_log_close
+#define vsyslog __connman_log
+#define syslog __connman_log_s
+
+static FILE *log_file = NULL;
+
+void __connman_log_open(const char *ident, int option, int facility)
+{
+       if (log_file == NULL)
+               log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+}
+
+void __connman_log_close(void)
+{
+       fclose(log_file);
+       log_file = NULL;
+}
+
+static void __connman_log_update_file_revision(int rev)
+{
+       int next_log_rev = 0;
+       char *log_file = NULL;
+       char *next_log_file = NULL;
+
+       next_log_rev = rev + 1;
+
+       log_file = g_strdup_printf("%s.%d", LOG_FILE_PATH, rev);
+       next_log_file = g_strdup_printf("%s.%d", LOG_FILE_PATH, next_log_rev);
+
+       if (next_log_rev >= MAX_LOG_COUNT)
+               remove(next_log_file);
+
+       if (access(next_log_file, F_OK) == 0)
+               __connman_log_update_file_revision(next_log_rev);
+
+       if (rename(log_file, next_log_file) != 0)
+               remove(log_file);
+
+       g_free(log_file);
+       g_free(next_log_file);
+}
+
+static void __connman_log_make_backup(void)
+{
+       const int rev = 0;
+       char *backup = NULL;
+
+       backup = g_strdup_printf("%s.%d", LOG_FILE_PATH, rev);
+
+       if (access(backup, F_OK) == 0)
+               __connman_log_update_file_revision(rev);
+
+       if (rename(LOG_FILE_PATH, backup) != 0)
+               remove(LOG_FILE_PATH);
+
+       g_free(backup);
+}
+
+static void __connman_log_get_local_time(char *strtime, const int size)
+{
+       time_t buf;
+       struct tm *local_ptm;
+
+       time(&buf);
+       buf = time(NULL);
+       local_ptm = localtime(&buf);
+
+       strftime(strtime, size, "%D %H:%M:%S", local_ptm);
+}
+
+void __connman_log(const int log_priority, const char *format, va_list ap)
+{
+       int log_size = 0;
+       struct stat buf;
+       char str[256];
+       char strtime[40];
+
+       if (log_file == NULL)
+               log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+
+       if (log_file == NULL)
+               return;
+
+       fstat(fileno(log_file), &buf);
+       log_size = buf.st_size;
+
+       if (log_size >= MAX_LOG_SIZE) {
+               fclose(log_file);
+               log_file = NULL;
+
+               __connman_log_make_backup();
+
+               log_file = (FILE *)fopen(LOG_FILE_PATH, "a+");
+
+               if (log_file == NULL)
+                       return;
+       }
+
+       __connman_log_get_local_time(strtime, sizeof(strtime));
+
+       if (vsnprintf(str, sizeof(str), format, ap) > 0)
+               fprintf(log_file, "%s %s\n", strtime, str);
+}
+
+void __connman_log_s(int log_priority, const char *format, ...)
+{
+       va_list ap;
+
+       va_start(ap, format);
+
+       vsyslog(LOG_DEBUG, format, ap);
+
+       va_end(ap);
+}
+#endif
+
 /**
  * connman_info:
  * @format: format string
index 314973e..c077356 100755 (executable)
 
 static struct {
        connman_bool_t bg_scan;
-#if defined TIZEN_EXT
-       connman_uint8_t bg_scan_mode;
-#endif
+       connman_bool_t single_connection;
 } connman_settings  = {
        .bg_scan = TRUE,
-#if defined TIZEN_EXT
-       .bg_scan_mode = CONNMAN_BGSCAN_MODE_DEFAULT,
-#endif
+       .single_connection = FALSE,
 };
 
 static GKeyFile *load_config(const char *file)
@@ -94,19 +90,13 @@ static void parse_config(GKeyFile *config)
        if (error == NULL)
                connman_settings.bg_scan = boolean;
 
-#if defined TIZEN_EXT
-       {
-               unsigned char mode;
+       g_clear_error(&error);
 
-               DBG("-------------bg scan : %d", boolean);
+       boolean = g_key_file_get_boolean(config, "General",
+                       "SingleConnection", &error);
+       if (error == NULL)
+               connman_settings.single_connection = boolean;
 
-               mode = g_key_file_get_integer(config, "General", "BackgroundScanningMode", &error);
-               if (error == NULL)
-                       connman_settings.bg_scan_mode = mode;
-               
-               DBG("-------------bg scan mode : %d", mode);
-       }
-#endif
        g_clear_error(&error);
 }
 
@@ -257,18 +247,11 @@ connman_bool_t connman_setting_get_bool(const char *key)
        if (g_str_equal(key, "BackgroundScanning") == TRUE)
                return connman_settings.bg_scan;
 
-       return FALSE;
-}
-
-#if defined TIZEN_EXT
-connman_uint16_t connman_setting_get_int(const char * key)
-{
-       if (g_str_equal(key, "BackgroundScanningMode") == TRUE)
-               return connman_settings.bg_scan_mode;
+       if (g_str_equal(key, "SingleConnection") == TRUE)
+               return connman_settings.single_connection;
 
-       return 0;
+       return FALSE;
 }
-#endif
 
 int main(int argc, char *argv[])
 {
index e76eabb..89bca06 100644 (file)
@@ -6,4 +6,4 @@
 # mechanism starting from 10s up to 5 minutes will run.
 
 BackgroundScanning = true
-BackgroundScanningMode = 2
+SingleConnection = true
index baa1e40..34081a6 100755 (executable)
@@ -38,9 +38,6 @@ static DBusMessage *get_properties(DBusConnection *conn,
        DBusMessage *reply;
        DBusMessageIter array, dict;
        connman_bool_t offlinemode, sessionmode;
-#if defined TIZEN_EXT
-       connman_uint8_t bgscanmode;
-#endif
        const char *str;
 
        DBG("conn %p", conn);
@@ -92,10 +89,7 @@ static DBusMessage *get_properties(DBusConnection *conn,
        connman_dbus_dict_append_basic(&dict, "SessionMode",
                                        DBUS_TYPE_BOOLEAN,
                                        &sessionmode);
-#if defined TIZEN_EXT
-       bgscanmode = __connman_device_get_bgscan_mode();
-       connman_dbus_dict_append_basic(&dict, "ScanMode", DBUS_TYPE_BYTE, &bgscanmode);
-#endif 
+
        connman_dbus_dict_close(&array, &dict);
 
        return reply;
@@ -154,17 +148,6 @@ static DBusMessage *set_property(DBusConnection *conn,
                        return NULL;
                }
 
-#if defined TIZEN_EXT
-       } else if (g_str_equal(name, "ScanMode") == TRUE) {
-               connman_uint16_t scanmode;
-
-               dbus_message_iter_get_basic(&value, &scanmode);
-
-               if ((scanmode > CONNMAN_BGSCAN_MODE_EXPONENTIAL) || (scanmode < CONNMAN_BGSCAN_MODE_DEFAULT))
-                       return __connman_error_invalid_arguments(msg);
-
-               __connman_device_set_bgscan_mode(scanmode);
-#endif
        } else
                return __connman_error_invalid_property(msg);
 
index 403f173..91fe688 100755 (executable)
@@ -1134,9 +1134,8 @@ static gboolean set_connected(gpointer user_data)
                }
 
 #if defined TIZEN_EXT
-               int service_type = 0;
-               service_type = connman_service_get_type(service);
-               if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR){
+               if (connman_service_get_type(service) ==
+                               CONNMAN_SERVICE_TYPE_CELLULAR) {
                        network->connecting = FALSE;
                        connman_network_set_associating(network, FALSE);
                }
@@ -1150,9 +1149,9 @@ static gboolean set_connected(gpointer user_data)
                                        CONNMAN_IPCONFIG_TYPE_IPV6);
 
 #if defined TIZEN_EXT
-               if(service_type == CONNMAN_SERVICE_TYPE_CELLULAR){
+               if (connman_service_get_type(service) ==
+                               CONNMAN_SERVICE_TYPE_CELLULAR)
                        return FALSE;
-               }
 #endif
        }
 
@@ -1245,8 +1244,8 @@ int __connman_network_connect(struct connman_network *network)
 
 #if defined TIZEN_EXT
        if (network->type != CONNMAN_NETWORK_TYPE_CELLULAR)
-               __connman_device_disconnect(network->device);
 #endif
+       __connman_device_disconnect(network->device);
 
        err = network->driver->connect(network);
        if (err < 0) {
@@ -1442,7 +1441,7 @@ int connman_network_set_ipaddress(struct connman_network *network,
 
 #if defined TIZEN_EXT
 /*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
  */
 int connman_network_set_proxy(struct connman_network *network,
                                const char *proxies)
@@ -1519,6 +1518,26 @@ const char *connman_network_get_enc_mode(struct connman_network *network)
 {
        return (const char *)network->wifi.encryption_mode;
 }
+
+const char *connman_network_get_ifname(struct connman_network *network)
+{
+       struct connman_service *service;
+       struct connman_ipconfig *ipconfig;
+       const char *ifname = NULL;
+
+       service = __connman_service_lookup_from_network(network);
+       if (service == NULL)
+               return NULL;
+
+       ipconfig = __connman_service_get_ip4config(service);
+
+       if (ipconfig != NULL)
+               ifname = connman_ipconfig_get_ifname(ipconfig);
+
+       DBG("index %d, service %p ip4config %p ifname %s",
+                       network->index, service, ipconfig, ifname);
+       return ifname;
+}
 #endif
 
 int connman_network_set_nameservers(struct connman_network *network,
index 63b7bfd..b8917d9 100644 (file)
@@ -498,21 +498,6 @@ static void notify_idle_state(connman_bool_t idle)
 }
 
 #if defined TIZEN_EXT
-void __connman_notifier_cellular_service_enabled(connman_bool_t enabled)
-{
-       GSList *list;
-       DBG("cellular connection available");
-
-       for (list = notifier_list; list; list = list->next) {
-               struct connman_notifier *notifier = list->data;
-
-               if (notifier->cellular_service_enabled)
-                       notifier->cellular_service_enabled(enabled);
-       }
-}
-#endif
-
-#if defined TIZEN_EXT
 /*
  * August 22nd, 2011. TIZEN
  *
index 766d68f..4a15fcf 100644 (file)
@@ -469,9 +469,9 @@ static void process_newlink(unsigned short type, int index, unsigned flags,
 
                if (type == ARPHRD_ETHER)
                        read_uevent(interface);
-               
+
 #if defined TIZEN_EXT
-               if(type == ARPHRD_PPP){
+               if (type == ARPHRD_PPP) {
                        interface->service_type = CONNMAN_SERVICE_TYPE_CELLULAR;
                        interface->device_type = CONNMAN_DEVICE_TYPE_CELLULAR;
                }
index 24941a9..2d6ddad 100644 (file)
@@ -116,48 +116,41 @@ struct connman_service {
         *              It's only for PDP (cellular) bearer. Wi-Fi is managed by ConnMan automatically.
         *              Reference count can help to manage open/close connection requests by each application.
         */
-       gint user_initiated_pdp_connection_refcount;
-       connman_bool_t alwayson;
+       gint user_initiated_pdn_connection_refcount;
 #endif
 };
 
 #if defined TIZEN_EXT
 /*
- * Public APIs to use user_initiated_pdp_connection_refcount
+ * Public APIs to use user_initiated_pdn_connection_refcount
  */
-void connman_service_user_initiated_pdp_connection_ref(struct connman_service *service)
+void connman_service_user_initiated_pdn_connection_ref(
+               struct connman_service *service)
 {
-       g_atomic_int_inc(&service->user_initiated_pdp_connection_refcount);
-       DBG("User try to make a PDP connection with already referenced count: %d", service->user_initiated_pdp_connection_refcount);
+       g_atomic_int_inc(&service->user_initiated_pdn_connection_refcount);
+       DBG("User try to make a PDP connection with already referenced count: %d",
+                       service->user_initiated_pdn_connection_refcount);
 }
 
-connman_bool_t connman_service_user_initiated_pdp_connection_unref_and_test(struct connman_service *service)
+connman_bool_t connman_service_user_initiated_pdn_connection_unref_and_test(
+               struct connman_service *service)
 {
        connman_bool_t test_zero = TRUE;
 
-       if (service->user_initiated_pdp_connection_refcount > 0)
-               test_zero = g_atomic_int_dec_and_test(&service->user_initiated_pdp_connection_refcount);
+       if (service->user_initiated_pdn_connection_refcount > 0)
+               test_zero = g_atomic_int_dec_and_test(&service->user_initiated_pdn_connection_refcount);
 
-       DBG("User try to disconnect existing PDP connection with already unreferenced count: %d", service->user_initiated_pdp_connection_refcount);
+       DBG("User try to disconnect existing PDP connection with already unreferenced count: %d",
+                       service->user_initiated_pdn_connection_refcount);
 
        return test_zero;
 }
 
-connman_bool_t connman_service_is_no_ref_user_initiated_pdp_connection(struct connman_service *service)
+connman_bool_t connman_service_is_no_ref_user_initiated_pdn_connection(
+               struct connman_service *service)
 {
-       return g_atomic_int_compare_and_exchange(&service->user_initiated_pdp_connection_refcount, 0, 0);
-}
-
-void connman_service_set_alwayson(struct connman_service *service, connman_bool_t state)
-{
-       if (service == NULL) {
-               DBG("serivce does not exist");
-               return;
-       }
-
-       DBG("always on old state(%d) new state (%d)", service->alwayson, state);
-       service->alwayson = state;
-       return;
+       return g_atomic_int_compare_and_exchange(&service->user_initiated_pdn_connection_refcount,
+                       0, 0);
 }
 #endif
 
@@ -902,9 +895,6 @@ const char *__connman_service_default(void)
 static void state_changed(struct connman_service *service)
 {
        const char *str;
-#if defined TIZEN_EXT
-       const char *str_err;
-#endif
 
        __connman_notifier_service_state_changed(service, service->state);
 
@@ -913,7 +903,7 @@ static void state_changed(struct connman_service *service)
                return;
 
 #if defined TIZEN_EXT
-       str_err = error2string(service->error);
+       const char *str_err = error2string(service->error);
        if ((service->state == CONNMAN_SERVICE_STATE_FAILURE) && (str_err != NULL))
                connman_dbus_service_property_changed_with_error_cause(service->path,
                                CONNMAN_SERVICE_INTERFACE, "State", DBUS_TYPE_STRING, &str,
@@ -1371,11 +1361,189 @@ static void domain_configuration_changed(struct connman_service *service)
                                DBUS_TYPE_STRING, append_domainconfig, service);
 }
 
+#if defined TIZEN_EXT
+static int __connman_service_dbus_update_default_info(int type, ...)
+{
+#define NETCONFIG_SERVICE                                      "net.netconfig"
+#define NETCONFIG_NETWORK_STATE_INTERFACE      NETCONFIG_SERVICE ".network"
+#define NETCONFIG_NETWORK_STATE_PATH           "/net/netconfig/network"
+       DBusMessage *message;
+       DBusPendingCall *call;
+       dbus_bool_t ok;
+       va_list va;
+
+       message = dbus_message_new_method_call(NETCONFIG_SERVICE,
+                       NETCONFIG_NETWORK_STATE_PATH,
+                       NETCONFIG_NETWORK_STATE_INTERFACE, "UpdateDefaultConnectionInfo");
+
+       if (message == NULL)
+               return -ENOMEM;
+
+       dbus_message_set_auto_start(message, FALSE);
+
+       va_start(va, type);
+       ok = dbus_message_append_args_valist(message, type, va);
+       va_end(va);
+
+       if (!ok)
+               return -ENOMEM;
+
+       if (dbus_connection_send_with_reply(connection, message, &call, 40000) == FALSE) {
+               connman_error("Failed to call %s.%s", NETCONFIG_NETWORK_STATE_INTERFACE,
+                               "UpdateDefaultConnectionInfo");
+               dbus_message_unref(message);
+               return -EINVAL;
+       }
+
+       if (call == NULL) {
+               connman_error("D-Bus connection not available");
+               dbus_message_unref(message);
+               return -EINVAL;
+       }
+
+       dbus_message_unref(message);
+
+       return -EINPROGRESS;
+}
+
+static connman_bool_t __connman_service_is_internet_profile(
+               struct connman_service *cellular)
+{
+       DBG("Service path: %s", cellular->path);
+
+       const char internet_suffix[] = "_1";
+       char *suffix = NULL;
+
+       if (strstr(cellular->path, "cellular_") != NULL) {
+               suffix = strrchr(cellular->path, '_');
+               if (strcmp(suffix, internet_suffix) == 0)
+                       return TRUE;
+       }
+
+       DBG("Not Internet profile.");
+       return FALSE;
+}
+
+static struct connman_service *__connman_service_get_default(void)
+{
+       GSequenceIter *iter;
+       struct connman_service *default_service = NULL;
+
+       iter = g_sequence_get_begin_iter(service_list);
+
+       while (g_sequence_iter_is_end(iter) == FALSE) {
+               struct connman_service *service = g_sequence_get(iter);
+
+               DBG("service: %p %s %s %s", service, service->name,
+                               state2string(service->state),
+                               __connman_service_type2string(service->type));
+
+               if (service->type == CONNMAN_SERVICE_TYPE_WIFI &&
+                               is_connected(service) == TRUE)
+                       return service;
+
+               if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+                       if (__connman_service_is_internet_profile(service) == TRUE) {
+                               if (default_service == NULL)
+                                       default_service = service;
+                               else if (is_connected(default_service) == FALSE &&
+                                               is_connected(service) == TRUE)
+                                       default_service = service;
+                       }
+
+               iter = g_sequence_iter_next(iter);
+       }
+
+       return default_service;
+}
+
+static void __connman_service_update_default_info(struct connman_service *service)
+{
+       struct connman_ipconfig *ip_config = NULL;
+       gchar *connection_type = NULL, *connection_state = NULL;
+       gchar *ip_addr = NULL, *proxy_addr = NULL;
+       gchar **proxy_list = NULL;
+
+       ip_config = __connman_service_get_ip4config(service);
+       if (ip_config == NULL)
+               return;
+
+       DBG("Update state %p %s %s", service, service->path, state2string(service->state));
+
+       ip_addr = g_strdup(__connman_ipconfig_get_local(ip_config));
+       if (ip_addr == NULL)
+               ip_addr = g_strdup("");
+
+       connection_type = g_strdup(
+                       __connman_service_type2string(connman_service_get_type(service)));
+
+       connection_state = g_strdup(state2string(service->state));
+
+       proxy_list = connman_service_get_proxy_servers(service);
+       if (proxy_list != NULL)
+               proxy_addr = g_strdup(proxy_list[0]);
+       if (proxy_addr == NULL)
+               proxy_addr = g_strdup("");
+
+       __connman_service_dbus_update_default_info(
+                       DBUS_TYPE_STRING, &connection_type, DBUS_TYPE_STRING, &connection_state,
+                       DBUS_TYPE_STRING, &ip_addr, DBUS_TYPE_STRING, &proxy_addr, DBUS_TYPE_INVALID);
+
+       g_free(connection_type);
+       g_free(connection_state);
+       g_free(ip_addr);
+       g_free(proxy_addr);
+       g_strfreev(proxy_list);
+}
+
+static void __connman_service_update_default(struct connman_service *service)
+{
+       struct connman_service *default_service = NULL;
+
+       default_service = __connman_service_get_default();
+
+       DBG("service %p %s %s", service, service->path, state2string(service->state));
+       if (default_service != NULL)
+               DBG("default service %p %s %s", default_service, default_service->path,
+                               state2string(default_service->state));
+       else
+               DBG("default service is NULL");
+
+       if (is_connected(service) == TRUE) {
+               if (service == default_service)
+                       __connman_service_update_default_info(service);
+
+               return;
+       }
+
+       if (default_service == NULL) {
+               __connman_service_update_default_info(service);
+               return;
+       }
+
+       if (service != default_service) {
+               if (default_service->type == CONNMAN_SERVICE_TYPE_WIFI)
+                       return;
+
+               if (is_connected(default_service) == TRUE)
+                       __connman_service_update_default_info(default_service);
+               else
+                       __connman_service_update_default_info(service);
+       } else
+               __connman_service_update_default_info(service);
+}
+#endif
+
 static void proxy_changed(struct connman_service *service)
 {
        connman_dbus_property_changed_dict(service->path,
                                        CONNMAN_SERVICE_INTERFACE, "Proxy",
                                                        append_proxy, service);
+#if defined TIZEN_EXT
+       DBG("");
+       if (is_connected(service) == TRUE)
+               __connman_service_update_default(service);
+#endif
 }
 
 static void proxy_configuration_changed(struct connman_service *service)
@@ -2152,7 +2320,7 @@ void __connman_service_set_pac(struct connman_service *service,
 
 #if defined TIZEN_EXT
 /*
- * Description: SONET plug-in requires manual PROXY setting function
+ * Description: Telephony plug-in requires manual PROXY setting function
  */
 void __connman_service_set_proxy(struct connman_service *service,
                                        const char *proxies)
@@ -2743,51 +2911,35 @@ void __connman_service_auto_connect(void)
                service = g_sequence_get(iter);
 
 #if defined TIZEN_EXT
-               DBG("service : %p, network name : %s, type : %d", service, service->name, service->type);
-
-               /*
-                * Currently, we use only cellular and Wi-Fi.
-                * But if any type will be added later, this block should be modified as a new concept.
-                */
-               if(service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
-               {
-                       service = NULL;
-                       iter = g_sequence_iter_next(iter);
-                       continue;
-               }
+               DBG("service: %p %s %s %s, favorite(%d), ignore(%d)", service, service->name,
+                               state2string(service->state),
+                               __connman_service_type2string(service->type),
+                               service->favorite, is_ignore(service));
+
+               /* Tizen takes Wi-Fi as the highest priority into consideration. */
+               if (service->type != CONNMAN_SERVICE_TYPE_WIFI)
+                       if (is_connecting(service) == TRUE || is_connected(service) == TRUE) {
+                               service = NULL;
+                               iter = g_sequence_iter_next(iter);
+                               continue;
+                       }
 #endif
                if (service->pending != NULL)
-               {
-                       DBG("pending");
                        return;
-               }
 
                if (is_connecting(service) == TRUE)
-               {
-                       DBG("connecting");
                        return;
-               }
 
                if (service->favorite == FALSE)
-               {
-                       DBG("favorite is FALSE");
                        return;
-               }
 
                if (is_connected(service) == TRUE)
-               {
-                       DBG("connected");
                        return;
-               }
 
                if (is_ignore(service) == FALSE && service->state ==
                                                CONNMAN_SERVICE_STATE_IDLE)
-               {
-                       DBG("try auto connecting");
                        break;
-               }
 
-               DBG("check the next service..");
                service = NULL;
 
                iter = g_sequence_iter_next(iter);
@@ -2964,7 +3116,7 @@ static DBusMessage *connect_service(DBusConnection *conn,
         * Description: TIZEN implements system global connection management.
         */
        if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
-               connman_service_user_initiated_pdp_connection_ref(service);
+               connman_service_user_initiated_pdn_connection_ref(service);
 #endif
 
        if (service->pending != NULL)
@@ -3019,12 +3171,14 @@ static DBusMessage *disconnect_service(DBusConnection *conn,
        /*
         * Description: TIZEN implements system global connection management.
         */
-       if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
-               if (connman_service_user_initiated_pdp_connection_unref_and_test(service) != TRUE)
+       if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR) {
+               if (connman_service_user_initiated_pdn_connection_unref_and_test(service) != TRUE)
                        return __connman_error_failed(msg, EISCONN);
 
-       if (service->alwayson == TRUE)
-               return __connman_error_failed(msg, EISCONN);
+               if (is_connected(service) == TRUE &&
+                               service == __connman_service_get_default())
+                       return __connman_error_failed(msg, EISCONN);
+       }
 #endif
 
        reply_pending(service, ECONNABORTED);
@@ -3383,8 +3537,7 @@ static void service_initialize(struct connman_service *service)
        /*
         * Description: TIZEN implements system global connection management.
         */
-       g_atomic_int_set(&service->user_initiated_pdp_connection_refcount, 0);
-       service->alwayson = FALSE;
+       g_atomic_int_set(&service->user_initiated_pdn_connection_refcount, 0);
 #endif
 }
 
@@ -3542,16 +3695,6 @@ static gint service_compare(gconstpointer a, gconstpointer b,
        return (gint) service_b->strength - (gint) service_a->strength;
 }
 
-#if defined TIZEN_EXT
-struct connman_network* connman_service_get_network(struct connman_service* service){
-       return service->network;
-}
-
-struct connman_ipconfig* connman_service_get_ipv4config(struct connman_service* service){
-       return __connman_service_get_ip4config(service);
-}
-#endif
-
 /**
  * connman_service_get_type:
  * @service: service structure
@@ -3680,10 +3823,11 @@ int __connman_service_set_favorite(struct connman_service *service,
                                                connman_bool_t favorite)
 {
        GSequenceIter *iter;
+
 #if defined TIZEN_EXT
-       struct connman_device *device = NULL;
+       if (service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+               return -EIO;
 #endif
-
        iter = g_hash_table_lookup(service_hash, service->identifier);
        if (iter == NULL)
                return -ENOENT;
@@ -3701,18 +3845,19 @@ int __connman_service_set_favorite(struct connman_service *service,
        __connman_profile_changed(FALSE);
 
 #if defined TIZEN_EXT
-       device = connman_network_get_device(service->network);
+       {
+               struct connman_device *device = connman_network_get_device(service->network);
 
-       if (connman_device_get_type(device) == CONNMAN_DEVICE_TYPE_WIFI) {
-               if (service->favorite == TRUE)
-                       connman_device_significant_wifi_profile_ref(device);
-               else
-                       connman_device_significant_wifi_profile_unref_and_test(device);
-       }
+               if (connman_device_get_type(device) == CONNMAN_DEVICE_TYPE_WIFI) {
+                       if (service->favorite == TRUE)
+                               connman_device_significant_wifi_profile_ref(device);
+                       else
+                               connman_device_significant_wifi_profile_unref_and_test(device);
+               }
 
-       connman_device_save_significant_wifi_profile_refcount_to_storage(device);
+               connman_device_save_significant_wifi_profile_refcount_to_storage(device);
+       }
 #endif
-
        return 0;
 }
 
@@ -3779,6 +3924,90 @@ static void report_error_cb(struct connman_service *service,
        }
 }
 
+#if defined TIZEN_EXT
+static connman_bool_t __connman_service_can_drop_cellular(
+               struct connman_service *cellular)
+{
+       if (cellular->type == CONNMAN_SERVICE_TYPE_CELLULAR &&
+                               is_connected(cellular) == TRUE)
+               if (connman_service_is_no_ref_user_initiated_pdn_connection(cellular) == TRUE)
+                       return TRUE;
+       return FALSE;
+}
+
+static void __connman_service_connect_default(void)
+{
+       static struct connman_device *connecting_device = NULL;
+       struct connman_service *default_service = NULL;
+       struct connman_device *default_device = NULL;
+
+       default_service = __connman_service_get_default();
+
+       if (default_service != NULL) {
+               if (is_connecting(default_service) == FALSE &&
+                               is_connected(default_service) == FALSE) {
+
+                       default_device = connman_network_get_device(
+                                       __connman_service_get_network(default_service));
+
+                       DBG("connecting_device %p", connecting_device);
+
+                       if (connecting_device == default_device)
+                               return;
+
+                       connecting_device = default_device;
+                       default_service->userconnect = FALSE;
+
+                       DBG("Connecting default service %p %s",
+                                       default_service, default_service->path);
+                       DBG("Connecting device %p %s", connecting_device,
+                                       connman_device_get_string(connecting_device, "Name"));
+
+                       __connman_service_connect(default_service);
+               } else if (is_connected(default_service) == TRUE) {
+                       DBG("default service connected %s", default_service->path);
+                       connecting_device = NULL;
+               }
+       }
+}
+#endif
+
+static void service_single_connection(struct connman_service *allowed)
+{
+       GSequenceIter *iter;
+       GSList *services = NULL, *list;
+
+#if defined TIZEN_EXT
+       if (allowed->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+               return;
+#endif
+
+       iter = g_sequence_get_begin_iter(service_list);
+
+       while (g_sequence_iter_is_end(iter) == FALSE) {
+               struct connman_service *service = g_sequence_get(iter);
+
+               if (service != allowed && is_connected(service))
+#if defined TIZEN_EXT
+                       if (__connman_service_can_drop_cellular(service) == TRUE)
+#endif
+                       services = g_slist_prepend(services, service);
+
+               iter = g_sequence_iter_next(iter);
+       }
+
+       DBG("Allowed %p %s", allowed, allowed->path);
+
+       for (list = services; list != NULL; list = list->next) {
+               struct connman_service *service = list->data;
+
+               DBG("Disconnecting %p %s", service, service->path);
+               __connman_service_disconnect(service);
+       }
+
+       g_slist_free(services);
+}
+
 static int __connman_service_indicate_state(struct connman_service *service)
 {
        enum connman_service_state old_state, new_state;
@@ -3847,7 +4076,9 @@ static int __connman_service_indicate_state(struct connman_service *service)
 
                reply_pending(service, ECONNABORTED);
                __connman_device_request_scan(service->type);
-#else
+
+               __connman_service_update_default(service);
+#endif
                connman_bool_t reconnect;
 
                reconnect = get_reconnect_state(service);
@@ -3855,7 +4086,6 @@ static int __connman_service_indicate_state(struct connman_service *service)
                        __connman_service_auto_connect();
 
                __connman_device_request_scan(CONNMAN_DEVICE_TYPE_UNKNOWN);
-#endif
        }
 
        if (new_state == CONNMAN_SERVICE_STATE_READY) {
@@ -3863,12 +4093,7 @@ static int __connman_service_indicate_state(struct connman_service *service)
 
                set_reconnect_state(service, TRUE);
 
-#if defined TIZEN_EXT
-               if (service->type != CONNMAN_SERVICE_TYPE_CELLULAR)
-                       __connman_service_set_favorite(service, TRUE);
-#else
                __connman_service_set_favorite(service, TRUE);
-#endif
 
                reply_pending(service, 0);
 
@@ -3904,6 +4129,12 @@ static int __connman_service_indicate_state(struct connman_service *service)
                        __connman_ipconfig_disable_ipv6(
                                                service->ipconfig_ipv6);
 
+#if defined TIZEN_EXT
+               __connman_service_update_default(service);
+#endif
+               if (connman_setting_get_bool("SingleConnection") == TRUE)
+                       service_single_connection(service);
+
        } else if (new_state == CONNMAN_SERVICE_STATE_DISCONNECT) {
                struct connman_service *def_service = get_default();
 
@@ -3937,6 +4168,9 @@ static int __connman_service_indicate_state(struct connman_service *service)
        } else
                service->error = CONNMAN_SERVICE_ERROR_UNKNOWN;
 
+#if defined TIZEN_EXT
+       __connman_service_connect_default();
+#endif
        iter = g_hash_table_lookup(service_hash, service->identifier);
        if (iter != NULL)
                g_sequence_sort_changed(iter, service_compare, NULL);
@@ -4061,9 +4295,8 @@ int __connman_service_ipconfig_indicate_state(struct connman_service *service,
 
 #if defined TIZEN_EXT
        if (new_state == CONNMAN_SERVICE_STATE_FAILURE &&
-           service->type == CONNMAN_SERVICE_TYPE_CELLULAR) {
-               g_atomic_int_set(&service->user_initiated_pdp_connection_refcount, 0);
-       }
+           service->type == CONNMAN_SERVICE_TYPE_CELLULAR)
+               g_atomic_int_set(&service->user_initiated_pdn_connection_refcount, 0);
 #endif
        /* Any change? */
        if (old_state == new_state)
@@ -4309,13 +4542,6 @@ static int service_connect(struct connman_service *service)
        return err;
 }
 
-#if defined TIZEN_EXT
-int connman_service_connect(struct connman_service* service){
-       DBG("service connect request path=%s", connman_network_get_identifier(service->network) );
-       return __connman_service_connect(service);
-}
-#endif
-
 int __connman_service_connect(struct connman_service *service)
 {
        int err;
@@ -4375,13 +4601,6 @@ int __connman_service_connect(struct connman_service *service)
        return err;
 }
 
-#if defined TIZEN_EXT
-int connman_service_disconnect(struct connman_service* service){
-       DBG("service disconnect request path=%s", connman_network_get_identifier(service->network) );
-       return __connman_service_disconnect(service);
-}
-#endif
-
 int __connman_service_disconnect(struct connman_service *service)
 {
        int err;
@@ -4717,13 +4936,6 @@ int __connman_service_provision(DBusMessage *msg)
        char *group = NULL, *ident = NULL;
        int err = 0;
        struct connman_service *service;
-#if defined TIZEN_EXT
-       struct connman_device * device;
-       const char *mode = "managed", *security = "ieee8021x";
-       char * name = NULL, *type = NULL;
-       char * device_ident = NULL;
-       int name_len = 0;
-#endif
 
        DBG("");
 
@@ -4757,46 +4969,8 @@ int __connman_service_provision(DBusMessage *msg)
        if (err < 0)
                goto done;
 
-#if !defined TIZEN_EXT
        ident = group + strlen("service_");
-#else
-       device = __connman_device_find_device(CONNMAN_SERVICE_TYPE_WIFI);
-       if (device == NULL) {
-               err = -EOPNOTSUPP;
-               goto done;
-       }
-
-       device_ident = connman_device_get_ident(device);
-       if (device_ident == NULL) {
-               err = -EOPNOTSUPP;
-               goto done;
-       }
 
-       type = g_key_file_get_string(keyfile, group, "Type", NULL);
-       if(type == NULL) {
-               err = -EINVAL;
-               goto done;
-       }
-
-       name = g_key_file_get_string(keyfile, group, "Name", NULL);
-       if(name == NULL) {
-               err = -EINVAL;
-               goto done;
-       }
-
-       name_len = strlen(name);
-
-       group = wifi_build_group_name((unsigned char *) name,
-                                               name_len, mode, security);
-       if (group == NULL) {
-               err = -EINVAL;
-               goto done;
-       }
-
-       DBG("group %s ", group);
-
-       ident = g_strdup_printf("%s_%s_%s", type, device_ident, group);
-#endif
        /* trigger service provisioning if service exists */
        service = lookup_by_identifier(ident);
        if (service != NULL)
@@ -5646,10 +5820,6 @@ static int service_load(struct connman_service *service)
                }
 
                break;
-#if defined TIZEN_EXT
-       case CONNMAN_SERVICE_TYPE_CELLULAR:
-               break;
-#endif
        }
 
        str = g_key_file_get_string(keyfile,