Example #1
0
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.")
Example #2
0
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

r.disconnect()
print("disconnected")

print("Setting address as 0x%08x" % p.address)
pod.address = p.address
pod.Save(sys.argv[3])

print(
    "Now put the pdm away, wait until it's not communicating with the pod or shut it off"
)
input("press enter to continue")

pdm = Pdm(pod)
pdm.updatePodStatus()
print(pod)
pdm.cleanUp()

print("done.")