iso14229 0.10.0
ISO14229-1 (UDS) C Library
Loading...
Searching...
No Matches
iso14229.h File Reference

ISO14229-1 (UDS) library. More...

#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <sys/types.h>
#include <time.h>
#include <stdlib.h>
#include <Arduino.h>
#include <esp_timer.h>
Include dependency graph for iso14229.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UDSSDU_t
 Service data unit (SDU). More...
struct  UDSTp_t
 UDS Transport layer. More...
struct  UDSClient_t
 UDS client structure. More...
struct  SecurityAccessResponse
 Security access response structure. More...
struct  RequestDownloadResponse
 Request download response structure. More...
struct  RoutineControlResponse
 Routine control response structure. More...
struct  UDSRDBIVar_t
 Read data by identifier variable structure. More...
struct  UDSReq_t
 Server request context. More...
struct  UDSServer_t
 UDS server structure. More...
struct  UDSDiagSessCtrlArgs_t
 Diagnostic session control arguments. More...
struct  UDSECUResetArgs_t
 ECU reset arguments. More...
struct  UDSCDIArgs_t
 Clear diagnostic information arguments. More...
struct  UDSRDTCIArgs_t
 Read DTC information arguments. More...
struct  UDSRDBIArgs_t
 Read data by identifier arguments. More...
struct  UDSReadMemByAddrArgs_t
 Read memory by address arguments. More...
struct  UDSCommCtrlArgs_t
 Communication control arguments. More...
struct  UDSSecAccessRequestSeedArgs_t
 Security access request seed arguments. More...
struct  UDSSecAccessValidateKeyArgs_t
 Security access validate key arguments. More...
struct  UDSWDBIArgs_t
 Write data by identifier arguments. More...
struct  UDSWriteMemByAddrArgs_t
 Write memory by address arguments. More...
struct  UDSDDDIArgs_t
 Dynamically define data identifier arguments. More...
struct  UDSIOCtrlArgs_t
 Input/output control by identifier arguments. More...
struct  UDSRoutineCtrlArgs_t
 Routine control arguments. More...
struct  UDSRequestDownloadArgs_t
 Request download arguments. More...
struct  UDSRequestUploadArgs_t
 Request upload arguments. More...
struct  UDSTransferDataArgs_t
 Transfer data arguments. More...
struct  UDSRequestTransferExitArgs_t
 Request transfer exit arguments. More...
struct  UDSRequestFileTransferArgs_t
 Request file transfer arguments. More...
struct  UDSControlDTCSettingArgs_t
 Control DTC setting arguments. More...
struct  UDSLinkCtrlArgs_t
 Link control arguments. More...
struct  UDSCustomArgs_t
 Custom service arguments. More...
struct  UDSTpISOTpC_t
 isotp-c implementation of UDSTp_t More...
struct  UDSTpISOTpCSocketCAN_t
 isotp-c over SocketCAN implementation of UDSTp_t More...
struct  UDSTpIsoTpSock_t
 linux ISO-TP socket implementation of UDSTp_t More...

Macros

#define UDS_SYS_CUSTOM   0
#define UDS_SYS   UDS_SYS_CUSTOM
 Selects the host system iso14229 is compiled for.
#define UDS_CUSTOM_MILLIS
 bring your own UDSMillis implementation
#define UDS_ISOTP_MTU   (4095)
 ISO-TP Maximum Transmission Unit (ISO-15764-2-2004 section 5.3.3).
#define UDS_TP_MTU   UDS_ISOTP_MTU
 ISOTP is the only supported tp type, so UDS inherits its MTU.
#define UDS_SERVER_SEND_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_SERVER_RECV_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_SEND_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_RECV_BUF_SIZE   (UDS_TP_MTU)
 reduce this at your own risk to save RAM. Fuzz testing is done with the default of UDS_TP_MTU.
#define UDS_CLIENT_DEFAULT_P2_MS   (150U)
 default P2 timeout
#define UDS_CLIENT_DEFAULT_P2_STAR_MS   (1500U)
 default P2* timeout
#define UDS_SERVER_DEFAULT_P2_MS   (50)
 default P2 duration
#define UDS_SERVER_DEFAULT_P2_STAR_MS   (5000)
 default P2* duration
#define UDS_SERVER_DEFAULT_S3_MS   (5100)
 default S3 duration (ISO14229-2 2013 Table 5: 5000 -0/+200 ms)
#define UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS   (60)
#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS   (1000)
 Amount of time to wait after boot before accepting 0x27 requests.
#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS   (1000)
 Amount of time to wait after an authentication failure before accepting another 0x27 request.
#define UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH   (UDS_TP_MTU)
#define UDS_TP_NOOP_ADDR   (0xFFFFFFFF)
 flags A_SA / A_TA as unused
#define UDS_LEV_DS_DS   1
 Default Session.
#define UDS_LEV_DS_PRGS   2
 Programming Session.
