Skip to content

Commit e3d64f3

Browse files
committed
printing instead of writing to file
1 parent 085a5d0 commit e3d64f3

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

main.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import json
88

99
import bluetooth._bluetooth as bluez
10+
from beacon import Beacon
1011

1112
dev_id = 0
1213
try:
@@ -24,9 +25,9 @@
2425
returnedList = blescan.parse_events(sock, 10)
2526
allbs = {}
2627
for beac in returnedList:
27-
uuid = beac['uuid']
28-
if not uuid.startswith('0613ff4c'):
29-
allbs[uuid] = beac
28+
beacon = Beacon(uuid=beac["uuid"], mac=beac["mac"], major=beac["major"],
29+
minor=beac["minor"], txpower=beac["txp"], rssi=beac["rssi"])
30+
allbs[beacon.uuid] = beacon
3031

31-
with open('./beacons.json', 'w') as of:
32-
json.dump(allbs, of)
32+
print allbs["aeae72f5af6749aeac60f27b5b6fa92f"]
33+
print allbs["aeae72f5af6749aeac60f27b5b6fa92f"].getDistance()

0 commit comments

Comments
 (0)