| 125 | } |
| 126 | |
| 127 | int string_to_brainflow_model_params (const char *json_params, struct BrainFlowModelParams *params) |
| 128 | { |
| 129 | // input string -> json -> struct BrainFlowModelParams |
| 130 | try |
| 131 | { |
| 132 | json config = json::parse (std::string (json_params)); |
| 133 | params->metric = config["metric"]; |
| 134 | params->classifier = config["classifier"]; |
| 135 | params->file = config["file"]; |
| 136 | params->output_name = config["output_name"]; |
| 137 | params->other_info = config["other_info"]; |
| 138 | params->max_array_size = config["max_array_size"]; |
| 139 | return (int)BrainFlowExitCodes::STATUS_OK; |
| 140 | } |
| 141 | catch (json::exception &e) |
| 142 | { |
| 143 | BaseClassifier::ml_logger->error ( |
| 144 | "Unable to create Brainflow model params with these arguments. Exception: {}", |
| 145 | e.what ()); |
| 146 | return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR; |
| 147 | } |
| 148 | } |
| 149 | |
| 150 | int log_message_ml_module (int log_level, char *log_message) |
| 151 | { |