IO Command Definition

IO Command


English-IOCmd

[TOC]

History

Date Version Update Editor
2021/3/1 V2.0.0 Fist draft Lux
2021/4/9 V2.0.1 Modify 2.38 IOTYPE_USER_IPCAM _DEVICE_SUPPORT_CLOUD _RESP = 0x800D Lux
2021/6/29 V2.0.2 Add 2.42 Get device humanoid detection status; 2.43 Set the device humanoid detection status; 2.44 Get device night vision status; 2.45 Set device night vision status; 2.46 Get device daylight saving time status; 2.47 Set device daylight saving time status; Modify 2.7 Get device SD card event list Lux
2021/11/16 V2.0.3 Add 2.27 Calling Client starts to send Video Frame;2.28 Calling Client stops to send Video Frame;2.35 End the call;2.36 The caller makes a call request;2.37 The called party responds to the call request;Adjust number Lux
2022/3/8 V2.0.4 Add 2.53 Get ICCID information Arthur
2022/4/28 V2.0.5 Add 2.54 Get certKey and profileVer Lux

One. IO Command Definition

> Note: The device needs to be functionally connected according to the IO Command document provided by TUTK. In order to standardize the setting and use of the public version of Kalay APP IO Command, it is forbidden to change the parameters and structures of the public version IO Command at will. If the device cannot successfully connect to the public version APP due to random changes, TUTK does not need to bear any responsibility. At the same time, in order to meet the needs of customized projects, some parameter sections will be reserved for customized Command settings.

1.1 Parameter section used in public version and customized

1.2 Structure definition specifications and restrictions

  • The number of bytes occupied by the data of the structure should be a multiple of 4.
  • The number of bytes of data in the structure should not exceed 1024 bytes.

Two. Structure and Description

2.1 Calling device starts to transmit Video Frame

IOTYPE_USER_IPCAM_START = 0x01FF;

  • Send from APP to Device;
  • APP informs Device to start sending video data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;               // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.2 Calling device stops transmitting Video Frame

IOTYPE_USER_IPCAM_STOP = 0x02FF;

  • Send from APP to Device;
  • APP tells Device to stop sending video data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;            // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.3 Calling device starts to transmit Audio Frame

IOTYPE_USER_IPCAM_AUDIOSTART = 0x0300;

  • Send from APP to Device;
  • APP informs Device to start sending audio data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;          // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.4 Calling device stops transmitting Audio Frame

IOTYPE_USER_IPCAM_AUDIOSTOP = 0x0301;

  • Send from APP to Device;
  • APP tells Device to stop sending audio data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;         // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.5 Set device SD card recording mode

IOTYPE_USER_IPCAM_SETRECORD_REQ = 0x0310;

  • Send from APP to Device;
  • APP informs Device to set the SD card recording mode of the device.
  • IOCtrl data:
  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;

  • Send from Device to APP;
  • Device informs App of setting result.
  • IOCtrl data:
  typedef struct
  {
  int result;                            // return 0 if success, otherwise: failed.
  unsigned char reserved[4];
  }SMsgAVIoctrlSetRecordResp;

2.6 Get the current SD card recording mode of the device

IOTYPE_USER_IPCAM_GETRECORD_REQ = 0x0312;

  • Send from APP to Device;
  • The APP informs the Device to obtain the SD card recording mode of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;            // Camera Index
  unsigned char reserved[4];
  }SMsgAVIoctrlGetRecordReq;

IOTYPE_USER_IPCAM_GETRECORD_RESP = 0x0313;

  • Send from Device to APP;
  • Device puts the video type configuration into IOCtrl data and sends it back to App.
  • IOCtrl data:
  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;

2.7 Get device SD card event list

IOTYPE_USER_IPCAM_LISTEVENT_REQ = 0x0318;

  • Send from APP to Device;
  • APP informs Device to obtain a list of device events.
  • IOCtrl data:
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;

typedef struct
{
unsigned short year;        // The number of year.
unsigned char month;      // The number of months since January, in the range 1 to 12.
unsigned char day;          // The day of the month, in the range 1 to 31.
unsigned char wday;       // The number of days since Sunday, in the range 0 to 6. (Sunday = 0, Monday = 1, ...)
unsigned char hour;        // The number of hours past midnight, in the range 0 to 23.
unsigned char minute;     // The number of minutes after the hour, in the range 0 to 59.
unsigned char second;     // The number of seconds after the minute, in the range 0 to 59.
}STimeDay;

IOTYPE_USER_IPCAM_LISTEVENT_RESP = 0x0319;

  • Send from Device to APP;
  • Device puts the video list in IOCtrl data and sends it back to App.
  • IOCtrl data:
  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
  {
  STimeDay stTime;
  unsigned char event;             // 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 short duration;      // event duration in second
  }SAvEvent;

  typedef enum
  {
  AVIOCTRL_EVENT_ALL = 0x00;                   // All Events
  AVIOCTRL_EVENT_MOTIONDECT = 0x01;            // Motion Detection
  AVIOCTRL_EVENT_VIDEOLOST = 0x02;             // Video Lost
  AVIOCTRL_EVENT_IOALARM = 0x03;               // IO Alarm
  AVIOCTRL_EVENT_MOTIONPASS = 0x04;            // Motion Pass
  AVIOCTRL_EVENT_VIDEORESUME = 0x05;           // Resume Video
  AVIOCTRL_EVENT_IOALARMPASS = 0x06;           // IO Alarm Pass
  AVIOCTRL_EVENT_MOVIE = 0x07;                  // Movie
  AVIOCTRL_EVENT_TIME_LAPSE = 0x08;             // Time Lapse
  AVIOCTRL_EVENT_EMERGENCY = 0x09;              // Emergency
  AVIOCTRL_EVENT_EXPT_REBOOT = 0x10;           // System Reboot
  AVIOCTRL_EVENT_SDFAULT = 0x11;               // Cannot detect SD Card
  AVIOCTRL_EVENT_FULLTIME_RECORDING = 0x12;     // Full Time
  AVIOCTRL_EVENT_PIR = 0x13;                    // PIR
  AVIOCTRL_EVENT_RINGBELL = 0x14;               // Ringbell
  AVIOCTRL_EVENT_SOUND = 0x15;                  // Sound
  AVIOCTRL_EVENT_HUMANOID_DETECTION = 0x16;     // Humanoid Detection
  }ENUM_EVENTTYPE;

