summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2010-11-13 07:40:43 +0900
committerMarcel Holtmann <marcel@holtmann.org>2010-11-13 07:40:43 +0900
commitffd2b546e5eea2b361791bbe9062f1baf8530c35 (patch)
treef612eb719c20ed9f46cd62569110f68601be0cda
parent1e302beda2c393b0a19a1a528a742ddef50a8a0b (diff)
downloadconnman-ffd2b546e5eea2b361791bbe9062f1baf8530c35.tar.gz
connman-ffd2b546e5eea2b361791bbe9062f1baf8530c35.tar.bz2
connman-ffd2b546e5eea2b361791bbe9062f1baf8530c35.zip
Use a proper technology callback to report Tethering status
-rw-r--r--Makefile.am2
-rw-r--r--include/technology.h3
-rw-r--r--include/tethering.h28
-rw-r--r--plugins/bluetooth.c5
-rw-r--r--src/connman.h6
-rw-r--r--src/technology.c11
-rw-r--r--src/tethering.c6
7 files changed, 23 insertions, 38 deletions
diff --git a/Makefile.am b/Makefile.am
index 651eede6..badab1c6 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -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
diff --git a/include/technology.h b/include/technology.h
index dcab267a..7471a53c 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -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
index 63f4f68c..00000000
--- a/include/tethering.h
+++ /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
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 984a647f..03a01dc6 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -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);
}
diff --git a/src/connman.h b/src/connman.h
index 8cb47545..7dbd7070 100644
--- a/src/connman.h
+++ b/src/connman.h
@@ -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);
diff --git a/src/technology.c b/src/technology.c
index b0810f26..b315e952 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -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;
diff --git a/src/tethering.c b/src/tethering.c
index 154efe9a..04f34094 100644
--- a/src/tethering.c
+++ b/src/tethering.c
@@ -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;