summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>2013-02-25 14:11:05 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2013-02-26 12:37:40 +0200
commitd58cb630cfaa01b9dc8b08135cf19f7f73d1caf0 (patch)
treebd7fdf7566c12d7548febc5fec618c69e7e0b25a
parent8a457c7555c2d04a907c607a3444abceb7021e89 (diff)
downloadconnman-d58cb630cfaa01b9dc8b08135cf19f7f73d1caf0.tar.gz
connman-d58cb630cfaa01b9dc8b08135cf19f7f73d1caf0.tar.bz2
connman-d58cb630cfaa01b9dc8b08135cf19f7f73d1caf0.zip
technology: Provide a function to get WiFi tethering information
-rw-r--r--include/technology.h3
-rw-r--r--src/technology.c55
2 files changed, 42 insertions, 16 deletions
diff --git a/include/technology.h b/include/technology.h
index f3fab203..71314f27 100644
--- a/include/technology.h
+++ b/include/technology.h
@@ -42,6 +42,9 @@ int connman_technology_set_regdom(const char *alpha2);
void connman_technology_regdom_notify(struct connman_technology *technology,
const char *alpha2);
+connman_bool_t connman_technology_get_wifi_tethering(const char **ssid,
+ const char **psk);
+
struct connman_technology_driver {
const char *name;
enum connman_service_type type;
diff --git a/src/technology.c b/src/technology.c
index 3f41d7f3..f15fbd93 100644
--- a/src/technology.c
+++ b/src/technology.c
@@ -315,6 +315,45 @@ int connman_technology_set_regdom(const char *alpha2)
return 0;
}
+static struct connman_technology *technology_find(enum connman_service_type type)
+{
+ GSList *list;
+
+ DBG("type %d", type);
+
+ for (list = technology_list; list; list = list->next) {
+ struct connman_technology *technology = list->data;
+
+ if (technology->type == type)
+ return technology;
+ }
+
+ return NULL;
+}
+
+connman_bool_t connman_technology_get_wifi_tethering(const char **ssid,
+ const char **psk)
+{
+ struct connman_technology *technology;
+
+ if (ssid == NULL || psk == NULL)
+ return FALSE;
+
+ *ssid = *psk = NULL;
+
+ technology = technology_find(CONNMAN_SERVICE_TYPE_WIFI);
+ if (technology == NULL)
+ return FALSE;
+
+ if (technology->tethering == FALSE)
+ return FALSE;
+
+ *ssid = technology->tethering_ident;
+ *psk = technology->tethering_passphrase;
+
+ return TRUE;
+}
+
static void free_rfkill(gpointer data)
{
struct connman_rfkill *rfkill = data;
@@ -820,22 +859,6 @@ static DBusMessage *set_property(DBusConnection *conn,
return g_dbus_create_reply(msg, DBUS_TYPE_INVALID);
}
-static struct connman_technology *technology_find(enum connman_service_type type)
-{
- GSList *list;
-
- DBG("type %d", type);
-
- for (list = technology_list; list; list = list->next) {
- struct connman_technology *technology = list->data;
-
- if (technology->type == type)
- return technology;
- }
-
- return NULL;
-}
-
static void reply_scan_pending(struct connman_technology *technology, int err)
{
DBusMessage *reply;