Add method to cound number of subscription
This commit is contained in:
parent
af01dcb7da
commit
dca344d237
@ -890,6 +890,18 @@ uint8_t Adafruit_MQTT::disconnectPacket(uint8_t *packet) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
uint Adafruit_MQTT::getSubscriptionCount()
|
||||
{
|
||||
uint count = 0;
|
||||
|
||||
for (int i = 0; i < MAXSUBSCRIPTIONS; i++) {
|
||||
if (subscriptions[i])
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// Adafruit_MQTT_Publish Definition ////////////////////////////////////////////
|
||||
|
||||
Adafruit_MQTT_Publish::Adafruit_MQTT_Publish(Adafruit_MQTT *mqttserver,
|
||||
|
@ -218,6 +218,9 @@ public:
|
||||
// Ping the server to ensure the connection is still alive.
|
||||
bool ping(uint8_t n = 1);
|
||||
|
||||
// Count the number of registrered Adafruit_MQTT_Subscribe
|
||||
uint getSubscriptionCount();
|
||||
|
||||
protected:
|
||||
// Interface that subclasses need to implement:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user