summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaehyun Kim <jeik01.kim@samsung.com>2018-02-20 15:37:40 +0900
committerJaehyun Kim <jeik01.kim@samsung.com>2018-02-21 15:14:10 +0900
commit63d4f774d04c381000e45e7490bc838da9b36027 (patch)
tree37c181ca6916c3f926dec23c87e6ca91e95f21e4 /src
parent45e07ac85c513f438bf4534b4a6abe36f0467248 (diff)
downloadconnman-63d4f774d04c381000e45e7490bc838da9b36027.tar.gz
connman-63d4f774d04c381000e45e7490bc838da9b36027.tar.bz2
connman-63d4f774d04c381000e45e7490bc838da9b36027.zip
Added new dbus method to support bssid based connection
Change-Id: I95d2a56c1d26db06cbdb5c85dc0e2b33b3c10da3 Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/connman.h11
-rwxr-xr-xsrc/technology.c57
2 files changed, 68 insertions, 0 deletions
diff --git a/src/connman.h b/src/connman.h
index 4125463b..a5977b88 100755
--- a/src/connman.h
+++ b/src/connman.h
@@ -564,6 +564,17 @@ void __connman_technology_remove_interface(enum connman_service_type type,
void __connman_technology_notify_regdom_by_device(struct connman_device *device,
int result, const char *alpha2);
+#if defined TIZEN_EXT
+enum bssid_type {
+ CHECK_BSSID = 0,
+ GET_BSSID = 1,
+ SET_BSSID = 2,
+ RESET_BSSID = 3,
+};
+
+int set_connman_bssid(enum bssid_type mode, char *bssid);
+#endif
+
#include <connman/device.h>
int __connman_device_init(const char *device, const char *nodevice);
diff --git a/src/technology.c b/src/technology.c
index 5aea9f4f..5d5b70f0 100755
--- a/src/technology.c
+++ b/src/technology.c
@@ -25,6 +25,9 @@
#include <errno.h>
#include <string.h>
+#if defined TIZEN_EXT
+#include <stdio.h>
+#endif
#include <gdbus.h>
@@ -876,6 +879,49 @@ make_reply:
return reply;
}
+#if defined TIZEN_EXT
+int set_connman_bssid(enum bssid_type mode, char *bssid)
+{
+ static unsigned char bssid_for_connect[6];
+ static int bssid_len;
+
+ DBG("mode : %d", mode);
+
+ if (mode == CHECK_BSSID) {
+ return bssid_len;
+ }
+
+ if (mode == GET_BSSID && bssid) {
+ memcpy(bssid, bssid_for_connect, 6);
+ return bssid_len;
+ }
+
+ if (mode == RESET_BSSID) {
+ bssid_len = 0;
+ return bssid_len;
+ }
+
+ if (mode != SET_BSSID || !bssid) {
+ DBG("Invalid parameter");
+ return 0;
+ }
+
+ bssid_len = sscanf(bssid, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
+ &bssid_for_connect[0], &bssid_for_connect[1], &bssid_for_connect[2],
+ &bssid_for_connect[3], &bssid_for_connect[4], &bssid_for_connect[5]);
+ if (bssid_len != 6) {
+ DBG("Incorrect BSSID format. bssid_len = %d", bssid_len);
+ bssid_len = 0;
+ }
+
+ DBG("SET BSSID len : %d, BSSID : %02x:%02x:%02x:%02x:%02x:%02x", bssid_len,
+ bssid_for_connect[0], bssid_for_connect[1], bssid_for_connect[2],
+ bssid_for_connect[3], bssid_for_connect[4], bssid_for_connect[5]);
+
+ return bssid_len;
+}
+#endif
+
static DBusMessage *set_property(DBusConnection *conn,
DBusMessage *msg, void *data)
{
@@ -1023,6 +1069,17 @@ static DBusMessage *set_property(DBusConnection *conn,
dbus_message_iter_get_basic(&value, &enable);
return set_powered(technology, msg, enable);
+#if defined TIZEN_EXT
+ } else if (g_str_equal(name, "SetBSSID")) {
+ char *key;
+
+ if (type != DBUS_TYPE_STRING)
+ return __connman_error_invalid_arguments(msg);
+
+ dbus_message_iter_get_basic(&value, &key);
+ DBG("BSSID %s", key);
+ set_connman_bssid(SET_BSSID, key);
+#endif
} else
return __connman_error_invalid_property(msg);