-
Notifications
You must be signed in to change notification settings - Fork 1
/
BlueDarD.py
39 lines (28 loc) · 894 Bytes
/
BlueDarD.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /usr/bin/python
__author__="reaper"
__date__ ="$Mar 25, 2009 11:02:40 PM$"
import pyrssi
from DocXMLRPCServer import DocXMLRPCServer
class BlueDarD(DocXMLRPCServer):
terminateFlag = False
def __init__(self):
DocXMLRPCServer.__init__(self, ('0.0.0.0', 54000), logRequests=False)
self.set_server_name("RSSI Proximity")
self.register_function(self.getProximity)
def getProximity(self, macAddress=None):
if not macAddress:
return macAddress
try:
signal = pyrssi.read_rssi(macAddress)
if int(signal) > 0:
signal = None
except:
signal = None
return signal
def run(self):
self.terminateFlag = False
while not self.terminateFlag:
self.handle_request()
if __name__ == "__main__":
main = BlueDarD()
main.run()