Message Format

Discussion in 'C-Bus Serial Protocols' started by pspeirs, Oct 15, 2018.

  1. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    Hi,

    I've noticed recently now that I've picked my project up again that the format of CBus messages has changed in terms of the second byte.

    For example, the lighting message 05 00 38 00 79 0C xx sets GA 10, however the messages I see coming through are now something like 05 1E 38 00 79 0C xx.

    What is this second byte used for or indicating. I thought that if we are routing between networks then this second byte would be used but there should be an accompanying byte. In any case, I'm only running the single default network.


    Cheers,
    Paul
     
    pspeirs, Oct 15, 2018
    #1
  2. pspeirs

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,534
    Likes Received:
    175
    Location:
    Adelaide, Australia
    The second byte is the unit address. i.e. The device that initiated the command.
     
    Ashley, Oct 15, 2018
    #2
  3. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    What a goof, it's been a while since I looked at this project. The other thing I hadn't originally catered for were concatenated commands coming through. I may need to rethink some of my logic, I'm looking at message lengths, etc. What is the recommended method or reading concatenated commands, for example something simple like

    05 DC 38 00 01 65 01 66 01 67 01 68

    Obviously it shouldn't be on message length :)

    Cheers,
    Paul
     
    pspeirs, Oct 15, 2018
    #3
  4. pspeirs

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,534
    Likes Received:
    175
    Location:
    Adelaide, Australia
    Well you do need to use the length. What I do is calculate the checksum first to make sure the message is valid (otherwise you could run off the end), then remove the checksum byte. I then extract the header (up to the application and null and any routing info), then you just need a repeat loop to pull off each command out until you run out of bytes.
     
    Ashley, Oct 15, 2018
    #4
    pspeirs likes this.
  5. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    Hi Ashley,
    Appreciate the info, I'll crawl off into a corner and rework my routines a little.

    Cheers,
    Paul
     
    pspeirs, Oct 15, 2018
    #5
  6. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    OK, all looks a lot neater now. From reading some of the other threads obviously any concatenated messages would be for the same App ID, is it possible that I may see On/Off commands mixed with Ramp commands? In addition would some of the other applications like measurement concatenate messages?

    Cheers,
    Paul
     
    pspeirs, Oct 17, 2018
    #6
  7. pspeirs

    Ashley

    Joined:
    Dec 1, 2005
    Messages:
    1,534
    Likes Received:
    175
    Location:
    Adelaide, Australia
    Ashley, Oct 17, 2018
    #7
  8. pspeirs

    pspeirs

    Joined:
    Nov 23, 2013
    Messages:
    185
    Likes Received:
    10
    Location:
    Sydney
    Hi,
    Yes, I had the ones I as interested in however have downloaded the remainder.
    Cheers, Paul
     
    pspeirs, Oct 21, 2018
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.