srv_headset.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /* Copyright (C) 2020 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _SRV_HEADSET_H_
  13. #define _SRV_HEADSET_H_
  14. #include "osi_compiler.h"
  15. #include "drv_headset.h"
  16. OSI_EXTERN_C_BEGIN
  17. /**
  18. * \brief function type, override headset event
  19. */
  20. typedef void (*headsetHook_t)(drvHeadsetNotifyMsg_t id, uint32_t param, void *ctx);
  21. /**
  22. * \brief listener to monitor the headset action
  23. */
  24. typedef struct srv_headset_listener srvHeadsetLsn_t;
  25. /**
  26. * \brief listen a headset action, and notify the event with hook function,
  27. * \srv headset call all reg bfunc by uplayer and switch audio patch,then call
  28. * \all reg afunc by uplayer
  29. *
  30. * \param id the msg id
  31. * \param bfunc the process function when headset plug triggered,before audio path switch
  32. * \param afunc the process function when headset plug triggered,after audio path switch
  33. * \param ctx the callse context
  34. * \return
  35. * - listener instance or NULL
  36. */
  37. srvHeadsetLsn_t *srvHeadsetListen(drvHeadsetNotifyMsg_t id, headsetHook_t bfunc, headsetHook_t afunc, void *ctx);
  38. /**
  39. * \brief stop listen a headset action
  40. *
  41. * \param lsn the listener
  42. * \return
  43. * - true on succeed else something wrong
  44. */
  45. bool srvHeadsetListenBreak(srvHeadsetLsn_t *lsn);
  46. /**
  47. * \brief initial headset service, the system will be crash if init fail
  48. */
  49. void srvHeadsetInit();
  50. typedef void (*srvHeadsetNotifyCB_t)(bool connected);
  51. bool srvheadsetDetectRegister(srvHeadsetNotifyCB_t cb);
  52. void prvSetInOutPath(drvHeadsetNotifyMsg_t id, uint32_t param);
  53. OSI_EXTERN_C_END
  54. #endif