#define UDS_LEV_DS_EXTDS   3
 Extended Diagnostic Session.
#define UDS_LEV_DS_SSDS   4
 Safety System Diagnostic Session.
#define UDS_LEV_RT_HR   1
 Hard Reset.
#define UDS_LEV_RT_KOFFONR   2
 Key Off On Reset.
#define UDS_LEV_RT_SR   3
 Soft Reset.
#define UDS_LEV_RT_ERPSD   4
 Enable Rapid Power Shut Down.
#define UDS_LEV_RT_DRPSD   5
 Disable Rapid Power Shut Down.
#define UDS_LEV_CTRLTP_ERXTX   0
 EnableRxAndTx.
#define UDS_LEV_CTRLTP_ERXDTX   1
 EnableRxAndDisableTx.
#define UDS_LEV_CTRLTP_DRXETX   2
 DisableRxAndEnableTx.
#define UDS_LEV_CTRLTP_DRXTX   3
 DisableRxAndTx.
#define UDS_CTP_NCM   1
 NormalCommunicationMessages.
#define UDS_CTP_NWMCM   2
 NetworkManagementCommunicationMessages.
#define UDS_CTP_NWMCM_NCM   3
 NetworkManagementCommunicationMessagesAndNormalCommunicationMessages.
#define UDS_LEV_RCTP_STR   1
 StartRoutine.
#define UDS_LEV_RCTP_STPR   2
 StopRoutine.
#define UDS_LEV_RCTP_RRR   3
 RequestRoutineResults.
#define UDS_MOOP_ADDFILE   1
 AddFile.
#define UDS_MOOP_DELFILE   2
 DeleteFile.
#define UDS_MOOP_REPLFILE   3
 ReplaceFile.
#define UDS_MOOP_RDFILE   4
 ReadFile.
#define UDS_MOOP_RDDIR   5
 ReadDirectory.
#define UDS_MOOP_RSFILE   6
 ResumeFile.
#define UDS_LEV_DTCSTP_ON   1
 Resume updating DTCs.
#define UDS_LEV_DTCSTP_OFF   2
 Stop updating DTCs.
#define UDS_LEV_LCTP_VMTWFP   1
 VerifyModeTransitionWithFixedParameter.
#define UDS_LEV_LCTP_VMTWSP   2
 VerifyModeTransitionWithSpecificParameter.
#define UDS_LEV_LCTP_TM   3
 TransitionMode.
#define UDS_MAX_DIAGNOSTIC_SERVICES   0x7F
 ISO-14229-1:2013 Table 2.
#define UDS_RESPONSE_SID_OF(request_sid)
 Convert request SID to response SID.
#define UDS_REQUEST_SID_OF(response_sid)
 Convert response SID to request SID.
#define UDS_ASSERT(x)
 define this during library development. It is a no-op by default for library users. API misuse is expected to be covered by runtime checks, not by UDS_ASSERT
#define UDS_LOG_NONE   0
#define UDS_LOG_ERROR   1
#define UDS_LOG_WARN   2
#define UDS_LOG_INFO   3
#define UDS_LOG_DEBUG   4
#define UDS_LOG_VERBOSE   5
#define UDS_LOG_LEVEL   UDS_LOG_NONE
 sets the logging level
#define UDS_SUPPRESS_POS_RESP   0x1
 set the suppress positive response bit
#define UDS_FUNCTIONAL   0x2
 send the request as a functional request
#define UDS_IGNORE_SRV_TIMINGS   0x8
 ignore the server-provided p2 and p2_star

Typedefs

typedef uint32_t UDSTpStatus_t
 private: bitfield of UDSTpStatusFlags
typedef uint8_t UDSTpAddr_t
 private: oneof UDS_A_TA_Type_t
typedef int32_t UDSTpSize_t
 Signed size type used by the transport layer interface (byte count, or negative on error).
typedef int UDS_LogLevel_t
 one of valid values for UDS_LOG_LEVEL

Enumerations

