P6SCoreSDK(iOS)

Contents

 

 

 

SDK integration

 

SDK initialization

 

 

P2P Connection

 

Add device process

 

 

 

Live streaming

 

 

SD card/hard disk playback

 

Domestic cloud storage playback

 

Device connection network

 

 

Local area network detection

 

Basic equipment configuration

 

Network Access

 

QR Code Network Setup Process Explanation

 

QR Code Network Setup

 

Low-Power Device

 

SDK integration

Integrated Development Environment

1 Import libP6SCore.a ,libEchoSoftUICore.a, libEchoSoftAPICore.a,libPPCS_API_64.a and P6Score, libEchoSoftUICore,libEchoSoftAPICore,FFmpeg-iOS folder and EchoP2Pclient.h EchoP2Pclient.mm file into the project

image-20231101145722611

  1. Import libiconv.tbd,libz.tbd,libc++.tbd,Uikit.framework,Foundation.framework,VideoToolbox.framework

image-20231101145833417

3.Set Enable Testability in the Build settings to No

image-20231101145939922

 

 

 

SDK initialization

Initialization

1.Function description

2.Parameter

ParameterDescription
userIduse @""
codeStr1use @""
codeStr2use @""
  1. Return value

    • There is no

4.Simple sample code

 

Deinitialization

1.Function description

2.Parameter:

3.Return value:

4.Simple sample code:

 

 

 

P2P Connection

P2P ConnectionP2P Connection

  1. Function description

    • Obtain the connection status of APP and device P2P

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Before making a P2P connection with the device, this interface needs to be called to detect the P2P connection status between the APP and the device.

      Usually used with the following functions

  3. Parameter

    ParameterInstructions
    in_strDIDDevice DID
  4. Return value

    Return valueInstructions
    The connection status of the device(Int)0 indicates that the P2P connection is successful, non-zero indicates that the P2P connection fails
  5. Simple sample code

Connect device(P2P)

  1. Function description

    • Establish a P2P connection with the device

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Before interacting with the device, a P2P connection must be established with the device. Calling this method allows the APP and the device to perform a P2P connection
    • After calling this method, you need to use the (-(int) checkStatus:(NSString*) in_strDID) method to check whether the P2P connection is successful
    • Interact with the device after detecting the successful P2P connection
  3. Parameter

    ParameterInstructions
    DIDDevice DID
  4. Return value

    • There is no
  5. Simple sample code

Log in device

Common equipment

  1. Function description

    • Log in to the device and authenticate (device without sharing)

    • Declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • The APP interacts with the device. After the APP and the device successfully establish a P2P connection, you need to log in to the device
    • Devices without sharing use this interface to log in to the device
  3. Parameter

    ParameterInstructions
    in_strDIDDevice DID
    strUserNameusername
    strUserpasswordpassword

     

  4. Return value(notification return code:RET_VALIDATION_PASSWORD)

    Return valueInstructions
    AutoBindWhether to support reset unbinding, 0: not supported, 1: supported
    DeviceSharedWhether to support sharing, 0: not supported, 1: supported
    authok: authentication succeeded, failed: authentication failed
    authContactIddevice did
    diddevice did
    is_pwd_correctWhether the device password is correct, 0: wrong, 1: correct (only some devices support)
    keycommand number
    resultok: authentication succeeded, failed: authentication failed
  5. Simple sample code

Share device

  1. Function Description

    • Log in to the device and authenticate (device sharing)

    • Declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • All devices need to perform V1 authentication after the P2P connection is successful, and then judge whether V2 authentication is required according to the result of V1 authentication

    • If the V1 authentication interface returns AutoBind as 1 (supports reset unbinding) or DeviceShared is 1 (supports sharing), you need to call the V2 authentication interface
  3. Parameter

    ParameterInstructions
    in_strDIDdevice did
    strUserNamedevice account
    strUserpassworddevice password
    secretStringDevice authentication key Obtain the device list after logging in to the device, and obtain the value corresponding to the encrpt field as secretString. If encrpt is empty, use the value of the attr1 field as secretString
    isOWNWhether it is the owner (share and reset the unbound device, there is a relationship between the owner and the guest, if it is the owner, pass YES, and NO is the guest)
  4. Return value(notification return code:RET_VALIDATION_PASSWORDV2)

    Return valueInstructions
    keycommand number
    resultok: authentication succeeded, failed: authentication failed
    DeviceSharedWhether to support sharing, 0: not supported, 1: supported
    authok: authentication succeeded, failed: authentication failed
    authContactIddevice did
    diddevice did
  5. Simple sample code

 

Disconnect device

  1. Function Description

    • Close P2P connection

    • Declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Disconnect the P2P connection of the device
  3. Parameter

    ParameterInstructions
    in_strDIDdevice DID

     

  4. Return value

    • There is no
  5. Simple sample code

Get the last online time of the device

  1. Function Description

    • Returns the time the device was last online

    • Declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • The last online time of the device can be obtained
  3. Parameter

    ParameterInstructions
    in_strDIDDevice DID
  4. Return value

    Return valueInstructions
    The number of seconds since the device was last online from the current timestampUse the current timestamp - return value = offline timestamp (-1: the device has never been online or was online 1 year ago, 0: means the device was just online)
  5. Simple sample code

Query the online status of the device on the server

  1. Function description

    • Query the online status of the device on the server

    • Declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Query the online status of the device on the server

    • Generally, first query the online status of the device on the server

      • When the device is online, establish a P2P connection with the device

      • If the device is not online, get the offline time of the device

         

  3. Parameter

    ParameterInstructions
    DIDStringDevice DID
    onlineStatuCallbackDevice state callback
     queryResult device status >0 device online -6 device offline -3 query timeout
     DID Device DID
  4. Return value

    • There is no
  5. Simple sample code

 

 

 

Add device process

一、Interface Description

P2P connection

  1. Function Description

    • Connect device

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • All device operations can only be called after the P2P connection is successful
  3. Parameter

    ParameterInstructions
    DIDDevice did
  4. Return value

    • There is no
  5. Simple sample code

 

Get device information

  1. Function Description

    • Get device information

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Called after the device is connected to P2P
  3. Parameter

    ParameterInstructions
    in_strDIDDevice did
  4. Return value

    Return valueInstructions
    IDDevice did (this field is commonly used)
    dwSrcIDDevice did
    Keycommand number
    modelDevice model
    versionDevice version number
    resultDicdictionary
    resultDic key valueInstructions
    channelTotal number of channels
    dev_typeDevice type, such as: IPC, NVR, HVR, etc.
    limit 
    macmac address (this field is invalid and must be obtained through other interfaces)
    serial_noserial number
    verdor 
    zwp2p_verzwp2p protocol version
  5. Simple sample code

 

V1 authentication

  1. Function Description

    • The device performs V1 authentication

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Called after the device is connected to P2P
  3. Parameter

    ParameterInstructions
    in_strDIDdevice did
    strUserNamedevice username
    strUserpassworddevice password
  4. Return value(notification return code:RET_VALIDATION_PASSWORD)

    Return valueInstructions
    AutoBindWhether to support reset unbinding, 0: not supported, 1: supported
    DeviceSharedWhether to support sharing, 0: not supported, 1: supported
    authok: authentication succeeded, failed: authentication failed
    authContactIddevice did
    diddevice did
    is_pwd_correctWhether the device password is correct, 0: wrong, 1: correct (only some devices support)
    keycommand number
    resultok: authentication succeeded, failed: authentication failed
  5. Simple sample code

 

