135 lines
3.6 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*************************************************************
*
* Copyright (C) POKA
* All rights reserved.
*
*************************************************************/
#ifndef __APPLICATION_H__
#define __APPLICATION_H__
#ifdef __cplusplus
extern "C" {
#endif
typedef struct
{
//小智AI OTA URL地址
char activation_code[32];
char websocket_url[128];
uint32_t led_brightness;
uint32_t led_timeout;
uint32_t sleep_timeout;
}app_config_t;
typedef enum AecMode {
kAecOff,
kAecOnDeviceSide,
kAecOnServerSide,
}AecMode;
typedef enum DeviceState {
kDeviceStateUnknown,
kDeviceStateStarting,
kDeviceStateWifiConfiguring,
kDeviceStateIdle,
kDeviceStateConnecting,
kDeviceStateListening,
kDeviceStateSpeaking,
kDeviceStateUpgrading,
kDeviceStateActivating,
kDeviceStateAudioTesting,
kDeviceStateFatalError
}DeviceState;
typedef enum AbortReason {
kAbortReasonNone,
kAbortReasonWakeWordDetected
}AbortReason;
typedef enum ListeningMode {
kListeningModeAutoStop,
kListeningModeManualStop,
kListeningModeRealtime // 需要 AEC 支持
}ListeningMode;
#include "cJSON.h"
/**
* 1.1.1
* 添加OTA升级电量限制 大于25%才允许升级
* 更新音量等级
* OTA时关闭语音
* 更新蓝牙控制休眠时间
*
* 1.1.3
* 1.添加获取电量状态
* 2.解决睡眠仪电压突然反向是PWM 占空比设置100%之后引起的
* 3.重新设置音量等级
* 4.当没有网络时不允许发IOT上报相关的消息
* 5 .当没有网络时不允许发送音频数据到平台
*
* 1.1.4
* 添加开灯超时 默认10分钟后关闭
*
* 1.1.5
* 修复设置灯光超时指令无效
*
* 1.1.6
* 单独添加控制灯光开关接口 和设置亮度接口分开
* 解决调用BLE设置灯光常亮时异常问题
*
* 1.2.0
* 更新MCP控制协议
* 添加电池校准
* 修复没有播声音 修正音量调整失败
* 添加自动激活设备
*/
#define APPLICATION_VERSION "1.2.0"
#define APPLICATION_DEFULT_OTA_URL "https://xiaozhi.xa-poka.com/xiaozhi/ota/"
#define APPLICATION_CONFIG_KEY_AI_URL "ai_url"
#define APPLICATION_DEFULT_OTA_ADD_DEV_URL "https://xiaozhi.xa-poka.com/xiaozhi/device/manual-add"
#define APPLICATION_DEFULT_TOKEN "test-token"
#define APPLICATION_DEFULT_PROTOCOL_VERSION 2
/**
* https://xiaozhi.xa-poka.com/xiaozhi/device/bind/20fea9573bf54b69b685395f6b67ae72
* 这个是默认的宝嘉小智平台默认 小宝的 AI Agent ID如果用户没有设置使用这个ID
*/
#define APPLICATION_DEFULT_AI_AGENT_ID "20fea9573bf54b69b685395f6b67ae72"
/**
*开灯超时关闭 单位分钟 10 - 表示开灯10分钟后关闭
*/
#define APPLICATION_DEFULT_LIGHT_TIMEOUT 10
/**
* 灯光默认亮度
*/
#define APPLICATION_DEFULT_LIGHT_BRIGHTNESS 100
/**
*助眠超时关闭 单位分钟 10 - 表示助眠10分钟后关闭
*/
#define APPLICATION_DEFULT_SLEEP_TIMEOUT 10
/**
* 使用本地MCP协议
*/
#define APPLICATION_IOT_PROTOCOL_MCP 1
#define APPLICATION_DEVICE_BOARD_NAME "bread-compact-wifi-ir58"
#define APPLICATION_DEVICE_BOARD_TYPE "bread-compact-wifi"
app_config_t* app_get_config();
void app_set_websocket_url(const char* url);
void app_ai_agent_start();
void app_start();
void app_set_device_state(DeviceState state);
DeviceState app_get_device_state();
#ifdef __cplusplus
}
#endif
#endif