2.8 SD card event playback control

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_REQ = 0x031A;

  • Sent from APP to Device;
  • APP informs Device to replay the recording event.
  • IOCtrl data:
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 endflag;                 // 0 app, play stop when this event end; 1 web, continue next event when this event end
unsigned char downloadFlag;        // 0 playback mode, 1 download mode
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;

IOTYPE_USER_IPCAM_RECORD_PLAYCONTROL_RESP = 0x031B;

  • Send from Device to APP;
  • Device puts the video playback result into IOCtrl data and sends it back to App. (APP receives fixed byte length)
  • IOCtrl data:
  typedef struct
  {
        unsigned int command;            // Play record command. refer to ENUM_PLAYCONTROL
        unsigned int result;                   // Depends on command
                                                         // when is AVIOCTRL_RECORD_PLAY_START:
                                                         // result>=0  real channel no used by device for playback
                                                         // result <0  error
                                                         // result= -1 playback error
                                                         // result= -2 exceed max allow client amount
        unsigned int size;                     //  Event playback file size
        unsigned char respond; 
        unsigned char reserved[3];
  } SMsgAVIoctrlPlayRecordResp;

2.9 Set device video quality

IOTYPE_USER_IPCAM_SETSTREAMCTRL_REQ = 0x0320;

  • Send from APP to Device;
  • APP tells Device to set the resolution of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;          // Camera Index
  unsigned char quality;         // refer to 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;

IOTYPE_USER_IPCAM_SETSTREAMCTRL_RESP = 0x0321;

  • Send from Device to APP;
  • Device informs the APP of the resolution setting result.
  • IOCtrl data:
  typedef struct
  {
  unsigned int result;         // 0: success; otherwise: failed.
  unsigned char reserved[4];
  } SMsgAVIoctrlGetStreamCtrlResq;

2.10 Get the current video quality of the device

IOTYPE_USER_IPCAM_GETSTREAMCTRL_REQ = 0x0322;

  • Send from APP to Device;
  • The APP informs the Device to obtain the current resolution of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;         // Camera Index
  unsigned char reserved[4];
  }SMsgAVIoctrlGetStreamCtrlReq; 

IOTYPE_USER_IPCAM_GETSTREAMCTRL_RESP = 0x0323;

  • Send from Device to APP;
  • Device puts the device resolution configuration in IOCtrl data and sends it back to App.
  • IOCtrl data:
  typedef struct
  {
  unsigned int  channel;        // Camera Index
  unsigned char quality;        //refer to ENUM_QUALITY_LEVEL
  unsigned char reserved[3];
  } SMsgAVIoctrlSetStreamCtrlReq, SMsgAVIoctrlGetStreamCtrlResp;

2.11 Set the sensitivity of device motion detection

IOTYPE_USER_IPCAM_SETMOTIONDETECT_REQ = 0x0324;

  • Send from APP to Device;
  • APP informs Device to set the sensitivity of device displacement detection.
  • IOCtrl data:
 typedef struct
  {
        unsigned int channel;             // Camera Index
        unsigned int sensitivity;         // 0 (Disabled) ~ 100(MAX):
                                                     // Index in App. Sensitivity value
                                                     // 0              0(Off)
                                                     // 1              25(Low)
                                                     // 2              50(Medium)
                                                     // 3              75(High)
                                                     // 4              100(Max)
  }SMsgAVIoctrlSetMotionDetectReq, SMsgAVIoctrlGetMotionDetectResp;

IOTYPE_USER_IPCAM_SETMOTIONDETECT_RESP = 0x0325;

  • Send from Device to APP;
  • Device informs APP of the sensitivity setting result of motion detection.
  • IOCtrl data:
  typedef struct
  {
  int result;                     // 0: success; otherwise: failed.
  unsigned char reserved[4];
  }SMsgAVIoctrlSetMotionDetectResp;

2.12 Get the sensitivity of the device's current motion detection

IOTYPE_USER_IPCAM_GETMOTIONDETECT_REQ = 0x0326;

  • Send from APP to Device;
  • APP informs Device to obtain the sensitivity of device displacement detection.
  • IOCtrl data:
  typedef struct
  {
  unsigned  int  channel;             // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlGetMotionDetectReq;

IOTYPE_USER_IPCAM_GETMOTIONDETECT_RESP = 0x0327;

  • Send from Device to APP;
  • Device puts device motion detection sensitivity configuration into IOCtrl data and sends it back to App.
  • IOCtrl data:
   typedef struct
  {
        unsigned int channel;        // Camera Index
        unsigned int sensitivity;    // 0(Disabled) ~ 100(MAX):
                                                  // index sensitivity value
                                                  // 0              0(Off)
                                                  // 1              25(Low)
                                                  // 2              50(Medium)
                                                  // 3              75(High)
                                                  // 4              100(Max)
  }SMsgAVIoctrlSetMotionDetectReq, SMsgAVIoctrlGetMotionDetectResp;

2.13 Get the current number of device channels

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_REQ = 0x0328;

  • Send from APP to Device;
  • APP tells Device to get the current device channel number.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlGetSupportStreamReq;

IOTYPE_USER_IPCAM_GETSUPPORTSTREAM_RESP = 0x0329;

  • Send from Device to APP;
  • Device puts the device channel configuration into IOCtrl data and sends it back to App.
  • IOCtrl data:
   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;

2.14 Obtain device audio format

> App to transmit sound.

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_REQ = 0x032A;

  • Send from APP to Device;
  • APP informs Device to obtain device audio format.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;       // camera index
  char reserved[4];
  }SMsgAVIoctrlGetAudioOutFormatReq;

