C-Bus Module Questions

Discussion in 'General Discussion' started by KevinH, Jan 18, 2010.

  1. KevinH

    KevinH

    Joined:
    Aug 3, 2004
    Messages:
    171
    Likes Received:
    0
    Location:
    Yorkshire. UK
    I'm making good headway porting my embedded xAP/HomeVision gateway using the newly released C-Bus module C code. I've probably missed something but what I wanted to know is how do I best recover the status/list of all the groups actually present on the C-Bus network ? Can I also get advised if they come and go ?

    At startup the database handler only seems to return events for groups that are on . I suspect this is because the database is initialised to level 0 so no level change trigger occurs. I thought the MMI handler might report an event for the off groups as they would be changing from absent to present when discovered but it doesn't and there doesn't seem a way to read absent/present if I poll through all the groups. I don't have to decode the MMI directly myself do I ?

    As soon as a group level changes I get a lighting and database event but that's not useful for initial synchronisation.

    K
     
    KevinH, Jan 18, 2010
    #1
  2. KevinH

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    Take a look at discovery.

    Another hint: groups generally (in a stable network) don't "come and go". So dont run discovery over and over again. Do it once at startup only, and after that rely on it all being "just right".

    HOWEVER if you have some terribly terribly critical application that MUST know when devices or groups come and go then you might *have* to use discovery more frequently. Don't run it more often than about once per 5 minutes though.
     
    ashleigh, Jan 18, 2010
    #2
  3. KevinH

    KevinH

    Joined:
    Aug 3, 2004
    Messages:
    171
    Likes Received:
    0
    Location:
    Yorkshire. UK
    I did look at Discovery and it does return all the units and the groups within but it means I have to augment the database and my compiler can't handle bit wide values either so it's a bit of a memory waste (had to work around this in your code). Also it returns groups that are present in key input units and these don't participate in the MMI level, unless they are matched in an output unit too. So I can't rely that the value in the DB is accurate , without interpreting the various unit types as well. (see * edit below)

    It just seems much more appropriate that absent/present be maintained within the module DB and that at initialisation the DB handler should report the values of all groups , not just those that are physically on which seems half right/half wrong. Or alternatively that there be a function call to return these. It's probably easiest for me to intercept a status MMI as it's returned via the serial receive handler... just messy.

    I assume that the discovery code is a mandatory inclusion if you operate at Enabled Level 4, or can it be left out with MMI's surficing ?

    The advice of coming and going units was not something I anticipated being frequent - it was just a way of automatically adapting to network changes should they happen

    K

    * edit: I just realised that if I include CBUS_DISCOVERY_LEVELS that the input units return zero length parameter data so conversely I can identify MMI maintained level data (groups) by there being a non zero length here.
     
    Last edited by a moderator: Jan 18, 2010
    KevinH, Jan 18, 2010
    #3
  4. KevinH

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    Discovery is not mandatory. Its there as a convenience if you want to use it.

    As far "finding the groups"... well... theres a few ways of skinning that cat. Picking apart MMI replies will tell you the groups present in output units only, if you have to modify the discovery code, or write your own, then it gets rather mucky. All possible though. Just depends what you want to achieve.

    just remember - cbus is not for polling. If you think you need to run MMI's or similar all the time to see things, then its time to think again. That said, MMI's ARE RUN FREQUENTLY - normally every 3 seconds. The Cbus Module code, as far as I remember, does not snoop those. But it could. (Its been a long time since I looked at the lighting side of things, it may well watch the MMIs and update the database, I can't remember for sure. Take a look through the lighting code.)
     
    ashleigh, Jan 18, 2010
    #4
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.