Query the device owner

  1. Function Description

    • Query the status of the device owner
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • GET request, query whether the device has an owner, if there is an owner, the device cannot be added, if there is no owner, it needs to become the owner
  3. Parameter

    ParameterInstructions
    didDevice DID
  4. Return value

    Return valueInstructions
    codereturn code 200 means success
    datadictionary
    errorprompt information
    Return valueInstructions
    status1-Currently has master information (the current database has master information but does not match the master Parameters; the peer database has no master information) 2-The peer has master information (the current database has no master information, but the peer database has this master information) 3- No owner information (the current database has no owner information, and the peer database has no owner information) 4- I am the owner (the current database has owner information and the account matches)
    diddevice did
  5. Simple sample code

 

Add device to user device list

  1. Function Description

    • Add device to user list
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Before the device is bound, it must be added to the user device list. Devices that do not support sharing or reset unbinding do not need to be bound
  3. Parameter

    ParameterInstructions
    diddevice did
    snEnterprise serial number
    aliasdevice alias
  4. Return value

    Return valueInstructions
    dataWhen the code is 200, return the added device table id
    codereturn code 200 means success
    errorprompt information
  5. Simple sample code

 

Get device Scode code

  1. Function Description

    • Get device Scode code

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Devices that support reset and unbinding only have Scode codes, and devices that can obtain Scode codes need to be unbound first
    • The data returned by the device is all xml text, which needs to be converted into key-value pairs by itself
  3. Parameter

    ParameterInstructions
    didDevice did
  4. Return value(notification return code:RET_HTTP_API)

    Return valueInstructions
    SCodeVaildtrue: with Scode, false: without Scode
    SCodeWhen SCodeValid is true, you can get the Scode code
    __namecommand name
  5. Simple sample code

 

Upload device Scode code

  1. Function description

    • Upload device Scode code

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Devices that support reset and unbind get a new Scode code after binding, upload it to the device, and do V2 authentication after the upload is successful
    • What needs to be uploaded to the device is xml text
  3. Parameter

    ParameterInstructions
    SCodeScode
  4. Return value(notification return code:RET_HTTP_API)

    Return valueInstructions
    __nameUnified return ResponseStatus of PUT command
    requestURLrequested URL
    statusCodeStatus code, 0 The request is successful
  5. Simple sample code

 

Unbind the device

  1. Function Description

    • Device reset unbind
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • When a device that supports reset and unbinding can obtain the Scode code, it must first unbind the device
  3. Parameter

    ParameterInstructions
    didDevice did
    sCodeDevice Scode
  4. Return value

  5. Simple sample code

 

Only supports shared device binding

  1. Function description

    • Support shared device binding
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Devices that only support sharing are bound to become masters differently from devices that support reset and unbind
    • Unbound devices that support reset must support sharing
    • Do V2 authentication directly after becoming the master
  3. Parameter

    ParameterInstructions
    diddevice did
    snEnterprise serial number
  4. Return value

    Return valueInstructions
    dataDevice identity encryption information
    codereturn code 200 means success
    errorprompt information
  5. Simple sample code

 

Device binding that supports reset unbinding

  1. Function Description

    • Support sharing and reset unbound device binding
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • Devices that only support sharing are bound to become masters differently from devices that support reset and unbind
    • Unbound devices that support reset must support sharing
    • After becoming the owner, you need to get the Scode code of the server and upload it to the device. After the upload is successful, do V2 authentication
  3. Parameter

    ParameterInstructions
    didDevice did
    snEnterprise serial number
  4. Return value

    Return valueInstructions
    codereturn code 200 means success
    datakey value pair
    errorprompt information
    data key-value pairInstructions
    sCodeUnbind the scode used
    encryptDevice authentication information
    iddevice table id
  5. Simple sample code

 

V2 authentication

  1. Function description

    • V2 authentication

    • Declaration class

  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • The device identity encryption information passed in by the sharing device is supported as secretString
    • The device authentication information passed in by the unbound device that supports reset is secretString
  3. Parameter

    ParameterInstructions
    in_strDIDDevice did
    strUserNamedevice username
    strUserpassworddevice password
    secretStringDevice authentication key
    isOWNIs it the master
  4. Return value(notification return code:RET_VALIDATION_PASSWORDV2)

    Return valueInstructions
    keycommand number
    resultok: authentication succeeded, failed: authentication failed
    DeviceSharedWhether to support sharing, 0: not supported, 1: supported
    authok: authentication succeeded, failed: authentication failed
    authContactIddevice did
    diddevice did
  5. Simple sample code

 

Get device list

  1. Function description

    • Get device list
  2. Describe contextual relationships (depending on interfaces or working with those interfaces)

    • After the V1 authentication is successful, go to get the device list, get the data corresponding to did from the device list, first get the encrypt data from the extracted data, if encrypt is not empty, use the encrypt data as secretString for V2 authentication, If encrypt is empty, attr1 data will be taken later, if attr1 is not empty, attr1 data will be used as secretString for V2 authentication, if attr1 is also empty, V2 authentication cannot be performed
  3. Parameter

    ParameterInstructions
    snEnterprise serial number
  4. Return value (entries key-value pair)

    ReturnInstructions
    dataContains entries key-value pairs
    codereturn code 200 means success
    errorprompt information
    entries key-value pairInstructions
    iddevice table id
    dtypeDevice type [1-ipc;2-nvr;3-dvr;4-panorama;5-alarm box;6-low power consumption]
    snEnterprise serial number
    accountuser account
    diddevice did
    pwddevice password
    aliasdevice alias
    usernameusername
    auth 
    attr1Device verification information
    attr2List of functions supported by device sharing
    attr3Device identity information (null is the old device; 0 is the master device; other numbers are guest devices)
    attr5multipurpose field
    createTime 
    hostDevice owner account information
    shareNumberShared quantity
    encrptDevice verification information
    passwordHintWhether to prompt to change the password (false-no prompt; true-prompt)

     

  5. Simple sample code

 

二、flow chart

三、Flow Description

 

 

Live streaming

Live video playback

Set playback proxy

  1. Function description

    • Set the playback agent to recall the decoded data to the upper layer

    • Declaration class

  2. Describe the context (dependent interfaces or interfaces used with))

    • use(-(void) sendOpenStream:(NSString*) in_strDID withChannel:(int)iChannel withQuality:(int)iQuality;)The proxy method must be set first
    • The following proxy methods are usually used

  3. Parameter

    ParameterExplain
    delegateCameraThe proxy object complies with the Delegatecamera agreement
    in_strDIDDevice did
  4. Return value

    • none
  5. Simple sample code

Playback agent (YUV data callback)

  1. Function description

    • Video playback proxy method

    • Declaration class

  2. Describe the context (dependent interfaces or interfaces used with)

    • This agent will be used for all video playback
    • This agent throws the decoded YUV data to the application layer
  3. Parameter

    ParameterExplain
    pFrameYUVDataDecoded YUV data
    widthWidth of video
    heightVideo height
    objNot currently used
    iChannelDevice channel number starts from 0
    strDidDevice did number
  4. Return value

    • none
  5. Simple sample code

Render YUV data (set width and height)

  1. Function description

    • Set the width and height of the playback video

    • Declaration class

  2. Describe the context (dependent interfaces or interfaces used with)

    • Usually, it is used together with rendering copy data, setting width and height, and displaying video data
    • In the proxy method of playing proxy and recalling video decoding YUV, render the data of playing YUV
    • First copy the YUV data, then set the width and height of the playback view, and finally play the display video data
  3. Parameter

    ParameterExplain
    wWidth of video
    hVideo height
    dataDecoded YUV data (pFrameYUVData in the playback agent is passed here)
  4. Return value

    • none
  5. Simple sample code

 

