Beispiel #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)
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)
Beispiel #3
0
                      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
            print(network)
            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