Project

General

Profile

Statistics
| Revision:

root / trunk / swipe / manualtron.py @ 300

History | View | Annotate | Download (1.32 KB)

1 218 bneuman
#!/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 224 bneuman
import sys
25
sys.path.append('../common')
26 222 bneuman
import common
27 218 bneuman
28 224 bneuman
29 222 bneuman
common.initBus(sys.argv[1])
30 218 bneuman
31 222 bneuman
def key():
32 283 bneuman
    x = readTransaction()
33
34
    if x == None:
35
        print "Didn't get valid transaction"
36 246 bneuman
        return False
37
38 283 bneuman
    [key,card] = x
39 218 bneuman
40 283 bneuman
    print "key:",key
41
    print "cardnum:",card
42
    return True
43 247 bneuman
44 294 rc99
def tool(t):
45
    common.sendMessage(t, common.TT_GRANT, "")
46
    if common.checkAck(t):
47
        print "got ACK"
48
    else:
49
        print "NO ACK"
50 283 bneuman
51 224 bneuman
def ping(t):
52
    common.sendMessage(t, common.TT_PING, "")
53 284 bneuman
    return common.checkAck(t)