Esempio n. 1
0
    wait = 3

else:
    wait = 1
    # "Fake" values that we need to make while loop infinite
    max = 10

# Note that in the case of no autonomous mode, max is never reached no matter its value, as
# route_pointer is never increased
while route_pointer < max:
    locations = {}
    for t in technitians:

        if autonomous:
            # Get location from points
            loc_str =  allPoints[route[route_pointer]][0] + ', ' + allPoints[route[route_pointer]][1]
            route_pointer += 1
        else:
            # Get location from Location GE
            loc = get_location(t)
            loc_str = str(loc[0]) + ', ' + str(loc[1])

        locations[vans[t]] = loc_str

    # Update Context Broker information
    print 'update with: ' + str(locations)
    do_post(cb_url + 'NGSI10/updateContext', update_van_locations_xml(locations))

    # Sleep for a while before doing the process again
    sleep(wait)