sys_event.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file system event interface
  8. */
  9. #ifndef _SYS_EVENT_H_
  10. #define _SYS_EVENT_H_
  11. #include <os_common_api.h>
  12. #include <sys_event_type.h>
  13. /**
  14. * @defgroup sys_event_apis App system event Manager APIs
  15. * @ingroup system_apis
  16. * @{
  17. */
  18. /** sys event ui map structure */
  19. struct sys_event_ui_map {
  20. /** sys event id */
  21. uint8_t sys_event;
  22. /** ui event id */
  23. uint8_t ui_event;
  24. /** ui event type */
  25. uint8_t stable_event;
  26. };
  27. /**
  28. * @brief send system message
  29. *
  30. * @details send system message to system app, if tws
  31. * master mode send system message to slave too.
  32. *
  33. * @param message message id want to send
  34. *
  35. * @return N/A
  36. */
  37. void sys_event_send_message_new(uint32_t message, uint8_t cmd, void* extra_data, int extra_data_size);
  38. #define sys_event_send_message(message) sys_event_send_message_new(message, 0, NULL, 0)
  39. /**
  40. * @brief report inut event
  41. *
  42. * @details report system event to system app.
  43. *
  44. * @param key_event input event
  45. *
  46. * @return N/A
  47. */
  48. void sys_event_report_input(uint32_t key_event);
  49. /**
  50. * @brief system event notify
  51. *
  52. * @details send system event to system app, if tws
  53. * master mode send system event to slave too.
  54. *
  55. * @param event event id want to send
  56. *
  57. * @return N/A
  58. */
  59. void sys_event_notify(uint32_t event);
  60. /**
  61. * @brief process system event
  62. *
  63. * @details this routine Find UI event through sys event ID according to
  64. * sys event UI map table and send UI event .
  65. *
  66. * @param event system event id
  67. *
  68. * @return N/A
  69. */
  70. void sys_event_process(uint32_t event);
  71. /**
  72. * @brief register a system event map
  73. *
  74. * @details register system event map, user can define system event an ui event map
  75. * when device sent system event ,may auto trigge ui event which mapped by event map
  76. *
  77. * @param event_map user define event map table
  78. * @param size event map table size
  79. * @param sys_view_id system view id
  80. *
  81. * @return N/A
  82. */
  83. void sys_event_map_register(const struct sys_event_ui_map *event_map, int size, int sys_view_id);
  84. /**
  85. * @} end defgroup sys_event_apis
  86. */
  87. #endif