"""
SPDX-FileCopyrightText: 2022-present Intel Corporation
SPDX-FileCopyrightText: 2020-present Open Networking Foundation <info@opennetworking.org>
SPDX-License-Identifier: Apache-2.0
"""
import paho.mqtt.client as mqtt
import time
import os
import sys

class Mqtt:

    def __init__(self, ip, port):
        self.topic = "camera/" + port
        self.ip = ip
        self.client = mqtt.Client()
        self.client.on_connect = self.on_connect
        self.client.on_message = self.on_message

    # The callback for when the client receives a CONNACK response from the server.
    def on_connect(self, client, userdata, flags, rc):
        print("Connected to {} with result code ".format(self.ip, str(rc)))
        # Subscribing in on_connect() means that if we lose the connection and
        # reconnect then subscriptions will be renewed.
        client.subscribe(self.topic)

    # The callback for when a PUBLISH message is received from the server.
    def on_message(self, client, userdata, msg):
        cmd = msg.payload.decode()
        print(msg.topic+" "+cmd)
        if cmd == "high":
            print("Change to high resolution")
            os.system("sudo systemctl stop openvino-camera@low.service")
            os.system("sudo systemctl start openvino-camera@high.service")
        elif cmd == "low":
            print("Change to low resolution")
            os.system("sudo systemctl stop openvino-camera@high.service")
            os.system("sudo systemctl start openvino-camera@low.service")
        else:
            print("Unknown cmd: " + cmd)

    def start(self):
        while True:
            try:
                self.client.connect(self.ip)
            except:
                time.sleep(1)
                continue
            break
        self.client.loop_forever()

if __name__ == '__main__':
    mqtt = Mqtt(sys.argv[1], sys.argv[2])
    mqtt.start()
