Diagnostics Objects#

The File Object and Event Log Object.

[ODVA CIP Vol 1] Wrappers for the File Object (class 0x37, §5-42) and Event Log Object (class 0x41, §5-45).

class icspacket.proto.cip.objects.diagnostics.EventLogObject(connection: CIP_Connection, instance: int = 1)[source]#

Provides event indication and/or a time-stamped event log on a CIP node (See CIP Vol 1, §5-45).

instance_name is STRINGI-encoded, and the event/log list attributes (4, 14, 16, 18) are arrays of structures whose per-entry layout is selected by event_identifier_format/the class-level Time Format attribute, so all of these are exposed as raw bytes rather than a fixed schema. event_enable/event_silenced/event_state are homogeneous byte arrays without that dependency, so they use a greedy array schema instead.

instance_name: CIPAttribute[bytes]#

STRINGI name of this event instance (attribute 1).

state: CIPAttribute[int]#

0=Nonexistent, 1=Stopped, 2=Empty, 3=Available, 4=Full/Overwrite, 5=Full/Halted (attribute 2).

event_list_size: CIPAttribute[int]#

Number of elements in event_list/event_enable/event_silenced/event_state (attribute 3).

event_list: CIPAttribute[bytes]#

All event identifiers monitored by this instance; format set by event_identifier_format (attribute 4).

event_enable: CIPAttribute[Collection[int]]#

Per-event enable flags: 0 = disabled, 1 = enabled (default), one BOOL each (attribute 5).

event_silenced: CIPAttribute[Collection[int]]#

Per-event silence flags: 0 = not silenced (default), 1 = silenced, one BOOL each (attribute 6).

event_state: CIPAttribute[Collection[int]]#

Per-event state bit flags: bit0=enabled, bit1=active, bit2=acked, bit3=logged, bit4=silenced (attribute 7).

logged_states_configuration: CIPAttribute[int]#

Bit flags selecting which event state transitions are logged, default 0x01 (attribute 8, See Table 5-45.4).

logged_data_configuration: CIPAttribute[int]#

Bit flags selecting what data is stored in the event log, default 0 (attribute 9, See Table 5-45.5).

log_full_action: CIPAttribute[int]#

0 = Halt (default), 1 = Scroll, action to take when the log is full (attribute 10).

duplicate_event_action: CIPAttribute[int]#

0 = Ignore (default), 1 = Add, 2 = Overwrite, action to take on a duplicate event (attribute 11).

event_data_log_maximum_size: CIPAttribute[int]#

Maximum number of allowable entries in the Event/Data Log (attribute 12).

event_data_log_size: CIPAttribute[int]#

Present number of entries in the Event/Data Log (attribute 13).

event_data_log: CIPAttribute[bytes]#

List of all logged events (attribute 14).

active_event_data_list_size: CIPAttribute[int]#

Number of entries in active_event_data_list (attribute 15).

active_event_data_list: CIPAttribute[bytes]#

List of event identifiers presently active (attribute 16).

logged_event_data_list_size: CIPAttribute[int]#

Number of entries in logged_event_data_list (attribute 17).

logged_event_data_list: CIPAttribute[bytes]#

List of event identifiers currently logged (attribute 18).

log_full: CIPAttribute[int]#

0 = log not full, 1 = event_data_log_size == event_data_log_maximum_size (attribute 19).

log_contains_entries: CIPAttribute[int]#

0 = log empty, 1 = log contains entries (attribute 20).

log_overrun: CIPAttribute[int]#

0 = no overrun, 1 = the log has overrun (attribute 21).

sequential_event_data_access: CIPAttribute[bytes]#

Simple mechanism to sequentially access Event/Data Log entries (attribute 22, See §5-45.4.22).

startup_behavior: CIPAttribute[int]#

0 = Auto Active (default), 1 = Start Required, behavior after power-up/reset (attribute 23).

event_identifier_format: CIPAttribute[int]#

Format of the Event Identifier used in log entries, default 0 (attribute 24).

get_class_attribute(attribute: int) bytes[source]#

Read an Event Log class attribute from instance 0 (See §5-45.2, Table 5-45.2).

reset(reset_type: int = 0) bytes[source]#

Invoke Reset, restoring this instance to its power-up (0) or out-of- box (1) state.

start() bytes[source]#

Invoke Start, transitioning this instance from Configuring to Active so logging can commence.

stop() bytes[source]#

Invoke Stop, transitioning this instance back to Configuring and clearing its event list/status.

class icspacket.proto.cip.objects.diagnostics.FileObject(connection: CIP_Connection, instance: int = 1)[source]#

Manages an uploadable/downloadable file, e.g. firmware or configuration data (See CIP Vol 1, §5-42).

instance_name/file_name are STRINGI (international string) encoded (See Appendix I) and directory/the file transfer services’ request/response payloads have their own internal framing, so they are all exposed as raw bytes rather than a fixed schema.

state: CIPAttribute[int]#

0=Nonexistent, 1=File Empty, 2=File Loaded, 3-6=Transfer in progress, 7=Storing (attribute 1).

instance_name: CIPAttribute[bytes]#

STRINGI name assigned to this instance (attribute 2).

instance_format_version: CIPAttribute[int]#

Format version of this instance (attribute 3).

file_name: CIPAttribute[bytes]#

STRINGI name assigned to the file loaded in this instance (attribute 4).

file_revision: CIPAttribute[FileRevision]#

Major/minor revision of the loaded file (attribute 5).

file_size: CIPAttribute[int]#

Size of the loaded file in bytes (attribute 6).

file_checksum: CIPAttribute[int]#

Checksum of the loaded file (attribute 7).

invocation_method: CIPAttribute[int]#

0=none, 1=Reset Identity, 2=power cycle, 3=Start service required, …

(attribute 8).

file_save_parameters: CIPAttribute[int]#

Bit flags describing the file’s non-volatile storage (attribute 9).

file_type: CIPAttribute[int]#

0 = Read/Write (default), 1 = Read Only (attribute 10).

file_encoding_format: CIPAttribute[int]#

Encoding format of the file’s data, if any (attribute 11, optional, See §5-42.8).

get_class_attribute(attribute: int) bytes[source]#

Read a File class attribute from instance 0 (See §5-42.1, Table 5-42.2).

create(instance_name: bytes = b'') bytes[source]#

Invoke Create, allocating a new file transfer instance (instance_name is a STRINGI payload).

delete() bytes[source]#

Invoke Delete, removing a file transfer instance previously allocated via create().

save() bytes[source]#

Invoke Save, persisting the loaded file to non-volatile storage.

restore() bytes[source]#

Invoke Restore, reloading the file from non-volatile storage.

initiate_upload(maximum_transfer_size: int) bytes[source]#

Invoke Initiate_Upload (service 0x4B), starting a file upload.

Parameters:

maximum_transfer_size – Maximum number of bytes this client can accept in each Upload_Transfer response (USINT).

initiate_download(request_data: bytes) bytes[source]#

Invoke Initiate_Download (service 0x4C) with a caller-built request payload, starting a file download.

initiate_partial_read(request_data: bytes) bytes[source]#

Invoke Initiate_Partial_Read (service 0x4D) with a caller-built request payload.

initiate_partial_write(request_data: bytes) bytes[source]#

Invoke Initiate_Partial_Write (service 0x4E) with a caller-built request payload.

upload_transfer(request_data: bytes) bytes[source]#

Invoke Upload_Transfer (service 0x4F) with a caller-built request payload.

download_transfer(request_data: bytes) bytes[source]#

Invoke Download_Transfer (service 0x50) with a caller-built request payload.

clear_file() bytes[source]#

Invoke Clear_File (service 0x51), clearing the loaded file’s contents and resetting its attributes.

class icspacket.proto.cip.objects.diagnostics.FileRevision(major_rev: int, minor_rev: int)[source]#

File Object attribute 5 payload (See CIP Vol 1, §5-42.2, Table 5-42.3).