Exemplo n.º 1
0
def fetch_sensorinf():
    for par in PARA:
        req = {PARAT: par, 'sensorType': 'gps'}
        capi.app_senmanager(req, creq)
    dat = capi.senmanager_app(crep)
    for v in dat:
        par = 'barricade'
        sensorinf[par] = list()
        sensorinf[par] = v['topic']
        break
    for v in dat:
        par = 'bus'
        sensorinf[par] = list()
        sensorinf[par] = v['topic']
        break
Exemplo n.º 2
0
reque2 = {
    'sensorType': 'temperature',
    'locationId': request_sensor['temperature'][0]
}
#print(reque1)
#print(reque2)

#capi.depmanager_senmanager(reque1)
#capi.depmanager_senmanager(reque2)
sendat = {}
AC = 'ac'
LIGHT = 'light_con'
creq, crep = capi.initiate_com()
#print(creq,crep)
time.sleep(5)
capi.app_senmanager(reque1, creq)
capi.app_senmanager(reque2, creq)

vastream = list()


def fetchtopic():
    val = capi.senmanager_app(crep)
    for v in val:
        #vastream.clear()
        #print('line 17',v)
        vastream.append(v)
        for x in v['topic']:
            th = threading.Thread(target=fetchsensordata, args=(x, ))
            sendat[x] = {}
            th.start()
Exemplo n.º 3
0
import sys
import communication_api as capi
import threading
import time
import action_api as api
radius = 10
reque = {'sensorType': 'gps', 'installedin': 'bus'}
CONTR = 'buzzer'
#capi.depmanager_senmanager(reque)

sendat = {}
creq, crep = capi.initiate_com()
#print(creq,crep)
time.sleep(5)
capi.app_senmanager(reque, creq)

vastream = list()


def fetchtopic():
    val = capi.senmanager_app(crep)
    for v in val:
        #vastream.clear()
        #print('line 17',v)
        vastream.append(v)
        for x in v['topic']:
            th = threading.Thread(target=fetchsensordata, args=(x, ))
            sendat[x] = {}
            th.start()

        break