Add wayvncctl version command
Signed-off-by: Jim Ramsay <i.am@jimramsay.com>pull/178/head
parent
73fd2e386f
commit
15735b3256
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
enum cmd_type {
|
enum cmd_type {
|
||||||
CMD_HELP,
|
CMD_HELP,
|
||||||
|
CMD_VERSION,
|
||||||
CMD_SET_OUTPUT,
|
CMD_SET_OUTPUT,
|
||||||
CMD_UNKNOWN,
|
CMD_UNKNOWN,
|
||||||
};
|
};
|
||||||
|
@ -60,6 +61,10 @@ static struct cmd_info cmd_list[] = {
|
||||||
{NULL, NULL},
|
{NULL, NULL},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
[CMD_VERSION] = { "version",
|
||||||
|
"Query the version of the wayvnc process",
|
||||||
|
{{NULL, NULL}}
|
||||||
|
},
|
||||||
[CMD_SET_OUTPUT] = { "set-output",
|
[CMD_SET_OUTPUT] = { "set-output",
|
||||||
"Switch the actively captured output",
|
"Switch the actively captured output",
|
||||||
{
|
{
|
||||||
|
@ -211,6 +216,10 @@ static struct cmd* parse_command(struct jsonipc_request* ipc,
|
||||||
case CMD_SET_OUTPUT:
|
case CMD_SET_OUTPUT:
|
||||||
cmd = (struct cmd*)cmd_set_output_new(ipc->params, err);
|
cmd = (struct cmd*)cmd_set_output_new(ipc->params, err);
|
||||||
break;
|
break;
|
||||||
|
case CMD_VERSION:
|
||||||
|
cmd = calloc(1, sizeof(*cmd));
|
||||||
|
cmd->type = cmd_type;
|
||||||
|
break;
|
||||||
case CMD_UNKNOWN:
|
case CMD_UNKNOWN:
|
||||||
jsonipc_error_set_new(err, ENOENT,
|
jsonipc_error_set_new(err, ENOENT,
|
||||||
json_pack("{s:o, s:o}",
|
json_pack("{s:o, s:o}",
|
||||||
|
@ -320,7 +329,17 @@ static struct cmd_response* generate_help_object(const char* cmd)
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd_response* ctl_server_dispatch_cmd(struct ctl* self, struct cmd* cmd)
|
static struct cmd_response* generate_version_object()
|
||||||
|
{
|
||||||
|
struct cmd_response* response = cmd_ok();
|
||||||
|
response->data = json_pack("{s:s, s:s, s:s}",
|
||||||
|
"wayvnc", wayvnc_version,
|
||||||
|
"neatvnc", nvnc_version,
|
||||||
|
"aml", aml_version);
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct cmd_response* ctl_server_dispatch_cmd(struct ctl* self, struct cmd* cmd)
|
||||||
{
|
{
|
||||||
assert(cmd->type != CMD_UNKNOWN);
|
assert(cmd->type != CMD_UNKNOWN);
|
||||||
const struct cmd_info* info = &cmd_list[cmd->type];
|
const struct cmd_info* info = &cmd_list[cmd->type];
|
||||||
|
@ -340,6 +359,9 @@ static struct cmd_response* ctl_server_dispatch_cmd(struct ctl* self, struct cmd
|
||||||
response = self->actions.on_output_cycle(self, c->cycle);
|
response = self->actions.on_output_cycle(self, c->cycle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case CMD_VERSION:
|
||||||
|
response = generate_version_object();
|
||||||
|
break;
|
||||||
case CMD_UNKNOWN:
|
case CMD_UNKNOWN:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue