| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- #include "ui.h"
- #include <unistd.h>
- #include <stdlib.h>
- #include "menu.h"
- #include "thread.h"
- #include "cfg.h"
- #if 1
- #define LOGD log_d
- #define LOGE log_e
- #else
- #define LOGD printf
- #define LOGE printf
- #endif
- typedef struct {
- int fd;
-
- }ui_handle_t;
- static ui_handle_t uiHandle={0};
- static void msleep(int ms)
- {
- usleep(ms*1000);
- }
- static void *ui_thread(void *arg)
- {
- int r;
- thread_handle_t *th=(thread_handle_t*)arg;
- ui_handle_t *h=(ui_handle_t*)th->arg;
-
- menu_init();
- while(th->quit==0) {
- menu_handle();
- msleep(50);
- }
- menu_deinit();
-
- pthread_exit(NULL);
- }
- /////////////////////////////////////////////////////
- static void rm_qt(void)
- {
- system("killall Qt_Test; rm /root/run/app/Qt_Test");
- }
- int ui_init(void)
- {
- ui_handle_t *h=&uiHandle;
- #ifdef USE_UI
- //rm_qt();
- thread_start(THREAD_ID_UI, ui_thread, h);
- #endif
- return 0;
- }
|