回调接口
更新日期:2025/5/13
目录
- KY_registerSDKListener
- KY_unRegisterSDKListener
- KY_receiveBindInfo
- KY_DeviceStatus
- KY_StartTalkSuccess
- KY_StartListenSuccess
- KY_UpdateDecodedImage
- KY_UpdateDecodedYUV
- KY_DecodeVideoFramInfo
- KY_DecodeResult
- KY_ReceiveFrameData
- KY_ReceiveAudioData
- KY_DidReceiveIOCtrlWithUid
- KY_DidReceiveNebulaCtrlWithUid
- KY_DownloadUploadOutput
回调接口
KY_registerSDKListener
- 功能描述:
- 注册IOTC回调。
接口定义
public boolean KY_registerSDKListener(InterfaceCtrl.KY_SDKListener listener);
参数说明
暂无
KY_unRegisterSDKListener
- 功能描述:
- 注销IOTC回调。
接口定义
public boolean KY_unRegisterSDKListener(InterfaceCtrl.KY_SDKListener listener);
参数说明
暂无
KY_receiveBindInfo
- 功能描述:
- Nebula绑定结果回调。当调用 KY_nebulaStartBind 进行对讲时,此接口会回调结果。
接口定义
void KY_receiveBindInfo(String uid, String credential, int KYDeviceState, int errorCode);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
credential | string | 绑定设备产生的credential |
KYDeviceState | int | 绑定状态 |
errorCode | int | P2P SDK错误码 |
KY_DeviceStatus
- 功能描述:
- 指定通道的连线状态回调。当调用 KY_Connect 进行连线时,此接口会回调结果。
接口定义
void KY_DeviceStatus(String uid, int channel, int KYDeviceState, int errorCode);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
KYDeviceState | int | 连线状态,返回结果参考 返回码 |
errorCode | int | P2P SDK错误码 |
返回码
返回码 | 说明 |
---|---|
KY_STATE_CONNECTING = 1 | 连线中 |
KY_STATE_CONNECTED = 2 | 连线成功 |
KY_STATE_DISCONNECTED = 3 | 断线 |
KY_STATE_UNKNOWN_DEVICE = 4 | 未知设备 |
KY_STATE_WRONG_PASSWORD = 5 | 密码错误 |
KY_STATE_TIMEOUT = 6 | 连线超时 |
KY_STATE_UNSUPPORTED = 7 | 设备不支持连线 |
KY_STATE_CONNECT_FAILED = 8 | 连线失败 |
KY_STATE_UNKNOWN_LICENSE = 9 | 设备uid未在license中 |
KY_STATE_SLEEP = 10 | 设备睡眠状态 |
KY_STATE_DEVICE_MAX_SESSION = 11 | 超过设备最大连线数 |
KY_STATE_POOR_NETWORKSIGNA = 12 | 网络信号差 |
KY_STATE_WRONG_AUTH_KEY = 13 | AuthKey错误 |
KY_STATE_SELF_DISCONNECT = 14 | 连线时用户主动断线 |
KY_StartTalkSuccess
- 功能描述:
- 对讲通道建立成功的回调。当调用 KY_StartTalk 进行对讲时,此接口会回调结果。
接口定义
void KY_StartTalkSuccess(String uid, boolean isSuccess, int errorCode);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
isSuccess | boolean | 是否建立成功 |
errorCode | int | P2P SDK错误码 |
KY_StartListenSuccess
- 功能描述:
- 监听通道建立成功的回调。当调用 KY_StartListen 进行监听时,此接口会回调结果。
接口定义
void KY_StartListenSuccess(String uid, boolean isSuccess);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
isSuccess | boolean | 是否建立成功 |
KY_UpdateDecodedImage
- 功能描述:
- 获取当前设备指定通道解码后的数据回调。当调用 KY_Connect 进行连线并出图成功时,此接口会回调结果。
接口定义
void KY_UpdateDecodedImage(String uid, int channel, long timestamp);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
timestamp | long | 当前数据的时间戳 |
KY_UpdateDecodedYUV
- 功能描述:
- 获取当前设备指定通道解码后的YUV数据。当调用 KY_Connect 进行连线,并进行yuv数据输出时,此接口会回调结果。
接口定义
void KY_UpdateDecodedYUV(String uid, int channel, long timestamp, byte[] yuvData, int outWidth, int outHeight);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
timestamp | long | 当前解码成功的帧时间戳 |
yuvData | array | 解码成功后的YUV数据 |
outWidth | int | 视频宽 |
outHeight | int | 视频高 |
KY_DecodeVideoFramInfo
- 功能描述:
- 指定通道的视频宽高/fps/bps/在线人数/帧数/丢帧数等调试信息回调。当调用 KY_Connect 进行连线并出图成功时,此接口会回调结果。
接口定义
void KY_DecodeVideoFramInfo(String uid, int channel, int connectMode, int videoWidth, int videoHeight, int videoFPS, int bps, int onlineNm, int frameCount, int incompleteFrameCount, boolean isHwDecode, int sessionID, int avChannelIndex, int cmdNum, int cmdReturn);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
connectMode | int | 连线模式 (-1:NONE,0:P2P,1:RELAY,2:LAN) |
videoWidth | int | 视频宽 |
videoHeight | int | 视频高 |
videoFPS | int | fps |
bps | int | 音视频bps |
onlineNm | int | 在线人数 |
frameCount | int | 帧数 |
incompleteFrameCount | int | 丢帧数 |
isHwDecode | boolean | 是否是硬解 |
sessionID | int | 连线返回的session号 |
avChannelIndex | int | 开启通道返回的av通道 |
cmdNum | int | command指令类型值 |
cmdReturn | int | command指令返回值 |
KY_DecodeResult
- 功能描述:
- 视频解码结果回调。当调用 KY_Connect 行连线并解码时,此接口会回调结果。
接口定义
void KY_DecodeResult(Camera camera, int avChannel, int cacheCount, AVFrame avFrame, boolean isDecodeSuccess, boolean isDropping, boolean isSoftDecode);
参数说明
参数 | 类型 | 说明 |
---|---|---|
camera | 绑定的camera对象 | |
avChannel | int | av通道,一般为0 |
cacheCount | int | 缓存队列还有多少未解码帧 |
avFrame | 当前解码的avFrame帧 | |
isDecodeSuccess | boolean | 是否解码成功 |
isDropping | boolean | 是否正在丢p帧 |
isSoftDecode | boolean | 是否使用的软解码 |
KY_ReceiveFrameData
- 功能描述:
- 获取当前设备指定通道接收的视频帧裸流数据及帧信息回调。当调用 KY_Connect 进行连线并出图成功时,此接口会回调结果。
接口定义
void KY_ReceiveFrameData(String uid, int channel, AVFrame avFrame);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
KY_ReceiveAudioData
- 功能描述:
- 获取当前设备指定通道接收的音频帧裸流数据及帧信息回调。当调用 KY_StartListen 进行监听时,此接口会回调结果。
接口定义
void KY_ReceiveAudioData(String uid, int channel, AVFrame avFrame);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前设备的uid |
channel | int | 设备连线的channel,默认为0 |
KY_DidReceiveIOCtrlWithUid
- 功能描述:
- 获取设备回复Command的数据信息回调。当调用 KY_SendIOCtrlToChannel 发送Command时,此接口会回调结果。
接口定义
void KY_DidReceiveIOCtrlWithUid(String uid, int channel, int type, byte[] data, int dataSize);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前接收Command的uid |
channel | int | 设备连线的channel,默认为0 |
type | int | command指令值 |
data | array | command对应指令的结构体数据 |
dataSize | int | command对应指令的结构体数据长度 |
KY_DidReceiveNebulaCtrlWithUid
- 功能描述:
- 获取设备回复Nebula Command的数据信息回调。当调用 KY_nebulaSendData 发送Nebula Command时,此接口会回调结果。
接口定义
void KY_DidReceiveNebulaCtrlWithUid(String uid, int channel, String jsonRequest, String jsonResponse);
参数说明
参数 | 类型 | 说明 |
---|---|---|
uid | string | 当前接收Command的uid |
channel | int | 设备连线的channel,默认为0 |
jsonRequest | string | nebula command指令 |
jsonResponse | string | nebula command设备返回 |
KY_DownloadUploadOutput
- 功能描述:
- 文件上传、下载回调。
- 连线成功之后,当调用 KY_startDownload 开始文件下载后,回调下载进度。
- 连线成功之后,当调用 KY_startUpload 开始文件上传后,回调上传进度。
接口定义
void KY_DownloadUploadOutput(Camera camera, int channel, String filePath, int progress, int loadType, int p2pCode);
参数说明
参数 | 类型 | 说明 |
---|---|---|
camera | 绑定的camera对象 | |
channel | int | 通道号 |
filePath | string | 文件完整沙盒路径 |
progress | int | 上传/下载进度 |
loadType | int | 下载或上传类型 (AVIOCTRLDEFs.FILETransferType_Download/AVIOCTRLDEFs.FILETransferType_Upload) |
p2pCode | int | P2P SDK返回值 |