Data Processing¶
DataPoint¶
-
class
DataProcessing.DataPoint.
DataPoint
(id, group_id, overview_id, name, value)[source]¶ - Description
This Class contains data information like name, value, id, group id and overview id.
Containing data are being used to update values in graphical interface.
- Parameters
- Raises
– Widget id is not an integer.
– Overview id is not an integer.
– Group id is not an integer.
– Name is not a str.
– Value is not a float or int.
– Widget id is not in range 1 - 50.
– Overview id is not in range 1 - 50.
– Group id is not in range 0 - 20.
DataProcessing¶
-
class
DataProcessing.DataProcessing.
DataProcessing
(can_id, can_data, config_list)[source]¶ - Description
This class takes ID, binary data and list of configs as input.
Main task is to decode and processed binary data based on given config list.
Resulting object will contain information like name, value, id and group id.
- Parameters
can_id (str) – Id of CAN message
can_data (str) – CAN message in binary format
config_list (list[CanDataConfig]) – List of data configurations
- Raises
– Can_id is not a hex string.
– Data is not a binary str.
– Can_id is hex string longer then 8.
– Can_data does not have length of 8 bytes (64 bits).
-
data_decode
()[source]¶ - Description
Checks if there are data configurations for given can id.
If so call processed data for each configuration where conf can id == given can id.
As result return list of DataPoints, containing useful information as widget id, group id, name, value, etc.
- Returns
List of DataPoints
- Return type
-
static
data_process
(bin_data, data_config)[source]¶ - Description
Takes binary data and suitable data configuration as input.
Based on given configuration processed data -> convert data from binary to real value.
- Conversion is done as follows:
Convert bin data to int in right format (Little or Big endian)
Multiply data by configuration multiplier
Add configuration offset
- Parameters
bin_data (str) – Can data in binary format.
data_config (CanDataConfig) – Suitable configuration
- Returns
Real value processed by given configuration
- Return type
DataProcessingManager¶
-
class
DataProcessing.DataProcessingManager.
DataProcessingManager
(received_data, data_config_list)[source]¶ - Inherit
QRunnable
- Description
This class inherit from QRunnable -> can run as separate task.
Takes care of data processing flow.
Data to superior task are being passed with Qt Signal.
- Parameters
received_data (bytearray) – Received data in raw format.
data_config_list (list[CanDataConfig]) – List of data configurations
-
class
DataProcessing.DataProcessingManager.
DataSignal
[source]¶ - Inherit
QObject
- Description
Helper class for
DataProcessingManager
allowing usage of Qt Signal.
RawData¶
-
class
DataProcessing.RawData.
RawData
(raw_data)[source]¶ - Description
This class takes raw received data from remote device.
Used to split raw data into ID and data part.
- Parameters
raw_data (bytearray) – Received data from remote device in its raw format.
- Raises
TypeError – Raw data are not a bytearray.
ValueError – Raw data do not have 12 bytes.