| IOTC Platform Ver: [Comments]

- AV Module AV IO Control V1.0

Copyright (c) 2013 by Throughtek Co., Ltd. All Rights Reserved.

- AV Module AV IO Control V1.0............................................................................................................. 1

Revision History................................................................................................................................................. 2

Introduction...................................................................................................................................................... 3

Implementation................................................................................................................................................. 4

AV IO Control Message Type................................................................................................................................ 5

IOTYPE_USER_IPCAM_START (0x01FF)........................................................................................................... 5

IOTYPE_USER_IPCAM_STOP (0x02FF)............................................................................................................ 5

IOTYPE_USER_IPCAM_AUDIOSTART (0x0300)................................................................................................. 6

IOTYPE_USER_IPCAM_AUDIOSTOP (0x0301).................................................................................................. 6

IOTYPE_USER_IPCAM_SPEAKERSTART (0x350)................................................................................................ 6

IOTYPE_USER_IPCAM_SPEAKERSTOP (0x351)............................................................................................... 10

IOTYPE_USER_IPCAM_SETSTREAMCTRL_REQ (0x0320).................................................................................. 10

IOTYPE_USER_IPCAM_SETSTREAMCTRL_RESP (0x0321)................................................................................. 11

IOTYPE_USER_IPCAM_GETSTREAMCTRL_REQ (0x0322)................................................................................. 11

IOTYPE_USER_IPCAM_GETSTREAMCTRL_RESP (0x0323)................................................................................ 11

IOTYPE_USER_IPCAM_SETMOTIONDETECT_REQ (0x0324)....................................................................... 11

IOTYPE_USER_IPCAM_SETMOTIONDETECT_RESP (0x0325)............................................................................ 12

IOTYPE_USER_IPCAM_GETMOTIONDETECT_REQ (0x0326)............................................................................ 12

IOTYPE_USER_IPCAM_GETMOTIONDETECT_RESP (0x0327)........................................................................... 12

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_REQ (0x0328)........................................................................... 12

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_RESP (0x0329).......................................................................... 13

IOTYPE_USER_IPCAM_DEVINFO_REQ (0x0330)............................................................................................. 13

IOTYPE_USER_IPCAM_DEVINFO_RESP (0x0331)............................................................................................ 13

IOTYPE_USER_IPCAM_SETPASSWORD_REQ (0x0332)..................................................................................... 13

IOTYPE_USER_IPCAM_SETPASSWORD_RESP (0x0333).................................................................................... 14

IOTYPE_USER_IPCAM_LISTWIFIAP_REQ (0x0340).......................................................................................... 14

IOTYPE_USER_IPCAM_LISTWIFIAP_RESP (0x0341)......................................................................................... 14

IOTYPE_USER_IPCAM_SETWIFI_REQ (0x0342).............................................................................................. 15

IOTYPE_USER_IPCAM_SETWIFI_REQ2 (0x0346)............................................................................................ 15

IOTYPE_USER_IPCAM_SETWIFI_RESP (0x0343)............................................................................................. 16

IOTYPE_USER_IPCAM_GETWIFI_REQ (0x0344)............................................................................................. 16

IOTYPE_USER_IPCAM_GETWIFI_RESP (0x0345)............................................................................................ 16

IOTYPE_USER_IPCAM_GETWIFI_RESP2 (0x0347)........................................................................................... 16

IOTYPE_USER_IPCAM_SETRECORD_REQ (0x0310)......................................................................................... 16

IOTYPE_USER_IPCAM_SETRECORD_RESP (0x0311)........................................................................................ 17

IOTYPE_USER_IPCAM_GETRECORD_REQ (0x0312)........................................................................................ 17

IOTYPE_USER_IPCAM_GETRECORD_RESP (0x0313)....................................................................................... 17

IOTYPE_USER_IPCAM_SETRCD_DURATION_REQ (0x0314)............................................................................. 18

IOTYPE_USER_IPCAM_SETRCD_DURATION_RESP (0x0315)............................................................................ 18

IOTYPE_USER_IPCAM_GETRCD_DURATION_REQ (0x0316)............................................................................. 18

IOTYPE_USER_IPCAM_GETRCD_DURATION_RESP (0x0317)............................................................................ 18

IOTYPE_USER_IPCAM_LISTEVENT_REQ (0x0318).......................................................................................... 18

IOTYPE_USER_IPCAM_LISTEVENT_RESP (0x0319)......................................................................................... 18

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL (0x031A)............................................................................... 19

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_RESP (0x031B)...................................................................... 20

IOTYPE_USER_IPCAM_SET_ENVIRONMENT_REQ (0x0360)............................................................................. 20

IOTYPE_USER_IPCAM_SET_ENVIRONMENT_RESP (0x0361)............................................................................ 20

IOTYPE_USER_IPCAM_GET_ENVIRONMENT_REQ (0x0362)............................................................................ 21

IOTYPE_USER_IPCAM_GET_ENVIRONMENT_RESP (0x0363)........................................................................... 21

IOTYPE_USER_IPCAM_SET_VIDEOMODE_REQ (0x0370)................................................................................ 21

IOTYPE_USER_IPCAM_SET_VIDEOMODE_RESP (0x0371)............................................................................... 22

IOTYPE_USER_IPCAM_GET_VIDEOMODE_REQ (0x0372)................................................................................ 22

IOTYPE_USER_IPCAM_GET_VIDEOMODE_RESP (0x0373)............................................................................... 22

IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_REQ (0x0380)........................................................................... 22

IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_RESP (0x0381).......................................................................... 23

IOTYPE_USER_IPCAM_GET_EVENTCONFIG_REQ (0x0400).............................................................................. 23

IOTYPE_USER_IPCAM_GET_EVENTCONFIG_RESP (0x0401)............................................................................. 23

