| 1345 | } |
| 1346 | |
| 1347 | static struct command_result *json_askrene_bias_node(struct command *cmd, |
| 1348 | const char *buffer, |
| 1349 | const jsmntok_t *params) |
| 1350 | { |
| 1351 | struct layer *layer; |
| 1352 | struct node_id *node; |
| 1353 | struct json_stream *response; |
| 1354 | const char *description; |
| 1355 | s8 *bias; |
| 1356 | const struct node_bias *b; |
| 1357 | bool *relative; |
| 1358 | bool *out_dir; |
| 1359 | u64 timestamp; |
| 1360 | |
| 1361 | if (!param(cmd, buffer, params, |
| 1362 | p_req("layer", param_known_layer, &layer), |
| 1363 | p_req("node", param_node_id, &node), |
| 1364 | p_req("direction", param_direction, &out_dir), |
| 1365 | p_req("bias", param_s8_hundred, &bias), |
| 1366 | p_opt("description", param_string, &description), |
| 1367 | p_opt_def("relative", param_bool, &relative, false), |
| 1368 | NULL)) |
| 1369 | return command_param_failed(); |
| 1370 | plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__, |
| 1371 | json_tok_full_len(params), json_tok_full(buffer, params)); |
| 1372 | |
| 1373 | timestamp = clock_time().ts.tv_sec; |
| 1374 | b = layer_set_node_bias(layer, node, description, *bias, *relative, |
| 1375 | *out_dir, timestamp); |
| 1376 | response = jsonrpc_stream_success(cmd); |
| 1377 | json_array_start(response, "node_biases"); |
| 1378 | if (b) |
| 1379 | json_add_node_bias(response, NULL, b, layer); |
| 1380 | json_array_end(response); |
| 1381 | return command_finished(cmd, response); |
| 1382 | } |
| 1383 | |
| 1384 | static struct command_result *json_askrene_disable_node(struct command *cmd, |
| 1385 | const char *buffer, |
nothing calls this directly
no test coverage detected