neovi.neovi module

This module wraps the low-level interface to the neoVI range of devices. It is unlikely that the functions defined here will be directly used as neodevice.NeoDevice and related classes offer a more convenient interface.

Of more interest will be the various constants defined here.

Device type identifiers (used by neodevice.find_devices()):

NEODEVICE_BLUE NEODEVICE_SW_VCAN NEODEVICE_FIRE
NEODEVICE_VCAN3 NEODEVICE_YELLOW NEODEVICE_RED
NEODEVICE_ECU NEODEVICE_IEVB NEODEVICE_PENDANT
NEODEVICE_VIRTUAL_NEOVI NEODEVICE_ECUCHIP_UART NEODEVICE_PLASMA_1_11
NEODEVICE_FIRE_VNET NEODEVICE_NEOANALOG NEODEVICE_CT_OBD
NEODEVICE_PLASMA_1_12 NEODEVICE_PLASMA_1_13 NEODEVICE_ION_2
NEODEVICE_RADSTAR NEODEVICE_ION_3 NEODEVICE_VCANFD
NEODEVICE_ECU15 NEODEVICE_ECU25 NEODEVICE_EEVB
NEODEVICE_VCANRF NEODEVICE_FIRE2 NEODEVICE_FLEX
NEODEVICE_RADGALAXY NEODEVICE_NEOECUCHIP  

Additional special identifiers are available:

NEODEVICE_ANY_PLASMA NEODEVICE_ANY_ION NEODEVICE_ALL

Network IDs:

NETID_DEVICE    
NETID_MSCAN NETID_SWCAN NETID_SWCAN2
NETID_LSFTCAN NETID_LSFTCAN2 NETID_HSCAN
NETID_HSCAN2 NETID_HSCAN3 NETID_HSCAN4
NETID_HSCAN5 NETID_HSCAN6 NETID_HSCAN7
NETID_LIN NETID_LIN2 NETID_LIN3
NETID_LIN4 NETID_LIN5 NETID_LIN6
NETID_ETHERNET NETID_OP_ETHERNET1 NETID_OP_ETHERNET2
NETID_OP_ETHERNET3 NETID_OP_ETHERNET4 NETID_OP_ETHERNET5
NETID_OP_ETHERNET6 NETID_OP_ETHERNET7 NETID_OP_ETHERNET8
NETID_OP_ETHERNET9 NETID_OP_ETHERNET10 NETID_OP_ETHERNET11
NETID_OP_ETHERNET12 NETID_ETHERNET_DAQ  
NETID_RS232 NETID_UART NETID_UART2
NETID_UART3 NETID_UART4  
NETID_FLEXRAY NETID_FLEXRAY1A NETID_FLEXRAY1B
NETID_FLEXRAY2 NETID_FLEXRAY2A NETID_FLEXRAY2B
NETID_3G_RESET_STATUS NETID_3G_FB_STATUS NETID_3G_APP_SIGNAL_STATUS
NETID_3G_READ_DATALINK_CM_TX_MSG NETID_3G_READ_DATALINK_CM_RX_MSG NETID_3G_LOGGING_OVERFLOW
NETID_3G_READ_SETTINGS_EX    
NETID_MOST NETID_MOST25 NETID_MOST50
NETID_MOST150    
NETID_FORDSCP NETID_J1708 NETID_AUX
NETID_JVPW NETID_ISO NETID_ISO2
NETID_ISO3 NETID_ISO4 NETID_ISOPIC
NETID_MAIN51 NETID_RED NETID_SCI
NETID_ISO14230 NETID_RED_APP_ERROR NETID_CGI
NETID_DATA_TO_HOST NETID_TEXTAPI_TO_HOST NETID_I2C1
NETID_SPI1 NETID_RED_VBAT NETID_GMFSA
NETID_TCP    
class BitRate

Bases: enum.IntEnum

Available bit rates for NeoVI network interfaces.

BR_20000 = 0
BR_33333 = 1
BR_50000 = 2
BR_62500 = 3
BR_83333 = 4
BR_100000 = 5
BR_125000 = 6
BR_250000 = 7
BR_500000 = 8
BR_800000 = 9
BR_1000000 = 10
DEFAULT = 8
network_name(nid)

Lookup the friendly name for a network ID.

Parameters:nid (int) – The network ID to look up.
Returns:The friendly name for the network.
Return type:str
InitializeAPI()

Initialise the API and prepares it for use. It must be called before any other API calls are made.

Note that the underlying neoVI library only requires this on Linux, but pyneovi requires it on all platforms. This provides a consistent interface without platform-specific checks in application code and also allows pyneovi to perform its own initialisation.

ShutdownAPI()

Shut down the API and releases any resources allocated during its use.

Note that the underlying neoVI library only requires this on Linux, but pyneovi requires it on all platforms. This provides a consistent interface without platform-specific checks in application code.

GetLastAPIError(hObject)

Get the error generated by the last API call.

API errors are generated and stored on a ‘per-thread’ basis. The calling thread will only receive errors generated within it’s own context. If a new API error is generated before the previous error has been retrieved, the previous error will be lost. All errors generated can still be retrieved using GetErrorMessages. However, GetErrorMessages will return errors generated in all threads, not just the current thread.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple consisting of i) a boolean indicating if a new error was generated since the port was opened or GetLastAPIError was last called and ii) the error generated by the last API call.
GetErrorMessages(hObject)

Read the neoVI DLL error message queue. The error queue will be reset after this function is called.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple consisting of i) a boolean indicating success or failure of the function and ii) a list of errors generated by all threads.
FindNeoDevices(types)

Find any attached neoVI devices.

Parameters:types (int) – Filter the results to given types of devices. The NEODEVICE_* constants can be OR’d together.
Returns:A list of structures.NeoDevice objects.
OpenNeoDevice(device, network_ids=None, config_read=True)

Open a communication link the a neoVI device.

Parameters:
  • device (structures.NeoDevice) – A device information structure returned by neovi.FindNeoDevices().
  • network_ids – An array of network IDs to assign to the available networks. The default is to use the predefined network IDs.
  • config_read (bool) – Should the device’s configuration be read before enabling it? It is recommended that this be set to true.
Returns:

An object handle for use in other API functions or None if the call failed.

ClosePort(hObject)

Close the communication link with the neoVI hardware.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple containing i) a bool representing the success or failure of the function and ii) a list of error codes if the bool is false (empty otherwise). See Error Messages in the ICS API documentation.
FreeObject(hObject)

Release any resources that were allocated by OpenNeoDevice.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
GetMessages(hObject)

Read messages from the neoVI device. The driver object will hold 20,000 received messages before it will generate an RX buffer overflow error.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 3-tuple containing i) either SUCCESS or an error code (see Error Messages in the ICS API documentation), ii) a list of structures.icsSpyMessage objects, and iii) a list of error codes obtained via neovi.GetErrorMessages().
TxMessages(hObject, msgs, network, num_msgs=1)

Transmit messages asynchronously to vehicle networks using the neoVI hardware.

After the messages has been transmitted there will be a transmit report message returned from the device. The transmit report will be read out with neovi.GetMessages(). Any message read which has the SPY_STATUS_TX_MSG bit set in the status bitfield is a transmit report.

You can also identify a particular transmitted message with DescriptionID field. This two byte field (only 14 bits are used) allows the programmer to assign an arbitrary number to a message. This number is then returned in the transmit report.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • msgs – A list of structures.icsSpyMessage objects.
  • network (int) – The network to transmit the message on.
  • num_msgs (int) – The number of messages to transmit. This should always be 1 unless you are transmitting a long Message on ISO or J1708.
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

WaitForRxMessagesWithTimeOut(hObject, timeout_ms)

Wait a specified amount of time for received messages.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • timeout_ms (int) – A timeout in ms to wait for a received message before returning.
Returns:

Either MESSAGES_RECVD, NO_MESSAGES, or an error code (see Error Messages in the ICS API documentation).

GetTimeStampForMsg(hObject, msg)

Calculate the timestamp for a message, based on the connected hardware type, and convert it to a usable variable.

Parameters:
Returns:

A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) the calculated timestamp.

EnableNetworkRXQueue(hObject, enable)

Enable or disable the received message queue (and thus reception of network traffic). This applies only to the application that called this function, other applications are not affected.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • enable (bool) – Specifies whether to enable (true) or disable (false) reception of network traffic.
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

GetISO15765Status(hObject, network, clear_rx_status)

Get, and optionally clear, the current receive status of the CAN ISO15765-2 network layer.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • network (int) – Which CAN network the status is requested for.
  • clear_rx_status (bool) – If true will clear the receive status and reset the receive state machine.
Returns:

The receive status. See GetISO15765Status in the ICS API documentation.

SetISO15765RxParameters(hObject, network, enable, msg_filter, flow_ctx_msg, timeout_ms, flow_control_block_size, uses_extended_addressing)

set the parameters necessary to control CAN ISO15765-2 network layer message reception.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • network (int) – The network to transmit the message on.
  • enable (bool) – If true ISO15765 services will be enabled for this network.

See SetISO15765RxParameters in the ICS API documentation for full descriptions of the remaining parameters.

GetConfiguration(hObject)

Read the configuration from a NeoVI Blue or ValueCAN device.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) an array of 1024 configuration bytes (see Configuration Array in the ICS API documentation).
SendConfiguration(hObject, pData)

Send configuration information to a NeoVI Blue or ValueCAN device.

Parameters:
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

GetFireSettings(hObject)

Read the configuration settings from a neoVI Fire device.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) a structures.SFireSettings object.
SetFireSettings(hObject, pSettings, bSaveToEEPROM)

Write configuration settings to a neoVI Fire device.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • pSettings (structures.SFireSettings) – The configuration to write.
  • bSaveToEEPROM (bool) – Overwrite the stored EEPROM values so that these settings persist across power-cycles.
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

GetVCAN3Settings(hObject)

Read the configuration settings from a ValueCAN3 device.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) a structures.SVCAN3Settings object.
SetVCAN3Settings(hObject, pSettings, bSaveToEEPROM)

Write configuration settings to a ValueCAN3 device.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • pSettings (structures.SVCAN3Settings) – The configuration to write.
  • bSaveToEEPROM (bool) – Overwrite the stored EEPROM values so that these settings persist across power-cycles.
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

SetBitRate(hObject, iBitRate, iNetworkID)

Set the bit rates for networks.

Parameters:
  • hObject – An object handle returned by neovi.OpenNeoDevice().
  • iBitRate (int) – The new bit rate setting.
  • iNetworkID (int) – The network to set the bit rate on.
Returns:

Either SUCCESS or an error code (see Error Messages in the ICS API documentation).

GetHWFirmwareInfo(hObject)

Return the firmware version of the open neoVI device.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) a structures.APIFirmwareInfo object.
GetDLLFirmwareInfo(hObject)

Return the firmware version stored within the DLL API.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
Returns:A 2-tuple of i) either SUCCESS or an error code (see Error Messages in the ICS API documentation) and ii) a structures.APIFirmwareInfo object.
ForceFirmwareUpdate(hObject)

Force the firmware on a neoVI device to be updated to the version stored in the DLL API.

Parameters:hObject – An object handle returned by neovi.OpenNeoDevice().
GetDLLVersion()

Return the software version of the DLL.

Returns:The version of the API DLL as an integer.
Return type:int