enum  UDSTpStatusFlags { UDS_TP_IDLE = 0x0000 , UDS_TP_SEND_IN_PROGRESS = 0x0001 , UDS_TP_RECV_COMPLETE = 0x0002 , UDS_TP_ERR = 0x0004 }
enum  UDS_A_Mtype_t { UDS_A_MTYPE_DIAG = 0 , UDS_A_MTYPE_REMOTE_DIAG , UDS_A_MTYPE_SECURE_DIAG , UDS_A_MTYPE_SECURE_REMOTE_DIAG }
enum  UDS_A_TA_Type_t { UDS_A_TA_TYPE_PHYSICAL = 0 , UDS_A_TA_TYPE_FUNCTIONAL }
enum  UDSEvent_t {
  UDS_EVT_Err , UDS_EVT_DiagSessCtrl , UDS_EVT_EcuReset , UDS_EVT_ClearDiagnosticInfo ,
  UDS_EVT_ReadDTCInformation , UDS_EVT_ReadDataByIdent , UDS_EVT_ReadMemByAddr , UDS_EVT_CommCtrl ,
  UDS_EVT_SecAccessRequestSeed , UDS_EVT_SecAccessValidateKey , UDS_EVT_WriteDataByIdent , UDS_EVT_WriteMemByAddr ,
  UDS_EVT_DynamicDefineDataId , UDS_EVT_IOControl , UDS_EVT_RoutineCtrl , UDS_EVT_RequestDownload ,
  UDS_EVT_RequestUpload , UDS_EVT_TransferData , UDS_EVT_RequestTransferExit , UDS_EVT_SessionTimeout ,
  UDS_EVT_DoScheduledReset , UDS_EVT_RequestFileTransfer , UDS_EVT_ControlDTCSetting , UDS_EVT_LinkControl ,
  UDS_EVT_Custom , UDS_EVT_Poll , UDS_EVT_SendComplete , UDS_EVT_ResponseReceived ,
  UDS_EVT_Idle , UDS_EVT_MAX
}
 UDS events. More...
enum  UDSErr_t {
  UDS_FAIL = -1 , UDS_OK = 0 , UDS_PositiveResponse = 0 , UDS_NRC_GeneralReject = 0x10 ,
  UDS_NRC_ServiceNotSupported = 0x11 , UDS_NRC_SubFunctionNotSupported = 0x12 , UDS_NRC_IncorrectMessageLengthOrInvalidFormat = 0x13 , UDS_NRC_ResponseTooLong = 0x14 ,
  UDS_NRC_BusyRepeatRequest = 0x21 , UDS_NRC_ConditionsNotCorrect = 0x22 , UDS_NRC_RequestSequenceError = 0x24 , UDS_NRC_NoResponseFromSubnetComponent = 0x25 ,
  UDS_NRC_FailurePreventsExecutionOfRequestedAction = 0x26 , UDS_NRC_RequestOutOfRange = 0x31 , UDS_NRC_SecurityAccessDenied = 0x33 , UDS_NRC_AuthenticationRequired = 0x34 ,
  UDS_NRC_InvalidKey = 0x35 , UDS_NRC_ExceedNumberOfAttempts = 0x36 , UDS_NRC_RequiredTimeDelayNotExpired = 0x37 , UDS_NRC_SecureDataTransmissionRequired = 0x38 ,
  UDS_NRC_SecureDataTransmissionNotAllowed = 0x39 , UDS_NRC_SecureDataVerificationFailed = 0x3A , UDS_NRC_CertficateVerificationFailedInvalidTimePeriod = 0x50 , UDS_NRC_CertficateVerificationFailedInvalidSignature = 0x51 ,
  UDS_NRC_CertficateVerificationFailedInvalidChainOfTrust = 0x52 , UDS_NRC_CertficateVerificationFailedInvalidType = 0x53 , UDS_NRC_CertficateVerificationFailedInvalidFormat = 0x54 , UDS_NRC_CertficateVerificationFailedInvalidContent = 0x55 ,
  UDS_NRC_CertficateVerificationFailedInvalidScope = 0x56 , UDS_NRC_CertficateVerificationFailedInvalidCertificate = 0x57 , UDS_NRC_OwnershipVerificationFailed = 0x58 , UDS_NRC_ChallengeCalculationFailed = 0x59 ,
  UDS_NRC_SettingAccessRightsFailed = 0x5A , UDS_NRC_SessionKeyCreationOrDerivationFailed = 0x5B , UDS_NRC_ConfigurationDataUsageFailed = 0x5C , UDS_NRC_DeAuthenticationFailed = 0x5D ,
  UDS_NRC_UploadDownloadNotAccepted = 0x70 , UDS_NRC_TransferDataSuspended = 0x71 , UDS_NRC_GeneralProgrammingFailure = 0x72 , UDS_NRC_WrongBlockSequenceCounter = 0x73 ,
  UDS_NRC_RequestCorrectlyReceived_ResponsePending = 0x78 , UDS_NRC_SubFunctionNotSupportedInActiveSession = 0x7E , UDS_NRC_ServiceNotSupportedInActiveSession = 0x7F , UDS_NRC_RpmTooHigh = 0x81 ,
  UDS_NRC_RpmTooLow = 0x82 , UDS_NRC_EngineIsRunning = 0x83 , UDS_NRC_EngineIsNotRunning = 0x84 , UDS_NRC_EngineRunTimeTooLow = 0x85 ,
  UDS_NRC_TemperatureTooHigh = 0x86 , UDS_NRC_TemperatureTooLow = 0x87 , UDS_NRC_VehicleSpeedTooHigh = 0x88 , UDS_NRC_VehicleSpeedTooLow = 0x89 ,
  UDS_NRC_ThrottlePedalTooHigh = 0x8A , UDS_NRC_ThrottlePedalTooLow = 0x8B , UDS_NRC_TransmissionRangeNotInNeutral = 0x8C , UDS_NRC_TransmissionRangeNotInGear = 0x8D ,
  UDS_NRC_BrakeSwitchNotClosed = 0x8F , UDS_NRC_ShifterLeverNotInPark = 0x90 , UDS_NRC_TorqueConverterClutchLocked = 0x91 , UDS_NRC_VoltageTooHigh = 0x92 ,
  UDS_NRC_VoltageTooLow = 0x93 , UDS_NRC_ResourceTemporarilyNotAvailable = 0x94 , UDS_ERR_TIMEOUT = 0x100 , UDS_ERR_DID_MISMATCH ,
  UDS_ERR_SID_MISMATCH , UDS_ERR_SUBFUNCTION_MISMATCH , UDS_ERR_TPORT , UDS_ERR_RESP_TOO_SHORT ,
  UDS_ERR_BUFSIZ , UDS_ERR_INVALID_ARG , UDS_ERR_BUSY , UDS_ERR_MISUSE
}
 Error Codes, including NRCs defined by the standard. More...

