Use a proper technology callback to report Tethering status
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Nov 2010 22:40:43 +0000 (07:40 +0900)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 12 Nov 2010 22:40:43 +0000 (07:40 +0900)
Makefile.am
include/technology.h
include/tethering.h [deleted file]
plugins/bluetooth.c
src/connman.h
src/technology.c
src/tethering.c

index 651eede..badab1c 100644 (file)
@@ -8,7 +8,7 @@ include_HEADERS = include/types.h include/log.h include/plugin.h \
                        include/storage.h include/service.h \
                        include/resolver.h include/ipconfig.h \
                        include/device.h include/network.h include/inet.h \
-                       include/ondemand.h include/tethering.h
+                       include/ondemand.h
 
 nodist_include_HEADERS = include/version.h
 
index dcab267..7471a53 100644 (file)
@@ -36,6 +36,9 @@ extern "C" {
 
 struct connman_technology;
 
+void connman_technology_tethering_notify(struct connman_technology *technology,
+                                                       connman_bool_t enabled);
+
 struct connman_technology_driver {
        const char *name;
        enum connman_service_type type;
diff --git a/include/tethering.h b/include/tethering.h
deleted file mode 100644 (file)
index 63f4f68..0000000
+++ /dev/null
@@ -1,28 +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
- *
- */
-
-#ifndef __CONNMAN_TETHERING_H
-#define __CONNMAN_TETHERING_H
-
-void connman_tethering_enabled(void);
-void connman_tethering_disabled(void);
-
-#endif
index 984a647..03a01dc 100644 (file)
@@ -36,7 +36,6 @@
 #include <connman/technology.h>
 #include <connman/device.h>
 #include <connman/inet.h>
-#include <connman/tethering.h>
 #include <connman/dbus.h>
 #include <connman/log.h>
 
@@ -969,7 +968,7 @@ static void server_register_reply(DBusPendingCall *call, void *user_data)
        dbus_message_unref(reply);
        dbus_pending_call_unref(call);
 
-       connman_tethering_enabled();
+       connman_technology_tethering_notify(NULL, TRUE);
 }
 
 static void server_unregister_reply(DBusPendingCall *call, void *user_data)
@@ -994,7 +993,7 @@ static void server_unregister_reply(DBusPendingCall *call, void *user_data)
        dbus_message_unref(reply);
        dbus_pending_call_unref(call);
 
-       connman_tethering_disabled();
+       connman_technology_tethering_notify(NULL, FALSE);
 }
 
 
index 8cb4754..7dbd707 100644 (file)
@@ -420,6 +420,8 @@ void __connman_tethering_cleanup(void);
 connman_bool_t __connman_tethering_get_status(void);
 int __connman_tethering_set_status(connman_bool_t status);
 void __connman_tethering_update_interface(const char *interface);
+void __connman_tethering_set_enabled(void);
+void __connman_tethering_set_disabled(void);
 
 #include <connman/provider.h>
 
@@ -428,9 +430,9 @@ void __connman_provider_list(DBusMessageIter *iter, void *user_data);
 int __connman_provider_create_and_connect(DBusMessage *msg);
 const char * __connman_provider_get_ident(struct connman_provider *provider);
 int __connman_provider_indicate_state(struct connman_provider *provider,
-                                    enum connman_provider_state state);
+                                       enum connman_provider_state state);
 int __connman_provider_indicate_error(struct connman_provider *provider,
-                                    enum connman_provider_error error);
+                                       enum connman_provider_error error);
 int __connman_provider_connect(struct connman_provider *provider);
 int __connman_provider_disconnect(struct connman_provider *provider);
 int __connman_provider_remove(const char *path);
index b0810f2..b315e95 100644 (file)
@@ -177,6 +177,17 @@ void __connman_technology_remove_interface(enum connman_service_type type,
        }
 }
 
+void connman_technology_tethering_notify(struct connman_technology *technology,
+                                                       connman_bool_t enabled)
+{
+       DBG("technology %p enabled %u", technology, enabled);
+
+       if (enabled == TRUE)
+               __connman_tethering_set_enabled();
+       else
+               __connman_tethering_set_disabled();
+}
+
 static int set_tethering(const char *bridge, connman_bool_t enabled)
 {
        GSList *list;
index 154efe9..04f3409 100644 (file)
@@ -31,8 +31,6 @@
 
 #include "connman.h"
 
-#include <connman/tethering.h>
-
 #define BRIDGE_NAME "tether"
 
 static connman_bool_t tethering_status = FALSE;
@@ -128,7 +126,7 @@ static void disable_nat(const char *interface)
        /* TODO: Flush nat POSTROUTING chain */
 }
 
-void connman_tethering_enabled(void)
+void __connman_tethering_set_enabled(void)
 {
        if (tethering_status == FALSE)
                return;
@@ -143,7 +141,7 @@ void connman_tethering_enabled(void)
        }
 }
 
-void connman_tethering_disabled(void)
+void __connman_tethering_set_disabled(void)
 {
        if (tethering_status == FALSE)
                return;