adafruit / Adafruit_WICED_Arduino

Adafruit WICED Feather Arduino BSP
https://www.adafruit.com/products/3056
27 stars 19 forks source link

Disconnect callback for MQTT and TCP don't imply that connected() method returns false #38

Closed mattlevy closed 8 years ago

mattlevy commented 8 years ago

I've noticed that even though I do receive callbacks to my handlers when disconnected, the connected() method still returns true. This means that my connection loop, which only attempts to connect if connected() is false, never executes. If I add an express call to disconnect() to my handler, I do attempt a reconnect.

I'm not sure which behavior you want, but it should be either changed so that no manual call to disconnect() is necessary, or documented.

Note: I have only experienced this with the AdafruitTCP and AdafruitMQTT classes. I have not tried any others, although I would assume they're consistent.

hathach commented 8 years ago

thanks for reporting, it is a bug, we will try to fix it asap.

hathach commented 8 years ago

@mattlevy if possible, could you provide your sketch. We could fix that quicker and make sure it work for you as well.

mattlevy commented 8 years ago

Here's my sketch as a text file. You'll need to fill in your own wifi network, etc. It should be clear where to do that.

You may notice that I have a global boolean "subscribed". That's because it's possible to subscribe multiple times to the same feed - I don't know if that's intended or not.

Disconnect_bug_sketch.txt

hathach commented 8 years ago

should be resolved on development branch, and get closed when merged to master