#include <stddef.h>
#include "meteofrance.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_log.h"
#include "esp_event.h"

#define BIT0     0x00000001
#define WIFI_CONNECTED_BIT BIT0


int main1(int argc, char const *argv[])
{
    /* code */
    return 0;
}

void weather_data_retreived_start()
{
    //if (display_lock("weather_data_retreived_start"))
    //{
        //ESP_LOGE(TAG,"Mutex obtenu dans weather_data_retreived_start");
        //lv_subject_set_int(&meteoStatus, 1);
        ESP_LOGE("","Subject setted weather_data_retreived_start");
        //display_unlock("weather_data_retreived_start");
    //}else{
    //    ESP_LOGE(TAG,"Impossible d'obtenir le mutex dans weather_data_retreived_start");
    //}
}

void weather_data_retreived(struct meteodailyforecast_data dailyDatas[3], struct meteoforecast_data datas[3])
{
}

EventGroupHandle_t domotic_event_group;
int app_main(int argc, char *argv[]) {
    ESP_ERROR_CHECK(esp_event_loop_create_default());
    domotic_event_group = xEventGroupCreate();
    on_weather_data_retrieval_start(weather_data_retreived_start);
    on_weather_data_retrieval(weather_data_retreived);
    initialise_weather_data_retrieval(30000, domotic_event_group);
    xEventGroupSetBits(domotic_event_group, WIFI_CONNECTED_BIT);

    return 0;
}