Render YUV data (display video data)

  1. Function description

    • Display video data on the playback view

    • Declaration class

  2. Describe the context (dependent interfaces or interfaces used with)

    • Usually, it is used together with rendering copy data, setting width and height, and displaying video data
    • In the proxy method of playing proxy and recalling video decoding YUV, render the data of playing YUV
    • First copy the YUV data, then set the width and height of the playback view, and finally play the display video data
  3. Parameter

    ParameterExplain
    dataCall the - (void) copyyuv420pdata: (void *) data width: (nsinteger) w height: (nsinteger) h method to copy the data, and then pass it here to nil
    wWidth of video
    hVideo height
  4. Return value

    • none
  5. Simple sample code

 

End playback

  1. Function description

    • End playback

    • Declaration class

  2. Describe the context (dependent interfaces or interfaces used with)

    • This method is usually called to close playback when the playback ends or when the playback interface jumps out
  3. Parameter

    ParameterExplain
    DIDDID DID of the device
    iChannelChannel number, starting from 0
  4. Return value

    • none
  5. Simple sample code

 

Playback process

  1. Set playback proxy
  2. Start playing
  3. Render video with OpenGLView20
  4. Turn off playback

 

Live Audio Playback

Turn on/off audio

  1. Function Description

    • Turn on/off the audio function

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Turn on/off the audio function first, then turn on/off the audio switch, and finally turn on/off the audio decoding
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    iChannelChannel number, starting from 0
  4. Return value

    • none
  5. Simple sample code

 

Audio switch

  1. Function Function Explain

    • Set the sound playback switch, generally turn on the sound first and then turn on the audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Set the sound playback switch, generally turn on the sound first and then turn on the audio decoding
  3. Parameter

    ParameterExplain
    bIsValueYES Turn on the sound NO Turn off the sound
  4. Return value

    • none
  5. Simple sample code

Audio decoding switch

  1. Function Function Explain

    • Whether to enable audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually used with -(void) setPlayAudioSwitch:(BOOL)bIsValue
  3. Parameter

    ParameterExplain
    bIsValueYES enable audio decoding NO disable audio decoding
  4. Return value

    • none
  5. Simple sample code

 

Live screenshot

Screenshot proxy implementation

  1. Function Function Explain

    • Whether to turn on audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Create an OpenGLView20 instance and set the OpenGLViewDelegate proxy
  3. Parameter

    • none
  4. Return value

    • none
  5. Simple sample code

 

Live video

Turn on/off recording

  1. Function Function Explain

    • Whether to turn on audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually used with -(void) setPlayAudioSwitch:(BOOL)bIsValue
  3. Parameter

    ParameterExplain
    bIsRecodYES open recording NO close recording
    pathVideo file storage path
    strDIDDevice did
    iChannelDevice channel number, starting from 0
  4. Return value

    • none
  5. Simple sample code

 

Intercom

Audio initialization

  1. Function Function Explain

    • Audio initialization, set in appdelegate
    • system class
  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • To implement the intercom function, the audio must be initialized first
  3. Parameter

    • none
  4. Return value

    • none
  5. Simple sample code

 

Turn on/off the audio collection function on the mobile phone

  1. Function Function Explain

    • Turn on/off the audio collection function on the mobile phone

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Turn on/off the audio collection function of the mobile phone, and use it at the same time as starting the intercom and controlling the intercom
  3. Parameter

    ParameterExplain
    strDidDevice did
  4. Return value

    • none
  5. Simple sample code

 

IntercomStart intercom

  1. Function Function Explain

    • start intercom

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Turn on/off the audio collection function of the mobile phone, and use it at the same time as starting the intercom and controlling the intercom
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    channelDevice channel number, starting from 0
  4. Return value

    • none
  5. Simple sample code

 

IntercomControl intercom

  1. Function Function Explain

    • control intercom

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Turn on/off the audio collection function of the mobile phone, and use it at the same time as starting the intercom and controlling the intercom
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    isSwitchYES: Enabled NO: Disabled
  4. Return value

    • none
  5. Simple sample code

 

Toggle resolution

Get Video Quality

  1. Function Function Explain

    • Get Video Quality

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Get the video resolution before setting the resolution
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    iChannelDevice channel number, starting from 0
  4. Return value(Notification return code:RET_GET_QUALITY)

    Return valueExplain
    resultprompt information
    dataClarity data, need to be converted to ZWP2P_QUALITY structure for processing
    keynotification return code
    DIDDevice did
  5. Simple sample code

 

Set video quality

  1. Function Function Explain

    • set video quality

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Get the video resolution before setting the resolution
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    iChannelDevice channel number, starting from 0
    stDeviceQualityClarity (uploaded as a structure)
  4. Return value

  5. Simple sample code

 

PTZ control (PTZ control)

PTZ function diagram (optional implementation)

PTZ capability Explain

The development of this function requires a certain understanding of device capabilities, PTZ capabilities, and some P2P commands, as well as a certain understanding of the meaning of the parameters returned by each interface.

  1. First request to obtain the device capability, PTZ capability, and device DeviceInfo information interface
  2. Professional dome cameras are preset points, not scene memory; consumer products, head shaking machines, and wifi ball PTZ are scene memory. (Device capability supports motor display scene memory)
  3. The following 16 display presets, regardless of whether the motor is supported (RL/7920PHM-AI, 523RL/7920PHM-AI, 345T/7920PHM-AI, 46F/7920PHM-AI, 362/7920PHM-AI, RL/WG/7920PHM-AI , 523RT/WG/7920PHM-AI, 523RL/NL/7920PHM-AI,RL/7930PHM-AI, 523RL/7930PHM-AI, 345T/7930PHM-AI, 46F/7930PHM-AI, 362/7930PHM-AI, RL/WG /7930PHM-AI, 523RT/WG/7930PHM-AI, 523RL/NL/7930PHM-AI)
  4. If the PTZ capability is obtained, the PTZ capability shall prevail. If the PTZ capability cannot be obtained, the equipment capability shall prevail.

 

Get PTZ capability

  1. Function Function Explain

    • Get PTZ capability

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Before using the PTZ function, you must first obtain the PTZ capability
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
  4. Return value

    Return valueExplain
    Focusfocus
    Supporttrue: focus is supported false: focus is not supported
    Return valueExplain
    Tracktrack
    Supporttrue: Tracks are supported false: Tracks are not supported
    CountNumber of tracks
    Return valueExplain
    AutoScanauto scan
    Supporttrue: auto scan is supported false: auto scan is not supported
    Return valueExplain
    Apertureaperture
    Supporttrue: Aperture is supported false: Aperture is not supported
    Return valueExplain
    PresetPreset
    Supporttrue: support preset point false: not support preset point
    CountThe number of APP preset points (supporting setting point number 1-255, some devices 1-48)
    APPCountNumber of APP preset points (Advanced preset function only available when APPCount is 256)
    Return valueExplain
    ZoomZoom
    Supporttrue: zooming is supported false: zooming is not supported
    AFTrackTracking zoom (Support, true: support tracking zoom false: not support tracking zoom)
    Return valueExplain
    GuardWatchman's position (watchman)
    Supporttrue: guard bit is supported false: guard bit is not supported
    Return valueExplain
    AuxControlAccessibility
    Supporttrue: Accessibility is supported false: Accessibility is not supported
    Menumenu(Support, true: support menu false: not support menu)
    LightLighting (Support, true: supports lighting false: does not support lighting)
    WipeWiper (Support, true: support wiper false: do not support wiper)
    HeatHeater (Support, true: supports heater false: does not support heater)
    FanFan (Support, true: support fan false: do not support fan)
    PowerPower switch (Support, true: support power switch false: do not support power switch)
    Return valueExplain
    PanTiledirection
    Supporttrue: orientation is supported false: orientation is not supported
    UpDownUp and down (Support, true: support up and down false: do not support up and down)
    LeftRightLeft and right (Support, true: support left and right false: do not support left and right)
    ExtendUpper left, lower left, upper right, lower right (eight directions) (Support, true: supports eight directions false: does not support eight directions)
    OneStepSingle-step control (Support, true: support single-step control false: do not support single-step control)
    Return valueExplain
    Cruisecruise
    Supporttrue: support watch cruise false: do not support watch cruise
    CountNumber of cruise lines
  5. Simple sample code

 

