Обновление
This commit is contained in:
parent
6602dfafca
commit
d1893882cb
20
CanUds.c
20
CanUds.c
|
|
@ -55,9 +55,17 @@ uint8_t setResponseError(tCanUds *env, eUdsServices service, eUdsResponseError e
|
|||
// начало ----------------------------- Сессия -------------------------------------------------------------
|
||||
static uint8_t DiagnosticSessionControl_10(tCanUds *env) {
|
||||
|
||||
if ((env->data.len != 2) ||
|
||||
(env->data.data[1] != UDS_session_defaultSession) ||
|
||||
(env->data.data[1] != UDS_session_programmingSession) ||
|
||||
(env->data.data[1] != UDS_session_extendedDiagnosticSession)) {
|
||||
|
||||
return setResponseError(env, UDS_DiagnosticSessionControl, UDS_error_incorrectMessageLengthOrInvalidFormat);
|
||||
}
|
||||
|
||||
tDiagnosticSessionsType *diagnosticSessionsType = (tDiagnosticSessionsType *) env->dataResponse;
|
||||
diagnosticSessionsType->ServiceId = env->data.data[0] | 0b1000000;
|
||||
diagnosticSessionsType->diagnosticSessionType = env->data.data[1] & 0b1111111;
|
||||
diagnosticSessionsType->ServiceId = UDS_DiagnosticSessionControl | 0b1000000;
|
||||
diagnosticSessionsType->diagnosticSessionType = env->data.data[1];
|
||||
|
||||
diagnosticSessionsType->sessionParameterRecord[0] = 0;
|
||||
diagnosticSessionsType->sessionParameterRecord[1] = 0x32;
|
||||
|
|
@ -89,7 +97,7 @@ static uint8_t ReadDataByIdentifier_22(tCanUds *env) {
|
|||
if (uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].data != NULL) {
|
||||
uint8_t response_size = uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].size;
|
||||
|
||||
env->dataResponse[0] = env->data.data[0] | 0b1000000;
|
||||
env->dataResponse[0] = UDS_ReadDataByIdentifier | 0b1000000;
|
||||
env->dataResponse[1] = dataIdentifier_hi;
|
||||
env->dataResponse[2] = dataIdentifier_lo;
|
||||
memcpy(&env->dataResponse[3], uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].data, response_size);
|
||||
|
|
@ -102,12 +110,12 @@ static uint8_t ReadDataByIdentifier_22(tCanUds *env) {
|
|||
if (dataIdentifier_hi == 0xF1) {
|
||||
|
||||
if (uds_ReadDataByIdentifier_22_com_F1[dataIdentifier_lo].data != NULL) {
|
||||
uint8_t response_size = uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].size;
|
||||
uint8_t response_size = uds_ReadDataByIdentifier_22_com_F1[dataIdentifier_lo].size;
|
||||
|
||||
env->dataResponse[0] = env->data.data[0] | 0b1000000;
|
||||
env->dataResponse[0] = UDS_ReadDataByIdentifier | 0b1000000;
|
||||
env->dataResponse[1] = dataIdentifier_hi;
|
||||
env->dataResponse[2] = dataIdentifier_lo;
|
||||
memcpy(&env->dataResponse[3], uds_ReadDataByIdentifier_22_com_CF[dataIdentifier_lo].data, response_size);
|
||||
memcpy(&env->dataResponse[3], uds_ReadDataByIdentifier_22_com_F1[dataIdentifier_lo].data, response_size);
|
||||
|
||||
return response_size;
|
||||
}
|
||||
|
|
|
|||
8
CanUds.h
8
CanUds.h
|
|
@ -30,6 +30,14 @@ typedef enum {
|
|||
} eUdsResponseError;
|
||||
|
||||
|
||||
typedef enum {
|
||||
UDS_session_defaultSession = 0x1,
|
||||
UDS_session_programmingSession= 0x2,
|
||||
UDS_session_extendedDiagnosticSession= 0x3
|
||||
} eUdsSession;
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
tCanSerialPortFrameTp canSerialPortFrameTp;
|
||||
tLoggerInterface *logger;
|
||||
|
|
|
|||
Loading…
Reference in New Issue