Functions

UDSTpSize_t UDSTpSend (UDSTp_t *hdl, const uint8_t *buf, UDSTpSize_t len, const UDSSDU_t *info)
 Send to transport.
UDSTpSize_t UDSTpRecv (UDSTp_t *hdl, uint8_t *buf, size_t bufsize, UDSSDU_t *info)
 Receive from transport.
UDSTpStatus_t UDSTpPoll (UDSTp_t *hdl)
 call this at <5ms intervals
uint32_t UDSMillis (void)
 Get time in milliseconds.
UDSErr_t UDSClientInit (UDSClient_t *client)
 Call this once.
UDSErr_t UDSClientPoll (UDSClient_t *client)
 Call at <5ms intervals.
UDSErr_t UDSSendBytes (UDSClient_t *client, const uint8_t *data, uint16_t size)
 Send user-defined bytes to a UDS server.
UDSErr_t UDSSendECUReset (UDSClient_t *client, uint8_t type)
 Request ECUReset.
UDSErr_t UDSSendDiagSessCtrl (UDSClient_t *client, uint8_t mode)
 Change the diagnostic session.
UDSErr_t UDSSendSecurityAccess (UDSClient_t *client, uint8_t level, uint8_t *data, uint16_t size)
 Get Security Access.
UDSErr_t UDSSendCommCtrl (UDSClient_t *client, uint8_t ctrl, uint8_t comm)
 Change communication settings.
UDSErr_t UDSSendRDBI (UDSClient_t *client, const uint16_t *didList, const uint16_t numDataIdentifiers)
 Read Data By Identifier.
UDSErr_t UDSSendWDBI (UDSClient_t *client, uint16_t dataIdentifier, const uint8_t *data, uint16_t size)
 Write Data By Identifier.
UDSErr_t UDSSendTesterPresent (UDSClient_t *client)
 What's up?
UDSErr_t UDSSendRoutineCtrl (UDSClient_t *client, uint8_t type, uint16_t routineIdentifier, const uint8_t *data, uint16_t size)
 Request to Twiddle Routines.
UDSErr_t UDSSendRequestDownload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize)
 Request to Download via TransferData.
UDSErr_t UDSSendRequestUpload (UDSClient_t *client, uint8_t dataFormatIdentifier, uint8_t addressAndLengthFormatIdentifier, size_t memoryAddress, size_t memorySize)
 Request to Upload via TransferData.
UDSErr_t UDSSendTransferData (UDSClient_t *client, uint8_t blockSequenceCounter, const uint16_t blockLength, const uint8_t *data, uint16_t size)
 Transfer Data to/from a buffer.
UDSErr_t UDSSendTransferDataStream (UDSClient_t *client, uint8_t blockSequenceCounter, const uint16_t blockLength, FILE *fd)
 Transfer Data to/from a file.
UDSErr_t UDSSendRequestTransferExit (UDSClient_t *client)
 Call this when finished with TransferData.
UDSErr_t UDSSendRequestFileTransfer (UDSClient_t *client, uint8_t mode, const char *filePath, size_t fileSizeUncompressed, size_t fileSizeCompressed)
 filesystem-based frontend to TransferData
UDSErr_t UDSCtrlDTCSetting (UDSClient_t *client, uint8_t dtcSettingType, uint8_t *dtcSettingControlOptionRecord, uint16_t len)
 control DTC setting
UDSErr_t UDSUnpackRDBIResponse (UDSClient_t *client, UDSRDBIVar_t *vars, uint16_t numVars)
 Parse server's response to RDBI.
UDSErr_t UDSUnpackSecurityAccessResponse (const UDSClient_t *client, struct SecurityAccessResponse *resp)
 Parse server's response to SecurityAccess.
