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
#include "UDS_85Service_Main.h"
/**
*85服务函数入口
*@param A_TA_type 收到数据的地址
*@param A_Length 收到数据的长度
*@param A_Data 收到数据的数据
*/
void UDS_Service_85_Indication(uint32_t A_TA_type, uint16_t A_Length, uint8_t A_Data[])
{
uint8_t NRC = positiveResponse;
setDiagMSG(A_TA_type, A_Length, A_Data);
if(NRC == positiveResponse)
{
NRC = UDS_85Service_NRC11(); /*85服务是否支持功能寻址*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_NRC7F(); /*85服务会话是否支持验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC13_MinLengthCheck(); /*85服务最小长度验证S*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC12(); /*85服务子功能是否支持验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC13_TotalLengthCheck(); /*85服务子功能总长度长度验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_NRC33(); /*85服务解锁等级验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_NRC22(); /*85服务条件验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC24(); /*85服务子功能请求顺序验证*/
}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC31(); /*85服务子功能超出请求范围验证*/
}
if(NRC == positiveResponse)
{
UDS_85Service_Sub(); /*85服务子功能*/
}
clearDiagMSG(); /*清除诊断信息*/
}
/**
*10服务子功能
*/
void UDS_85Service_Sub(void)
{
uint8_t NRC = positiveResponse;
/*if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC13_MinLengthCheck(); /*85服务子功能最小长度验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC12(); /*85服务子功能是否支持验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC7E(); /*85服务子功能会话是否支持验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC31(); /*85服务子功能超出请求范围验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC13_TotalLengthCheck(); /*85服务子功能总长度长度验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC24(); /*85服务子功能请求顺序验证*/
/*}
if(NRC == positiveResponse)
{
NRC = UDS_85Service_Sub_NRC22(); /*85服务子功能条件验证*/
/*}*/
if(NRC == positiveResponse)
{
switch(DiagMSG.msgData.SidDetail.SubID) /*子服务判断*/
{
case DTCSettingOn:
UDS_85Service_Sub01(); /*85服务01子功能*/
break;
case DTCSettingOff:
UDS_85Service_Sub02(); /*85服务02子功能*/
break;
default:
break;
}
}
}
/**
*85服务01子功能
*/
void UDS_85Service_Sub01(void)
{
OpenDTCTest();
if(DiagMSG.msgData.SidDetail.PositiveSuppression == 0u)
{
UDS_Service_Response(0x85u, POSITIVE_RSP, DIAG_ID_Tx, 1u, DiagMSG.msgData.Data);
}
}
/**
*85服务02子功能
*/
void UDS_85Service_Sub02(void)
{
CloseDTCTest();
if(DiagMSG.msgData.SidDetail.PositiveSuppression == 0u)
{
UDS_Service_Response(0x85u, POSITIVE_RSP, DIAG_ID_Tx, 1u, DiagMSG.msgData.Data);
}
}