137 lines
4.5 KiB
C
137 lines
4.5 KiB
C
/*
|
|
*
|
|
* Copyright (C) 2020-2022 Qing.zhou
|
|
*
|
|
*
|
|
*/
|
|
|
|
|
|
/* -------------------------------- Includes -------------------------------- */
|
|
/* external head files */
|
|
|
|
/* internal head files */
|
|
#include "UDS_ServicesType.h"
|
|
#include "DiagnosticR/Comp_ISO_15765_3/Iso15765_3.h"
|
|
#include "calib_public.h"
|
|
|
|
#define NOOF(a) (sizeof(a)/sizeof(a[0]))
|
|
/* -------------------------------- Defines --------------------------------- */
|
|
|
|
/* -------------------------------- Macros ---------------------------------- */
|
|
|
|
/* ------------------------------- Data Types ------------------------------- */
|
|
|
|
/* -------------------------- Function declaration -------------------------- */
|
|
static t_UDS_ERR Calib_KeyUp(void);
|
|
static t_UDS_ERR Calib_KeyDown(void);
|
|
static t_UDS_ERR Calib_KeyLeft(void);
|
|
static t_UDS_ERR Calib_KeyRight(void);
|
|
static t_UDS_ERR Calib_KeyOK(void);
|
|
static t_UDS_ERR Calib_KeyFun1(void);
|
|
static t_UDS_ERR Calib_KeyFun2(void);
|
|
static t_UDS_ERR Calib_KeyFun3(void);
|
|
|
|
/* ----------------------------- Local Variables ---------------------------- */
|
|
|
|
/* ---------------------------- Global Variables ---------------------------- */
|
|
t_UDSIOControlSubCommands uds_io_control_commands[] =
|
|
{
|
|
/* DID Service legth Session support Security {ReturnControl , Default, Freeze, Adjustment} */
|
|
{ 0xD101 , 1 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {NULL, NULL, NULL, NULL} },
|
|
};
|
|
|
|
t_UDSRoutineControlCommands uds_routine_control_commands[] =
|
|
{
|
|
/* DID Service legth Session support Security {Start Stop Request } */
|
|
{ 0xAE00 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyUp, NULL, NULL} },
|
|
{ 0xAE01 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyDown, NULL, NULL} },
|
|
{ 0xAE02 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyLeft, NULL, NULL} },
|
|
{ 0xAE03 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyRight, NULL, NULL} },
|
|
{ 0xAE04 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyOK, NULL, NULL} },
|
|
{ 0xAE05 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyFun1, NULL, NULL} },
|
|
{ 0xAE06 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyFun2, NULL, NULL} },
|
|
{ 0xAE07 , 0 , UDS_EXT_DIAG_SESSION , UDS_ECU_LOCKED, {Calib_KeyFun3, NULL, NULL} },
|
|
};
|
|
|
|
/* --------------------------- Private Variables ---------------------------- */
|
|
|
|
/* --------------------------- Private Functions ---------------------------- */
|
|
|
|
|
|
|
|
static t_UDS_ERR Calib_KeyUp(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data0,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyDown(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data1,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyLeft(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data2,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyRight(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data3,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyOK(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data4,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyFun1(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data5,0);
|
|
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyFun2(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data6,0);
|
|
|
|
return response_mode;
|
|
}
|
|
static t_UDS_ERR Calib_KeyFun3(void) {
|
|
t_UDS_ERR response_mode = ISO15765_3_POSITIVE_RESPONSE;
|
|
/* implementation */
|
|
Calib_Trigger(data7,0);
|
|
|
|
return response_mode;
|
|
}
|
|
|
|
|
|
/* ---------------------------- Public Functions ---------------------------- */
|
|
|
|
uint8 GetIoControlServiceNumber(void){
|
|
return NOOF(uds_io_control_commands);
|
|
}
|
|
|
|
|
|
uint8 GetRoutineServiceNumber(void){
|
|
return NOOF(uds_routine_control_commands);
|
|
}
|
|
|