Baji_Rtc_Toy/components/common/inc/base/volc_device_manager.h
2026-02-24 15:57:32 +08:00

64 lines
2.2 KiB
C
Raw Permalink 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 (2025) Beijing Volcano Engine Technology Ltd.
// SPDX-License-Identifier: Apache-2.0
#ifndef __CONV_AI_BASE_VOLC_DEVICE_MANAGER_H__
#define __CONV_AI_BASE_VOLC_DEVICE_MANAGER_H__
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
// 硬件ID宏定义
#define HARDWARE_ID "a2:c8:2c:89:6e:46"
// 错误码宏定义
#define ERROR_LICENSE_EXHAUSTED 12000130
#define ERROR_LICENSE_EXPIRED 12000140
// IoT设备信息结构体
typedef struct {
char* instance_id; // 实例ID
char* product_key; // 产品密钥
char* product_secret; // 产品密钥
char* device_name; // 设备名称
char* device_secret; // 设备密钥
char* rtc_app_id; // RTC应用ID
char* bot_id; // Bot ID
} volc_iot_info_t;
// RTC配置结构体
typedef struct {
char* p_channel_name; // 频道名称
char* p_uid; // 用户ID
char* p_token; // 令牌
int audio_codec; // 音频编解码器
int video_codec; // 视频编解码器
uint32_t audio_bitrate; // 音频比特率
uint32_t video_bitrate; // 视频比特率
uint32_t sample_rate; // 采样率
uint32_t channels; // 声道数
uint32_t bits_per_sample;// 采样位数
} volc_rtc_config_t;
// 房间信息结构体
typedef struct {
volc_rtc_config_t rtc_opt; // RTC配置选项
char* task_id; // 任务ID
} volc_room_info_t;
// 为了向后兼容添加volc_rtc_option_t作为volc_rtc_config_t的别名
typedef volc_rtc_config_t volc_rtc_option_t;
// 函数声明
int volc_device_register(volc_iot_info_t* info, char** output);
// 新增extra_params 用于传递额外的AgentConfig配置参数
int volc_get_rtc_config(volc_iot_info_t* info, int audio_codec, const char* bot_id, const char* task_id, const char* extra_params, volc_room_info_t* room_info);
char* volc_generate_signature(const char* secret_key, const char* product_key, const char* device_name, int rnd, uint64_t timestamp, int auth_type);
char* volc_generate_signature_ws(const char* secret_key, const char* product_key, const char* device_name, const char* instance_id, int rnd, uint64_t timestamp, int auth_type);
#ifdef __cplusplus
}
#endif
#endif /* __CONV_AI_BASE_VOLC_DEVICE_MANAGER_H__ */