Callback functions within subscription packets are currently not processed if processPacketsUntil() receives a subscription packet. While processPacketsUntil() does call handleSubscriptionPacket(), handleSubscriptionPacket() fills the Adafruit_Subscription object but does not call the callbacks as mentioned in its docstring ("// Handle any data coming in for subscriptions and fires them off to the appropriate callback") nor does it mark the subscription message as "read" (implemented in https://github.com/adafruit/Adafruit_MQTT_Library/pull/195).
This causes any subscription packet picked up during processPacketsUntil()'s period (called by a ping() or publish()) to never execute its callback method.
This pull request:
Adds a new method, processSubscriptionPacket which executes a subscription packet's associated callback and marks the message as "read"
Refactors processPackets and processPacketsUntil to use processSubscriptionPacket
This was tested against the Adafruit IO WipperSnapper library's synchronization function and was OK for: 5x servos re-syncing, 2x DS18x components syncing, 2x i2c devices + servo + 2x dsx + 1x pin component syncing
Callback functions within subscription packets are currently not processed if
processPacketsUntil()
receives a subscription packet. WhileprocessPacketsUntil()
does callhandleSubscriptionPacket()
,handleSubscriptionPacket()
fills theAdafruit_Subscription
object but does not call the callbacks as mentioned in its docstring ("// Handle any data coming in for subscriptions and fires them off to the appropriate callback") nor does it mark the subscription message as "read" (implemented in https://github.com/adafruit/Adafruit_MQTT_Library/pull/195).This causes any subscription packet picked up during
processPacketsUntil()
's period (called by aping()
orpublish()
) to never execute its callback method.This pull request:
processSubscriptionPacket
which executes a subscription packet's associated callback and marks the message as "read"processPackets
andprocessPacketsUntil
to useprocessSubscriptionPacket
This was tested against the Adafruit IO WipperSnapper library's synchronization function and was OK for: 5x servos re-syncing, 2x DS18x components syncing, 2x i2c devices + servo + 2x dsx + 1x pin component syncing
ping @ladyada for review