Home » Eclipse Projects » Eclipse Titan » Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder(Unified Diagnostic Services RAW encoder / decoder)
Unified Diagnostic Services (UDS) ISO 14229 decoder / encoder [message #1794920] |
Tue, 11 September 2018 06:43 |
Michael Josenhans Messages: 99 Registered: February 2016 |
Member |
|
|
I have created a subset of the Unified Diagnostic Services (UDS) ISO 14229.
type enumerated SuppressPosRspMsgIndicationBitType {
doNotsuppresssPos (0),
suppresssPos (1)
}
with {variant "FIELDLENGTH(1)"}
type OCT1 DiagnosticSessionType
type record DefaultSessionRequest {
DiagnosticSessionType diagnosticSessionType ('01'O)
} with { variant "" };
type record ProgrammingSessionRequest {
DiagnosticSessionType diagnosticSessionType ('02'O)
} with { variant "" };
type record ExtendedDiagnosticSessionRequest {
DiagnosticSessionType diagnosticSessionType ('03'O)
} with { variant "" };
type record SafetySystemDiagnosticSessionRequest {
DiagnosticSessionType diagnosticSessionType ('04'O)
} with { variant "" };
type union DiagnosticSessionRequestType
{
DefaultSessionRequest defaultSession,
ProgrammingSessionRequest programmingSession,
ExtendedDiagnosticSessionRequest extendedDiagnosticSession,
SafetySystemDiagnosticSessionRequest safetySystemDiagnosticSession
}
with {variant "TAG (
defaultSession, diagnosticSessionType = '01'O;
programmingSession, diagnosticSessionType = '02'O;
extendedDiagnosticSession, diagnosticSessionType = '03'O;
safetySystemDiagnosticSession, diagnosticSessionType = '04'O)";
variant "FIELDLENGTH(7)"
}
type record DiagnosticSessionControlRequestSID
{
SID sid ('10'O),
SuppressPosRspMsgIndicationBitType suppressPosRspMsgIndicationBit,
DiagnosticSessionRequestType diagnosticSessionType
} with { variant "FIELDORDER(msb)" };
type record TesterPresentRequestSID
{
SID sid ('3E'O),
SuppressPosRspMsgIndicationBitType suppressPosRspMsgIndicationBit,
BIT7 zero ('0000000'B)
} with { variant "FIELDORDER(msb)" };
The SuppressPosRspMsgIndicationBitType (1 bit) forms together with the following 7 bit type when encoding / decoding a Byte. That's why I have defined DiagnosticSessionRequestType as FIELDLENGTH(7).
When encoding / decoding DiagnosticSessionRequestType encodes to a 3 byte value instead of the expected 2 byte value '1083'O and decodes even to a differnt than the encoded value (after decoding the suppressPosRspMsgIndicationBit changes from suppresssPos to doNotsuppresssPos):
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := suppresssPos (1), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '100600'O
MTC@Donald: '100600'O
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := suppresssPos (1), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '100600'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Stream before decoding: '100600'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Decoded @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := doNotsuppresssPos (0), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
MTC@Donald: { diagnosticSessionControlRequestSID := { sid := '10'O, suppressPosRspMsgIndicationBit := doNotsuppresssPos (0), diagnosticSessionType := { extendedDiagnosticSession := { diagnosticSessionType := '03'O } } } }
TesterPresentRequestSID with the paramter suppresssPos (1) encodes to '3E80'O, what it should:
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '3E80'O
MTC@Donald: '3E80'O
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Encoding @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: encode_TopLevelMessage_UDS_requests(): Stream after encoding: '3E80'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Stream before decoding: '3E80'O
MTC@Donald: decode_TopLevelMessage_UDS_requests(): Decoded @UnifiedDiagnosticServices.TopLevelMessage_UDS_requests: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
MTC@Donald: { testerPresentRequestSID := { sid := '3E'O (">"), suppressPosRspMsgIndicationBit := suppresssPos (1), zero := '0000000'B } }
Is it necessary to change the DiagnosticSessionRequestType to:
type BIT7 DiagnosticSessionType
type record DefaultSessionRequest {
DiagnosticSessionType diagnosticSessionType ('0000001'B)
} with { variant "" };
type record ProgrammingSessionRequest {
DiagnosticSessionType diagnosticSessionType ('0000010'B)
} with { variant "" };
type record ExtendedDiagnosticSessionRequest {
DiagnosticSessionType diagnosticSessionType ('0000011'B)
} with { variant "" };
type record SafetySystemDiagnosticSessionRequest {
DiagnosticSessionType diagnosticSessionType ('0000100'B)
} with { variant "" };
type union DiagnosticSessionRequestType
{
DefaultSessionRequest defaultSession,
ProgrammingSessionRequest programmingSession,
ExtendedDiagnosticSessionRequest extendedDiagnosticSession,
SafetySystemDiagnosticSessionRequest safetySystemDiagnosticSession
}
with {variant "TAG (
defaultSession, diagnosticSessionType = '0000001'B;
programmingSession, diagnosticSessionType = '0000010'B;
extendedDiagnosticSession, diagnosticSessionType = '0000011'B;
safetySystemDiagnosticSession, diagnosticSessionType = '0000100'B)";
variant "FIELDLENGTH(7)"
}
|
|
| | |
Goto Forum:
Current Time: Fri Sep 20 07:30:09 GMT 2024
Powered by FUDForum. Page generated in 0.03663 seconds
|