libdoip  0.1.0
DoIP (Diagnostics over Internet Protocol) ISO 13400 C++17 Library
doip::uds Namespace Reference

Classes

class  IUdsServiceHandler
 
class  LambdaUdsHandler
 
class  UdsMock
 
struct  UdsServiceDescriptor
 

Typedefs

using UdsResponse = std::pair< UdsResponseCode, ByteArray >
 
using IUdsServiceHandlerPtr = std::unique_ptr< IUdsServiceHandler >
 
using uds_length = uint16_t
 

Enumerations

enum class  UdsResponseCode : uint8_t {
  OK = 0 ,
  PositiveResponse = 0x0 ,
  GeneralReject = 0x10 ,
  ServiceNotSupported = 0x11 ,
  SubFunctionNotSupported = 0x12 ,
  IncorrectMessageLengthOrInvalidFormat = 0x13 ,
  ResponseTooLong = 0x14 ,
  BusyRepeatRequest = 0x21 ,
  ConditionsNotCorrect = 0x22 ,
  RequestSequenceError = 0x24 ,
  NoResponseFromSubnetComponent = 0x25 ,
  FailurePreventsExecutionOfRequestedAction = 0x26 ,
  RequestOutOfRange = 0x31 ,
  SecurityAccessDenied = 0x33 ,
  AuthenticationRequired = 0x34 ,
  InvalidKey = 0x35 ,
  ExceedNumberOfAttempts = 0x36 ,
  RequiredTimeDelayNotExpired = 0x37 ,
  SecureDataTransmissionRequired = 0x38 ,
  SecureDataTransmissionNotAllowed = 0x39 ,
  SecureDataVerificationFailed = 0x3A ,
  CertficateVerificationFailedInvalidTimePeriod = 0x50 ,
  CertficateVerificationFailedInvalidSignature = 0x51 ,
  CertficateVerificationFailedInvalidChainOfTrust = 0x52 ,
  CertficateVerificationFailedInvalidType = 0x53 ,
  CertficateVerificationFailedInvalidFormat = 0x54 ,
  CertficateVerificationFailedInvalidContent = 0x55 ,
  CertficateVerificationFailedInvalidScope = 0x56 ,
  CertficateVerificationFailedInvalidCertificate = 0x57 ,
  OwnershipVerificationFailed = 0x58 ,
  ChallengeCalculationFailed = 0x59 ,
  SettingAccessRightsFailed = 0x5A ,
  SessionKeyCreationOrDerivationFailed = 0x5B ,
  ConfigurationDataUsageFailed = 0x5C ,
  DeAuthenticationFailed = 0x5D ,
  UploadDownloadNotAccepted = 0x70 ,
  TransferDataSuspended = 0x71 ,
  GeneralProgrammingFailure = 0x72 ,
  WrongBlockSequenceCounter = 0x73 ,
  RequestCorrectlyReceived_ResponsePending = 0x78 ,
  SubFunctionNotSupportedInActiveSession = 0x7E ,
  ServiceNotSupportedInActiveSession = 0x7F ,
  RpmTooHigh = 0x81 ,
  RpmTooLow = 0x82 ,
  EngineIsRunning = 0x83 ,
  EngineIsNotRunning = 0x84 ,
  EngineRunTimeTooLow = 0x85 ,
  TemperatureTooHigh = 0x86 ,
  TemperatureTooLow = 0x87 ,
  VehicleSpeedTooHigh = 0x88 ,
  VehicleSpeedTooLow = 0x89 ,
  ThrottlePedalTooHigh = 0x8A ,
  ThrottlePedalTooLow = 0x8B ,
  TransmissionRangeNotInNeutral = 0x8C ,
  TransmissionRangeNotInGear = 0x8D ,
  BrakeSwitchNotClosed = 0x8F ,
  ShifterLeverNotInPark = 0x90 ,
  TorqueConverterClutchLocked = 0x91 ,
  VoltageTooHigh = 0x92 ,
  VoltageTooLow = 0x93 ,
  ResourceTemporarilyNotAvailable = 0x94
}
 
enum class  UdsService : uint8_t {
  DiagnosticSessionControl = 0x10 ,
  ECUReset = 0x11 ,
  SecurityAccess = 0x27 ,
  CommunicationControl = 0x28 ,
  TesterPresent = 0x3E ,
  AccessTimingParameters = 0x83 ,
  SecuredDataTransmission = 0x84 ,
  ControlDTCSetting = 0x85 ,
  ResponseOnEvent = 0x86 ,
  LinkControl = 0x87 ,
  ReadDataByIdentifier = 0x22 ,
  ReadMemoryByAddress = 0x23 ,
  ReadScalingDataByIdentifier = 0x24 ,
  ReadDataByPeriodicIdentifier = 0x2A ,
  DynamicallyDefineDataIdentifier = 0x2C ,
  WriteDataByIdentifier = 0x2E ,
  WriteMemoryByAddress = 0x3D ,
  ClearDiagnosticInformation = 0x14 ,
  ReadDTCInformation = 0x19
}
 

Functions

std::ostream & operator<< (std::ostream &os, const UdsResponse &response)
 
std::ostream & operator<< (std::ostream &os, const UdsResponseCode &code)
 
const UdsServiceDescriptorfindServiceDescriptor (UdsService sid)
 Find service descriptor by service ID. More...
 

Variables

constexpr uint8_t UDS_POSITIVE_RESPONSE_OFFSET = 0x40
 
constexpr uds_length MAX_UDS_MESSAGE_LENGTH = 4095
 
constexpr std::array< UdsServiceDescriptor, 19 > UDS_SERVICE_DESCRIPTORS
 

Typedef Documentation

◆ IUdsServiceHandlerPtr

using doip::uds::IUdsServiceHandlerPtr = typedef std::unique_ptr<IUdsServiceHandler>

Definition at line 36 of file IUdsServiceHandler.h.

◆ uds_length

using doip::uds::uds_length = typedef uint16_t

Definition at line 34 of file UdsServices.h.

◆ UdsResponse

using doip::uds::UdsResponse = typedef std::pair<UdsResponseCode, ByteArray>

Definition at line 10 of file IUdsServiceHandler.h.

Enumeration Type Documentation

◆ UdsResponseCode

enum doip::uds::UdsResponseCode : uint8_t
strong
Enumerator
OK 
PositiveResponse 
GeneralReject 
ServiceNotSupported 
SubFunctionNotSupported 
IncorrectMessageLengthOrInvalidFormat 
ResponseTooLong 
BusyRepeatRequest 
ConditionsNotCorrect 
RequestSequenceError 
NoResponseFromSubnetComponent 
FailurePreventsExecutionOfRequestedAction 
RequestOutOfRange 
SecurityAccessDenied 
AuthenticationRequired 
InvalidKey 
ExceedNumberOfAttempts 
RequiredTimeDelayNotExpired 
SecureDataTransmissionRequired 
SecureDataTransmissionNotAllowed 
SecureDataVerificationFailed 
CertficateVerificationFailedInvalidTimePeriod 
CertficateVerificationFailedInvalidSignature 
CertficateVerificationFailedInvalidChainOfTrust 
CertficateVerificationFailedInvalidType 
CertficateVerificationFailedInvalidFormat 
CertficateVerificationFailedInvalidContent 
CertficateVerificationFailedInvalidScope 
CertficateVerificationFailedInvalidCertificate 
OwnershipVerificationFailed 
ChallengeCalculationFailed 
SettingAccessRightsFailed 
SessionKeyCreationOrDerivationFailed 
ConfigurationDataUsageFailed 
DeAuthenticationFailed 
UploadDownloadNotAccepted 
TransferDataSuspended 
GeneralProgrammingFailure 
WrongBlockSequenceCounter 
RequestCorrectlyReceived_ResponsePending 
SubFunctionNotSupportedInActiveSession 
ServiceNotSupportedInActiveSession 
RpmTooHigh 
RpmTooLow 
EngineIsRunning 
EngineIsNotRunning 
EngineRunTimeTooLow 
TemperatureTooHigh 
TemperatureTooLow 
VehicleSpeedTooHigh 
VehicleSpeedTooLow 
ThrottlePedalTooHigh 
ThrottlePedalTooLow 
TransmissionRangeNotInNeutral 
TransmissionRangeNotInGear 
BrakeSwitchNotClosed 
ShifterLeverNotInPark 
TorqueConverterClutchLocked 
VoltageTooHigh 
VoltageTooLow 
ResourceTemporarilyNotAvailable 

Definition at line 11 of file UdsResponseCode.h.

◆ UdsService

enum doip::uds::UdsService : uint8_t
strong
Enumerator
DiagnosticSessionControl 
ECUReset 
SecurityAccess 
CommunicationControl 
TesterPresent 
AccessTimingParameters 
SecuredDataTransmission 
ControlDTCSetting 
ResponseOnEvent 
LinkControl 
ReadDataByIdentifier 
ReadMemoryByAddress 
ReadScalingDataByIdentifier 
ReadDataByPeriodicIdentifier 
DynamicallyDefineDataIdentifier 
WriteDataByIdentifier 
WriteMemoryByAddress 
ClearDiagnosticInformation 
ReadDTCInformation 

Definition at line 12 of file UdsServices.h.

Function Documentation

◆ findServiceDescriptor()

const UdsServiceDescriptor* doip::uds::findServiceDescriptor ( UdsService  sid)
inline

Find service descriptor by service ID.

Parameters
sidthe UDS service ID
Returns
const UdsServiceDescriptor* the service descriptor or nullptr if not found

Definition at line 73 of file UdsServices.h.

References UDS_SERVICE_DESCRIPTORS.

Referenced by doip::uds::UdsMock::handleDiagnosticRequest().

◆ operator<<() [1/2]

std::ostream& doip::uds::operator<< ( std::ostream &  os,
const UdsResponse response 
)
inline

Definition at line 12 of file IUdsServiceHandler.h.

◆ operator<<() [2/2]

Variable Documentation

◆ MAX_UDS_MESSAGE_LENGTH

constexpr uds_length doip::uds::MAX_UDS_MESSAGE_LENGTH = 4095
constexpr

Definition at line 43 of file UdsServices.h.

◆ UDS_POSITIVE_RESPONSE_OFFSET

constexpr uint8_t doip::uds::UDS_POSITIVE_RESPONSE_OFFSET = 0x40
constexpr

Definition at line 19 of file UdsMock.h.

◆ UDS_SERVICE_DESCRIPTORS

constexpr std::array<UdsServiceDescriptor, 19> doip::uds::UDS_SERVICE_DESCRIPTORS
constexpr
Initial value:
= {{
{ UdsService::DiagnosticSessionControl, 2, 2, 6, 6 },
{ UdsService::ECUReset, 2, 2, 2, 2 },
{ UdsService::SecurityAccess, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::CommunicationControl, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::TesterPresent, 2, 2, 2, 2 },
{ UdsService::AccessTimingParameters, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::SecuredDataTransmission, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ControlDTCSetting, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ResponseOnEvent, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::LinkControl, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ReadDataByIdentifier, 3, MAX_UDS_MESSAGE_LENGTH, 4, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ReadMemoryByAddress, 4, MAX_UDS_MESSAGE_LENGTH, 4, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ReadScalingDataByIdentifier, 3, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ReadDataByPeriodicIdentifier, 3, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::DynamicallyDefineDataIdentifier, 3, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::WriteDataByIdentifier, 4, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::WriteMemoryByAddress, 4, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ClearDiagnosticInformation, 3, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH },
{ UdsService::ReadDTCInformation, 2, MAX_UDS_MESSAGE_LENGTH, 3, MAX_UDS_MESSAGE_LENGTH }
}}
constexpr uds_length MAX_UDS_MESSAGE_LENGTH
Definition: UdsServices.h:43

Definition at line 45 of file UdsServices.h.

Referenced by findServiceDescriptor().