CNI from dll?

Discussion in 'C-Bus Toolkit and C-Gate Software' started by paulas, Dec 5, 2008.

  1. paulas

    paulas

    Joined:
    Feb 4, 2008
    Messages:
    14
    Likes Received:
    0
    Hi,

    I've developed an app (c++) that interfaces to cbus via c-gate through a CNI. For a number of reasons, I would like to get rid of c-gate and talk to the CNI directly. I've downloaded the Windows driver, but a quick look through the docs seems to indicate that it only works for serial comms?

    What's the best way for an embedded app to access CBus via a CNI?

    Thanks,

    Paul
     
    paulas, Dec 5, 2008
    #1
  2. paulas

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,397
    Likes Received:
    26
    Location:
    Adelaide, South Australia
    You need to write yourself a code wrapper which reads and writes sockets to the CNI. When the CBM.DLL reads a character you need to take the next character from a string or array read from the socket (and when none left, read the socket again). For transmitting, just write each character to the socket.

    This can all be done without the need for threads, but it will require a bit of thought to do so.
     
    ashleigh, Dec 7, 2008
    #2
  3. paulas

    daniel C-Busser Moderator

    Joined:
    Jul 26, 2004
    Messages:
    770
    Likes Received:
    21
    Location:
    Adelaide
    Hi paulas,

    Out of curiosity, what are the "number of reasons" you would like to bypass C-gate?
     
    daniel, Dec 8, 2008
    #3
  4. paulas

    paulas

    Joined:
    Feb 4, 2008
    Messages:
    14
    Likes Received:
    0
    Hi Daniel,

    I've had a couple of times where c-gate simply stopped responding, so we wrote a watchdog that tried to identify this and kill / restart it. It's all just a bit messy, it doesn't seem to be written as a 24/7 style service. I'm no java guru, but I tried pretty hard to get it to run as service and gave up eventually.

    We were using PACs, that worked pretty well, except it's virtually impossible to maintain / update remotely. So now we are using atom based systems running 2008 Core Embedded with some kludges to run c-Gate in a console session. Getting rid of c-gate and talking directly to cbus via a CNI seems pretty attractive.

    Kind Regards,

    Paul
     
    paulas, Dec 13, 2008
    #4
  5. paulas

    Richo

    Joined:
    Jul 26, 2004
    Messages:
    1,257
    Likes Received:
    0
    Location:
    Adelaide
    Clipsal have used this java service wrapper to deploy C-gate in a production environment. http://wrapper.tanukisoftware.org/doc/english/download.jsp

    It has worked really well and we have not seen any issues running C-gate as a service. Certainly never seen a lockup.
     
    Richo, Dec 13, 2008
    #5
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.