IO Command Definition

IO Command


简中-IOCmd

<p>[TOC]</p> <h1>版本记录</h1> <table> <thead> <tr> <th style="text-align: left;">更新日期</th> <th style="text-align: left;">版本号</th> <th style="text-align: left;">更新内容</th> <th style="text-align: left;">作者</th> </tr> </thead> <tbody> <tr> <td style="text-align: left;">2021/3/1</td> <td style="text-align: left;">V2.0.0</td> <td style="text-align: left;">初稿</td> <td style="text-align: left;">Lux</td> </tr> <tr> <td style="text-align: left;">2021/4/9</td> <td style="text-align: left;">V2.0.1</td> <td style="text-align: left;">修改2.38 IOTYPE_USER_IPCAM _DEVICE_SUPPORT_CLOUD _RESP = 0x800D</td> <td style="text-align: left;">Lux</td> </tr> <tr> <td style="text-align: left;">2021/6/29</td> <td style="text-align: left;">V2.0.2</td> <td style="text-align: left;">增加2.42 获取设备人形侦测开关;2.43 设置设备人形侦测开关;2.44 获取设备夜视开关;2.45 设置设备夜视开关;2.46 获取设备夏令时开关;2.47 设置设备夏令时开关;修改2.7 获取设备事件列表</td> <td style="text-align: left;">Lux</td> </tr> <tr> <td style="text-align: left;">2021/11/16</td> <td style="text-align: left;">V2.0.3</td> <td style="text-align: left;">增加2.27 呼叫Client端开始传送Video Frame;2.28 呼叫Client端停止传送Video Frame;2.35 结束通话;2.36 呼叫方发出通话请求;2.37 被呼叫方响应呼叫请求;调整部分编号</td> <td style="text-align: left;">Lux</td> </tr> <tr> <td style="text-align: left;">2022/3/8</td> <td style="text-align: left;">V2.0.4</td> <td style="text-align: left;">增加2.53 获取物联网卡ICCID</td> <td style="text-align: left;">Arthur</td> </tr> <tr> <td style="text-align: left;">2022/4/28</td> <td style="text-align: left;">V2.0.5</td> <td style="text-align: left;">增加2.54 获取设备CertKey及ProfileVer</td> <td style="text-align: left;">Lux</td> </tr> <tr> <td style="text-align: left;">2023/7/11</td> <td style="text-align: left;">V2.0.6</td> <td style="text-align: left;">增加2.55 上传文件 获取通道列表;2.56 下载SD卡事件 获取通道列表;2.57 获取预设语音列表;2.58 播放设备存储的预设语音</td> <td style="text-align: left;">Toco</td> </tr> <tr> <td style="text-align: left;">2024/2/5</td> <td style="text-align: left;">V2.0.7</td> <td style="text-align: left;">增加2.59 获取设备是否支持双向视频;2.60 发起双向视频;</td> <td style="text-align: left;">Steven</td> </tr> <tr> <td style="text-align: left;">2024/4/10</td> <td style="text-align: left;">V2.0.8</td> <td style="text-align: left;">修改2.41 version字段类型为char[64]</td> <td style="text-align: left;">Zed</td> </tr> <tr> <td style="text-align: left;">2024/4/16</td> <td style="text-align: left;">V2.0.9</td> <td style="text-align: left;">增加2.61 获取设备SD卡挂载状态</td> <td style="text-align: left;">Zed</td> </tr> <tr> <td style="text-align: left;">2024/4/30</td> <td style="text-align: left;">V2.0.10</td> <td style="text-align: left;">增加2.62 获取设备对讲状态</td> <td style="text-align: left;">Zed</td> </tr> </tbody> </table> <hr /> <h1>一、IO Command定义</h1> <p>&gt; 注:设备需要依据TUTK提供的IO Command文档进行功能对接。为规范公版Kalay APP IO Command的设定和使用,禁止随意更改公版IO Command已制定的参数和结构体,如因随意更改造成设备无法成功对接公版APP,TUTK无需承担任何责任。同时,为满足客制化项目的需求,将预留部分参数区段以供客制化Command的设定。</p> <h2>1.1 公版和客制化使用的参数区段</h2> <p><img src="https://www.showdoc.com.cn/server/api/attachment/visitfile/sign/732be5894fb27a68ea17d0db01b1c08c" alt="" /></p> <h2>1.2 结构体定义规范及限制</h2> <ul> <li>结构体的数据所占字节数应为4的倍数</li> <li>结构体的数据所占字节数应不超过1024字节</li> </ul> <hr /> <h1>二、结构体及说明</h1> <h2>2.1 呼叫设备开始传送Video Frame</h2> <p><strong>IOTYPE_USER_IPCAM_START = 0x01FF;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device开始发送视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.2 呼叫设备停止传送Video Frame</h2> <p><strong>IOTYPE_USER_IPCAM_STOP = 0x02FF;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device停止发送视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.2.1 呼叫设备开始接收Video Frame</h2> <p><strong>IOTYPE_USER_IPCAM_START_CLIENT = 0x03FF;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device开始接收视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.2.2呼叫设备停止接收Video Frame</h2> <p><strong>IOTYPE_USER_IPCAM_STOP = 0x04FF;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device停止接收视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.3 呼叫设备开始传送Audio Frame</h2> <p><strong>IOTYPE_USER_IPCAM_AUDIOSTART = 0x0300;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device开始发送音频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.4 呼叫设备停止传送Audio Frame</h2> <p><strong>IOTYPE_USER_IPCAM_AUDIOSTOP = 0x0301;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device停止发送音频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.5 设定设备SD卡录像模式</h2> <p><strong>IOTYPE_USER_IPCAM_SETRECORD_REQ = 0x0310;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设置设备SD卡录像模式。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int recordType; // 参考ENUM_RECORD_TYPE unsigned char reserved[4]; }SMsgAVIoctrlSetRecordReq, SMsgAVIoctrlGetRecordResq; typedef enum { AVIOTC_RECORDTYPE_OFF = 0x00; AVIOTC_RECORDTYPE_FULLTIME = 0x01; AVIOTC_RECORDTYPE_ALARM = 0x02; AVIOTC_RECORDTYPE_MANUAL = 0x03; }ENUM_RECORD_TYPE;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SETRECORD_RESP = 0x0311;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知App设置结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { int result; // 0 成功, otherwise: 失败。 unsigned char reserved[4]; }SMsgAVIoctrlSetRecordResp;</code></pre> <h2>2.6 获取设备目前SD卡录像模式</h2> <p><strong>IOTYPE_USER_IPCAM_GETRECORD_REQ = 0x0312;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备SD卡录像模式。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; }SMsgAVIoctrlGetRecordReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETRECORD_RESP = 0x0313;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将录像类型配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int recordType; // 参考ENUM_RECORD_TYPE unsigned char reserved[4]; }SMsgAVIoctrlSetRecordReq, SMsgAVIoctrlGetRecordResq; typedef enum { AVIOTC_RECORDTYPE_OFF = 0x00; AVIOTC_RECORDTYPE_FULLTIME = 0x01; AVIOTC_RECORDTYPE_ALARM = 0x02; AVIOTC_RECORDTYPE_MANUAL = 0x03; }ENUM_RECORD_TYPE;</code></pre> <h2>2.7 获取设备事件列表</h2> <p><strong>IOTYPE_USER_IPCAM_LISTEVENT_REQ = 0x0318;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备事件列表。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index STimeDay stStartTime; // 搜寻事件的起始时间 ... STimeDay stEndTime; // ... 搜寻事件的结束时间 unsigned char event; // 事件类型,参考ENUM_EVENTTYPE unsigned char status; // 0x00: 录像文件存在,事件未读取 // 0x01: 录像文件存在,事件已读取 // 0x02: 无录像文件记录 unsigned char reserved[2]; }SMsgAVIoctrlListEventReq; typedef struct { unsigned short year; // 年份数 unsigned char month; // 自一月以来的月数,范围为1到12。 unsigned char day; // 每月的日期,范围为1到31。 unsigned char wday; // 自星期日以来的天数,范围为0到6。(星期日= 0,星期一= 1,...) unsigned char hour; // 午夜之后的小时数,范围为0到23。 unsigned char minute; // 小时后的分钟数,范围为0到59。 unsigned char second; // 分钟后的秒数,范围为0到59。 }STimeDay;</code></pre> <p><strong>IOTYPE_USER_IPCAM_LISTEVENT_RESP = 0x0319;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将录像列表放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int total; // 搜索的总事件数 unsigned char index; // 数据包索引, 0,1,2... // avSendIOCtrl 一次最多可发送1024 个字节; //总事件可以分为x个包; x是0,1,2 ... unsigned char endflag; // end flag = 1表示此数据包是最后一个数据包,否则有更多的数据包要接收。 unsigned char count; //此封包中有多少个事件。 unsigned char reserved[1]; SAvEvent stEvent[0]; //此封包中所有事件的第一个地址 }SMsgAVIoctrlListEventResp; typedef struct { STimeDay stTime; unsigned char event; // 参考ENUM_EVENTTYPE unsigned char status; // 0x00: 录像文件存在,事件未读取 // 0x01: 录像文件存在,事件已读取 // 0x02: 无录像文件记录 unsigned short duration; // 事件持续时间(以秒为单位) }SAvEvent; typedef enum { AVIOCTRL_EVENT_ALL = 0x00; // 所有事件类型 AVIOCTRL_EVENT_MOTIONDECT = 0x01; // 移动侦测 AVIOCTRL_EVENT_VIDEOLOST = 0x02; // 视频遗失 AVIOCTRL_EVENT_IOALARM = 0x03; // IO报警 AVIOCTRL_EVENT_MOTIONPASS = 0x04; // 移动侦测结束 AVIOCTRL_EVENT_VIDEORESUME = 0x05; // 视频恢复 AVIOCTRL_EVENT_IOALARMPASS = 0x06; // IO报警结束 AVIOCTRL_EVENT_MOVIE = 0x07; // 影片 AVIOCTRL_EVENT_TIME_LAPSE = 0x08; // 延时拍摄 AVIOCTRL_EVENT_EMERGENCY = 0x09; // 紧急事件 AVIOCTRL_EVENT_EXPT_REBOOT = 0x10; // 系统异常重启 AVIOCTRL_EVENT_SDFAULT = 0x11; // SD卡错误 AVIOCTRL_EVENT_FULLTIME_RECORDING = 0x12; // 全时录像 AVIOCTRL_EVENT_PIR = 0x13; // PIR侦测 AVIOCTRL_EVENT_RINGBELL = 0x14; // 门铃呼叫 AVIOCTRL_EVENT_SOUND = 0x15; // 声音 AVIOCTRL_EVENT_HUMANOID_DETECTION = 0x16; // 人形侦测 }ENUM_EVENTTYPE;</code></pre> <h2>2.8 事件回播控制播放</h2> <p><strong>IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_REQ = 0x031A;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要进行录像事件回放。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int command; // 播放记录指, 参考ENUM_PLAYCONTROL. unsigned int Param; // 指令参数,由用户自定义 STimeDay stTimeDay; // 事件列表起始时间 unsigned char endflag; // 0 app, 事件播放完毕; 1 web, 当此事件播放完毕时继续播下一个事件 unsigned char downloadFlag; // 0 回放模式, 1 下载模式 unsigned char reserved[2]; } SMsgAVIoctrlPlayRecordReq; typedef enum { AVIOCTRL_RECORD_PLAY_PAUSE = 0x00; AVIOCTRL_RECORD_PLAY_STOP = 0x01; AVIOCTRL_RECORD_PLAY_STEPFORWARD = 0x02; AVIOCTRL_RECORD_PLAY_STEPBACKWARD = 0x03; AVIOCTRL_RECORD_PLAY_FORWARD = 0x04; AVIOCTRL_RECORD_PLAY_BACKWARD = 0x05; AVIOCTRL_RECORD_PLAY_SEEKTIME = 0x06; AVIOCTRL_RECORD_PLAY_END = 0x07; AVIOCTRL_RECORD_PLAY_START = 0x10; AVIOCTRL_RECORD_PLAY_NEXT = 0xf0; AVIOCTRL_RECORD_PLAY_IFRAME = 0xf1 }ENUM_PLAYCONTROL;</code></pre> <p><strong>IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_RESP = 0x031B;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将录像回放结果放到IOCtrl资料并回传给App.(APP收固定字节长度)</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int command; // 播放记录指令,参考ENUM_PLAYCONTROL unsigned int result; // 取决于指令定义 // 当使用AVIOCTRL_RECORD_PLAY_START: // result&amp;amp;amp;=0 设备未使用实际通道进行播放 // result &amp;lt;0 异常错误 // result= -1 回放异常 // result= -2 超出最大可连接的Client数 unsigned int size; // 事件回放文件大小 unsigned char respond; unsigned char reserved[3]; } SMsgAVIoctrlPlayRecordResp;</code></pre> <h2>2.9 设置设备解析度</h2> <p><strong>IOTYPE_USER_IPCAM_SETSTREAMCTRL_REQ = 0x0320;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设置设备的解析度。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char quality; // 参考ENUM_QUALITY_LEVEL unsigned char reserved[3]; } SMsgAVIoctrlSetStreamCtrlReq; typedef enum { AVIOCTRL_QUALITY_UNKNOWN = 0x00, AVIOCTRL_QUALITY_MAX = 0x01; AVIOCTRL_QUALITY_HIGH = 0x02; AVIOCTRL_QUALITY_MIDDLE = 0x03; AVIOCTRL_QUALITY_LOW = 0x04; AVIOCTRL_QUALITY_MIN = 0x05; }ENUM_QUALITY_LEVEL;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SETSTREAMCTRL_RESP = 0x0321;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP解析度设置结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int result; // 0: 成功; otherwise: 失败 unsigned char reserved[4]; } SMsgAVIoctrlGetStreamCtrlResq;</code></pre> <h2>2.10 获取设备目前解析度</h2> <p><strong>IOTYPE_USER_IPCAM_GETSTREAMCTRL_REQ = 0x0322;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备目前的解析度。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; }SMsgAVIoctrlGetStreamCtrlReq; </code></pre> <p><strong>IOTYPE_USER_IPCAM_GETSTREAMCTRL_RESP = 0x0323;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备解析度配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char quality; //参考ENUM_QUALITY_LEVEL unsigned char reserved[3]; } SMsgAVIoctrlSetStreamCtrlReq, SMsgAVIoctrlGetStreamCtrlResp;</code></pre> <h2>2.11 设置设备位移侦测之灵敏度</h2> <p><strong>IOTYPE_USER_IPCAM_SETMOTIONDETECT_REQ = 0x0324;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设置设备位移侦测的灵敏度。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int sensitivity; // 0 (禁用) ~ 100(最大): // Index in App. Sensitivity value // 0 0(关闭) // 1 25(低) // 2 50(中) // 3 75(高) // 4 100(最高) }SMsgAVIoctrlSetMotionDetectReq, SMsgAVIoctrlGetMotionDetectResp;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SETMOTIONDETECT_RESP = 0x0325;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP位移侦测之灵敏度设置结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { int result; // 0: 成功; otherwise: 失败 unsigned char reserved[4]; }SMsgAVIoctrlSetMotionDetectResp;</code></pre> <h2>2.12 获取设备目前位移侦测之灵敏度</h2> <p><strong>IOTYPE_USER_IPCAM_GETMOTIONDETECT_REQ = 0x0326;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备位移侦测的灵敏度。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlGetMotionDetectReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETMOTIONDETECT_RESP = 0x0327;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备移动侦测灵敏度配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned int sensitivity; // 0(禁用) ~ 100(最大): // index sensitivity value // 0 0(关闭) // 1 25(低) // 2 50(中) // 3 75(高) // 4 100(最高) }SMsgAVIoctrlSetMotionDetectReq, SMsgAVIoctrlGetMotionDetectResp;</code></pre> <h2>2.13 获取目前设备通道数</h2> <p><strong>IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_REQ = 0x0328;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取目前设备频道数。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlGetSupportStreamReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_RESP = 0x0329;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备频道数配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned short index; // 设备使用的stream index unsigned short channel; // AVAPIs使用的channel index char reserved[4]; }SStreamDef; typedef struct { unsigned int number; // 可支持的 stream数量 SStreamDef streams[0]; }SMsgAVIoctrlGetSupportStreamResp;</code></pre> <h2>2.14 获取设备音讯格式</h2> <p>&gt; App传送声音用。</p> <p><strong>IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_REQ = 0x032A;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备音频格式。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // camera index char reserved[4]; }SMsgAVIoctrlGetAudioOutFormatReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_RESP = 0x032B;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备音频格式放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // camera index int format; // 参考ENUM_CODECID in AVFRAMEINFO.h char sample_rate; char bitdata; char channels; // 可支持的通道数量 char avservchannel; // 0 子通道;1 主通道;otherwise 子通道(默认0) }SMsgAVIoctrlGetAudioOutFormatResp; Sample_Rate: AUDIO_SAMPLE_8K = 0; AUDIO_SAMPLE_11K = 1; AUDIO_SAMPLE_12K = 2; AUDIO_SAMPLE_16K = 3; AUDIO_SAMPLE_22K = 4; AUDIO_SAMPLE_24K = 5; AUDIO_SAMPLE_32K = 6; AUDIO_SAMPLE_44K = 7; AUDIO_SAMPLE_48K = 8; CodecId: MEDIA_CODEC_UNKNOWN = 0x00; MEDIA_CODEC_VIDEO_MPEG4 = 0x4C; // 76 MEDIA_CODEC_VIDEO_H263 = 0x4D; // 77 MEDIA_CODEC_VIDEO_H264 = 0x4E; // 78 MEDIA_CODEC_VIDEO_MJPEG = 0x4F; // 79 MEDIA_CODEC_VIDEO_HEVC = 0x50; // 80 MEDIA_CODEC_AUDIO_AAC_RAW = 0x86; // 134 MEDIA_CODEC_AUDIO_AAC_ADTS = 0x87; // 135 MEDIA_CODEC_AUDIO_AAC_LATM = 0x88; // 136 MEDIA_CODEC_AUDIO_G711U = 0x89; // 137 MEDIA_CODEC_AUDIO_G711A = 0x8A; // 138 MEDIA_CODEC_AUDIO_ADPCM = 0x8B; // 139 MEDIA_CODEC_AUDIO_PCM = 0x8C; // 140 MEDIA_CODEC_AUDIO_SPEEX = 0x8D; // 141 MEDIA_CODEC_AUDIO_MP3 = 0x8E; // 142 MEDIA_CODEC_AUDIO_G726 = 0x8F; // 143 Bitdata (0x0 ~ 0xF): AUDIO_DATABITS_8 = 0; AUDIO_DATABITS_16 = 1;</code></pre> <h2>2.15 获取设备信息</h2> <p>&gt; 建议改为使用0x8015/0x8016</p> <p><strong>IOTYPE_USER_IPCAM_DEVINFO_REQ = 0x0330;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备资讯。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlDeviceInfoReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVINFO_RESP = 0x0331;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备资讯放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char model[16]; unsigned char vendor[16]; unsigned int version; unsigned int channel; // 保留 unsigned int total; // MBytes, sdcard的全部空间 unsigned int free; // MBytes , sdcard的可用空间 unsigned int company; // 参考OTA 上的公司名 unsigned char reserved[4]; }SMsgAVIoctrlDeviceInfoResp;</code></pre> <h2>2.16 变更设备密码</h2> <p><strong>IOTYPE_USER_IPCAM_SETPASSWORD_REQ = 0x0332;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要变更设备密码。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { char oldpasswd[32]; // 旧密码 char newpasswd[32]; // 新密码 }SMsgAVIoctrlSetPasswdReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SETPASSWORD_RESP = 0x0333;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP变更设备密码的结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { int result; //0x00 密码设置成功, 否则失败 unsigned char reserved[4]; }SMsgAVIoctrlSetPasswdResp;</code></pre> <h2>2.17 事件回放进度控制</h2> <p><strong>IOTYPE_USER_IPCAM_GET_PLAYBACK_REQ = 0x033A;</strong></p> <ul> <li>由App发往Device。</li> <li>App告知Device获取事件时长信息。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index STimeDay stTimeDay; // 事件的时间长度 unsigned char reserved[4]; }SMsgAVIoctrlGetPlaybackReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_PLAYBACK_RESP = 0x033B;</strong> &gt; 注:视频流的时间戳必须在回传的时间段内, 时间戳为UTC格式。</p> <ul> <li>由Device发往App;</li> <li>Device时长信息回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int videoTime; // 事件视频时间(以秒为单位) unsigned long size; // 事件大小(以字节为单位) unsigned char reserved[4]; }SMsgAVIoctrlGetPlaybackResp;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SET_RECORD_PROGRESS_REQ = 0x033C;</strong> &gt; 注: App不会停掉视频流(不会发送0x2ff)。</p> <ul> <li>由App 发往Device。</li> <li>App告知Device从指定时间播放。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index STimeDay stTimeDay; // 事件的时间长度 unsigned int progressTime; // 事件进度时间(以秒为单位) unsigned char reserved[4]; }SMsgAVIoctrlSetRecordProgessReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SET_RECORD_PROGRESS_RESP = 0x033D;</strong></p> <ul> <li>由Device发往App。</li> <li>Device将设备进度结果回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char result; //0 表示成功 unsigned char reserved[3]; }SMsgAVIoctrlSeRecordProgressResp;</code></pre> <h2>2.18 获取设备周围Wifi列表</h2> <p><strong>IOTYPE_USER_IPCAM_LISTWIFIAP_REQ = 0x0340;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备周围的wifi列表。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlListWifiApReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_LISTWIFIAP_RESP = 0x0341;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备周围的wifi列表放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int number; // 最大: 1024/36=28 SWifiAp stWifiAp[0]; // 存储所有WiFi信息的起始地 // 使用(SWifiAp)字节的大小来获取WiFi数据。 }SMsgAVIoctrlListWifiApResp; typedef struct { char ssid[32]; // WiFi SSID char mode; // 参考 ENUM_AP_MODE char enctype; // 加密为WiFi,请参考ENUM_AP_ENCTYPE。 char signal; // 信号强度,范围为0%至100%。 char status; // 0 : 无效的ssid或已断开连接 // 1 : 连接默认网关 // 2 : 密码不匹配 // 3 : 弱信号且已连接 // 4 : 所选密码匹配且已断开连接或已连接,但不是默认网关 }SWifiAp; typedef enum { AVIOTC_WIFIAPMODE_NULL = 0x00; AVIOTC_WIFIAPMODE_MANAGED = 0x01; AVIOTC_WIFIAPMODE_ADHOC = 0x02; }ENUM_AP_MODE; typedef enum { AVIOTC_WIFIAPENC_INVALID = 0x00; AVIOTC_WIFIAPENC_NONE = 0x01; AVIOTC_WIFIAPENC_WEP = 0x02; // WEP,无密码 AVIOTC_WIFIAPENC_WPA_TKIP = 0x03; AVIOTC_WIFIAPENC_WPA_AES = 0x04; AVIOTC_WIFIAPENC_WPA2_TKIP = 0x05; AVIOTC_WIFIAPENC_WPA2_AES = 0x06; AVIOTC_WIFIAPENC_WPA_PSK_TKIP = 0x07; AVIOTC_WIFIAPENC_WPA_PSK_AES = 0x08; AVIOTC_WIFIAPENC_WPA2_PSK_TKIP = 0x09; AVIOTC_WIFIAPENC_WPA2_PSK_AES = 0x0A; }ENUM_AP_ENCTYPE;</code></pre> <h2>2.19 设定设备的Wifi网络</h2> <p><strong>IOTYPE_USER_IPCAM_SETWIFI_REQ = 0x0342;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设置设备的wifi。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char ssid[32]; // 连接的WiFi SSID unsigned char password[32]; // WiFi SSID 密码 unsigned char mode; // 参考ENUM_AP_MODE unsigned char enctype; // 参考ENUM_AP_ENCTYPE unsigned char reserved[10]; }SMsgAVIoctrlSetWifiReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SETWIFI_RESP = 0x0343;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP设置设备wifi的结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { int result; //如果已连接WiFi,则返回0,否则返回1。 unsigned char reserved[4]; }SMsgAVIoctrlSetWifiResp;</code></pre> <h2>2.20 获取设备目前所设置的WiFi</h2> <p><strong>IOTYPE_USER_IPCAM_GETWIFI_REQ = 0x0344;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要获取设备目前所设置的wifi。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlGetWifiReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETWIFI_RESP = 0x0345;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备当前wifi配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char ssid[32]; // WiFi ssid unsigned char password[32]; // WiFi密码(如果不为空) unsigned char mode; // 参考 ENUM_AP_MODE unsigned char enctype; // 参考ENUM_AP_ENCTYPE unsigned char signal; // 信号强度 0--100% unsigned char status; // 参考SWifiAp的 &amp;quot;status&amp;quot; }SMsgAVIoctrlGetWifiResp;</code></pre> <h2>2.21 设定设备目前所设置的WiFi</h2> <p>&gt; 该command支持64bit密码,同IOTYPE_USER_IPCAM_SETWIFI_REQ = 0x0342一起发送。</p> <p><strong>IOTYPE_USER_IPCAM_SETWIFI_REQ2 = 0x0346;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设定设备目前所设置的wifi。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char ssid[32]; // 连接的WiFi SSID unsigned char password[64]; // WiFi SSID密码 unsigned char mode; // 参考ENUM_AP_MODE unsigned char enctype; // 参考ENUM_AP_ENCTYPE unsigned char reserved[10]; }SMsgAVIoctrlSetWifiReq2;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GETWIFI_RESP2 = 0x0347;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device将设备当前wifi配置放到IOCtrl资料并回传给App。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char ssid[32]; // WiFi ssid unsigned char password[64]; // WiFi密码(如果不为空) unsigned char mode; // 参考 ENUM_AP_MODE unsigned char enctype; // 参考ENUM_AP_ENCTYPE unsigned char signal; // 信号强度 0--100% unsigned char status; // 参考SWifiAp的 &amp;quot;status&amp;quot; }SMsgAVIoctrlGetWifiResp2;</code></pre> <h2>2.22 呼叫设备开始接收Audio Frame</h2> <p><strong>IOTYPE_USER_IPCAM_SPEAKERSTART = 0x0350;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device开始接收音频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.23 呼叫设备停止接收Audio Frame</h2> <p><strong>IOTYPE_USER_IPCAM_SPEAKERSTOP = 0x0351;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device停止接收音频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.24 设置画面镜像/翻转状态</h2> <p><strong>IOTYPE_USER_IPCAM_SET_VIDEOMODE_REQ = 0x0370;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device进行镜像/翻转设置。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char mode; // 参考 ENUM_VIDEO_MODE unsigned char reserved[3]; }SMsgAVIoctrlSetVideoModeReq; typedef enum { AVIOCTRL_VIDEOMODE_NORMAL = 0x00; AVIOCTRL_VIDEOMODE_FLIP = 0x01; // 垂直翻转 AVIOCTRL_VIDEOMODE_MIRROR = 0x02; // 水平翻转 AVIOCTRL_VIDEOMODE_FLIP_MIRROR = 0x03; // 垂直和水平翻转 }ENUM_VIDEO_MODE;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SET_VIDEOMODE_RESP = 0x0371;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP设置结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char result; // 0: 成功; otherwise:失败 unsigned char reserved[3]; }SMsgAVIoctrlSetVideoModeResp;</code></pre> <h2>2.25 获取画面镜像/翻转设置状态</h2> <p><strong>IOTYPE_USER_IPCAM_GET_VIDEOMODE_REQ = 0x0372;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device获取镜像/翻转设置状态。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; }SMsgAVIoctrlGetVideoModeReq; </code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_VIDEOMODE_RESP = 0x0373;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP目前画面镜像/翻转的设置状态。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // Camera Index unsigned char mode; // 参考 ENUM_VIDEO_MODE unsigned char reserved[3]; }SMsgAVIoctrlGetVideoModeResp; typedef enum { AVIOCTRL_VIDEOMODE_NORMAL = 0x00, AVIOCTRL_VIDEOMODE_FLIP = 0x01, // 垂直翻转 AVIOCTRL_VIDEOMODE_MIRROR = 0x02, // 水平翻转 AVIOCTRL_VIDEOMODE_FLIP_MIRROR = 0x03, // 垂直和水平翻转 }ENUM_VIDEO_MODE;</code></pre> <h2>2.26 格式化SD卡</h2> <p><strong>IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_REQ = 0x0380;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device执行格式化SD卡操作。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int storage; // Storage index(例如sdcard插槽= 0,内部闪存= 1,...) unsigned char reserved[4]; }SMsgAVIoctrlFormatExtStorageReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_RESP = 0x0381;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP已格式化SD卡结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int storage; // Storage index char result; // 0: 成功; // -1:不支持格式化指令 // otherwise: 失败 unsigned char reserved[3]; }SMsgAVIoctrlFormatExtStorageResp;</code></pre> <h2>2.27 呼叫Client端开始传送Video Frame</h2> <p>&gt; 主要应用于双向视频通话场景。</p> <p><strong>IOTYPE_USER_IPCAM_START_CLIENT = 0x03FF;</strong></p> <ul> <li>由APP发往Client;</li> <li>APP告知Client开始发送视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.28 呼叫Client端停止传送Video Frame</h2> <p>&gt; 主要应用于双向视频通话场景。</p> <p><strong>IOTYPE_USER_IPCAM_STOP_CLIENT = 0x04FF;</strong></p> <ul> <li>由APP发往Client;</li> <li>APP告知Client停止发送视频数据。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlAVStream;</code></pre> <h2>2.29 获取NVR设备Channel接口数量</h2> <p><strong>IOTYPE_USER_IPCAM_GET_NVR_CHANNEL_NUMBER_REQ = 0x5A4;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device获取设备Channel的接口数量。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlGetNVRChannelNumberReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_NVR_CHANNEL_NUMBER_RESP = 0x5A5;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP目前设备Channel的接口数量。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int number; // 设备的通道数量 unsigned char reserved[4]; }SMsgAVIoctrlGetNVRChannelNumberResp;</code></pre> <h2>2.30 获取通道名称</h2> <p><strong>IOTYPE_USER_IPCAM_GET_CHANNEL_NAME_REQ = 0x5B0;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device获取设备的通道名称。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[4]; }SMsgAVIoctrlGetChannelNameReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_CHANNEL_NAME_RESP = 0x5B1;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP设备的通道名称。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char count; // 通道数量 unsigned char reserved[3]; SChannelInfo sChannelInfo[0]; // 第一个channelInfo和channelInfo的总数 }SMsgAVIoctrlGetChannelNameResp; typedef struct { unsigned int channel; // camera index unsigned char name[24]; // 通道名称 } SChannelInfo;</code></pre> <h2>2.31 设置通道名称</h2> <p><strong>IOTYPE_USER_IPCAM_SET_CHANNEL_NAME_REQ = 0x5B2;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要设置设备的通道名称。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char count; // SChannelInfos的数量 unsigned char reserved[3]; SChannelInfo sChannelInfo[0]; // 第一个channelInfo和channelInfo的总数 }SMsgAVIoctrlSetChannelNameReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SET_CHANNEL_NAME_RESP = 0x5B3;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP设置设备通道名称的结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char result; // 0 成功, 其他失败 unsigned char reserved[3]; }SMsgAVIoctrlSetResetResp;</code></pre> <h2>2.32 门铃呼叫</h2> <p>&gt; 主要应用于可视门铃通话场景。</p> <p><strong>IOTYPE_XM_CALL_REQ = 0x700;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP有用户呼叫。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char index; // 门索引号,0:门1; 1:门2 STimeDay stTime; // 事件时间 unsigned char reserved[3]; } SMsgAVIoctrlCallReq</code></pre> <p><strong>IOTYPE_XM_CALL_RESP = 0x701;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device是否进行接听。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char index; // 门索引号,0:门1;1: 门2 int nAnswered; // 0:挂断;1:接听 unsigned char reserved[3]; }SMsgAVIoctrlCallResp;</code></pre> <p><strong>IOTYPE_XM_CALL_IND = 0x702;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP是否有其他用户接听。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char index; // 门索引号,0:门1;1:门2 unsigned char type; // 类型,0:有用户呼叫;1:有其他用户应答 STimeDay stTime; // 事件时间 unsigned char reserved[3]; }SMsgAVIoctrlCallInd;</code></pre> <h2>2.33 发送设备名称给设备</h2> <p><strong>IOTYPE_USER_IPCAM_PUSH_DEVICENAME_REQ= 0x0736;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device要当前设备名称。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel ; // camera index char devicename[150]; // 当前设备名称 }SMsgAVIoctrlPushDeviceNameReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_PUSH_DEVICENAME_RESP= 0x0737;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP要当前设备名称更新结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { int res ; // 0:成功,其他失败 char reserved[4]; }SMsgAVIoctrlPushDeviceNameResp;</code></pre> <h2>2.34 同步手机时间给设备</h2> <p><strong>IOTYPE_USER_IPCAM_SET_TIME_SYNC_REQ = 0x0816;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device进行同步手机时间。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned short year; unsigned char month; unsigned char day; unsigned char hour; unsigned char minute; unsigned char second; unsigned char nIsSupportSync; // 1 支持; 0 不支持 int nGMTOffset; // GMT之间的偏移量(以秒为单位) } SMsgAVIoctrlTimeSyncReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SET_TIME_SYNC_RESP = 0x0817;</strong></p> <ul> <li>由Device发往APP;</li> <li>Device告知APP同步时间的结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int result; // 如果成功则返回0,否则失败 unsigned char reserved[4]; } SMsgAVIoctrlTimeSyncResp;</code></pre> <h2>2.35 结束通话</h2> <p>&gt; 主要应用于双向视频通话场景。</p> <p><strong>IOTYPE_USER_IPCAM_CALL_END = 0x0900;</strong></p> <ul> <li>由APP发往另一端;</li> <li>APP告知对方结束此通话。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char myID[6]; // 我的 ID unsigned char reserved[2]; }SMsgAVIoctrlCallEnd;</code></pre> <h2>2.36 呼叫方发出通话请求</h2> <p>&gt; 主要应用于双向视频通话场景。</p> <p><strong>IOTYPE_USER_IPCAM_CALL_REQ = 0x0901;</strong></p> <ul> <li>由呼叫方发往被呼叫方;</li> <li>呼叫方向被呼叫方发起通话请求。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char myID[6]; // 我的 ID unsigned char myUID[20]; // 我的 UID unsigned char callType; // 0,单向视频; 1, 双向视频 unsigned char beInvited; // 0 表示邀请;1 表示被邀请 unsigned char infoCount; // 其他参与者的数量 unsigned char reserved[3]; unsigned AccountInfo info // 其他参与者的信息 }SMsgAVIoctrlCallReq; typedef struct{ unsigned char UID[20]; // UID unsigned char myID[6]; // ID unsigned char reserved[2]; }AccountInfo</code></pre> <h2>2.37 被呼叫方响应呼叫请求</h2> <p>&gt; 主要应用于双向视频通话场景。</p> <p><strong>IOTYPE_USER_IPCAM_CALL_RESP = 0x0902;</strong></p> <ul> <li>由被呼叫方发往呼叫方;</li> <li>被呼叫方响应呼叫方发起的通话请求。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char answer; // 0, 拒绝; 1 接听 unsigned char myID[6]; // myID unsigned char reserved[1]; }SMsgAVIoctrlCallResp;</code></pre> <h2>2.38 云台控制</h2> <p><strong>IOTYPE_USER_IPCAM_PTZ_COMMAND = 0x1001;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device进行云台控制。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char control; // 云台控制指令,参考 ENUM_PTZCMD. unsigned char speed; // 云台转动的速度 unsigned char point; // app未使用 unsigned char limit; // app未使用 unsigned char aux; // app未使用 unsigned char channel; // camera index unsigned char reserve[2]; } SMsgAVIoctrlPtzCmd; /* AVIOCTRL PTZ Command 值 */ typedef enum { AVIOCTRL_PTZ_STOP = 0; AVIOCTRL_PTZ_UP = 1; AVIOCTRL_PTZ_DOWN = 2; AVIOCTRL_PTZ_LEFT = 3; AVIOCTRL_PTZ_LEFT_UP = 4; AVIOCTRL_PTZ_LEFT_DOWN = 5; AVIOCTRL_PTZ_RIGHT = 6; AVIOCTRL_PTZ_RIGHT_UP = 7; AVIOCTRL_PTZ_RIGHT_DOWN = 8; AVIOCTRL_PTZ_AUTO = 9; AVIOCTRL_PTZ_SET_POINT = 10; AVIOCTRL_PTZ_CLEAR_POINT = 11; AVIOCTRL_PTZ_GOTO_POINT = 12; AVIOCTRL_PTZ_SET_MODE_START = 13; AVIOCTRL_PTZ_SET_MODE_STOP = 14; AVIOCTRL_PTZ_MODE_RUN = 15; AVIOCTRL_PTZ_MENU_OPEN = 16; AVIOCTRL_PTZ_MENU_EXIT = 17; AVIOCTRL_PTZ_MENU_ENTER = 18; AVIOCTRL_PTZ_FLIP = 19; AVIOCTRL_PTZ_START = 20; AVIOCTRL_LENS_APERTURE_OPEN = 21; AVIOCTRL_LENS_APERTURE_CLOSE = 22; AVIOCTRL_LENS_ZOOM_IN = 23; AVIOCTRL_LENS_ZOOM_OUT = 24; AVIOCTRL_LENS_FOCAL_NEAR = 25; AVIOCTRL_LENS_FOCAL_FAR = 26; AVIOCTRL_AUTO_PAN_SPEED = 27; AVIOCTRL_AUTO_PAN_LIMIT = 28; AVIOCTRL_AUTO_PAN_START = 29; AVIOCTRL_PATTERN_START = 30; AVIOCTRL_PATTERN_STOP = 31; AVIOCTRL_PATTERN_RUN = 32; AVIOCTRL_SET_AUX = 33; AVIOCTRL_CLEAR_AUX = 34; AVIOCTRL_MOTOR_RESET_POSITION = 35; }ENUM_PTZCMD;</code></pre> <h2>2.39 APP获取第一张I帧图片</h2> <p><strong>IOTYPE_USER_IPCAM_RECEIVE_FIRST_IFRAME = 0x1002;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device接收到第一张I帧图片。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int channel; // camera index char reserved[4]; }SMsgAVIoctrlReceiveFirstIFrame;</code></pre> <h2>2.40 设备进行OTA升级</h2> <p><strong>IOTYPE_USER_IPCAM_OTA_REQ = 0x8001;</strong></p> <ul> <li>由APP发往Device;</li> <li>APP告知Device开始进行OTA升级。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char file_checksum[32]; // MD5校验码 unsigned char url[256]; // 下载固件url链接 unsigned int file_size; // 固件包大小 unsigned char reserved[4]; }SMsgAVIoctrlOTAReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_OTA_RESP = 0x8002;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App升级OTA结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int progress; // 下载固件进度 unsigned int endflag; // 1:下载完成;0:下载中 unsigned char reserved[8]; }SMsgAVIoctrlOTAResp;</code></pre> <h2>2.41 获取设备信息</h2> <p>&gt; 注:新设备需对接OTA功能时建议使用,与旧cmd IOTYPE_USER_IPCAM_DEVINFO_REQ = 0x0330同作用。</p> <p><strong>IOTYPE_USER_IPCAM_DEVICE_INFO_REQ = 0x8015;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device要获取设备资讯。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[8]; } SMsgAVIoctrlDeviceInfoReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_INFO_RESP = 0x8016;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备资讯。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char model[32]; // 产品型号 unsigned char product[32]; // 产品名 unsigned char vender[32]; // 制造商(需与KOTA服务器上的厂商一致) unsigned char version[64]; // 当前版本号 unsigned int free; // SD卡剩余空间 unsigned int total; // SD卡总空间 unsigned char region; // 获取设备所在位置,0:中国大陆区;1:非中国大陆区 unsigned char reserved[3]; } SMsgAVIoctrlDeviceInfoResp;</code></pre> <p>&gt; 注:以上参数用于拼接向KOTA服务器获取升级文件的下载地址请求,故需与在KOTA服务器上创建的vender,product,model等信息保持一致,且注意区分设备所在区域。</p> <h2>2.42 获取设备是否支持OTA升级</h2> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_OTA_REQ = 0x800A;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device要获取设备是否支持OTA。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[8]; }SMsgAVIoctrlDeviceSupportOTAReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_OTA _RESP = 0x800B;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备是否支持OTA。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char isSupport; // 0 不支持;1 支持 unsigned char reserved[4]; } SMsgAVIoctrlDeviceSupportOTAResp;</code></pre> <h2>2.43 获取设备是否支持云存储</h2> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_CLOUD_REQ = 0x800C;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device查询是否支持云存储。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned char reserved[8]; }SMsgAVIoctrlDeviceSupportCloudReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_CLOUD _RESP = 0x800D;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备是否支持云存储结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c"> typedef struct { unsigned int result; // 0 不支持;1 支持 unsigned char reserved[4]; } SMsgAVIoctrlDeviceSupportCloudResp;</code></pre> <h2>2.44 设置设备云存储录像状态</h2> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SET_CLOUD_REQ = 0x8010;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device开启或关闭云存储录像功能。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // camera index unsigned int isOn; // 1 开启, 0 关闭 }SMsgAVIoctrlSetCloudReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SET_CLOUD_RESP = 0x8011;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App开启或关闭云存储录像结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // camera index unsigned int result; // 0 成功, 1 失败 }SMsgAVIoctrlSetCloudResp;</code></pre> <h2>2.45 获取设备云存储录像状态</h2> <p><strong>IOTYPE_USER_IPCAM_DEVICE_GET_CLOUD_REQ = 0x8012;</strong></p> <ul> <li>由App发往Device</li> <li>App获取Device云存储录像状态。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // camera index unsigned char reserved[4]; }SMsgAVIoctrlGetCloudReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_GET_CLOUD_RESP = 0x8013;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App云存储录像状态。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // camera index unsigned int isOn; // 1 开启, 0 关闭 }SMsgAVIoctrlGetCloudResp;</code></pre> <h2>2.46 获取有SD卡事件的日期</h2> <p><strong>IOTYPE_USER_IPCAM_GET_EVENT_DATE_REQ = 0x9000;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device获取有SD卡事件的日期。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // Camera Index unsigned int eventType; // 查询的事件类型,0:全部,1:移动侦测;2:全时录像,默认是0 STimeDay stStartTime; // 开始时间 STimeDay stEndTime; // 结束时间 unsigned char reserved[8]; } SMsgAVIoctrlGetEventDateReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_EVENT_DATE_RESP = 0x9001;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App有SD卡事件的日期结果。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int count; // 事件的日期数量 unsigned char reserved[4]; EventDate eventDate[1]; // 事件的日期 } SMsgAVIoctrlGetEventDateResp; typedef struct { char date[8]; // 事件的日期,例如:20200210,后面依次还有count-1个date[8] } EventDate;</code></pre> <h2>2.47 获取设备人形侦测开关</h2> <p><strong>IOTYPE_USER_IPCAM_GET_HUMANDETECTION_REQ = 0x9002;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device查询人形侦测开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char reserved[4]; } SMsgAVIoctrlGetHumanDetectionReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_GET_HUMANDETECTION_RESP = 0x9003;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App人形侦测开关查询结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 1:开启; 其他:关闭 unsigned char reserved[4]; } SMsgAVIoctrlGetHumanDetectionResp;</code></pre> <p> </p> <h2>2.48 设置设备人形侦测开关</h2> <p><strong>IOTYPE_USER_IPCAM_SET_HUMANDETECTION_REQ = 0x9004;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device设置人形侦测开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int isOn; // 1:开启;0 :关闭 unsigned char reserved[4]; } SMsgAVIoctrlSetHumanDetectionReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_SET_HUMANDETECTION_RESP = 0x9005;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App人形侦测开关设置结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 0:成功;其他:失败 unsigned char reserved[4]; } SMsgAVIoctrlSetHumanDetectionResp;</code></pre> <p> </p> <h2>2.49 获取设备夜视开关</h2> <p><strong>IOTYPE_USER_IPCAM_GET_NIGHTVISION_REQ = 0x9006;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device查询夜视开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char reserved[4]; } SMsgAVIoctrlGetNightVisionReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_GET_NIGHTVISION_RESP = 0x9007;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App夜视开关查询结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 1:开启;其他:关闭 unsigned char reserved[4]; } SMsgAVIoctrlGetNightVisionResp;</code></pre> <p> </p> <h2>2.50 设置设备夜视开关</h2> <p><strong>IOTYPE_USER_IPCAM_SET_NIGHTVISION_REQ = 0x9008;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device设置夜视开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int isOn; // 1:开启;0:关闭 unsigned char reserved[4]; } SMsgAVIoctrlSetNightVisionReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_SET_NIGHTVISION_RESP = 0x9009;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App夜视开关设置结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 0:成功;其他:失败 unsigned char reserved[4]; } SMsgAVIoctrlSetNightVisionResp;</code></pre> <p> </p> <h2>2.51 获取设备夏令时开关</h2> <p><strong>IOTYPE_USER_IPCAM_GET_SUMMERTIME_REQ = 0x9010;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device查询夏令时开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char reserved[4]; } SMsgAVIoctrlGetSummerTimeReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_GET_SUMMERTIME_RESP = 0x9011;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App夏令时开关查询结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 1:开启;其他:关闭 unsigned char reserved[4]; } SMsgAVIoctrlGetSummerTimeResp;</code></pre> <p> </p> <h2>2.52 设置设备夏令时开关</h2> <p><strong>IOTYPE_USER_IPCAM_SET_SUMMERTIME_REQ = 0x9012;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device设置夏令时开关</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int isOn; // 1:开启; 0:关闭 unsigned char reserved[4]; } SMsgAVIoctrlSetSummerTimeReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_SET_SUMMERTIME_RESP = 0x9013;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App夏令时开关设置结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // 0:成功;其他:失败 unsigned char reserved[4]; } SMsgAVIoctrlSetSummerTimeResp;</code></pre> <h2>2.53 获取物联网卡ICCID</h2> <p><strong>IOTYPE_USER_IPCAM_GET_CARD_ICCID_REQ = 0x30000004;</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device获取物联网卡</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int channel; // Camera channel unsigned char reserved[4]; }SMsgAVIoctrlGetCardICCIDReq;</code></pre> <p>  <strong>IOTYPE_USER_IPCAM_GET_CARD_ICCID_RESP = 0x30000005;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App获取物联网卡结果</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned int result; // return 0 if success, otherwise failed unsigned char ICCID[40]; unsigned char reserved[4]; }SMsgAVIoctrlGetCardICCIDResp;</code></pre> <h2>2.54 获取设备CertKey及ProfileVer</h2> <p><strong>IOTYPE_USER_IPCAM_GET_PROFILE_REQ = 0x9014</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device需要获取certKey、profileVer</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char reserved[8]; }SMsgAVIoctrlGetProfileReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_PROFILE_RESP = 0x9015;</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备的certKey、profileVer</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char certKey[40];   unsigned char profileVer[20];  // profile version unsigned char reserved[8]; } SMsgAVIoctrlGetProfileResp;</code></pre> <h2>2.55 获取上传文件的通道列表</h2> <p><strong>IOTYPE_USER_IPCAM_UPLOAD_FILE_REQ = 0x9027</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device需要获取上传文件的通道列表</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { unsigned char fileName[64]; // 文件名称 }Fileinfo; typedef struct { int functionalType; // 功能类型: 1.预设语音 2.其他功能类型 int count; // 需要上传文件的总数 Fileinfo Filename[10]; // 上传文件名集合 } SMsgAVIoctrlFileUploadReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_UPLOAD_FILE_RESP = 0x9028</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备的可上传类型、可上传的连接通道</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">SMsgAVIoctrlEventFileDownReq // AVIOCTRL TKTransferType typedef enum { TKTransferType_AVAPI = 0, // AVAPI 上传类型 TKTransferType_RDT = 1, // RDT 上传类型 }ENUM_TKTransferType; typedef struct { unsigned int channel; // 通道 id }ChannelInfo; typedef struct { unsigned int type; // TKTransferType 上传类型 int count; // 通道集合的总数(最多10个) ; -1 表示失败 ChannelInfo channel[10]; } SMsgAVIoctrlFileUploadResp;</code></pre> <h2>2.56 获取下载SD卡事件的通道列表</h2> <p><strong>IOTYPE_USER_IPCAM_EVENT_DOWNLOAD_FILE_REQ = 0x9029</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device需要获取下载SD卡事件的通道列表</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { int count; // 需要下载事件的个数 STimeDay sTimeDayList [10]; // 需要下载SD卡事件的时间集合(每次最多10个) }SMsgAVIoctrlEventFileDownReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_EVENT_DOWNLOAD_FILE_RESP = 0x902A</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备的下载类型、可下载的连接通道</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">SMsgAVIoctrlEventFileDownReq // AVIOCTRL TKTransferType typedef enum { TKTransferType_AVAPI = 0, // AVAPI下载类型 TKTransferType_RDT = 1, // RDT下载类型 }ENUM_TKTransferType; typedef struct { unsigned int channel; // 通道 id }ChannelInfo; typedef struct { unsigned int type; // TKTransferType 下载类型 int count; // 通道集合的总数(最多10个) ; -1 表示失败 ChannelInfo channel[10]; } SMsgAVIoctrlEventFileDownResp;</code></pre> <h2>2.57 获取预设语音列表</h2> <p><strong>IOTYPE_USER_IPCAM_GET_VOICE_FILELIST_REQ = 0x902B</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device需要获取预设语音文件名称列表</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { int channel; // 通道号 }SMsgAVIoctrlGetVoiceFileReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_GET_VOICE_FILELIST_RESP = 0x902C</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备的预设语音列表</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { int isPresetSpeech; // 是否预设语音,1:当前预设语音,0:当前不是预设语音 char fileName[64]; //文件名称 }PresetSpeechInfo; typedef struct { int count; // 文件名称总数 (最多10个); -1 表示失败 PresetSpeechInfo presetSpeechInfo [10]; } SMsgAVIoctrlGetVoiceFileResp;</code></pre> <h2>2.58 播放设备存储的预设语音</h2> <p><strong>IOTYPE_USER_IPCAM_PLAY_VOICE_REQ = 0x902D</strong></p> <ul> <li>由App发往Device</li> <li>App告知Device 开始播放</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { int channel; //通道号 }SMsgAVIoctrlPlayVoiceReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_PLAY_VOICE_RESP = 0x902E</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备的预设语音列表</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct { int result; // 1 成功播放,其他返回播放失败 } SMsgAVIoctrlPlayVoiceResp;</code></pre> <h2>2.59 获取设备是否支持双向视频</h2> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_DOUBLEVIDEO_REQ = 0x9030</strong></p> <ul> <li>由App发往Device</li> <li>App发送请求获取设备是否支持双向视频</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char reserved[8]; }SMsgAVIoctrlDeviceSupportDoubleVideoReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DEVICE_SUPPORT_DOUBLEVIDEO_RESP = 0x9031</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备是否支持双向视频</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char isSupport; //0 不支持,1支持     unsigned char reserved[3]; } SMsgAVIoctrlDeviceSupportDoubleVideoResp;</code></pre> <h2>2.60 发起双向视频</h2> <p><strong>IOTYPE_USER_IPCAM_DOUBLEVIDEOCALL_REQ = 0x9032</strong></p> <ul> <li>由呼叫方发往被呼叫方;</li> <li>呼叫方向被呼叫方发起通话请求。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char reserved[8]; }SMsgAVIoctrlDoubleVideoCallReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_DOUBLEVIDEOCALL_RESP = 0x9033</strong></p> <ul> <li>由被呼叫方发往呼叫方;</li> <li>被呼叫方响应呼叫方发起的通话请求。</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char answer; //0 拒绝,1 接听     unsigned char reserved[3]; } SMsgAVIoctrlDoubleVideoCallResp;</code></pre> <h2>2.61 获取SD卡挂载状态</h2> <p><strong>IOTYPE_USER_IPCAM_SDINFO_REQ = 0x9034</strong></p> <ul> <li>由App发往Device</li> <li>App发送请求获取设备SD卡挂载状态</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char reserved[8]; }SMsgAVIoctrlSdInfoReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SDINFO_RESP = 0x9035</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备SD卡挂载状态</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char state; //0 sd卡异常,1 未插卡,2已插卡     unsigned char reserved[3]; } SMsgAVIoctrlSdInfoResp;</code></pre> <h2>2.62 获取设备当前对讲状态</h2> <p><strong>IOTYPE_USER_IPCAM_SPEAK_STATE_REQ = 0x9036</strong></p> <ul> <li>由App发往Device</li> <li>App发送请求获取设备当前对讲状态</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char reserved[8]; }SMsgAVIoctrlSpeakStateReq;</code></pre> <p><strong>IOTYPE_USER_IPCAM_SPEAK_STATE_RESP = 0x9037</strong></p> <ul> <li>由Device发往App</li> <li>Device告知App设备当前对讲状态</li> <li>IOCtrl数据:</li> </ul> <pre><code class="language-c">typedef struct {     unsigned char state; //0 未占用(允许app进行对讲),1 被占用(不允许app进行对讲),2 不支持(设备没有对讲功能)     unsigned char reserved[3]; } SMsgAVIoctrlSpeakStateResp;</code></pre> <h1>三、示例说明</h1> <h2>3.1 APP实作通过Command获取灯光状态实例</h2> <ul> <li>定义Command及结构体</li> <li>获取开关状态Command定义:IOTYPE_GET_LED_REQ = 0x30000001</li> <li>获取开关状态结构体定义: @struct SMsgAVIoctrlGetLedReq;</li> </ul> <pre><code class="language-c"> typedef struct { int channel; //当前通道号 unsigned char reserved[4]; }SMsgAVIoctrlGetLedReq;</code></pre> <ul> <li>设备端回复APP开关状态Command定义:IOTYPE_GET_LED_RESP = 0x30000002</li> <li>设备端回复APP开关状态结构体定义:@struct SMsgAVIoctrlGetLedResp;</li> </ul> <pre><code class="language-c"> typedef struct { int res; // 0:成功; 其他失败 unsigned char isOnOff; // 0:开启; 1:关闭 unsigned char reserved[3]; }SMsgAVIoctrlGetLedResp;</code></pre> <h2>3.2 IOS端发送及接收Command的方法</h2> <ul> <li>发送Command的方法</li> </ul> <pre><code class="language-c"> SMsgAVIoctrlGetLedReq *s = malloc(sizeof(SMsgAVIoctrlGetLedReq)); memset(s, 0, sizeof(SMsgAVIoctrlGetLedReq)); [self.camera KY_SendIOCtrlToChannel:channel Type:IOTYPE_GET_LED_REQ Data:(char *)s DataSize:sizeof(SMsgAVIoctrlGetLedReq)]; free(s);</code></pre> <ul> <li>接收Command的回调方法</li> </ul> <pre><code class="language-c">- (void)KY_DidReceiveIOCtrlWithUid:(NSString *)uid Type:(NSInteger)type Data:(const char*)data DataSize:(NSInteger)size { if (type == IOTYPE_GET_LED_RESP) { SMsgAVIoctrlGetLedResp *s = (SMsgAVIoctrlGetLedResp *)data; isLightOn = s-&amp;amp;amp;isOnOff; } }</code></pre> <h2>3.3 Android 如何将bytes转成一个java对象</h2> <pre><code class="language-c">private class People { int age = 0;//4 bytes means data[0] ~ data[3] long birthday = 1612330883993L;//8 bytes means data[4] ~ data[11] String name = &amp;quot;&amp;quot;;//custom bytes ex: 32 bytes } /** * byte to people * * @param data src bytes length &amp;amp;amp; 44 * @return people */ private People byteToPeople(byte[] data) { if (data.length &amp;lt; 44) { return null; } People p = new People(); p.age = byteArrayToInt(data, 0); p.birthday = byteArrayToLong(data, 4); byte[] name = new byte[32]; System.arraycopy(data, 12, name, 0, 32); p.name = new String(name); return p; } private short byteArrayToShort(byte[] bytes, int beginPos) { return (short) ((0xff &amp;amp;amp;amp; bytes[beginPos]) | ((0xff &amp;amp;amp;amp; bytes[beginPos + 1]) &amp;lt;&amp;lt; 8)); } private int byteArrayToInt(byte[] bytes, int beginPos) { return (0xff &amp;amp;amp;amp; bytes[beginPos]) | (0xff &amp;amp;amp;amp; bytes[beginPos + 1]) &amp;lt;&amp;lt; 8 | (0xff &amp;amp;amp;amp; bytes[beginPos + 2]) &amp;lt;&amp;lt; 16 | (0xff &amp;amp;amp;amp; bytes[beginPos + 3]) &amp;lt;&amp;lt; 24; } private long byteArrayToLong(byte[] bytes, int beginPos) { long l = 0; for (int i = 0; i &amp;lt; 4; i++) { l = l | ((0xffL &amp;amp;amp;amp; bytes[beginPos + i]) &amp;lt;&amp;lt; (8 * i)); } return l; }</code></pre>

页面列表

ITEM_HTML