root / trunk / swipe / manualtron.py @ 284
History | View | Annotate | Download (1.2 KB)
| 1 | #!/usr/bin/python -i |
|---|---|
| 2 | |
| 3 | """ |
| 4 | This file is part of Tooltron. |
| 5 | |
| 6 | Tooltron is free software: you can redistribute it and/or modify |
| 7 | it under the terms of the Lesser GNU General Public License as published by |
| 8 | the Free Software Foundation, either version 3 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | Tooltron is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | Lesser GNU General Public License for more details. |
| 15 | You should have received a copy of the Lesser GNU General Public License |
| 16 | along with Tooltron. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | Copyright 2009 Bradford Neuman <bneuman@andrew.cmu.edu> |
| 19 | |
| 20 | """ |
| 21 | |
| 22 | # This allows you to interactively send crap to tooltron |
| 23 | |
| 24 | import sys |
| 25 | sys.path.append('../common')
|
| 26 | import common |
| 27 | |
| 28 | |
| 29 | common.initBus(sys.argv[1]) |
| 30 | |
| 31 | def key(): |
| 32 | x = readTransaction() |
| 33 | |
| 34 | if x == None: |
| 35 | print "Didn't get valid transaction" |
| 36 | return False |
| 37 | |
| 38 | [key,card] = x |
| 39 | |
| 40 | print "key:",key |
| 41 | print "cardnum:",card |
| 42 | return True |
| 43 | |
| 44 | |
| 45 | def ping(t): |
| 46 | common.sendMessage(t, common.TT_PING, "") |
| 47 | return common.checkAck(t) |
| 48 |