方块连连API文档
载入中...
搜索中...
未找到
cube_unite_iot_sdk.h
浏览该文件的文档.
1#ifndef CUBE_UNITE_SDK_CUBE_UNITE_IOT_SDK_H
2#define CUBE_UNITE_SDK_CUBE_UNITE_IOT_SDK_H
3
11#include <stdbool.h>
12#include <stdint.h>
13#include <time.h>
14
15#define CU_IOT_AUDIO_FRAME_MAX_SIZE (640)
16
17
21typedef enum cu_iot_err_code_e {
23 // 1-100, reserved
24 // 101-200, network related error
26 // 201-300, API error
28 // 301-400, application level error
32
36typedef struct cu_iot_video_meta_s {
37 uint32_t image_width;
38 uint32_t image_height;
39 char format[64];
44 char rotation[16];
52
64
69typedef struct cu_iot_device_event_s {
70 char name[32];
71 uint8_t user_type;
72 uint16_t user_id;
73 uint8_t event_info;
74 char* extra_meta;
76
91
99
107
113typedef void (*cu_iot_sdk_event_handler_t)(cu_iot_sdk_event_t *event, void *event_meta);
114
120typedef void (*cu_iot_rtc_on_audio_frame_received_t)(cu_iot_audio_frame_t *audio_frame, uint64_t sent_ts);
121
122
131cu_iot_err_code_t cu_iot_init(char* license, char *vendor_name, char* vendor_token);
132
139
144
145
157 char* device_creation_code,
158 char* device_mac_addr,
159 cu_iot_video_meta_t *video_meta,
160 cu_iot_audio_meta_t *audio_meta,
161 uint8_t *device_meta_out_buf
162 );
163
169
175
176
181
182
183// event related
189
195
201
202// time sync
210
211// RTC related
216
221
228
234
240
241
242#endif //CUBE_UNITE_SDK_CUBE_UNITE_IOT_SDK_H
cu_iot_err_code_t cu_iot_device_deinit()
反初始化设备信息,释放资源
cu_iot_sdk_event_e
SDK 系统事件类型
Definition cube_unite_iot_sdk.h:80
@ CU_IOT_SDK_EVENT_REMOTE_TRIGGER_WAKEUP
Definition cube_unite_iot_sdk.h:83
@ CU_IOT_SDK_EVENT_REMOTE_RTC_STARTED
Definition cube_unite_iot_sdk.h:88
@ CU_IOT_SDK_EVENT_REMOTE_UNLOCK
Definition cube_unite_iot_sdk.h:82
@ CU_IOT_SDK_EVENT_REMOTE_TRIGGER_SLEEP
Definition cube_unite_iot_sdk.h:84
@ CU_IOT_SDK_EVENT_REMOTE_DISABLE_KEEP_ALIVE
Definition cube_unite_iot_sdk.h:86
@ CU_IOT_SDK_EVENT_REMOTE_ENABLE_KEEP_ALIVE
Definition cube_unite_iot_sdk.h:85
@ CU_IOT_SDK_EVENT_REMOTE_RTC_END
Definition cube_unite_iot_sdk.h:89
@ CU_IOT_SDK_EVENT_UNDEFINED
Definition cube_unite_iot_sdk.h:81
cu_iot_err_code_t cu_iot_device_rtc_end()
主动结束视频通话
cu_iot_err_code_t cu_iot_device_snapshot_upload(cu_iot_video_frame_t *snapshot)
enum cu_iot_err_code_e cu_iot_err_code_t
错误码
struct cu_iot_video_frame_s cu_iot_video_frame_t
视频帧
cu_iot_err_code_t cu_iot_device_delete(uint8_t *device_meta)
cu_iot_err_code_t cu_iot_device_init(uint8_t *device_meta)
初始化设备信息,分配所需资源
cu_iot_err_code_t cu_iot_device_get_remote_time(time_t *server_time_ts)
获取远端时间
cu_iot_err_code_t cu_iot_device_create(char *device_creation_code, char *device_mac_addr, cu_iot_video_meta_t *video_meta, cu_iot_audio_meta_t *audio_meta, uint8_t *device_meta_out_buf)
创建一个 IOT 设备对象
cu_iot_err_code_t cu_iot_device_event_create(cu_iot_device_event_t *event)
门锁事件上报
cu_iot_err_code_t cu_iot_init(char *license, char *vendor_name, char *vendor_token)
方块连连 SDK 初始化
cu_iot_err_code_t cu_iot_device_rtc_register_audio_frame_receive_callback(cu_iot_rtc_on_audio_frame_received_t on_audio_frame_received)
注册下发音频受到后的处理函数
void(* cu_iot_rtc_on_audio_frame_received_t)(cu_iot_audio_frame_t *audio_frame, uint64_t sent_ts)
音频回掉函数
Definition cube_unite_iot_sdk.h:120
cu_iot_err_code_e
错误码
Definition cube_unite_iot_sdk.h:21
@ CU_IOT_ERR_DEVICE_INVALID
Definition cube_unite_iot_sdk.h:29
@ CU_IOT_ERR_OK
Definition cube_unite_iot_sdk.h:22
@ CU_IOT_ERR_LICENSE_INVALID
Definition cube_unite_iot_sdk.h:30
@ CU_IOT_ERR_SERVER_NOT_AVAILABLE
Definition cube_unite_iot_sdk.h:25
@ CU_IOT_ERR_ARGUMENT_INVALID
Definition cube_unite_iot_sdk.h:27
struct cu_iot_audio_frame_s cu_iot_audio_frame_t
音频帧
cu_iot_err_code_t cu_iot_device_rtc_start()
门铃时,启动视频通话
cu_iot_err_code_t cu_iot_deinit()
反初始化
struct cu_iot_audio_meta_s cu_iot_audio_meta_t
音频元数据
void(* cu_iot_sdk_event_handler_t)(cu_iot_sdk_event_t *event, void *event_meta)
SDK事件回调函数
Definition cube_unite_iot_sdk.h:113
cu_iot_err_code_t cu_iot_ping_server()
测试 SDK 是否能正常联网
enum cu_iot_sdk_event_e cu_iot_sdk_event_t
SDK 系统事件类型
struct cu_iot_video_meta_s cu_iot_video_meta_t
视频元数据
cu_iot_err_code_t cu_iot_device_video_send_frame(cu_iot_video_frame_t *video_frame)
发送视频帧
struct cu_iot_device_event_s cu_iot_device_event_t
门锁上报事件
#define CU_IOT_AUDIO_FRAME_MAX_SIZE
Definition cube_unite_iot_sdk.h:15
cu_iot_err_code_t cu_iot_device_register_callback(cu_iot_sdk_event_handler_t handler)
注册事件回调函数,用于接收来自 SDK 的事件通知
cu_iot_err_code_t cu_iot_device_audio_send_frame(cu_iot_audio_frame_t *audio_frame)
发送音频帧
音频帧
Definition cube_unite_iot_sdk.h:95
uint32_t data_bytes
Definition cube_unite_iot_sdk.h:96
uint8_t data[CU_IOT_AUDIO_FRAME_MAX_SIZE]
Definition cube_unite_iot_sdk.h:97
音频元数据
Definition cube_unite_iot_sdk.h:56
char codec[32]
Definition cube_unite_iot_sdk.h:57
门锁上报事件
Definition cube_unite_iot_sdk.h:69
char * extra_meta
Definition cube_unite_iot_sdk.h:74
char name[32]
Definition cube_unite_iot_sdk.h:70
uint8_t user_type
Definition cube_unite_iot_sdk.h:71
uint8_t event_info
Definition cube_unite_iot_sdk.h:73
uint16_t user_id
Definition cube_unite_iot_sdk.h:72
视频帧
Definition cube_unite_iot_sdk.h:103
uint8_t * data
Definition cube_unite_iot_sdk.h:105
uint32_t data_bytes
Definition cube_unite_iot_sdk.h:104
视频元数据
Definition cube_unite_iot_sdk.h:36
char rotation[16]
Definition cube_unite_iot_sdk.h:44
uint32_t image_width
Definition cube_unite_iot_sdk.h:37
char format[64]
Definition cube_unite_iot_sdk.h:39
uint32_t image_height
Definition cube_unite_iot_sdk.h:38