| 90 | } |
| 91 | |
| 92 | aimrt::co::Task<aimrt::rpc::Status> ParameterServiceImpl::Load( |
| 93 | aimrt::rpc::ContextRef ctx_ref, |
| 94 | const ::aimrt::protocols::parameter_plugin::LoadParameterReq& req, |
| 95 | ::aimrt::protocols::parameter_plugin::LoadParameterRsp& rsp) { |
| 96 | for (auto module_itr = req.module_parameter_map().begin(); |
| 97 | module_itr != req.module_parameter_map().end(); |
| 98 | ++module_itr) { |
| 99 | std::string_view module_name(module_itr->first); |
| 100 | auto* parameter_handle_ptr = parameter_manager_ptr_->GetParameterHandle(module_name); |
| 101 | |
| 102 | // Check the legality of module name |
| 103 | if (parameter_handle_ptr == nullptr) { |
| 104 | SetErrorCode(ErrorCode::kInvalidModuleName, rsp); |
| 105 | co_return aimrt::rpc::Status(); |
| 106 | } |
| 107 | |
| 108 | const auto& pb_parameter_map = module_itr->second.value(); |
| 109 | for (auto parameter_itr = pb_parameter_map.begin(); |
| 110 | parameter_itr != pb_parameter_map.end(); |
| 111 | ++parameter_itr) { |
| 112 | parameter_handle_ptr->SetParameter(parameter_itr->first, parameter_itr->second); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | co_return aimrt::rpc::Status(); |
| 117 | } |
| 118 | |
| 119 | } // namespace aimrt::plugins::parameter_plugin |
nothing calls this directly
no test coverage detected