Statistics
| Revision:

root / trunk / swipe / pingTest.py @ 300

History | View | Annotate | Download (1.16 KB)

1
#!/usr/bin/python
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 files allows you to try to send pings to all possible tools
23

    
24
import sys
25
sys.path.append('../common')
26
import common
27

    
28
common.initBus(sys.argv[1], timeout=0.2)
29

    
30
def ping(t):
31
    common.sendMessage(t, common.TT_PING, "")
32
    return common.checkAck(t)
33

    
34
acks = []
35

    
36
try:
37
    for i in range(256):
38
        while ping(i):
39
            acks.append(i)
40
    print "\n\ndone pinging"
41
finally:
42
    print "responses from:"
43
    print acks