UDSErr_t UDSUnpackRequestDownloadResponse (const UDSClient_t *client, struct RequestDownloadResponse *resp)
 Parse server's response to RequestDownload.
UDSErr_t UDSUnpackRoutineControlResponse (const UDSClient_t *client, struct RoutineControlResponse *resp)
 Parse server's response to RoutineControl.
UDSErr_t UDSServerInit (UDSServer_t *srv)
 call this once
void UDSServerPoll (UDSServer_t *srv)
 Call this at <5ms intervals.
UDSErr_t UDSServerTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func)
 Initialize isotp-c transport for UDSServer_t.
UDSErr_t UDSClientTpISOTpCInit (UDSTpISOTpC_t *tp, uint32_t target_addr, uint32_t source_addr, uint32_t target_addr_func)
 Initialize isotp-c transport for UDSClient_t.
UDSErr_t UDSTpISOTpCSocketCANInit (UDSTpISOTpCSocketCAN_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func, uint32_t target_addr_func)
 Initialize the transport.
void UDSTpISOTpCSocketCANDeinit (UDSTpISOTpCSocketCAN_t *tp)
 release socket
UDSErr_t UDSServerTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t source_addr_func)
 for UDSServer_t
UDSErr_t UDSClientTpIsoTpSockInit (UDSTpIsoTpSock_t *tp, const char *ifname, uint32_t source_addr, uint32_t target_addr, uint32_t target_addr_func)
 for UDSClient_t
void UDSTpIsoTpSockDeinit (UDSTpIsoTpSock_t *tp)
 release sockets

Detailed Description

See also
https://github.com/driftregion/iso14229

Definition in file iso14229.h.

Macro Definition Documentation

◆ UDS_ASSERT

#define UDS_ASSERT ( x)

Definition at line 626 of file iso14229.h.

◆ UDS_CLIENT_DEFAULT_P2_MS

#define UDS_CLIENT_DEFAULT_P2_MS   (150U)

Definition at line 138 of file iso14229.h.

◆ UDS_CLIENT_DEFAULT_P2_STAR_MS

#define UDS_CLIENT_DEFAULT_P2_STAR_MS   (1500U)

Definition at line 142 of file iso14229.h.

◆ UDS_CLIENT_RECV_BUF_SIZE

#define UDS_CLIENT_RECV_BUF_SIZE   (UDS_TP_MTU)

Definition at line 134 of file iso14229.h.

◆ UDS_CLIENT_SEND_BUF_SIZE

#define UDS_CLIENT_SEND_BUF_SIZE   (UDS_TP_MTU)

Definition at line 129 of file iso14229.h.

◆ UDS_CUSTOM_MILLIS

#define UDS_CUSTOM_MILLIS

Bring your own UDSMillis implementation. Valid values:

See also
UDSMillis

Definition at line 60 of file iso14229.h.

◆ UDS_FUNCTIONAL

#define UDS_FUNCTIONAL   0x2

Definition at line 785 of file iso14229.h.

◆ UDS_IGNORE_SRV_TIMINGS

#define UDS_IGNORE_SRV_TIMINGS   0x8

Definition at line 786 of file iso14229.h.

◆ UDS_ISOTP_MTU

#define UDS_ISOTP_MTU   (4095)

Definition at line 106 of file iso14229.h.

◆ UDS_LOG_LEVEL

#define UDS_LOG_LEVEL   UDS_LOG_NONE
See also
valid values for UDS_LOG_LEVEL for valid values

Definition at line 678 of file iso14229.h.

◆ UDS_MAX_DIAGNOSTIC_SERVICES

#define UDS_MAX_DIAGNOSTIC_SERVICES   0x7F

Definition at line 533 of file iso14229.h.

◆ UDS_REQUEST_SID_OF

#define UDS_REQUEST_SID_OF ( response_sid)
Value:
((response_sid) - 0x40)

Definition at line 537 of file iso14229.h.

◆ UDS_RESPONSE_SID_OF

#define UDS_RESPONSE_SID_OF ( request_sid)
Value:
((request_sid) + 0x40)

Definition at line 535 of file iso14229.h.

◆ UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS

#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_AUTH_FAIL_DELAY_MS   (1000)

Definition at line 183 of file iso14229.h.

◆ UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS

#define UDS_SERVER_0x27_BRUTE_FORCE_MITIGATION_BOOT_DELAY_MS   (1000)

Definition at line 178 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_P2_MS

#define UDS_SERVER_DEFAULT_P2_MS   (50)

Definition at line 148 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_P2_STAR_MS

#define UDS_SERVER_DEFAULT_P2_STAR_MS   (5000)

Definition at line 152 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS

#define UDS_SERVER_DEFAULT_POWER_DOWN_TIME_MS   (60)

Duration between the server sending a positive response to an ECU reset request and the emission of a UDS_EVT_DoScheduledReset event. This should be set to a duration adequate for the server transport layer to finish responding to the ECU reset request.

Definition at line 169 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_S3_MS

#define UDS_SERVER_DEFAULT_S3_MS   (5100)

Definition at line 156 of file iso14229.h.

◆ UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH

#define UDS_SERVER_DEFAULT_XFER_DATA_MAX_BLOCKLENGTH   (UDS_TP_MTU)

ISO14229-1:2013 Table 396. This parameter is used by the requestDownload positive response message to inform the client how many data bytes (maxNumberOfBlockLength) to include in each TransferData request message from the client.

Definition at line 190 of file iso14229.h.

◆ UDS_SERVER_RECV_BUF_SIZE

#define UDS_SERVER_RECV_BUF_SIZE   (UDS_TP_MTU)

Definition at line 124 of file iso14229.h.

◆ UDS_SERVER_SEND_BUF_SIZE

#define UDS_SERVER_SEND_BUF_SIZE   (UDS_TP_MTU)

Definition at line 119 of file iso14229.h.

◆ UDS_SUPPRESS_POS_RESP

#define UDS_SUPPRESS_POS_RESP   0x1

Definition at line 784 of file iso14229.h.

◆ UDS_SYS

#define UDS_SYS   UDS_SYS_CUSTOM
See also
valid values of UDS_SYS for the list of valid values

Definition at line 46 of file iso14229.h.

◆ UDS_TP_MTU

#define UDS_TP_MTU   UDS_ISOTP_MTU

Definition at line 110 of file iso14229.h.

◆ UDS_TP_NOOP_ADDR

#define UDS_TP_NOOP_ADDR   (0xFFFFFFFF)

Definition at line 245 of file iso14229.h.

Typedef Documentation

◆ UDS_LogLevel_t

typedef int UDS_LogLevel_t

Definition at line 670 of file iso14229.h.

◆ UDSTpAddr_t

typedef uint8_t UDSTpAddr_t

Definition at line 229 of file iso14229.h.

◆ UDSTpSize_t

typedef int32_t UDSTpSize_t

Definition at line 249 of file iso14229.h.

◆ UDSTpStatus_t

typedef uint32_t UDSTpStatus_t

Definition at line 211 of file iso14229.h.

Enumeration Type Documentation

◆ UDS_A_Mtype_t

private: transport message type

Definition at line 215 of file iso14229.h.

◆ UDS_A_TA_Type_t

private: transmission type

Definition at line 224 of file iso14229.h.

◆ UDSErr_t

enum UDSErr_t
See also
UDSErrToStr

Definition at line 343 of file iso14229.h.

◆ UDSEvent_t

enum UDSEvent_t

Events are passed to the server or client callback function along with a pointer to the associated argument structure.

Enumerator
UDS_EVT_Err 

Common event. Argument type: UDSErr_t *

UDS_EVT_DiagSessCtrl 

Server evt 0x10, argtype: UDSDiagSessCtrlArgs_t *

UDS_EVT_EcuReset 

Server evt 0x11, argtype: UDSECUResetArgs_t *

UDS_EVT_ClearDiagnosticInfo 

Server evt 0x14, argtype: UDSCDIArgs_t *

UDS_EVT_ReadDTCInformation 

Server evt 0x19, argtype: UDSRDTCIArgs_t *

UDS_EVT_ReadDataByIdent 

Server evt 0x22, argtype: UDSRDBIArgs_t *

UDS_EVT_ReadMemByAddr 

Server evt 0x23, argtype: UDSReadMemByAddrArgs_t *

UDS_EVT_CommCtrl 

Server evt 0x28, argtype: UDSCommCtrlArgs_t *

UDS_EVT_SecAccessRequestSeed 

Server evt 0x27, argtype: UDSSecAccessRequestSeedArgs_t *

UDS_EVT_SecAccessValidateKey 

Server evt 0x27, argtype: UDSSecAccessValidateKeyArgs_t *

UDS_EVT_WriteDataByIdent 

Server evt 0x2E, argtype: UDSWDBIArgs_t *

UDS_EVT_WriteMemByAddr 

Server evt 0x3D, argtype: UDSWriteMemByAddrArgs_t *

UDS_EVT_DynamicDefineDataId 

Server evt 0x2C, argtype: UDSDDDIArgs_t *

UDS_EVT_IOControl 

Server evt 0x2F, argtype: UDSIOCtrlArgs_t *

UDS_EVT_RoutineCtrl 

Server evt 0x31, argtype: UDSRoutineCtrlArgs_t *

UDS_EVT_RequestDownload 

Server evt 0x34, argtype: UDSRequestDownloadArgs_t *

UDS_EVT_RequestUpload 

Server evt 0x35, argtype: UDSRequestUploadArgs_t *

UDS_EVT_TransferData 

Server evt 0x36, argtype: UDSTransferDataArgs_t *

UDS_EVT_RequestTransferExit 

