Обновление
This commit is contained in:
parent
fc4048ef48
commit
2f142a2721
52
CanUds.c
52
CanUds.c
|
|
@ -310,20 +310,58 @@ static uint16_t WriteDataByIdentifier_2E(tCanUds *env) {
|
|||
|
||||
static uint16_t InputOutputControlByIdentifier_2F(tCanUds *env) {
|
||||
|
||||
if (env->data.len < 5) {
|
||||
if (env->data.len < 4) {
|
||||
return setResponseError(env, UDS_InputOutputControlByIdentifier,
|
||||
UDS_error_incorrectMessageLengthOrInvalidFormat);
|
||||
}
|
||||
|
||||
if ((env->data.data[3] != UDS_io_returnControlToECU) &&
|
||||
(env->data.data[3] != UDS_io_shortTermAdjustment)) {
|
||||
return setResponseError(env, UDS_InputOutputControlByIdentifier, UDS_error_conditionsNotCorrect);
|
||||
}
|
||||
|
||||
uint8_t dataIdentifier_hi = env->data.data[1];
|
||||
uint8_t dataIdentifier_lo = env->data.data[2];
|
||||
// uint16_t dataIdentifier = (dataIdentifier_hi << 8) | dataIdentifier_lo;
|
||||
|
||||
return setResponseError(env, UDS_InputOutputControlByIdentifier, UDS_error_requestOutOfRange);
|
||||
if ((env->data.data[3] != UDS_io_returnControlToECU) &&
|
||||
(env->data.data[3] != UDS_io_shortTermAdjustment)) {
|
||||
return setResponseError(env, UDS_ECUResetService, UDS_error_sub_functionNotSupported);
|
||||
}
|
||||
|
||||
if (dataIdentifier_hi == 0xCF) {
|
||||
|
||||
if (uds_IoDataByIdentifier_2F_com_CF[dataIdentifier_lo].data != NULL) {
|
||||
uint16_t size = uds_IoDataByIdentifier_2F_com_CF[dataIdentifier_lo].size;
|
||||
|
||||
if (env->data.len != size + 4) {
|
||||
return setResponseError(env, UDS_InputOutputControlByIdentifier,
|
||||
UDS_error_incorrectMessageLengthOrInvalidFormat);
|
||||
}
|
||||
|
||||
env->dataResponse[0] = UDS_InputOutputControlByIdentifier | 0b1000000;
|
||||
env->dataResponse[1] = dataIdentifier_hi;
|
||||
env->dataResponse[2] = dataIdentifier_lo;
|
||||
env->dataResponse[3] = env->data.data[3];
|
||||
//memcpy(uds_IoDataByIdentifier_2F_com_CF[dataIdentifier_lo].data, &env->data.data[3], size);
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (dataIdentifier_hi == 0xF1) {
|
||||
|
||||
if (uds_IoDataByIdentifier_2F_com_F1[dataIdentifier_lo].data != NULL) {
|
||||
uint16_t size = uds_IoDataByIdentifier_2F_com_F1[dataIdentifier_lo].size;
|
||||
|
||||
env->dataResponse[0] = UDS_WriteDataByIdentifier | 0b1000000;
|
||||
env->dataResponse[1] = dataIdentifier_hi;
|
||||
env->dataResponse[2] = dataIdentifier_lo;
|
||||
env->dataResponse[3] = env->data.data[3];
|
||||
//memcpy(uds_IoDataByIdentifier_2F_com_F1[dataIdentifier_lo].data, &env->data.data[3], size);
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return setResponseError(env, UDS_WriteDataByIdentifier, UDS_error_requestOutOfRange);
|
||||
}
|
||||
// конец --------------------------- Управление ---------------------------------------------------------
|
||||
// конец --------------------------- Управление ---------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue