Parse Module

This module is primarily responsible for providing a high-level interface for parsing CANOpen messages according to Object Definiton files or Electronic Data Sheet files, provided by the end user.

class canopen_monitor.parse.CANOpenParser(eds_configs: dict)[source]

A convenience wrapper for the parse function

get_name(message: canopen_monitor.can.message.Message) Optional[str][source]
parse(message: canopen_monitor.can.message.Message) -> (<class 'str'>, <class 'str'>)[source]

Detect the type of the given message and return the parsed version

@:param: message: a Message object containing the message

str: The parsed message

class canopen_monitor.parse.DataType(value)[source]

An enumeration.

BOOLEAN = '0x0001'
DOMAIN = '0x000F'
ECSS_TIME = 'ECSS_TIME'
FLOATING_POINTS = ('0x0008', '0x0011')
IDENTITY = '0x0023'
INTEGER16 = '0x0003'
INTEGER24 = '0x0010'
INTEGER32 = '0x0004'
INTEGER40 = '0x0012'
INTEGER48 = '0x0013'
INTEGER56 = '0x0014'
INTEGER64 = '0x0015'
INTEGER8 = '0x0002'
NON_FORMATTED = ('0x000F', '0x0020', '0x0021', '0x0022', '0x0023')
OCTET_STRING = '0x000A'
PDO_COMMUNICATION_PARAMETER = '0x0020'
PDO_MAPPING = '0x0021'
REAL32 = '0x0008'
REAL64 = '0x0011'
SDO_PARAMETER = '0x0022'
SIGNED_INTEGERS = ('0x0002', '0x0003', '0x0004', '0x0010', '0x0012', '0x0013', '0x0014', '0x0015')
TIME_DIFFERENCE = '0x000D'
TIME_OF_DAY = '0x000C'
UNICODE_STRING = '0x000B'
UNSIGNED16 = '0x0006'
UNSIGNED24 = '0x0016'
UNSIGNED32 = '0x0007'
UNSIGNED40 = '0x0018'
UNSIGNED48 = '0x0019'
UNSIGNED56 = '0x001A'
UNSIGNED64 = '0x001B'
UNSIGNED8 = '0x0005'
UNSIGNED_INTEGERS = ('0x0005', '0x0006', '0x0007', '0x0016', '0x0018', '0x0019', '0x001A', '0x001B')
VISIBLE_STRING = '0x0009'
class canopen_monitor.parse.EDS(eds_data: [str])[source]
canopen_monitor.parse.load_eds_file(filepath: str, enable_ecss: bool = False) canopen_monitor.parse.eds.EDS[source]

Read in the EDS file, grab the raw lines, strip them of all escaped characters, then serialize into an EDS and return the resulting object.

Parameters
  • filepath (str) – Path to an eds file

  • enable_ecss (bool, optional) – Flag to enable ECSS time, defaults to False

Returns

The successfully serialized EDS file.

Return type

EDS

canopen_monitor.parse.load_eds_files(filepath: str, enable_ecss: bool = False) dict[source]

Read a directory of OD files

Parameters
  • filepath (str) – Directory to load files from

  • enable_ecss (bool, optional) – Flag to enable ECSS time, defaults to False

Returns

dictionary of OD files with node id as key and OD as value

Return type

dict