| 348 | } |
| 349 | |
| 350 | void TopicHandlerService::unregisterTopic(const String& deviceId, const String& entityId, const String& topic, bool purge) |
| 351 | { |
| 352 | if ((false == deviceId.isEmpty()) && |
| 353 | (false == topic.isEmpty())) |
| 354 | { |
| 355 | uint8_t idx = 0U; |
| 356 | uint8_t count = 0U; |
| 357 | ITopicHandler** topicHandlerList = TopicHandlers::getList(count); |
| 358 | |
| 359 | /* Unregister topic by every known topic handler. */ |
| 360 | while (count > idx) |
| 361 | { |
| 362 | ITopicHandler* handler = topicHandlerList[idx]; |
| 363 | |
| 364 | if (nullptr != handler) |
| 365 | { |
| 366 | handler->unregisterTopic(deviceId, entityId, topic, purge); |
| 367 | } |
| 368 | |
| 369 | ++idx; |
| 370 | } |
| 371 | |
| 372 | /* If topic is stored for automatic publishing, it will be removed. */ |
| 373 | removeFromTopicMetaDataList(deviceId, entityId, topic); |
| 374 | } |
| 375 | } |
| 376 | |
| 377 | /****************************************************************************** |
| 378 | * Protected Methods |