IOTYPE_USER_IPCAM_GETAUDIOOUTFORMAT_RESP = 0x032B;

  • Send from Device to APP;
  • Device puts the device audio format in IOCtrl data and sends it back to App.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;       // camera index
  int format;                     // refer to ENUM_CODECID in AVFRAMEINFO.h
  char sample_rate;
  char bitdata;
  char channels;               //how many channels is used
  char avservchannel;       // 0 sub channel; 1 main channel; otherwise sub channel (default 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;
  MEDIA_CODEC_VIDEO_H263 = 0x4D;
  MEDIA_CODEC_VIDEO_H264 = 0x4E;
  MEDIA_CODEC_VIDEO_MJPEG = 0x4F;
  MEDIA_CODEC_VIDEO_HEVC = 0x50;
  MEDIA_CODEC_AUDIO_AAC_RAW = 0x86;
  MEDIA_CODEC_AUDIO_AAC_ADTS = 0x87;
  MEDIA_CODEC_AUDIO_AAC_LATM = 0x88;
  MEDIA_CODEC_AUDIO_G711U = 0x89;        //g711 u-law
  MEDIA_CODEC_AUDIO_G711A = 0x8A;       //g711 a-law
  MEDIA_CODEC_AUDIO_ADPCM = 0x8B;
  MEDIA_CODEC_AUDIO_PCM = 0x8C;
  MEDIA_CODEC_AUDIO_SPEEX = 0x8D;
  MEDIA_CODEC_AUDIO_MP3 = 0x8E;
  MEDIA_CODEC_AUDIO_G726 = 0x8F;

  Bitdata (0x0 ~ 0xF):
  AUDIO_DATABITS_8 = 0;
  AUDIO_DATABITS_16 = 1;

2.15 Get device information

> It is recommended to use 0x8015/0x8016 instead.

IOTYPE_USER_IPCAM_DEVINFO_REQ = 0x0330;

  • Send from APP to Device;
  • APP informs Device to obtain device information.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlDeviceInfoReq;

IOTYPE_USER_IPCAM_DEVINFO_RESP = 0x0331;

  • Send from Device to APP;
  • Device puts device information into IOCtrl data and sends it back to App.
  • IOCtrl data:
  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 int company;               //company index reference OTA Company list
  unsigned char reserved[4];
  }SMsgAVIoctrlDeviceInfoResp;

2.16 Change device password

IOTYPE_USER_IPCAM_SETPASSWORD_REQ = 0x0332;

  • Send from APP to Device;
  • APP informs Device to change the device password.
  • IOCtrl data:
  typedef struct
  {
  char oldpasswd[32];        // old password
  char newpasswd[32];       // new password
  }SMsgAVIoctrlSetPasswdReq;

IOTYPE_USER_IPCAM_SETPASSWORD_RESP = 0x0333;

  • Send from Device to APP;
  • Device informs APP of the result of changing device password.
  • IOCtrl data:
  typedef struct
  {
  int result;              //0x00 set password successfully, or not failed
  unsigned char reserved[4];
  }SMsgAVIoctrlSetPasswdResp;

2.17 Event playback progress control

IOTYPE_USER_IPCAM_GET_PLAYBACK_REQ = 0x033A;

  • Send from App to Device.
  • App tells Device to get event duration information.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;            // Camera Index
  STimeDay stTimeDay;           //  Event time from ListEvent
  unsigned char reserved[4];
  }SMsgAVIoctrlGetPlaybackReq;

IOTYPE_USER_IPCAM_GET_PLAYBACK_RESP = 0x033B; > Note: The time stamp of the video stream must be within the time period of the return, and the time stamp is in UTC format.

  • Send from Device to App.
  • Device duration information is returned to the App.
  • IOCtrl data:
  typedef struct
  {
  unsigned  int videoTime;             //event video time in seconds
  unsigned  long size;                     //event size in byte
  unsigned char reserved[4];
  }SMsgAVIoctrlGetPlaybackResp;

IOTYPE_USER_IPCAM_SET_RECORD_PROGRESS_REQ = 0x033C; > Note: App will not stop video streaming (0x2ff will not be sent).

  • Send from App to Device.
  • App tells Device to play from the specified time.
  • IOCtrl data:
typedef struct
{
unsigned int channel;                    // Camera Index
STimeDay stTimeDay;                   // Event time from ListEvent
unsigned  int progressTime;          //event progress time in seconds
unsigned char reserved[4];
}SMsgAVIoctrlSetRecordProgessReq;

IOTYPE_USER_IPCAM_SET_RECORD_PROGRESS_RESP = 0x033D;

  • Send from Device to App.
  • Device sends back the device progress result to the App.
  • IOCtrl data:
  typedef struct
  {
  unsigned char result;              //0 means success
  unsigned char reserved[3];
  }SMsgAVIoctrlSeRecordProgressResp;

2.18 Get Wifi list around the device

IOTYPE_USER_IPCAM_LISTWIFIAP_REQ = 0x0340;

  • Send from APP to Device;
  • The APP informs the Device to obtain the wifi list around the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlListWifiApReq;