Get device capabilities

  1. Function Function Explain

    • set video quality

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • When the ptz capability is not obtained, use the device capability to control the gimbal
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
  4. Return value(仅Explain对云台有效的字段)

    Return valueExplain
    PTZ_Advance_CruiseAdvanced cruise function
    PTZ_Advance_WatchAdvanced Overwatch Features
    ShakingHeadWhether it is a head-shaking machine (support, true: yes, false: no. The head-shaking machine removes the watch, cruise, optical zoom, and optical focus functions, and the preset point function adopts the scene memory mode)
    Motormotor
  5. Simple sample code

 

operation

  1. Function Function Explain

    • Set the camera to rotate up and down, left and right, zoom, focus

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • To obtain the ptz ability first
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    nSpeedSpeed (support 0-9)
    nLastTimeDuration (this field is invalid, subject to action)
    iChannelChannel number, starting from 0
    directionAdjustment type (zoomin: zoom out, zoomout: zoom in, focus_near: focus near, focus_far: focus far, up: turn up, left: turn left, down: turn down, right: turn right)
    actionPTZ controls the rotation of the PTZ of the device through action start or stop (after setting start to start rotation, stop must be set to stop rotation, and the two need to be used together)
  4. Return value

  5. Simple sample code

 

Turn watch on/off

  1. Function Function Explain

    • Turn watch on/off

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • To obtain the ptz ability first
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    param@"Param1=1" (fixed writing method)
  4. Return value

  5. Simple sample code

 

Set/recall preset position

  1. Function Function Explain

    • Set/recall preset position

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • To obtain the ptz ability first
  3. Parameter

    ParameterExplain
    in_strDIDDevice did
    param"Param1=%d" is the default number. The range of values is 0-127.
    ChannelIDChannel number, starting from 1
  4. Return value

  5. Simple sample code

SD card, hard disk playback

