Signals

EnumSignal

class canlib.kvadblib.EnumSignal(db, message, sh, name=None, type=None, byte_order=None, mode=None, size=None, scaling=ValueScaling(factor=1, offset=0), limits=None, unit=None, comment=None, enums={})[source]

Database signal of type enum, holds meta data about a signal.

Changed in version 1.17: default settings byte_order=SignalByteOrder.INTEL and mode=SignalMultiplexMode.SIGNAL chaged to None.

add_enum_definition(enums)[source]

Add enums dictionary to definition.

enums

Signal enum definition dictionary

Type:dict

Signal

class canlib.kvadblib.Signal(db, message, sh, name=None, type=None, byte_order=None, mode=None, representation=None, size=None, scaling=None, limits=None, unit=None, comment=None)[source]

Database signal, holds meta data about a signal

add_node(node)[source]

Add receiving node to signal.

attributes()[source]

Return a generator over all signal attributes.

bind(frame=None)[source]

Bind this signal to a frame

Creates a new BoundSignal object representing this signal bound to the given Frame object, or a new Frame object if frame is None..

byte_order

Get the signal byte order encoding.

Type:SignalByteOrder
comment

Get the signal comment.

Type:str
data_from(can_data, phys=None, raw=None)[source]

Convert a raw or physical value into CAN data bytes.

delete_attribute(name)[source]

Delete attribute from signal.

get_attribute_value(name)[source]

Return attribute value

If the attribute is not set on the signal, we return the attribute definition default value.

limits

Get message min and max values

Type:ValueLimits
mode
name

Get the signal name.

Type:str
nodes()[source]

Return a generator over all receiving nodes of the signal.

phys_from(can_data)[source]

Return signals physical value from data

qualified_name

Get the qualified signal name.

Returns database, message and signal names separated by dots.

Type:str
raw_from(can_data)[source]

Return signals raw value from data

remove_node(node)[source]

Remove receiving node from signal.

scaling

Get the signals factor and offset

Type:ValueScaling
set_attribute_value(name, value)[source]

Set value of attribute ‘name’ on signal.

If no attribute called ‘name’ is set on signal, attach a signal attribute from the database attribute definition first.

size

Get the signals startbit and length

Type:ValueSize
type

Get the signal representation type.

Type:SignalType
unit

Get the signal unit

Type:str

ValueLimits

class canlib.kvadblib.ValueLimits(min, max)
max

Alias for field number 1

min

Alias for field number 0

ValueScaling

class canlib.kvadblib.ValueScaling(factor, offset)
factor

Alias for field number 0

offset

Alias for field number 1

ValueSize

class canlib.kvadblib.ValueSize(startbit, length)
length

Alias for field number 1

startbit

Alias for field number 0