Ejemplo n.º 1
0
def collection_toggle(channel):
    global collection_flag
    logging.debug('collection_flag=%s', collection_flag)

    collection_flag = not collection_flag
    if collection_flag:
        wpa_sup_list.down_iface(IFACE)
        wpa_sup_list.up_iface(IFACE)
        collection_timer.start()
    else:
        collection_timer.stop()
        wpa_sup_list.down_iface(IFACE)
        wpa_sup_list.up_iface(IFACE, INTERFACES_CONFIG)
Ejemplo n.º 2
0
def collection_toggle(channel):
    global collection_flag
    logging.debug('collection_flag=%s', collection_flag)

    collection_flag = not collection_flag
    if collection_flag:
        wpa_sup_list.down_iface(IFACE)
        wpa_sup_list.up_iface(IFACE)
        collection_timer.start()
    else:
        collection_timer.stop()
        wpa_sup_list.down_iface(IFACE)
        wpa_sup_list.up_iface(IFACE, INTERFACES_CONFIG)
Ejemplo n.º 3
0
                      bouncetime=2000)
GPIO.add_event_detect(BUTTON_COLLECTION,
                      GPIO.FALLING,
                      callback=collection_toggle,
                      bouncetime=2000)
GPIO.add_event_detect(BUTTON_RECORD,
                      GPIO.FALLING,
                      callback=record_toggle,
                      bouncetime=2000)

# Main loop
collection_timer = RepeatedTimer(WIFI_SCAN_DELAY, scan_log_wifi, IFACE)

# Start state
wpa_sup_list.down_iface(IFACE)
wpa_sup_list.up_iface(IFACE)
collection_timer.start()

while True:
    if collection_flag:
        # Collect data - fill in later
        # Initiate GPS
        # Log GPS
        # Scan and log wifi
        # handled by collection_toggle()
        # Interval photos
        if record_flag > recording:
            # Stop interval photos
            # Start detail recording
            record_flag = False
            pass
Ejemplo n.º 4
0
            logging.info('SSID:%s, Signal:%s, BSSID:%s, Security:%s, Freq:%s', network['ssid'], network['sig'], network['bssid'], network['flag'], network['freq'])
    else:
        logging.info('No wireless networks detected')
##

# Add button pressed event detects
GPIO.add_event_detect(BUTTON_SHUTDOWN, GPIO.FALLING, callback=shutdown, bouncetime=2000)
GPIO.add_event_detect(BUTTON_COLLECTION, GPIO.FALLING, callback=collection_toggle, bouncetime=2000)
GPIO.add_event_detect(BUTTON_RECORD, GPIO.FALLING, callback=record_toggle, bouncetime=2000)

# Main loop
collection_timer = RepeatedTimer(WIFI_SCAN_DELAY, scan_log_wifi, IFACE)

# Start state
wpa_sup_list.down_iface(IFACE)
wpa_sup_list.up_iface(IFACE)
collection_timer.start()

while True:
    if collection_flag:
        # Collect data - fill in later
        # Initiate GPS
        # Log GPS
        # Scan and log wifi
            # handled by collection_toggle()
        # Interval photos
        if record_flag > recording:
            # Stop interval photos
            # Start detail recording
            record_flag = False
            pass