umqtt.simple: Return handled message type from wait_msg(). #159
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.