ql_gprs_data_transfer.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /**
  2. @file
  3. ql_gprs_data_transfer.h
  4. @brief
  5. This file provides the definitions for data transfer interface, and declares the
  6. API functions.
  7. */
  8. /*============================================================================
  9. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  10. Quectel Wireless Solution Proprietary and Confidential.
  11. =============================================================================*/
  12. /*===========================================================================
  13. EDIT HISTORY FOR MODULE
  14. This section contains comments describing changes made to the module.
  15. Notice that changes are listed in reverse chronological order.
  16. WHEN WHO WHAT, WHERE, WHY
  17. ---------- ------------ ----------------------------------------------------
  18. 2021/08/27 larson.li init
  19. =============================================================================*/
  20. #ifndef __QL_DATA_TRANSFER_H__
  21. #define __QL_DATA_TRANSFER_H__
  22. #include "ql_api_common.h"
  23. #define QL_GPRS_DATA_ERRCODE_BASE (QL_COMPONNET_LWIP_GPRS_DATA_TRANSFER<<16)
  24. typedef enum
  25. {
  26. QL_GPRS_DATA_SUCCESS = 0,
  27. QL_GPRS_DATA_PARAM_ERROR = 1 | QL_GPRS_DATA_ERRCODE_BASE,
  28. QL_GPRS_DATA_SIZE_LARGE_ERROR, //if \p size is too large for one packet
  29. QL_GPRS_DATA_UPLINK_UNAVAILABLE_ERROR, //is uplink buffer is unavailable
  30. QL_GPRS_DATA_SIM_CID_ERROR, //sim_cid param error
  31. QL_GPRS_DATA_GET_NETIF_ERROR, //sim/cid is not active
  32. QL_GRPS_DATA_OUTPUT_DATA_SIZE_ERROR, //data transfer output data size error,data_len size 1-1600
  33. }ql_gprs_data_errcode_e;
  34. /*****************************************************************
  35. * Function: ql_data_transfer_input_cb
  36. *
  37. * Description:
  38. * gprs数据接收函数指针类型,
  39. *
  40. * Parameters:
  41. * payload [in] 对应pdp激活的GPRS数据会送入此函数,数据内容为void*类型,
  42. * 此函数对应lwip tcpip_input函数接口截取数据
  43. * tot_len [in] 对应payload数据总长度
  44. *
  45. * Return:
  46. *
  47. *****************************************************************/
  48. typedef void (*ql_gprs_data_transfer_input_cb)(void *payload, unsigned short tot_len);
  49. /*****************************************************************
  50. * Function: ql_gprs_data_transfer_output
  51. *
  52. * Description:
  53. * gprs数据发送接口
  54. *
  55. * Parameters:
  56. * data [in] 无符号类型字符数据
  57. * data_len [in] 数据长度,范围1-1600
  58. *
  59. * Return:
  60. * 如果成功,该函数需要返回已送入PS域的数据长度
  61. * 如果失败,返回ql_gprs_data_errcode_e错误码
  62. *
  63. *****************************************************************/
  64. int ql_gprs_data_transfer_output(unsigned char *data,int data_len);
  65. /*****************************************************************
  66. * Function: ql_gprs_data_transfer_input_cb_reg
  67. *
  68. * Description:
  69. * gprs数据接收函数注册
  70. *
  71. * Parameters:
  72. * ql_data_transfer_input_cb [in] 数据输出回调函数注册,类型:函数指针
  73. *
  74. * Return:
  75. * TRUE 执行成功
  76. * FALSE 执行失败
  77. *
  78. *****************************************************************/
  79. ql_gprs_data_errcode_e ql_gprs_data_transfer_input_cb_reg(ql_gprs_data_transfer_input_cb cb);
  80. /*****************************************************************
  81. * Function: ql_gprs_data_transfer_start
  82. *
  83. * Description:
  84. * GPRS 对应的PDP激活之后,才能执行此函数,否则会数据收发会执行失败
  85. *
  86. * Parameters:
  87. * sim [in] SIM卡,范围:0-1
  88. * cid [in] pdp cid,范围:1-7
  89. * Return:
  90. * TRUE 执行成功
  91. * FALSE 执行失败
  92. *
  93. *****************************************************************/
  94. ql_gprs_data_errcode_e ql_gprs_data_transfer_start(unsigned char sim,unsigned char cid );
  95. /*****************************************************************
  96. * Function: ql_gprs_data_transfer_input_cb_reg
  97. *
  98. * Description:
  99. * 停止GPRS数据透传,恢复数据送入lwip tcp/ip协议栈中进行处理
  100. *
  101. * Parameters:
  102. * sim [in] SIM卡,范围:0-1
  103. * cid [in] pdp cid,范围:1-7
  104. * Return:
  105. * TRUE 执行成功
  106. * FALSE 执行失败
  107. *
  108. *****************************************************************/
  109. void ql_gprs_data_transfer_stop(void);
  110. #endif /* __QL_DATA_TRANSFER_H__ */