IOTYPE_USER_IPCAM_LISTWIFIAP_RESP = 0x0341;

  • Send from Device to APP;
  • Device puts the wifi list around the device in the IOCtrl data and sends it back to the App.
  • IOCtrl data:
  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;

2.19 Set the Wifi network of the device

IOTYPE_USER_IPCAM_SETWIFI_REQ = 0x0342;

  • Send from APP to Device;
  • The APP informs the Device to set the wifi of the device.
  • IOCtrl data:
  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_RESP = 0x0343;

  • Send from Device to APP;
  • Device informs APP of the result of setting device wifi.
  • IOCtrl data:
  typedef struct
  {
  int result;                      //return 0 if WiFi connected, otherwise return 1.
  unsigned char reserved[4];
  }SMsgAVIoctrlSetWifiResp;

2.20 Get the WiFi currently set on the device

IOTYPE_USER_IPCAM_GETWIFI_REQ = 0x0344;

  • Send from APP to Device;
  • The APP informs the Device to obtain the wifi currently set by the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlGetWifiReq;

IOTYPE_USER_IPCAM_GETWIFI_RESP = 0x0345;

  • Send from Device to APP;
  • Device puts the current wifi configuration of the device in the IOCtrl data and sends it back to the App.
  • IOCtrl data:
  typedef struct
  {
  unsigned char ssid[32];                  // WiFi ssid
  unsigned char password[32];         // WiFi password if not empty
  unsigned char mode;                     // refer to ENUM_AP_MODE
  unsigned char enctype;                 // refer to ENUM_AP_ENCTYPE
  unsigned char signal;                    // signal intensity 0--100%
  unsigned char status;                   // refer to "status" of SWifiAp
  }SMsgAVIoctrlGetWifiResp;

2.21 Set the WiFi currently set by the device

> Note: This command supports 64-bit password and is sent together with IOTYPE_USER_IPCAM_SETWIFI_REQ = 0x0342.

IOTYPE_USER_IPCAM_SETWIFI_REQ2 = 0x0346;

  • Send from APP to Device;
  • The APP informs the Device to set the wifi currently set by the device.
  • IOCtrl data:
  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_GETWIFI_RESP2 = 0x0347;

  • Send from Device to APP;
  • Device puts the current wifi configuration of the device in the IOCtrl data and sends it back to the App.
  • IOCtrl data:
  typedef struct
  {
  unsigned char ssid[32];                  // WiFi ssid
  unsigned char password[64];          // WiFi password if not empty
  unsigned char mode;                     // refer to ENUM_AP_MODE
  unsigned char enctype;                  // refer to ENUM_AP_ENCTYPE
  unsigned char signal;                    // signal intensity 0--100%
  unsigned char status;                   // refer to "status" of SWifiAp
  }SMsgAVIoctrlGetWifiResp2;

2.22 Calling device starts to receive Audio Frame

IOTYPE_USER_IPCAM_SPEAKERSTART = 0x0350;

  • Send from APP to Device;
  • APP informs Device to start receiving audio data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;             // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.23 Calling device stops receiving Audio Frame

IOTYPE_USER_IPCAM_SPEAKERSTOP = 0x0351;

  • Send from APP to Device;
  • APP informs Device to stop receiving audio data.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;          // Camera Index
  unsigned char reserved[4];
  } SMsgAVIoctrlAVStream;

2.24 Set screen mirroring/flip status

IOTYPE_USER_IPCAM_SET_VIDEOMODE_REQ = 0x0370;

  • Send from APP to Device;
  • APP tells Device to set mirror/flip.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;            // Camera Index
  unsigned char mode;             // refer to ENUM_VIDEO_MODE
  unsigned char reserved[3];
  }SMsgAVIoctrlSetVideoModeReq;

  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;

IOTYPE_USER_IPCAM_SET_VIDEOMODE_RESP = 0x0371;

  • Send from Device to APP;
  • Device informs APP of setting result.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;             // Camera Index
  unsigned char result;             // 0: success; otherwise: failed.
  unsigned char reserved[3];
  }SMsgAVIoctrlSetVideoModeResp;

2.25 Get screen mirroring/flip setting status

IOTYPE_USER_IPCAM_GET_VIDEOMODE_REQ = 0x0372;

  • Send from APP to Device;
  • The APP informs the Device to obtain the mirror/flip setting status.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;            // Camera Index
  unsigned char reserved[4];
  }SMsgAVIoctrlGetVideoModeReq;

IOTYPE_USER_IPCAM_GET_VIDEOMODE_RESP = 0x0373;

  • Sent from Device to APP;
  • Device informs the APP of the current setting status of screen mirroring/flip.
  • IOCtrl data:
  typedef struct
  {
  unsigned int  channel;          // Camera Index
  unsigned char mode;             //  refer to ENUM_VIDEO_MODE
  unsigned char reserved[3];
  }SMsgAVIoctrlGetVideoModeResp;

  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;

2.26 Format SD card

IOTYPE_USER_IPCAM_FORMATEXTSTORAGE_REQ = 0x0380;

  • Send from APP to Device;
  • APP tells Device to format SD card.
  • IOCtrl data:
  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;

  • Send from Device to APP;
  • Device informs APP that the SD card has been formatted.
  • IOCtrl data:
  typedef struct
  {
  unsigned int  storage;             // Storage index
  char result;                            // 0: success;
                                               // -1: format command is not supported.
                                               // otherwise: failed.
  unsigned char reserved[3];
  }SMsgAVIoctrlFormatExtStorageResp;

2.27 Calling Client starts to send Video Frame

> Mainly used in two-way video call scenarios.

