Changeset - a3984dfada9d
[Not reviewed]
default
0 6 1
John Kemp - 4 years ago 2020-10-06 21:59:05

Updated neodevice module documentation, particularly the set_settings methods.
Switched can module documentation to just include source for now.
Spec module documentation now points to an example of how to use a spec.
Added requirements file.
Update hgignore file.
7 files changed with 93 insertions and 13 deletions:
0 comments (0 inline, 0 general)
.hgignore
Show inline comments
 
syntax: glob
 
build/*
 
*.pyc
 
.idea/*
 
.pytest_cache/*
 
doc_build/*
 
venv/*
doc/neovi.can.rst
Show inline comments
 
neovi.can module
 
================
 

	
 
.. automodule:: neovi.can
 
    :members:
 
    :undoc-members:
 
    :show-inheritance:
 
.. literalinclude:: ../neovi/can.py
doc/neovi.neodevice.rst
Show inline comments
...
 
@@ -4,4 +4,3 @@ neovi.neodevice module
 
.. automodule:: neovi.neodevice
 
    :members:
 
    :undoc-members:
 
    :show-inheritance:
neovi/can.py
Show inline comments
 
# The file is part of the pyneovi project and is provided under the MIT License terms.
 
# For license information see LICENSE.txt.
 
"""
 
.. literalinclude:: ../neovi/can.py
 

 
"""
 

 
import enum
 

 
# -------------------
 
# Service identifiers
 
# -------------------
 

 
# Message types
 
DIAG_CURRENT_DATA          = 0x01
 
DIAG_FREEZE_FRAME_DATA     = 0x02
 
DIAG_STORED_DTCS           = 0x03
...
 
@@ -16,39 +18,57 @@ DIAG_PENDING_DTCS          = 0x07
 
DIAG_VEHICLE_INFORMATION   = 0x09
 
DIAG_PERMANENT_DTCS        = 0x0A
 

 
# Diagnostic and communications management
 
DIAGNOSTIC_SESSION_CONTROL = 0x10
 
ECU_RESET                  = 0x11
 
SECURITY_ACCESS            = 0x27
 
COMMUNICATION_CONTROL      = 0x28
 
AUTHENTICATION             = 0x29
 
TESTER_PRESENT             = 0x3E
 
ACCESS_TIMING_PARAMETER    = 0x83
 
ACCESS_TIMING_PARAMETERS   = 0x83
 
SECURED_DATA_TRANSMISSION  = 0x84
 
CONTROL_DTC_SETTING        = 0x85
 
RESPONSE_ON_EVENT          = 0x86
 
LINK_CONTROL               = 0x87
 

 
# Data transmission
 
READ_DATA_BY_ID            = 0x22
 
READ_MEMORY_BY_ADDRESS     = 0x23
 
READ_SCALING_DATA_BY_ID    = 0x24
 
READ_DATA_BY_PERIODIC_ID   = 0x2A
 
READ_DATA_BY_ID_PERIODIC   = 0x2A
 
DYNAMICALLY_DEFINE_DATA_ID = 0x2C
 
WRITE_DATA_BY_ID           = 0x2E
 
WRITE_MEMORY_BY_ADDRESS    = 0x3D
 

 
# Stored data transmission
 
CLEAR_DIAGNOSTIC_INFORMATION = 0x14
 
READ_DTC_INFORMATION         = 0x19
 

 
# Input / output control
 
IO_CONTROL_BY_ID           = 0x2F
 

 
# Remote activation of routine
 
ROUTINE_CONTROL            = 0x31
 

 
# Upload / download
 
REQUEST_DOWNLOAD           = 0x34
 
REQUEST_UPLOAD             = 0x35
 
TRANSFER_DATA              = 0x36
 
REQUEST_TRANSFER_EXIT      = 0x37
 
REQUEST_FILE_TRANSFER      = 0x38
 

 

 
def get_response_sid(request_sid: int) -> int:
 
    return request_sid + 0x40
 

 

 
NEGATIVE_RESPONSE = 0x7F
 

 

 
# -----------------------------
 
# DIAG_VEHICLE_INFORMATION PIDs
 
# -----------------------------
 

 
SUPPORTED_PIDS                 = 0x00
 
VIN_MESSAGE_COUNT              = 0x01
 
VIN                            = 0x02
neovi/neodevice.py
Show inline comments
...
 
@@ -47,10 +47,12 @@ def find_devices(types=neovi.NEODEVICE_A
 
    Find any attached neoVI devices.
 
    
 
    :param int types: Filter the results to given types of devices. The
 
        NEODEVICE_* constants defined in :py:mod:`~neovi.neovi` can be OR'd together.
 
        NEODEVICE_* constants defined in :py:mod:`~neovi.neovi` can be OR'd
 
        together.
 
    :param bool auto_open: Determines whether each device should be
 
        automatically opened. If this is False then you must call
 
        :py:meth:`.NeoDevice.open` in order to open a given device.
 
        :py:meth:`.NeoDevice.open` in order to open a given device before
 
        using it.
 
    """
 
    return [device_class_lookup[device.DeviceType](device, auto_open) for device in neovi.FindNeoDevices(types)]
 
    
...
 
@@ -140,8 +142,10 @@ class NeoDevice:
 
        Set the device configuration.
 

 
        :param settings: A device-specific configuration.
 
        :param save_to_eeprom: Determines if the configuration will be persisted across device power cycles.
 
        :return:
 
        :param bool save_to_eeprom: Determines if the configuration will be persisted across device power cycles.
 
        :return: Either SUCCESS or an error code (see
 
            `Error Messages <https://cdn.intrepidcs.net/support/neoVIDLL/apiErrorMessages.htm>`_
 
            in the ICS API documentation).
 
        """
 
        raise NotImplementedError
 
        
...
 
@@ -292,14 +296,29 @@ class NeoDevice:
 
        self.set_settings(settings)
 
    
 
    def get_firmware_version(self):
 
        """
 
        Return the firmware version of the device.
 

 
        :return: A firmware info object if the call succeeded, otherwise None.
 
        :rtype: :py:class:`.structures.APIFirmwareInfo`
 
        """
 
        result, info = neovi.GetHWFirmwareInfo(self._handle)
 
        return info if result else None
 

 
    def get_dll_firmware_version(self):
 
        """
 
        Return the firmware version stored within the DLL API.
 

 
        :return: A firmware info object if the call succeeded, otherwise None.
 
        :rtype: :py:class:`.structures.APIFirmwareInfo`
 
        """
 
        result, info = neovi.GetDLLFirmwareInfo(self._handle)
 
        return info if result else None
 

 
    def force_firmware_update(self):
 
        """
 
        Force the firmware on the device to be updated to the version stored in the DLL API.
 
        """
 
        neovi.ForceFirmwareUpdate(self._handle)
 

 
    def close(self):
...
 
@@ -353,6 +372,8 @@ class NeoFire(NeoDevice):
 
    """
 
    Represents a neoVI Fire device. Should be used if settings specific to the
 
    neoVI Fire must be read/written.
 

 
    Base class: :py:class:`NeoDevice`
 
    """
 
    def __init__(self, device, auto_open=True, launch_msg_queue_thread=True):
 
        NeoDevice.__init__(self, device, auto_open, launch_msg_queue_thread)
...
 
@@ -361,6 +382,15 @@ class NeoFire(NeoDevice):
 
        return neovi.GetFireSettings(self._handle)
 
    
 
    def set_settings(self, settings, save_to_eeprom=False):
 
        """
 
        Set the device configuration.
 

 
        :param structures.SFireSettings settings: The new configuration.
 
        :param bool save_to_eeprom: Determines if the configuration will be persisted across device power cycles.
 
        :return: Either SUCCESS or an error code (see
 
            `Error Messages <https://cdn.intrepidcs.net/support/neoVIDLL/apiErrorMessages.htm>`_
 
            in the ICS API documentation).
 
        """
 
        return neovi.SetFireSettings(self._handle, settings, save_to_eeprom)
 

 

...
 
@@ -368,6 +398,8 @@ class NeoRed(NeoFire):
 
    """
 
    Represents a neoVI Red device. Should be used if settings specific to the
 
    neoVI Red must be read/written.
 

 
    Base class: :py:class:`NeoFire`
 
    """
 
    pass
 

...
 
@@ -376,6 +408,8 @@ class NeoVCAN3(NeoDevice):
 
    """
 
    Represents a ValueCAN3 device. Should be used if settings specific to the
 
    ValueCAN3 must be read/written.
 

 
    Base class: :py:class:`NeoDevice`
 
    """
 
    def __init__(self, device, auto_open=True, launch_msg_queue_thread=True):
 
        NeoDevice.__init__(self, device, auto_open, launch_msg_queue_thread)
...
 
@@ -384,6 +418,15 @@ class NeoVCAN3(NeoDevice):
 
        return neovi.GetVCAN3Settings(self._handle)
 
    
 
    def set_settings(self, settings, save_to_eeprom=False):
 
        """
 
        Set the device configuration.
 

 
        :param structures.SVCAN3Settings settings: The new configuration.
 
        :param bool save_to_eeprom: Determines if the configuration will be persisted across device power cycles.
 
        :return: Either SUCCESS or an error code (see
 
            `Error Messages <https://cdn.intrepidcs.net/support/neoVIDLL/apiErrorMessages.htm>`_
 
            in the ICS API documentation).
 
        """
 
        return neovi.SetVCAN3Settings(self._handle, settings, save_to_eeprom)
 
        
 
        
...
 
@@ -391,11 +434,25 @@ class NeoBlue(NeoDevice):
 
    """
 
    Represents a neoVI Blue device. Should be used if settings specific to the
 
    neoVI Blue must be read/written.
 

 
    Base class: :py:class:`NeoDevice`
 
    """
 
    def __init__(self, device, auto_open=True, launch_msg_queue_thread=True):
 
        NeoDevice.__init__(self, device, auto_open, launch_msg_queue_thread)
 
    
 
    def set_settings(self, settings, save_to_eeprom=False):
 
        """
 
        Set the device configuration.
 

 
        :param settings: An array of configuration bytes (see
 
            `Configuration Array <https://cdn.intrepidcs.net/support/neoVIDLL/ConfigArray.htm>`_
 
            in the ICS API documentation).
 
        :param bool save_to_eeprom: Determines if the configuration will be persisted across device power cycles.
 
        :return: Either SUCCESS or an error code (see
 
            `Error Messages <https://cdn.intrepidcs.net/support/neoVIDLL/apiErrorMessages.htm>`_
 
            in the ICS API documentation).
 
        :raises InvalidConfigurationError: If the size of the settings array is incorrect.
 
        """
 
        if sizeof(settings) != 1024:
 
            raise InvalidConfigurationError
 
        return neovi.SendConfiguration(self._handle, settings)
neovi/spec.py
Show inline comments
...
 
@@ -14,6 +14,8 @@ ECU provides four identifiers, each made
 

 
.. literalinclude:: ../examples/create_network_spec.py
 

 
See the :py:mod:`.ecu` module page for an example of using a network specification.
 

 
"""
 

 
import enum
requirements.txt
Show inline comments
 
new file 100644
 
overrides
...
 
\ No newline at end of file
0 comments (0 inline, 0 general)