Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    how to send confirmed data pycom?

    Scheduled Pinned Locked Moved LoPy
    confirmed data
    4 Posts 3 Posters 1.6k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J Offline
      John
      last edited by

      @administrators
      @Pycom-Channel-Partners

      how to send confirmed data pycom?

      my code is

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

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

      but this code is non-confirmed_data...

      J 1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron @John
        last edited by jcaron

        @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.

        1 Reply Last reply Reply Quote 1
        • J Offline
          John
          last edited by John

          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)
          print('Sending...')
          s.send("send pk #%d" %4)
          time.sleep(40)
          print(s.recv(12))

          but this code no output ..

          J 1 Reply Last reply Reply Quote 0
          • J Offline
            jmarcelino @John
            last edited by

            @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."

            1 Reply Last reply Reply Quote 1

            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

            With your input, this post could be even better 💗

            Register Login
            • 1 / 1
            • First post
              Last post

            Pycom on Twitter

            Pycom