nixnet.types
- class nixnet.types.CanBusErrorFrame(timestamp: int, state: CanCommState, tcvr_err: bool, bus_err: CanLastErr, tx_err_count: int, rx_err_count: int)[source]
Bases:
FrameError detected on hardware bus of a
nixnet.session.FrameInStreamSession.Note
This requires enabling
nixnet._session.intf.Interface.bus_err_to_in_strm.See also
nixnet.types.CanComm.- timestamp
Absolute time when the bus error occurred.
- Type:
int
- state
Communication State
- tcvr_err
Transceiver Error.
- Type:
bool
- bus_err
Last Error.
- Type:
- tx_err_count
Transmit Error Counter.
- Type:
int
- rx_err_count
Receive Error Counter.
- Type:
int
- class nixnet.types.CanComm(state, tcvr_err, sleep, last_err, tx_err_count, rx_err_count)[source]
Bases:
CanComm_CAN Communication State.
- state
Communication State
- tcvr_err
Transceiver Error. Transceiver error indicates whether an error condition exists on the physical transceiver. This is typically referred to as the transceiver chip NERR pin. False indicates normal operation (no error), and true indicates an error.
- Type:
bool
- sleep
Sleep. Sleep indicates whether the transceiver and communication controller are in their sleep state. False indicates normal operation (awake), and true indicates sleep.
- Type:
bool
- last_err
Last Error. Last error specifies the status of the last attempt to receive or transmit a frame
- Type:
- tx_err_count
Transmit Error Counter. The transmit error counter begins at 0 when communication starts on the CAN interface. The counter increments when an error is detected for a transmitted frame and decrements when a frame transmits successfully. The counter increases more for an error than it is decreased for success. This ensures that the counter generally increases when a certain ratio of frames (roughly 1/8) encounter errors. When communication state transitions to Bus Off, the transmit error counter no longer is valid.
- Type:
int
- rx_err_count
Receive Error Counter. The receive error counter begins at 0 when communication starts on the CAN interface. The counter increments when an error is detected for a received frame and decrements when a frame is received successfully. The counter increases more for an error than it is decreased for success. This ensures that the counter generally increases when a certain ratio of frames (roughly 1/8) encounter errors.
- Type:
int
- class nixnet.types.CanFrame(identifier: CanIdentifier | int, type: FrameType = FrameType.CAN_DATA, payload: bytes = b'')[source]
Bases:
FrameCAN Frame.
- identifier
CAN frame arbitration identifier.
- echo
If the frame is an echo of a successful transmit rather than being received from the network.
- Type:
bool
- type
Frame type.
- Type:
- timestamp
Absolute time the XNET interface received the end-of-frame.
- Type:
int
- payload
Payload.
- Type:
bytes
- classmethod from_raw(frame)[source]
Convert from RawFrame.
>>> raw = RawFrame(5, 0x20000001, constants.FrameType.CAN_DATA, _cconsts.NX_FRAME_FLAGS_TRANSMIT_ECHO, 0, b'') >>> CanFrame.from_raw(raw) CanFrame(CanIdentifier(0x1, extended=True), echo=True, timestamp=0x5)
- to_raw()[source]
Convert to RawFrame.
>>> CanFrame(CanIdentifier(1, True), constants.FrameType.CAN_DATA).to_raw() RawFrame(timestamp=0x0, identifier=0x20000001, type=FrameType.CAN_DATA) >>> c = CanFrame(CanIdentifier(1, True), constants.FrameType.CAN_DATA) >>> c.echo = True >>> c.to_raw() RawFrame(timestamp=0x0, identifier=0x20000001, type=FrameType.CAN_DATA, flags=0x80)
- class nixnet.types.CanIdentifier(identifier: int, extended: bool = False)[source]
Bases:
objectCAN frame arbitration identifier.
- identifier
CAN frame arbitration identifier
- Type:
int
- extended
If the identifier is extended
- Type:
bool
- classmethod from_raw(raw: int) CanIdentifier[source]
Parse a raw frame identifier into a CanIdentifier
- Parameters:
raw (int) – A raw frame identifier
- Returns:
parsed value
- Return type:
>>> CanIdentifier.from_raw(0x1) CanIdentifier(0x1) >>> CanIdentifier.from_raw(0x20000001) CanIdentifier(0x1, extended=True)
- class nixnet.types.DelayFrame(offset: int)[source]
Bases:
FrameDelay hardware when DelayFrame is outputted.
Note
This requires
nixnet._session.intf.Interface.out_strm_timngto be in replay mode.- offset
Time to delay in milliseconds.
- Type:
int
- class nixnet.types.DriverVersion(major, minor, update, phase, build)[source]
Bases:
DriverVersion_Driver Version
The arguments align with the following fields:
[major].[minor].[update][phase][build].- major
- Type:
int
- minor
- Type:
int
- update
- Type:
int
- phase
- Type:
- build
- Type:
int
- class nixnet.types.Frame[source]
Bases:
FrameFactoryABC for frame objects.
- class nixnet.types.FrameFactory[source]
Bases:
objectABC for creating
nixnet.types.Frameobjects.
- class nixnet.types.LinBusErrorFrame(timestamp: int, state: LinCommState, bus_err: LinLastErr, err_id: int, err_received: int, err_expected: int)[source]
Bases:
FrameError detected on hardware bus of a
nixnet.session.FrameInStreamSession.Note
This requires enabling
nixnet._session.intf.Interface.bus_err_to_in_strm.See also
nixnet.types.LinComm.- timestamp
Absolute time when the bus error occurred.
- Type:
int
- state
Communication State.
- bus_err
Last Error.
- Type:
- err_id
Identifier on bus.
- Type:
int
- err_received
Received byte on bus
- Type:
int
- err_expected
Expected byte on bus
- Type:
int
- class nixnet.types.LinComm(sleep, state, last_err, err_received, err_expected, err_id, tcvr_rdy, sched_index)[source]
Bases:
LinComm_CAN Communication State.
- sleep
Sleep. Indicates whether the transceiver and communication controller are in their sleep state. False indicates normal operation (awake), and true indicates sleep.
- Type:
bool
- state
Communication State
- last_err
Last Error. Last error specifies the status of the last attempt to receive or transmit a frame
- Type:
- err_received
Returns the value received from the network when last error occurred.
When
last_errisREADBACK, this is the value read back.When
last_errisCHECKSUM, this is the received checksum.- Type:
int
- err_expected
Returns the value that the LIN interface expected to see (instead of last received).
When
last_errisREADBACK, this is the value transmitted.When
last_errisCHECKSUM, this is the calculated checksum.- Type:
int
- err_id
Returns the frame identifier in which the last error occurred.
This is not applicable when
last_errisNONEorUNKNOWN_ID.- Type:
int
- tcvr_rdy
Indicates whether the LIN transceiver is powered from the bus.
True indicates the bus power exists, so it is safe to start communication on the LIN interface.
If this value is false, you cannot start communication successfully. Wire power to the LIN transceiver and run your application again.
- Type:
bool
- sched_index
Indicates the LIN schedule that the interface currently is running.
This index refers to a LIN schedule that you requested using the
nixnet._session.base.SessionBase.change_lin_schedulefunction. It indexes the array of schedules represented in thenixnet._session.intf.Interface.lin_sched_names.This index applies only when the LIN interface is running as a master. If the LIN interface is running as a slave only, this element should be ignored.
- Type:
int
- class nixnet.types.LinFrame(identifier: int, type: FrameType = FrameType.LIN_DATA, payload: bytes = b'')[source]
Bases:
objectLIN Frame.
- identifier
LIN frame arbitration identifier.
- Type:
int
- echo
If the frame is an echo of a successful transmit rather than being received from the network.
- Type:
bool
- type
Frame type.
- Type:
- timestamp
Absolute time the XNET interface received the end-of-frame.
- Type:
int
- eventslot
Whether the frame was received within an event-triggered slot or an unconditional or sporadic slot.
- Type:
bool
- eventid
Identifier for an event-triggered slot.
- Type:
int
- payload
A byte string representing the payload.
- Type:
bytes
- classmethod from_raw(frame: RawFrame) LinFrame[source]
Convert from RawFrame.
>>> raw = RawFrame(5, 2, constants.FrameType.LIN_DATA, 0x81, 1, b'') >>> LinFrame.from_raw(raw) LinFrame(identifier=0x2, echo=True, timestamp=0x5, eventslot=True, eventid=1, len(payload)=1) >>> raw = RawFrame(5, 2, constants.FrameType.LIN_DATA, _cconsts.NX_FRAME_FLAGS_TRANSMIT_ECHO, 0, b'') >>> LinFrame.from_raw(raw) LinFrame(identifier=0x2, echo=True, timestamp=0x5, len(payload)=1)
- to_raw() RawFrame[source]
Convert to RawFrame.
>>> LinFrame(2, constants.FrameType.LIN_DATA).to_raw() RawFrame(timestamp=0x0, identifier=0x2, type=FrameType.LIN_DATA) >>> l = LinFrame(2, constants.FrameType.LIN_DATA) >>> l.echo = True >>> l.eventslot = True >>> l.eventid = 1 >>> l.to_raw() RawFrame(timestamp=0x0, identifier=0x2, type=FrameType.LIN_DATA, flags=0x81, info=0x1)
- class nixnet.types.LogTriggerFrame(timestamp: int)[source]
Bases:
FrameTimestamp of when a trigger occurred.
This frame is generated on input sessions when a rising edge is detected on an external connection.
Note
This requires using
nixnet._session.base.SessionBase.connect_terminalsto connect an external connection to the internalLogTriggerterminal.- timestamp
Absolute time that the trigger occurred.
- Type:
int
- class nixnet.types.PduProperties(pdu, start_bit, update_bit)[source]
Bases:
PDU_PROPERTIES_Properties that map a PDU onto a frame.
Mapping PDUs to a frame requires setting three frame properties that are combined into this tuple.
- start_bit
Defines the start bit of the PDU inside the frame.
- Type:
int
- update_bit
Defines the update bit for the PDU inside the frame. If the update bit is not used, set the value to
-1.- Type:
int
- class nixnet.types.RawFrame(timestamp: int, identifier: int, type: FrameType, flags: int = 0, info: int = 0, payload: bytes = b'')[source]
Bases:
FrameRaw Frame.
- timestamp
Absolute time the XNET interface received the end-of-frame.
- Type:
int
- identifier
Frame identifier.
- Type:
int
- type
Frame type.
- Type:
- flags
Flags that qualify the type.
- Type:
int
- info
Info that qualify the type.
- Type:
int
- payload
Payload.
- Type:
bytes
- class nixnet.types.StartTriggerFrame(timestamp: int)[source]
Bases:
FrameTimestamp of
nixnet.session.FrameInStreamSessionstart.Note
This requires enabling
nixnet._session.intf.Interface.start_trig_to_in_strm.- timestamp
Absolute time that the trigger occurred.
- Type:
int
- class nixnet.types.XnetFrame[source]
Bases:
FrameFactoryCreate Frame based on RawFrame content.