From 13789ca60ed95b1ec6c58b265ef3ecdabe9089ce Mon Sep 17 00:00:00 2001 From: Ravi kumar Veeramally Date: Wed, 3 Apr 2013 15:37:27 +0300 Subject: [PATCH] test: Add test script to write mime type on tag Added test script to write mime type on tag. Currently it supports application/vnd.wfa.wsc mime type. --- test/write-tag | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/write-tag b/test/write-tag index 912d8a3..3635ff7 100755 --- a/test/write-tag +++ b/test/write-tag @@ -10,11 +10,18 @@ def help_text(): print " If type is SmartPoster, parameters are " print " If type is SMS, parameters are " print " If type is E-Mail, parameters are " + print " If type is MIME, and WiFi AP is passphrase protected" + print " Type is MIME, parameters are wifi_wsc " + print " If type is MIME, and WiFi AP is open network" + print " Type is MIME, parameters are wifi_wsc " print "e.g. < %s /org/neard/nfc0/tag0 Text UTF-8 en-US hello,NFC! >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/tag0 URI http://www.nfc-forum.com >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/tag0 SmartPoster http://www.nfc-forum.com >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/tag0 SMS 0102030405 YourSMSMessage >" % (sys.argv[0]) print "e.g. < %s /org/neard/nfc0/tag0 E-Mail test@test.com >" % (sys.argv[0]) + print "e.g. < %s /org/neard/nfc0/tag0 MIME wifi_wsc YourAPname passphrase >" % (sys.argv[0]) + print "e.g. < %s /org/neard/nfc0/tag0 MIME wifi_wsc YourAPname >" % (sys.argv[0]) + sys.exit(1) if len(sys.argv) < 2: @@ -49,5 +56,21 @@ elif sys.argv[2] in ["E-Mail"]: tag.Write(({ "Type" : "URI", "URI" : URI })) +elif sys.argv[2] in ["MIME"]: + if len(sys.argv) == 5: + if sys.argv[3] in ["wifi_wsc"]: + tag.Write(({ "Type" : "MIME", + "MIME" : "application/vnd.wfa.wsc", + "SSID" : sys.argv[4] })) + + elif len(sys.argv) == 6: + if sys.argv[3] in ["wifi_wsc"]: + tag.Write(({ "Type" : "MIME", + "MIME" : "application/vnd.wfa.wsc", + "SSID" : sys.argv[4], + "Passphrase" : sys.argv[5] })) + else: + help_text() + else: help_text() -- 2.7.4