From a2b34302c2019363d38f7fff62a2651fde2a44e8 Mon Sep 17 00:00:00 2001 From: cfif Date: Fri, 27 Feb 2026 11:00:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CanUds.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/CanUds.c b/CanUds.c index f501787..7a9fd1f 100644 --- a/CanUds.c +++ b/CanUds.c @@ -66,6 +66,61 @@ static void PrintfDebug(uint8_t *data, uint8_t dlc) { } +bool isSecurityAccessDenied(tCanUds *env, tPermissionSession isPermissionSession) { + bool result = false; + + switch (isPermissionSession) { + + case perm_session_defaultSession: { + if (env->currentSession == UDS_session_defaultSession) + result = true; + break; + } + + case perm_session_programmingSession: { + if (env->currentSession == UDS_session_programmingSession) + result = true; + break; + } + + case perm_session_extendedDiagnosticSession: { + if (env->currentSession == UDS_session_extendedDiagnosticSession) + result = true; + break; + } + + case perm_session_defaultSession_programmingSession: { + if ((env->currentSession == UDS_session_defaultSession) || + (env->currentSession == UDS_session_programmingSession)) + result = true; + break; + } + + case perm_session_defaultSession_extendedDiagnosticSession: { + if ((env->currentSession == UDS_session_defaultSession) || + (env->currentSession == UDS_session_extendedDiagnosticSession)) + result = true; + break; + } + + case perm_session_extendedDiagnosticSession_programmingSession: { + if ((env->currentSession == UDS_session_extendedDiagnosticSession) || + (env->currentSession == UDS_session_programmingSession)) + result = true; + break; + } + + case perm_session_all: { + result = true; + break; + } + + default: + break; + } + + return result; +} char *sendLogCanUdsHex(tCanUds *env, uint8_t *data, size_t size) { memset(env->hexString, 0, sizeof(env->hexString)); @@ -222,6 +277,14 @@ static uint16_t ReadDataByIdentifier_22(tCanUds *env) { if (dataIdentifier_hi == 0xCF) { if (uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].data != NULL) { + + +// if (uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].isPermissionSession != NULL) { +// +// } + + + uint16_t response_size = uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].size; env->dataResponse[0] = UDS_ReadDataByIdentifier | 0b1000000;