Ejemplo n.º 1
0
    def __init__(self):
        self.pi = pigpio.pi()

        self.lightQueue = multiprocessing.Queue()
        self.heightQueue = multiprocessing.Queue()
        self.pcQueue = multiprocessing.Queue()
        self.stateQueue = multiprocessing.Queue()
        self.sendQueue = multiprocessing.Queue()

        self.bluetoothConnection = BluetoothConnection.BluetoothConnection(
            self.lightQueue, self.heightQueue, self.pcQueue, self.stateQueue,
            self.sendQueue)
        self.lightControl = LightControl.LightControl(self.pi, self.lightQueue,
                                                      self.stateQueue)
        self.heightControl = HeightControl.HeightControl(
            self.pi, self.heightQueue)
        self.pcControl = PcControl.PcControl(self.pi, self.pcQueue)
        self.indication = Indication.Indication(self.pi, self.sendQueue)

        self.bluetoothConnection.start()
        self.lightControl.start()
        self.heightControl.start()
        self.pcControl.start()
Ejemplo n.º 2
0
    deviceID = "LightControl"
    terrariumID = data["terrariumID"]
    file.close()
    catalogurl = "http://" + catalogip + catalogport

    try:
        r = requests.get(catalogurl + "broker")
        r.raise_for_status()
        broker = r.json()
        brokerip = broker["broker_IP"]
        brokerport = broker["broker_port"]
    except requests.HTTPError as err:
        print "Error retrieving the broker"
        sys.exit()

    Pikachu = LightControl()

    LightActor = MQTTControl(deviceID, terrariumID, Pikachu, brokerip,
                             brokerport)

    light_registration = LightRegistration(Pikachu, deviceID, terrariumID,
                                           catalogurl)

    thread_light = LightThread(1, LightActor, Pikachu)

    LightActor.start()

    light_registration.start()
    thread_light.start()

    conf = {