localwifisystem = networkdbmod.getAPSSID()
if localwifisystem == "":
    localwifisystem = "hydrosys4"
    print "error the name of AP not found, double check the hostapd configuration"
    logger.error(
        "error the name of AP not found, double check the hostapd configuration"
    )
LOCALPORT = 5020
PUBLICPORT = networkdbmod.getPORT()
WAITTOCONNECT = networkdbmod.getWAITTOCONNECT()
if WAITTOCONNECT == "":
    WAITTOCONNECT = 180  # should be 180 at least
    networkdbmod.changesavesetting(
        'APtime', WAITTOCONNECT)  # if field not present it will be added
IPADDRESS = networkdbmod.getIPaddress()
EXTERNALIPADDR = ""
DHCP_COUNTER = 0


def stopNTP():
    #sudo systemctl disable systemd-timesyncd.service
    #sudo service systemd-timesyncd stop
    logger.info("Stop NTP")
    print "Stop NTP (Network Time Protocol)"
    # hostnamectl set-hostname $NewHostName
    cmd = ['service', 'systemd-timesyncd', 'stop']
    try:
        output_string = subprocess.check_output(cmd).decode('utf-8').strip()
        return output_string
    except subprocess.CalledProcessError as e:
Beispiel #2
0
import wpa_cli_mod

logger = logging.getLogger("hydrosys4."+__name__)

localwifisystem=networkdbmod.getAPSSID()
if localwifisystem=="":
	localwifisystem="hydrosys4"
	print "error the name of AP not found, double check the hostapd configuration"
	logger.error("error the name of AP not found, double check the hostapd configuration")
LOCALPORT=5020
PUBLICPORT=networkdbmod.getPORT()
WAITTOCONNECT=networkdbmod.getWAITTOCONNECT()
if WAITTOCONNECT=="":
	WAITTOCONNECT=180 # should be 180 at least
	networkdbmod.changesavesetting('APtime',WAITTOCONNECT) # if field not present it will be added
IPADDRESS =networkdbmod.getIPaddress()
EXTERNALIPADDR=""




	
def wifilist_ssid():
	# get all cells from the air
	ssids=[]
	network = wpa_cli_mod.get_networks("wlan0",2)
	for item in network:
		ssids.append(item["ssid"])
	return ssids

def savedwifilist_ssid():