how to send confirmed data pycom?

  • @administrators

    how to send confirmed data pycom?

    my code is

    s.setsockopt(socket.SOL_LORA, socket.SO_DR, 3)
    s.setblocking(False) # false로 되어있어야 recv가 가능

    for i in range (200):
    send = s.send(bytes([0x01, 0x02, 0x03]))
    print('send_data: ', bytes([0x01, 0x02, 0x03]))
    rx = s.recv(64)
    if rx:
    print('recv_data: ',rx)

    but this code is non-confirmed_data...

  • @john

    You need to register a LoRa callback to work with the acknowledgements, i.e.:

    lora.callback(LoRa.TX_FAILED_EVENT, handler=YourHandlerFunction, arg=None)

    "If the ack is not received LoRa.TX_FAILED_EVENT will be raised after the number of tx_retries configured have been performed."

  • thank you!

    I succeeded in sending confirmed data.
    but, i don't know ack packet printing.
    Do you know printing ack packet as lopy ??
    this is my code

    join process
    s = socket.socket(socket.AF_LORA, socket.SOCK_RAW)
    s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, True)
    s.send("send pk #%d" %4)

    but this code no output ..

  • @john as described in the docs:

    # selecting confirmed type of messages
    s.setsockopt(socket.SOL_LORA, socket.SO_CONFIRMED, True)

    Note that due to the bands limitations, there are often strict limits on how much confirmed packets you are allowed to send.

Log in to reply

Pycom on Twitter