-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutility.py
More file actions
39 lines (29 loc) · 966 Bytes
/
Copy pathutility.py
File metadata and controls
39 lines (29 loc) · 966 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import subprocess
def isRpiA():
returnValue = False
processReturnStr = subprocess.check_output(['cat', '/proc/device-tree/model'])
modelStr = processReturnStr.split('Model')
if modelStr[1] == 'A':
returnValue = True
return returnValue
def isWifiConnected():
returnValue = False
processReturnStr = subprocess.check_output(['iwgetid'])
modelStr = processReturnStr.split('ESSID:')
# If we have a SSID string, they we are considering ourselves connected to wifi.
if modelStr[0]:
print(">> Connected Wifi: " + modelStr[0])
returnValue = True
return returnValue
def doesDatabaseExist():
# TODO
return True
def get_ip_address():
strIp = "0.0.0.0"
try:
IP = subprocess.check_output(["hostname", "-I"]).split()[0]
strIp = str(IP)
print(">> Ip address: " + str(IP))
except:
strIp = "Unknown"
return strIp