2026-09-06 17:04:11 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
#include <stddef.h>
|
|
|
|
|
#include "esp_err.h"
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define PLATFORM_DEVICE_ID_MAX 37
|
|
|
|
|
#define PLATFORM_DEVICE_SECRET_MAX 129
|
|
|
|
|
#define PLATFORM_HARDWARE_ID_MAX 65
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char instance_id[201];
|
|
|
|
|
char product_key[201];
|
|
|
|
|
char device_name[129];
|
|
|
|
|
char device_secret[257];
|
|
|
|
|
char hardware_id[PLATFORM_HARDWARE_ID_MAX];
|
|
|
|
|
} platform_volc_credential_t;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
char conversation_id[37];
|
|
|
|
|
char bot_id[201];
|
|
|
|
|
char provider_session_ref[201];
|
|
|
|
|
char session_nonce[257];
|
|
|
|
|
char config_digest[65];
|
|
|
|
|
char *session_update_json;
|
|
|
|
|
bool native_subtitle_primary;
|
|
|
|
|
} platform_agent_session_t;
|
|
|
|
|
|
|
|
|
|
esp_err_t platform_identity_save(const char *device_id, const char *device_secret);
|
|
|
|
|
bool platform_identity_is_configured(void);
|
|
|
|
|
const char *platform_last_error_code(void);
|
|
|
|
|
esp_err_t platform_client_init(void);
|
|
|
|
|
const char *platform_hardware_id(void);
|
|
|
|
|
const platform_volc_credential_t *platform_volc_credential(void);
|
|
|
|
|
esp_err_t platform_provision_volc_credential(void);
|
2026-09-06 18:15:32 +08:00
|
|
|
esp_err_t platform_recover_pending_conversation(void);
|
2026-09-06 17:04:11 +08:00
|
|
|
esp_err_t platform_create_agent_session(platform_agent_session_t *session);
|
|
|
|
|
esp_err_t platform_report_session_started(const platform_agent_session_t *session,
|
|
|
|
|
const char *provider_connection_ref);
|
|
|
|
|
esp_err_t platform_report_session_event(const platform_agent_session_t *session,
|
|
|
|
|
const char *event_type,
|
|
|
|
|
const char *error_code);
|
|
|
|
|
void platform_agent_session_free(platform_agent_session_t *session);
|
|
|
|
|
|
|
|
|
|
/* Link-safe hooks used by the vendor application component. */
|
|
|
|
|
const char *platform_runtime_instance_id(void);
|
|
|
|
|
const char *platform_runtime_product_key(void);
|
|
|
|
|
const char *platform_runtime_device_name(void);
|
|
|
|
|
const char *platform_runtime_device_secret(void);
|
|
|
|
|
esp_err_t platform_conversation_begin(void);
|
|
|
|
|
const char *platform_conversation_bot_id(void);
|
|
|
|
|
const char *platform_conversation_update_json(void);
|
|
|
|
|
esp_err_t platform_conversation_started(const char *provider_connection_ref);
|
|
|
|
|
int platform_conversation_poll(void);
|
2026-10-08 10:06:44 +08:00
|
|
|
bool platform_conversation_audio_authorized(void);
|
2026-09-06 17:04:11 +08:00
|
|
|
esp_err_t platform_conversation_turn(const char *speaker, const char *source_id, const char *text);
|
|
|
|
|
void platform_conversation_finish(bool failed, const char *error_code);
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|