ql_api_decoder.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. /**
  2. @file
  3. ql_api_qr_code.h
  4. @brief
  5. This file provides the definitions for qr code API functions.
  6. */
  7. /*=================================================================
  8. EDIT HISTORY FOR MODULE
  9. This section contains comments describing changes made to the module.
  10. Notice that changes are listed in reverse chronological order.
  11. WHEN WHO WHAT, WHERE, WHY
  12. ------------ ------- -------------------------------------------------------------------------------
  13. =================================================================*/
  14. #ifndef QL_API_DECODER_H
  15. #define QL_API_DECODER_H
  16. #include "ql_api_common.h"
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*===========================================================================
  21. * Macro Definition
  22. ===========================================================================*/
  23. #define QL_DECODER_ERRCODE_BASE (QL_COMPONENT_BSP_DECODER<<16)
  24. #define DECODER_INITIAL_FAILED 0
  25. #define DECODER_INITIAL 1
  26. #define DECODER_ERROR 0
  27. #define DECODER_SUCCESS 1
  28. #define DECODER_ERROR_NONE 1
  29. /*===========================================================================
  30. * Enum
  31. ===========================================================================*/
  32. typedef enum
  33. {
  34. QL_DECODER_SUCCESS = QL_SUCCESS,
  35. QL_DECODER_INIT_ERR = 1|QL_COMPONENT_BSP_DECODER,
  36. QL_DECODER_REPEAT_INIT_ERR,
  37. QL_DECODER_COPYRIGHT_ERR,
  38. QL_DECODER_SETMIRROR_ERR,
  39. QL_DECODER_ERR = 5|QL_COMPONENT_BSP_DECODER,
  40. QL_DECODER_MEM_ERR,
  41. QL_DECODER_PREVIEW_ERR,
  42. QL_DECODER_GET_RESULT_ERR,
  43. QL_DECODER_GET_RESULT_LENGTH_ERR,
  44. QL_DECODER_DESTROY_ERR = 10|QL_COMPONENT_BSP_DECODER,
  45. }ql_errcode_decoder_e;
  46. typedef enum
  47. {
  48. QL_DECODER_TYPE_CODE39 = 0,
  49. QL_DECODER_TYPE_CODE128,
  50. QL_DECODER_TYPE_QR_CODE,
  51. QL_DECODER_TYPE_NONE = 0xff,
  52. }ql_decoder_type_e;
  53. typedef enum
  54. {
  55. QL_DECODE_NORMAL_MODE = 0, //正常码解析
  56. QL_DECODE_MIRROR_MODE, //镜像码解析
  57. QL_DECODE_AUTO_MODE, //正常解析,镜像解析都可以
  58. QL_DECODE_MODE_MAX,
  59. }QL_DECODE_MODE_E;
  60. /*===========================================================================
  61. * Variate
  62. ===========================================================================*/
  63. /*===========================================================================
  64. * Functions
  65. ===========================================================================*/
  66. /*****************************************************************
  67. * Function: ql_qr_decoder_init
  68. *
  69. * Description: Initialize the decoder
  70. *
  71. * Parameters:
  72. *
  73. * Return:
  74. * ql_errcode_decoder_e
  75. *
  76. *****************************************************************/
  77. ql_errcode_decoder_e ql_qr_decoder_init (void);
  78. /*****************************************************************
  79. * Function: ql_qr_get_decoder_result
  80. *
  81. * Description: get the decode result
  82. *
  83. * Parameters:
  84. * *type [out] the type of the code
  85. * *result [out] the result of the code
  86. * Return:
  87. * ql_errcode_decoder_e
  88. *
  89. *****************************************************************/
  90. ql_errcode_decoder_e ql_qr_get_decoder_result(ql_decoder_type_e* type, unsigned char * result);
  91. /*****************************************************************
  92. * Function: ql_qr_image_decoder
  93. *
  94. * Description: decode the image
  95. *
  96. * Parameters:
  97. * *img_buffer [in] the image need to be decoded
  98. * whidth [in] the width of the image
  99. * height [in] the height of the image
  100. * Return:
  101. * ql_errcode_decoder_e
  102. *
  103. *****************************************************************/
  104. ql_errcode_decoder_e ql_qr_image_decoder (uint16_t *img_buffer, uint32_t width, uint32_t height);
  105. /*****************************************************************
  106. * Function: ql_destroy_decoder
  107. *
  108. * Description: destroy the deocder
  109. *
  110. * Parameters:
  111. *
  112. * Return:
  113. * ql_errcode_decoder_e
  114. *
  115. *****************************************************************/
  116. ql_errcode_decoder_e ql_destroy_decoder(void);
  117. /*****************************************************************
  118. * Function: ql_get_decoder_version
  119. *
  120. * Description: get version of the deocder
  121. *
  122. * Parameters:
  123. * *version [out] the data of the version
  124. *
  125. * Return:
  126. * ql_errcode_decoder_e
  127. *
  128. *****************************************************************/
  129. ql_errcode_decoder_e ql_get_decoder_version(unsigned char* version);
  130. /*****************************************************************
  131. * Function: ql_set_decode_mirror
  132. *
  133. * Description: set decode mode
  134. *
  135. * Parameters:
  136. * decode_mode: QL_DECODE_NORMAL_MODE QL_DECODE_MIRROR_MODE AUTO
  137. *
  138. * Return:
  139. * ql_errcode_decoder_e
  140. *
  141. *****************************************************************/
  142. ql_errcode_decoder_e ql_set_decode_mirror(QL_DECODE_MODE_E decode_mode);
  143. #ifdef __cplusplus
  144. } /*"C" */
  145. #endif
  146. #endif /* QL_API_DECODER_H*/