diff --git a/dummy_receiver.py b/dummy_receiver.py index 0ca3bdc..2975b9b 100644 --- a/dummy_receiver.py +++ b/dummy_receiver.py @@ -18,7 +18,6 @@ IPC_CREAT = 0o1000 terminate = False - class TDriveData(ctypes.Structure): _fields_ = [ ("caDriveIndex", ctypes.c_char * STR_BUFFER_SIZE), @@ -29,6 +28,7 @@ class TDriveData(ctypes.Structure): ("caDriveShredDuration", ctypes.c_char * STR_BUFFER_SIZE), ("caDriveCapacity", ctypes.c_char * STR_BUFFER_SIZE), ("caDriveState", ctypes.c_char * STR_BUFFER_SIZE), + ("caDriveConnectionType", ctypes.c_char * STR_BUFFER_SIZE), ("caDriveModelFamily", ctypes.c_char * STR_BUFFER_SIZE), ("caDriveModelName", ctypes.c_char * STR_BUFFER_SIZE), ("caDriveSerialnumber", ctypes.c_char * STR_BUFFER_SIZE), @@ -75,6 +75,7 @@ def create_drive_objects(drive_info): smart_error_count=int(drive_info["driveErrors"]), shred_timestamp=int(drive_info["driveShredTimestamp"]), shred_duration=int(drive_info["driveShredDuration"]), + connection_type=drive_info["driveConnectionType"], ) rehdd_info = layouter.ReHddInfo( @@ -88,8 +89,8 @@ def create_drive_objects(drive_info): def worker(queue_id, test_mode=False): try: while not terminate: + time.sleep(3) if test_mode: - time.sleep(3) drive_info = { "driveIndex": "42", "driveHours": 44, @@ -99,6 +100,7 @@ def worker(queue_id, test_mode=False): "driveShredDuration": 0, "driveCapacity": 42, "driveState": "shredded", + "driveConnectionType": "sata", "driveModelFamily": "modelFamily", "driveModelName": "modelName", "driveSerialnumber": "serial", @@ -145,6 +147,7 @@ def worker(queue_id, test_mode=False): ), "driveCapacity": int(d.caDriveCapacity.decode().strip("\x00")), "driveState": d.caDriveState.decode().strip("\x00"), + "driveConnectionType": d.caDriveConnectionType.decode().strip("\x00"), "driveModelFamily": d.caDriveModelFamily.decode().strip("\x00"), "driveModelName": d.caDriveModelName.decode().strip("\x00"), "driveSerialnumber": d.caDriveSerialnumber.decode().strip("\x00"), diff --git a/dummy_sender/main.cpp b/dummy_sender/main.cpp index ea63cb1..5cff79d 100644 --- a/dummy_sender/main.cpp +++ b/dummy_sender/main.cpp @@ -43,23 +43,7 @@ int main(void) sprintf(msgQueueData.driveData.caDriveErrors, "%i", 1); sprintf(msgQueueData.driveData.caDriveShredTimestamp, "%li", 71718LU); sprintf(msgQueueData.driveData.caDriveShredDuration, "%li", 81718LU); - /* - switch (drive->connectionType) - { - case Drive::USB: - strcpy(msgQueueData.driveData.caDriveConnectionType, "usb"); - break; - case Drive::SATA: - strcpy(msgQueueData.driveData.caDriveConnectionType, "sata"); - break; - case Drive::NVME: - strcpy(msgQueueData.driveData.caDriveConnectionType, "nvme"); - break; - case Drive::UNKNOWN: - default: - strcpy(msgQueueData.driveData.caDriveConnectionType, "na"); - } - */ + strcpy(msgQueueData.driveData.caDriveConnectionType, "sata"); sprintf(msgQueueData.driveData.caDriveReHddVersion, REHDD_VERSION); std::cout << "Sending message to queue..." << std::endl; diff --git a/dummy_sender/main.h b/dummy_sender/main.h index 2ed16cd..35445cf 100644 --- a/dummy_sender/main.h +++ b/dummy_sender/main.h @@ -28,7 +28,7 @@ typedef struct char caDriveShredDuration[STR_BUFFER_SIZE]; char caDriveCapacity[STR_BUFFER_SIZE]; char caDriveState[STR_BUFFER_SIZE]; - // char caDriveConnectionType[STR_BUFFER_SIZE]; + char caDriveConnectionType[STR_BUFFER_SIZE]; char caDriveModelFamily[STR_BUFFER_SIZE]; char caDriveModelName[STR_BUFFER_SIZE]; char caDriveSerialnumber[STR_BUFFER_SIZE];