app.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. #define NO_GUI_WITH_WTL 0
  27. #define EXIT_FROM_GUARDIAN 1
  28. #define EXIT_FROM_KILL 2
  29. #define EXIT_FROM_REBOOT_CMD 3
  30. typedef struct app_t app_t;
  31. typedef struct log_t log_t;
  32. typedef class CSpShellConsole CSpShellConsole;
  33. struct app_t {
  34. bus_daemon_t *bus_daemon;
  35. sp_svc_t *svc;
  36. sp_iom_t *iom;
  37. sp_var_client_t* var_client;
  38. sp_var_daemon_t *var_daemon;
  39. sp_bcm_daemon_t *bcm_daemon;
  40. log_t *log;
  41. #if defined(_MSC_VER)
  42. sp_gui_t* bsc_gui;
  43. #else
  44. sp_gui_format_t* bsc_gui;
  45. #endif //_MSC_VER
  46. sp_rpc_server_t *rpc_server;
  47. sp_sps_t *sps;
  48. CSpShellConsole *pConsole;
  49. };
  50. app_t *get_app_instance();
  51. #if defined(_MSC_VER)
  52. std::pair<int, CSimpleStringA> app_init(const sp_cfg_start_args_t* args);
  53. #else
  54. int app_init(const sp_cfg_start_args_t* args, std::function<void(const char* msg, bool)> const& popup);
  55. #endif //_MSC_VER
  56. int app_term();
  57. int app_run();
  58. void app_stop(int from_id);
  59. /** 暂时不适用,由实体去控制,否则会出现因配置SYSEVENT未拉下来导致值不统一的问题 [Gifur@2025314]*/
  60. int app_update_terminal_state(int state);
  61. void app_clear();
  62. void app_upload_last_log();
  63. #endif //__APP_H__