srv_keypad.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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_KEYPAD_H_
  13. #define _SRV_KEYPAD_H_
  14. #include "osi_compiler.h"
  15. #include "drv_keypad.h"
  16. #include "drv_pwrkey_internal.h"
  17. OSI_EXTERN_C_BEGIN
  18. /**
  19. * \brief function type, override keypad event
  20. */
  21. typedef void (*kpdHook_t)(keyMap_t id, keyState_t event, void *ctx);
  22. /**
  23. * \brief listener to monitor the keypad
  24. */
  25. typedef struct srv_kpd_listener srvKpdLsn_t;
  26. /**
  27. * \brief listen a key, and notify the event with hook function
  28. *
  29. * \param id the key id
  30. * \param hook_func the process function when key event triggered
  31. * \param ctx the callse context
  32. * \return
  33. * - listener instance or NULL
  34. */
  35. srvKpdLsn_t *srvKpdListen(keyMap_t id, kpdHook_t hook_func, void *ctx);
  36. /**
  37. * \brief stop listen a key
  38. *
  39. * \param lsn the listener
  40. * \return
  41. * - true on succeed else something wrong
  42. */
  43. bool srvKpdListenBreak(srvKpdLsn_t *lsn);
  44. /**
  45. * \brief initial keypad service, the system will be crash if init fail
  46. */
  47. void srvKpdInit();
  48. OSI_EXTERN_C_END
  49. #endif