Example #1
0
def _get_pod():
    global g_pod
    try:
        if g_pod is None:
            if os.path.exists(DATA_PATH + POD_FILE + POD_FILE_SUFFIX):
                g_pod = Pod.Load(DATA_PATH + POD_FILE + POD_FILE_SUFFIX,
                                 DATA_PATH + POD_FILE + POD_DB_SUFFIX)
            else:
                g_pod = Pod()
                g_pod.path = DATA_PATH + POD_FILE + POD_FILE_SUFFIX
                g_pod.path_db = DATA_PATH + POD_FILE + POD_DB_SUFFIX
                g_pod.Save()
        return g_pod
    except:
        logger.exception("Error while loading pod")
        return None
Example #2
0
def get_pod():
    path = "data/bbe.json"
    log_path = "data/bbe.log"
    pod = None

    try:
        pod = Pod.Load(path)
    except:
        pass

    if pod is None:
        pod = Pod()
        pod.path = path
        pod.log_file_path = log_path
        pod.id_lot = 44147
        pod.id_t = 1100256
        pod.radio_address = 0x1f0e89f0
        pod.Save()

    return pod
Example #3
0
        return None
    else:
        return packet


path = "data/bbe.json"
log_path = "data/bbe.log"
pod = None
try:
    pod = Pod.Load(path)
except:
    pass

if pod is None:
    pod = Pod()
    pod.path = path
    pod.log_file_path = log_path
    pod.id_lot = 44147
    pod.id_t = 1100256
    pod.radio_address = 0x1f0e89f0
    pod.Save()

mock_radio = MockPacketRadio(send_callback=skip_ack,
                             allow_connect=True,
                             allow_listen=True)
radio = PdmRadio(pod.radio_address,
                 packet_radio=mock_radio,
                 msg_sequence=pod.radio_message_sequence,
                 pkt_sequence=pod.radio_packet_sequence)

request = request_status()
Example #4
0
from podcomm.protocol_radio import PdmRadio, RadioPacket, RadioPacketType, TxPower
from podcomm.crc import crc16, crc8
from tests.mock_radio import MockPacketRadio
from podcomm.pod import Pod

import time

pod = None
try:
    pod = pod.Load("/home/ba/newpod2.json", "/home/ba/newpod2.json.log")
except:
    pass

if pod is None:
    pod = Pod()
    pod.path = "/home/ba/newpod2.json"
    pod.log_file_path = "/home/ba/newpod2.json.log"

req_address = 0x1f000015
radio = PdmRadio(0xffffffff)

msg = request_assign_address(req_address)
rsp = radio.send_message_get_message(msg,
                                     ack_address_override=req_address,
                                     tx_power=TxPower.Lowest)
response_parse(rsp, pod)
pod.Save("/home/ba/newpod1.json")

radio.message_sequence = 1
msg = request_setup_pod(pod.id_lot, pod.id_t, pod.radio_address, 2019, 4, 3,
                        21, 35)