控制协议
更新日期:2025/5/13
目录
控制协议
KY_SendIOCtrlToChannel
- 功能描述:
- 向设备发送指定Command的数据。
接口定义
- (void)KY_SendIOCtrlWithChannel:(NSInteger)channel
type:(ENUM_AVIOCTRL_MSGTYPE)type
data:(NSData * _Nonnull)data;
参数说明
参数 | 类型 | 说明 |
---|---|---|
channel | int | 设备连线的channel,默认0 |
type | int | command指令类型,AVIOCTRLDEFs.h |
data | array | command对应指令的结构体数据 |
回调说明
暂无
返回码
暂无
代码示例
[self.camera KY_SendIOCtrlWithChannel:0 type:IOTYPE_USER_IPCAM_GET_PLAYBACK_REQ data:data];
协议封装示例
定义协议及结构体
APP发送Command获取灯控开关状态:IOTYPE_GET_LED_REQ = 0x30000001
typedef struct{
unsigned int channel; //当前通道号
unsigned char reserved[4];
}SMsgAVIoctrlGetLedReq;
设备端回复灯控开关状态:IOTYPE_GET_LED_RESP = 0x30000002
typedef struct{
int result; //0:成功, 其他失败
unsigned char isOnOff; // 0:开启; 1:关闭
unsigned char reserved[3];
}SMsgAVIoctrlGetLedResp;
结构体封装与发送
数据接收与解析