app.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef __APP_H__
  2. #define __APP_H__
  3. #pragma once
  4. #include "sp_svc.h"
  5. #include "sp_iom.h"
  6. #include "sp_mod.h"
  7. #include "sp_var.h"
  8. #include "sp_env.h"
  9. #include "sp_rpc.h"
  10. #include "sp_gui.h"
  11. #include "sp_sps.h"
  12. #include "sp_bcm.h"
  13. #include "sp_cfg.h"
  14. #include <utility>
  15. #ifndef _WIN32
  16. #include <functional>
  17. #endif //NOT _WIN32
  18. #include "SimpleString.h"
  19. #ifndef SPSHELL_TAG
  20. #include <winpr/wlog.h>
  21. #ifndef RVC_TAG
  22. #define RVC_TAG(tag) "rvc." tag
  23. #endif
  24. #define SPSHELL_TAG(tag) RVC_TAG("spshell.") tag
  25. #endif //SPSHELL_TAG
  26. /*indicate use qt to create gui*/
  27. #ifdef WITH_QT
  28. #define NO_GUI_WITH_WTL 1
  29. #else
  30. #define NO_GUI_WITH_WTL 0
  31. #endif
  32. #define EXIT_FROM_GUARDIAN 1
  33. #define EXIT_FROM_KILL 2
  34. #define EXIT_FROM_REBOOT_CMD 3
  35. #define EXIT_FROM_QT 10
  36. typedef struct app_t app_t;
  37. typedef struct log_t log_t;
  38. typedef class CSpShellConsole CSpShellConsole;
  39. struct app_t {
  40. bus_daemon_t *bus_daemon;
  41. sp_svc_t *svc;
  42. sp_iom_t *iom;
  43. sp_var_client_t* var_client;
  44. sp_var_daemon_t *var_daemon;
  45. sp_bcm_daemon_t *bcm_daemon;
  46. log_t *log;
  47. #if defined(_MSC_VER)
  48. sp_gui_t* bsc_gui;
  49. #else
  50. sp_gui_format_t* bsc_gui;
  51. #endif //_MSC_VER
  52. sp_rpc_server_t *rpc_server;
  53. sp_sps_t *sps;
  54. CSpShellConsole *pConsole;
  55. };
  56. app_t *get_app_instance();
  57. #if defined(_MSC_VER)
  58. std::pair<int, CSimpleStringA> app_init(const sp_cfg_start_args_t* args);
  59. #else
  60. int app_init(const sp_cfg_start_args_t* args, std::function<void(const char* msg, bool)> const& popup);
  61. #endif //_MSC_VER
  62. int app_term();
  63. int app_run();
  64. void app_stop(int from_id);
  65. int app_update_terminal_state(int state);
  66. void app_clear();
  67. void app_upload_last_log();
  68. #endif //__APP_H__