diff options
-rwxr-xr-x | dcs8000lh-configure.py | 40 |
1 files changed, 40 insertions, 0 deletions
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 <addr>".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: {} <addr>".format(sys.argv[0])) + sys.exit(1) + + BleCam(sys.argv[1]) +print("Done.") |