extern_interface/include/external_interface.h

57 lines
1.1 KiB
C

#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
#define ET_SYS_STATUS_WAKE 1
#if defined(_MSC_VER)
#define EXTERN_INTERFACE_PUBLIC __declspec(dllexport)
#elif defined(__GNUC__)
#define EXTERN_INTERFACE_PUBLIC __attribute__ ((visibility("default")))
#endif
#ifdef __cplusplus
extern "C" {
#endif
struct AlarmData {
uint32_t alarm_id;
const char* text;
};
struct TelemetryRequestData {
bool close_asr;
int sys_state;
bool volume_key_pressed;
bool wakeup_key_pressed;
int volume_grade; // 0, 1, 2
int sys_ver_high;
int sys_ver_low;
int app_ver_high;
int app_ver_low;
};
typedef void (*et_callback_t)(uint32_t, size_t, void*);
EXTERN_INTERFACE_PUBLIC
int exint_initialize(const char* config_path, et_callback_t cb);
EXTERN_INTERFACE_PUBLIC
void exint_send(uint32_t type, size_t len, void* data);
EXTERN_INTERFACE_PUBLIC
void exint_finialize();
#ifdef __cplusplus
}
#endif
#endif