summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2019-05-12 21:44:29 +0200
committerBjørn Mork <bjorn@mork.no>2019-05-12 21:44:29 +0200
commite45eee8546e64a4a34e017479638bfca060babfb (patch)
tree21df7bd176b3bffb4d735db40764ac1eb4a1ce2b
parente742826d00dac4058b917af8d17153b92618a98e (diff)
WiP
Signed-off-by: Bjørn Mork <bjorn@mork.no>
-rwxr-xr-xdcs8000lh-configure.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/dcs8000lh-configure.py b/dcs8000lh-configure.py
index 316cf9e..d347db5 100755
--- a/dcs8000lh-configure.py
+++ b/dcs8000lh-configure.py
@@ -68,6 +68,15 @@ class BleCam(object):
if not self.unlock(): return
return kv2dict(self.service.getCharacteristics(0xa104)[0].read().decode())
+ def get_wificonfig(self):
+ if not self.unlock(): return
+ return kv2dict(self.service.getCharacteristics(0xa101)[0].read().decode())
+
+ def wifilink(self):
+ if not self.unlock(): return
+ r = kv2dict(self.service.getCharacteristics(0xa103)[0].read().decode())
+ return r["S"] == "1"
+
def sysinfo(self):
if not self.unlock(): return
return kv2dict(self.service.getCharacteristics(0xa200)[0].read().decode())
@@ -129,7 +138,7 @@ if __name__ == '__main__':
parser.add_argument("--essid", help="Connect to this WiFi network")
parser.add_argument("--wifipw", help="Password for ESSID")
parser.add_argument("--survey", help="List WiFi networks seen by the IPCam", action="store_true")
- parser.add_argument("--ipconfig", help="Print current IP configuration", action="store_true")
+ parser.add_argument("--netconf", help="Print current network configuration", action="store_true")
parser.add_argument("--sysinfo", help="Dump system configuration", action="store_true")
parser.add_argument("--command", help="Run command on IPCam")
parser.add_argument("--telnetd", help="Start telnet server on IPCam", action="store_true")
@@ -142,8 +151,10 @@ if __name__ == '__main__':
cam = BleCam(args.address, args.pincode)
if args.essid:
wifiok = cam.setup_wifi(args.essid, args.wifipw)
- if args.ipconfig:
- print("ip config is: %s" % cam.get_ipconfig())
+ if args.netconf:
+ print("wifi link is %s" % "Up" if cam.wifilink() else "Down")
+ print("wifi config: %s" % cam.get_wificonfig())
+ print("ip config: %s" % cam.get_ipconfig())
if args.sysinfo:
print(cam.sysinfo())
if args.survey: