quec_aliot_smartcard.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /** @file
  2. quec_aliot_smartcard.h
  3. @brief
  4. This file is used to define at command for different Quectel Project.
  5. */
  6. /*================================================================
  7. Copyright (c) 2020 Quectel Wireless Solution, Co., Ltd. All Rights Reserved.
  8. Quectel Wireless Solution Proprietary and Confidential.
  9. =================================================================*/
  10. /*=================================================================
  11. EDIT HISTORY FOR MODULE
  12. This section contains comments describing changes made to the module.
  13. Notice that changes are listed in reverse chronological order.
  14. WHEN WHO WHAT, WHERE, WHY
  15. ------------ ------- -------------------------------------------------------------------------------
  16. =================================================================*/
  17. #ifndef QUEC_ALIIOT_SMARTCARD__H
  18. #define QUEC_ALIIOT_SMARTCARD__H
  19. #include "at_engine.h"
  20. #define QUEC_SMARTCARD_EVN_VALUE_MAX 5
  21. #define QUEC_SMARTCARD_URC_BUF_MAX_LEN 128
  22. #define QUEC_SMARTCARD_RESULT_OK 0
  23. #define QUEC_SMARTCARD_RESULT_FAIL -1
  24. #define QUEC_SMARTCARD_INIT_FAIL -2
  25. #define QUEC_SMARTCARD_PARAM_ERR -3
  26. #define QUEC_SMARTCARD_UNKNOW_SIM -4
  27. #define QUEC_SMARTCARD_UNCHANGE_ICCID -5
  28. #define QUEC_SMARTCARD_EXEC_TIMEOUT -6
  29. #define QUEC_SMARTCARD_UNRECOGNIZED -7
  30. #define QUEC_SMARTCARD_PARSE_DATA_ERR -9
  31. #define QUEC_SMARTCARD_DIAL_FAIL -10
  32. #define QUEC_SMARTCARD_REGISTER_FAIL -11
  33. #define QUEC_SMARTCARD_SDK_UNENABLE -12
  34. #define QUEC_SMARTCARD_SCAN_FAIL -13
  35. #define QUEC_SMARTCARD_SWITCH_RUN -14
  36. #define QUEC_SMARTCARD_OPERATOR_DISABLE -15
  37. #define QUEC_SMARTCARD_PARSE_FILE_ERR -16
  38. #define QUEC_SMARTCARD_SCAN_UNENABLE -17
  39. #define QUEC_SMARTCARD_SWITCH_UNENABLE -18
  40. #define QUEC_SMARTCARD_MANUAL_UNENABLE -19
  41. #define QUEC_FREE_PTR(p) {if((p) != NULL) {free(p);(p) = NULL;}}
  42. typedef enum{
  43. QUEC_SMARTCARD_SDK_IDLE = 0,
  44. QUEC_SMARTCARD_SDK_RUN,
  45. QUEC_SMARTCARD_SDK_SHUT,
  46. }quec_smartcard_sdk_state;
  47. typedef enum{
  48. QUEC_ALIPAY_APP_OPT_IDLE_STAT = 0,
  49. QUEC_ALIPAY_APP_OPT_RUN_STAT,
  50. QUEC_ALIPAY_APP_OPT_RUN_INIT_FAIL,
  51. }quec_smartcard_opt_state;
  52. typedef enum{
  53. QUEC_SMARTCARD_INIT = 1,
  54. QUEC_SMARTCARD_SETENABLE = 2,
  55. QUEC_SMARTCARD_GETENABLE=3,
  56. QUEC_SMARTCARD_LIST=4,
  57. QUEC_SMARTCARD_SEL=5,
  58. QUEC_SMARTCARD_SETPOLICY=6,
  59. QUEC_SMARTCARD_GETPOLICY=7,
  60. QUEC_SMARTCARD_SCAN=8,
  61. QUEC_SMARTCARD_SAVE=9,
  62. QUEC_SMARTCARD_DEINIT = 10,
  63. }tcpip_msg_id;
  64. /*save parameter, 需要掉电保存的参数*/
  65. typedef struct
  66. {
  67. int rsv1;
  68. }quec_smartcard_save;
  69. typedef struct
  70. {
  71. int startup_init;
  72. }quec_smartcard_qcfg_info;
  73. typedef struct
  74. {
  75. int running;/*sdk run flag*/
  76. int state;/*业务执行流程状态, app state*/
  77. ql_queue_t queue;
  78. atCmdEngine_t * atengine;
  79. atDispatch_t* dispatch;
  80. int func_save;
  81. uint32_t interval_time;
  82. int try_times;
  83. quec_smartcard_save smartcard_save;
  84. quec_smartcard_qcfg_info qcfg;
  85. }quec_aliot_smartcard_ctx;
  86. typedef struct
  87. {
  88. uint32_t func_hac;
  89. uint32_t func_sc;
  90. uint32_t func_sw;
  91. uint32_t func_mse;
  92. }quec_aliot_smartcard_mnenable;
  93. typedef struct
  94. {
  95. uint16_t policy;
  96. uint16_t check_retry_cnt;
  97. uint16_t delay_threshold;
  98. uint16_t ping_cycle;
  99. uint16_t ping_cnt_once;
  100. uint16_t silent_time;
  101. char ping_dest_ip[256];
  102. int rssi_threshold;
  103. }quec_aliot_smartcard_mnpolicy;
  104. int quec_aliot_smartcard_int(void);
  105. int quec_aliot_smartcard_sdk_sta(void);
  106. int quec_aliot_smartcard_get_all_sim_info(void);
  107. int quec_aliot_smartcard_manual_switch(void *arg);
  108. int quec_aliot_smartcard_get_mnenable(void *arg);
  109. int quec_aliot_smartcard_get_mnsave(void);
  110. int quec_aliot_smartcard_set_mnenable(void *arg);
  111. int quec_aliot_smartcard_scan_carrier(void);
  112. int quec_aliot_smartcard_update_configs(void *arg);
  113. int quec_aliot_smartcard_get_mnpolicy(void *arg);
  114. int quec_aliot_smartcard_set_mnpolicy(void *arg);
  115. void quec_aliot_smartcard_set_at_param(atCmdEngine_t* atengine);
  116. int quec_aliot_smartcard_event_send(uint32 id, void *arg);
  117. int ql_aliot_smartcard_write_qcfg_nv( const void *data, int size);
  118. int ql_aliot_smartcard_read_qcfg_nv( void *data, int size);
  119. void quec_aliot_smartcard_startup_init(void);
  120. int quec_aliot_smartcard_get_init_state(void);
  121. int quec_aliot_smartcard_app_startup_cfg_fxn(int opt,int* startup);
  122. #endif/*QUEC_ALIIOT_SMARTCARD__H*/