Skip to Content
CTech Digital
  • Home
  • Odoo services
  • AI services
  • Contact us
  • 0
  • Nederlands (BE) English (UK) Français
CTech Digital
  • 0
    • Home
    • Odoo services
    • AI services
    • Contact us
  • Nederlands (BE) English (UK) Français

31/5/25

Continued new message based communication
  • All Blogs
  • Daily blog
  • 31/5/25
  • 31 May 2025 by
    CTech Metrology, Luc Wens

    And now we are starting to implement the new message responder on Proxy Level.

    First candidate is the template and we start with the hardware detection.

    Steps:

    1. Derive driver from Subscriber
    2. Convert the Driver::HardwareDetection
    3. Add responder in main
    4. Update the ProxyDriver

    Proxy: Derive driver from subscriber

    Add #include "../Libraries/TCP/Subscriber.h"

    Derive Driver from public CTrack::Subscriber

    Proxy: Convert driver function

    CTrack::Reply Driver::HardwareDetect(const CTrack::Message &message)
    {
        CTrack::Reply     Return            = std::make_unique<CTrack::Message>(TAG_COMMAND_HARDWAREDETECT);
    .....
        Return->GetParams()[ATTRIB_HARDWAREDETECT_PRESENT]     = Present;
    ....
        return Return;
    }

    The original handlers are XML based and need to be converted into JSON as shown above.

    Proxy: Add driver responder

    driver->Subscribe(*TCPServer.GetMessageResponder(),TAG_COMMAND_HARDWAREDETECT, CTrack::MakeMemberHandler(driver.get(), &Driver::HardwareDetect));

    The driver registers its HardwareDetect function as a responder to the message TAG_COMMAND_HARDWAREDETECT in TCPServer.

    The registration is done in the main.cpp before entering the big loop.

    Engine: Update proxydriver

    Based on the Handshake we can add new base functions to CProxyDevice:



    in Daily blog
    30/5/25
    Continued on message based communication
    Copyright © CTech
    Nederlands (BE) | English (UK) | Français
    Powered by Odoo - The #1 Open Source eCommerce