From e45eee8546e64a4a34e017479638bfca060babfb Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Sun, 12 May 2019 21:44:29 +0200 Subject: WiP MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- dcs8000lh-configure.py | 17 ++++++++++++++--- 1 file 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: -- cgit v1.2.3