From 04b05d7e59c689103c86eefc93a4df5142b59123 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Sat, 11 May 2019 15:26:20 +0200 Subject: WiP: reading name of device working MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- dcs8000lh-configure.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dcs8000lh-configure.py b/dcs8000lh-configure.py index fa057ec..636a0ad 100755 --- a/dcs8000lh-configure.py +++ b/dcs8000lh-configure.py @@ -3,12 +3,15 @@ import sys import hashlib import base64 -from bluepy.btle import Peripheral +from bluepy.btle import UUID, Peripheral + +dev_name_uuid = UUID(0x2A00) class BleCam(object): def __init__(self, address, pincode): self.pincode = pincode self.periph = Peripheral(address) + #print(self.periph) self.ipcamservice() self.dumpchars() self.experiment() @@ -34,8 +37,9 @@ class BleCam(object): if t.startswith("C="): self.challenge=t.split("=",2)[1] print("challenge is %s" % self.challenge) - name = "DCS-8000LH-CC73" + name = self.periph.getCharacteristics(uuid=dev_name_uuid)[0].read().decode() # "DCS-8000LH-CC73" hashit = name + self.pincode + self.challenge + print("will hash %s" % hashit) self.key = base64.b64encode(hashlib.md5(hashit.encode()).digest())[:16] print ("key is %s" % self.key) try: -- cgit v1.2.3