forked from SZV10X_Software/SZV103_FM33A0xxEV_SiZhu

wujiazhi
2024-06-07 d0cca79a4aa7efce979c6aed275fe1bb75af4cc4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
#include "gprs_protocol_api.h"
#include "string.h"
#include "rtc.h"
#include "sundry.h"
#include "stdlib.h"
#include "billing.h"
#include "system_parameter.h"
 
GPRS_SUCC_TEST_T gprs_test_g = {0};//230531
 
static ErrorStatus set_result_g = ERROR;
 
GPRS_PROTOCOL_HEAD_TAIL_T gprs_protocol_head_tail_g = {
    {PROTOCOL_START_CODE, 0, 0, 0, 0, 0, 0, 0, 0, PROTOCOL_START_CODE, PROTOCOL_CMD_UP_U8_H | PROTOCOL_CMD_INITIATIVE_SEND_U8_L, 0},
    {0, 0, 0, 0, 0, 0, PROTOCOL_VERSION, PROTOCOL_NORMAL_SEND_CMD_U16, 0, 0, KEY_VERSION},
    {0, PROTOCOL_END_CODE},
    {0}};
 
GPRS_PROTOCOL_ALARM_HEAD_T gprs_protocol_alarm_head_tail_g = {
    {PROTOCOL_START_CODE, 0, 0, 0, 0, 0, 0, 0, 0, PROTOCOL_START_CODE, PROTOCOL_CMD_UP_U8_H | PROTOCOL_CMD_INITIATIVE_SEND_U8_L, 0},
    {0, 0, 0, 0, 0, 0, PROTOCOL_VERSION, PROTOCOL_NORMAL_SEND_CMD_U16, 0, 0, KEY_VERSION},
    {0, PROTOCOL_END_CODE}};
 
 
GPRS_PROTOCOL_NORMAL_DATA_PACK_T gprs_protocol_normal_data_pack_g;
GPRS_PROTOCOL_PARA_T gprs_protocol_para_g;
GPRS_PROTOCOL_ALARM_ID_PACK_T gprs_protocol_alarm_id_pack_g;
 
static const GPRS_PROTOCOL_SEND_FUNC_TABLE_DRV_T gprs_protocol_send_tab_func[] = {
    {PROTOCOL_NORMAL_SEND_CMD, Gprs_Protocol_SendNormalDataHandler},
    {PROTOCOL_SET_TIME_CMD_BACK, Gprs_Protocol_SendSetTimeResultHandler}};
 
static const GPRS_PROTOCOL_RECV_FUNC_TABLE_DRV_T gprs_protocol_recv_tab_func[] = {
    {PROTOCOL_NORMAL_SEND_CMD_U16, Gprs_Protocol_RecvNormalDataHandler},
    {PROTOCOL_END_CMD_U16, Gprs_Protocol_RecvEndHandler},
    {PROTOCOL_SET_TIME_CMD_U16, Gprs_Protocol_RecvSetTimeHandler}};
 
uint16_t Gprs_Protocol_DataLength(uint8_t send_type, GPRS_PROTOCOL_ENCRYPT_PARA *gprs_protocol_encrypt_para_p)
{
  switch (send_type)
  {
  case PROTOCOL_NORMAL_SEND_CMD:
    gprs_protocol_encrypt_para_p->plaintext_length = PROTOCOL_NORMAL_DATA_HEAD_LENGTH + PROTOCOL_NORMAL_DATA_PACK_LENGTH;
    break;
  case PROTOCOL_SET_TIME_CMD_BACK:
    gprs_protocol_encrypt_para_p->plaintext_length = PROTOCOL_SET_CMD_DATA_BACK_LENGTH;
    break;
    case PROTOCOL_ALARM_SEND_CMD:
        gprs_protocol_encrypt_para_p->plaintext_length = sizeof(GPRS_PROTOCOL_ALARM_ID_PACK_T);
        break;
  default:
    break;
  }
  gprs_protocol_encrypt_para_p->padding_total_length = PKCS5Padding_like(&gprs_protocol_encrypt_para_p->padding_length, gprs_protocol_encrypt_para_p->plaintext_length);
  return PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH + PROTOCOL_TAIL_LENGTH + gprs_protocol_encrypt_para_p->padding_total_length;
}
 
 
 
/************************************** Send Data **************************************************************/
/************************************** Send Data **************************************************************/
/************************************** Send Data **************************************************************/
 
void Gprs_Protocol_SendSetTimeResultHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p)
{
  /*¹¹ÔìÖ¡Í·¿ØÖÆÂë*/
  gprs_protocol_head_tail_p->gprs_protocol_head.cmd_code_u8 = (PROTOCOL_CMD_UP_U8_H | PROTOCOL_CMD_WRITE_U8_L);
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.cmd_code_u16 = PROTOCOL_SET_TIME_CMD_U16;
  /*¹¹ÔìÊý¾ÝÓò³¤¶È*/
  gprs_protocol_head_tail_p->gprs_protocol_head.data_field_length = PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length;
  /*¹¹ÔìÊý¾Ý°üÊý¾Ý*/
  pData[0] = set_result_g;
}
 
void Create_Send_NormalDataPack(GPRS_PROTOCOL_NORMAL_DATA_PACK_T *gprs_protocol_normal_data_pack_p)
{
    volatile int32_t temp_data = 0;
  gprs_protocol_normal_data_pack_p->sample_time[0] = calendar_g.year & 0xFF;
  gprs_protocol_normal_data_pack_p->sample_time[1] = calendar_g.month;
  gprs_protocol_normal_data_pack_p->sample_time[2] = calendar_g.day;
  gprs_protocol_normal_data_pack_p->sample_time[3] = calendar_g.hour;
  gprs_protocol_normal_data_pack_p->sample_time[4] = calendar_g.minute;
  gprs_protocol_normal_data_pack_p->sample_time[5] = calendar_g.second;
    gprs_test_g.gprs_send_succ_cnt++;
    
    temp_data = billing_real_para_g.balance_now;
    gprs_protocol_normal_data_pack_p->balance_dec = /*(billing_real_para_g.balance_now - temp_data) * 10000*/0;
    gprs_protocol_normal_data_pack_p->balance_int = /*temp_data*/gprs_test_g.gprs_start_cnt;
    
    temp_data = sys_realtime_data_g.measure_para_s.forward_cumulate_sc;
    gprs_protocol_normal_data_pack_p->gas_use_total_dec = /*(sys_realtime_data_g.measure_para_s.forward_cumulate_sc - temp_data) * 10000*/0;
  gprs_protocol_normal_data_pack_p->gas_use_total_int = /*temp_data*/gprs_test_g.gprs_send_succ_cnt;
    
    gprs_protocol_normal_data_pack_p->fee_use_total_dec = 0;
    gprs_protocol_normal_data_pack_p->fee_use_total_int = /*0*/gprs_test_g.gprs_time_cnt;
    
    gprs_protocol_normal_data_pack_p->sc_cumulate_dec = /*gprs_protocol_normal_data_pack_p->gas_use_total_dec*/0;
    gprs_protocol_normal_data_pack_p->sc_cumulate_int = /*gprs_protocol_normal_data_pack_p->gas_use_total_int*/gprs_test_g.gprs_recv_cnt;
    
    temp_data = sys_realtime_data_g.measure_para_s.forward_cumulate_wc;
    gprs_protocol_normal_data_pack_p->wc_cumulate_dec = /*(sys_realtime_data_g.measure_para_s.forward_cumulate_wc - temp_data) * 10000*/0;
    gprs_protocol_normal_data_pack_p->wc_cumulate_int = /*temp_data*/gprs_test_g.gprs_iccid_cnt;
 
    temp_data = sys_realtime_data_g.measure_para_s.instant_sc;
    gprs_protocol_normal_data_pack_p->sc_instant_dec = /*(sys_realtime_data_g.measure_para_s.instant_sc - temp_data) * 10000*/0;
    gprs_protocol_normal_data_pack_p->sc_instant_int = /*temp_data*/gprs_test_g.gprs_imei_cnt;
    
    temp_data = sys_realtime_data_g.measure_para_s.instant_wc;
    gprs_protocol_normal_data_pack_p->wc_instant_dec = /*(sys_realtime_data_g.measure_para_s.instant_wc - temp_data) * 10000*/0;
    gprs_protocol_normal_data_pack_p->wc_instant_int = /*temp_data*/gprs_test_g.gprs_csq_cnt;
    
    gprs_protocol_normal_data_pack_p->temperature = /*sys_realtime_data_g.measure_para_s.temperature*/gprs_test_g.gprs_call_cnt;
    gprs_protocol_normal_data_pack_p->pressure = /*sys_realtime_data_g.measure_para_s.pressure*/gprs_test_g.gprs_tcp_cnt;
    
    gprs_protocol_normal_data_pack_p->lith_vcc_dec = /*sys_realtime_data_g.state_para_s.lith_vcc % 10 * 10*/0;
    gprs_protocol_normal_data_pack_p->lith_vcc_int = /*sys_realtime_data_g.state_para_s.lith_vcc / 10*/gprs_test_g.gprs_len_cnt;
    
    gprs_protocol_normal_data_pack_p->alka_vcc_dec = sys_realtime_data_g.state_para_s.alka_vcc % 10 * 10;
    gprs_protocol_normal_data_pack_p->alka_vcc_int = sys_realtime_data_g.state_para_s.alka_vcc / 10;
 
}
 
void Gprs_Protocol_SendNormalDataHandler(uint8_t *pData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p)
{
  /*¹¹ÔìÖ¡Í·¿ØÖÆÂë*/
  gprs_protocol_head_tail_p->gprs_protocol_head.cmd_code_u8 = (PROTOCOL_CMD_UP_U8_H | PROTOCOL_CMD_INITIATIVE_SEND_U8_L);
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.cmd_code_u16 = PROTOCOL_NORMAL_SEND_CMD_U16;
  /*¹¹ÔìÊý¾ÝÓò³¤¶È*/
  gprs_protocol_head_tail_p->gprs_protocol_head.data_field_length = PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length;
 
  /*¹¹ÔìÊý¾Ý°üÍ·*/
//gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.sys_send_type = 2;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.pwr_type = 1;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.data_get_type = 2;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.billing_type = 1;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.use_state = 0;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.net_info = 0;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.valve_state = 1;
  gprs_protocol_head_tail_p->gprs_protocol_normal_data_head.one_frame_num = 1;
  /*¹¹ÔìÊý¾Ý°üÊý¾Ý*/
  Create_Send_NormalDataPack(&gprs_protocol_normal_data_pack_g);
  /*¿½±´Êý¾Ý°üÍ·¹Ì¶¨Êý¾Ý*/
  memcpy(pData, &gprs_protocol_head_tail_p->gprs_protocol_normal_data_head, PROTOCOL_NORMAL_DATA_HEAD_LENGTH);
  /*¿½±´Êý¾Ý¶¯Ì¬ÄÚÈÝÊý¾Ý*/
  memcpy(&pData[PROTOCOL_NORMAL_DATA_HEAD_LENGTH], &gprs_protocol_normal_data_pack_g, PROTOCOL_NORMAL_DATA_PACK_LENGTH);
}
 
void Gprs_Protocol_SendAlarmPack(uint8_t *pSendData, GPRS_PROTOCOL_ALARM_HEAD_T *gprs_protocol_alarm_head_p)
{
    uint8_t i = 0;
    uint16_t checksum_length = 0;
    /*¹¹ÔìЭÒé°üÍ·*/
    gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[0] = 0x04; //É豸±àºÅ
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[1] = 0x00;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[2] = 0x00;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[3] = 0x00;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[4] = 0x00;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[5] = 0x15;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[6] = 0x08;
  gprs_protocol_alarm_head_p->gprs_protocol_head.device_num[7] = 0x23;
    
    gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[0] = calendar_g.year & 0xFF; //ʱ¼ä
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[1] = calendar_g.month;
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[2] = calendar_g.day;
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[3] = calendar_g.hour;
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[4] = calendar_g.minute;
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.device_time[5] = calendar_g.second;
    
    gprs_protocol_alarm_head_p->gprs_protocol_head.cmd_code_u8 = (PROTOCOL_CMD_UP_U8_H | PROTOCOL_CMD_INITIATIVE_SEND_U8_L);    //¿ØÖÆÂë
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.cmd_code_u16 = PROTOCOL_ALARM_CMD_U16;    //ÃüÁî±êʶ
    gprs_protocol_alarm_head_p->gprs_protocol_head.data_field_length = PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length;    //Êý¾Ý³¤¶È
    
    gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.frame_num = 1;
  gprs_protocol_alarm_head_p->gprs_protocol_data_field_head.frame_sum = 1;
    
    gprs_protocol_alarm_id_pack_g.alarm_num = 1;
    
      /*¿½±´Í·²¿¹Ì¶¨Êý¾ÝÖÁ·¢ËÍÊý×é*/
  memcpy(pSendData, &gprs_protocol_alarm_head_p->gprs_protocol_head, PROTOCOL_HEAD_LENGTH); //¿½±´Êý¾ÝÖ¡Í·²¿Êý¾Ý
    memcpy(&pSendData[PROTOCOL_HEAD_LENGTH], &gprs_protocol_alarm_head_p->gprs_protocol_data_field_head, PROTOCOL_DATA_FIELD_HEAD_LENGTH);//¿½±´Êý¾ÝÓò
    memcpy(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH], &gprs_protocol_alarm_id_pack_g, sizeof(GPRS_PROTOCOL_ALARM_ID_PACK_T));
    Gprs_Send_Data_Aes128_Ecb_Encrypt_Padding(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH], &gprs_protocol_encrypt_para_g);//¼ÓÃÜÊý¾Ý
    
  /*ºÍУÑé*/
  checksum_length = PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length;
  gprs_protocol_alarm_head_p->gprs_protocol_tail.checksum = 0;
  for (i = 0; i < checksum_length; i++)
    gprs_protocol_alarm_head_p->gprs_protocol_tail.checksum += pSendData[i];
  /*¿½±´Î²²¿¹Ì¶¨Êý¾ÝÖÁ·¢ËÍÊý×é*/
  memcpy(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length], &gprs_protocol_alarm_head_p->gprs_protocol_tail, PROTOCOL_TAIL_LENGTH);
}
 