Obtain the video information of a certain month


  1. Function Description

    • Query the days of a month when the SD card/hard disk store video clips

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • It's for the calendar. There's video footage of those days

  3. Parameter

    Parameterinstructions
    in_strDIDDevice did
    strRecordTypeVideo type (all: all types of video; time: regular timing video; motion: motion detection video; -Leonard: It's an alarm video.
    strChannelChannels that require access to the video (all: all channels; If the videos of all channels are not obtained, the binary mode is used to indicate the videos of which channels are to be obtained. 1111000011110001 Each character indicates whether the current query is required,1 indicates yes, and 0 indicates no. Even 64 channel devices can support it. In this example,9 channels such as 1,2,3,4,9,10,11,12,16 need to be queried.)
    iYearYear: @"2022", (20220401) query 2022
    iMonthMonth: @"04", (20220401) queried video in April 2022
  4. Return value

    Return valueinstructions
    DIDDevice did
    key#define RET_GET_RECORD_INFO_BY_MONTH 400 // Get monthly video information
    query_result32位(00000000000001100000000000000000),0: there is no video recording. 1: indicates the day on which the video segment is available
    resultok indicates that success is returned
  5. Simple sample code

 

 

Obtain the video information of a certain day


  1. Function description

    • Query SD card/hard disk video clips of a specific date

    • Declaration class

  2. State the context (depending on or with which interfaces)

    • Used as a calendar display that has video footage of the day

  3. Parameter

    Parameterinstructions
    in_strDIDDevice did
    strRecordTypeVideo type (all: all types of video; time: regular timing video; motion: motion detection video; -Leonard: It's an alarm video.
    strChannelThe channels to obtain the video are from (all: all channels; If the videos of all channels are not obtained, the binary mode is used to indicate the videos of which channels are to be obtained. 1111000011110001 Each character indicates whether the current query is required,1 indicates yes, and 0 indicates no. Even 64 channel devices can support it. In this example,9 channels such as 1,2,3,4,9,10,11,12,16 need to be queried.)
    iYearYear: @"2022", (20220401) query 2022
    iMonthMonth: @"04", (20220401) queried video in April 2022
    iDayDay: @"01", (20220401) query the day video on April 1, 2022
  4. Return value

    Return valueinstructions
    resultok indicates that success is returned
    countTotal number of video clips per day
    record_listAn array of daily video fragments
    channelThe channel number of the video
    typeDaily video segments: normal: manual video recording, motion: motion detection video recording, ai: humanoid detection video recording, and time: scheduled video recording)
    start_timeDay start time of video segment
    end_timeEnd time of video segment
  5. Simple sample code

 

 

Start playing back


  1. Function Description

    • From the specified time, play SD card/hard disk storage video

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • SD card/hard disk like playback before you want to set the agent usually with(-(void) setDelegateCamera:(NSString*) in_strDID withDelegateCamera:(id ) delegateCamera;)Use together
    • The playback proxy must be set up before calling this method
  3. Parameter

    Parameterinstructions
    in_strDIDDevice DID
    strRecordTypeVideo type (all: all types of video; time: regular timing video; motion: motion detection video; -Leonard: It's an alarm video.
    strChannelChannels that require access to the video (all: all channels; If the videos of all channels are not obtained, the binary mode is used to indicate the videos of which channels are to be obtained. 1111000011110001 Each character indicates whether the current query is required,1 indicates yes, and 0 indicates no. Even 64 channel devices can support it. In this example,9 channels such as 1,2,3,4,9,10,11,12,16 need to be queried) (for instruction sending)
    strStartTimePlayback start time: @"20220415 00:00:00"
    strEndTimePlayback end Time: @"20220415 03:37:21"
    iChannelChannel number to play back (used to select the decoder thread when opening the stream)

     

  4. Return value

    • There is no
  5. Simple sample code

 

 

Setting up the Playback Agent


  1. Function Description

    • Set the SD card/hard disk storage video playback agent, used to return the data after the mediation code to the upper layer

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Call (-(void) sendPlayBackStart:(NSString) in_strDID withRecordType:(NSString)strRecordType withChannel:(NSString)strChannel withStartTime:(NSString)strStartTime withEndTime:(NSString*)strEndTime IChannel withChannel: (int * * * *);) The proxy method must be set first
    • The following proxy methods are typically used

  3. Parameter

    Parameterinstructions
    in_strDIDDevice did
    delegateCameraDelegateCamera (DelegATecamera)
  4. Return value

    • There is no
  5. Simple sample code

 

 

Play agent (YUV data callback)


  1. Function Description

    • Video play agent method

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • This agent is used for all video playback
    • This agent throws decoded YUV data into the application layer
  3. Parameter

    Parameterinstructions
    pFrameYUVDataDecoded YUV data
    widthWidth of video
    heightHeight of video
    objNot currently in use
    iChannelThe device channel number starts from 0
    strDidDevice DID ID
  4. Return value

    • There is no
  5. Simple sample code

 

 

 

Play agent (timestamp callback)


  1. Function Description

    • The playback agent calls back the timestamp of the playing video to the upper layer

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • When a video is playing, this proxy method calls back to the upper layer the timestamp being played
  3. Parameter

    Parameterinstructions
    lDateThe timestamp (in seconds) of the video being played
    iChannelThe device channel number starts from 0
    strDidDevice DID ID
  4. Return value

    • There is no
  5. Simple sample code

 

 

Render YUV data (copy data)


  1. Function Description

    • Copy YUV data to the playing view when the video is playing

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Usually render the copy data, set the width and height, and display the video data together
    • The playback YUV data is rendered in the playback agent's callback video decoder YUV's agent method
    • First copy the YUV data, then set the width and height of the play view, and finally play the display video data
  3. Parameter

    Parameterinstructions
    dataDecoded YUV video data
    wWidth of video
    hHeight of video
  4. Return value

    • There is no
  5. Simple sample code

 

 

Render YUV data (set width and height)


 

  1. Function Description

    • Set the width and height of the video

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Usually render copy data, set width and height, display video data used together
    • Render playback YUV data in playback agent, callback video decoder YUV agent method
    • First copy YUV data, then set the width and height of the play view, and finally play the display video data
  3. Parameter

    Parameterinstructions
    widthWidth of video
    heightHeight of video
  4. Return value

    • There is no
  5. Simple sample code

 

 

 

Render YUV data (display video data)


  1. Function Description

    • Displays video data on the play view

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Usually render the copy data, set the width and height, and display the video data together
    • The playback YUV data is rendered in the playback agent's callback video decoder YUV's agent method
    • First copy the YUV data, then set the width and height of the play view, and finally play the display video data
  3. Parameter

    Parameterinstructions
    dataAfter we call - (void)copyYUV420pData:(void *)data width:(NSInteger)w height:(NSInteger)h to copy the data, we pass nil
    wWidth of video
    hHeight of video
  4. Return value

    • There is no
  5. Simple sample code

 

 

End Playback


  1. Function Description

    • Ends playing the video stored on the SD card or hard disk

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Call this method to disable SD card/hard disk playback when you finish playing or jump out of the playing screen
  3. Parameter

    Parameterinstructions
    in_strDIDDID of the device
  4. Return value

    • none
  5. Simple sample code

 

 

Playback process


  1. Query video clips from a particular day
  2. Setting the Playback Agent
  3. Open the SD card/hard disk storage playback
  4. Render video via OpenGLView20
  5. Turn off playback after playback and set the playback agent to nil

 

 

Audio frequency playback

Playback audio switch


  1. Function Description

    • Set the sound playing switch. Generally, the sound is turned on first and then the audio decoding is turned on

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Set the sound playing switch. Generally, the sound is turned on first and then the audio decoding is turned on

  3. Parameter

    Parameterinstructions
    bIsValueYES Turn on the sound. NO Turn off the sound
  4. Return value

    • There is no
  5. Simple sample code

 

 

Frequency decoding switch


  1. Function Description

    • Whether to turn on audio decoding

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • is usually used with -(void) setPlayAudioSwitch:(BOOL)bIsValue

  3. Parameter

    Parameterinstructions
    bIsValueYES Enables audio decoding. NO Disables audio decoding
  4. Return value

    • There is no
  5. Simple sample code

 

 

Positioning of playback

  1. Function Description

    • When the SD card/hard disk is playing, drag the timeline to specify a time to play the video

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Usually when you are playing a video on your SD card/hard drive, drag the timeline to specify a time to play the video
  3. Parameter

    Parameterinstructions
    strTimeThe format of playback time is "yyyyMMdd HH:mm:ss".
    in_strDIDDevice did
  4. Return value

    • There is no
  5. Simple sample code

 

 

Double speed playback

  1. Function Description

    • The speed at which the SD card/hard disk stores the video is being played changes

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Usually when playing the SD card/hard disk storage video, click the double speed button to change the playback speed
  3. Parameter

    Parameterinstructions
    in_strDIDDevice did
    strSpeedPlayback speed (1/16; 1/8; A quarter; 1/2; 1 constant speed; 2 times the speed; 4, 4 times the speed; 8 8 times the speed; 16 16 times speed)
  4. Return value

    • There is no
  5. Simple sample code

 

 

Play back the screenshot

  1. Function Description

    • OpenGLView20 proxy method that sends the screenshots of OpenGLView20 back to the upper layer

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Set the proxy method of OpenGLView20 to play view first

    • Then setting the property isScreenShotting to YES will screen the image once and have the image returned to the top by the -(void) onscreenshotting method :(UIImage*)image

  3. Parameter

    Parameterinstructions
    imageScreenshot of the picture
  4. Screenshot of the picture

    • There is no
  5. Simple sample code

 

 

Play back the video

  1. Function Description

    • Record the playing SD card/hard disk storage video

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • Call this method to disable SD card/hard disk playback when you finish playing or jump out of the playing screen
  3. Parameter

    Parameterinstructions
    bIsRecodYES Start recording. NO End recording. When recording is closed, path sends nil
    pathPath to save the video Absolute path file name NGLSPE-368863-SBXNE*MOV_20220407_144005_CH01_368863.prv, use the suffix.prv
    strDIDDID of the device
    iChannelThe channel number of the device starts from 0
  4. Return value

    • There is no
  5. Simple sample code

 

 

Video download

  1. Function Description

    • Download video clips stored on SD card/hard disk. Only single video clips can be downloaded

    • Declaration class

  2. Specify the context (depending on or with which interfaces)

    • First obtain the SD card/hard disk video clips of a certain day (see Query Video clips of the same day)
    • Then select one of the desired clips to download
  3. Parameter

    Parameterinstructions
    in_strDIDdid of the device
    filePathDownload file object, file path on the device
    fileTypeFile saving type
    savePathFile saving path
  4. Return value

    • There is no
  5. Simple sample code


 

Domestic cloud storage playback

Remarks: ObsManager must be initialized before using cloud storage, and then complete the authentication operation

cloud storage initialization

  1. Function Function Explain

    • Initialize the domestic cloud storage singleton object

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • The use of cloud storage related content is required to obtain a single instance through this method
  3. Parameter

    • none
  4. Return value

    Return valueExplain
    ObsManager instantiation objectObsManager singleton object
  5. Simple sample code

Cloud storage authentication

  1. Function Function Explain

    • Cloud storage login interface

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • You must log in before using cloud storage related functions
  3. Parameter

    • none
  4. Return value

    • none
  5. Simple sample code

Cloud storage video playback

Query monthly video

  1. Function Function Explain

    • Query which days of a certain month there are video clips stored in the cloud

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Used as a display on the calendar, there are video clips in those days

       

  3. Parameter

    ParameterExplain
    monthNeed to query the month of video "2022-3"
    deviceIdDevice ID of the device, obtained when cloud storage is activated
    channelchannel number
    recordTypeRecording type ALL
    streamTypeCode stream type stream=ALL all stream=0,1 multiple
    utcTime zone NSString *timeZoneStr=[[NSTimeZone systemTimeZone] name];
    successCallback for getting data
    failureCallback for request failure
  4. Return value

    Return valueExplain
    codereturn code 200 means success
    datareturn data dictionary structure
     cloudId: cloud disk Id
     storeType: type routine: cloud storage disk: cloud disk
     time: Indicates which day there is a video clip date such as "2022-04-06"
     type: recording type (manual recording 01; planned recording 02; alarm input recording 03; motion detection recording 04; PIR recording 05; human shape detection recording 06; face detection recording 07; face recognition 08;)
    messageprompt information
    propertiesreserve
    tokentoken
  5. Simple sample code

Query the video footage of the day

  1. Function Function Explain

    • Query all video time segments of a certain day

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Used as a timeline to show playback for the current day
  3. Parameter

    ParameterExplain
    userIdObtained after the user's ID account is successfully logged in
    beginTimeStart time "2019-11-29 00:00:00"
    endTimeEnd time "2019-11-29 23:59:59"
    deviceIdDevice ID of the device, obtained when cloud storage is activated
    channelchannel number
    recordTypeRecording type ALL
    streamTypeCode stream type stream=ALL all stream=0,1 multiple
    offsetTime(put into the beginTime of the last file) paging offset, // start from null by default
    limitThe number of pages, //int starts from offsetTime and then limits data
    successCallback for getting data
    failureCallback for request failure

     

  4. Return value

    Return valueExplain
    codereturn code 200 means success
    dataReturn video clip data
     duration file duration
     indexes file path
     pos pos value
     endtime file end time
     i I frame time
     fileUrl file path
     beginTime file start time
     time file start time
     dueTime Expiration
     type Type (Manual Recording 01; Planned Recording 02; Alarm Input Recording 03; Motion Detection Recording 04; PIR Recording 05; Human Shape Detection Recording 06; Face Detection Recording 07; Face Recognition 08;)
    message提示信息prompt information

     

  5. Simple sample code

start playback

  1. Function Function Explain

    • Play the cloud storage recording from the specified time

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Before cloud video playback, you need to set the proxy. It is usually used together with (- (void)OBS_SetDelegate:(id ) delegateCamera;)
    • Set playback proxy must be set before calling this method
  3. Parameter

    ParameterExplain
    DIDDevice did
    iChannelDevice channel number starts from 0
    startTimeCloud recording start time ''2022-04-07 10:55:11''

     

  4. Return value

    • none
  5. Simple sample code

 

Set playback proxy

  1. Function Function Explain

    • Set the proxy for cloud storage video playback, which is used to call back the decoded data to the upper layer

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Call (- (void)OBS_StartPlayBackWithDID:(NSString *)DID WithChannel:(NSInteger)iChannel WithStartTime:(NSString *)startTime;) must first set the proxy method
    • Typically the following proxy methods are used

       

  3. Parameter

    ParameterExplain
    delegateCameraProxy object, complying with the DelegateCamera protocol

     

  4. Return value

    • none
  5. Simple sample code

Playback agent (YUV data callback)

  1. Function Function Explain

    • Video playback proxy method

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • All video playback will use this proxy
    • This proxy is to throw the decoded YUV data to the application layer
  3. Parameter

    ParameterExplain
    pFrameYUVDataDecoded YUV data
    widthvideo width
    heightvideo high
    objcurrently unused
    iChannelDevice channel number starts from 0
    strDidDevice did number

     

  4. Return value

    • none
  5. Simple sample code

playback agent (timestamp callback)

  1. Function Function Explain

    • Play agent, call back the timestamp of the video being played to the upper layer

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • When playing the video, rely on this proxy method to call back the timestamp of the playback to the upper layer
  3. Parameter

    ParameterExplain
    lDateTimestamp of the video being played (in seconds)
    iChannelDevice channel number starts from 0
    strDidDevice did number

     

  4. Return value

    • none
  5. Simple sample code

Render YUV data (copy data)

  1. Function Function Explain

    • When the video is playing, copy the YUV data to the playback view

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually render copy data, set width and height, and display video data together
    • In the playback proxy, callback the video decoding YUV proxy method to render the playback YUV data
    • First copy the YUV data, then set the width and height of the playback view, and finally play and display the video data
  3. Parameter

    ParameterExplain
    dataDecoded YUV video data
    wvideo width
    hvideo high

     

  4. Return value

    • none
  5. Simple sample code

 

Render YUV data (set width and height)

 

  1. Function Function Explain

    • Set the playback video width and height

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually render copy data, set width and height, and display video data together
    • In the playback proxy, callback the video decoding YUV proxy method to render the playback YUV data
    • First copy the YUV data, then set the width and height of the playback view, and finally play and display the video data
  3. Parameter

    ParameterExplain
    widthvideo width
    heightvideo high

     

  4. Return value

    • none
  5. Simple sample code

 

Render YUV data (display video data)

  1. Function Function Explain

    • Display video data on playback view

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually render copy data, set width and height, and display video data together
    • In the playback proxy, callback the video decoding YUV proxy method to render the playback YUV data
    • First copy the YUV data, then set the width and height of the playback view, and finally play and display the video data
  3. Parameter

    ParameterExplain
    dataAfter calling - (void)copyYUV420pData:(void *)data width:(NSInteger)w height:(NSInteger)h method to copy the data, pass nil here
    wvideo width
    hvideo high

     

  4. Return value

    • none
  5. Simple sample code

 

End playback

  1. Function Function Explain

    • End playback of cloud storage recordings

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually when End playback or jumping out of the playback interface, this method should be called to close the playback of cloud storage
  3. Parameter

    ParameterExplain
    DIDdevice did
    iChannelchannel number, starting from 0

     

  4. Return value

    • none
  5. Simple sample code

 

playback process

  1. Query video clips of a certain day
  2. Set playback proxy
  3. Open cloud storage playback
  4. Render video via OpenGLView20
  5. Close the playback after the playback is complete, and set the playback agent to nil

Cloud storage audio playback

Playback Audio switch

  1. Function Function Explain

    • Set the sound playback switch, generally turn on the sound first and then turn on the audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Set the sound playback switch, generally turn on the sound first and then turn on the audio decoding

       

  3. Parameter

    ParameterExplain
    bIsValueYES Turn on the sound NO Turn off the sound

     

  4. Return value

    • none
  5. Simple sample code

 

Audio decoding switch

  1. Function Function Explain

    • Whether to turn on audio decoding

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually used with -(void) setPlayAudioSwitch:(BOOL)bIsValue

       

  3. Parameter

    ParameterExplain
    bIsValueYES turn on audio decoding NO turn off audio decoding

     

  4. Return value

    • none
  5. Simple sample code

 

Cloud storage playback positioning

  1. Function Function Explain

    • When the cloud storage recording is playing, drag the time axis to specify a certain time to play the recording

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually when the cloud video is playing, drag the time axis to specify to play the video at a certain moment.
  3. Parameter

    ParameterExplain
    seektimeSpecify the playing time, start playing from this time Time format "yyyy-MM-dd HH:mm:ss"
    successsuccessful callback
    failurefailed callback

     

  4. Return value

    • none
  5. Simple sample code

 

Cloud storage playback screenshot

  1. Function Function Explain

    • The proxy method of OpenGLView20, which calls back the screenshot of OpenGLView20 to the upper layer

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • First set the proxy method of OpenGLView20 to play the view

    • Then set the property isScreenShotting to YES to take a screenshot, and call back the image to the upper layer through the -(void)onScreenShotted:(UIImage*)image method

       

  3. Parameter

    ParameterExplain
    imagescreenshot image

     

  4. Return value

    • none
  5. Simple sample code

 

Cloud storage playback video

  1. Function Function Explain

    • Record a cloud storage recording that is playing

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • Usually when End playback or jumping out of the playback interface, this method should be called to close the playback of cloud storage
  3. Parameter

    ParameterExplain
    bIsRecodYES start recording NO end recording When the recording is closed, path passes nil
    pathThe absolute path of the path to save the video file name NGLSPE-368863-SBXNE*MOV_20220407_144005_CH01_368863.prv, use the suffix of .prv
    strDIDdevice did
    iChannelThe channel number of the device starts from 0

     

  4. Return value

    • none
  5. Simple sample code

 

Cloud storage video download

  1. Function Function Explain

    • Download video clips stored in the cloud, only a single video clip can be downloaded

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • First get the cloud storage video footage of a certain day (see Query the video footage of the day)
    • Then select a desired segment to download
  3. Parameter

    ParameterExplain
    DIDdevice did
    iChannelThe channel number of the device starts from 0
    downloadFileDownload file object
    progressBlockDownload progress callback totalBytesWritten The current total download size totalBytesExpectedToWrite The total file size
    completionHandlererror callback

     

  4. Return value

    • none
  5. Simple sample code

 

 

Device connection network

Scan QR code to connect to the network

  1. Connect to the WiFi of the router. 5g WiFi of the router is not supported. Enter the WiFi password

    • none
  2. Generate a QR code according to the rules and let the device recognize it. If the recognition is successful, you will hear a "Ding" sound from the device

    QR code generation rules

    • Get the SSID, password, mobile IP address of the router, generate a random port number, generate a 5-digit random code, and time zone information

    • Generate the string s=ssid&p=pwd&t=timestring&k=key&a=ipaddress+ipport through the following rules

      • The name of SSID router needs to be Base64 encoded

      • The password of PWD router needs to be Base64 encoded

      • Timestring time zone, which is converted into minutes, with "+" in the East and "-" in the West

      • English random string with key length of 5

      • IPAddress hexadecimal mobile phone IP address eg. 192.168.250.199 to C7FAA8C0

      • Ipport hexadecimal mobile phone idle port Eg. 39531 to 6B9A

      ipport needs to use the key:@ "port" of nsuserdefaults to facilitate the use of subsequent UDP ports

       

  3. App starts UDP monitoring, receives the status of devices after network distribution, and then adds devices

     

    1. Function description

      • Initialize UDP monitoring class

      • Declaration class

    2. Describe the context (dependent interfaces or interfaces used with)

      • Use this method to obtain a single instance for all content related to the distribution network UDP
    3. Parameter

      ParameterExplain
      portPort number randomly used by QR code rules:[[NSUserDefaults.standardUserDefaults objectForKey:@"port"] intValue]
      m_delegateShakeSet proxy object
      • Initialization code example

    4. Return value

      Return valueExplain
      receiveDataIntercept the following receivedata from the 0 bit of receivedata The length-1 bit is data to string.

      Example after converting to string:[P2P]S=AChKO&DID=IOTBAA-123456-JGSMR
      • Receiving method

         

AP connection network

  1. Connect to the WiFi of the router. 5g WiFi of the router is not supported. Enter the WiFi password

  2. Connect the device's WiFi to ZW_ At the beginning, the input device password is generally 01234567 by default

  3. App starts UDP monitoring, receives the status of devices after network distribution, and then adds devices

     

    1. Function description

      • Initialize UDP monitoring class

      • Declaration class

    2. Describe the context (dependent interfaces or interfaces used with)

    • The content related to using UDP of distribution network needs to obtain singletons through this method
    1. Parameter

      ParameterExplain
      isReleaseYES destroy single instance NO create single instance
      m_delegateShakeSet proxy object
      strDestIPTarget IP 255.255.255.255
      datastructural morphology,
      SHAKE_DATA stShakeData = {
      0x00,
      0x00,
      0x02,
      0x5B
      };
      iDestPortTarget port 5555
      iReceivePortReceive port 5556

       

      • Initialization code example

    2. Return value

      Return valueExplain
      dataThe next 5 bits intercepted from 462 bits of data are sessionid
      The next 32 bits intercepted from 138 bits of data are adidandcheck
      The next 19 bits intercepted from 0 bits of adidandcheck are did
      • Receiving method

         


 

 

 

Local area network detection

1.Local area network detection

  1. If the password starts with ZW_, the default password is 01234567

  2. App enables UDP monitoring, receives the status of devices after network configuration, and then adds devices

     

    1. Function Description

      • Initializes the UDP monitoring class

      • Declaration class

    2. Specify the context (depending on or with which interfaces)

    • This method is used to obtain singleton information about UDP of the distribution network
    1. Parameter

      ParameterExplain
      isReleaseYES destroys singletons. NO Creates singletons
      m_delegateShakeSetting proxy Objects
      strDestIPThe targetIP 255.255.255.255
      dataBody of structure,
      SHAKE_DATA stShakeData = {
      0x00,
      0x00,
      0x02,
      0x5B
      };
      iDestPortDestination port 5555
      iReceivePortReceiving port 5556

       

      • Initialize the code sample

    2. Return value

      Return valueinstructions
      dataIntercepting the last 5 bits from the 462 bit of data is sessionId
      Intercepting the last 32 bits from the 138 bit of data is aDIDAndCheck
      Intercepting the last 19 bits from the 0 bit of aDIDAndCheck is did
      • Method of receiving

         


 

Basic equipment configuration

Acquire equipment capability

1.Function Description Function Description

2.Parameter

ParameterExplain
in_strDIDDevice ID
MethodMethod Name

3.Return value

The return value xml is the following document

Equipment Capability Definition Document

 

Mirror image Settings

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
channelChannel Number

3.Return value

Return valueExplain
"disable"No mirror settings
"left-right"Left and right mirror image
"up-down"Up and down mirror image
"center"Central Mirror image

 

1.Function Description

2.Parameter

ParameterExplain
in_strDIDdevice did
channelChannel Number
modeMirror image mode

3.Return value

Return valueExplain
resultOk means success, others are failures

Time Setting

1.Function Description

2.Parameter

ParameterExplain
in_strDIDdevice did
Methodmethod name
paramsend nil

3.Return value

Return valueExplain
@"__name"Return "NTP" or "Time" or "DST"

 

1.Function Description

2.Parameter

ParameterExplain
in_strDIDdevice did
Methodmethod name

3.Return value :

Return valueExplain
ResponseStatusResponse status code

 

Device Information

1.Function Description

2.Parameter

ParameterExplain
in_strDIDdevice did

3.Return value:

 

Mobile Detection Configuration

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
MethodMethod Name
channelIDChannel Number

3.Response data

GET /Pictures/channel ID/Motion Response ParameterExplain
ResponseStatus or MotionGet all mobile detection related configurations
PUT /Pictures/channel ID/Motion Response ParameterExplain
ResponseStatusResponse after configuration modification

 

OSD Setting

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
MethodMethod Name
channelIDChannel Number

3.Response data

GET /Pictures/channelID/OSD Response ParameterExplain
ResponseStatus or OSDGet all OSD related configurations
PUT /Pictures/channelID/OSD Response ParameterExplain
ResponseStatusResponse after configuration modification

 

Memory card Setting

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
MethodMethod Name

3.Return value

GET /Disk Response ParameterExplain
ResponseStatus or DiskListGet all Disk related configurations
PUT /Disk Response ParameterExplain
ResponseStatusResponse after configuration modification

 

Recording Setting

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
MethodMethod Name

3.Return value: None

 

Human shape detection Setting

1.Function Description

2.Parameter

ParameterExplain
in_strDIDDevice did
MethodMethod Name

3.Example of channel number return value code

 

Human tracking Configuration

1.Function Description

2.ParameterExplain

ParameterExplain
in_strDIDDevice did
MethodMethod Name

3.Return value: None

 

Network Access

Initialize Network Tools Object

  1. Function Description

    • Initialize Network Tools Object

    • Declare class

  2. Context description or other interfaces

    • The network interface must be initialized before calling
  3. Parameter

    • None
  4. Return value

    Return valueExplain
    NetManager*Network Tools Object

     

  5. Simple sample code

 

Select local Servers

  1. Function Description

    • Select local servers

    • Declare class

  2. Context description or other interfaces

    • Server must be selected before network request
    • Generally speaking, after the APP starts, you need to select the server and then request the interface
  3. Parameter

    ParameterExplain
    RegionTypeServer regions(Chinese servers RegionTypeChina, international servers RegionTypeInternational, European servers RegionTypeEurope, American servers RegionTypeNorthAmerica)
    isDebugisDebug YES test suit NO formal suit
  4. Return value

    • None
  5. Simple sample code

 

Save token to local

  1. Function Description

    • Save token to local

    • Declare class

  2. Context description or other interfaces

    • After successful login, you will get a token
    • After successful login, you need to save the token locally, and then call the network interface
  3. Parameter

    ParameterExplain
    tokenToken value obtained after successful login
  4. Return value

    • None
  5. Simple sample code

 

 

Universal Network Access Interface

  1. Function Function Explain

    • Common interface for network access

    • declaration class

  2. Explain the context relationship (depending on the interface or which interfaces are used with it)

    • 1.This interface is a universal network access interface
    • 2.Select the server before using Yes
    • 3.Select the server before using Yes, and then call the login interface to save the token
    • 4.This interface supports GET PUT POST DELETE request mode
  3. Parameter

    ParameterExplain
    actionPathAddress of network request for example:"safe/get-device-list" Can be viewed on the background YAPI
    methodNetwork request mode support GET PUT POST DELETE for example @"GET"
    callBackThe request successfully returns JSON as P6SResult object
    failureFailure Data
  4. Return value

    • none
  5. Simple sample code

 

QR Code Network Setup Process Explanation

  1. QR Code Setup

  2. Generate a QR code to connect to Wi-Fi, allowing the device to scan the following QR code content:

    S=ssid&P=pwd&T=timeString&K=key&A=ipAddress+ipPort

    The ssid and pwd need to be encrypted with base64.

    timeString: represents the minute difference (time zone * 60). If it's a positive time zone, it should include a '+' sign, for example, +480.

    key: a random 5-character English string.

    ipAddress: The hexadecimal format of the phone's IP address.

    For instance, 192.168.250.199 converts to C7FAA8C0.

    ipPort: The hexadecimal format of the phone's idle port.

    For example, 39531 converts to 6B9A."

  3. Obtain the device's DID using UDPTool (UDPTool.h)

    Firstly initialize, using the port number randomly generated in the QR code.

Then, within the delegate, retrieve the device's DID number:

Here, 'S' represents the previously randomly generated key, and 'DID' indicates the device's identification number.

Finally, after obtaining the DID number, it's possible to add the device. Once the DID is acquired, stop receiving data:

[_tool stopUDPSocket]

 

 

Low-Power Device

Setting Low-Power Device Prefix

  1. Function Description

    • Sets the DID prefix for low-power devices. These prefixes determine which devices are classified as low-power devices.

    • Class Declaration:

  2. Context and Dependencies

    • Low-power devices use a different P2P connection mechanism compared to other devices. Therefore, the DID prefix for low-power devices must be set beforehand to enable efficient P2P connections.
  3. Parameters

    ParameterDescription
    arrayAn array of DID prefixes, e.g., @[@"IOTGAA", @"IOTGBB"]
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

Query Online Status for Low-Power Devices on Wake Server

  1. Function Description

    • Queries the online status of a low-power device through the wake server.

    • Class Declaration:

  2. Context and Dependencies

    • To determine the status of a low-power device, the process involves two steps:

      1. Call the interface to query the device’s last login time on the main server:

    If the last login time (lastTime) is between 0 and 70 seconds, the device is considered online.

    If lastTime exceeds 70 seconds, call the wake server query interface to determine the online status.

    2. Use LPQueryOnlineStatusWithDID:callback::

    Check the queryResult:

    0: The device may be online; further check if lastLoginSec is between 0 and 70 seconds to confirm.

    Non-zero: The device is considered offline.

  3. Parameters

    ParametersDescription
    in_strDIDThe DID of the device to be queried.
    callbackA completion handler with the query result
     - queryResult: 0 means the device may be online, additional checks with lastLoginSec are needed. Other values indicate the device is offline.
     - DID: The device’s DID.
     - lastLoginSec: The time (in seconds) since the device last logged in to the wake server. Values between 0–70 indicate the device is online.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

Query Last Login Time on P2P Server

  1. Function Description

    • Queries the last time a device logged into the P2P server.

    • Class Declaration:

  2. Context and Dependencies

    • The online status of low-power devices is determined by checking their last login time on the P2P server:

      If the last login time (lastTime) is within 0 to 70 seconds, the device is considered online.

      If lastTime exceeds 70 seconds, the wake server should be queried for the last login time using the following method:

    This ensures an accurate determination of the device’s online status.

  3. Parameter

    ParameterDescription
    in_strDIDThe DID of the device to be queried.
    lastTimeCallbackA callback that returns the query result:
     - lastTime: The number of seconds since the device last logged into the P2P server.
     - DID: The DID of the device.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

 

Connect to Low-Power Device

  1. Function Description

    • Establishes a P2P connection with a low-power device and wakes it up if necessary.

    • Class Declaration:

  2. Context and Dependencies

    • This function is used to connect to low-power devices. In addition to establishing the P2P connection, it also wakes up the device. After a successful connection, device authentication is typically performed, similar to regular powered devices.

       

  3. Parameters

    ParametersDescription
    DIDThe DID of the device to connect to.
    callbackA callback function that provides the result of the P2P connection:
     - DID: The DID of the connected device.
     - session: A value greater than or equal to 0 indicates success. Negative values indicate failure.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

Disconnect Low-Power Device

  1. Function Description

    • Disconnects the P2P connection with a low-power device. After disconnection, the device enters sleep mode.

    • Class Declaration:

  2. Context and Dependencies

    • This function is used to terminate the P2P connection with a low-power device. Once disconnected, the device transitions into a sleep state to conserve energy. It is typically used after completing operations requiring the device to be active.

       

  3. Parameters

    ParametersDescription
    in_strDIDThe DID of the device to disconnect.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

Monitor P2P Disconnection Status

  1. Function Description

    • Monitors and retrieves the P2P disconnection status for a specific device. It provides a callback when the P2P connection is disrupted.

    • Class Declaration:

  2. Context and Dependencies

    • This function is used to listen for the disconnection state of P2P devices. The callback is triggered when the connection is lost, enabling appropriate handling, such as retrying the connection or notifying the user.

       

  3. Parameter

    ParameterDescription
    in_strDIDThe DID of the device to monitor.
    iChannelThe channel number associated with the connection.
    successA callback triggered on connection state change:
     - ret: A non-zero value indicates a disconnection.
     - -3: Indicates a timeout.
     - DID: The DID of the device associated with the disconnection.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example

Set AOV Device Flag

  1. Function Description

    • Marks whether a device is an AOV device. This designation is primarily used during playback to process AOV recordings with fast-forward functionality.

    • Class Declaration:

  2. Context and Dependencies

    • This function identifies AOV devices to enable specific handling during playback:

      AOV recordings: Played back in fast-forward mode.

      Event recordings: Played back at normal speed.

       

  3. Parameters

    ParameterDescription
    in_strDIDThe DID of the device to be marked.
    flagA boolean indicating the AOV status:
     - YES: The device is an AOV device.
     - NO: The device is not an AOV device.
  4. Return Value

    Return ValueDescription
    NoneN/A
  5. Usage Example