IOTYPE_USER_IPCAM_START_CLIENT = 0x03FF;

  • Send from APP to Client;
  • APP informs Client start to send video frame.
  • IOCtrl data:
typedef struct
{
unsigned int channel;         // Camera Index
unsigned char reserved[4];
} SMsgAVIoctrlAVStream;

2.28 Calling Client stops to send Video Frame

> Mainly used in two-way video call scenarios.

IOTYPE_USER_IPCAM_STOP_CLIENT = 0x04FF;

  • Send from APP to Client;
  • APP informs Client stop to send video frame.
  • IOCtrl data:
typedef struct
{
unsigned int channel;          // Camera Index
unsigned char reserved[4];
} SMsgAVIoctrlAVStream;

2.29 Get the number of NVR device Channel interfaces

IOTYPE_USER_IPCAM_GET_NVR_CHANNEL_NUMBER_REQ = 0x5A4;

  • Send from APP to Device;
  • APP informs Device to obtain the number of interfaces of the device Channel.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlGetNVRChannelNumberReq;

IOTYPE_USER_IPCAM_GET_NVR_CHANNEL_NUMBER_RESP = 0x5A5;

  • Send from Device to APP;
  • Device informs the APP of the number of interfaces of the current device Channel.
  • IOCtrl data:
  typedef struct
  {
  unsigned int number;           // the quantity of device channel
  unsigned char reserved[4];
  }SMsgAVIoctrlGetNVRChannelNumberResp;

2.30 Get channel name

IOTYPE_USER_IPCAM_GET_CHANNEL_NAME_REQ = 0x5B0;

  • Send from APP to Device;
  • APP tells Device to obtain the channel name of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[4];
  }SMsgAVIoctrlGetChannelNameReq;

IOTYPE_USER_IPCAM_GET_CHANNEL_NAME_RESP = 0x5B1;

  • Send from Device to APP;
  • Device tells APP the channel name of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned char count;                        // quantity of  channels
  unsigned char reserved[3];
  SChannelInfo sChannelInfo[0];         //  first channelInfo, and total count channelInfo
  }SMsgAVIoctrlGetChannelNameResp;

  typedef struct
  {
  unsigned int channel;         //camera index
  unsigned char name[24];    //channel name
  } SChannelInfo;

2.31 Set channel name

IOTYPE_USER_IPCAM_SET_CHANNEL_NAME_REQ = 0x5B2;

  • Send from APP to Device;
  • APP tells Device to set the channel name of the device.
  • IOCtrl data:
  typedef struct
  {
  unsigned char count;                        //  quantity of  SChannelInfos
  unsigned char reserved[3];
  SChannelInfo sChannelInfo[0];        //  first channelInfo, and total count channelInfo
  }SMsgAVIoctrlSetChannelNameReq;

IOTYPE_USER_IPCAM_SET_CHANNEL_NAME_RESP = 0x5B3;

  • Send from Device to APP;
  • Device informs APP of the result of setting device channel name.
  • IOCtrl data:
  typedef struct
  {
  unsigned char result;            //  0 success, other failed
  unsigned char reserved[3];
  }SMsgAVIoctrlSetResetResp;

2.32 Doorbell call

> Mainly used in video doorbell call scenarios.

IOTYPE_XM_CALL_REQ = 0x700;

  • Send from Device to APP;
  • Device informs APP that there is a user call.
  • IOCtrl data:
  typedef struct
  {
  unsigned char index;           //Door index number, 0: Door1; 1: Door2
  STimeDay stTime;              //Event time
  unsigned char reserved[3];
  } SMsgAVIoctrlCallReq

IOTYPE_XM_CALL_RESP = 0x701;

  • Send from APP to Device;
  • APP informs Device whether to answer the call.
  • IOCtrl data:
  typedef struct
  {
  unsigned  char  index;            //Door index number, 0: Door1; 1: Door2
  int nAnswered;                       //0: hang up; 1: answer
  unsigned char reserved[3];
  }SMsgAVIoctrlCallResp;

IOTYPE_XM_CALL_IND = 0x702;

  • Send from Device to APP;
  • Device informs the APP whether there are other users answering.
  • IOCtrl data:
  typedef struct
  {
  unsigned char index;           //Door index number, 0: Door1; 1: Door2
  unsigned char type;            //Type, 0: user calls; 1: other users answer
  STimeDay stTime;              //Event time
  unsigned char reserved[3];
  }SMsgAVIoctrlCallInd;

2.33 Send device name to device

IOTYPE_USER_IPCAM_PUSH_DEVICENAME_REQ= 0x0736;

  • Send from APP to Device;
  • APP tells Device to request the current device name.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel ;            //camera index
  char devicename[150];          //Current device name
  }SMsgAVIoctrlPushDeviceNameReq;

IOTYPE_USER_IPCAM_PUSH_DEVICENAME_RESP= 0x0737;

  • Send from Device to APP;
  • Device tells the APP to update the result of the current device name.
  • IOCtrl data:
  typedef struct
  {
  int res;              //0:success, others failed
  char reserved[4];
  }SMsgAVIoctrlPushDeviceNameResp;

2.34 Sync phone time to device

IOTYPE_USER_IPCAM_SET_TIME_SYNC_REQ = 0x0816;

  • Send from APP to Device;
  • APP informs Device to synchronize the phone time.
  • IOCtrl data:
  typedef struct
  {
  unsigned short year;
  unsigned char month;
  unsigned char day;
  unsigned char hour;
  unsigned char minute;
  unsigned char second;
  unsigned char nIsSupportSync;            // 1 supported; 0 unsupported
  int nGMTOffset;                                 //  the offset between GMT in seconds
  } SMsgAVIoctrlTimeSyncReq;

