diff options
Diffstat (limited to 'nuttx/examples/nx/nx_main.c')
-rw-r--r-- | nuttx/examples/nx/nx_main.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/nuttx/examples/nx/nx_main.c b/nuttx/examples/nx/nx_main.c index 7e68b47bd..ed7b7a3bb 100644 --- a/nuttx/examples/nx/nx_main.c +++ b/nuttx/examples/nx/nx_main.c @@ -43,6 +43,7 @@ #include <stdio.h> #include <stdlib.h> #include <unistd.h> +#include <string.h> #include <sched.h> #include <pthread.h> #include <errno.h> @@ -72,6 +73,12 @@ static int g_exitcode = NXEXIT_SUCCESS; +#ifdef CONFIG_NX_KBD +static const ubyte g_kbdmsg1[] = "NuttX is cool!"; +static const ubyte g_kbdmsg2[] = "NuttX is fun!"; +#endif + + /**************************************************************************** * Public Data ****************************************************************************/ @@ -660,6 +667,23 @@ int user_start(int argc, char *argv[]) sleep(1); #endif + /* Give keyboard input to the top window -- should be window #2 */ + +#ifdef CONFIG_NX_KBD + message("user_start: Send keyboard input: %s\n", g_kbdmsg1); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg1), g_kbdmsg1); + if (ret < 0) + { + message("user_start: nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message("user_start: Sleeping\n\n"); + sleep(1); +#endif + /* Lower window 2 */ message("user_start: Lower window #2\n"); @@ -685,6 +709,23 @@ int user_start(int argc, char *argv[]) sleep(1); #endif + /* Give keyboard input to the top window -- should be window #1 */ + +#ifdef CONFIG_NX_KBD + message("user_start: Send keyboard input: %s\n", g_kbdmsg2); + ret = nx_kbdin(g_hnx, strlen((FAR const char *)g_kbdmsg2), g_kbdmsg2); + if (ret < 0) + { + message("user_start: nx_kbdin failed: %d\n", errno); + goto errout_with_hwnd2; + } + + /* Sleep a bit */ + + message("user_start: Sleeping\n\n"); + sleep(1); +#endif + /* Raise window 2 */ message("user_start: Raise window #2\n"); |