Basic Types#

class scrutiny.core.basic_types.EmbeddedDataType[source]#

(Enum) Represent a datatype that can be read from a device. The embedded library has the same definition of datatype as this one. They needs to match. Not all datatype are supported. (cfloat or >64 bits)

sint8 = 0#
sint16 = 1#
sint32 = 2#
sint64 = 3#
sint128 = 4#
uint8 = 16#
uint16 = 17#
uint32 = 18#
uint64 = 19#
uint128 = 20#
float8 = 32#
float16 = 33#
float32 = 34#
float64 = 35#
float128 = 36#
cfloat8 = 64#
cfloat16 = 65#
cfloat32 = 66#
cfloat64 = 67#
cfloat128 = 68#
boolean = 48#
NA = 15#
get_size_bit()[source]#

Return the size fo the datatype in bits. Returns 0 if NA

Return type:

int

get_size_byte()[source]#

Return the size fo the datatype in bytes. Returns 0 if NA

Return type:

int


class scrutiny.core.basic_types.Endianness[source]#

(Enum) Represent an data storage endianness

Little = 0#

Litle endian. 0x12345678 is stored as 78 56 34 12

Big = 1#

Big endian. 0x12345678 is stored as 12 34 56 78


class scrutiny.core.embedded_enum.EmbeddedEnum[source]#

Represents an enumeration in the embedded code. Match a string to an int value

add_value(name, value)[source]#

Adds a string/value pair in the enum

Parameters:
  • name (str) – Enumerator name

  • value (int) – Enumerator value

Raises:

IndexError – If the enumerator name is already defined in the enum with a different value

Return type:

None

get_name()[source]#

Return the name of the enum

Return type:

str

get_value(name)[source]#

Returns the value associated with a name

Parameters:

name (str) – Enumerator name

Raises:

ValueError – If the given enumerator name is not part of the enumeration

Return type:

int

has_value(name)[source]#

Tells if the enum has value with the given name

Parameters:

name (str) – Enumerator name

Return type:

bool

get_def()[source]#

Exports to dict for json serialization mainly

Return type:

EmbeddedEnumDef

has_signed_value()[source]#

Returns true if any value is negative

Return type:

bool

copy()[source]#

Creates a copy of the enum

Return type:

EmbeddedEnum

classmethod from_def(enum_def)[source]#

Recreates from a .json dict

Parameters:

enum_def (EmbeddedEnumDef) – The json structure created with get_def

Return type:

EmbeddedEnum