Add unpair command

This commit is contained in:
Iwan Timmer 2016-04-01 18:57:35 +02:00
parent 3c4cc4af69
commit 9b98371afc
3 changed files with 13 additions and 1 deletions

View File

@ -19,6 +19,10 @@ Create a mapping file for a gamepad.
Pair this computer with the host.
=item B<unpair>
Unpair this computer with the host.
=item B<stream>
Stream game from host to this computer.

View File

@ -1,7 +1,7 @@
/*
* This file is part of Moonlight Embedded.
*
* Copyright (C) 2015 Iwan Timmer
* Copyright (C) 2015, 2016 Iwan Timmer
*
* Moonlight is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -38,5 +38,6 @@ typedef struct _SERVER_DATA {
int gs_init(PSERVER_DATA server, const char *keyDirectory);
int gs_start_app(PSERVER_DATA server, PSTREAM_CONFIGURATION config, int appId, bool sops, bool localaudio);
int gs_applist(PSERVER_DATA server, PAPP_LIST *app_list);
int gs_unpair(PSERVER_DATA server);
int gs_pair(PSERVER_DATA server, char* pin);
int gs_quit_app(PSERVER_DATA server);

View File

@ -121,6 +121,7 @@ static void help() {
printf("\n Actions\n\n");
printf("\tmap\t\t\tCreate mapping file for gamepad\n");
printf("\tpair\t\t\tPair device with computer\n");
printf("\tunpair\t\t\tUnpair device with computer\n");
printf("\tstream\t\t\tStream computer to device\n");
printf("\tlist\t\t\tList available games and applications\n");
printf("\tquit\t\t\tQuit the application or game being streamed\n");
@ -264,6 +265,12 @@ int main(int argc, char* argv[]) {
} else {
printf("Succesfully paired\n");
}
} else if (strcmp("unpair", config.action) == 0) {
if (gs_unpair(&server) != GS_OK) {
fprintf(stderr, "Failed to unpair to server: %s\n", gs_error);
} else {
printf("Succesfully unpaired\n");
}
} else if (strcmp("quit", config.action) == 0) {
pair_check(&server);
gs_quit_app(&server);