esp-sr/include/esp32s3/model_path.h
2022-07-08 19:25:49 +08:00

74 lines
2.6 KiB
C

#pragma once
typedef struct
{
char **model_name; // the name of models, like "wn9_hilexin"(wakenet9, hilexin), "mn5_en"(multinet5, english)
int num; // the number of models
} srmodel_list_t;
#define MODEL_NAME_MAX_LENGTH 64
/**
* @brief Return all avaliable models in spiffs or selected in Kconfig.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
srmodel_list_t* esp_srmodel_init(void);
/**
* @brief Free srmodel_list_t and unregister SPIFFS filesystem if open SPIFFS filesystem.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
void esp_srmodel_deinit(srmodel_list_t *models);
/**
* @brief Return the first model name containing the specified keywords
* If keyword is NULL, we will ignore the keyword.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
* @param keyword1 The specified keyword1 , like ESP_WN_PREDIX(the prefix of wakenet),
* ESP_MN_PREFIX(the prefix of multinet),
*
* @param keyword2 The specified keyword2, like ESP_MN_ENGLISH(the english multinet)
* ESP_MN_CHINESE(the chinese multinet)
* "alexa" (the "alexa" wakenet)
* @return return model name if can find one model name containing the keywords otherwise return NULL.
*/
char *esp_srmodel_filter(srmodel_list_t *models, const char *keyword1, const char *keyword2);
/**
* @brief Check whether the specified model name exists or not.
*
* @param models The srmodel_list_t point allocated by esp_srmodel_init function.
* @param model_name The specified model name
* @return return index in models if model name exists otherwise return -1
*/
int esp_srmodel_exists(srmodel_list_t *models, char *model_name);
/**
* @brief Initialize and mount SPIFFS filesystem, return all avaliable models in spiffs.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
srmodel_list_t *srmodel_spiffs_init(void);
/**
* @brief unregister SPIFFS filesystem and free srmodel_list_t.
*
* @param models The srmodel_list_t point allocated by srmodel_spiffs_init function.
*
* @return all avaliable models in spiffs,save as srmodel_list_t.
*/
void srmodel_spiffs_deinit(srmodel_list_t *models);
/**
* @brief Return base path of srmodel spiffs
*
* @return the base path od srmodel spiffs
*/
char *get_model_base_path(void);