def getData(self): if not self.complete: return None bc32_cbor = "".join(self.segments) raw = cbor_decode(bc32decode(bc32_cbor)) return raw
def getBase64Data(self) -> str: bc32_cbor = "".join(self.segments) raw = cbor_decode(bc32decode(bc32_cbor)) base64 = b2a_base64(raw) if self.complete: return base64 return None
def getDataPSBT(self): if self.complete: if self.qr_type == QRType.PSBTUR2: cbor = self.ur_decoder.result_message().cbor return cbor_decode(cbor) elif self.qr_type == QRType.PSBTSPECTER: return self.specter_qr.getData() elif self.qr_type == QRType.PSBTURLEGACY: return self.legacy_ur.getData() elif self.qr_type == QRType.PSBTBASE64: return self.base64_qr.getData() elif self.qr_type == QRType.PSBTBASE43: return self.base43_qr.getData() return None
def scan_animated_qr_pbst(self, controller) -> str: self.controller = controller self.buttons = controller.buttons self.controller.menu_view.draw_modal(["Initializing Camera"]) # TODO: Move to Controller # initialize camera self.controller.to_camera_queue.put(["start"]) # First get blocking, this way it's clear when the camera is ready for the end user self.controller.from_camera_queue.get() self.camera_loop_timer = CameraPoll(0.05, self.process_camera_data) input = self.buttons.wait_for([B.KEY_LEFT, B.KEY_RIGHT]) if input in (B.KEY_LEFT, B.KEY_RIGHT): self.camera_loop_timer.stop() self.controller.to_camera_queue.put(["stop"]) return "nodata" elif input == B.OVERRIDE: self.camera_loop_timer.stop() self.controller.to_camera_queue.put(["stop"]) if self.qr_data[0] == "invalid": return "invalid" return cbor_decode(self.ur_decoder.result.cbor)