test: Add MIME type to the Device pushing options
authorSamuel Ortiz <sameo@linux.intel.com>
Tue, 18 Jun 2013 17:38:26 +0000 (19:38 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Tue, 18 Jun 2013 17:38:26 +0000 (19:38 +0200)
Only wifi_wsc is supported for now, i.e. one can only push WSC
configuration tokens over SNEP.

src/device.c
test/push-device

index af8fdf5..27fbf4f 100644 (file)
@@ -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, "MIME") == 0)
+                               return NEAR_DEVICE_SN_SNEP;
                        else
                                return NULL;
 
index 165e33a..0f48d8f 100755 (executable)
@@ -9,10 +9,12 @@ 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 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 MIME wifi_wsc>" % (sys.argv[0])
        sys.exit(1)
 
 if len(sys.argv) < 2:
@@ -42,6 +44,12 @@ elif len(sys.argv) == 4:
        elif sys.argv[2] in ["Handover"]:
                device.Push(({ "Type" : "Handover",
                                "Carrier" : sys.argv[3] }))
+       elif sys.argv[2] in ["MIME"]:
+               if sys.argv[3] in ["wifi_wsc"]:
+                       device.Push(({ "Type" : "MIME",
+                               "MIME" : "application/vnd.wfa.wsc"}))
+               else:
+                       help_text()
        else:
                help_text()
 else: