No description
Find a file
2023-10-09 01:10:37 +03:00
.idea Initial commit 2023-10-01 22:41:21 +03:00
command_parser Рефакторинг парсера команд 2023-10-09 01:10:37 +03:00
data_processor Initial commit 2023-10-01 22:41:21 +03:00
tests Рефакторинг парсера команд 2023-10-09 01:10:37 +03:00
transport Initial commit 2023-10-01 22:41:21 +03:00
config.yml Initial commit 2023-10-01 22:41:21 +03:00
reader.py Initial commit 2023-10-01 22:41:21 +03:00
README.md Initial commit 2023-10-01 22:41:21 +03:00
writer.py Initial commit 2023-10-01 22:41:21 +03:00
writer_tcp.py Initial commit 2023-10-01 22:41:21 +03:00

Создаем пару виртуальных портов:

$ socat -d -d pty,rawer,echo=0 pty,rawer,echo=0
2023/10/01 03:18:39 socat[965194] N PTY is /dev/pts/16
2023/10/01 03:18:39 socat[965194] N PTY is /dev/pts/19

Запускаем писателя на другой консоли:

$ ./writer.py
Write: GET_A
Write: GET_B
Write: GET_C
Write: GET_NORESP
Write: INVALID_CMD
...

На следующей консоли за пускаем парсер:

$ ./reader.py
01-10-2023 15:17:07 DEBUG:read: GET_B
01-10-2023 15:17:07 INFO:response_str: B_5V
01-10-2023 15:17:09 DEBUG:read: GET_C
01-10-2023 15:17:09 INFO:response_str: C_15A
01-10-2023 15:17:11 DEBUG:read: GET_NORESP
01-10-2023 15:17:11 WARNING:No value for sensor: NORESP
01-10-2023 15:17:13 DEBUG:read: INVALID_CMD
01-10-2023 15:17:13 WARNING:Command parser error: Unknown command: INVALID
01-10-2023 15:17:15 DEBUG:read: GET_A
...