Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Need help to understand basic communication API: send, receive, ACK

Need help to understand basic communication API: send, receive, ACK

Scheduled Pinned Locked Moved General Discussion
3 Posts 2 Posters 726 Views 2 Watching
  • 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.
  • M Offline
    M Offline
    Michał Kozak
    wrote on last edited by
    #1

    Looks like I have a problem to understand how sending exactly works? I read the docs, examples, I created sketches for 4 nodes but I'm still not sure wether I use the function send correctly.

    The function returns boolean which according to documentation:
    Returns true if message reached the first stop on its way to destination.
    My doubts here:

    1. If I send without ACK, how does a node "knows" that the "message reached the first stop on its way" ? How to interpret the returned boolean in such case? If I get false should I repeat sending?
    2. If I want to use ACK, does the send function call blocks execution until ACK is received then it returns true? Do I need to implement receive function and handle ACK by myself?
    mfalkviddM 1 Reply Last reply
    0
    • M Michał Kozak

      Looks like I have a problem to understand how sending exactly works? I read the docs, examples, I created sketches for 4 nodes but I'm still not sure wether I use the function send correctly.

      The function returns boolean which according to documentation:
      Returns true if message reached the first stop on its way to destination.
      My doubts here:

      1. If I send without ACK, how does a node "knows" that the "message reached the first stop on its way" ? How to interpret the returned boolean in such case? If I get false should I repeat sending?
      2. If I want to use ACK, does the send function call blocks execution until ACK is received then it returns true? Do I need to implement receive function and handle ACK by myself?
      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by
      #2

      @michał-kozak ack is a complex topic. See https://forum.mysensors.org/post/34267 for an earlier discussion on the same topic.

      To answer your questions:

      1. The next-hop node will acknowledge the message. The returned boolean shows if the sending node received an acknowledgement from the next hop node. If you get false, it could be because the next hop didn't receive the message, or because the sending node didn't receive the acknowledgement. What you should do depends on what you want to happen.
      2. No, the send function will not block. Yes you need to handle the echoed message in receive().

      See also https://github.com/mysensors/MySensors/issues/1103

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Michał Kozak
        wrote on last edited by
        #3

        @mfalkvidd that's helped me a lot to better understand what is happening during send! Thanks!

        1 Reply Last reply
        1
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        18

        Online

        11.7k

        Users

        11.2k

        Topics

        113.1k

        Posts


        Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • MySensors
        • OpenHardware.io
        • Categories
        • Recent
        • Tags
        • Popular