Skip to content
Snippets Groups Projects
Commit 0894afae authored by Server (Shared Users)'s avatar Server (Shared Users)
Browse files

revise

'
parent 04fb2bdb
No related branches found
No related tags found
No related merge requests found
...@@ -139,7 +139,6 @@ class CoapClient(): ...@@ -139,7 +139,6 @@ class CoapClient():
path = "/bleInfoPath" path = "/bleInfoPath"
payload = [] payload = []
temp = []
path = "coap://" + self.ip + path path = "coap://" + self.ip + path
host, port, path = parse_uri(path) host, port, path = parse_uri(path)
...@@ -154,18 +153,17 @@ class CoapClient(): ...@@ -154,18 +153,17 @@ class CoapClient():
try: try:
while True : while True :
payload = [] payload = []
temp = [] returnedList = blescan.parse_events(self.sock, 50)
returnedList = blescan.parse_events(self.sock, 100)
for beacon in returnedList: for beacon in returnedList:
beaconInfo = [str(x) for x in beacon.split(',') if x.strip()] beaconInfo = [str(x) for x in beacon.split(',') if x.strip()]
if not beaconInfo[0] in temp:
temp.append(beaconInfo[0])
if beaconInfo[1][:8] == "52528282": if beaconInfo[1][:8] == "52528282":
print("scanned : "+ str(beaconInfo)) print("scanned : "+ str(beaconInfo))
regiRelThread = threading.Thread(target = self.regiRelWithNewPi, args=([beaconInfo])) regiRelThread = threading.Thread(target = self.regiRelWithNewPi, args=([beaconInfo]))
regiRelThread.start() regiRelThread.start()
continue continue
payload.append(self.mkJsonbeaconInfo(beaconInfo)) jsonpayload = self.mkJsonbeaconInfo(beaconInfo)
if jsonpayload.distance < 60:
payload.append(jsonpayload)
response = client.put(path, json.dumps(payload)) response = client.put(path, json.dumps(payload))
print((response.pretty_print())) print((response.pretty_print()))
......
...@@ -17,7 +17,7 @@ bct_IBEACONPROFIX = "1E 02 01 1A 1A FF 4C 00 02 15" ...@@ -17,7 +17,7 @@ bct_IBEACONPROFIX = "1E 02 01 1A 1A FF 4C 00 02 15"
bct_UUID = " 00 00 00 AC E8 B4 E0 C2 7D 20 B6 11 B6 11 C7 74" bct_UUID = " 00 00 00 AC E8 B4 E0 C2 7D 20 B6 11 B6 11 C7 74"
bct_MAJOR = "00 01" bct_MAJOR = "00 01"
bct_MINOR = "00 02" bct_MINOR = "00 02"
bct_POWER = "C8 00" bct_POWER = "CB 00"
class BeaconEmit(): class BeaconEmit():
def __init__(self): def __init__(self):
self.beacon_TX_config("up") self.beacon_TX_config("up")
......
...@@ -3,6 +3,7 @@ const Schema = mongoose.Schema; ...@@ -3,6 +3,7 @@ const Schema = mongoose.Schema;
const trackingSchema = new Schema({ const trackingSchema = new Schema({
rpuuid: { type: String, default: "" }, rpuuid: { type: String, default: "" },
userMAC: { type: String, default: "" },
useruuid: { type: String, default: "" }, useruuid: { type: String, default: "" },
distance: { type: Number, default: 0 }, distance: { type: Number, default: 0 },
updateTime : { type: Number, default: 0 } updateTime : { type: Number, default: 0 }
......
...@@ -178,13 +178,13 @@ router.get('/aggregateByRPUUID/:id', function(req, res, next) { ...@@ -178,13 +178,13 @@ router.get('/aggregateByRPUUID/:id', function(req, res, next) {
'$match': { '$match': {
'rpuuid': output.rpuuid, 'rpuuid': output.rpuuid,
'updateTime': { 'updateTime': {
'$gt': lastUpdateTime '$gt': lastUpdateTime - 10
}, },
distance: {'$lt': 10, '$gt' : 0.1} distance: {'$lt': 10}
} }
}, { }, {
'$group': { '$group': {
'_id': '$useruuid' '_id': '$userMAC'
} }
} }
],function(rr,ra){ ],function(rr,ra){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment