nixnet.convert

class nixnet.convert.SignalConversionSinglePointSession(database_name, cluster_name, signals)[source]

Bases: object

Convert NI-XNET signal data to frame data or vice versa.

Conversion works similar to Single-Point mode. You specify a set of signals that can span multiple frames. Signal to frame conversion reads a set of values for the signals specified and writes them to the respective frame(s). Frame to signal conversion parses a set of frames and returns the latest signal value read from a corresponding frame.

application_protocol

This property returns the application protocol that the session uses.

The database used with the session determines the application protocol.

Type:nixnet._enums.AppProtocol
close()[source]

Close (clear) the XNET session.

cluster_name

This property returns the cluster (network) name used with the session.

Type:str
convert_frames_to_signals(frames)[source]

Convert Frames to signals.

The frames passed into the frames array are read one by one, and the signal values found are written to internal buffers for each signal. Frames are identified by their identifier (FlexRay: slot) field. After all frames in frames array are processed, the internal signal buffers’ status is returned with the corresponding timestamps from the frames where a signal value was found. The signal internal buffers’ status is being preserved over multiple calls to this function.

This way, for example, data returned from multiple calls of nxFrameRead for a Frame Input Stream Mode session (or any other Frame Input session) can be passed to this function directly.

Note

Frames unknown to the session are silently ignored.

convert_signals_to_frames(signals, frame_type=<class 'nixnet.types.XnetFrame'>)[source]

Convert signals to frames.

The signal values written to the signals array are written to a raw frame buffer array. For each frame included in the session, one frame is generated in the array that contains the signal values. Signals not present in the session are written as their respective default values; empty space in the frames that signals do not occupy is written with the frame’s default payload.

The frame header values are filled with appropriate values so that this function’s output can be directly written to a Frame Output session.

Parameters:
  • signals (list of float) – Values corresponding to signals configured in this session.
  • frame_type (nixnet.types.FrameFactory) – A factory for the desired frame formats.
Yields:

nixnet.types.Frame

database_name

This property returns the database name used with the session.

Type:str
j1939

Returns the J1939 configuration object for the session.

Type:nixnet._session.j1939.J1939
mode

This property returns the mode associated with the session.

For more information, refer to nixnet._enums.CreateSessionMode.

Type:nixnet._enums.CreateSessionMode
protocol

This property returns the protocol that the interface in the session uses.

Type:nixnet._enums.Protocol
signals

Operate on session’s signals

Type:nixnet._session.signals.Signals