IOTYPE_USER_IPCAM_SET_TIME_SYNC_RESP = 0x0817;

  • Send from Device to APP;
  • Device informs APP of the result of time synchronization.
  • IOCtrl data:
  typedef struct
  {
  unsigned int result;                  //return 0 if success, otherwise failed
  unsigned char reserved[4];
  } SMsgAVIoctrlTimeSyncResp;

2.35 End the call

> Mainly used in two-way video call scenarios.

IOTYPE_USER_IPCAM_CALL_END = 0x0900;

  • Send to the other end from the APP;
  • APP informs the other party to end the call.
  • IOCtrl data:
typedef struct
{
unsigned char myID[6];        // my ID
unsigned char reserved[2];
}SMsgAVIoctrlCallEnd;

2.36 The caller makes a call request

> Mainly used in two-way video call scenarios.

IOTYPE_USER_IPCAM_CALL_REQ = 0x0901;

  • Sent from the caller to the called party;
  • The caller initiates a call request to the called party.
  • IOCtrl data:
typedef struct
{
unsigned char myID[6];         // my ID
unsigned char myUID[20];     // my UID
unsigned char callType;        // 0,oneway; 1, twoway
unsigned char beInvited;      // 0 means to invite and 1 means be invited
 unsigned char infoCount;    // other account count
unsigned char reserved[3];
unsigned AccountInfo info    // other account info in this meeting
}SMsgAVIoctrlCallReq;

typedef struct{
unsigned char UID[20];            // UID
unsigned char myID[6];           // ID
unsigned char reserved[2];
}AccountInfo

2.37 The called party responds to the call request

> Mainly used in two-way video call scenarios.

IOTYPE_USER_IPCAM_CALL_RESP = 0x0902;

  • From the called party to the caller;
  • The called party responds to the call request initiated by the caller.
  • IOCtrl data:
typedef struct
{
unsigned char answer;       // 0, reject; 1 answer
unsigned char myID[6];      //my ID
unsigned char reserved[1];
}SMsgAVIoctrlCallResp;

2.38 PTZ control

IOTYPE_USER_IPCAM_PTZ_COMMAND = 0x1001;

  • Send from APP to Device;
  • APP informs Device to control PTZ.
  • IOCtrl data:
  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 值 */

  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;

2.39 APP gets the first I frame picture

IOTYPE_USER_IPCAM_RECEIVE_FIRST_IFRAME = 0x1002;

  • Send from APP to Device;
  • APP informs Device that it has received the first I frame picture.
  • IOCtrl data:
  typedef struct
  {
  unsigned int channel;        // camera index
  char reserved[4];
  }SMsgAVIoctrlReceiveFirstIFrame;

2.40 Device upgrade via OTA

IOTYPE_USER_IPCAM_OTA_REQ = 0x8001;

  • Send from APP to Device;
  • APP informs Device to start OTA upgrade.
  • IOCtrl data:
  typedef struct
  {
  unsigned char file_checksum[32];     //MD5 checksum
  unsigned char url[256];                   //Download firmware url link
  unsigned int file_size;                     //firmware package size
  unsigned char reserved[4];
  }SMsgAVIoctrlOTAReq;

IOTYPE_USER_IPCAM_OTA_RESP = 0x8002;

  • Send from Device to App
  • Device informs the App of the result of the OTA upgrade.
  • IOCtrl data:
  typedef struct
  {
  unsigned int progress;         //Download firmware progress
  unsigned int endflag;        //1: download completed; 0: downloading
  unsigned char reserved[8];
  }SMsgAVIoctrlOTAResp;

2.41 Get device information

> Note: It is recommended to use when the new device needs to be connected to the OTA function. It has the same effect as the old cmd IOTYPE_USER_IPCAM_DEVINFO_REQ = 0x0330.

IOTYPE_USER_IPCAM_DEVICE_INFO_REQ = 0x8015;

  • Send from App to Device
  • App tells Device to get device information.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[8];
  } SMsgAVIoctrlDeviceInfoReq;

IOTYPE_USER_IPCAM_DEVICE_INFO_RESP = 0x8016;

  • Send from Device to App
  • Device informs App device information.
  • IOCtrl data:
  typedef struct
  {
  unsigned char model[32];     //Product model
  unsigned char product[32];   //Product name
  unsigned char vender[32];    //Manufacturer (must be consistent with the vendor on the KOTA server)
  unsigned int version;          //Current version number
  unsigned int free;              //SD card remaining space
  unsigned int total;             //Total space of SD card
  unsigned char region;        //Get the location of the device, 0: Mainland China; 1: Non-Mainland China
  unsigned char reserved[3];
  } SMsgAVIoctrlDeviceInfoResp;

> Note: The above parameters are used to splice the download url request for obtaining the upgrade file from the KOTA server, so they need to be consistent with the information such as vender, product, and model created on the KOTA server, and pay attention to distinguishing the device area.

2.42 Get whether the device supports OTA upgrade

IOTYPE_USER_IPCAM _DEVICE_SUPPORT_OTA_REQ = 0x800A;

  • Send from App to Device
  • App tells Device to obtain whether the device supports OTA.
  • IOCtrl data:
    typedef struct
    {
    unsigned char reserved[8];
    }SMsgAVIoctrlDeviceSupportOTAReq;

IOTYPE_USER_IPCAM _DEVICE_SUPPORT_OTA _RESP = 0x800B;

  • Send from Device to App
  • Device tells the App whether the device supports OTA.
  • IOCtrl data:
  typedef struct
  {
  unsigned char isSupport;        //  0 not supported; 1 supported
  unsigned char reserved[4];
  } SMsgAVIoctrlDeviceSupportOTAResp;

