| 1281 | } |
| 1282 | |
| 1283 | static struct command_result *json_askrene_bias_node(struct command *cmd, |
| 1284 | const char *buffer, |
| 1285 | const jsmntok_t *params) |
| 1286 | { |
| 1287 | struct layer *layer; |
| 1288 | struct node_id *node; |
| 1289 | struct json_stream *response; |
| 1290 | const char *description; |
| 1291 | s8 *bias; |
| 1292 | const struct node_bias *b; |
| 1293 | bool *relative; |
| 1294 | bool *out_dir; |
| 1295 | u64 timestamp; |
| 1296 | |
| 1297 | if (!param(cmd, buffer, params, |
| 1298 | p_req("layer", param_known_layer, &layer), |
| 1299 | p_req("node", param_node_id, &node), |
| 1300 | p_req("direction", param_direction, &out_dir), |
| 1301 | p_req("bias", param_s8_hundred, &bias), |
| 1302 | p_opt("description", param_string, &description), |
| 1303 | p_opt_def("relative", param_bool, &relative, false), |
| 1304 | NULL)) |
| 1305 | return command_param_failed(); |
| 1306 | plugin_log(cmd->plugin, LOG_TRACE, "%s called: %.*s", __func__, |
| 1307 | json_tok_full_len(params), json_tok_full(buffer, params)); |
| 1308 | |
| 1309 | timestamp = clock_time().ts.tv_sec; |
| 1310 | b = layer_set_node_bias(layer, node, description, *bias, *relative, |
| 1311 | *out_dir, timestamp); |
| 1312 | response = jsonrpc_stream_success(cmd); |
| 1313 | json_array_start(response, "node_biases"); |
| 1314 | if (b) |
| 1315 | json_add_node_bias(response, NULL, b, layer); |
| 1316 | json_array_end(response); |
| 1317 | return command_finished(cmd, response); |
| 1318 | } |
| 1319 | |
| 1320 | static struct command_result *json_askrene_disable_node(struct command *cmd, |
| 1321 | const char *buffer, |
nothing calls this directly
no test coverage detected