Skip to content

Support for QoS1 and QoS2 publishing/subscribing #49

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
q2dg opened this issue Aug 21, 2016 · 9 comments
Closed

Support for QoS1 and QoS2 publishing/subscribing #49

q2dg opened this issue Aug 21, 2016 · 9 comments

Comments

@q2dg
Copy link

q2dg commented Aug 21, 2016

I know in Readme there is this pharagraph: "The first release of the library only supports QoS0 and the basic features to get going. In the next releases more of the features will be available. Please create an issue if you need a specific functionality." So, well...I'm creating the issue, then.

Thanks

PS: This alternative (https://github.com/adafruit/Adafruit_MQTT_Library) supports QoS1 publishing. This other (https://github.com/knolleary/pubsubclient) supports QoS1 subscribing

@256dpi
Copy link
Owner

256dpi commented Aug 22, 2016

Thanks for raising this.

The underlying library (Paho) uses constants to activate QOS1 an QOS2 and as the Arduino IDE offers no library configuration via constants, enabling these features would result in more program space usage for all users.

Therefore, this feature is delayed until the Arduino IDE offers a suitable solution.

Ongoing discussions:

@256dpi 256dpi added the question label Dec 5, 2016
@256dpi 256dpi added this to the v2 milestone Jan 26, 2017
@sandeepmistry
Copy link
Contributor

@q2dg what boards would you like to use the QoS1 and QoS2 with?

@256dpi
Copy link
Owner

256dpi commented Jan 26, 2017

Since the increase in programming space usage is minimal, I think we should enable support for all QoS levels in v2.

The usage table again for future reference:

QoS0: 25768 bytes (9%)
QoS1: 26240 bytes (10%)
QoS2: 26552 bytes (10%)

@q2dg
Copy link
Author

q2dg commented Jan 27, 2017

@sandeepmistry Hello! Well, I'm not a skilled technician but I think SAMD's boards (Zero and MKRxxx) -at least- could do the job, don't you think?

@sandeepmistry
Copy link
Contributor

@q2dg yes, even AVR boards like the Uno should be fine. See comments in #53 (comment) for more metrics.

@alim-s-ajiev
Copy link

alim-s-ajiev commented Apr 26, 2017

I am trying to use this library with ESP8266 and QoS1. I have not written any app code yet, just in selecting sutable library yet, but I suppose that some modification would be useful in src/lib/MQTTClient.h:

#ifdef ESP8266
extern "C" void yield( void );
#endif

// only used in single-threaded mode where one command at a time is in process
template<class Network, class Timer, int a, int b>
int MQTT::Client<Network, Timer, a, b>::waitfor(int packet_type, Timer& timer)
{
    int rc = FAILURE;

    do
    {
        if (timer.expired())
            break; // we timed out
#ifdef ESP8266
        yield();
#endif
    }
    while ((rc = cycle(timer)) != packet_type);

    return rc;
}

Please, fix me if I am wrong!

@256dpi
Copy link
Owner

256dpi commented Apr 26, 2017

@alim-s-ajiev The library has been tested and successfully used with the ESP8266. No modification should be necessary to use it with the current feature set.

@alim-s-ajiev
Copy link

Yes, you are right! It turns out that yield() is called inside cycle method for ESP8266 WiFi.

Thank you very much!

@256dpi 256dpi mentioned this issue Apr 26, 2017
Merged
11 tasks
@256dpi
Copy link
Owner

256dpi commented Apr 26, 2017

This is beeing addressed in #59.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants