kwp2000_service.c 64.7 KB
Newer Older
hu's avatar
hu committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
/*
*********************************************************************
* Includes
*********************************************************************
*/
#include "kwp2000_interface.h"
#include "kwp2000_tp.h"
#include "kwp2000_service.h"

#include "Common_Interface.h"
#include "GUI.h"
/*
*********************************************************************
* structure
*********************************************************************
*/
17
#define TEST_TYPE   0
hu's avatar
hu committed
18 19 20 21 22
/*
*********************************************************************
* variable
*********************************************************************
*/
hu's avatar
hu committed
23 24 25 26
unsigned char Sendseed1;
unsigned char Sendseed2;
unsigned char Sendseed3;
unsigned char Sendseed4;
hu's avatar
hu committed
27

hu's avatar
hu committed
28 29 30 31
unsigned char Recvseed1;
unsigned char Recvseed2;
unsigned char Recvseed3;
unsigned char Recvseed4;
hu's avatar
hu committed
32 33 34

unsigned char Seed1, Seed2, Seed3, Seed4;

hu's avatar
hu committed
35
unsigned char DTCstatusCHGFFK_Line = 0u;
hu's avatar
hu committed
36

hu's avatar
hu committed
37 38
unsigned char AccessMode2701KeyTimeFlag;
unsigned char AccessMode2701KeyTime;
hu's avatar
hu committed
39

40
#pragma alignvar(8)
hu's avatar
hu committed
41
_ECUStatus ECUStatusONE;
42
#pragma alignvar(8)
hu's avatar
hu committed
43
_EOL_K_LINE_SET K_Line_Set;
44 45 46 47
#pragma alignvar(8)
Kwp2000_Negative_t Kwp2000_Negative;
#pragma alignvar(8)
_K_LINE_SIGNAL_FLAG K_LINE_SIGNAL_FLAG;
hu's avatar
hu committed
48

49 50 51 52
#pragma ghs section bss=".myNonInitArea"
unsigned long SeedKey = 0;
unsigned long EOLSeedRandomNumber = 0x727u;
#pragma ghs section bss=default
hu's avatar
hu committed
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
/*
*********************************************************************
* function
*********************************************************************
*/

/*-------------------------------------------------------------------------
* Function Name  : kwp_NegativeResponse
* Description    : Negative Response
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
unsigned char kwp_NegativeResponse(unsigned char sId_u8, unsigned char NegRC_u8, unsigned char *blockByte)
{
    unsigned char bufPos = 0;

    (*blockByte++) = KWP_NEGATIVE_RESPONSE;
    (*blockByte++) = sId_u8;
    (*blockByte) = NegRC_u8;

    bufPos = 3;

    return (bufPos);
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_EcuReset
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 11
--------------------------------------------------------------------------*/
unsigned char kwp_EcuReset(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;

hu's avatar
hu committed
91
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
92
    {
hu's avatar
hu committed
93
    case 1: /* hardReset */
hu's avatar
hu committed
94
        (*TxData++) = KWP2000_ECURESET_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
95
        (*TxData) = RequestData[0];
hu's avatar
hu committed
96 97
        Tx_Len = 2;
        break;
hu's avatar
hu committed
98
    case 2: /* keyOffOnReset */
hu's avatar
hu committed
99
        (*TxData++) = KWP2000_ECURESET_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
100
        (*TxData) = RequestData[0];
hu's avatar
hu committed
101 102
        Tx_Len = 2;
        break;
hu's avatar
hu committed
103
    case 3: /* softReset */
hu's avatar
hu committed
104
        (*TxData++) = KWP2000_ECURESET_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
105
        (*TxData) = RequestData[0];
hu's avatar
hu committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
        Tx_Len = 2;
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}

/*-------------------------------------------------------------------------
* Function Name  : kwp_TesterPresent
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 3E
--------------------------------------------------------------------------*/
unsigned char kwp_TesterPresent(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
126

hu's avatar
hu committed
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    (*TxData) = KWP2000_TESTERPRESENT_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
    Tx_Len = 1;
    return Tx_Len;
}

/*-------------------------------------------------------------------------
* Function Name  : kwp_StartCommunication
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 81
--------------------------------------------------------------------------*/
unsigned char kwp_StartCommunication(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
143

hu's avatar
hu committed
144 145
    K_LINE_SIGNAL_FLAG.RecvStart = 1;

hu's avatar
hu committed
146 147
    (*TxData++) = KWP2000_STARTCOMMUNICATION_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
    (*TxData++) = KWP2000_KEYBYTE1;
hu's avatar
hu committed
148 149 150 151 152 153 154 155 156 157 158 159
    (*TxData) = KWP2000_KEYBYTE2;
    Tx_Len = 3;

    return Tx_Len;
}

/*-------------------------------------------------------------------------
* Function Name  : kwp_StartCommunication
* Description    :
* Input          :
* Output         : None
* Return         : None
hu's avatar
hu committed
160
* onther         : 82 服务,没有否定应答
hu's avatar
hu committed
161 162 163 164
--------------------------------------------------------------------------*/
unsigned char kwp_StopCommunication(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
165

hu's avatar
hu committed
166 167
    if (K_LINE_SIGNAL_FLAG.RecvStart == 1)
    {
hu's avatar
hu committed
168 169
        K_LINE_SIGNAL_FLAG.RecvStart = 0;            /*EOL诊断结束标识*/
        K_LINE_SIGNAL_FLAG.SendSeedEQUSRecvSeed = 0; /*清空密钥配对成功标识*/
hu's avatar
hu committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191

        (*TxData) = KWP2000_STOPCOMMUNICATION_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        Tx_Len = 1;
    }
    else
    {
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
    }

    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readEcuIdentification
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 1A
--------------------------------------------------------------------------*/
unsigned char kwp_readEcuIdentification(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
192

hu's avatar
hu committed
193
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
194
    {
hu's avatar
hu committed
195
    case 0x81: /* ECUIdentificationScalingTable */
hu's avatar
hu committed
196
        (*TxData++) = KWP2000_READECUIDENTIFICATION_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
197 198 199 200
        (*TxData++) = RequestData[0];
        (*TxData++) = 0x03; /* Scaling Offset*/
        (*TxData++) = 0x91; /* 汽车制造厂编号*/
        (*TxData++) = 0x6A; /* Ascii 10 byte*/
hu's avatar
hu committed
201 202 203 204 205
        (*TxData++) = 0xFF;
        Tx_Len = 6;
        break;
    case 0x91: /* vehicleManufacturerECUHardwareNumber */
        (*TxData++) = KWP2000_READECUIDENTIFICATION_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
206
        (*TxData++) = RequestData[0]; /* ISUZU Parts No. 8979683010 */
hu's avatar
hu committed
207 208 209 210 211 212 213 214 215 216
        (*TxData++) = K_Line_Set.No_Digit1;
        (*TxData++) = K_Line_Set.No_Digit2;
        (*TxData++) = K_Line_Set.No_Digit3;
        (*TxData++) = K_Line_Set.No_Digit4;
        (*TxData++) = K_Line_Set.No_Digit5;
        (*TxData++) = K_Line_Set.No_Digit6;
        (*TxData++) = K_Line_Set.No_Digit7;
        (*TxData++) = K_Line_Set.No_Digit8;
        (*TxData++) = K_Line_Set.No_Digit9;
        (*TxData++) = K_Line_Set.No_Digit10;
hu's avatar
hu committed
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
        Tx_Len = 12;
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}

/*-------------------------------------------------------------------------
* Function Name  : kwp_writeDataByLocalIdentifier
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 3B
--------------------------------------------------------------------------*/
unsigned char kwp_writeDataByLocalIdentifier(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
    unsigned char CupFlag = 0;
hu's avatar
hu committed
238

hu's avatar
hu committed
239
    if ((K_Line_Set.KLINE == 0) || ((K_Line_Set.KLINE == 1) && (K_LINE_SIGNAL_FLAG.SendSeedEQUSRecvSeed == 1)))
hu's avatar
hu committed
240
    {
hu's avatar
hu committed
241
        switch (RequestData[0]) /* */
hu's avatar
hu committed
242
        {
hu's avatar
hu committed
243
        case 0x20: /*应对ECE R13 0:非应对、1:应对*/
hu's avatar
hu committed
244 245 246 247
            K_Line_Set.K_Line_LID20 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x20;
            Tx_Len = 2;
hu's avatar
hu committed
248
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
249
            break;
hu's avatar
hu committed
250
        case 0x21: /*EBS/ABS 0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对)*/
hu's avatar
hu committed
251 252 253 254
            K_Line_Set.K_Line_LID21 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x21;
            Tx_Len = 2;
hu's avatar
hu committed
255
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
256
            break;
hu's avatar
hu committed
257
        case 0x22: /* EVSC 0:无、1:有 */
hu's avatar
hu committed
258 259 260 261
            K_Line_Set.K_Line_LID22 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x22;
            Tx_Len = 2;
hu's avatar
hu committed
262
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
263
            break;
hu's avatar
hu committed
264
        case 0x23: /* 驻车锁定 0:无、1:有*/
hu's avatar
hu committed
265 266 267 268
            K_Line_Set.K_Line_LID23 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x23;
            Tx_Len = 2;
hu's avatar
hu committed
269
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
270
            break;
hu's avatar
hu committed
271
        case 0x24: /* HSA */
hu's avatar
hu committed
272 273 274 275
            K_Line_Set.K_Line_LID24 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x24;
            Tx_Len = 2;
hu's avatar
hu committed
276
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
277
            break;
hu's avatar
hu committed
278
        case 0x25: /* AEBS */
hu's avatar
hu committed
279 280 281 282
            K_Line_Set.K_Line_LID25 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x25;
            Tx_Len = 2;
hu's avatar
hu committed
283
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
284
            break;
hu's avatar
hu committed
285
        case 0x26: /* ACC */
hu's avatar
hu committed
286 287 288 289
            K_Line_Set.K_Line_LID26 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x26;
            Tx_Len = 2;
hu's avatar
hu committed
290
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
291
            break;
hu's avatar
hu committed
292
        case 0x27: /* LDWS */
hu's avatar
hu committed
293 294 295 296
            K_Line_Set.K_Line_LID27 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x27;
            Tx_Len = 2;
hu's avatar
hu committed
297
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
298
            break;
hu's avatar
hu committed
299
        case 0x28: /* 车辆间报警 */
hu's avatar
hu committed
300 301 302 303
            K_Line_Set.K_Line_LID28 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x28;
            Tx_Len = 2;
hu's avatar
hu committed
304
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
305
            break;
hu's avatar
hu committed
306
        case 0x29: /* 有无巡航 */
hu's avatar
hu committed
307 308 309 310
            K_Line_Set.K_Line_LID29 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x29;
            Tx_Len = 2;
hu's avatar
hu committed
311
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
312
            break;
hu's avatar
hu committed
313
        case 0x2A: /* 气悬 */
hu's avatar
hu committed
314 315 316 317
            K_Line_Set.K_Line_LID2A = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2A;
            Tx_Len = 2;
hu's avatar
hu committed
318
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
319
            break;
hu's avatar
hu committed
320
        case 0x2B: /* ISS */
hu's avatar
hu committed
321 322 323 324
            K_Line_Set.K_Line_LID2B = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2B;
            Tx_Len = 2;
hu's avatar
hu committed
325
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
326
            break;
hu's avatar
hu committed
327
        case 0x2C: /* 装货台工作警报蜂鸣器 */
hu's avatar
hu committed
328 329 330 331
            K_Line_Set.K_Line_LID2C = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2C;
            Tx_Len = 2;
hu's avatar
hu committed
332
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
333
            break;
hu's avatar
hu committed
334
        case 0x2D: /* ROWS */
hu's avatar
hu committed
335 336 337 338
            K_Line_Set.K_Line_LID2D = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2D;
            Tx_Len = 2;
hu's avatar
hu committed
339
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
340
            break;
hu's avatar
hu committed
341
        case 0x2E: /* 行车记录仪*/
hu's avatar
hu committed
342 343 344 345
            K_Line_Set.K_Line_LID2E = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2E;
            Tx_Len = 2;
hu's avatar
hu committed
346
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
347
            break;
hu's avatar
hu committed
348
        case 0x2F: /* 车型 */
hu's avatar
hu committed
349 350 351 352
            K_Line_Set.K_Line_LID2F = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x2F;
            Tx_Len = 2;
hu's avatar
hu committed
353
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
354
            break;
hu's avatar
hu committed
355
        case 0x30: /* 缓速器 */
hu's avatar
hu committed
356 357 358 359
            K_Line_Set.K_Line_LID30 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x30;
            Tx_Len = 2;
hu's avatar
hu committed
360
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
361
            break;
hu's avatar
hu committed
362
        case 0x31: /* 地图巡航 */
hu's avatar
hu committed
363 364 365 366
            K_Line_Set.K_Line_LID31 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x31;
            Tx_Len = 2;
hu's avatar
hu committed
367
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
368
            break;
hu's avatar
hu committed
369
        case 0x32: /* 装货台种类 */
hu's avatar
hu committed
370 371 372 373
            K_Line_Set.K_Line_LID32 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x32;
            Tx_Len = 2;
hu's avatar
hu committed
374
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
375
            break;
hu's avatar
hu committed
376
        case 0x33: /* SCR?DPD */
hu's avatar
hu committed
377 378 379 380
            K_Line_Set.K_Line_LID33 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x33;
            Tx_Len = 2;
hu's avatar
hu committed
381
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
382
            break;
hu's avatar
hu committed
383
        case 0x34: /* 驻车种类 */
hu's avatar
hu committed
384 385 386 387
            K_Line_Set.K_Line_LID34 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x34;
            Tx_Len = 2;
hu's avatar
hu committed
388
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
389
            break;
hu's avatar
hu committed
390
        case 0x35: /* 气压计 */
hu's avatar
hu committed
391 392 393 394
            K_Line_Set.K_Line_LID35 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x35;
            Tx_Len = 2;
hu's avatar
hu committed
395
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
396
            break;
hu's avatar
hu committed
397
        case 0x36: /* 低气压报警 */
hu's avatar
hu committed
398 399 400 401
            K_Line_Set.K_Line_LID36 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x36;
            Tx_Len = 2;
hu's avatar
hu committed
402
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
403
            break;
hu's avatar
hu committed
404
        case 0x37: /* 超限警报 */
hu's avatar
hu committed
405 406 407 408
            K_Line_Set.K_Line_LID37 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x37;
            Tx_Len = 2;
hu's avatar
hu committed
409
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
410
            break;
hu's avatar
hu committed
411
        case 0x38: /* 速度警报 */
hu's avatar
hu committed
412 413 414 415
            K_Line_Set.K_Line_LID38 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x38;
            Tx_Len = 2;
hu's avatar
hu committed
416
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
417
            break;
hu's avatar
hu committed
418
        case 0x39: /* 可变SLD */
hu's avatar
hu committed
419 420 421 422
            K_Line_Set.K_Line_LID39 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x39;
            Tx_Len = 2;
hu's avatar
hu committed
423
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
424
            break;
hu's avatar
hu committed
425
        case 0x3A: /* OEM */
hu's avatar
hu committed
426 427 428 429
            K_Line_Set.K_Line_LID3A = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3A;
            Tx_Len = 2;
hu's avatar
hu committed
430
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
431
            break;
hu's avatar
hu committed
432
        case 0x3B: /*预留 */
hu's avatar
hu committed
433 434 435 436
            K_Line_Set.K_Line_LID3B = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3B;
            Tx_Len = 2;
hu's avatar
hu committed
437
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
438
            break;
hu's avatar
hu committed
439
        case 0x3C: /* 预留 */
hu's avatar
hu committed
440 441 442 443
            K_Line_Set.K_Line_LID3C = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3C;
            Tx_Len = 2;
hu's avatar
hu committed
444
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
445
            break;
hu's avatar
hu committed
446
        case 0x3D: /* 预留 */
hu's avatar
hu committed
447 448 449 450
            K_Line_Set.K_Line_LID3D = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3D;
            Tx_Len = 2;
hu's avatar
hu committed
451
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
452
            break;
hu's avatar
hu committed
453
        case 0x3E: /* 预留 */
hu's avatar
hu committed
454 455 456 457
            K_Line_Set.K_Line_LID3E = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3E;
            Tx_Len = 2;
hu's avatar
hu committed
458
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
459
            break;
hu's avatar
hu committed
460
        case 0x3F: /* 预留 */
hu's avatar
hu committed
461 462 463 464
            K_Line_Set.K_Line_LID3F = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x3F;
            Tx_Len = 2;
hu's avatar
hu committed
465
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
466
            break;
hu's avatar
hu committed
467
        case 0x40: /* 发动机种类名称 */
hu's avatar
hu committed
468 469 470 471
            K_Line_Set.K_Line_LID40 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x40;
            Tx_Len = 2;
hu's avatar
hu committed
472
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
473
            break;
hu's avatar
hu committed
474
        case 0x41: /* 变速器种类&控制 */
hu's avatar
hu committed
475 476 477 478
            K_Line_Set.K_Line_LID41 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x41;
            Tx_Len = 2;
hu's avatar
hu committed
479
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
480
            break;
hu's avatar
hu committed
481
        case 0x42: /* 驻车管道 */
hu's avatar
hu committed
482 483 484 485
            K_Line_Set.K_Line_LID42 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x42;
            Tx_Len = 2;
hu's avatar
hu committed
486
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
487
            break;
hu's avatar
hu committed
488
        case 0x43: /* 车型 */
hu's avatar
hu committed
489 490 491 492
            K_Line_Set.K_Line_LID43 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x43;
            Tx_Len = 2;
hu's avatar
hu committed
493
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
494
            break;
hu's avatar
hu committed
495
        case 0x44: /* 速度警报 */
hu's avatar
hu committed
496 497 498 499
            K_Line_Set.K_Line_LID44 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x44;
            Tx_Len = 2;
hu's avatar
hu committed
500
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
501
            break;
hu's avatar
hu committed
502
        case 0x45: /* 发动机转速 */
hu's avatar
hu committed
503 504 505 506 507
            K_Line_Set.K_Line_LID45 = RequestData[2];
            User_App.User_Speed = K_Line_Set.K_Line_LID45;
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x45;
            Tx_Len = 2;
hu's avatar
hu committed
508
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
509
            break;
hu's avatar
hu committed
510
        case 0x46: /* 急加速 */
hu's avatar
hu committed
511 512 513 514 515
            K_Line_Set.K_Line_LID46 = RequestData[2];
            User_App.User_JADD = K_Line_Set.K_Line_LID46;
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x46;
            Tx_Len = 2;
hu's avatar
hu committed
516
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
517
            break;
hu's avatar
hu committed
518
        case 0x47: /* 急减速 */
hu's avatar
hu committed
519 520 521 522 523
            K_Line_Set.K_Line_LID47 = RequestData[2];
            User_App.User_JSUB = K_Line_Set.K_Line_LID47;
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x47;
            Tx_Len = 2;
hu's avatar
hu committed
524
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
525
            break;
hu's avatar
hu committed
526
        case 0x48: /* 长时间怠速 */
hu's avatar
hu committed
527 528 529 530
            K_Line_Set.K_Line_LID48 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x48;
            Tx_Len = 2;
hu's avatar
hu committed
531
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
532
            break;
hu's avatar
hu committed
533
        case 0x49: /* 辅助驻车 */
hu's avatar
hu committed
534 535 536 537
            K_Line_Set.K_Line_LID49 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x49;
            Tx_Len = 2;
hu's avatar
hu committed
538
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
539
            break;
hu's avatar
hu committed
540
        case 0x4A: /* 变速箱油 */
hu's avatar
hu committed
541 542 543 544
            K_Line_Set.K_Line_LID4A = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4A;
            Tx_Len = 2;
hu's avatar
hu committed
545
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
546
            break;
hu's avatar
hu committed
547
        case 0x4B: /* 差速器油 */
hu's avatar
hu committed
548 549 550 551
            K_Line_Set.K_Line_LID4B = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4B;
            Tx_Len = 2;
hu's avatar
hu committed
552
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
553
            break;
hu's avatar
hu committed
554
        case 0x4C: /* 离合器油 */
hu's avatar
hu committed
555 556 557 558
            K_Line_Set.K_Line_LID4C = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4C;
            Tx_Len = 2;
hu's avatar
hu committed
559
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
560
            break;
hu's avatar
hu committed
561
        case 0x4D: /* 动力转向油 */
hu's avatar
hu committed
562 563 564 565
            K_Line_Set.K_Line_LID4D = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4D;
            Tx_Len = 2;
hu's avatar
hu committed
566
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
567
            break;
hu's avatar
hu committed
568
        case 0x4E: /* 轮胎 */
hu's avatar
hu committed
569 570 571 572
            K_Line_Set.K_Line_LID4E = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4E;
            Tx_Len = 2;
hu's avatar
hu committed
573
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
574
            break;
hu's avatar
hu committed
575
        case 0x4F: /* 机油&滤清器 */
hu's avatar
hu committed
576 577 578 579
            K_Line_Set.K_Line_LID4F = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x4F;
            Tx_Len = 2;
hu's avatar
hu committed
580
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
581
            break;
hu's avatar
hu committed
582
        case 0x50: /* 预留 */
hu's avatar
hu committed
583 584 585 586
            K_Line_Set.K_Line_LID50 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x50;
            Tx_Len = 2;
hu's avatar
hu committed
587
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
588
            break;
hu's avatar
hu committed
589
        case 0x51: /* 工作模式 */
hu's avatar
hu committed
590 591 592 593
            K_Line_Set.K_Line_LID51 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x51;
            Tx_Len = 2;
hu's avatar
hu committed
594
            //DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
595
            break;
hu's avatar
hu committed
596
        case 0x52: /* 电子部件设定 */
hu's avatar
hu committed
597 598 599 600
            K_Line_Set.K_Line_LID52 = RequestData[2];
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x52;
            Tx_Len = 2;
hu's avatar
hu committed
601
            DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
602 603
            break;

hu's avatar
hu committed
604
        case 0x91: /*  */
hu's avatar
hu committed
605 606 607 608 609 610 611 612 613 614
            K_Line_Set.No_Digit1 = RequestData[1];
            K_Line_Set.No_Digit2 = RequestData[2];
            K_Line_Set.No_Digit3 = RequestData[3];
            K_Line_Set.No_Digit4 = RequestData[4];
            K_Line_Set.No_Digit5 = RequestData[5];
            K_Line_Set.No_Digit6 = RequestData[6];
            K_Line_Set.No_Digit7 = RequestData[7];
            K_Line_Set.No_Digit8 = RequestData[8];
            K_Line_Set.No_Digit9 = RequestData[9];
            K_Line_Set.No_Digit10 = RequestData[10];
hu's avatar
hu committed
615

hu's avatar
hu committed
616
            /*写EEP*/
hu's avatar
hu committed
617
            DTCstatusCHGFFK_Line = 1;   //----ECU ID_ECU件号 eep
hu's avatar
hu committed
618 619 620 621 622

            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = RequestData[0];
            Tx_Len = 2;
            break;
hu's avatar
hu committed
623
        case 0xA0: /*  */
hu's avatar
hu committed
624
            K_Line_Set.TesterECU = RequestData[2];
hu's avatar
hu committed
625

hu's avatar
hu committed
626
            if (K_Line_Set.METERCOUNT < 0xFF)
hu's avatar
hu committed
627
            {
hu's avatar
hu committed
628
                K_Line_Set.METERCOUNT++; /*修正率次数增加*/
hu's avatar
hu committed
629 630 631
            }
            else
            {
hu's avatar
hu committed
632
                K_Line_Set.METERCOUNT = 0xFF; /*修正率次数增加*/
hu's avatar
hu committed
633 634
            }

hu's avatar
hu committed
635 636
            DTCstatusCHGFFK_Line = 1;

hu's avatar
hu committed
637 638 639 640
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0xA0;
            Tx_Len = 2;
            break;
hu's avatar
hu committed
641
        case 0xA3: /*  */
hu's avatar
hu committed
642
            K_Line_Set.TesterECUCAN = RequestData[2];
hu's avatar
hu committed
643

hu's avatar
hu committed
644
            if (K_Line_Set.METERCOUNT < 0xFF)
hu's avatar
hu committed
645
            {
hu's avatar
hu committed
646
                K_Line_Set.METERCOUNT++; /*修正率次数增加*/
hu's avatar
hu committed
647 648 649
            }
            else
            {
hu's avatar
hu committed
650
                K_Line_Set.METERCOUNT = 0xFF; /*修正率次数增加*/
hu's avatar
hu committed
651 652
            }

hu's avatar
hu committed
653 654
            DTCstatusCHGFFK_Line = 1;

hu's avatar
hu committed
655 656 657 658 659 660 661 662 663 664 665 666
            (*TxData++) = KWP2000_WRITEDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0xA3;
            Tx_Len = 2;
            break;
        default: /* subFunctionNotSupported */
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
            break;
        }
        return Tx_Len;
    }
    else
    {
hu's avatar
hu committed
667
        if ((K_Line_Set.KLINE == 1u) && (K_LINE_SIGNAL_FLAG.SendSeedEQUSRecvSeed == 0u))
hu's avatar
hu committed
668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690
        {
            if (((RequestData[0] >= 0x20) && (RequestData[0] <= 0x52)) || (RequestData[0] == 0x91) || (RequestData[0] == 0xA0) || (RequestData[0] == 0xA3))
                Kwp2000_Negative.ResponseCode = KWP2000_securityAccessDenied;
            else
                Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        }
        else
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        return Tx_Len;
    }
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readDataByLocalIdentifier
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 21
--------------------------------------------------------------------------*/
unsigned char kwp_readDataByLocalIdentifier(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
    unsigned int ECUStatusCup = 0;
hu's avatar
hu committed
691

hu's avatar
hu committed
692
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
693
    {
hu's avatar
hu committed
694
    case 0x20: /* 应对ECE R13 */
hu's avatar
hu committed
695 696 697
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x20;
        (*TxData++) = 0x00;
hu's avatar
hu committed
698
        (*TxData++) = K_Line_Set.K_Line_LID20;
hu's avatar
hu committed
699 700
        Tx_Len = 4;
        break;
hu's avatar
hu committed
701
    case 0x21: /* EBS/ABS */
hu's avatar
hu committed
702 703 704
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x21;
        (*TxData++) = 0x00;
hu's avatar
hu committed
705
        (*TxData++) = K_Line_Set.K_Line_LID21;
hu's avatar
hu committed
706 707
        Tx_Len = 4;
        break;
hu's avatar
hu committed
708
    case 0x22: /* EVSC */
hu's avatar
hu committed
709 710 711
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x22;
        (*TxData++) = 0x00;
hu's avatar
hu committed
712
        (*TxData++) = K_Line_Set.K_Line_LID22;
hu's avatar
hu committed
713 714
        Tx_Len = 4;
        break;
hu's avatar
hu committed
715
    case 0x23: /* 驻车锁定 */
hu's avatar
hu committed
716 717 718
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x23;
        (*TxData++) = 0x00;
hu's avatar
hu committed
719
        (*TxData++) = K_Line_Set.K_Line_LID23;
hu's avatar
hu committed
720 721
        Tx_Len = 4;
        break;
hu's avatar
hu committed
722
    case 0x24: /* HSA */
hu's avatar
hu committed
723 724 725
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x24;
        (*TxData++) = 0x00;
hu's avatar
hu committed
726
        (*TxData++) = K_Line_Set.K_Line_LID24;
hu's avatar
hu committed
727 728
        Tx_Len = 4;
        break;
hu's avatar
hu committed
729
    case 0x25: /* AEBS */
hu's avatar
hu committed
730 731 732
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x25;
        (*TxData++) = 0x00;
hu's avatar
hu committed
733
        (*TxData++) = K_Line_Set.K_Line_LID25;
hu's avatar
hu committed
734 735
        Tx_Len = 4;
        break;
hu's avatar
hu committed
736
    case 0x26: /* ACC */
hu's avatar
hu committed
737 738 739
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x26;
        (*TxData++) = 0x00;
hu's avatar
hu committed
740
        (*TxData++) = K_Line_Set.K_Line_LID26;
hu's avatar
hu committed
741 742
        Tx_Len = 4;
        break;
hu's avatar
hu committed
743
    case 0x27: /* LDWS */
hu's avatar
hu committed
744 745 746
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x27;
        (*TxData++) = 0x00;
hu's avatar
hu committed
747
        (*TxData++) = K_Line_Set.K_Line_LID27;
hu's avatar
hu committed
748 749
        Tx_Len = 4;
        break;
hu's avatar
hu committed
750
    case 0x28: /* 车辆间报警 */
hu's avatar
hu committed
751 752 753
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x28;
        (*TxData++) = 0x00;
hu's avatar
hu committed
754
        (*TxData++) = K_Line_Set.K_Line_LID28;
hu's avatar
hu committed
755 756
        Tx_Len = 4;
        break;
hu's avatar
hu committed
757
    case 0x29: /* 有无巡航 */
hu's avatar
hu committed
758 759 760
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x29;
        (*TxData++) = 0x00;
hu's avatar
hu committed
761
        (*TxData++) = K_Line_Set.K_Line_LID29;
hu's avatar
hu committed
762 763
        Tx_Len = 4;
        break;
hu's avatar
hu committed
764
    case 0x2A: /* 气悬 */
hu's avatar
hu committed
765 766 767
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2A;
        (*TxData++) = 0x00;
hu's avatar
hu committed
768
        (*TxData++) = K_Line_Set.K_Line_LID2A;
hu's avatar
hu committed
769 770
        Tx_Len = 4;
        break;
hu's avatar
hu committed
771
    case 0x2B: /* ISS */
hu's avatar
hu committed
772 773 774
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2B;
        (*TxData++) = 0x00;
hu's avatar
hu committed
775
        (*TxData++) = K_Line_Set.K_Line_LID2B;
hu's avatar
hu committed
776 777
        Tx_Len = 4;
        break;
hu's avatar
hu committed
778
    case 0x2C: /* װ装货台工作警报蜂鸣器 */
hu's avatar
hu committed
779 780 781
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2C;
        (*TxData++) = 0x00;
hu's avatar
hu committed
782
        (*TxData++) = K_Line_Set.K_Line_LID2C;
hu's avatar
hu committed
783 784
        Tx_Len = 4;
        break;
hu's avatar
hu committed
785
    case 0x2D: /* ROWS */
hu's avatar
hu committed
786 787 788
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2D;
        (*TxData++) = 0x00;
hu's avatar
hu committed
789
        (*TxData++) = K_Line_Set.K_Line_LID2D;
hu's avatar
hu committed
790 791
        Tx_Len = 4;
        break;
hu's avatar
hu committed
792
    case 0x2E: /* 行车记录仪 */
hu's avatar
hu committed
793 794 795
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2E;
        (*TxData++) = 0x00;
hu's avatar
hu committed
796
        (*TxData++) = K_Line_Set.K_Line_LID2E;
hu's avatar
hu committed
797 798
        Tx_Len = 4;
        break;
hu's avatar
hu committed
799
    case 0x2F: /* 车型 */
hu's avatar
hu committed
800 801 802
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x2F;
        (*TxData++) = 0x00;
hu's avatar
hu committed
803
        (*TxData++) = K_Line_Set.K_Line_LID2F;
hu's avatar
hu committed
804 805
        Tx_Len = 4;
        break;
hu's avatar
hu committed
806
    case 0x30: /* 缓速器 */
hu's avatar
hu committed
807 808 809
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x30;
        (*TxData++) = 0x00;
hu's avatar
hu committed
810
        (*TxData++) = K_Line_Set.K_Line_LID30;
hu's avatar
hu committed
811 812
        Tx_Len = 4;
        break;
hu's avatar
hu committed
813
    case 0x31: /* 地图巡航 */
hu's avatar
hu committed
814 815 816
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x31;
        (*TxData++) = 0x00;
hu's avatar
hu committed
817
        (*TxData++) = K_Line_Set.K_Line_LID31;
hu's avatar
hu committed
818 819
        Tx_Len = 4;
        break;
hu's avatar
hu committed
820
    case 0x32: /* 装货台种类 */
hu's avatar
hu committed
821 822 823
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x32;
        (*TxData++) = 0x00;
hu's avatar
hu committed
824
        (*TxData++) = K_Line_Set.K_Line_LID32;
hu's avatar
hu committed
825 826
        Tx_Len = 4;
        break;
hu's avatar
hu committed
827
    case 0x33: /*  SCR?DPD */
hu's avatar
hu committed
828 829 830
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x33;
        (*TxData++) = 0x00;
hu's avatar
hu committed
831
        (*TxData++) = K_Line_Set.K_Line_LID33;
hu's avatar
hu committed
832 833
        Tx_Len = 4;
        break;
hu's avatar
hu committed
834
    case 0x34: /* 驻车种类 */
hu's avatar
hu committed
835 836 837
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x34;
        (*TxData++) = 0x00;
hu's avatar
hu committed
838
        (*TxData++) = K_Line_Set.K_Line_LID34;
hu's avatar
hu committed
839 840
        Tx_Len = 4;
        break;
hu's avatar
hu committed
841
    case 0x35: /* 气压计 */
hu's avatar
hu committed
842 843 844
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x35;
        (*TxData++) = 0x00;
hu's avatar
hu committed
845
        (*TxData++) = K_Line_Set.K_Line_LID35;
hu's avatar
hu committed
846 847
        Tx_Len = 4;
        break;
hu's avatar
hu committed
848
    case 0x36: /* 低压警报 */
hu's avatar
hu committed
849 850 851
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x36;
        (*TxData++) = 0x00;
hu's avatar
hu committed
852
        (*TxData++) = K_Line_Set.K_Line_LID36;
hu's avatar
hu committed
853 854
        Tx_Len = 4;
        break;
hu's avatar
hu committed
855
    case 0x37: /* 超限警报 */
hu's avatar
hu committed
856 857 858
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x37;
        (*TxData++) = 0x00;
hu's avatar
hu committed
859
        (*TxData++) = K_Line_Set.K_Line_LID37;
hu's avatar
hu committed
860 861
        Tx_Len = 4;
        break;
hu's avatar
hu committed
862
    case 0x38: /* 速度警报 */
hu's avatar
hu committed
863 864 865
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x38;
        (*TxData++) = 0x00;
hu's avatar
hu committed
866
        (*TxData++) = K_Line_Set.K_Line_LID38;
hu's avatar
hu committed
867 868
        Tx_Len = 4;
        break;
hu's avatar
hu committed
869
    case 0x39: /* 可变SLD */
hu's avatar
hu committed
870 871 872
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x39;
        (*TxData++) = 0x00;
hu's avatar
hu committed
873
        (*TxData++) = K_Line_Set.K_Line_LID39;
hu's avatar
hu committed
874 875
        Tx_Len = 4;
        break;
hu's avatar
hu committed
876
    case 0x3A: /* OEM */
hu's avatar
hu committed
877 878 879
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3A;
        (*TxData++) = 0x00;
hu's avatar
hu committed
880
        (*TxData++) = K_Line_Set.K_Line_LID3A;
hu's avatar
hu committed
881 882
        Tx_Len = 4;
        break;
hu's avatar
hu committed
883
    case 0x3B: /*  */
hu's avatar
hu committed
884 885 886
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3B;
        (*TxData++) = 0x00;
hu's avatar
hu committed
887
        (*TxData++) = K_Line_Set.K_Line_LID3B;
hu's avatar
hu committed
888 889
        Tx_Len = 4;
        break;
hu's avatar
hu committed
890
    case 0x3C: /*  */
hu's avatar
hu committed
891 892 893
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3C;
        (*TxData++) = 0x00;
hu's avatar
hu committed
894
        (*TxData++) = K_Line_Set.K_Line_LID3C;
hu's avatar
hu committed
895 896
        Tx_Len = 4;
        break;
hu's avatar
hu committed
897
    case 0x3D: /*  */
hu's avatar
hu committed
898 899 900
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3D;
        (*TxData++) = 0x00;
hu's avatar
hu committed
901
        (*TxData++) = K_Line_Set.K_Line_LID3D;
hu's avatar
hu committed
902 903
        Tx_Len = 4;
        break;
hu's avatar
hu committed
904
    case 0x3E: /*  */
hu's avatar
hu committed
905 906 907
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3E;
        (*TxData++) = 0x00;
hu's avatar
hu committed
908
        (*TxData++) = K_Line_Set.K_Line_LID3E;
hu's avatar
hu committed
909 910
        Tx_Len = 4;
        break;
hu's avatar
hu committed
911
    case 0x3F: /*  */
hu's avatar
hu committed
912 913 914
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x3F;
        (*TxData++) = 0x00;
hu's avatar
hu committed
915
        (*TxData++) = K_Line_Set.K_Line_LID3F;
hu's avatar
hu committed
916 917
        Tx_Len = 4;
        break;
hu's avatar
hu committed
918
    case 0x40: /* 发动机种类 */
hu's avatar
hu committed
919 920 921
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x40;
        (*TxData++) = 0x00;
hu's avatar
hu committed
922
        (*TxData++) = K_Line_Set.K_Line_LID40;
hu's avatar
hu committed
923 924
        Tx_Len = 4;
        break;
hu's avatar
hu committed
925
    case 0x41: /* 变速器种类&控制 */
hu's avatar
hu committed
926 927 928
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x41;
        (*TxData++) = 0x00;
hu's avatar
hu committed
929
        (*TxData++) = K_Line_Set.K_Line_LID41;
hu's avatar
hu committed
930 931
        Tx_Len = 4;
        break;
hu's avatar
hu committed
932
    case 0x42: /* 5.2.14.1.4.  驻车管道*/
hu's avatar
hu committed
933 934 935
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x42;
        (*TxData++) = 0x00;
hu's avatar
hu committed
936
        (*TxData++) = K_Line_Set.K_Line_LID42;
hu's avatar
hu committed
937 938
        Tx_Len = 4;
        break;
hu's avatar
hu committed
939
    case 0x43: /* 5.2.14.1.5.  车型 */
hu's avatar
hu committed
940 941 942
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x43;
        (*TxData++) = 0x00;
hu's avatar
hu committed
943
        (*TxData++) = K_Line_Set.K_Line_LID43;
hu's avatar
hu committed
944 945
        Tx_Len = 4;
        break;
hu's avatar
hu committed
946
    case 0x44: /* 速度警报 */
hu's avatar
hu committed
947 948 949
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x44;
        (*TxData++) = 0x00;
hu's avatar
hu committed
950
        (*TxData++) = K_Line_Set.K_Line_LID44;
hu's avatar
hu committed
951 952
        Tx_Len = 4;
        break;
hu's avatar
hu committed
953
    case 0x45: /* 发动机转速 */
hu's avatar
hu committed
954 955 956
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x45;
        (*TxData++) = 0x00;
hu's avatar
hu committed
957
        (*TxData++) = K_Line_Set.K_Line_LID45;
hu's avatar
hu committed
958 959
        Tx_Len = 4;
        break;
hu's avatar
hu committed
960
    case 0x46: /* 急加速 */
hu's avatar
hu committed
961 962 963
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x46;
        (*TxData++) = 0x00;
hu's avatar
hu committed
964
        (*TxData++) = K_Line_Set.K_Line_LID46;
hu's avatar
hu committed
965 966
        Tx_Len = 4;
        break;
hu's avatar
hu committed
967
    case 0x47: /* 急减速 */
hu's avatar
hu committed
968 969 970
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x47;
        (*TxData++) = 0x00;
hu's avatar
hu committed
971
        (*TxData++) = K_Line_Set.K_Line_LID47;
hu's avatar
hu committed
972 973
        Tx_Len = 4;
        break;
hu's avatar
hu committed
974
    case 0x48: /* 长时间怠速 */
hu's avatar
hu committed
975 976 977
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x48;
        (*TxData++) = 0x00;
hu's avatar
hu committed
978
        (*TxData++) = K_Line_Set.K_Line_LID48;
hu's avatar
hu committed
979 980
        Tx_Len = 4;
        break;
hu's avatar
hu committed
981
    case 0x49: /* 辅助驻车 */
hu's avatar
hu committed
982 983 984
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x49;
        (*TxData++) = 0x00;
hu's avatar
hu committed
985
        (*TxData++) = K_Line_Set.K_Line_LID49;
hu's avatar
hu committed
986 987
        Tx_Len = 4;
        break;
hu's avatar
hu committed
988
    case 0x4A: /* 变速箱油 */
hu's avatar
hu committed
989 990 991
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4A;
        (*TxData++) = 0x00;
hu's avatar
hu committed
992
        (*TxData++) = K_Line_Set.K_Line_LID4A;
hu's avatar
hu committed
993 994
        Tx_Len = 4;
        break;
hu's avatar
hu committed
995
    case 0x4B: /* 差速器油 */
hu's avatar
hu committed
996 997 998
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4B;
        (*TxData++) = 0x00;
hu's avatar
hu committed
999
        (*TxData++) = K_Line_Set.K_Line_LID4B;
hu's avatar
hu committed
1000 1001
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1002
    case 0x4C: /* 离合器油 */
hu's avatar
hu committed
1003 1004 1005
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4C;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1006
        (*TxData++) = K_Line_Set.K_Line_LID4C;
hu's avatar
hu committed
1007 1008
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1009
    case 0x4D: /* 动力转向油 */
hu's avatar
hu committed
1010 1011 1012
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4D;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1013
        (*TxData++) = K_Line_Set.K_Line_LID4D;
hu's avatar
hu committed
1014 1015
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1016
    case 0x4E: /* 轮胎 */
hu's avatar
hu committed
1017 1018 1019
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4E;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1020
        (*TxData++) = K_Line_Set.K_Line_LID4E;
hu's avatar
hu committed
1021 1022
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1023
    case 0x4F: /* 机油&滤清器 */
hu's avatar
hu committed
1024 1025 1026
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x4F;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1027
        (*TxData++) = K_Line_Set.K_Line_LID4F;
hu's avatar
hu committed
1028 1029
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1030
    case 0x50: /* 预留 */
hu's avatar
hu committed
1031 1032 1033
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x50;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1034
        (*TxData++) = K_Line_Set.K_Line_LID50;
hu's avatar
hu committed
1035 1036
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1037
    case 0x51: /* 5.2.14.1.8.  工作模式 */
hu's avatar
hu committed
1038 1039 1040
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x51;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1041
        (*TxData++) = K_Line_Set.K_Line_LID51;
hu's avatar
hu committed
1042 1043
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1044
    case 0x52: /* 5.2.14.1.9.  电子部件设定 */
hu's avatar
hu committed
1045 1046 1047
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x52;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1048
        (*TxData++) = K_Line_Set.K_Line_LID52;
hu's avatar
hu committed
1049 1050 1051
        Tx_Len = 4;
        break;

hu's avatar
hu committed
1052
    case 0xA0: /*  */
hu's avatar
hu committed
1053 1054 1055
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0xA0;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1056
        (*TxData++) = K_Line_Set.TesterECU;
hu's avatar
hu committed
1057 1058
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1059
    case 0xA3: /*  */
hu's avatar
hu committed
1060 1061 1062
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0xA3;
        (*TxData++) = 0x00;
hu's avatar
hu committed
1063
        (*TxData++) = K_Line_Set.TesterECUCAN;
hu's avatar
hu committed
1064 1065
        Tx_Len = 4;
        break;
hu's avatar
hu committed
1066
    case 0xA1: /*  */
hu's avatar
hu committed
1067
    /*
hu's avatar
hu committed
1068
    K_Line_Set.ECUStatus1 = ECUStatusONE.Data[0];
hu's avatar
hu committed
1069 1070

    if (DataVSpeedDisp <= 1275)
hu's avatar
hu committed
1071
        K_Line_Set.ECUStatus2 = DataVSpeedDisp / 5 ;
hu's avatar
hu committed
1072 1073

    ECUStatusCup = ECUSTATUST_F ;
hu's avatar
hu committed
1074 1075
    K_Line_Set.ECUStatus3 = (unsigned char)(ECUStatusCup & 0xFF);
    K_Line_Set.ECUStatus4 = (unsigned char)((ECUStatusCup >> 8) & 0xFF);
hu's avatar
hu committed
1076

hu's avatar
hu committed
1077
    K_Line_Set.ECUStatus5 = 0x80;
hu's avatar
hu committed
1078 1079 1080

    (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
    (*TxData++) = 0xA1;
hu's avatar
hu committed
1081 1082 1083 1084 1085
    (*TxData++) = K_Line_Set.ECUStatus1;
    (*TxData++) = K_Line_Set.ECUStatus2;
    (*TxData++) = K_Line_Set.ECUStatus3;
    (*TxData++) = K_Line_Set.ECUStatus4;
    (*TxData++) = K_Line_Set.ECUStatus5;
hu's avatar
hu committed
1086 1087 1088
    Tx_Len = 7;
    break;
    */
hu's avatar
hu committed
1089
    case 0xA2: /*  */
hu's avatar
hu committed
1090 1091
        (*TxData++) = KWP2000_READDATABYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0xA2;
hu's avatar
hu committed
1092
        (*TxData++) = K_Line_Set.METERCOUNT; /*修正率替换次数*/
hu's avatar
hu committed
1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111
        Tx_Len = 3;
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readDataByCommonIdentifier
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 22
--------------------------------------------------------------------------*/
unsigned char kwp_readDataByCommonIdentifier(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
1112

hu's avatar
hu committed
1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126
    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readDataAccessMode
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 27
--------------------------------------------------------------------------*/
unsigned char kwp_readDataAccessMode(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;

hu's avatar
hu committed
1127
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
1128
    {
hu's avatar
hu committed
1129
    case 0x01: /*  */
hu's avatar
hu committed
1130
        if (K_Line_Set.KLINE == 1)/*是否锁定标记*/
hu's avatar
hu committed
1131
        {
hu's avatar
hu committed
1132
            /*密钥随机数生成*/
1133 1134
            EOLSeedRandomNumber = (unsigned long)(EOLSeedRandomNumber * 1103515245ul + 12345u);
            SeedKey = (unsigned long)EOLSeedRandomNumber;
hu's avatar
hu committed
1135 1136
            //SeedKey = SeedKey << 16;
            //SeedKey |= (unsigned long)(~EOLSeedRandomNumber);
hu's avatar
hu committed
1137 1138 1139 1140 1141

            Seed1 = (unsigned char)(SeedKey >> 24);
            Seed2 = (unsigned char)(SeedKey >> 16);
            Seed3 = (unsigned char)(SeedKey >> 8);
            Seed4 = (unsigned char)(SeedKey);
hu's avatar
hu committed
1142 1143 1144

            /*计算密钥等待应答*/
            App_Uds_Calc_Key();
hu's avatar
hu committed
1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162

            K_LINE_SIGNAL_FLAG.AccessMode2701 = 1;
            AccessMode2701KeyTime = 0;
            AccessMode2701KeyTimeFlag = 1;

            (*TxData++) = KWP2000_SECURITYACCESS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x01;
            (*TxData++) = Seed1;
            (*TxData++) = Seed2;
            (*TxData++) = Seed3;
            (*TxData++) = Seed4;
            Tx_Len = 6;
        }
        else
        {
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        }
        break;
hu's avatar
hu committed
1163 1164 1165 1166 1167
    case 0x02: /*  */
        Recvseed1 = RequestData[1];
        Recvseed2 = RequestData[2];
        Recvseed3 = RequestData[3];
        Recvseed4 = RequestData[4];
hu's avatar
hu committed
1168
        if (
hu's avatar
hu committed
1169 1170 1171 1172 1173
            (Sendseed1 == Recvseed1) &&
            (Sendseed2 == Recvseed2) &&
            (Sendseed3 == Recvseed3) &&
            (Sendseed4 == Recvseed4) &&
            (AccessMode2701KeyTimeFlag == 1))
hu's avatar
hu committed
1174
        {
hu's avatar
hu committed
1175
            K_LINE_SIGNAL_FLAG.AccessMode2701 = 0;
hu's avatar
hu committed
1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206
            AccessMode2701KeyTimeFlag = 1;

            K_LINE_SIGNAL_FLAG.SendSeedEQUSRecvSeed = 1;
            (*TxData++) = KWP2000_SECURITYACCESS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0x02;
            Tx_Len = 2;
        }
        else
        {
            K_LINE_SIGNAL_FLAG.SendSeedEQUSRecvSeed = 0;
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        }
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }

    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readDataAccessMode
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 31
--------------------------------------------------------------------------*/
unsigned char kwp_StartroutInebykocalIdentifier(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
1207

hu's avatar
hu committed
1208
    switch (RequestData[0]) /*  */
hu's avatar
hu committed
1209
    {
hu's avatar
hu committed
1210
    case 0x08: /*  */
hu's avatar
hu committed
1211 1212
        K_LINE_SIGNAL_FLAG.S_Regist = 1;
        K_Line_Set.KLINE = 1 ;
hu's avatar
hu committed
1213
        /*写EEP*/
hu's avatar
hu committed
1214
        DTCstatusCHGFFK_Line = 1;
hu's avatar
hu committed
1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235
        (*TxData++) = KWP2000_STARTROUTINEBYLOCALIDENTIFIER_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
        (*TxData++) = 0x08;
        Tx_Len = 2;
        break;
    default: /*  */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_readDataStatusofDTC
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 18
--------------------------------------------------------------------------*/
unsigned char kwp_readDataStatusofDTC(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
1236

hu's avatar
hu committed
1237
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
1238
    {
hu's avatar
hu committed
1239
    case 0x00: /*  */
hu's avatar
hu committed
1240 1241 1242 1243
    /*
    if ((RequestData[1] == 0xFF)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1244
      (*TxData++) = K_Line_Set.NoOfDTCFF00;
hu's avatar
hu committed
1245 1246 1247 1248 1249
      Tx_Len = 2;
    }
    else if ((RequestData[1] == 0x80)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1250
      (*TxData++) = K_Line_Set.NoOfDTC8000;
hu's avatar
hu committed
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263
      Tx_Len = 2;
    }
    else
    {
      Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
    }
    break;
    */
    case 0x01:
    /*
    if ((RequestData[1] == 0xFF)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1264
      (*TxData++) = K_Line_Set.NoOfDTCFF01;
hu's avatar
hu committed
1265 1266 1267 1268 1269
      Tx_Len = 2;
    }
    else if ((RequestData[1] == 0x80)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1270
      (*TxData++) = K_Line_Set.NoOfDTC8001;
hu's avatar
hu committed
1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283
      Tx_Len = 2;
    }
    else
    {
      Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
    }
    break;
    */
    case 0x02:
    /*
    if ((RequestData[1] == 0xFF)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1284
      (*TxData++) = K_Line_Set.NoOfDTCFF02;
hu's avatar
hu committed
1285 1286 1287 1288 1289
      Tx_Len = 2;
    }
    else if ((RequestData[1] == 0x80)&&(RequestData[2] == 0x00))
    {
      (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1290
      (*TxData++) = K_Line_Set.NoOfDTC8002;
hu's avatar
hu committed
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302
      Tx_Len = 2;
    }
    else
    {
      Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
    }
    break;
    */
    case 0x03:
        if ((RequestData[1] == 0xFF) && (RequestData[2] == 0x00))
        {
            (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1303
            (*TxData++) = K_Line_Set.NoOfDTCFF00;
hu's avatar
hu committed
1304 1305 1306 1307 1308
            Tx_Len = 2;
        }
        else if ((RequestData[1] == 0x80) && (RequestData[2] == 0x00))
        {
            (*TxData++) = KWP2000_READDIAGNOSTICTROUBLECODESBYSTATUS_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
hu's avatar
hu committed
1309
            (*TxData++) = K_Line_Set.NoOfDTC8000;
hu's avatar
hu committed
1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333
            Tx_Len = 2;
        }
        else
        {
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        }
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : kwp_ClearDiagnosticInformation
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         : 14
--------------------------------------------------------------------------*/
unsigned char kwp_ClearDiagnosticInformation(unsigned char *TxData, unsigned char *RequestData)
{
    unsigned char Tx_Len = 0;
hu's avatar
hu committed
1334

hu's avatar
hu committed
1335
    switch (RequestData[0]) /* subFunction */
hu's avatar
hu committed
1336
    {
hu's avatar
hu committed
1337
    case 0xFF: /*  */
hu's avatar
hu committed
1338 1339 1340 1341 1342
        if (RequestData[1] == 0x00)
        {
            (*TxData++) = KWP2000_CLEARDIAGNOSTICINFORMATION_REQUEST + KWP2000_POSITIVE_RESPONSE_OFFSET;
            (*TxData++) = 0xFF;
            (*TxData++) = 0x00;
hu's avatar
hu committed
1343
            // K_Line_Set.NoOfDTCFF00 == 0x00;
hu's avatar
hu committed
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366
            Tx_Len = 3;
        }
        else
        {
            Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        }
        break;
    default: /* subFunctionNotSupported */
        Kwp2000_Negative.ResponseCode = KWP2000_subFunctionNotSupported;
        break;
    }
    return Tx_Len;
}
/*-------------------------------------------------------------------------
* Function Name  : App_Uds_Calc_Key
* Description    :
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
void App_Uds_Calc_Key(void)
{
hu's avatar
hu committed
1367 1368 1369 1370
    unsigned char CupChar1 = 0;
    unsigned char CupChar2 = 0;
    unsigned char CupChar3 = 0;
    unsigned char CupChar4 = 0;
hu's avatar
hu committed
1371

hu's avatar
hu committed
1372 1373 1374 1375
    unsigned char CupChar5 = 0;
    unsigned char CupChar6 = 0;
    unsigned char CupChar7 = 0;
    unsigned char CupChar8 = 0;
hu's avatar
hu committed
1376

hu's avatar
hu committed
1377
    unsigned char CupChar9 = 0;
hu's avatar
hu committed
1378 1379 1380 1381
    unsigned char CupChar10 = 0;
    unsigned char CupChar11 = 0;
    unsigned char CupChar12 = 0;

hu's avatar
hu committed
1382 1383 1384 1385
    CupChar1 = Cup_Key(Seed1, 1, Seed1);
    CupChar2 = Cup_Key(Seed2, 2, Seed2);
    CupChar3 = Cup_Key(Seed3, 3, Seed3);
    CupChar4 = Cup_Key(Seed4, 4, Seed4);
hu's avatar
hu committed
1386

hu's avatar
hu committed
1387 1388 1389 1390
    CupChar5 = Cup_Key(CupChar4, 1, Seed1);
    CupChar6 = Cup_Key(CupChar3, 2, Seed2);
    CupChar7 = Cup_Key(CupChar2, 3, Seed3);
    CupChar8 = Cup_Key(CupChar1, 4, Seed4);
hu's avatar
hu committed
1391

hu's avatar
hu committed
1392 1393 1394 1395
    CupChar9 = Cup_Key(CupChar8, 1, Seed1);
    CupChar10 = Cup_Key(CupChar7, 2, Seed2);
    CupChar11 = Cup_Key(CupChar6, 3, Seed3);
    CupChar12 = Cup_Key(CupChar5, 4, Seed4);
hu's avatar
hu committed
1396

hu's avatar
hu committed
1397 1398 1399 1400
    Sendseed4 = Cup_Key(CupChar12, 1, Seed1);
    Sendseed3 = Cup_Key(CupChar11, 2, Seed2);
    Sendseed2 = Cup_Key(CupChar10, 3, Seed3);
    Sendseed1 = Cup_Key(CupChar9, 4, Seed4);
hu's avatar
hu committed
1401 1402 1403 1404 1405 1406 1407
}

unsigned char Cup_Key(unsigned char KLineseed, unsigned char Num, unsigned char Seed)
{
    unsigned char CupCharL = 0;
    unsigned char CupCharR = 0;

hu's avatar
hu committed
1408 1409
    CupCharL = KLineseed;
    CupCharR = KLineseed;
hu's avatar
hu committed
1410

hu's avatar
hu committed
1411
    CupCharL = (CupCharL << Num);
hu's avatar
hu committed
1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423
    CupCharR = (CupCharR >> (8 - Num));
    CupCharL = (CupCharL | CupCharR);

    CupCharL = (CupCharL ^ Seed);

    CupCharL = (~CupCharL);

    CupCharL = BitReplace(CupCharL);

    return CupCharL;
}

hu's avatar
hu committed
1424
unsigned char BitReplace(unsigned char Data)
hu's avatar
hu committed
1425 1426 1427 1428
{
    unsigned char i = 0;
    unsigned char temp = 0;

hu's avatar
hu committed
1429
    for (i = 0; i < 8; i++)
hu's avatar
hu committed
1430 1431 1432 1433 1434 1435
    {
        temp = temp << 1;
        temp |= (Data >> i) & 0x01;
    }

    return temp;
hu's avatar
hu committed
1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
}

unsigned char Common_Get_DTCstatusCHGFFK_Flag(void)
{
    return DTCstatusCHGFFK_Line;
}

void Common_Set_DTCstatusCHGFFK_Flag(unsigned char Val)
{
    DTCstatusCHGFFK_Line = Val;
}

hu's avatar
hu committed
1448 1449 1450 1451 1452 1453 1454 1455
/*-------------------------------------------------------------------------
* Function Name  : K_LINE_EOL_InitVal
* Description    : k-line数据初始化
* Input          :
* Output         : None
* Return         : None
* onther         :
--------------------------------------------------------------------------*/
1456
#if  TEST_TYPE == 0
hu's avatar
hu committed
1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467
void K_LINE_EOL_InitVal(void)
{
    K_Line_Set.Flag = 0x7AA7A55Au;

    K_Line_Set.K_Line_LID20 = 0x00u; /* 00 应对ECE R13      //0:非应对、1:应对 */
    K_Line_Set.K_Line_LID21 = 0x00u; /* 00 EBS/ABS         //0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对) */
    K_Line_Set.K_Line_LID22 = 0x00u; /* 00 EVSC            //0:无、1:有 */
    K_Line_Set.K_Line_LID23 = 0x00u; /* 00 驻车锁定         //0:无、1:有 */
    K_Line_Set.K_Line_LID24 = 0x00u; /* 00 HSA             //0:无、1:有 */
    K_Line_Set.K_Line_LID25 = 0x00u; /* 00 AEBS            //0:无、1:有 */
    K_Line_Set.K_Line_LID26 = 0x00u; /* 00 ACC             //0:无、1:有 */
hu's avatar
hu committed
1468 1469
    K_Line_Set.K_Line_LID27 = 0x00u; /* 00 LDWS            //0:无、1:有 */
    K_Line_Set.K_Line_LID28 = 0x00u; /* 01 车辆间报警        //0:无、1:有 */
hu's avatar
hu committed
1470 1471 1472 1473 1474 1475 1476 1477 1478 1479
    K_Line_Set.K_Line_LID29 = 0x01u; /* 01 有无巡航          //0:无、1:有          /*初值1*/
    K_Line_Set.K_Line_LID2A = 0x00u; /* 00 气悬             //0:Reef、1:Rear air、2:Full air */
    K_Line_Set.K_Line_LID2B = 0x00u; /* 00 ISS             //0:无、1: eco stop、 2:Idle Stop */
    K_Line_Set.K_Line_LID2C = 0x00u; /* 00 装货台工作警报蜂鸣 //0:无、1:有             */
    K_Line_Set.K_Line_LID2D = 0x00u; /* 00 ROWS            //0:无、1:ROWS有、2LOCAL警报有 */
    K_Line_Set.K_Line_LID2E = 0x00u; /* 00 行车记录仪        //0:模拟记录仪、1:数字记录仪或行车记录仪 */
    K_Line_Set.K_Line_LID2F = 0x00u; /* 00 车型             //0:单车、1:拖车、2:全拖车 */
    K_Line_Set.K_Line_LID30 = 0x00u; /* 00 缓速器           //0:无、1:有(C&E)、2:有(F) */
    K_Line_Set.K_Line_LID31 = 0x01u; /* -- 定速巡航         //0:无、1:有 */
    K_Line_Set.K_Line_LID32 = 0x00u; /* 00 装货台种类       //0:一般、1:侧翼、2:倾倒 */
hu's avatar
hu committed
1480
    K_Line_Set.K_Line_LID33 = 0x00u; /* 01 SCR?DPD         //0:SCR无/DPD有、1:SCR有/DPD有、2:SCR无/DPD无、3:SCR有/DPD无    /*初值1*/
hu's avatar
hu committed
1481 1482 1483 1484 1485 1486 1487 1488 1489 1490
    K_Line_Set.K_Line_LID34 = 0x00u; /* 00 驻车种类         //0:FULL AIR、1:AOH                     /*初值1*/
    K_Line_Set.K_Line_LID35 = 0x00u; /* -- 气压计           //0:2针式、1:1针式 */
    K_Line_Set.K_Line_LID36 = 0x00u; /* -- 低压警报压       //0:一般输出(539kPa)、1:ADR(588kPa) */
    K_Line_Set.K_Line_LID37 = 0x01u; /* -- 超限警报         //0:无、1:有 */
    K_Line_Set.K_Line_LID38 = 0x01u; /* -- 速度警报         //0:无、1:有 */
    K_Line_Set.K_Line_LID39 = 0x00u; /* 00 可变SLD          //0:无、1:1车速、2:2车速            /*初值1*/
    K_Line_Set.K_Line_LID3A = 0x00u; /* -- OEM             //0:ISZ、1:UDT */
    K_Line_Set.K_Line_LID3B = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID3C = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID3D = 0x00u; /* -- 预留 */
hu's avatar
hu committed
1491
    K_Line_Set.K_Line_LID3E = 0x00u; /* 01 胎压匹配功能      //0:胎压功能未匹配    1:匹配 */
hu's avatar
hu committed
1492 1493
    K_Line_Set.K_Line_LID3F = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID40 = 0x00u; /* 00 发动机种类 */
hu's avatar
hu committed
1494
    K_Line_Set.K_Line_LID41 = 0x01u; /* 50 变速器种类&控制 /*初值50*/
hu's avatar
hu committed
1495 1496 1497 1498
    K_Line_Set.K_Line_LID42 = 0x00u; /* 00 驻车管道        /*初值 0*/
    K_Line_Set.K_Line_LID43 = 0x82u; /* 82 车型            /*初值44*/
    K_Line_Set.K_Line_LID44 = 0xFFu; /* FF 速度警报        /*初值FF*/
    K_Line_Set.K_Line_LID45 = 0xFFu; /* FF 发动机转速      /*初值FF*/
hu's avatar
hu committed
1499
    K_Line_Set.K_Line_LID46 = 0xFFu; /* FF 急加速          /*初FF*/
hu's avatar
hu committed
1500 1501 1502 1503 1504 1505 1506
    K_Line_Set.K_Line_LID47 = 0xFFu; /* FF 急减速          /*初值FF*/
    K_Line_Set.K_Line_LID48 = 0xFFu; /* FF 长时间怠速      /*初值FF*/
    K_Line_Set.K_Line_LID49 = 0xFFu; /* FF 辅助驻车        /*初值FF*/
    K_Line_Set.K_Line_LID4A = 0x32u; /* 37 变速箱油         55000 */
    K_Line_Set.K_Line_LID4B = 0x32u; /* 37 差速器油         55000 */
    K_Line_Set.K_Line_LID4C = 0x32u; /* 37 离合器油         55000 */
    K_Line_Set.K_Line_LID4D = 0x64u; /* 37 动力转向油        55000 */
hu's avatar
hu committed
1507 1508
    K_Line_Set.K_Line_LID4E = 0x3Cu; /* 32 轮胎             50000 */
    K_Line_Set.K_Line_LID4F = 0x1Eu; /* 34 机油&滤清器      22000 */
hu's avatar
hu committed
1509 1510 1511 1512
    K_Line_Set.K_Line_LID50 = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID51 = 0x01u; /* 01 工作模式 */
    K_Line_Set.K_Line_LID52 = 0x00u; /* 00 电子部件设定 */

hu's avatar
hu committed
1513 1514 1515
    K_Line_Set.KLINE        = 0x00u;
    K_Line_Set.No_Digit1    = 0x38u; /* 01 */
    K_Line_Set.No_Digit2    = 0x39u; /* 02 */
hu's avatar
hu committed
1516 1517 1518 1519 1520 1521 1522
    K_Line_Set.No_Digit3    = 0x38u; /* 03 */
    K_Line_Set.No_Digit4    = 0x31u; /* 04 */
    K_Line_Set.No_Digit5    = 0x38u; /* 05 */
    K_Line_Set.No_Digit6    = 0x30u; /* 06 */
    K_Line_Set.No_Digit7    = 0x36u; /* 07 */
    K_Line_Set.No_Digit8    = 0x35u; /* 08 */
    K_Line_Set.No_Digit9    = 0x33u; /* 09 */
hu's avatar
hu committed
1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535
    K_Line_Set.No_Digit10   = 0x30u; /* 10 */
    K_Line_Set.ECUStatus1   = 0x00u; /* 11 */
    K_Line_Set.ECUStatus2   = 0x00u; /* 12 */
    K_Line_Set.ECUStatus3   = 0x00u; /* 13 */
    K_Line_Set.ECUStatus4   = 0x00u; /* 14 */
    K_Line_Set.ECUStatus5   = 0x00u; /* 15 */
    K_Line_Set.METERCOUNT   = 0x00u; /* 16 */
    K_Line_Set.NoOfDTCFF00  = 0x00u; /* 17 */
    K_Line_Set.NoOfDTC8000  = 0x00u; /* 18 */
    K_Line_Set.TesterECU    = 0x00u; /* 19 */
    K_Line_Set.TesterECUCAN = 0x00u; /* 20 */
    K_Line_Set.User_Light1  = 10u;   /*背光亮度等级*/
    K_Line_Set.User_Light2  = 10u;   /*背光亮度等级*/
1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618
}
#else
void K_LINE_EOL_InitVal(void)
{
    K_Line_Set.Flag = 0x7AA7A55Bu;

    K_Line_Set.K_Line_LID20 = 0x00u; /* 00 应对ECE R13      //0:非应对、1:应对 */
    K_Line_Set.K_Line_LID21 = 0x01u; /* 00 EBS/ABS         //0:无、1:EBS、2:ABS(CAN应对) 3:ABS (CAN非应对) */
    K_Line_Set.K_Line_LID22 = 0x01u; /* 00 EVSC            //0:无、1:有 */
    K_Line_Set.K_Line_LID23 = 0x00u; /* 00 驻车锁定         //0:无、1:有 */
    K_Line_Set.K_Line_LID24 = 0x00u; /* 00 HSA             //0:无、1:有 */
    K_Line_Set.K_Line_LID25 = 0x00u; /* 00 AEBS            //0:无、1:有 */
    K_Line_Set.K_Line_LID26 = 0x00u; /* 00 ACC             //0:无、1:有 */
    K_Line_Set.K_Line_LID27 = 0x01u; /* 00 LDWS            //0:无、1:有 */
    K_Line_Set.K_Line_LID28 = 0x01u; /* 01 车辆间报警        //0:无、1:有 */
    K_Line_Set.K_Line_LID29 = 0x01u; /* 01 有无巡航          //0:无、1:有          /*初值1*/
    K_Line_Set.K_Line_LID2A = 0x01u; /* 00 气悬             //0:Reef、1:Rear air、2:Full air */
    K_Line_Set.K_Line_LID2B = 0x00u; /* 00 ISS             //0:无、1: eco stop、 2:Idle Stop */
    K_Line_Set.K_Line_LID2C = 0x01u; /* 00 装货台工作警报蜂鸣 //0:无、1:有             */
    K_Line_Set.K_Line_LID2D = 0x00u; /* 00 ROWS            //0:无、1:ROWS有、2LOCAL警报有 */
    K_Line_Set.K_Line_LID2E = 0x00u; /* 00 行车记录仪        //0:模拟记录仪、1:数字记录仪或行车记录仪 */
    K_Line_Set.K_Line_LID2F = 0x00u; /* 00 车型             //0:单车、1:拖车、2:全拖车 */
    K_Line_Set.K_Line_LID30 = 0x00u; /* 00 缓速器           //0:无、1:有(C&E)、2:有(F) */
    K_Line_Set.K_Line_LID31 = 0x01u; /* -- 定速巡航         //0:无、1:有 */
    K_Line_Set.K_Line_LID32 = 0x00u; /* 00 装货台种类       //0:一般、1:侧翼、2:倾倒 */
    K_Line_Set.K_Line_LID33 = 0x00u; /* 01 SCR?DPD         //0:SCR无/DPD有、1:SCR有/DPD有、2:SCR无/DPD无、3:SCR有/DPD无    /*初值1*/
    K_Line_Set.K_Line_LID34 = 0x00u; /* 00 驻车种类         //0:FULL AIR、1:AOH                     /*初值1*/
    K_Line_Set.K_Line_LID35 = 0x00u; /* -- 气压计           //0:2针式、1:1针式 */
    K_Line_Set.K_Line_LID36 = 0x00u; /* -- 低压警报压       //0:一般输出(539kPa)、1:ADR(588kPa) */
    K_Line_Set.K_Line_LID37 = 0x01u; /* -- 超限警报         //0:无、1:有 */
    K_Line_Set.K_Line_LID38 = 0x01u; /* -- 速度警报         //0:无、1:有 */
    K_Line_Set.K_Line_LID39 = 0x01u; /* 00 可变SLD          //0:无、1:1车速、2:2车速            /*初值1*/
    K_Line_Set.K_Line_LID3A = 0x00u; /* -- OEM             //0:ISZ、1:UDT */
    K_Line_Set.K_Line_LID3B = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID3C = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID3D = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID3E = 0x01u; /* 01 胎压匹配功能      //0:胎压功能未匹配    1:匹配 */
    K_Line_Set.K_Line_LID3F = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID40 = 0x00u; /* 00 发动机种类 */
    K_Line_Set.K_Line_LID41 = 0x13u; /* 50 变速器种类&控制 /*初值50*/
    K_Line_Set.K_Line_LID42 = 0x00u; /* 00 驻车管道        /*初值 0*/
    K_Line_Set.K_Line_LID43 = 0x82u; /* 82 车型            /*初值44*/
    K_Line_Set.K_Line_LID44 = 0xFFu; /* FF 速度警报        /*初值FF*/
    K_Line_Set.K_Line_LID45 = 0xFFu; /* FF 发动机转速      /*初值FF*/
    K_Line_Set.K_Line_LID46 = 0xFFu; /* FF 急加速          /*初FF*/
    K_Line_Set.K_Line_LID47 = 0xFFu; /* FF 急减速          /*初值FF*/
    K_Line_Set.K_Line_LID48 = 0xFFu; /* FF 长时间怠速      /*初值FF*/
    K_Line_Set.K_Line_LID49 = 0xFFu; /* FF 辅助驻车        /*初值FF*/
    K_Line_Set.K_Line_LID4A = 0x32u; /* 37 变速箱油         55000 */
    K_Line_Set.K_Line_LID4B = 0x32u; /* 37 差速器油         55000 */
    K_Line_Set.K_Line_LID4C = 0x32u; /* 37 离合器油         55000 */
    K_Line_Set.K_Line_LID4D = 0x64u; /* 37 动力转向油        55000 */
    K_Line_Set.K_Line_LID4E = 0x3Cu; /* 32 轮胎             50000 */
    K_Line_Set.K_Line_LID4F = 0x1Eu; /* 34 机油&滤清器      22000 */
    K_Line_Set.K_Line_LID50 = 0x00u; /* -- 预留 */
    K_Line_Set.K_Line_LID51 = 0x01u; /* 01 工作模式 */
    K_Line_Set.K_Line_LID52 = 0x00u; /* 00 电子部件设定 */

    K_Line_Set.KLINE        = 0x00u;
    K_Line_Set.No_Digit1    = 0x38u; /* 01 */
    K_Line_Set.No_Digit2    = 0x39u; /* 02 */
    K_Line_Set.No_Digit3    = 0x38u; /* 03 */
    K_Line_Set.No_Digit4    = 0x31u; /* 04 */
    K_Line_Set.No_Digit5    = 0x38u; /* 05 */
    K_Line_Set.No_Digit6    = 0x30u; /* 06 */
    K_Line_Set.No_Digit7    = 0x36u; /* 07 */
    K_Line_Set.No_Digit8    = 0x35u; /* 08 */
    K_Line_Set.No_Digit9    = 0x33u; /* 09 */
    K_Line_Set.No_Digit10   = 0x30u; /* 10 */
    K_Line_Set.ECUStatus1   = 0x00u; /* 11 */
    K_Line_Set.ECUStatus2   = 0x00u; /* 12 */
    K_Line_Set.ECUStatus3   = 0x00u; /* 13 */
    K_Line_Set.ECUStatus4   = 0x00u; /* 14 */
    K_Line_Set.ECUStatus5   = 0x00u; /* 15 */
    K_Line_Set.METERCOUNT   = 0x00u; /* 16 */
    K_Line_Set.NoOfDTCFF00  = 0x00u; /* 17 */
    K_Line_Set.NoOfDTC8000  = 0x00u; /* 18 */
    K_Line_Set.TesterECU    = 0x00u; /* 19 */
    K_Line_Set.TesterECUCAN = 0x00u; /* 20 */
    K_Line_Set.User_Light1  = 10u;   /*背光亮度等级*/
    K_Line_Set.User_Light2  = 10u;   /*背光亮度等级*/
}
#endif