Beispiel #1
0
def handle_stop(environ, start_response):
    start_response(httplib.OK, [('Content-Type', 'text/plain')])
    yield stop_hotspot()
Beispiel #2
0
def handle_reset(environ, start_response):
    start_response(httplib.OK, [('Content-Type', 'text/plain')])
    enable_wifi_p2p_service()
    restore_config_files()
    stop_hotspot()
    return []
Beispiel #3
0
def wifi_reset():
    wifi.enable_wifi_p2p_service()
    wifi.restore_config_files()
    wifi.stop_hotspot()
Beispiel #4
0
def wifi_reset():
    wifi.enable_wifi_p2p_service()
    wifi.restore_config_files()
    wifi.stop_hotspot()
Beispiel #5
0
def handle_stop(environ, start_response):
    start_response(httplib.OK, [('Content-Type', 'text/plain')])
    yield stop_hotspot()
Beispiel #6
0
def handle_reset(environ, start_response):
    start_response(httplib.OK, [('Content-Type', 'text/plain')])
    enable_wifi_p2p_service()
    restore_config_files()
    stop_hotspot()
    return []
Beispiel #7
-1
    httpd.serve_forever()


def clean():
    setup_logging(LOG_FILE)
    LOGGER.info('clean...')
    dns_service.clean()
    tcp_service.clean()
    full_proxy_service.clean()
    lan_service.clean()
    wifi.clean()


if '__main__' == __name__:
    if len(sys.argv) > 1:
        shutdown_hook.shutdown_hooks = []
        action = sys.argv[1]
        if 'wifi-start-hotspot' == action:
            setup_logging(os.path.join(LOG_DIR, 'wifi.log'), maxBytes=1024 * 512)
            sys.stderr.write(repr(wifi.start_hotspot(*sys.argv[2:])))
        elif 'wifi-stop-hotspot' == action:
            setup_logging(os.path.join(LOG_DIR, 'wifi.log'), maxBytes=1024 * 512)
            sys.stderr.write(repr(wifi.stop_hotspot()))
        elif 'twitter-check' == action:
            setup_logging(os.path.join(LOG_DIR, 'twitter.log'), maxBytes=1024 * 64)
            sys.stderr.write(repr(twitter.check()))
        elif 'clean' == action:
            clean()
    else:
        run()