sensor_manager.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2019 Actions Semiconductor Co., Ltd
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file sensor manager interface
  8. */
  9. #ifndef __SENSOR_MANGER_H__
  10. #define __SENSOR_MANGER_H__
  11. #include <sensor_algo.h>
  12. /**
  13. * @defgroup sensor_manager_apis app Sensor Manager APIs
  14. * @ingroup system_apis
  15. * @{
  16. */
  17. enum SENSOR_MSG_ID {
  18. MSG_SENSOR_DATA,
  19. MSG_SENSOR_GET_RESULT,
  20. MSG_SENSOR_ADD_CB,
  21. MSG_SENSOR_REMOVE_CB,
  22. MSG_SENSOR_ENABLE,
  23. MSG_SENSOR_DISABLE,
  24. };
  25. typedef int (*sensor_res_cb_t)(int evt_id, sensor_res_t *res);
  26. int sensor_send_msg(uint32_t cmd, uint32_t len, void *ptr, uint8_t notify);
  27. /* callback for sensor result */
  28. int sensor_manager_add_callback(sensor_res_cb_t cb);
  29. int sensor_manager_remove_callback(sensor_res_cb_t cb);
  30. /* sensor manager enable sensor */
  31. int sensor_manager_enable(uint32_t id, uint32_t func);
  32. /* sensor manager disable sensor */
  33. int sensor_manager_disable(uint32_t id, uint32_t func);
  34. /* sensor manager get algo result funcion */
  35. int sensor_manager_get_result(sensor_res_t *res);
  36. /**
  37. * @brief sensor manager init funcion
  38. *
  39. * This routine calls init sensor manager ,called by main
  40. *
  41. * @return 0 if invoked succsess.
  42. * @return others if invoked failed.
  43. */
  44. int sensor_manager_init(void);
  45. /**
  46. * @brief sensor manager deinit funcion
  47. *
  48. * This routine calls deinit sensor manager ,called by main
  49. *
  50. * @return 0 if invoked succsess.
  51. * @return others if invoked failed.
  52. */
  53. int sensor_manager_exit(void);
  54. /**
  55. * @} end defgroup system_apis
  56. */
  57. #endif