import os
import platform
import sys
from PyQt5.QtWidgets import QApplication
if platform.system().lower() == "windows":
    sys.path.append(f"{os.getcwd()}\src\components")
else:
    sys.path.append(f"{os.getcwd()}/src/components")

from components.furness_controls_leak_tester import FurnessControlsLeakTester
from lib.helpers import ConfigReader

config = ConfigReader(system_id="ST-TEN-9")

app = QApplication(sys.argv)

tester_component = FurnessControlsLeakTester(name="furness_controls",config=config)
tester_component.config_changed()

# GET STATUS
enquiry=bytearray(b'M000')
response=tester_component.send_enquiry(enquiry)


if response is not None:
    print(f"INQUIRY RESPONSE:{response}")
else:
    print("INQUIRY ERROR")

# SET PRODUCT 50 (LAST RECIPE)

#command=bytearray(b'F050')
command=bytearray(b'G000')  # START TEST

response=tester_component.send_command(command)
if response is True:
    print(f"COMMAND RESPONSE OK")
else:
    print("COMMAND NO RESPONSE")

