Ejemplo n.º 1
0
def switch_to_hotspot_mode():
    if niryo_one_wifi.get_current_ssid() == HOTSPOT_SSID:
        return standard_response(200, "Hotspot mode already activated")
    success = niryo_one_wifi.hard_enable_hotspot_with_ssid(HOTSPOT_SSID, HOTSPOT_PASSWORD)
    if success:
        return standard_response(200, "Hotspot mode activated")
    return standard_response(400, "Failed to activate hotspot mode")
Ejemplo n.º 2
0
def delete_connection():
    params = request.get_json()
    #print params
    if not params:
        return standard_response(400, "No ssid given")
    ssid = params.get('ssid', None)
    if ssid is None:
        return standard_response(400, "No ssid given")

    # Check if ssid = current ssid
    current_ssid = gauss_wifi.get_current_ssid()
    #print current_ssid
    if current_ssid == ssid:
        return standard_response(400, "Gauss is currently connected to this ssid. Please connect the robot to another ssid, or switch to 'hotspot mode', and retry")

    if gauss_wifi.delete_connection_with_ssid(ssid):
        return standard_response(200, "Connection has been removed")
    else:
        return standard_response(400, "Unable to remove this connection")