IOTYPE_USER_IPCAM_SET_EVENTCONFIG_REQ (0x0402).............................................................................. 23

IOTYPE_USER_IPCAM_SET_EVENTCONFIG_RESP (0x0403)....................................................................... 23

IOTYPE_USER_IPCAM_PTZ_COMMAND (0x1001).......................................................................................... 23

IOTYPE_USER_IPCAM_EVENT_REPORT (0x1FFF)........................................................................................... 24

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_REQ (0x32A)......................................................................... 24

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_RESP (0x32B)........................................................................ 25

IOTYPE_USER_IPCAM_RECEIVE_FIRST_IFRAME (0x1002)............................................................................... 25

IOTYPE_USER_IPCAM_GET_FLOWINFO_REQ (0x390)..................................................................................... 25

IOTYPE_USER_IPCAM_GET_TIMEZONE_REQ (0x3A0)
IOTYPE_USER_IPCAM_GET_TIMEZONE_RESP (0x3A1)
IOTYPE_USER_IPCAM_SET_TIMEZONE_REQ (0x3B0)
IOTYPE_USER_IPCAM_SET_TIMEZONE_RESP (0x3B1).................................................................................... 26

# Revision History

V1.4 :

Add new codec types - AAC, 711U, 711A.

Modify Dropbox struct SMsgAVIoctrlSetDropbox from 32 bytes to 128byes.

V1.3¡G

Add TimeZone related message types.

V1.2¡G

Add a new command to notify Device when Client receives the first I-Frame.

Add a new command for Device to count I-Frame and to gather information from Client.

V1.1¡G

Add a new function to set Wifi (64bit password) and gets the decoding format of communicating audio.

Add descriptions for SWifiAp and STimeDay.

Add a new type ¡§ENUM_AP_ENCTYPE¡¨

V1.0¡G

Add new environment settings, formatting external storage media,and image flip functions.

Update Audio Out Sample code.

# Introduction

AV IO Control is a set of API(Application Interface) used to send or recieve some control commands, like to start/stop video streaming, or to set the parameters of device

Available functions¡G

avSendIOCtrl(ÿ)¡GInterface of sending AVIOCTRL. It will block until receiving the response.

avRecvIOCtrl(ÿ)¡GInterface of receiving AVIOCTRL.

avSendIOCtrlExit(ÿ)¡GAs avSendIOCtrl() will block the threads, we could call

avSendIOCtrlExit() to eliminate the block after the Sender does not yet receive the response from the Receiver.

AV IO Control can only be used after one of the these functions avServStart(), avServStart2(), avClientStart()being called successfully. Please refer to "AVIOCTRLDEFs.h" for details

int avSendIOCtrl(int nAVChannelID, unsigned int nIOCtrlType, char *abIOCtrlData, int nIOCtrlDataSize);

int avRecvIOCtrl(int nAVChannelID, unsigned int *pnIOCtrlType, char *abIOCtrlData, int nIOCtrlMaxDataSize, unsigned int nTimeout);

¡unIOCtrlType¡v¡B¡u*pnIOCtrlType¡v are message types of AV IO Control

¡uabIOCtrlData¡vis data buffer for Sender/Recevier;

¡unIOCtrlDataSize¡v¡B¡unIOCtrlMaxDataSize¡v are the maximal size of buffer of Sender/Recevier.

# Implementation

We use avSendIOCtrl() and avRecvIOCtrl() to communicate between Device and Client App. It is not suggest to put avSendIOCtrl() and avRecvIOCtrl() in the same thread. It is recommaned to put them in different threads as the following example:

int *send_io_ctrl_loop(int avIndex) {

for(int i = 0; ; i++) {

char trash[] = "\x00\x00\x00\x00";

int ret = avSendIOCtrl(avIndex, 0x318, trash, sizeof(trash) - 1);

printf("i = %d, avSendIOCtrl(): %d\n", i, ret);

if(ret < 0) {

break;

}

break;

}

return NULL;

}

void *recv_io_ctrl_loop(void* arg) {

int avIndex = *(int*)arg;

for(int i = 0; ; ) {

unsigned int ioType;

char trash[1500];

int ret = avRecvIOCtrl(avIndex, &ioType, trash, sizeof(trash), 10000);

if(ret < 0) {

printf("avRecvIOCtrl[%d][%d]\n", ret, avIndex);

break;

}

else {

switch (ioType) {

case ÿ:

default:

}

i++;

}

}

return NULL;

}

void *thread_SndIO(void *arg) {

int avIndex = *(int*)arg;

char buf[768];

int ret = avSendIOCtrl(avIndex, 0x318, buf, 32);

printf("avSendIOCtrl[%d]\n", ret);

pthread_exit(0);

}

int main(int argc, char **argv) {

const char UID[] = "00000000000000000000";

const int PORT = 40001 + getpid() % 1007;

char master_list[][30] = {"m1.iotcplatform.com", "m2.iotcplatform.com",

"m3.iotcplatform.com", "m4.iotcplatform.com"};

int ret = IOTC_Initialize(PORT, master_list[0], master_list[1], master_list[2],

master_list[3]);

if(ret != IOTC_ER_NoERROR) {

printf("IOTC_Initialize(): %d\n", ret);

return 1;

}

avInitialize(1);

int SID = -1;

for(time_t start = time(NULL); difftime(time(NULL), start) < 30; ) {

SID = IOTC_Connect_ByUID((char*)UID);

if(SID != -24 && SID != -19) {

break;

}

}

printf("IOTC_Connect_ByUID(): %d\n", SID);

if(SID < 0) {

IOTC_DeInitialize();

return 1;

}

unsigned long serv_type;

int avIndex = avClientStart(SID, "admin", "password", 100, &serv_type, 0);

printf("avClientStart(): %d\n", avIndex);

if(avIndex < 0) return 1;

unsigned short val = 0;

int r = avSendIOCtrl(avIndex,IOTYPE_INNER_SND_DATA_DELAY,(char*)&val,

sizeof(unsigned short));

pthread_t Thread_ID1, Thread_ID2, Thread_ID3;

pthread_create(&Thread_ID1, NULL, &thread_SndIO, (void*)&avIndex);

pthread_detach(Thread_ID1);

pthread_create(&Thread_ID2, NULL, &thread_SndIO, (void*)&avIndex);

pthread_detach(Thread_ID2);

pthread_create(&Thread_ID3, NULL, &thread_SndIO, (void*)&avIndex);

pthread_detach(Thread_ID3);

recv_io_ctrl_loop(&avIndex);

avClientStop(avIndex);

IOTC_Session_Close(SID);

return 0;

}

# AV IO Control Message Type

IOTYPE_USER_IPCAM_START (0x01FF)

l This message should be sent from APP to IPCamera

l App requests IPCamera to send video stream. The IOCtrl data isn't necessary. After IPCamera receives this message by calling avRecvIOCtrl(), it can start to send video stream by calling avSendFrameData().

IOTYPE_USER_IPCAM_STOP (0x02FF)

l This message should be sent from APP to IPCamera

l App requests IPCamera to stop video stream. The IOCtrl data isn't necessary. After IPCamera receives this message by calling avRecvIOCtrl(), it would stop sending video stream.

IOTYPE_USER_IPCAM_AUDIOSTART (0x0300)

l This message should be sent from APP to IPCamera

l App requests IPCamera to send audio stream. The IOCtrl data isn't necessary. After IPCamera receives this message by calling avRecvIOCtrl(), it can start to send audio stream by calling avSendAudioData().

IOTYPE_USER_IPCAM_AUDIOSTOP (0x0301)

l This message should be sent from APP to IPCamera

l App requests IPCamera to stop audio stream.The IOCtrl data isn't necessary. After IPCamera receives this message by calling avRecvIOCtrl(), it would stop sending audio stream.

IOTYPE_USER_IPCAM_SPEAKERSTART (0x350)

l This message should be sent from APP to IPCamera

l App notifies IPCamera that the audio stream of speaker will be sent to IPCamera. The attached data IOCtrl is the channel number. The IOCtrl data is the channel number.

l After IPCamera receives this message by calling avRecvIOCtrl(), it must follow the flowchart to receive the audio data.

l Pseudo Code:

App side:

When user press the ¡§speech¡¨ button, the thread will begin to execute:

1> void *ThreadSendSpeechAudio(void *arg)

2> {

int nChSpeech = 1;

avSendIOCtrl(m_nAVIndex, IOTYPE_USER_IPCAM_SPEAKERSTART,(char*)&nChSpeech, 4);

3>

int avIndex = -1; // avIndex for Speech Channel

char buffer[320];

char out_buff[1024];

short *pbuffer = (short *)buffer;

FRAMEINFO_t framInfo;

memset(buffer,0,sizeof(buffer));

memset(out_buff, 0, sizeof(out_buff));

memset(&framInfo, 0 , sizeof(FRAMEINFO_t));

while(m_bIsRunning && ((avIndex = avServStart(m_nSID,null,null,60,0,1)) < 0);

// init microphone here ÿ

// init speex encoder hereÿ

int nLen = 0;

framInfo.codec_id = MEDIA_CODEC_AUDIO_SPEEX;

framInfo.flags= (samplerate << 2) | (databits << 1) | (channel);

framInfo.cam_index = 0;

framInfo.onlineNum = 0;

//send audio data continuously

while(m_bIsRunning){

// get speaker data -> pbuffer

// get speaker data length -> nReadBytes

if(nReadBytes > 0)

{

nLen = SpeexEncode(pbuffer, nReadBytes, out_buff);

framInfo.timestamp = GetTickCount();

avSendAudioData(avIndex, out_buff, nLen, frameInfo, sizeof(FRAMEINFO_t));

}

}

// release speex encoder here ÿ

// release microphone resource here ÿ

if(avIndex >= 0) avServStop(avIndex);

}

l Which user click the ¡§Stop¡¨ button on App:

1> void stopThreadSpeech()

2> {

int nChSpeech=1;

avSendIOCtrl(m_nAVIndex, IOTYPE_USER_IPCAM_SPEAKERSTOP, (char *)&nChpeech, 4);

m_bIsRunning=false;

if(m_nSID >= 0) avServExit(m_nSID, nChSpeech);

ThreadSendSpeechAudio.join();

}

IPCamera side:

l In order to play audio correctly on App, you should initialize the audio device and set the parameter Speex.

l typedef struct _AudioIn

{

int SID;

int ch;

int avIndex;

unsigned long srvType;

int dspFd;

}AudioIn;

4> void *ThreadRecvSpeechAudio(void *arg)

{

AudioIn audioIn = *(AudioIn *)arg;

int avIndex = 0;

int ret = 0;

char buf[BUFF_FOR_AUDIO];

FRAMEINFO_t frameInfo;

while(audioIn.SID >= 0 && (avIndex = avClientStart(audioIn.SID, NULL, NULL, 60, &audioIn.srvType, audioIn.ch)) >= 0);

while (audioIn.SID >= 0)

{

ret = avRecvAudioData(avIndex, buf, BUFF_FOR_AUDIO, (char*)&frameInfo, 16);

if(ret >= 0)

{

// Puts buff into sound card.

}

}

pthread_exit(0);

}

void start_receive_audio(int SID, int channel)

{

int i;

for(i = 0; I < MAX_CLIENT_NUMBER; i++)

{

if(gAudioIn[i].SID == SID)

{

gAudioIn[i].ch = channel;

// create a thread.

pthread_t ThreadRecvSpeechAudio_ID;

pthread_create(&ThreadRecvSpeechAudio_ID, NULL, & ThreadRecvSpeechAudio, (void *)gAudioIn[i]);

pthread_detach(ThreadRecvSpeechAudio_ID);

}

}

}

l void ReleaseAudioIn(int SID)

{

int i = 0;

//It allows numbers up to ¡§MAX_CLIENT_NUMBER¡¨ App connect to IPCamera.

for(i = 0; i < MAX_CLIENT_NUMBER; i++)

{

if(gAudioIn[i].SID == SID)

{

avClientStop(gAudioIn[i].avIndex);

gAudioIn[i].SID = -1;

close_dsp(gAudioIn[i].dspFd); //Close the audio file according to the SID.

gAudioIn[i].dspFd = -1;

break;

}

}

}

// This device-sided thread receives IOCtrl.

l void *ThreadRecvIOCtrl(void *arg)

{

int ret = 0;

unsigned int ioType;

char ioCtrlBuf[MAX_SIZE_IOCTRL_BUF]; // MAX_SIZE_IOCTRL_BUF = 1024

ÿÿ

while(1)

{

ret = avRecvIOCtrl(m_nAVIndex, &ioType, (char*)&ioCtrlBuf, MAX_SIZE_IOCTRL_BUF, 1000);

if(ret > 0)

{

switch(ioType)

{

case IOTYPE_USER_IPCAM_SPEAKERSTART:

{

SMsgAVIoctrlAVStream *p = (SMsgAVIoctrlAVStream *)buf;

start_receive_audio(m_nSID, p->channel);

}

break;

case IOTYPE_USER_IPCAM_SPEAKERSTOP:

{

ReleaseAudioIn(m_nSID);

}

break;

ÿÿ

default:;

}

}

}

l Note:

TUTK app is using tunnel 1 to send audio stream to device.

Parameters:

Audio Codec¡GSpeex(default) or ADPCM, depends on AVAPI Service Type.

SampleRate¡G8KHz

Data bit¡G16Bit

Channel¡GMono

Therefore, in avClientStart(int nSID,char *viewAcc, char *viewPwd,

unsigned long timeout_sec, unsigned long *pservType, unsigned char ChID) on IPCamera, ChID=1.

Furthermore, if viewAcc = null, viewPwd = null, then it is not necessary to authenticate.

IOTYPE_USER_IPCAM_SPEAKERSTOP (0x351)

l This message should be sent from APP to IPCamera

l App requests IPCamera to stop talking. IPCamera should stop handling audio stream and call avClientStop() to close the channel when it receives this message.

IOTYPE_USER_IPCAM_SETSTREAMCTRL_REQ (0x0320)

l This message should be sent from APP to IPCamera

l App requests IPCamera to set the quality of video. When IPCamera receives the message through IOCtrl, IPCamera should set the quality of video according to received information.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned char quality; // refer to ENUM_QUALITY_LEVEL

unsigned char reserved[3];

} SMsgAVIoctrlSetStreamCtrlReq;

/* AVIOCTRL Quality Type */

typedef enum

{

AVIOCTRL_QUALITY_UNKNOWN = 0x00,

AVIOCTRL_QUALITY_MAX = 0x01, //640*480, 30fps, bit rate not limited

AVIOCTRL_QUALITY_HIGH = 0x02, //640*480, 15fps, 512kbps

AVIOCTRL_QUALITY_MIDDLE = 0x03, //320*240, 15fps, 256kbps

AVIOCTRL_QUALITY_LOW = 0x04, //320*240, 10fps, 128kbps

AVIOCTRL_QUALITY_MIN = 0x05, //160*120, 10fps, 64kbps

}ENUM_QUALITY_LEVEL;

IOTYPE_USER_IPCAM_SETSTREAMCTRL_RESP (0x0321)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App for ¡§IOTYPE_USER_IPCAM_SETSTREAMCTRL_REQ¡¨.

l Stucture of IOCtrl:

typedef struct { unsigned int result; // 0: success; otherwise: failed. unsigned char reserved[4]; } SMsgAVIoctrlGetStreamCtrlResq;

IOTYPE_USER_IPCAM_GETSTREAMCTRL_REQ (0x0322)

l This message should be sent from App to IPCamera.

l App requests IPCamera to receive data of video quality. IOCtrl is not necessary.

IOTYPE_USER_IPCAM_GETSTREAMCTRL_RESP (0x0323)

l This message should be sent from IPCamera to App.

l IPCamera responds the result of ¡§IOTYPE_USER_IPCAM_GETSTREAMCTRL_REQ¡¨ to App.

l Structure of IOCtrl refers to ¡§SMsgAVIoctrlGetStreamCtrlResq¡¨.

IOTYPE_USER_IPCAM_SETMOTIONDETECT_REQ (0x0324)

l This message should be sent from APP to IPCamera

l App requests IPCamera to set sensitivity of motion detection. IPCamera set sensitivity of motion detection according the information in IOCtrl.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned int sensitivity; // 0 (Disabled) ~ 100(MAX):

// Index in App. Sensitivity value

// 0 0

// 1 25

// 2 50

// 3 75

// 4 100

}SMsgAVIoctrlSetMotionDetectReq, SMsgAVIoctrlGetMotionDetectResp;

IOTYPE_USER_IPCAM_SETMOTIONDETECT_RESP (0x0325)

l This message should be sent from IPCamera to App.

l IPCamera responds the result of ¡§IOTYPE_USER_IPCAM_SETMOTIONDETECT_REQ¡¨ to App.

l Structure of IOCtrl:

typedef struct { int result; // 0: success; otherwise: failed. unsigned char reserved[4]; }SMsgAVIoctrlSetMotionDetectResp;

IOTYPE_USER_IPCAM_GETMOTIONDETECT_REQ (0x0326)

l This message should be sent from APP to IPCamera.

l App requests IPCamera to receive the sensitivity of motion detection. IOCtrl is not necessary.

l Structure of IOCtrl:

typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; } SMsgAVIoctrlGetMotionDetectReq;

IOTYPE_USER_IPCAM_GETMOTIONDETECT_RESP (0x0327)

l This message is sent from IPCamera to App.

l IPCamera sets sensitivity then responds the result of ¡§IOTYPE_USER_IPCAM_GETMOTIONDETECT_REQ¡¨ to App.

l Structure of IOCtrl refers to ¡§SMsgAVIoctrlGetMotionDetectResp¡¨ above.

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_REQ (0x0328)

l This message should be sent from APP to IPCamera

l App requests IPCamera to receive the video stream type which is supported by device.

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_RESP (0x0329)

l This message should be sent from IPCamera to App.

l After IPCamera receives ¡§IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_RESP¡¨, IPCamera fills all the types which is supported into IOCtrl and return it to App.

l Structure of IOCtrl:

typedef struct

{

unsigned short index; // the stream index of camera

unsigned short channel; // the channel index used in AVAPIs

char reserved[4];

}SStreamDef;

typedef struct

{

unsigned int number; // the quantity of supported stream

SStreamDef streams[0];

}SMsgAVIoctrlGetSupportStreamResp;

IOTYPE_USER_IPCAM_DEVINFO_REQ (0x0330)

l This message should be sent from APP to IPCamera

l App requests IPCamera to receive the information of manufacturer. IOCtrl is not necessary.

IOTYPE_USER_IPCAM_DEVINFO_RESP (0x0331)

l This message is sent from IPCamera to App.

l After IPCamera receives ¡§IOTYPE_USER_IPCAM_DEVINFO_REQ¡¨, it fills the information of manufacturer into IOCtrl and return it to App.

l Structure of IOCtrl:

typedef struct

{

unsigned char model[16];

unsigned char vendor[16];

unsigned int version;

unsigned int channel; //reserve

unsigned int total; // MBytes, total space size for sdcard

unsigned int free; // MBytes , free space size for sdcard

unsigned char reserved[8];

}SMsgAVIoctrlDeviceInfoResp;

IOTYPE_USER_IPCAM_SETPASSWORD_REQ (0x0332)

l This message should be sent from APP to IPCamera

l App requests IPCamera to set the password of IPCamera.

l Structure of IOCtrl:

typedef struct { char oldpasswd[32]; //old password char newpasswd[32]; //new password }SMsgAVIoctrlSetPasswdReq;

IOTYPE_USER_IPCAM_SETPASSWORD_RESP (0x0333)

l This message is sent from IPCamera to App.

l IPCamera responds the result for ¡§IOTYPE_USER_IPCAM_SETPASSWORD_REQ¡¨ to App after the old password was matched and new password was updated successfully.

l Structure of IOCtrl:

typedef struct{ int result; //0x00 set password successfully, or not failed unsigned char reserved[4]; }SMsgAVIoctrlSetPasswdResp;

IOTYPE_USER_IPCAM_LISTWIFIAP_REQ (0x0340)

l This message should be sent from APP to IPCamera.

l App requests IPCamera to list all the Wifi it find. IOCtrl is not necessary.

IOTYPE_USER_IPCAM_LISTWIFIAP_RESP (0x0341)

l This message should be sent from IPCamera to App.

l IP Camera responds the result to App by command ¡uIOTYPE_USER_IPCAM_LISTWIFIAP_REQ¡v.

l Structure of IOCtrl:

typedef struct

{

unsigned int number; // MAX: 1024/36=28

SWifiAp stWifiAp[0]; //stored the start address for all WiFi information

//use sizeof(SWifiAp) bytes to get WiFi data.

}SMsgAVIoctrlListWifiApResp;

typedef struct

{

char ssid[32]; //the SSID of WiFi

char mode; //refer to ENUM_AP_MODE

char enctype; //Encryption to WiFi, refer to ENUM_AP_ENCTYPE.

char signal; // signal strength, ranged from 0% to 100%.

char status; // 0 : invalid ssid or disconnected

// 1 : connected with default gateway

// 2 : unmatched password

// 3 : weak signal and connected

// 4 : selected:

// - password matched and

// - disconnected or connected but not default gateway

}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, for no password

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;

IOTYPE_USER_IPCAM_SETWIFI_REQ (0x0342)

l This message should be sent from APP to IPCamera

l App requests IPCamera to connect to the SSID of WiFi.

l Structure of IOCtrl:

typedef struct

{

unsigned char ssid[32]; // the WiFi SSID to connect

unsigned char password[32]; // WiFi SSID password

unsigned char mode; // refer to ENUM_AP_MODE

unsigned char enctype; // refer to ENUM_AP_ENCTYPE

unsigned char reserved[10];

}SMsgAVIoctrlSetWifiReq;

IOTYPE_USER_IPCAM_SETWIFI_REQ2 (0x0346)

l This message should be sent from APP to IPCamera

l App requests IPCamera to connect the SSID of the WiFi.

l Same as IOTYPE_USER_IPCAM_SETWIFI_REQ (0x0342), but support 64bit password.¡C

l Structure of IOCtrl:

typedef struct

{

unsigned char ssid[32]; // the WiFi SSID to connect

unsigned char password[64]; // WiFi SSID password

unsigned char mode; // refer to ENUM_AP_MODE

unsigned char enctype; // refer to ENUM_AP_ENCTYPE

unsigned char reserved[10];

}SMsgAVIoctrlSetWifiReq2;

IOTYPE_USER_IPCAM_SETWIFI_RESP (0x0343)

l This message is sent from IPCamera to App.

l IPCamera responds the result for command ¡§IOTYPE_USER_IPCAM_SETWIFI_REQ¡¨ or ¡§IOTYPE_USER_IPCAM_SETWIFI_REQ2¡¨.

l Structure of IOCtrl:

typedef struct { int result; //return 0 if WiFi connected, otherwise return 1. unsigned char reserved[4]; }SMsgAVIoctrlSetWifiResp;

IOTYPE_USER_IPCAM_GETWIFI_REQ (0x0344)

l No used since we have SMsgAVIoctrlListWifiApReq().

IOTYPE_USER_IPCAM_GETWIFI_RESP (0x0345)

l No used since we have SMsgAVIoctrlListWifiApResp().

IOTYPE_USER_IPCAM_GETWIFI_RESP2 (0x0347)

l Same as¡uIOTYPE_USER_IPCAM_GETWIFI_RESP¡v¡Afor 64bit password.¡C

IOTYPE_USER_IPCAM_SETRECORD_REQ (0x0310)

l This message should be sent from App to IPCamera

l App requests IPCamera to set the record mode of IPCamera.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned int recordType; // Refer to 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;

IOTYPE_USER_IPCAM_SETRECORD_RESP (0x0311)

l This message is sent from IPCamera to App.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_SETRECORD_REQ¡¨.

l Structure of IOCtrl:

typedef struct { int result; // return 0 if success, otherwise return -1 unsigned char reserved[4]; }SMsgAVIoctrlSetRecordResp;

IOTYPE_USER_IPCAM_GETRECORD_REQ (0x0312)

l This message should be sent from APP to IPCamera

l App requests IPCamera to receive recording mode.

IOTYPE_USER_IPCAM_GETRECORD_RESP (0x0313)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_GETRECORD_REQ¡¨.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned int recordType; // Refer to 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;

IOTYPE_USER_IPCAM_SETRCD_DURATION_REQ (0x0314)

l No used.

IOTYPE_USER_IPCAM_SETRCD_DURATION_RESP (0x0315)

l No used.

IOTYPE_USER_IPCAM_GETRCD_DURATION_REQ (0x0316)

l No used.

IOTYPE_USER_IPCAM_GETRCD_DURATION_RESP (0x0317)

l No used.

IOTYPE_USER_IPCAM_LISTEVENT_REQ (0x0318)

l This message should be sent from APP to IPCamera

l App requests IPCamera to retrieve lists of event.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

STimeDay stStartTime; // Search event from ...

STimeDay stEndTime; // ... to (search event)

unsigned char event; // event type, refer to ENUM_EVENTTYPE

unsigned char status; // 0x00: Recording file exists, Event unreaded

// 0x01: Recording file exists, Event readed

// 0x02: No Recording file in the event

unsigned char reserved[2];

}SMsgAVIoctrlListEventReq;

IOTYPE_USER_IPCAM_LISTEVENT_RESP (0x0319)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to APP for command ¡§IOTYPE_USER_IPCAM_LISTEVENT_REQ¡¨.

l The result of this command might be very large, so the transferring packets should be separated. Refer to following definition for detail.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned int total; // total events in this search session

unsigned char index; // packet index, 0,1,2...

// avSendIOCtrl send max 1024 bytes one time;

// total events can be divided into x packages; x is 0,1,2...

unsigned char endflag; // end flag = 1 means this packet is the last one,

otherwise there are more packets to receive.

unsigned char count; // how many events in this packet.

unsigned char reserved[1];

SAvEvent stEvent[0]; //first address of all events in this package

}SMsgAVIoctrlListEventResp;

typedef struct

{

unsigned short year;

unsigned char month;

unsigned char day;

unsigned char wday; //Sunday = 0(maybe another value in other platform)

unsigned char hour;

unsigned char minute;

unsigned char second;

}STimeDay;

typedef struct

{

STimeDay stTime;

unsigned char event; // refer to ENUM_EVENTTYPE

unsigned char status; // unread = 0, read = 1

unsigned char reserved[2];

}SAvEvent;

typedef enum

{

AVIOCTRL_EVENT_ALL = 0x00, // all event type

AVIOCTRL_EVENT_MOTIONDECT = 0x01, // motion detect start

AVIOCTRL_EVENT_VIDEOLOST = 0x02, // video lost alarm

AVIOCTRL_EVENT_IOALARM = 0x03, // IO alarm start

AVIOCTRL_EVENT_MOTIONPASS = 0x04, // motion detect end

AVIOCTRL_EVENT_VIDEORESUME = 0x05, // video resume

AVIOCTRL_EVENT_IOALARMPASS = 0x06, // IO alarm end

AVIOCTRL_EVENT_EXPT_REBOOT = 0x10, // system exception reboot

AVIOCTRL_EVENT_SDFAULT = 0x11, // SDCard record exception

}ENUM_EVENTTYPE;

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL (0x031A)

l This message should be sent from App to IPCamera

l App requests IPCamera to playback the recorded video.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned int command; // play record command, refer to ENUM_PLAYCONTROL.

unsigned int Param; // command param, that the user defined

STimeDay stTimeDay; // Event time from ListEvent

unsigned char reserved[4];

} SMsgAVIoctrlPlayRecord;

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,

}ENUM_PLAYCONTROL;

l Instructions of ENUM_PLAYCONTROL¡G

u AVIOCTRL_RECORD_PLAY_START¡GCall avServerStart() after IPCamera received this instruction, and then choice an available IOTC channel ,together with same account and password. App would use the new channel to stream the video.

u AVIOCTRL_RECORD_PLAY_PAUSE¡GPause the video streaming or resume to stream video.

u AVIOCTRL_RECORD_PLAY_STOP¡GCall avServerStop() to stop video streaming and close the IOTC channel.

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_RESP (0x031B)

l This message should be sent to App from IPCamera.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL¡¨.

l Structure of IOCtrl:

typedef struct

{

unsigned int command; // play record command

unsigned int result; // depends on command

unsigned char reserved[4];

} SMsgAVIoctrlPlayRecordResp

l Notes for ENUM_PLAYCONTROL¡G

u AVIOCTRL_RECORD_PLAY_START¡GAssign the IOTC channel for playback to result, and responds to APP. App would use the ID of IOTC Channel for avClientStart(). In addition, sends IOTYPE_USER_IPCAM_START() and IOTYPE_USER_IPCAM_AUDIOSTART() to Camera by avSendIOCtrl()¡Abegin to receive video and audio stream.

u AVIOCTRL_RECORD_PLAY_END¡GIPCamera responds to App automatically if video was finish.

IOTYPE_USER_IPCAM_SET_ENVIRONMENT_REQ (0x0360)

l This message should be sent from APP to IPCamera

l App requests IPCamera to set the environment.

l Structure of IOCtrl:

typedef enum

{

AVIOCTRL_ENVIRONMENT_INDOOR_50HZ = 0x00,

AVIOCTRL_ENVIRONMENT_INDOOR_60HZ = 0x01,

AVIOCTRL_ENVIRONMENT_OUTDOOR = 0x02,

AVIOCTRL_ENVIRONMENT_NIGHT = 0x03,

}ENUM_ENVIRONMENT_MODE;

typedef struct

{

unsigned int channel; // Camera Index

unsigned char mode; // refer to ENUM_ENVIRONMENT_MODE

unsigned char reserved[3];

}SMsgAVIoctrlSetEnvironmentReq;

IOTYPE_USER_IPCAM_SET_ENVIRONMENT_RESP (0x0361)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_SET_ENVIRONMENT_REQ¡¨.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned char result; // 0: success; otherwise: failed.

unsigned char reserved[3];

}SMsgAVIoctrlSetEnvironmentResp;

IOTYPE_USER_IPCAM_GET_ENVIRONMENT_REQ (0x0362)

l This message should be send from APP to IPCamera.

l App requests IPCamera to retrieve the environment setting.

l Structure of IOCtrl:

typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; }SMsgAVIoctrlGetEnvironmentReq;

IOTYPE_USER_IPCAM_GET_ENVIRONMENT_RESP (0x0363)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_GET_ENVIRONMENT_REQ¡¨.

l Structure of IOCtrl:

typedef enum

{

AVIOCTRL_ENVIRONMENT_INDOOR_50HZ = 0x00,

AVIOCTRL_ENVIRONMENT_INDOOR_60HZ = 0x01,

AVIOCTRL_ENVIRONMENT_OUTDOOR = 0x02,

AVIOCTRL_ENVIRONMENT_NIGHT = 0x03,

}ENUM_ENVIRONMENT_MODE;

typedef struct

{

unsigned int channel; // Camera Index

unsigned char mode; // refer to ENUM_ENVIRONMENT_MODE

unsigned char reserved[3];

}SMsgAVIoctrlGetEnvironmentResp;

IOTYPE_USER_IPCAM_SET_VIDEOMODE_REQ (0x0370)

l This message should be sent from APP to IPCamera

l App requests IPCamera to retrieve video mode setting.

l Structure of IOCtrl:

typedef enum

{

AVIOCTRL_VIDEOMODE_NORMAL = 0x00,

AVIOCTRL_VIDEOMODE_FLIP = 0x01, // vertical flip

AVIOCTRL_VIDEOMODE_MIRROR = 0x02, // horizontal flip

AVIOCTRL_VIDEOMODE_FLIP_MIRROR = 0x03, // vertical & horizontal flip

}ENUM_VIDEO_MODE;

typedef struct

{

unsigned int channel; // Camera Index

unsigned char mode; // refer to ENUM_VIDEO_MODE

unsigned char reserved[3];

}SMsgAVIoctrlSetVideoModeReq;

IOTYPE_USER_IPCAM_SET_VIDEOMODE_RESP (0x0371)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App for command ¡§IOTYPE_USER_IPCAM_SET_VIDEOMODE_REQ¡¨.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // Camera Index

unsigned char result; // 0: success; otherwise: failed.

unsigned char reserved[3];

}SMsgAVIoctrlSetVideoModeResp;

IOTYPE_USER_IPCAM_GET_VIDEOMODE_REQ (0x0372)

l This message should be sent from APP to IPCamera.

l App requests IPCamera to retrieve the video mode setting.

l Structure of IOCtrl:

typedef struct { unsigned int channel; // Camera Index unsigned char reserved[4]; }SMsgAVIoctrlGetVideoModeReq;

IOTYPE_USER_IPCAM_GET_VIDEOMODE_RESP (0x0373)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App.

l Structure of IOCtrl:

typedef enum

{

AVIOCTRL_VIDEOMODE_NORMAL = 0x00,

AVIOCTRL_VIDEOMODE_FLIP = 0x01, // vertical flip

AVIOCTRL_VIDEOMODE_MIRROR = 0x02, // horizontal flip

AVIOCTRL_VIDEOMODE_FLIP_MIRROR = 0x03, // vertical & horizontal flip

}ENUM_VIDEO_MODE;

typedef struct

{

unsigned int channel; // Camera Index

unsigned char mode; // refer to ENUM_VIDEO_MODE

unsigned char reserved[3];

}SMsgAVIoctrlGetVideoModeResp;

IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_REQ (0x0380)

l This message should be sent from APP to IPCamera.

l App requests IPCamera to format the storage.

l Should be worked with AVAPI Service Type.

l Structure of IOCtrl:

typedef struct { unsigned int storage; // Storage index (ex. sdcard slot = 0, internal flash = 1, ...) unsigned char reserved[4]; }SMsgAVIoctrlFormatExtStorageReq;

IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_RESP (0x0381)

l IPCamera sends to App.

l IPCamera responds the result to App.

l Structure of IOCtrl:

typedef struct

{

unsigned int storage; // Storage index

char result; // 0: success;

// -1: format command is not supported.

// otherwise: failed.

unsigned char reserved[3];

}SMsgAVIoctrlFormatExtStorageResp;

IOTYPE_USER_IPCAM_GET_EVENTCONFIG_REQ (0x0400)

l No used.

IOTYPE_USER_IPCAM_GET_EVENTCONFIG_RESP (0x0401)

l No used.

IOTYPE_USER_IPCAM_SET_EVENTCONFIG_REQ (0x0402)

l No used.

IOTYPE_USER_IPCAM_SET_EVENTCONFIG_RESP (0x0403)

l No used.

IOTYPE_USER_IPCAM_PTZ_COMMAND (0x1001)

l This message should be sent from APP to IPCamera

l App requests IPCamera to control PT.

l Structure of IOCtrl:

typedef struct

{

unsigned char control; // ptz control command, refer to ENUM_PTZCMD.

unsigned char speed; // ptz control speed

unsigned char point; // no use in app

unsigned char limit; // no use in app

unsigned char aux; // no use in app

unsigned char channel; // camera index

unsigned char reserve[2];

} SMsgAVIoctrlPtzCmd;

/* AVIOCTRL PTZ Command Value */

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;

IOTYPE_USER_IPCAM_EVENT_REPORT (0x1FFF)

l This message should be sent from IPCamera to App.

l Send notification to App if IPCamera triggered an event.

l Sturcture of IOCtrl:

typedef struct

{

STimeDay stTime;

unsigned long time; // UTC Time

unsigned int channel; // Camera Index

unsigned int event; // Event Type, refer to ENUM_EVENTTYPE. Event start status

unsigned char reserved[4];

} SMsgAVIoctrlEvent

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_REQ (0x32A)

l This message should be sent from App to IPCamera.

l App requests IPCamera the supported audio format, for App to decide the audio decoder.

l Structure of IOCtrl:

typedef struct { unsigned int channel; // camera index char reserved[4]; }SMsgAVIoctrlGetAudioOutFormatReq;

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_RESP (0x32B)

l This message should be sent from IPCamera to App.

l IPCamera responds the result to App with the audio encode format.

l Structure of IOCtrl:

typedef struct

{

unsigned int channel; // camera index

int format; // refer to ENUM_CODECID in AVFRAMEINFO.h

char reserved[4];

}SMsgAVIoctrlGetAudioOutFormatResp;

IOTYPE_USER_IPCAM_RECEIVE_FIRST_IFRAME (0x1002)

l This message should be sent from App to IPCamera.

l APP notifies IPCamera while receiving first I-Frame.

l Structure of IOCtrl:

typedef struct { unsigned int channel; // camera index char reserved[4]; }SMsgAVIoctrlReceiveFirstIFrame;

IOTYPE_USER_IPCAM_GET_FLOWINFO_REQ (0x390)

l This message should be sent from IPCamera to App.

l IPCamera notifies App to collect the status of frames receiving in seconds by collect_interval.

l Structure of IOCtrl:

typedef structure { unsigned int channel; // camera index unsigned int collect_interval //seconds of interval to collect frame information }SMsgAVIoctrlGetFlowInfoReq;

IOTYPE_USER_IPCAM_GET_FLOWINFO_RESP (0x391)

l This message should be sent from App to IPCamera.

l App responds to Camera the command is received and beginning to collect data.

l Structure of IOCtrl:

typedef structure

{

unsigned int channel; // camera index

unsigned int collect_interval // seconds of interval client will collect frame

// information

}SMsgAVIoctrlGetFlowInfoResp;

IOTYPE_USER_IPCAM_CURRENT_FLOWINFO (0x392)

l This message should be sent from App to IPCamera.

l App responds the result to IPCamera for command ¡§IOTYPE_USER_IPCAM_GET_FLOWINFO_REQ¡¨.

l Structure of IOCtrl:

typedef structure

{

unsigned int channel; // camera index

unsigned int total_frame_count; // Total frame count in the specified

// interval

unsigned int lost_incomplete_frame_count; // Total lost and incomplete frame count

// in the specified interval

unsigned int total_expected_frame_size; // Total expected frame size from

// avRecvFrameData2()

unsigned int total_actual_frame_size; // Total actual frame size from

// avRecvFrameData2()

unsigned int timestamp_ms; // Timestamp in millisecond of this

//report.

char reserved[8];

}SMsgAVIoctrlCurrentFlowInfo;

IOTYPE_USER_IPCAM_GET_TIMEZONE_REQ (0x3A0)
IOTYPE_USER_IPCAM_GET_TIMEZONE_RESP (0x3A1)
IOTYPE_USER_IPCAM_SET_TIMEZONE_REQ (0x3B0)
IOTYPE_USER_IPCAM_SET_TIMEZONE_RESP (0x3B1)

l IPCamera responds to IPCamera.

1. App sends IOTYPE_USER_IPCAM_GET_TIMEZONE_REQ to IPCamera after successfully connects to IPCamera.

2. IPCamera responds the time zone setting to APP by IOTYPE_USER_IPCAM_GET_TIMEZONE_RESP, and then APP updates the time-zone.

3. App notifies IPCamera by IOTYPE_USER_IPCAM_SET_TIMEZONE_REQ to changes time zone setting

4. IPCamers responds to App by IOTYPE_USER_IPCAM_SET_TIMEZONE_RESP and then APP confirms the setting is completed.

l Structure of IOCtrl:

typedef structure

{

int cbSize; // the following package size in bytes,
// should be sizeof(SMsgAVIoctrlTimeZone)

int nIsSupportTimeZone; // device is support TimeZone or not, , 1:

Supported, 0: Unsupported.

int nGMTDiff; // the difference between GMT in hours

char szTimeZoneString[256]; // the timezone description string in
// multi-bytes char format

} SMsgAVIoctrlTimeZone;