2024-11-28 08:31:00 +00:00
|
|
|
#ifndef _INCLUDE_EXTERN_INTERFACE_H_
|
|
|
|
#define _INCLUDE_EXTERN_INTERFACE_H_
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#define ET_TYPE_NONE 0
|
|
|
|
#define ET_TYPE_TEXT 1
|
|
|
|
#define ET_TYPE_AUDIO 2
|
|
|
|
#define ET_TYPE_COMMAND 3
|
|
|
|
#define ET_TYPE_ALARM 4
|
|
|
|
#define ET_TYPE_TELEMETRY_REQUEST 5
|
|
|
|
|
2024-11-29 18:44:08 +00:00
|
|
|
#define ET_SYS_STATUS_WAKE 1
|
|
|
|
|
2024-11-28 10:14:00 +00:00
|
|
|
#if defined(_MSC_VER)
|
|
|
|
#define EXTERN_INTERFACE_PUBLIC __declspec(dllexport)
|
|
|
|
#elif defined(__GNUC__)
|
|
|
|
#define EXTERN_INTERFACE_PUBLIC __attribute__ ((dllexport))
|
|
|
|
#endif
|
|
|
|
|
2024-11-28 08:31:00 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct TelemetryRequestData {
|
|
|
|
bool keep_sys_running;
|
|
|
|
bool close_asr;
|
|
|
|
int sys_state;
|
|
|
|
bool volume_key_pressed;
|
|
|
|
bool wakeup_key_pressed;
|
2024-11-29 18:44:08 +00:00
|
|
|
int volume_grade; // 0, 1, 2
|
2024-11-28 08:31:00 +00:00
|
|
|
int sys_ver_high;
|
|
|
|
int sys_ver_low;
|
|
|
|
int app_ver_high;
|
|
|
|
int app_ver_low;
|
|
|
|
};
|
|
|
|
|
|
|
|
union PacketData
|
|
|
|
{
|
|
|
|
int64_t pd_integer;
|
|
|
|
double pd_float;
|
|
|
|
const char* pd_text;
|
|
|
|
void* pd_pointer;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef void (*et_callback_t)(uint32_t, size_t, union PacketData);
|
|
|
|
|
2024-11-28 10:14:00 +00:00
|
|
|
EXTERN_INTERFACE_PUBLIC
|
2024-11-29 10:07:35 +00:00
|
|
|
int extern_interface_init(const char* config_path, et_callback_t cb);
|
2024-11-28 10:14:00 +00:00
|
|
|
EXTERN_INTERFACE_PUBLIC
|
2024-11-28 08:31:00 +00:00
|
|
|
void extern_interface_send(uint32_t type, size_t len, union PacketData data);
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|