Skip to content

umqtt.simple: Return handled message type from wait_msg(). #159

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
wants to merge 0 commits into from
Closed

umqtt.simple: Return handled message type from wait_msg(). #159

wants to merge 0 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 8, 2017

Hello everyone, thanks for the nice work on micropython.

Problem

I am trying to solve two problems with this request:

A) I execute the method check_msg() in umqtt.simple.MQTTClient regularly from a main loop. For scheduling reasons I would like to know if the call has handled an incoming message or not.

B) Currently there seems no way to react to an incoming PINGRESP.

Solution

The proposed solution is: Return the message header of a handled message instead of None at the end of the function. Return the message header (0xd0) of a handled PINGRESP instead of None. Move the statement op = res[0] above the ping handling to be consistent. By this change the calling module can extract all the required information.

Impact

One line of code is added so the code size remains small. Since the method was always returning None I do not see any impact on depending code.

@ghost ghost closed this Jul 31, 2017
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants