Can Exceptions

Exceptions.CanCheck.check_binary_can_data(binary_data)[source]
Description

Can data are expected as binary string of length 64 bits.

Parameters

binary_data (str) – Binary data.

Raises
  • TypeError – Binary data are not a str.

  • ValueError – Binary data do not have size of 64 bits.

Exceptions.CanCheck.check_can_id(can_id)[source]
Description

Can id is expected to be HEX string of max len 8.

Parameters

can_id (str) – Can id in hex format.

Raises
Exceptions.CanCheck.check_endian(endian)[source]
Description

Endian is expected as “L” or “B” of type str.

Parameters

endian (str) – Little or Big endian.

Raises
Exceptions.CanCheck.check_group_id(group_id)[source]
Description

Group id is expected to by of type int.

Parameters

group_id (int) – Group ID in UI.

Raises
Exceptions.CanCheck.check_id(id)[source]
Description

Id is expected to by of type int.

Parameters

id (int) – General Id.

Raises

TypeError – Id is not an integer.

Exceptions.CanCheck.check_length(length)[source]
Description

Length is expected to by of type int in range of 1 - 63.

Parameters

length (int) – Data length in can msg.

Raises
Exceptions.CanCheck.check_multiplier(multiplier)[source]
Description

Multiplier is expected to by of type float or int.

Cannot be equal to 0.

Parameters

multiplier (int, float) – Data multiplier in can msg.

Raises
  • TypeError – Multiplier is not an integer or float.

  • ValueError – Multiplier is equal to 0.

Exceptions.CanCheck.check_name(name)[source]
Description

Name is expected to by of type str.

Parameters

name (str) – Name of data variable.

Raises

TypeError – Name is not a str.

Exceptions.CanCheck.check_offset(offset)[source]
Description

Offset is expected to by of type float or int.

Parameters

offset (int, float) – Data offset in can msg.

Raises

TypeError – Offset is not an integer or float.

Exceptions.CanCheck.check_raw_data(raw_data)[source]
Description

Raw data are expected to be of type byte array of length 12.

Parameters

raw_data (bytearray) – Raw data (received from external device).

Raises
Exceptions.CanCheck.check_start_bit(start_bit)[source]
Description

Start bit is expected to be of type int in range of 0 - 63.

Parameters

start_bit (int) – Data start bit in can msg.

Raises
Exceptions.CanCheck.check_unit(unit)[source]
Description

Unit is expected to by of type str.

Parameters

unit (str) – Data unit(°C, Pa, …).

Raises

TypeError – Unit is not a str.

Exceptions.CanCheck.check_value(value)[source]
Description

Value is expected to be of type float or int.

Parameters

value (int, float) – Real data value.

Raises

TypeError – Value is not an integer or float.

Exceptions.CanCheck.check_widget_id(widget_id)[source]
Description

Widget id is expected to by of type int.

Parameters

widget_id (int) – Widget id in display group of UI.

Raises