#pragma once

#include <Arduino.h>
#include <WiFi.h>
#include <Client.h>
#include <ArduinoHA.h>


#include "knob_data.h"
#include "task.h"

#define BROKER_ADDR IPAddress(192,168,4,58)
#define BROKER_USERNAME     "mqtt_broker_user" // replace with your credentials
#define BROKER_PASSWORD     "mqtt2022"

//HA vars


class CommuTask : public Task<CommuTask> {
  friend class Task<CommuTask>; // Allow base Task to invoke protected run()

  public:
    CommuTask(const uint8_t task_core);
    ~CommuTask();

    void setAngleValue(uint32_t angle);
    QueueHandle_t getKnobStateQueue();


  protected:
    void run();


  private:
    
    uint32_t angle_ =0;
    SemaphoreHandle_t mutex_;

    QueueHandle_t knob_state_queue_;


};
