示例#1
0
def new_pod():
    verify_auth(request)

    pod = Pod()

    if request.args.get('id_lot') is not None:
        pod.id_lot = int(request.args.get('id_lot'))
    if request.args.get('id_t') is not None:
        pod.id_t = int(request.args.get('id_t'))
    if request.args.get('radio_address') is not None:
        pod.radio_address = int(request.args.get('radio_address'))
        pod.radio_address2 = int(request.args.get('radio_address'))

    archive_pod()
    pod.Save(POD_FILE + POD_FILE_SUFFIX)
    return pod
示例#2
0
文件: restapi.py 项目: winemug/omnipy
def new_pod():
    _verify_auth(request)

    pod = Pod()

    if request.args.get('id_lot') is not None:
        pod.id_lot = int(request.args.get('id_lot'))
    if request.args.get('id_t') is not None:
        pod.id_t = int(request.args.get('id_t'))
    if request.args.get('radio_address') is not None:
        pod.radio_address = int(request.args.get('radio_address'))
    else:
        pod.radio_address = 0

    if pod.radio_address == 0:
        pod.radio_address = _get_pdm_address(45000)

    _archive_pod()
    _set_pod(pod)
示例#3
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
示例#4
0

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()
response = radio.send_message_get_message(request)
response_parse(response, pod)
示例#5
0
from podcomm.protocol_common import PdmMessage, PdmRequest, PodMessage, PodResponse
from podcomm.protocol import *
from podcomm.nonce import Nonce
from podcomm.protocol_radio import PdmRadio, RadioPacket, RadioPacketType
from podcomm.crc import crc16, crc8
from tests.mock_radio import MockPacketRadio
from podcomm.pod import Pod


import time

pod = Pod()
pod.radio_address = 0x1f10fc49
radio = PdmRadio(0x1f10fc49, 0, 0)
pod.id_t = 381741
pod.id_lot = 44425

msg = request_status()
msg = radio.send_message_get_message(msg)
response_parse(msg, pod)
print(pod.__dict__)