esd_manager.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. * Copyright (c) 2018 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file esd manager interface
  8. */
  9. #ifndef __EDS_MANGER_H__
  10. #define __EDS_MANGER_H__
  11. /**
  12. * @defgroup esd_manager_apis esd manager APIs
  13. * @ingroup system_apis
  14. * @{
  15. */
  16. /** esd device link state */
  17. typedef enum
  18. {
  19. /** esd device link single state */
  20. DEVICE_STATE_SINGLE_LINK = 1,
  21. /** esd device link double state */
  22. DEVICE_STATE_DOUBLE_LINK = 2,
  23. /** esd device link tws state */
  24. DEVICE_STATE_TWS = 4,
  25. }esd_device_state_e;
  26. /** esd tag info */
  27. typedef enum
  28. {
  29. /** tag of app */
  30. TAG_APP_ID,
  31. /** tag of play state */
  32. TAG_PLAY_STATE,
  33. /** tag of device state */
  34. TAG_DEVICE_STATE,
  35. /** tag of music bp info */
  36. TAG_BP_INFO,
  37. /** tag of volume info */
  38. TAG_VOLUME,
  39. }esd_tag_info_e;
  40. /**
  41. *
  42. * @brief init esd manager
  43. *
  44. * @details init the esd manager memory and manager struct stat
  45. *
  46. * @return N/A
  47. */
  48. void esd_manager_init(void);
  49. /**
  50. *
  51. * @brief check esd manager state
  52. *
  53. * @details check esd manager state, reset by esd or not reset by esd
  54. *
  55. * @return true current reset because of esd
  56. * @return false current reset not because of esd
  57. */
  58. bool esd_manager_check_esd(void);
  59. /**
  60. *
  61. * @brief reset esd manager
  62. *
  63. * @details reset esd manager state to init state,
  64. * state saved before will be clear by this function
  65. *
  66. * @return N/A
  67. */
  68. void esd_manager_reset_finished(void);
  69. /**
  70. *
  71. * @brief save current scene to esd mananger
  72. * @param tag tag of esd tag info
  73. * @param value valu of tag witch need to save
  74. * @param len max length of value.
  75. *
  76. * @return 0 success.
  77. * @return others failed.
  78. */
  79. int esd_manager_save_scene(int tag, uint8_t *value , int len);
  80. /**
  81. *
  82. * @brief restore current scene from esd mananger
  83. * @param tag tag of esd tag info
  84. * @param value valu of tag find from esd manager
  85. * @param len max length of value.
  86. *
  87. * @return 0 success.
  88. * @return others failed.
  89. */
  90. int esd_manager_restore_scene(int tag, uint8_t *value , int len);
  91. /**
  92. *
  93. * @brief deinit esd manager
  94. *
  95. * @details clear esd manager state and release manager memory
  96. *
  97. * @return N/A
  98. */
  99. void esd_manager_deinit(void);
  100. /**
  101. * @} end defgroup esd_manager_apis
  102. */
  103. #endif