Exemplo n.º 1
0
def readGps():
    args =["gps", "info"]
    response = ubus.call(args)
    
    # check if the GPS is locked
    if "signal" in response and response["signal"] == False:
        return False
    # else return the data
    return response
Exemplo n.º 2
0
def scanWifi():
    device = json.dumps({"device": "ra0"})
    args = ["onion", "wifi-scan", device]

    # perform wifi scan
    networks = ubus.call(args)["results"]

    # format the data to hold only what's needed by the API
    formattedNetworks = {}
    formattedNetworks["results"] = []

    new_json_list = []
    for data in networks:
        new_data = {}
        new_data["macAddress"] = data["bssid"]
        new_data["signalStrength"] = int(data["rssi"])
        formattedNetworks["results"].append(new_data)

    return formattedNetworks
Exemplo n.º 3
0
def scanWifi():
    device = json.dumps({"device": "ra0"})
    args = ["onion", "wifi-scan", device]
    return ubus.call(args)["results"]