| 60 | } |
| 61 | |
| 62 | bool ClientPluginInterface::OnCreate(const ClientPluginParam& param) { |
| 63 | SnowflakeId::initialize(0, 105); |
| 64 | this->param_ = param; |
| 65 | if (param.cluster_.contains("name")) { |
| 66 | auto n = param.cluster_.at("name"); |
| 67 | plugin_file_name_ = std::any_cast<std::string>(n); |
| 68 | } |
| 69 | |
| 70 | if (param.cluster_.contains("base_path")) { |
| 71 | base_path_ = std::any_cast<std::string>(param.cluster_.at("base_path")); |
| 72 | } |
| 73 | std::string base_data_path; |
| 74 | if (param.cluster_.contains("base_data_path")) { |
| 75 | base_data_path = std::any_cast<std::string>(param.cluster_.at("base_data_path")); |
| 76 | } |
| 77 | plugin_context_ = std::make_shared<ClientPluginContext>(GetPluginName()); |
| 78 | |
| 79 | Logger::InitLog(base_data_path + "/gr_logs/ct_" + plugin_file_name_+".log", true); |
| 80 | LOGI("{} OnCreate", GetPluginName()); |
| 81 | |
| 82 | capture_audio_device_id_ = GetConfigParam<std::string>("capture_audio_device_id"); |
| 83 | |
| 84 | screen_recording_path_ = GetConfigParam<std::string>("screen_recording_path"); |
| 85 | |
| 86 | plugin_settings_.clipboard_enabled_ = GetConfigBoolParam("clipboard_enabled"); |
| 87 | plugin_settings_.device_id_ = GetConfigStringParam("device_id"); |
| 88 | plugin_settings_.stream_id_ = GetConfigStringParam("stream_id"); |
| 89 | plugin_settings_.language_ = (int)GetConfigIntParam("language"); |
| 90 | plugin_settings_.stream_name_ = GetConfigStringParam("stream_name"); |
| 91 | plugin_settings_.display_name_ = GetConfigStringParam("display_name"); |
| 92 | plugin_settings_.display_remote_name_ = GetConfigStringParam("display_remote_name"); |
| 93 | |
| 94 | LOGI("plugin settings clipboard enabled: {}", plugin_settings_.clipboard_enabled_); |
| 95 | LOGI("plugin settings device id: {}", plugin_settings_.device_id_); |
| 96 | LOGI("plugin settings stream id: {}", plugin_settings_.stream_id_); |
| 97 | |
| 98 | // print params |
| 99 | LOGI("Input params size : {}", param.cluster_.size()); |
| 100 | for (const auto& [key, value]: param.cluster_) { |
| 101 | if (value.type() == typeid(std::string)) { |
| 102 | LOGI(" * {} => {}", key, std::any_cast<std::string>(value)); |
| 103 | } |
| 104 | else if (value.type() == typeid(int64_t)) { |
| 105 | LOGI(" * {} => {}", key, std::any_cast<int64_t>(value)); |
| 106 | } |
| 107 | else if (value.type() == typeid(double)) { |
| 108 | LOGI(" * {} => {}", key, std::any_cast<double>(value)); |
| 109 | } |
| 110 | else if (value.type() == typeid(bool)) { |
| 111 | LOGI(" * {} => {}", key, std::any_cast<bool>(value)); |
| 112 | } |
| 113 | |
| 114 | // parse |
| 115 | if (key == "author") { |
| 116 | plugin_author_ = std::any_cast<std::string>(value); |
| 117 | } |
| 118 | else if (key == "description") { |
| 119 | plugin_desc_ = std::any_cast<std::string>(value); |
nothing calls this directly
no outgoing calls
no test coverage detected