

#ifndef _UDS_DEF_H_
#define _UDS_DEF_H_

///////////------------------------////////////////////////////
#define SubDefSession 0x01
#define SubProgSession 0x02
#define SubExtSession 0x03
#define SubHardReset 1
#define SubKeyOffOnReset 2
#define SubSoftReset 3
#define SubZeroFun0 0
#define SubReqSeed1 1
#define SubReqSeed3 3
#define SubReqSeed5 5
#define SubReqSeed7 7
#define SubSendKey2 2
#define SubSendKey4 4
#define SubSendKey6 6
#define SubSendKey8 8

#define SubEnableRxAndTx 0    //使能接收发送
#define SubEnableRxAndDisTx 1 //使能接收
#define SubDisableRxAndEnTx 2 //使能发送
#define SubDisableRxAndTx 3   //关闭

#define NOR_Message 1
#define NM_Message 2
#define NOR_NM_Message 3

#define UnLockLv4 4
#define UnLockLv3 3
#define UnLockLv2 2
#define UnLockLv1 1 //解锁
#define Lock 0

#define DefSession 0x01  //默认会话
#define ProgSession 0x02 //编程会话
#define ExtSession 0x03  //扩展会话




#define NegativeId 0x7f //否定响应ID

//-- Request Service Id(服务列表) --//
#define ReqSessionCtlId 0x10
#define ReqECUResetId 0x11
#define ReqClrDiagInfoId 0x14
#define ReqReadDtcId 0x59
#define ReqReadDataId 0x62
#define ReqAccessId 0x27
#define ReqCommCtlId 0x28
#define ReqWriteDataId 0x2e
#define ReqRoutineControlId 0x31
#define ReqDownloadId 0x34
#define ReqMessageId 0x36
#define RequestTransferExitId 0x37
#define ReqTesterId 0x3E //
#define ReqInAndOutCtlId 0x2F
#define ReqCtlDTCSetId 0x85
#define ReqProgModeId 0xA5

#define ReqProgMilId 0x41

//-- N_R否定响应 --//
#define ServiceNotSupported 0x11                    //服务不支持   99        Exct_USData.ind.MsgData[0]
#define SubFunctionNotSupported 0x12                //子功能不支持 10 04     SubFunBit0_6
#define ErrFormatLength 0x13                        //长度不对               ind.Length
#define RequestOutOfRange 0x31                      //超出范围     28 03 04  ind.MsgData[2]
#define FlashEraseFailed 0x32                       //31
#define SecurityAccessDenied 0x33                   //31
#define InvalidKey 0x35                             //秘钥错误
#define ExceedNumberOfAttempts 0x36                 //27
#define ReqTimeDelayNotExpired 0x37                 //27
#define SubFunctionNotSupportedInActiceSession 0x7e //----------空
#define NotSuppInActiveSession 0x7f                 //此会话不支持功能
#define ConditNotCorrect 0x22                       //----------空
#define ReqSequenceError 0x24                       //
#define voltageTooHigh 0x92                         //----------空
#define voltageTooLow 0x93                          //----------空

#define DtcSetOn 1
#define DtcSetOff 2

//19
#define RepNumByStatusMask 1  //reportNumberOfDTCByStatusMask
#define RepDTCByStatusMask 2  //reportDTCByStatusMask
#define RepSnapRecordDTCNum 4 //reportDTCSnapshotRecordByDTCNumber
#define RepExtDataRecordNum 6 //reportDTCExtendedDataRecordByDTCNumber
#define RepSupportedDTC 0xa   //reportSupportedDTC

//A5
#define VerifyProgCondition 1
#define EnableProgMode 3

//2F
#define ReturnControlToECU 0
#define ShortTermAdjustment 3
//
#define UDS_TRUE 1
#define UDS_FALSE 0

#endif