2.43 Get whether the device supports cloud storage

IOTYPE_USER_IPCAM _DEVICE_SUPPORT_CLOUD_REQ = 0x800C;

  • Send from App to Device
  • App tells Device to check whether cloud storage is supported.
  • IOCtrl data:
  typedef struct
  {
  unsigned char reserved[8];
  }SMsgAVIoctrlDeviceSupportCloudReq;

IOTYPE_USER_IPCAM _DEVICE_SUPPORT_CLOUD _RESP = 0x800D;

  • Send from Device to App
  • Device informs the App whether the device supports cloud storage results.
  • IOCtrl data:
  typedef struct
  {
  unsigned int result;           // 0 not supported; 1 supported
  unsigned char reserved[4];
  } SMsgAVIoctrlDeviceSupportCloudResp;

2.44 Set device cloud storage recording status

IOTYPE_USER_IPCAM_DEVICE_SET_CLOUD_REQ = 0x8010;

  • Send from App to Device
  • The App tells the Device to turn on or off the cloud storage recording function.
  • IOCtrl data:
typedef struct
{
unsigned int channel;       // camera index
unsigned int isOn;           // 1 on, 0 off
}SMsgAVIoctrlSetCloudReq;

IOTYPE_USER_IPCAM_DEVICE_SET_CLOUD_RESP = 0x8011;

  • Send from Device to App
  • Device tells the App to turn on or off cloud storage recording results.
  • IOCtrl data:
typedef struct
{
unsigned int channel;       // camera index
unsigned int result;          // 0 successful, 1 fail
}SMsgAVIoctrlSetCloudResp;

2.45 Get device cloud storage recording status

IOTYPE_USER_IPCAM_DEVICE_GET_CLOUD_REQ = 0x8012;

  • Send from App to Device
  • App gets Device cloud storage recording status.
  • IOCtrl data:
typedef struct
{
unsigned int channel;         // camera index
unsigned char reserved[4];
}SMsgAVIoctrlGetCloudReq;

IOTYPE_USER_IPCAM_DEVICE_GET_CLOUD_RESP = 0x8013;

  • Send from Device to App
  • Device informs App cloud storage recording status.
  • IOCtrl data:
typedef struct
{
unsigned int channel;       // camera index
unsigned int isOn;            // 1 on, 0 off
}SMsgAVIoctrlGetCloudResp;

2.46 Get the date of SD card event

IOTYPE_USER_IPCAM_GET_EVENT_DATE_REQ = 0x9000;

  • Send from App to Device
  • App informs Device to get the date of SD card event.
  • IOCtrl data:
 typedef struct
{
unsigned int channel;       //Camera Index
unsigned int eventType;   //The type of event to be queried, 0: all, 1: motion detection; 2: full-time recording, the default is 0
STimeDay stStartTime;    //Start time
STimeDay stEndTime;     //End time
unsigned char reserved[8];
}SMsgAVIoctrlGetEventDateReq;

IOTYPE_USER_IPCAM_GET_EVENT_DATE_RESP = 0x9001;

  • Send from Device to App
  • Device informs App that there is a date result of SD card event.
  • IOCtrl data:
 typedef struct
{
unsigned int count;                   //The date number of the event
unsigned char reserved[4];
EventDate eventDate[1];          //The date of the event
}SMsgAVIoctrlGetEventDateResp;
 
 typedef struct
{
char date[8];              //The date of the event, for example: 20200210, followed by count-1 dates[8]
}EventDate;

2.47 Get device humanoid detection status

IOTYPE_USER_IPCAM_GET_HUMANDETECTION_REQ = 0x9002;

  • Send from App to Device
  • App informs Device to get the status of humanoid detection switch.
  • IOCtrl data:
typedef struct
{
unsigned char reserved[4];
}SMsgAVIoctrlGetHumanDetectionReq;

  IOTYPE_USER_IPCAM_GET_HUMANDETECTION_RESP = 0x9003;

  • Send from Device to App
  • Device informs the App of the result of the humanoid detection switch query.
  • IOCtrl data:
typedef struct
{
unsigned int result;             //  return 1 if open, otherwise close
unsigned char reserved[4];
} SMsgAVIoctrlGetHumanDetectionResp;

 

2.48 Set the device humanoid detection status

IOTYPE_USER_IPCAM_SET_HUMANDETECTION_REQ = 0x9004;

  • Send from App to Device
  • App informs Device to set humanoid detection switch.
  • IOCtrl data:
typedef struct
{
unsigned int isOn;        //1 open, 0 close
unsigned char reserved[4];
} SMsgAVIoctrlSetHumanDetectionReq;

  IOTYPE_USER_IPCAM_SET_HUMANDETECTION_RESP = 0x9005;

  • Send from Device to App
  • Device informs the App of the result of the humanoid detection switch setting.
  • IOCtrl data:
typedef struct
{
unsigned int result;             // return 0 if successful, otherwise fail
unsigned char reserved[4];
} SMsgAVIoctrlSetHumanDetectionResp;

 

2.49 Get device night vision status

IOTYPE_USER_IPCAM_GET_NIGHTVISION_REQ = 0x9006;

  • Send from App to Device
  • App informs Device to get the status of night vision switch.
  • IOCtrl data:
typedef struct
{
unsigned char reserved[4];
} SMsgAVIoctrlGetNightVisionReq;

  IOTYPE_USER_IPCAM_GET_NIGHTVISION_RESP = 0x9007;

  • Send from Device to App
  • Device informs App of the result of night vision switch query.
  • IOCtrl data:
typedef struct
{
unsigned int result;             // return 1 if open, otherwise close
unsigned char reserved[4];
} SMsgAVIoctrlGetNightVisionResp;

 

