diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-20 14:46:17 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-20 14:46:17 +0200 |
commit | 23d531b8703efd277f22bee98565446742d2e95f (patch) | |
tree | 5c6a2cbef5df2dde95bae331155f8fbce7bd0212 | |
parent | ccd520cdea10a7f7497085cbb38c796df589b8df (diff) | |
download | neard-23d531b8703efd277f22bee98565446742d2e95f.tar.gz neard-23d531b8703efd277f22bee98565446742d2e95f.tar.bz2 neard-23d531b8703efd277f22bee98565446742d2e95f.zip |
ndef: Implement static handover
static handover is going through a different D-Bus path as it would not
make sense to handle both static and dynamic handover from the same code
path.
Static handover means an application explicitely requires to send a
handover select without having previously received a handover request.
This could typically be used for handling WiFi handover through
configuration token from the registrar perspective. The registrar
(a.k.a. the Access Point) would send a configuration token via Handover
and expects the Enrolle (a.k.a. the WiFi STA) to initiate the WiFi
association.
-rw-r--r-- | src/device.c | 2 | ||||
-rw-r--r-- | src/ndef.c | 4 | ||||
-rwxr-xr-x | test/push-device | 5 |
3 files changed, 11 insertions, 0 deletions
diff --git a/src/device.c b/src/device.c index 27fbf4f..2c5b047 100644 --- a/src/device.c +++ b/src/device.c @@ -234,6 +234,8 @@ static char *sn_from_message(DBusMessage *msg) return NEAR_DEVICE_SN_SNEP; else if (g_strcmp0(value, "Handover") == 0) return NEAR_DEVICE_SN_HANDOVER; + else if (g_strcmp0(value, "StaticHandover") == 0) + return NEAR_DEVICE_SN_HANDOVER; else if (g_strcmp0(value, "MIME") == 0) return NEAR_DEVICE_SN_SNEP; else @@ -3339,6 +3339,10 @@ struct near_ndef_message *__ndef_build_from_message(DBusMessage *msg) ndef = build_ho_record( RECORD_TYPE_WKT_HANDOVER_REQUEST, msg); break; + } else if (g_strcmp0(value, "StaticHandover") == 0) { + ndef = build_ho_record( + RECORD_TYPE_WKT_HANDOVER_SELECT, msg); + break; } else if (g_strcmp0(value, "MIME") == 0) { ndef = build_mime_record(msg); break; diff --git a/test/push-device b/test/push-device index 0f48d8f..b0b0c55 100755 --- a/test/push-device +++ b/test/push-device @@ -9,11 +9,13 @@ def help_text(): print " If type is URI, parameters are <uri>" print " If type is SmartPoster, parameters are <uri>" print " If type is Handover, parameters are <carrier>" + print " If type is StaticHandover, parameters are <carrier>" print " If type is MIME, parameters are <mime_type> (only wifi_wsc)" print "e.g. < %s /org/neard/nfc0/device0 Text UTF-8 en-US hello,Type2! >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/device0 URI http://www.nfc-forum.com >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/device0 SmartPoster http://www.nfc-forum.com >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/device0 Handover bluetooth,wifi >" % (sys.argv[0]) + print "e.g. < %s /org/neard/nfc0/device0 StaticHandover bluetooth,wifi >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/device0 MIME wifi_wsc>" % (sys.argv[0]) sys.exit(1) @@ -44,6 +46,9 @@ elif len(sys.argv) == 4: elif sys.argv[2] in ["Handover"]: device.Push(({ "Type" : "Handover", "Carrier" : sys.argv[3] })) + elif sys.argv[2] in ["StaticHandover"]: + device.Push(({ "Type" : "StaticHandover", + "Carrier" : sys.argv[3] })) elif sys.argv[2] in ["MIME"]: if sys.argv[3] in ["wifi_wsc"]: device.Push(({ "Type" : "MIME", |