diff options
author | Christophe Prigent <christophe.prigent@intel.com> | 2012-12-12 17:14:59 +0100 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-01-06 22:47:01 +0100 |
commit | 2cd176e88b746f856dfd25fae729540d807fabbc (patch) | |
tree | 5c99c56bbc8eaccc7940331f292e2d83a2004370 | |
parent | e50bcc434fe0a8b04ce9646af8aedcde56d18401 (diff) | |
download | neard-2cd176e88b746f856dfd25fae729540d807fabbc.tar.gz neard-2cd176e88b746f856dfd25fae729540d807fabbc.tar.bz2 neard-2cd176e88b746f856dfd25fae729540d807fabbc.zip |
test: Support writing SMS and e-mail address to a tag
-rwxr-xr-x | test/write-tag | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/test/write-tag b/test/write-tag index aec413f..912d8a3 100755 --- a/test/write-tag +++ b/test/write-tag @@ -8,9 +8,13 @@ def help_text(): print " If type is Text, parameters are <encoding> <language> <representation>" print " If type is URI, parameters are <uri>" print " If type is SmartPoster, parameters are <uri>" - print "e.g. < %s /org/neard/nfc0/tag0 Text UTF-8 en-US hello,Type2! >" % (sys.argv[0]) + print " If type is SMS, parameters are <phone number> <text>" + print " If type is E-Mail, parameters are <e-mail address>" + 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]) sys.exit(1) if len(sys.argv) < 2: @@ -21,23 +25,29 @@ bus = dbus.SystemBus() tag = dbus.Interface(bus.get_object("org.neard", sys.argv[1]), "org.neard.Tag") -if len(sys.argv) == 6: - if sys.argv[2] in ["Text"]: - tag.Write(({ "Type" : "Text", - "Encoding" : sys.argv[3], - "Language" : sys.argv[4], - "Representation" : sys.argv[5] })) - else: - help_text() - -elif len(sys.argv) == 4: - if sys.argv[2] in ["URI"]: - tag.Write(({ "Type" : "URI", - "URI" : sys.argv[3] })) - elif sys.argv[2] in ["SmartPoster"]: - tag.Write(({ "Type" : "SmartPoster", - "URI" : sys.argv[3] })) - else: - help_text() +if sys.argv[2] in ["Text"]: + tag.Write(({ "Type" : "Text", + "Encoding" : sys.argv[3], + "Language" : sys.argv[4], + "Representation" : sys.argv[5] })) + +elif sys.argv[2] in ["URI"]: + tag.Write(({ "Type" : "URI", + "URI" : sys.argv[3] })) + +elif sys.argv[2] in ["SmartPoster"]: + tag.Write(({ "Type" : "SmartPoster", + "URI" : sys.argv[3] })) + +elif sys.argv[2] in ["SMS"]: + URI = "sms:"+sys.argv[3]+"?body="+sys.argv[4] + tag.Write(({ "Type" : "URI", + "URI" : URI })) + +elif sys.argv[2] in ["E-Mail"]: + URI = "mailto:"+sys.argv[3] + tag.Write(({ "Type" : "URI", + "URI" : URI })) + else: - help_text()
\ No newline at end of file + help_text() |