#ifndef TASK_MANAGER_H
#define TASK_MANAGER_H

#include "esp_err.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"

#define APP_TASK_CORE_NO_AFFINITY (-1)

typedef enum {
    APP_TASK_DNS_SERVER = 0,
    APP_TASK_BUTTON_MONITOR,
    APP_TASK_BLE_HEARTBEAT,
    APP_TASK_MQTT_HEARTBEAT,
    APP_TASK_MQTT_OTA_REPORT,
    APP_TASK_MQTT_EXIT,
    APP_TASK_MQTT_INIT,
    APP_TASK_UART_COMM_EXAMPLE,
    APP_TASK_RC_WATCHDOG,  /* 遥控超时守护任务 */
    APP_TASK_COUNT,
} app_task_id_t;

esp_err_t app_task_start(app_task_id_t id,
                         TaskFunction_t entry,
                         void *arg,
                         TaskHandle_t *out_handle);

void app_task_stop(TaskHandle_t *handle);

esp_err_t app_task_start_nimble_host(TaskFunction_t entry);

#endif
