| 383 | *****************************************************************************/ |
| 384 | |
| 385 | void TopicHandlerService::strToAccess(IPluginMaintenance* plugin, const String& strAccess, ITopicHandler::GetTopicFunc& getTopicFunc, ITopicHandler::SetTopicFunc& setTopicFunc, ITopicHandler::UploadReqFunc& uploadReqFunc) const |
| 386 | { |
| 387 | if (nullptr != plugin) |
| 388 | { |
| 389 | bool isReadAccess = false; |
| 390 | bool isWriteAccess = false; |
| 391 | |
| 392 | if (true == strAccess.equalsIgnoreCase("rw")) |
| 393 | { |
| 394 | /* Read/Write access */ |
| 395 | isReadAccess = true; |
| 396 | isWriteAccess = true; |
| 397 | } |
| 398 | else if (true == strAccess.equalsIgnoreCase("w")) |
| 399 | { |
| 400 | /* Write only access */ |
| 401 | isWriteAccess = true; |
| 402 | } |
| 403 | else |
| 404 | { |
| 405 | /* Read only access */ |
| 406 | isReadAccess = true; |
| 407 | } |
| 408 | |
| 409 | if (true == isReadAccess) |
| 410 | { |
| 411 | getTopicFunc = [plugin](const String& topic, JsonObject& value) -> bool { |
| 412 | LOG_DEBUG("Get %s of plugin %u.", topic.c_str(), plugin->getUID()); |
| 413 | return plugin->getTopic(topic, value); |
| 414 | }; |
| 415 | } |
| 416 | |
| 417 | if (true == isWriteAccess) |
| 418 | { |
| 419 | setTopicFunc = [plugin](const String& topic, const JsonObjectConst& value) -> bool { |
| 420 | LOG_DEBUG("Set %s of plugin %u.", topic.c_str(), plugin->getUID()); |
| 421 | return plugin->setTopic(topic, value); |
| 422 | }; |
| 423 | |
| 424 | uploadReqFunc = [plugin](const String& topic, const String& srcFilename, String& dstFilename) -> bool { |
| 425 | return plugin->isUploadAccepted(topic, srcFilename, dstFilename); |
| 426 | }; |
| 427 | } |
| 428 | } |
| 429 | } |
| 430 | |
| 431 | void TopicHandlerService::addToTopicMetaDataList(const String& deviceId, const String& entityId, IPluginMaintenance* plugin, const String& topic, HasChangedFunc hasChangedFunc) |
| 432 | { |
nothing calls this directly
no test coverage detected