2.50 Set device night vision status

IOTYPE_USER_IPCAM_SET_NIGHTVISION_REQ = 0x9008;

  • Send from App to Device
  • App informs Device to set night vision switch.
  • IOCtrl data:
typedef struct
{
unsigned int isOn;        // 1 open, 0 close
unsigned char reserved[4];
} SMsgAVIoctrlSetNightVisionReq;

  IOTYPE_USER_IPCAM_SET_NIGHTVISION_RESP = 0x9009;

  • Send from Device to App
  • Device informs App of the result of night vision switch setting.
  • IOCtrl data:
typedef struct
{
unsigned int result;             //  return 0 if successful, otherwise fail
unsigned char reserved[4];
} SMsgAVIoctrlSetNightVisionResp;

 

2.51 Get device DST status

IOTYPE_USER_IPCAM_GET_SUMMERTIME_REQ = 0x9010;

  • Send from App to Device
  • App informs Device to check the daylight saving time switch.
  • IOCtrl data:
typedef struct
{
unsigned char reserved[4];
} SMsgAVIoctrlGetSummerTimeReq;

  IOTYPE_USER_IPCAM_GET_SUMMERTIME_RESP = 0x9011;

  • Send from Device to App
  • Device informs App of the result of daylight saving time switch query.
  • IOCtrl data:
typedef struct
{
unsigned int result;             // return 1 if open, otherwise close
unsigned char reserved[4];
} SMsgAVIoctrlGetSummerTimeResp;

 

2.52 Set device DST status

IOTYPE_USER_IPCAM_SET_SUMMERTIME_REQ = 0x9012;

  • Send from App to Device
  • App informs Device to set the daylight saving time switch.
  • IOCtrl data:
typedef struct
{
unsigned int isOn;        // 1 open, 0 close
unsigned char reserved[4];
} SMsgAVIoctrlSetSummerTimeReq;

  IOTYPE_USER_IPCAM_SET_SUMMERTIME_RESP = 0x9013;

  • Send from Device to App
  • Device informs App of the result of daylight saving time switch setting.
  • IOCtrl data:
typedef struct
{
unsigned int result;             // return 0 if successful, otherwise fail
unsigned char reserved[4];
} SMsgAVIoctrlSetSummerTimeResp;

2.53 Get ICCID information

IOTYPE_USER_IPCAM_GET_CARD_ICCID_REQ = 0x30000004;

  • Send from App to Device
  • App get the device's ICCID information
  • IOCtrl data:
typedef struct
{
unsigned int channel;  // Camera channel
unsigned char reserved[4];
}SMsgAVIoctrlGetCardICCIDReq;

IOTYPE_USER_IPCAM_GET_CARD_ICCID_RESP = 0x30000005;

  • Send from Device to App
  • Device informs App of the information of ICCID.
  • IOCtrl data:
typedef struct
{
unsigned int result; // return 0 if success, otherwise failed
unsigned char ICCID[40];
unsigned char reserved[4];
}SMsgAVIoctrlGetCardICCIDResp;

2.54 Get certKey and profileVer

IOTYPE_USER_IPCAM_GET_PROFILE_REQ = 0x9014;

  • Send from App to Device
  • App get the device's certKey and profileVer information
  • IOCtrl data:
typedef struct
{
unsigned char reserved[8];
}SMsgAVIoctrlGetProfileReq;

IOTYPE_USER_IPCAM_GET_PROFILE_RESP = 0x9015;

  • Send from Device to App
  • Device informs App of the information of certKey and profileVer.
  • IOCtrl data:
typedef struct
{
unsigned char certKey[40];  
unsigned char profileVer[20]; //profile version
unsigned char reserved[8];
} SMsgAVIoctrlGetProfileResp;

Three. Sample

3.1 APP implementation obtains light status instance through Command

  • Define Command and structure
  • Get the switch status Command definition: IOTYPE_GET_LED_REQ = 0x30000001
  • Get the definition of the switch state structure: @struct SMsgAVIoctrlGetLedReq;
  typedef struct
  {
  int channel;       //Current channel number
  unsigned char reserved[4];
  }SMsgAVIoctrlGetLedReq;
  • Device end reply APP switch status Command definition: IOTYPE_GET_LED_RESP = 0x30000002
  • Device side reply APP switch status structure definition: @struct SMsgAVIoctrlGetLedResp;
  typedef struct
  {
  int res;                               // 0:success,  others failed
  unsigned char isOnOff;        // 0:on    1:off
  unsigned char reserved[3];
  }SMsgAVIoctrlGetLedResp;

3.2 Method of sending and receiving Command on IOS

  • Method of sending Command

    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);
  • Callback method for receiving Command
- (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->isOnOff;
    }
}

3.3 How does Android convert bytes into a java object

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 = "";//custom bytes ex: 32 bytes
}
/**
 * byte to people
 *
 * @param data src bytes length > 44
 * @return people
 */
private People byteToPeople(byte[] data) {
    if (data.length < 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 & bytes[beginPos]) | ((0xff & bytes[beginPos + 1]) << 8));
}

private int byteArrayToInt(byte[] bytes, int beginPos) {
    return (0xff & bytes[beginPos]) | (0xff & bytes[beginPos + 1]) << 8 | (0xff & bytes[beginPos + 2]) << 16 | (0xff & bytes[beginPos + 3]) << 24;
}

private long byteArrayToLong(byte[] bytes, int beginPos) {
    long l = 0;
    for (int i = 0; i < 4; i++) {
            l = l | ((0xffL & bytes[beginPos + i]) << (8 * i));
    }
    return l;
}

页面列表

ITEM_HTML