From 754256c8a162c3a1af7c2499b7b479f507e983f1 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Sat, 11 May 2019 14:24:55 +0200 Subject: WiP: sort of working code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bjorn@miraculix:~/privat/prog/git/defogger$ ./dcs8000lh-configure.py B0:C5:54:4C:CC:73 getting service dumping [, , , , , , , , , , , , , ] 0000a000-0000-1000-8000-00805f9b34fb - Properties=READ NOTIFY Handle=0x0013 0000a001-0000-1000-8000-00805f9b34fb - Properties=READ WRITE Handle=0x0016 0000a100-0000-1000-8000-00805f9b34fb - Properties=READ Handle=0x0018 0000a101-0000-1000-8000-00805f9b34fb - Properties=READ WRITE Handle=0x001a 0000a102-0000-1000-8000-00805f9b34fb - Properties=WRITE Handle=0x001c 0000a103-0000-1000-8000-00805f9b34fb - Properties=READ Handle=0x001e 0000a104-0000-1000-8000-00805f9b34fb - Properties=READ Handle=0x0020 0000a200-0000-1000-8000-00805f9b34fb - Properties=READ WRITE Handle=0x0022 0000a201-0000-1000-8000-00805f9b34fb - Properties=WRITE Handle=0x0024 0000a300-0000-1000-8000-00805f9b34fb - Properties=READ WRITE Handle=0x0026 0000a301-0000-1000-8000-00805f9b34fb - Properties=READ Handle=0x0028 0000a302-0000-1000-8000-00805f9b34fb - Properties=WRITE Handle=0x002a 0000a303-0000-1000-8000-00805f9b34fb - Properties=WRITE Handle=0x002c 0000a304-0000-1000-8000-00805f9b34fb - Properties=READ Handle=0x002e read M=1;C=xyzx8i0j33xeymur Done. Signed-off-by: Bjørn Mork --- dcs8000lh-configure.py | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 dcs8000lh-configure.py diff --git a/dcs8000lh-configure.py b/dcs8000lh-configure.py new file mode 100755 index 0000000..35fa476 --- /dev/null +++ b/dcs8000lh-configure.py @@ -0,0 +1,40 @@ +#!/usr/bin/python3 + +import sys +from bluepy.btle import Peripheral + +class BleCam(object): + def __init__(self, address): + try: + self.periph = Peripheral(address) + except BTLEDisconnectError: + print("failed to connect to ".format(address)) + return + self.ipcamservice() + self.dumpchars() + self.experiment() + + def ipcamservice(self): + try: + print("getting service") + self.service = self.periph.getServiceByUUID(0xD001) + except BTLEEException: + print("no such service") + return + + def dumpchars(self): + handles = self.service.getCharacteristics() + print("dumping %s" % handles) + for h in handles: + print("%s - Properties=%s Handle=%#06x " % (h.uuid, h.propertiesToString(), h.getHandle())) + + def experiment(self): + print("read %s" % self.service.getCharacteristics(0xa001)[0].read().decode()) + +if __name__ == '__main__': + if len(sys.argv) < 2: + print("Usage: {} ".format(sys.argv[0])) + sys.exit(1) + + BleCam(sys.argv[1]) +print("Done.") -- cgit v1.2.3