aboutsummaryrefslogtreecommitdiffstats
path: root/android/console.c
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2011-01-20 18:02:35 -0800
committerVladimir Chtchetkine <vchtchetkine@google.com>2011-01-25 13:37:49 -0800
commit6b985d708d64008eee69fe0c3f03c6e3c61e7f73 (patch)
tree640fa2d7595e61216b042e82b4fe07c59e1742a5 /android/console.c
parentb2d3df36e6e0d22c00fcddb51f9b0f4f754bfda4 (diff)
downloadexternal_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.zip
external_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.tar.gz
external_qemu-6b985d708d64008eee69fe0c3f03c6e3c61e7f73.tar.bz2
Implement UI control service and client
Change-Id: Iecc1b5bb9ddcdaf9f22c500a5195718db3f25354
Diffstat (limited to 'android/console.c')
-rw-r--r--android/console.c98
1 files changed, 96 insertions, 2 deletions
diff --git a/android/console.c b/android/console.c
index 4c3548a..9382e8d 100644
--- a/android/console.c
+++ b/android/console.c
@@ -54,6 +54,7 @@
#include "android/display-core.h"
#include "android/framebuffer-core.h"
#include "android/user-events-core.h"
+#include "android/ui-ctl-core.h"
#if defined(CONFIG_SLIRP)
#include "libslirp.h"
@@ -126,6 +127,18 @@ ControlClient user_events_client = NULL;
/* User events service. */
CoreUserEvents* core_ue = NULL;
+
+/* UI control service client (UI -> Core). */
+ControlClient ui_core_ctl_client = NULL;
+
+/* UI control service (UI -> Core. */
+// CoreUICtl* ui_core_ctl = NULL;
+
+/* UI control service client (Core-> UI). */
+ControlClient core_ui_ctl_client = NULL;
+
+/* UI control service (Core -> UI. */
+// CoreUICtl* core_ui_ctl = NULL;
#endif // CONFIG_STANDALONE_CORE
/* -android-avdname option value. Defined in vl-android.c */
@@ -248,6 +261,16 @@ control_client_destroy( ControlClient client )
coreue_destroy(core_ue);
user_events_client = NULL;
}
+
+ if (client == ui_core_ctl_client) {
+ uicorectl_destroy();
+ ui_core_ctl_client = NULL;
+ }
+
+ if (client == core_ui_ctl_client) {
+ coreuictl_destroy();
+ core_ui_ctl_client = NULL;
+ }
#endif // CONFIG_STANDALONE_CORE
sock = control_client_detach( client );
@@ -2561,7 +2584,7 @@ destroy_control_fb_client(void)
static int
do_create_user_events_service( ControlClient client, char* args )
{
- // Make sure that there are no framebuffer client already existing.
+ // Make sure that there are no user events client already existing.
if (user_events_client != NULL) {
control_write( client, "KO: Another user events service is already existing!\r\n" );
control_client_destroy(client);
@@ -2572,7 +2595,6 @@ do_create_user_events_service( ControlClient client, char* args )
if (core_ue != NULL) {
char reply_buf[4096];
user_events_client = client;
- // Reply "OK" with the framebuffer's bits per pixel
snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
control_write( client, reply_buf);
} else {
@@ -2591,6 +2613,70 @@ destroy_control_ue_client(void)
control_client_destroy(user_events_client);
}
}
+
+static int
+do_create_ui_core_ctl_service( ControlClient client, char* args )
+{
+ // Make sure that there are no ui control client already existing.
+ if (ui_core_ctl_client != NULL) {
+ control_write( client, "KO: Another UI control service is already existing!\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ if (!uicorectl_create(client->sock)) {
+ char reply_buf[4096];
+ ui_core_ctl_client = client;
+ snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
+ control_write( client, reply_buf);
+ } else {
+ control_write( client, "KO\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ return 0;
+}
+
+void
+destroy_ui_core_ctl_client(void)
+{
+ if (ui_core_ctl_client != NULL) {
+ control_client_destroy(ui_core_ctl_client);
+ }
+}
+
+static int
+do_create_core_ui_ctl_service( ControlClient client, char* args )
+{
+ // Make sure that there are no ui control client already existing.
+ if (core_ui_ctl_client != NULL) {
+ control_write( client, "KO: Another UI control service is already existing!\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ if (!coreuictl_create(client->sock)) {
+ char reply_buf[4096];
+ core_ui_ctl_client = client;
+ snprintf(reply_buf, sizeof(reply_buf), "OK\r\n");
+ control_write( client, reply_buf);
+ } else {
+ control_write( client, "KO\r\n" );
+ control_client_destroy(client);
+ return -1;
+ }
+
+ return 0;
+}
+
+void
+destroy_core_ui_ctl_client(void)
+{
+ if (core_ui_ctl_client != NULL) {
+ control_client_destroy(core_ui_ctl_client);
+ }
+}
#endif // CONFIG_STANDALONE_CORE
static const CommandDefRec qemu_commands[] =
@@ -2611,6 +2697,14 @@ static const CommandDefRec qemu_commands[] =
{ "user events", "create user events service",
"Create user events service\r\n",
NULL, do_create_user_events_service, NULL },
+
+ { "ui-core control", "create UI control service",
+ "Create UI control service\r\n",
+ NULL, do_create_ui_core_ctl_service, NULL },
+
+ { "core-ui control", "create UI control service",
+ "Create UI control service\r\n",
+ NULL, do_create_core_ui_ctl_service, NULL },
#endif // CONFIG_STANDALONE_CORE
{ NULL, NULL, NULL, NULL, NULL, NULL }