Server evt 0x37, argtype: UDSRequestTransferExitArgs_t *

UDS_EVT_SessionTimeout 

Server evt 0x38, argtype: NULL

UDS_EVT_DoScheduledReset 

Server evt 0x39, argtype: uint8_t *

UDS_EVT_RequestFileTransfer 

Server evt 0x38, argtype: UDSRequestFileTransferArgs_t *

UDS_EVT_ControlDTCSetting 

Server evt 0x85, argtype: UDSControlDTCSettingArgs_t *

UDS_EVT_LinkControl 

Server evt 0x87, argtype: UDSLinkCtrlArgs_t *

UDS_EVT_Custom 

Server evt other, argtype: UDSCustomArgs_t *

UDS_EVT_Poll 

Client evt: Poll. Argument type: NULL

UDS_EVT_SendComplete 

Client evt: Send complete. Argument type: NULL

UDS_EVT_ResponseReceived 

Client evt: Response received. Argument type: NULL

UDS_EVT_Idle 

Client evt: Idle. Argument type: NULL

UDS_EVT_MAX 

Unused sentinel value

Definition at line 303 of file iso14229.h.

◆ UDSTpStatusFlags

private: Status flags set by the transport implementation.

Definition at line 204 of file iso14229.h.

Function Documentation

◆ UDSClientInit()

UDSErr_t UDSClientInit ( UDSClient_t * client)

Definition at line 55 of file iso14229.c.

◆ UDSClientPoll()

UDSErr_t UDSClientPoll ( UDSClient_t * client)

Definition at line 922 of file iso14229.c.

◆ UDSClientTpISOTpCInit()

UDSErr_t UDSClientTpISOTpCInit ( UDSTpISOTpC_t * tp,
uint32_t target_addr,
uint32_t source_addr,
uint32_t target_addr_func )
Parameters
tpUDSTpISOTpC_t instance.
target_addrClient sends physical requests to this address.
source_addrClient listens for responses at this address.
target_addr_funcClient sends functional transmissions to this address.

Definition at line 3136 of file iso14229.c.

◆ UDSClientTpIsoTpSockInit()

UDSErr_t UDSClientTpIsoTpSockInit ( UDSTpIsoTpSock_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t target_addr_func )

Definition at line 3616 of file iso14229.c.

◆ UDSCtrlDTCSetting()

UDSErr_t UDSCtrlDTCSetting ( UDSClient_t * client,
uint8_t dtcSettingType,
uint8_t * dtcSettingControlOptionRecord,
uint16_t len )

Definition at line 762 of file iso14229.c.

◆ UDSMillis()

uint32_t UDSMillis ( void )
Returns
current time in milliseconds
Note
implementers must ensure the return value is monotonically increasing between calls. The value must never go backwards. Wrap-around (overflow back to 0) is expected; this is handled by UDSTimeAfter.

◆ UDSSendBytes()

UDSErr_t UDSSendBytes ( UDSClient_t * client,
const uint8_t * data,
uint16_t size )

Definition at line 344 of file iso14229.c.

◆ UDSSendCommCtrl()

UDSErr_t UDSSendCommCtrl ( UDSClient_t * client,
uint8_t ctrl,
uint8_t comm )

Definition at line 379 of file iso14229.c.

◆ UDSSendDiagSessCtrl()

UDSErr_t UDSSendDiagSessCtrl ( UDSClient_t * client,
uint8_t mode )

Definition at line 368 of file iso14229.c.

◆ UDSSendECUReset()

UDSErr_t UDSSendECUReset ( UDSClient_t * client,
uint8_t type )

Definition at line 357 of file iso14229.c.

◆ UDSSendRDBI()

UDSErr_t UDSSendRDBI ( UDSClient_t * client,
const uint16_t * didList,
const uint16_t numDataIdentifiers )

Definition at line 402 of file iso14229.c.

◆ UDSSendRequestDownload()

UDSErr_t UDSSendRequestDownload ( UDSClient_t * client,
uint8_t dataFormatIdentifier,
uint8_t addressAndLengthFormatIdentifier,
size_t memoryAddress,
size_t memorySize )

Definition at line 494 of file iso14229.c.

◆ UDSSendRequestFileTransfer()

UDSErr_t UDSSendRequestFileTransfer ( UDSClient_t * client,
uint8_t mode,
const char * filePath,
size_t fileSizeUncompressed,
size_t fileSizeCompressed )

Definition at line 637 of file iso14229.c.

◆ UDSSendRequestTransferExit()

UDSErr_t UDSSendRequestTransferExit ( UDSClient_t * client)

Definition at line 627 of file iso14229.c.

◆ UDSSendRequestUpload()

UDSErr_t UDSSendRequestUpload ( UDSClient_t * client,
uint8_t dataFormatIdentifier,
uint8_t addressAndLengthFormatIdentifier,
size_t memoryAddress,
size_t memorySize )

