srv_sim_detect.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /* Copyright (C) 2019 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_SIM_DETECT_H_
  13. #define _SRV_SIM_DETECT_H_
  14. #include "osi_compiler.h"
  15. #include "quec_proj_config.h"
  16. #ifdef CONFIG_QUEC_PROJECT_FEATURE_GPIO
  17. #include "drv_gpio.h"
  18. #endif
  19. OSI_EXTERN_C_BEGIN
  20. #include <stdbool.h>
  21. /**
  22. * @brief function type to report sim plug in/out
  23. */
  24. typedef void (*simDetectCB_t)(int id, bool connect);
  25. /**
  26. * @brief sim detect register callback
  27. *
  28. * @param id sim id (must be 1/2)
  29. * @param gpio_id gpio to detect sim hot plug
  30. * @param cb callback after sim plug in/out detect
  31. * @return
  32. * - true success
  33. * - false fail
  34. */
  35. bool srvSimDetectRegister(int id, int gpio_id, simDetectCB_t cb);
  36. /**
  37. * @brief enable/disable sim detect
  38. *
  39. * @param id sim id (must be 1/2)
  40. * @param int_status enable or disable
  41. * @return
  42. * - true on success else fail
  43. */
  44. bool srvSimDetectSwitch(int id, bool int_status);
  45. #ifdef CONFIG_QUEC_PROJECT_FEATURE_GPIO
  46. typedef struct
  47. {
  48. int sim_id;
  49. simDetectCB_t cb;
  50. bool connected;
  51. bool connect_debounce;
  52. osiTimer_t *debounce_timer;
  53. drvGpio_t *gpio;
  54. } simDetect_t;
  55. #endif
  56. OSI_EXTERN_C_END
  57. #endif