/*GPRSЭÒé·¢ËÍÊý¾ÝÅäÖÃ*/
void Gprs_Protocol_SendDataConfig(uint8_t send_type, uint8_t *pSendData, GPRS_PROTOCOL_HEAD_TAIL_T *gprs_protocol_head_tail_p)
{
  uint8_t i = 0;
  uint16_t checksum_length = 0;
  /*¹¹ÔìЭÒé°üÍ·*/
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[0] = 0x04; //É豸±àºÅ
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[1] = 0x00;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[2] = 0x00;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[3] = 0x00;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[4] = 0x00;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[5] = 0x15;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[6] = 0x08;
  gprs_protocol_head_tail_p->gprs_protocol_head.device_num[7] = 0x23;
 
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[0] = calendar_g.year & 0xFF; //ʱ¼ä
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[1] = calendar_g.month;
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[2] = calendar_g.day;
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[3] = calendar_g.hour;
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[4] = calendar_g.minute;
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.device_time[5] = calendar_g.second;
 
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.frame_num = 1;
  gprs_protocol_head_tail_p->gprs_protocol_data_field_head.frame_sum = 1;
 
  /*Ñ¡Ôñ·¢ËÍÊý¾ÝÖ¡ÀàÐÍ*/
  for (i = 0; i < GPRS_PROTOCOL_SEND_FUNC_TABLE_NUM; i++)
  {
    /*²é±í*/
    if (gprs_protocol_send_tab_func[i].gprs_protocol_cmd_table == send_type && gprs_protocol_send_tab_func[i].GprsProtocolSendFuncHandler != NULL)
    {
      gprs_protocol_send_tab_func[i].GprsProtocolSendFuncHandler(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH], gprs_protocol_head_tail_p);
      Gprs_Send_Data_Aes128_Ecb_Encrypt_Padding(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH], &gprs_protocol_encrypt_para_g); //Ìî³äºÍ¼ÓÃÜ
      break;
    }
  }
  /*¿½±´Í·²¿¹Ì¶¨Êý¾ÝÖÁ·¢ËÍÊý×é*/
  memcpy(pSendData, &gprs_protocol_head_tail_p->gprs_protocol_head, PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH); //¿½±´Êý¾ÝÖ¡Í·²¿Êý¾Ý
  /*ºÍУÑé*/
  checksum_length = PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length;
  gprs_protocol_head_tail_p->gprs_protocol_tail.checksum = 0;
  for (i = 0; i < checksum_length; i++)
    gprs_protocol_head_tail_p->gprs_protocol_tail.checksum += pSendData[i];
  /*¿½±´Î²²¿¹Ì¶¨Êý¾ÝÖÁ·¢ËÍÊý×é*/
  memcpy(&pSendData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH + gprs_protocol_encrypt_para_g.padding_total_length], &gprs_protocol_head_tail_p->gprs_protocol_tail, PROTOCOL_TAIL_LENGTH);
}
 
 
/************************************** Recv Data **************************************************************/
/************************************** Recv Data **************************************************************/
/************************************** Recv Data **************************************************************/
 
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvNormalDataHandler(uint8_t *pData)
{
  if (gprs_protocol_head_tail_g.gprs_protocol_data_field_head.frame_num < gprs_protocol_head_tail_g.gprs_protocol_data_field_head.frame_sum)
    gprs_protocol_head_tail_g.gprs_protocol_data_field_head.frame_num++;
  return PROTOCOL_NORMAL_SEND_CMD;
}
 
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvEndHandler(uint8_t *pData)
{
  gprs_protocol_head_tail_g.gprs_protocol_data_field_head.frame_num = 1;
  gprs_protocol_head_tail_g.gprs_protocol_data_field_head.frame_sum = 1;
    gprs_test_g.gprs_recv_cnt++;
  return PROTOCOL_END_STATUS;
}
 
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvSetTimeHandler(uint8_t *pData)
{
 
//  if (Set_Sys_Rtc_Time(pData[0], pData[1], pData[2], 1, pData[3], pData[4], pData[5]) == HAL_OK)
    set_result_g = SUCCESS;
//  else
//    set_result_g = ERROR;
  return PROTOCOL_SET_TIME_CMD_BACK;
}
 
/*GPRSЭÒé½ÓÊÕÊý¾Ý´¦Àí*/
GPRS_PROTOCOL_STATUS Gprs_Protocol_RecvDataConfig(uint8_t *pRecvData, uint16_t recv_data_length)
{
  GPRS_PROTOCOL_STATUS gprs_protocol_cmd_flag = PROTOCOL_UNKOWN_STATUS;
  uint8_t recv_cmd_code_u8 = pRecvData[10];                        //ЭÒé¿ØÖÆÂë
  uint16_t recv_cmd_code_u16 = pRecvData[21] << 8 | pRecvData[20]; //ЭÒéÃüÁî±êʶ
  uint8_t recv_checksum_calculate = 0, recv_checksum = pRecvData[recv_data_length - 1 - 1];
  for (uint8_t i = 0; i < recv_data_length - 2; i++)
    recv_checksum_calculate += pRecvData[i];
  if (recv_checksum_calculate == recv_checksum)
  {
    /*Ñ¡Ôñ½ÓÊÕÊý¾ÝÖ¡ÀàÐÍ*/
    for (uint8_t i = 0; i < GPRS_PROTOCOL_RECV_FUNC_TABLE_NUM; i++)
    {
      /*²é±í*/
      if (gprs_protocol_recv_tab_func[i].gprs_protocol_cmd_table_u16 == recv_cmd_code_u16 && gprs_protocol_recv_tab_func[i].GprsProtocolRecvFuncHandler != NULL)
      {
        /*Êý¾Ý½âÃÜ*/
        Gprs_Recv_Data_Aes128_Ecb_Decrypt(&pRecvData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH], recv_data_length);
        gprs_protocol_cmd_flag = gprs_protocol_recv_tab_func[i].GprsProtocolRecvFuncHandler(&pRecvData[PROTOCOL_HEAD_LENGTH + PROTOCOL_DATA_FIELD_HEAD_LENGTH]);
        break;
      }
    }
  }
  return gprs_protocol_cmd_flag;
}