Definition at line 535 of file iso14229.c.

◆ UDSSendRoutineCtrl()

UDSErr_t UDSSendRoutineCtrl ( UDSClient_t * client,
uint8_t type,
uint16_t routineIdentifier,
const uint8_t * data,
uint16_t size )

Definition at line 456 of file iso14229.c.

◆ UDSSendSecurityAccess()

UDSErr_t UDSSendSecurityAccess ( UDSClient_t * client,
uint8_t level,
uint8_t * data,
uint16_t size )

Definition at line 805 of file iso14229.c.

◆ UDSSendTesterPresent()

UDSErr_t UDSSendTesterPresent ( UDSClient_t * client)

Definition at line 391 of file iso14229.c.

◆ UDSSendTransferData()

UDSErr_t UDSSendTransferData ( UDSClient_t * client,
uint8_t blockSequenceCounter,
const uint16_t blockLength,
const uint8_t * data,
uint16_t size )

Definition at line 575 of file iso14229.c.

◆ UDSSendTransferDataStream()

UDSErr_t UDSSendTransferDataStream ( UDSClient_t * client,
uint8_t blockSequenceCounter,
const uint16_t blockLength,
FILE * fd )

Definition at line 599 of file iso14229.c.

◆ UDSSendWDBI()

UDSErr_t UDSSendWDBI ( UDSClient_t * client,
uint16_t dataIdentifier,
const uint8_t * data,
uint16_t size )

Definition at line 425 of file iso14229.c.

◆ UDSServerInit()

UDSErr_t UDSServerInit ( UDSServer_t * srv)

Definition at line 2558 of file iso14229.c.

◆ UDSServerPoll()

void UDSServerPoll ( UDSServer_t * srv)

Definition at line 2575 of file iso14229.c.

◆ UDSServerTpISOTpCInit()

UDSErr_t UDSServerTpISOTpCInit ( UDSTpISOTpC_t * tp,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func )
Parameters
tpUDSTpISOTpC_t instance.
source_addrServer listens for physical transmissions on this address.
target_addrServer sends responses to this address.
source_addr_funcServer listens for functional transmissions on this address.

Definition at line 3131 of file iso14229.c.

◆ UDSServerTpIsoTpSockInit()

UDSErr_t UDSServerTpIsoTpSockInit ( UDSTpIsoTpSock_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func )

Definition at line 3589 of file iso14229.c.

◆ UDSTpISOTpCSocketCANDeinit()

void UDSTpISOTpCSocketCANDeinit ( UDSTpISOTpCSocketCAN_t * tp)

Definition at line 3366 of file iso14229.c.

◆ UDSTpISOTpCSocketCANInit()

UDSErr_t UDSTpISOTpCSocketCANInit ( UDSTpISOTpCSocketCAN_t * tp,
const char * ifname,
uint32_t source_addr,
uint32_t target_addr,
uint32_t source_addr_func,
uint32_t target_addr_func )
Parameters
tptransport
ifnamecan0, vcan0
source_addr
target_addr
source_addr_func
target_addr_func

Definition at line 3341 of file iso14229.c.

◆ UDSTpIsoTpSockDeinit()

void UDSTpIsoTpSockDeinit ( UDSTpIsoTpSock_t * tp)

Definition at line 3642 of file iso14229.c.

◆ UDSTpPoll()

UDSTpStatus_t UDSTpPoll ( UDSTp_t * hdl)

Definition at line 2674 of file iso14229.c.

◆ UDSTpRecv()

UDSTpSize_t UDSTpRecv ( UDSTp_t * hdl,
uint8_t * buf,
size_t bufsize,
UDSSDU_t * info )

Definition at line 2668 of file iso14229.c.

◆ UDSTpSend()

UDSTpSize_t UDSTpSend ( UDSTp_t * hdl,
const uint8_t * buf,
UDSTpSize_t len,
const UDSSDU_t * info )

Definition at line 2662 of file iso14229.c.

◆ UDSUnpackRDBIResponse()

UDSErr_t UDSUnpackRDBIResponse ( UDSClient_t * client,
UDSRDBIVar_t * vars,
uint16_t numVars )

Definition at line 940 of file iso14229.c.

◆ UDSUnpackRequestDownloadResponse()

UDSErr_t UDSUnpackRequestDownloadResponse ( const UDSClient_t * client,
struct RequestDownloadResponse * resp )

Definition at line 896 of file iso14229.c.

◆ UDSUnpackRoutineControlResponse()

UDSErr_t UDSUnpackRoutineControlResponse ( const UDSClient_t * client,
struct RoutineControlResponse * resp )

Definition at line 868 of file iso14229.c.

◆ UDSUnpackSecurityAccessResponse()

UDSErr_t UDSUnpackSecurityAccessResponse ( const UDSClient_t * client,
struct SecurityAccessResponse * resp )

Definition at line 843 of file iso14229.c.