|
@@ -4,6 +4,12 @@ from threading import Thread, Lock
|
|
|
from typing import Optional
|
|
from typing import Optional
|
|
|
import pandas as pd
|
|
import pandas as pd
|
|
|
|
|
|
|
|
|
|
+import time
|
|
|
|
|
+import traceback
|
|
|
|
|
+from threading import Thread, Lock
|
|
|
|
|
+from typing import Optional, Tuple
|
|
|
|
|
+import pandas as pd
|
|
|
|
|
+
|
|
|
from nbus_api.nbus_sensor import NBusSensor
|
|
from nbus_api.nbus_sensor import NBusSensor
|
|
|
from nbus_api.nbus_common_parser import NbusCommonParser
|
|
from nbus_api.nbus_common_parser import NbusCommonParser
|
|
|
from nbus_hal.crc8 import crc8
|
|
from nbus_hal.crc8 import crc8
|
|
@@ -47,6 +53,7 @@ class NBusSlaveModule:
|
|
|
self.__df = pd.DataFrame() # internal data frame
|
|
self.__df = pd.DataFrame() # internal data frame
|
|
|
self.__ts0 = None # 0-th timestamp
|
|
self.__ts0 = None # 0-th timestamp
|
|
|
self.__payload_size = 0
|
|
self.__payload_size = 0
|
|
|
|
|
+ self.__damaged_packets = []
|
|
|
|
|
|
|
|
"""
|
|
"""
|
|
|
================================================================================================================
|
|
================================================================================================================
|
|
@@ -56,6 +63,8 @@ class NBusSlaveModule:
|
|
|
def init(self) -> None:
|
|
def init(self) -> None:
|
|
|
"""
|
|
"""
|
|
|
Initialize the module from hardware.
|
|
Initialize the module from hardware.
|
|
|
|
|
+
|
|
|
|
|
+ :param load_format: flag to fetch data format
|
|
|
"""
|
|
"""
|
|
|
sensors = self.cmd_get_sensor_type()
|
|
sensors = self.cmd_get_sensor_type()
|
|
|
|
|
|
|
@@ -74,6 +83,13 @@ class NBusSlaveModule:
|
|
|
"""
|
|
"""
|
|
|
return self.__devices
|
|
return self.__devices
|
|
|
|
|
|
|
|
|
|
+ def get_damaged_packets(self) -> list[Tuple[int, bytearray]]:
|
|
|
|
|
+ """
|
|
|
|
|
+ Get damaged packets from module stream.
|
|
|
|
|
+ :return: list of damaged packets (id, packet)
|
|
|
|
|
+ """
|
|
|
|
|
+ return self.__damaged_packets
|
|
|
|
|
+
|
|
|
"""
|
|
"""
|
|
|
================================================================================================================
|
|
================================================================================================================
|
|
|
Module Get Commands
|
|
Module Get Commands
|