How to use the udsoncan.Response.Response.Code.ConditionsNotCorrect function in udsoncan

To help you get started, we’ve selected a few udsoncan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github pylessard / python-udsoncan / udsoncan / services / ControlDTCSetting.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *

class ControlDTCSetting(BaseService):
    _sid = 0x85

    supported_negative_response = [	Response.Code.SubFunctionNotSupported, 
                                                    Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange
                                                    ]
    class SettingType(BaseSubfunction):
        """
        ControlDTCSetting defined subfunctions
        """

        __pretty_name__ = 'setting type'

        on = 1
        off = 2
        vehicleManufacturerSpecific = (0x40, 0x5F)	# To be able to print textual name for logging only.
        systemSupplierSpecific = (0x60, 0x7E)		# To be able to print textual name for logging only.

    @classmethod
    def make_request(cls, setting_type, data = None):
github pylessard / python-udsoncan / udsoncan / services / AccessTimingParameter.py View on Github external
class AccessType(BaseSubfunction):
        """
        AccessTimingParameter defined subfunctions
        """

        __pretty_name__ = 'access type'

        readExtendedTimingParameterSet = 1
        setTimingParametersToDefaultValues = 2
        readCurrentlyActiveTimingParameters = 3
        setTimingParametersToGivenValues = 4

    supported_negative_response = [	Response.Code.SubFunctionNotSupported, 
                                                    Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange
                                                    ]	

    @classmethod
    def make_request(cls, access_type, timing_param_record=None):
        """
        Generates a request for AccessTimingParameter

        :param access_type: Service subfunction. Allowed values are from 0 to 0x7F
        :type access_type: int

        :param timing_param_record: Data associated with request. Must be present only when access_type=``AccessType.setTimingParametersToGivenValues`` (4)
        :type timing_param_record: bytes

        :raises ValueError: If parameters are out of range, missing or wrong type
        """
github pylessard / python-udsoncan / udsoncan / services / RequestDownload.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *
import struct 

class RequestDownload(BaseService):
    _sid = 0x34
    _use_subfunction = False

    supported_negative_response = [	 Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied,
                                                    Response.Code.UploadDownloadNotAccepted
                                                    ]
    @classmethod
    def normalize_data_format_identifier(cls, dfi):
        from udsoncan import DataFormatIdentifier
        if dfi is None:
            dfi = DataFormatIdentifier()

        if not isinstance(dfi, DataFormatIdentifier):
            raise ValueError('dfi must be an instance of DataFormatIdentifier')

        return dfi

    @classmethod
github pylessard / python-udsoncan / udsoncan / services / ReadDataByPeriodicIdentifier.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *

class ReadDataByPeriodicIdentifier(BaseService):
    _sid = 0x2A

    supported_negative_response = [	 Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied
                                                    ]

    @classmethod
    def make_request(cls):
        raise NotImplementedError('Service is not implemented')

    @classmethod
    def interpret_response(cls, response):
        raise NotImplementedError('Service is not implemented')

    class ResponseData(BaseResponseData):	
        def __init__(self):
            super().__init__(ReadDataByPeriodicIdentifier)
github pylessard / python-udsoncan / udsoncan / services / InputOutputControlByIdentifier.py View on Github external
#
    class ControlParam(BaseSubfunction):
        """
        InputOutputControlByIdentifier defined control parameters as defined by ISO-14229:2006, Annex E
        """	

        __pretty_name__ = 'control parameter'

        returnControlToECU = 0
        resetToDefault = 1
        freezeCurrentState = 2
        shortTermAdjustment = 3

    supported_negative_response = [	 Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied
                                                    ]

    @classmethod
    def make_request(cls, did, control_param=None, values=None, masks=None, ioconfig=None):
        """
        Generates a request for InputOutputControlByIdentifier

        :param did: Data identifier to represent the IO
        :type did: int

        :param control_param: Optional parameter that can be a value defined in :class:`InputOutputControlByIdentifier.ControlParam`
        :type control_param: int

        :param values: Optional values to send to the server. This parameter will be given to :ref:`DidCodec`.encode() method. 
github pylessard / python-udsoncan / udsoncan / services / DynamicallyDefineDataIdentifier.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *

class DynamicallyDefineDataIdentifier(BaseService):
    _sid = 0x2C

    supported_negative_response = [	 Response.Code.SubFunctionNotSupported,
                                                    Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied
                                                    ]

    @classmethod
    def make_request(cls):
        raise NotImplementedError('Service is not implemented')

    @classmethod
    def interpret_response(cls, response):
        raise NotImplementedError('Service is not implemented')

    class ResponseData(BaseResponseData):	
        def __init__(self):
            super().__init__(DynamicallyDefineDataIdentifier)
github pylessard / python-udsoncan / udsoncan / services / ClearDiagnosticInformation.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *
import struct

class ClearDiagnosticInformation(BaseService):
    _sid = 0x14
    _use_subfunction = False
    _no_response_data = True

    supported_negative_response = [	 Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange
                                                    ]

    @classmethod
    def make_request(cls, group=0xFFFFFF):
        """
        Generates a request for ClearDiagnosticInformation

        :param group: DTC mask ranging from 0 to 0xFFFFFF. 0xFFFFFF means all DTCs
        :type group: int

        :raises ValueError: If parameters are out of range, missing or wrong type
        """		
        from udsoncan import Request
        ServiceHelper.validate_int(group, min=0, max=0xFFFFFF, name='Group of DTC')
        request = Request(service=cls)
github pylessard / python-udsoncan / udsoncan / services / CommunicationControl.py View on Github external
_sid = 0x28

    class ControlType(BaseSubfunction):
        """
        CommunicationControl defined subfunctions
        """		
        __pretty_name__ = 'control type' 

        enableRxAndTx = 0
        enableRxAndDisableTx = 1
        disableRxAndEnableTx = 2
        disableRxAndTx = 3

    supported_negative_response = [	Response.Code.SubFunctionNotSupported, 
                                                    Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange
                                                    ]

    @classmethod
    def normalize_communication_type(self, communication_type):
        from udsoncan import CommunicationType

        if not isinstance(communication_type, CommunicationType) and not isinstance(communication_type, int) and not isinstance(communication_type, bytes):
            raise ValueError('communication_type must either be a CommunicationType object or an integer')

        if isinstance(communication_type, int) or isinstance(communication_type, bytes):
            communication_type = CommunicationType.from_byte(communication_type)

        return communication_type

    @classmethod
github pylessard / python-udsoncan / udsoncan / services / RoutineControl.py View on Github external
class RoutineControl(BaseService):
    _sid = 0x31

    class ControlType(BaseSubfunction):
        """
        RoutineControl defined subfunctions
        """		
        __pretty_name__ = 'control type'

        startRoutine = 1
        stopRoutine = 2
        requestRoutineResults = 3

    supported_negative_response = [	 Response.Code.SubFunctionNotSupported,
                                                    Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestSequenceError,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied,
                                                    Response.Code.GeneralProgrammingFailure
                                                    ]

    @classmethod
    def make_request(cls, routine_id, control_type, data=None):
        """
        Generates a request for RoutineControl

        :param routine_id: The routine ID. Value should be between 0 and 0xFFFF
        :type routine_id: int

        :param control_type: Service subfunction. Allowed values are from 0 to 0x7F
        :type control_type: bytes
github pylessard / python-udsoncan / udsoncan / services / RequestUpload.py View on Github external
from . import *
from udsoncan.Response import Response
from udsoncan.exceptions import *
import struct 

class RequestUpload(BaseService):
    _sid = 0x35
    _use_subfunction = False

    supported_negative_response = [	 Response.Code.IncorrectMessageLegthOrInvalidFormat,
                                                    Response.Code.ConditionsNotCorrect,
                                                    Response.Code.RequestOutOfRange,
                                                    Response.Code.SecurityAccessDenied,
                                                    Response.Code.UploadDownloadNotAccepted
                                                    ]
    @classmethod
    def normalize_data_format_identifier(cls, dfi):
        from udsoncan import DataFormatIdentifier
        if dfi is None:
            dfi = DataFormatIdentifier()

        if not isinstance(dfi, DataFormatIdentifier):
            raise ValueError('dfi must be an instance of DataFormatIdentifier')

        return dfi

    @classmethod