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. Development
  3. Understanding Message code

Understanding Message code

Scheduled Pinned Locked Moved Development
6 Posts 3 Posters 3.5k Views 1 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.
  • J Offline
    J Offline
    jmmorgan
    wrote on last edited by
    #1

    I need to understand message coding better. The overview is fine, but I was hoping for a link that would explain it more (i.e. what it message_s? etc).
    Thanks
    John

    1 Reply Last reply
    0
    • hekH Offline
      hekH Offline
      hek
      Admin
      wrote on last edited by
      #2

      message_s contains the actual message that is transferred over the air. It contains of a header and a payload.

      The payload is the actual message you want to transfer from sensor. Like 23.7 degres.
      The header contains meta information like destination, which sensor is reporting etc. The header is needed for routing the message to its destination and for interpreting the message on the other end.

      1 Reply Last reply
      0
      • J Offline
        J Offline
        jmmorgan
        wrote on last edited by
        #3

        Thanks
        So were to you find the syntax to parse the header such as message.header.??? And what is "atoi (message.data)". I hate to keep asking questions, if there is some place I could read up on it.

        BulldogLowellB hekH 2 Replies Last reply
        0
        • J jmmorgan

          Thanks
          So were to you find the syntax to parse the header such as message.header.??? And what is "atoi (message.data)". I hate to keep asking questions, if there is some place I could read up on it.

          BulldogLowellB Offline
          BulldogLowellB Offline
          BulldogLowell
          Contest Winner
          wrote on last edited by
          #4

          @jmmorgan said:

          Thanks
          So were to you find the syntax to parse the header such as message.header.??? And what is "atoi (message.data)". I hate to keep asking questions, if there is some place I could read up on it.

          message.data is the return of gw.getMessage and atoi() is an (arduino) C function to convert a string to an integer, so:

          atoi (message.data) returns the message.data as an integer

          Use that if you are moving integers from server side.

          if you are moving Strings:

          messageString = String(message.data)

          1 Reply Last reply
          0
          • J jmmorgan

            Thanks
            So were to you find the syntax to parse the header such as message.header.??? And what is "atoi (message.data)". I hate to keep asking questions, if there is some place I could read up on it.

            hekH Offline
            hekH Offline
            hek
            Admin
            wrote on last edited by
            #5

            @jmmorgan

            Why would you like to parse the header? And by what?

            You probably need to pick up some of the c++ basics first. There free online :book: and we linked a couple of physical ones on the API page.

            BulldogLowellB 1 Reply Last reply
            0
            • hekH hek

              @jmmorgan

              Why would you like to parse the header? And by what?

              You probably need to pick up some of the c++ basics first. There free online :book: and we linked a couple of physical ones on the API page.

              BulldogLowellB Offline
              BulldogLowellB Offline
              BulldogLowell
              Contest Winner
              wrote on last edited by
              #6

              @hek said:

              You probably need to pick up some of the c++ basics first. There free online :book: and we linked a couple of physical ones on the API page.

              I would also recommend Beginning C in Arduino, which is a great start. It has practical examples you can test with your Arduino. Downside is that it has a terrible index and is pricey. Borrow it, don't buy it! ;)

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


              26

              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