Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(uds): fix error code for failurePreventsExecutionOfRequestedAction #193

Merged
merged 3 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/cursed_hr/cursed_hr.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from copy import deepcopy
from dataclasses import dataclass
from datetime import datetime
from enum import IntEnum
from enum import IntEnum, unique
from math import ceil
from pathlib import Path
from typing import Any, BinaryIO, Optional, Union
Expand All @@ -31,6 +31,7 @@
from gallia.uds.core.service import NegativeResponse, UDSRequest, UDSResponse


@unique
class InterpretationColor(IntEnum):
DEFAULT = 42
UDS_REQUEST = 43
Expand Down
3 changes: 2 additions & 1 deletion src/gallia/db/db_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import asyncio
import json
from datetime import datetime
from enum import Enum
from enum import Enum, unique
from pathlib import Path
from typing import Any, Optional

Expand Down Expand Up @@ -118,6 +118,7 @@ def bytes_repr(data: bytes) -> str:
"""


@unique
class LogMode(Enum):
implicit = "implicit"
explicit = "explicit"
Expand Down
3 changes: 2 additions & 1 deletion src/gallia/penlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@
#
# SPDX-License-Identifier: Apache-2.0

from enum import Enum
from enum import Enum, unique
from typing import Any, Optional

import penlog


@unique
class MessageType(str, Enum):
READ = "read"
WRITE = "write"
Expand Down
11 changes: 9 additions & 2 deletions src/gallia/transports/doip.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,27 @@
import asyncio
import struct
from dataclasses import dataclass
from enum import IntEnum
from enum import IntEnum, unique
from typing import Optional, TypedDict, Union, cast

from gallia.penlog import Logger
from gallia.transports.base import BaseTransport, TargetURI, _int_spec


@unique
class ProtocolVersions(IntEnum):
ISO_13400_2_2010 = 0x01
ISO_13400_2_2012 = 0x02


@unique
class RoutingActivationRequestTypes(IntEnum):
Default = 0x00
WWH_OBD = 0x01
CentralSecurity = 0xE0


@unique
class RoutingActivationResponseCodes(IntEnum):
UnknownSourceAddress = 0x00
NoRessources = 0x01
Expand All @@ -37,6 +40,7 @@ class RoutingActivationResponseCodes(IntEnum):
SuccessConfirmationRequired = 0x11


@unique
class PayloadTypes(IntEnum):
NegativeAcknowledge = 0x0000
VehicleIdentificationRequestMessage = 0x0002
Expand All @@ -47,16 +51,18 @@ class PayloadTypes(IntEnum):
AliveCheckRequest = 0x0007
AliveCheckResponse = 0x0008
DoIPEntityStatusRequest = 0x4001
DoIPEntityStatusResponse = 0x4001
DoIPEntityStatusResponse = 0x4002
DiagnosticMessage = 0x8001
DiagnosticMessagePositiveAcknowledgement = 0x8002
DiagnosticMessageNegativeAcknowledgement = 0x8003


@unique
class DiagnosticMessagePositiveAckCodes(IntEnum):
Success = 0x00


@unique
class DiagnosticMessageNegativeAckCodes(IntEnum):
InvalidSourceAddress = 0x02
UnknownTargetAddress = 0x03
Expand All @@ -67,6 +73,7 @@ class DiagnosticMessageNegativeAckCodes(IntEnum):
TransportProtocolError = 0x08


@unique
class GenericHeaderNACKCodes(IntEnum):
IncorrectPatternFormat = 0x01
UnknownPayloadType = 0x02
Expand Down
15 changes: 13 additions & 2 deletions src/gallia/uds/core/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
#
# SPDX-License-Identifier: Apache-2.0

from enum import IntEnum
from enum import IntEnum, unique


@unique
class UDSIsoServices(IntEnum):
ShowCurrentData = 0x01
ShowFreezeFrameData = 0x02
Expand Down Expand Up @@ -46,6 +47,7 @@ class UDSIsoServices(IntEnum):
NegativeResponse = 0x7F


@unique
class UDSErrorCodes(IntEnum):
generalReject = 0x10
serviceNotSupported = 0x11
Expand All @@ -56,7 +58,7 @@ class UDSErrorCodes(IntEnum):
conditionsNotCorrect = 0x22
requestSequenceError = 0x24
noResponseFromSubnetComponent = 0x25
failurePreventsExecutionOfRequestedAction = 0x25
failurePreventsExecutionOfRequestedAction = 0x26
requestOutOfRange = 0x31
securityAccessDenied = 0x33
authenticationRequired = 0x34
Expand Down Expand Up @@ -123,6 +125,7 @@ class UDSErrorCodes(IntEnum):
vehicleManufacturerSpecificConditionsNotCorrectFE = 0xFE


@unique
class DSCSubFuncs(IntEnum):
# defaultSession
DS = 0x01
Expand All @@ -134,6 +137,7 @@ class DSCSubFuncs(IntEnum):
SSDS = 0x04


@unique
class RCSubFuncs(IntEnum):
# start routine
STR = 0x01
Expand All @@ -143,6 +147,7 @@ class RCSubFuncs(IntEnum):
RRR = 0x03


@unique
class CCSubFuncs(IntEnum):
# enableRxAndTx
ERXTX = 0x00
Expand All @@ -155,12 +160,14 @@ class CCSubFuncs(IntEnum):
# Plus vendor specific stuff...


@unique
class CDTCSSubFuncs(IntEnum):
ON = 0x01
OFF = 0x02
# Plus vendor specific stuff...


@unique
class RDTCISubFuncs(IntEnum):
# reportNumberOfDTCByStatusMask
RNODTCBSM = 0x01
Expand Down Expand Up @@ -190,6 +197,7 @@ class RDTCISubFuncs(IntEnum):
RDTCWPS = 0x15


@unique
class ERSubFuncs(IntEnum):
# hardReset
HR = 0x01
Expand All @@ -203,6 +211,7 @@ class ERSubFuncs(IntEnum):
DRPSD = 0x05


@unique
class InputOutputControlParameter(IntEnum):
# returnControlToECU
RCTECU = 0x00
Expand All @@ -214,6 +223,7 @@ class InputOutputControlParameter(IntEnum):
STA = 0x03


@unique
class DTCFormatIdentifier(IntEnum):
# ISO15031-6DTCFormat
ISO_15031_6 = 0x00
Expand Down Expand Up @@ -256,5 +266,6 @@ class DTCFormatIdentifier(IntEnum):
}


@unique
class DataIdentifier(IntEnum):
ActiveDiagnosticSessionDataIdentifier = 0xF186
4 changes: 3 additions & 1 deletion src/gallia/udscan/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from argparse import ArgumentDefaultsHelpFormatter, Namespace
from asyncio import Task
from datetime import datetime, timezone
from enum import Enum, IntEnum
from enum import Enum, IntEnum, unique
from importlib.metadata import EntryPoint, entry_points, version
from pathlib import Path
from secrets import token_urlsafe
Expand All @@ -37,13 +37,15 @@
from gallia.utils import camel_to_snake, g_repr


@unique
class ExitCodes(IntEnum):
SUCCESS = 0
GENERIC_ERROR = 1
SETUP_FAILED = 10
TEARDOWN_FAILED = 11


@unique
class FileNames(Enum):
PROPERTIES_PRE = "PROPERTIES_PRE.json"
PROPERTIES_POST = "PROPERTIES_POST.json"
Expand Down
6 changes: 5 additions & 1 deletion src/penlog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@
import uuid
from dataclasses import dataclass, asdict
from datetime import datetime
from enum import Enum, IntEnum
from enum import Enum, IntEnum, unique
from typing import Any, TextIO, Optional


@unique
class MessageType(str, Enum):
MESSAGE = "message"


@unique
class MessagePrio(IntEnum):
EMERGENCY = 0
ALERT = 1
Expand All @@ -31,6 +33,7 @@ class MessagePrio(IntEnum):
TRACE = 8


@unique
class OutputType(Enum):
JSON = "json"
JSON_PRETTY = "json-pretty"
Expand All @@ -39,6 +42,7 @@ class OutputType(Enum):
HR_NANO = "hr-nano"


@unique
class Color(Enum):
NOP = ""
RESET = "\033[0m"
Expand Down