def new_pod(): try: verify_auth(request) pod = Pod() if request.args.get('lot') is not None: pod.lot = int(request.args.get('lot')) if request.args.get('tid') is not None: pod.tid = int(request.args.get('tid')) if request.args.get('address') is not None: pod.address = int(request.args.get('address')) archive_pod() pod.Save(POD_FILE + POD_FILE_SUFFIX) return respond_ok({}) except RestApiException as rae: return respond_error(str(rae)) except Exception: logger.exception("Error while creating new pod") return respond_error("Other error. Please check log files.")
#!/usr/bin/python3 from podcomm.pod import Pod from podcomm.pdm import Pdm from podcomm.packet import Packet from podcomm.rileylink import RileyLink import logging import sys from podcomm.crc import crc8 logging.basicConfig(level=logging.DEBUG) pod = Pod() pod.lot = int(sys.argv[1]) pod.tid = int(sys.argv[2]) pod.lastNonce = None r = RileyLink("88:6b:0f:44:fc:1b") print("connecting to RL") r.connect() print("initializing") r.init_radio() print("ready to listen for pdm") p = None while True: data = r.get_packet(30000) if data is not None and len(data) > 2: calc = crc8(data[2:-1]) if data[-1] == calc: p = Packet(0, data[2:-1]) break