How to use emMQTT with other IP stack

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • How to use emMQTT with other IP stack

    Hello,

    I have learned that emMQTT can be used with any IP stack not only emNet from the link segger.com/products/security-iot/emmqtt/.

    However, I don't find the interface to port it with other IP stack. The IP stack related functions, for example IP_MQTT_CLIENT_Connect(), IP_MQTT_CLIENT_Publish(), IP_MQTT_CLIENT_Recv() and so on, has no source code or callback functions for porting. I also don't find the independent emMQTT binary library. I think it has been compiled into the library file libIP_vxxx_t_xxx_xxx_xxx.a with emNet. Am I right? If so, how could I use it with other IP stack?

    The software evaluation packet I used is downloaded from segger.com/evaluate-our-software/nxp/segger-empower/.

    Thanks. :)
  • Hello SilentDawn,

    If you have a look at e.g. the IP_MQTT_CLIENT_Publisher.c sample, you should be able to identify the structure IP_MQTT_CLIENT_TRANSPORT_API

    and the actual socket abstraction in various static functions above it (between file header and the IP_MQTT_CLIENT_TRANSPORT_API location).

    The

    static const IP_MQTT_CLIENT_TRANSPORT_API _IP_Api = {
    _Connect,
    _Disconnect,
    _Recv,
    _Send
    };
    _IP_Api is then assigned via IP_MQTT_CLIENT_Init() to a context.
    From here on only the context is used, which is the reason why you do not see any type of callback being given to each and every API later on.

    SilentDawn wrote:

    I also don't find the independent emMQTT binary library. I think it has been compiled into the library file libIP_vxxx_t_xxx_xxx_xxx.a with emNet. Am I right? If so, how could I use it with other IP stack?
    Correct.
    While it is in the same lib as emNet, both are not actually bundled in there.

    To use emMQTT with another IP stack, simply port the callbacks for the IP_MQTT_CLIENT_TRANSPORT_API to the other stack.
    As we basically use BSD socket API this should not be too hard if your other stack also provides this standard API interface.

    Best regards,
    Oliver
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.