0% found this document useful (0 votes)
202 views

NetSDK Programming Manual (Camera)

This document provides a programming manual for NetSDK, which is a development kit that allows developers to interface with surveillance products like NVRs, IP cameras, and other devices. It describes NetSDK interfaces and functions for cameras, speed domes, and thermal cameras. The manual defines key terms, provides an overview of initialization, device login and monitoring functions, and includes example code. It is intended to help SDK software engineers and project managers integrate NetSDK capabilities into their applications.

Uploaded by

Ivan Rangel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
202 views

NetSDK Programming Manual (Camera)

This document provides a programming manual for NetSDK, which is a development kit that allows developers to interface with surveillance products like NVRs, IP cameras, and other devices. It describes NetSDK interfaces and functions for cameras, speed domes, and thermal cameras. The manual defines key terms, provides an overview of initialization, device login and monitoring functions, and includes example code. It is intended to help SDK software engineers and project managers integrate NetSDK capabilities into their applications.

Uploaded by

Ivan Rangel
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

NetSDK Programming Manual

(Camera)

V1.0.0
Foreword

Purpose

Welcome to use NetSDK (hereinafter referred to be "SDK") programming manual (hereinafter


referred to be "the Manual").
SDK, also known as network device SDK, is a development kit for developer to develop the
interfaces for network communication among surveillance products such as Network Video
Recorder (NVR), Network Video Server (NVS), IP Camera (IPC), Speed Dome (SD), and
intelligence devices.
The Manual describes the SDK interfaces and processes of the general function modules for
IPC, SD and Thermal IP Camera (TPC). For more function modules and data structures, refer
to NetSDK Development Manual.
The example codes provided in the Manual are only for demonstrating the procedure and not
assured to copy for use.

Reader

 SDK software development engineers


 Project managers
 Product managers

Signals

The following categorized signal words with defined meaning might appear in the Manual.
Signal Words Meaning

Provides methods to help you solve a problem or save you time.

Provides additional information as the emphasis and supplement to


the text.

Revision History

No. Version Revision Content Release Time

1 V1.0.0 First Release. December 30, 2017

About the Manual

 The Manual is for reference only. If there is inconsistency between the Manual and the
actual product, the actual product shall govern.

Foreword I
 All the designs and software are subject to change without prior written notice. The product
updates might cause some differences between the actual product and the Manual. Please
contact the customer service for the latest program and supplementary documentation.
 There still might be deviation between the actual value of some data and the value
provided, if there is any doubt or dispute, please refer to our final explanation.
 Please contact the supplier or customer service if there is any problem occurred when
using the device.
 We are not liable for any loss caused by the operations that do not comply with the Manual.
 All trademarks, registered trademarks and the company names in the Manual are the
properties of their respective owners.
 Please visit our website or contact your local service engineer for more information. If there
is any uncertainty or controversy, please refer to our final explanation.

Foreword II
Glossary
This chapter provides the definitions to some of the terms appear in the Manual to help you
understand the function of each module.

Term Definition
A type of video stream that usually has better resolution and clarity
Main Stream and provides a better experience if the network resource is not
restricted.
A type of video stream that usually has lower resolution and clarity
than the main stream but demands less network resources. The
Sub Stream
user can choose the stream type according to the particular
scenes.
The video is numbered from 0 and each video receives a channel
Video Channel number. Currently, except the TPC, the other types of devices
usually have only one channel that is numbered as 0.
The first step to access to the device is login (authentication). The
device receives a unique ID that refers to the login handle upon
Login Handle
the successful login. This handle will be used by the subsequent
procedures and stay valid until logout.
A fast positioning method in PTZ control by providing the
difference value of the PTZ coordinates (X-axis and Y-axis) to the
Relative Positioning device which accord to the present PTZ location and the difference
value to calculate and transfer to the final location. This method
also supports ZOOM control.
A fast positioning method in PTZ control which provides certain
horizontal and vertical coordinates (angular coordinate) to the
Absolute Positioning
device. The device directly transfers to the user specified location.
This method also supports ZOOM control.
Pulse Code Modulation is one of the coding methods of digital
communication and converts the analog signal into digital signal
PCM
without encoding loss. It is suitable for the user who requires
higher data transfer rate and bandwidth.
PTZ Pan Tilt Zoom is all-round movement and lens zoom control.
Corresponds to the temperature distribution data of a scene and
Heat Map (Temperature)
each pixel has a data point.
Heat Map (Activity) Indicates a picture using different colors to show the statistical
activity of an area during a certain period.

Glossary III
Table of Contents
Foreword .................................................................................................................................................... I
Glossary ................................................................................................................................................... III
1 Overview ................................................................................................................................................. 1
1.1 General .......................................................................................................................................... 1
1.2 Applicability .................................................................................................................................... 2
2 Function Modules .................................................................................................................................. 3
2.1 SDK Initialization ........................................................................................................................... 3
2.1.1 Introduction ......................................................................................................................... 3
2.1.2 Interface Overview .............................................................................................................. 3
2.1.3 Process ............................................................................................................................... 3
2.1.4 Example Code .................................................................................................................... 4
2.2 Device Initialization ........................................................................................................................ 5
2.2.1 Introduction ......................................................................................................................... 5
2.2.2 Interface Overview .............................................................................................................. 5
2.2.3 Process ............................................................................................................................... 5
2.2.4 Example Code .................................................................................................................... 8
2.3 Device Login ................................................................................................................................ 10
2.3.1 Introduction ....................................................................................................................... 10
2.3.2 Interface Overview ............................................................................................................ 10
2.3.3 Process ............................................................................................................................. 10
2.3.4 Example Code ...................................................................................................................11
2.4 Real-time Monitoring ................................................................................................................... 12
2.4.1 Introduction ....................................................................................................................... 12
2.4.2 Interface Overview ............................................................................................................ 12
2.4.3 Process ............................................................................................................................. 12
2.4.4 Example Code .................................................................................................................. 16
2.5 Video Snapshot ........................................................................................................................... 17
2.5.1 Introduction ....................................................................................................................... 17
2.5.2 Interface Overview ............................................................................................................ 17
2.5.3 Process ............................................................................................................................. 17
2.5.4 Example Code .................................................................................................................. 20
2.6 PTZ Control ................................................................................................................................. 20
2.6.1 Introduction ....................................................................................................................... 20
2.6.2 Interface Overview ............................................................................................................ 21
2.6.3 Process ............................................................................................................................. 21
2.6.4 Example Code .................................................................................................................. 23
2.7 Voice Talk ..................................................................................................................................... 23
2.7.1 Introduction ....................................................................................................................... 23
2.7.2 Interface Overview ............................................................................................................ 23
2.7.3 Process ............................................................................................................................. 24
2.7.4 Example Code .................................................................................................................. 25

Table of Contents IV
2.8 Heat Map (Temperature) ............................................................................................................. 26
2.8.1 Introduction ....................................................................................................................... 26
2.8.2 Interface Overview ............................................................................................................ 26
2.8.3 Process ............................................................................................................................. 27
2.8.4 Example Code .................................................................................................................. 28
2.9 Heat Map (Activity) ...................................................................................................................... 29
2.9.1 Introduction ....................................................................................................................... 29
2.9.2 Interface Overview ............................................................................................................ 29
2.9.3 Process ............................................................................................................................. 29
2.9.4 Example Code .................................................................................................................. 30
3 Interface Definition .............................................................................................................................. 32
3.1 SDK Initialization ......................................................................................................................... 32
3.1.1 SDK CLIENT_Init .............................................................................................................. 32
3.1.2 CLIENT_Cleanup.............................................................................................................. 32
3.1.3 CLIENT_SetAutoReconnect ............................................................................................. 32
3.1.4 CLIENT_SetNetworkParam.............................................................................................. 33
3.2 Device Initialization ...................................................................................................................... 33
3.2.1 CLIENT_StartSearchDevices ........................................................................................... 33
3.2.2 CLIENT_InitDevAccount................................................................................................... 33
3.2.3 CLIENT_GetDescriptionForResetPwd ............................................................................. 34
3.2.4 CLIENT_CheckAuthCode................................................................................................. 35
3.2.5 CLIENT_ResetPwd........................................................................................................... 35
3.2.6 CLIENT_GetPwdSpecification.......................................................................................... 36
3.2.7 CLIENT_StopSearchDevices ........................................................................................... 36
3.3 Device Login ................................................................................................................................ 36
3.3.1 CLIENT_LoginEx2 ............................................................................................................ 36
3.3.2 CLIENT_Logout ................................................................................................................ 37
3.4 Real-time Monitoring ................................................................................................................... 38
3.4.1 CLIENT_RealPlayEx ........................................................................................................ 38
3.4.2 CLIENT_StopRealPlayEx ................................................................................................. 39
3.4.3 CLIENT_SaveRealData .................................................................................................... 39
3.4.4 CLIENT_StopSaveRealData ............................................................................................ 39
3.4.5 CLIENT_SetRealDataCallBackEx2 .................................................................................. 40
3.5 Video Snapshot ........................................................................................................................... 40
3.5.1 CLIENT_SnapPictureToFile.............................................................................................. 40
3.5.2 CLIENT_CapturePictureEx............................................................................................... 41
3.6 PTZ Control ................................................................................................................................. 41
3.6.1 CLIENT_DHPTZControlEx2 ............................................................................................. 41
3.7 Voice Talk ..................................................................................................................................... 45
3.7.1 CLIENT_StartTalkEx ......................................................................................................... 45
3.7.2 CLIENT_StopTalkEx ......................................................................................................... 46
3.7.3 CLIENT_RecordStartEx ................................................................................................... 46
3.7.4 CLIENT_RecordStopEx .................................................................................................... 46
3.7.5 CLIENT_TalkSendData .................................................................................................... 47
3.7.6 CLIENT_AudioDecEx ....................................................................................................... 47
3.8 Heat Map (Temperature) ............................................................................................................. 48
3.8.1 CLIENT_RadiometryAttach .............................................................................................. 48

Table of Contents V
3.8.2 CLIENT_RadiometryDetach ............................................................................................. 48
3.8.3 CLIENT_RadiometryFetch ............................................................................................... 48
3.8.4 CLIENT_RadiometryDataParse ....................................................................................... 49
3.9 Heat Map (Activity) ...................................................................................................................... 49
3.9.1 CLIENT_QueryDevState .................................................................................................. 49
4 Callback Definition .............................................................................................................................. 51
4.1 fSearchDevicesCB ...................................................................................................................... 51
4.2 fDisConnect ................................................................................................................................. 51
4.3 fHaveReConnect ......................................................................................................................... 51
4.4 fRealDataCallBackEx2 ................................................................................................................ 52
4.5 pfAudioDataCallBack................................................................................................................... 53
4.6 fRadiometryAttachCB .................................................................................................................. 53

Table of Contents VI
1 Overview

1.1 General
The Manual introduces SDK interfaces reference information that includes main function
modules, interface definition, and callback definition.
The following are the main functions:
SDK initialization, device login, real-time monitoring, PTZ control, voice talk, video snapshot,
heat map (temperature) and heat map (activity).
The development kit might be different dependent on the environment.
 For the files included in Windows development kit, see Table 1-1.
Library type Library file name Library file description
dhnetsdk.h Header file
dhnetsdk.lib Lib file
Function library
dhnetsdk.dll Library file
avnetsdk.dll Library file
avglobal.h Header file
dhconfigsdk.h Configuration Header file
Configuration library
dhconfigsdk.lib Lib file
dhconfigsdk.dll Library file
dhplay.dll Playing library
aacdec.dll AAC audio decoding library
amrenc.dll AMR audio decoding library
g729dec.dll G729 audio decoding library
g7221dec.dll G7221 audio decoding library
h264dec.dll H264 video decoding library
mjpegdec.dll MJPEG video decoding library
mp3dec.dll MP3 audio decoding library
Auxiliary library of hevcdec.dll H265 video decoding library
playing (coding and mp2dec.dll MP2 audio decoding library
decoding) mpeg4dec.dll MPEG4 video decoding library
oggdec.dll OGG audio decoding library
adpcmdec.dll ADPCM audio decoding library
svac_dec.dll SVAC video decoding library
fisheye.dll Fisheye correction library
Library used for fisheye and speed dome
MCL_FPTZ.dll
linkage, matching of fisheye correction library
postproc.dll Image processing library
swscale.dll Library used for GDI display

Overview 1
Library type Library file name Library file description
Infra.dll Infrastructure library
json.dll JSON library
Dependent library of
NetFramework.dll Network infrastructure library
"avnetsdk.dll"
Stream.dll Media transmission structure package library
StreamSvr.dll Streaming service
Auxiliary library of
IvsDrawer.dll Image display library
"dhnetsdk.dll"
Table 1-1
 For the files included in Linux development kit, see Table 1-2.
Library type Library file name Library file description
dhnetsdk.h Header file
Function library libdhnetsdk.so Library file
libavnetsdk.so Library file
avglobal.h Header file
Configuration library dhconfigsdk.h Configuration Header file
libdhconfigsdk.so Configuration library
libInfra.so Infrastructure library
Dependent library of libNetFramework.so Network infrastructure library
"libavnetsdk.so" libStream.so Media transmission structure package library
libStreamSvr.so Streaming service
Table 1-2

 The function library and configuration library are necessary libraries.


 The function library is the main body of SDK, which is used for communication interaction
between client and products, remotely controls device, queries device data, configures
device data information, as well as gets and handles the streams.
 The configuration library packs and parses the structures of configuration functions.
 It is recommended to use auxiliary library of playing (coding and decoding) to parse and
play the streams.
 The auxiliary library decodes the audio and video streams for the functions such as
monitoring and voice talk, and collects the local audio.
 If the function library includes avnetsdk.dll or libavnetsdk.so, the corresponding dependent
library is necessary.

1.2 Applicability
 Recommended memory: No less than 512 M
 System supported by SDK:
 Windows
Windows 10/Windows 8.1/Windows 7 and Windows Server 2008/2003
 Linux
The common Linux systems such as Red Hat/SUSE

Overview 2
2 Function Modules
There are seven function modules in this chapter. Each function module includes SDK
initialization, device login, logout, and SDK resource release. The optional processes do not
affect the use of other processes.

2.1 SDK Initialization


2.1.1 Introduction
Initialization is the first step of SDK to conduct all the function modules. It does not have the
surveillance function but can set some parameters that affect the SDK overall functions.
 Initialization occupies some memory.
 Only the first initialization is valid within one process.
 After using this function, call CLIENT_Cleanup to release SDK resource.

2.1.2 Interface Overview


Interface Implication
CLIENT_Init SDK initialization
CLIENT_Cleanup SDK cleaning up
CLIENT_SetAutoReconnect Setting of reconnection after disconnection
CLIENT_SetNetworkParam Setting of network environment
Table 2-1

2.1.3 Process
For the process of SDK initialization, see Figure 2-1.

Function Modules 3
Figure 2-1

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 (Optional) Call CLIENT_SetAutoReconnect to set reconnection callback to allow the
auto reconnecting after disconnection.
Step 3 (Optional) Call CLIENT_SetNetworkParam to set network login parameter that
includes connection timeout and connection attempts.
Step 4 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Call CLIENT_Init and CLIENT_Cleanup in pairs. It supports single thread multiple calling
but it is suggested to call the pair for only one time overall.
 Initialization: Calling CLIENT_Init multiple times is only for internal count without repeating
applying resources.
 Cleaning up: The interface CLIENT_Cleanup clears all the opened processes, such as
login, real-time monitoring, and alarm subscription.
 Reconnection: SDK can set the reconnection function for the situations such as network
disconnection and power off. SDK will keep logging the device until succeeded. Only the
real-time monitoring, alarm and snapshot subscription can be resumed after reconnection
is successful.

2.1.4 Example Code


// Set this callback through CLIENT_Init. When the device is disconnected, SDK informs the user through ths
callback.
void CALLBACK DisConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, DWORD dwUser)

Function Modules 4
{
printf("Call DisConnectFunc: lLoginID[0x%x]\n", lLoginID);
}
// Initialize SDK
CLIENT_Init(DisConnectFunc, 0);

// .... Call the functional interface to handle the process

// Clean up the SDK resource


CLIENT_Cleanup();

2.2 Device Initialization


2.2.1 Introduction
The device is uninitialized by default. Please initialize the device before starting use.
 The uninitialized device cannot be logged.
 A password will be set for the default admin account during initialization.
 You can reset the password if you forgot it.

2.2.2 Interface Overview


Interface Implication
CLIENT_StartSearchDevices Search in the LAN to find the uninitialized devices.
CLIENT_InitDevAccount Initialization interface.
Get the password reset information: mobile phone
CLIENT_GetDescriptionForResetPwd
number, email address, and QR code.
CLIENT_CheckAuthCode Check the validity of security code.
CLIENT_ResetPwd Reset password.
CLIENT_GetPwdSpecification Get the password rules.
CLIENT_StopSearchDevices Stop searching.
Table 2-2

2.2.3 Process

2.2.3.1 Device Initialization


For the process of device initialization, see Figure 2-2.

Function Modules 5
Figure 2-2

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_StartSearchDevices to search the devices within the LAN and get the
device information.

Multi-thread calling is not supported.


Step 3 Call CLIENT_GetPwdSpecification to get the password rules.
Step 4 Call CLIENT_InitDevAccount to initialize device.
Step 5 Call CLIENT_StopSearchDevices to stop searching.
Step 6 Call CLIENT_LoginEx2 and login the admin account with the configured password.
Step 7 After using the function module, call CLIENT_Logout to logout the device.
Step 8 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

Because the interface is working in multicast, the host PC and device must be in the same
multicast group.

Function Modules 6
2.2.3.2 Password Reset
For the process of device initialization, see Figure 2-3.

Figure 2-3

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_StartSearchDevices to search the devices within the LAN and get the
device information.

Multi-thread calling is not supported.


Step 3 Call CLIENT_GetDescriptionForResetPwd to get the information for password reset.
Step 4 (Optional) Scan the QR code obtained from the previous step to get the security code,
and then validate it through CLIENT_CheckAuthCode.
Step 5 (Optional) Call CLIENT_GetPwdSpecification to get the password rules.
Step 6 Call CLIENT_ResetPwd to reset the password.

Function Modules 7
Step 7 Call CLIENT_StopSearchDevices to stop searching.
Step 8 Call CLIENT_LoginEx2 and login the admin account with the configured password.
Step 9 After using the function module, call CLIENT_Logout to logout the device.
Step 10 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

Because the interface is working in multicast, the host PC and device must be in the same
multicast group.

2.2.4 Example Code

2.2.4.1 Device Initialization


//Firstly, call CLIENT_StartSearchDevices to get the device information.
//Get the password rules
NET_IN_PWD_SPECI stIn = {sizeof(stIn)};
strncpy(stIn.szMac, szMac, sizeof(stIn.szMac) - 1);
NET_OUT_PWD_SPECI stOut = {sizeof(stOut)};
CLIENT_GetPwdSpecification(&stIn, &stOut, 3000, NULL);//In the case of single network card, the last
parameter can be left unfilled; in the case of multiple network card, enter the host PC IP for the last parameter. Set
the password according to the rules which are used for preventing user from setting the passwords that are not
supported by the device.

//Device initialization
NET_IN_INIT_DEVICE_ACCOUNT sInitAccountIn = {sizeof(sInitAccountIn)};
NET_OUT_INIT_DEVICE_ACCOUNT sInitAccountOut = {sizeof(sInitAccountOut)};
sInitAccountIn.byPwdResetWay = 1;//1 stands for password reset by mobile phone number, and 2 stands for
password reset by email
strncpy(sInitAccountIn.szMac, szMac, sizeof(sInitAccountIn.szMac) - 1);//Set mac value
strncpy(sInitAccountIn.szUserName, szUserName, sizeof(sInitAccountIn.szUserName) - 1);//Set user name
strncpy(sInitAccountIn.szPwd, szPwd, sizeof(sInitAccountIn.szPwd) - 1);//Set password
strncpy(sInitAccountIn.szCellPhone, szRig, sizeof(sInitAccountIn.szCellPhone) - 1);//If the byPwdResetWay is
set as 1, please set szCellPhone field; if the byPwdResetWay is set as 2, please set sInitAccountIn.szMail field.
CLIENT_InitDevAccount(&sInitAccountIn, &sInitAccountOut, 5000, NULL);

2.2.4.2 Password Reset


//Firstly, call CLIENT_StartSearchDevices to get the device information.
//Get the information for password reset
NET_IN_DESCRIPTION_FOR_RESET_PWD stIn = {sizeof(stIn)};
strncpy(stIn.szMac, szMac, sizeof(stIn.szMac) - 1); //Set mac value

Function Modules 8
strncpy(stIn.szUserName, szUserName, sizeof(stIn.szUserName) - 1);//Set user name
stIn.byInitStatus = bStstus; //bStstus is the value of return field byInitStatus of device search interface (Callback
of CLIENT_SearchDevices and CLIENT_StartSearchDevice, and CLIENT_SearchDevicesByIPs)
NET_OUT_DESCRIPTION_FOR_RESET_PWD stOut = {sizeof(stOut)};
char szTemp[360];
stOut.pQrCode = szTemp;
CLIENT_GetDescriptionForResetPwd(&stIn, &stOut, 3000, NULL);//In the case of single network card, the last
parameter can be left unfilled; in the case of multiple network card, enter the host PC IP for the last parameter.
After successful connection, stout will output a QR code with address of stOut.pQrCode. Scan this QR code to get
the security code for password reset. This security code will be sent to the reserved mobile phone or email box.
//(Optional) Check the security code
NET_IN_CHECK_AUTHCODE stIn1 = {sizeof(stIn1)};
strncpy(stIn1.szMac, szMac, sizeof(stIn1.szMac) - 1); //Set mac value
strncpy(stIn1.szSecurity, szSecu, sizeof(stIn1.szSecurity) - 1); // szSecu is the security code sent to the reserved
mobile phone or email box
NET_OUT_CHECK_AUTHCODE stOut1 = {sizeof(stOut1)};
bRet = CLIENT_CheckAuthCode(&stIn1, &stOut1, 3000, NULL); //In the case of single network card, the last
parameter can be left unfilled; in the case of multiple network card, enter the host PC IP for the last parameter
//Get password rules
NET_IN_PWD_SPECI stIn2 = {sizeof(stIn2)};
strncpy(stIn2.szMac, szMac, sizeof(stIn2.szMac) - 1); //Set mac value
NET_OUT_PWD_SPECI stOut2 = {sizeof(stOut2)};
CLIENT_GetPwdSpecification(&stIn2, &stOut2, 3000, NULL);// In the case of single network card, the last
parameter can be left unfilled; in the case of multiple network card, enter the host PC IP for the last parameter. Set
the password according to the rules which are used for preventing user from setting the passwords that are not
supported by the device
//Reset password
NET_IN_RESET_PWD stIn3 = {sizeof(stIn3)};
strncpy(stIn3.szMac, szMac, sizeof(stIn3.szMac) - 1); //Set mac value
strncpy(stIn3.szUserName, szUserName, sizeof(stIn3.szUserName) - 1); //Set user name
strncpy(stIn3.szPwd, szPassWd, sizeof(stIn3.szPwd) - 1); //szPassWd is the password reset according to the rules
strncpy(stIn3.szSecurity, szSecu, sizeof(stIn1.szSecurity) - 1); //szSecu is the security code sent to the reserved
mobile phone or email box
stIn3.byInitStaus = bStstus; //bStstus is the value of return field byInitStatus of device search interface (Callback
of CLIENT_SearchDevices and CLIENT_StartSearchDevice, and CLIENT_SearchDevicesByIPs)
stIn3.byPwdResetWay = bPwdResetWay; // bPwdResetWay is the value of return field byPwdResetWay of device
search interface (Callback of CLIENT_SearchDevices and CLIENT_StartSearchDevice, and
CLIENT_SearchDevicesByIPs)
NET_OUT_RESET_PWD stOut3 = {sizeof(stOut3)};
CLIENT_ResetPwd(&stIn3, &stOut3, 3000, NULL);//In the case of single network card, the last parameter can be
left unfilled; in the case of multiple network card, enter the host PC IP for the last parameter.

Function Modules 9
2.3 Device Login
2.3.1 Introduction
Device login, also called user authentication, is the precondition of all the other function
modules.
You will obtain a unique login ID upon login to the device and should call login ID before using
other SDK interfaces. The login ID becomes invalid once logged out.

2.3.2 Interface Overview


Interface Implication
CLIENT_LoginEx2 Login.
CLIENT_Logout Logout.
Table 2-3

2.3.3 Process
For the process of login, see Figure 2-4.

Figure 2-4

Process Description

Function Modules 10
Step 1 Call CLIENT_Init to initialize SDK.
Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 After successful login, you can realize the required function module.
Step 4 After using the function module, call CLIENT_Logout to logout the device.
Step 5 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Login handle: When the login is successful, the returned value is not 0 (even the handle is
smaller than 0, the login is also successful). One device can login multiple times with
different handle at each login. If there is not special function module, it is suggested to login
only one time. The login handle can be repeatedly used on other function modules.
 Logout: The interface will release the opened functions internally, but it is not suggested to
rely on the cleaning up function. For example, if you opened the monitoring function, you
should call the interface that stops the monitoring function when it is no longer required.
 Use login and logout in pairs: The login consumes some memory and socket information
and release sources once logout.
 Login failure: It is suggested to check the failure through the error parameter of the login
interface. For the common error code, see Table 2-4.
Error code Meaning
1 Password is wrong
2 User name does not exist
3 Login timeout
4 The account has been logged in
5 The account has been locked
6 The account is blacklisted
7 Out of resources, the system is busy
8 Sub connection failed
9 Main connection failed
10 Exceeded the maximum user connections
11 Lack of avnetsdk or avnetsdk dependent library
USB flash disk is not inserted into device, or the USB flash disk
12
information error
13 The client IP is not authorized with login
Table 2-4
The example code to avoid error code 3 is as follows.
NET_PARAM stuNetParam = {0};
stuNetParam.nWaittime = 8000; // unit ms
CLIENT_SetNetworkParam (&stuNetParam);
For more information about error codes, see "CLIENT_LoginEx2 interface" in Network SDK
Development Manual.chm.

2.3.4 Example Code


NET_DEVICEINFO_Ex stDevInfo = {0};

Function Modules 11
int nError = 0;
// Login the device
LLONG lLoginHandle = CLIENT_LoginEx2(szDevIp, nPort, szUserName, szPasswd,
EM_LOGIN_SPEC_CAP_TCP, NULL, &stDevInfo, &nError);

// Logout the device


if (0 != lLoginHandle)
{
CLIENT_Logout(lLoginHandle);
}

2.4 Real-time Monitoring


2.4.1 Introduction
Real-time monitoring obtains the real-time stream from the storage device or front-end device,
which is an important part of the surveillance system.
SDK can get the main stream and sub stream from the device once it logged.
 Supports calling the window handle for SDK to directly decode and play the stream
(Windows system only).
 Supports calling the real-time stream to you to perform independent treatment.
 Supports saving the real-time record to the specific file though saving the callback stream
or calling the SDK interface.

2.4.2 Interface Overview


Interface Implication
CLIENT_RealPlayEx Start real-time monitoring extension interface.
CLIENT_StopRealPlayEx Stop real-time monitoring extension interface.
Start saving the real-time monitoring data to the
CLIENT_SaveRealData
local path.
Stop saving the real-time monitoring data to the
CLIENT_StopSaveRealData
local path.
Set real-time monitoring data callback function
CLIENT_SetRealDataCallBackEx2
extension interface.
Table 2-5

2.4.3 Process
You can realize the real-time monitoring through SDK decoding library or your play library.

Function Modules 12
2.4.3.1 SDK Decoding Play
Call PlaySDK library from the SDK auxiliary library to realize real-time play.
For the process of playing by SDK decoding library, see Figure 2-5.

Start

Initialize SDK
CLIENT_Init

Login the device


CLIENT_LoginEx2

Start monitoring, hWnd calls


the valid handle
CLIENT_RealPlayEx Save the monitoring to the
local path Set callback
CLIENT_SaveRealData CLIENT_SetRealDataCallBackEx2

Stop save the monitoring


data to the local path
CLIENT_StopSaveRealData
Stop real-time monitoring
CLIENT_StopRealPlayEx

Logout the device


CLIENT_Logout

Release SDK resource


CLIENT_Cleanup

Close

Mandotory Optional

Figure 2-5

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_RealPlayEx to enable the real-time monitoring. The parameter hWnd is a
valid window handle.
Step 4 (Optional) Call CLIENT_SaveRealData to start saving the monitoring data.
Step 5 (Optional) Call CLIENT_StopSaveRealData to end the saving process and generate
the local video file.
Step 6 (Optional) If you call CLIENT_SetRealDataCallBackEx2, you can choose to save or
forward the video file. If saved as the video file, see the step 4 and step 5.
Step 7 After using the real-time function, call CLIENT_StopRealPlayEx to stop real-time
monitoring.
Step 8 After using the function module, call CLIENT_Logout to logout the device.
Step 9 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Function Modules 13
Notes for Process

 SDK decoding play only supports Windows system. You need to call the decoding after
getting the stream in other systems.
 Multi-thread calling: Multi-thread calling is not supported for the functions within the same
login session; however, multi-thread calling can deal with the functions of different login
sessions although such calling is not recommended.
 Timeout: The request on applying for monitoring resources should have made some
agreement with the device before requiring the monitoring data. There are some timeout
settings (see "NET_PARAM structure"), and the field about monitoring is
nGetConnInfoTime. If there is timeout due to the reasons such as bad network connection,
you can modify the value of nGetConnInfoTime bigger.
The example code is as follows. Call it for only one time after having called CLIENT_Init.
NET_PARAM stuNetParam = {0};
stuNetParam. nGetConnInfoTime = 5000; // unit ms
CLIENT_SetNetworkParam (&stuNetParam);
 Failed to repeat opening: For some models, the same channel cannot be opened for
multiple times during the one entire logged in status. If you are trying to open it repeatedly,
you will success in the first try but get failed afterwards. In this case, you can try the
following:
 Close the opened channel. For example, if you already opened the main stream video
on the channel 1 and still want to open the sub stream video on the same channel, you
can close the main stream first and then open the sub stream.
 Login twice to obtain two login handles to deal with the main stream and sub stream
respectively.
 Calling succeeded but no image: SDK decoding needs to use dhplay.dll. It is suggested to
check if dhplay.dll and its auxiliary library are missing under the running directory. See
Table 1-1.
 If the system resource is insufficient, the device might return error instead of stream. You
can receive an event DH_REALPLAY_FAILD_EVENT in the alarm callback that is set in
CLIENT_SetDVRMessCallBack. This event includes the detailed error codes. See
"DEV_PLAY_RESULT Structure" in Network SDK Development Manual.chm.
 32 channels limit: The decoding consumes resources especially for the high definition
videos. Considering the limited resources at the client, currently the maximum channels
are set to be 32. If more than 32, it is suggested to use third party play library. See "2.4.3.2
Call Third Party Play Library."

2.4.3.2 Call Third Party Play Library


SDK calls back the real-time monitoring stream to you and you call PlaySDK to decode and
play.
For the process of calling the third party play library, see Figure 2-6.

Function Modules 14
Start

Initialize SDK
CLIENT_Init

Login the device


CLIENT_LoginEx2

Start real-time monitoring, hWnd


calls NULL
CLIENT_RealPlayEx

Set callback The callback receives data and


CLIENT_SetRealDataCallBackE call playsdk series interface to
x2 play

Stop real-time monitoring


CLIENT_StopRealPlayEx

Logout
CLIENT_Logout

Release SDK resource


CLIENT_Cleanup

Stop

Figure 2-6

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 After successful login, call CLIENT_RealPlayEx to enable real-time monitoring. The
parameter hWnd is NULL.
Step 4 Call CLIENT_SetRealDataCallBackEx2 to set the real-time data callback.
Step 5 In the callback, pass the data to PlaySDK to finish decoding.
Step 6 After completing the real-time monitoring, call CLIENT_StopRealPlayEx to stop
real-time monitoring.
Step 7 After using the function module, call CLIENT_Logout to logout the device.
Step 8 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Stream format: It is recommended to use PlaySDK for decoding.


 Lag image
 When using PlaySDK for decoding, there is a default channel cache size (the
PLAY_OpenStream interface in playsdk) for decoding. If the stream resolution value is
big, it is recommended to modify the parameter value smaller such as 3 M.

Function Modules 15
 SDK callbacks can only moves into the next process after returning from you. It is not
recommended for you to consume time for the unnecessary operations; otherwise the
performance could be affected.

2.4.4 Example Code

2.4.4.1 SDK Decoding Play


// Take opening the main stream monitoring of channel 1 as an example. The parameter hWnd is a handle of
interface window.
LLONG lRealHandle = CLIENT_RealPlayEx(lLoginHandle, 0, hWnd, DH_RType_Realplay);
if (NULL == lRealHandle)
{
printf("CLIENT_RealPlayEx: failed! Error code: %x.\n", CLIENT_GetLastError());
}
printf("input any key to quit!\n");
getchar();
// Stop preview
if (NULL != lRealHandle)
{
CLIENT_StopRealPlayEx(lRealHandle);
}

2.4.4.2 Call Play Library


void CALLBACK RealDataCallBackEx(LLONG lRealHandle, DWORD dwDataType, BYTE *pBuffer,
DWORD dwBufSize, LLONG param, LDWORD dwUser);
// Take opening the main stream monitoring of channel 1 as an example.
LLONG lRealHandle = CLIENT_RealPlayEx(lLoginHandle, 0, NULL, DH_RType_Realplay);
if (NULL == lRealHandle)
{
printf("CLIENT_RealPlayEx: failed! Error code: %x.\n", CLIENT_GetLastError());
}
else
{
DWORD dwFlag = REALDATA_FLAG_RAW_DATA; //Initial data labels
CLIENT_SetRealDataCallBackEx2(lRealHandle, &RealDataCallBackEx, NULL, dwFlag);
}

printf("input any key to quit!\n");


getchar();

Function Modules 16
// Stop preview
if (0 != lRealHandle)
{
CLIENT_StopRealPlayEx(lRealHandle);
}

void CALLBACK RealDataCallBackEx(LLONG lRealHandle, DWORD dwDataType, BYTE *pBuffer,


DWORD dwBufSize, LLONG param, LDWORD dwUser)
{
// Call PlaySDK interface to get the stream data from the device. See SDK monitoring demo source data for
more details.
printf("receive real data, param: lRealHandle[%p], dwDataType[%d], pBuffer[%p], dwBufSize[%d]\n",
lRealHandle, dwDataType, pBuffer, dwBufSize);
}

2.5 Video Snapshot


2.5.1 Introduction
Video snapshot can get the picture data of the playing video. This section introduces the
following two snapshot ways:
 Network snapshot: Call the SDK interface which sends the snapshot command to the
device. The device will snapshot the current image and send to SDK through network, and
then SDK returns the image data to you.
 Local snapshot: When the monitoring is opened, you can save the monitoring data to the
picture format which is the frame information that does not have interaction with the device.

2.5.2 Interface Overview


Interface Implication
CLIENT_SnapPictureToFile Snap picture and send to the user.
Snap local pictures and the parameters could be
CLIENT_CapturePictureEx
monitoring handle or playback handle.
Table 2-6

2.5.3 Process
Video snapshot is consisted of network snapshot and local snapshot.

Function Modules 17
2.5.3.1 Network Snapshot
For the process of network snapshot, see Figure 2-7.

Figure 2-7

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_SnapPictureToFile to get the picture data.
Step 4 Call CLIENT_Logout to logout the device.
Step 5 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Picture size limit: SDK allocates the fixed memory to receive the picture data returned from
the device. If the picture is larger than the fixed memory, SDK will return the truncated data.
 SDK provides the interface to modify the default memory. If the picture (for example, the
high definition picture) is truncated, you can modify the value of nPicBufSize bigger. The
example code is as follows. After calling CLIENT_Init, call the example code just one time.
NET_PARAM stuNetParam = {0};
stuNetParam. nPicBufSize = 4*1024*1024; // unit byte
CLIENT_SetNetworkParam (&stuNetParam);
 Multi-thread calling: Multi-thread calling is not supported for the functions within the same

Function Modules 18
login session.
 Snapshot configuration: You can configure the items such as quality and definition for the
snapshot. However, if the default configurations are satisfactory, do not modify them. For
more details of the example code, see the SDK package on the website
 Picture save format: The picture data returns as memory and the interface supports saving
it as file (the precondition is that you have set the szFilePath field of
NET_IN_SNAP_PIC_TO_FILE_PARAM).

2.5.3.2 Local Snapshot


For the process of local snapshot, see Figure 2-8.

Figure 2-8

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_RealPlayEx to start monitoring and obtain the monitoring handle.

Function Modules 19
Step 4 Call CLIENT_CapturePictureEx to introduce the monitoring handle.
Step 5 Call CLIENT_StopRealPlayEx to stop the real-time monitoring.
Step 6 Call CLIENT_Logout to logout the device.
Step 7 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

2.5.4 Example Code


// Network snapshot example
NET_IN_SNAP_PIC_TO_FILE_PARAM stuInParam = {sizeof(stuInParam)};
NET_OUT_SNAP_PIC_TO_FILE_PARAM stuOutParam = {sizeof(stuOutParam)};
SNAP_PARAMS stuSnapParams = {0};
stuSnapParams.Channel = 0; // Take the first channel as an example
int nBufferLen = 2*1024*1024;
char* pBuffer = new char[nBufferLen]; // Picture cache
memset(pBuffer, 0, nBufferLen);
stuOutParam.szPicBuf = pBuffer;
stuOutParam.dwPicBufLen = nBufferLen;
if (FALSE == CLIENT_SnapPictureToFile(lLoginHandle, &stuSnapParams))
{
printf("CLIENT_SnapPictureEx Failed!Last Error[%x]\n", CLIENT_GetLastError());
}
delete[] pBuffer;

// Example of local snapshot. The handle hPlayHandle is obtained from opening monitoring.
if (FALSE == CLIENT_CapturePictureEx(hPlayHandle, “test.jpg”, NET_CAPTURE_JPEG))
{
printf("CLIENT_CapturePictureEx Failed!Last Error[%x]\n", CLIENT_GetLastError());
}

2.6 PTZ Control


2.6.1 Introduction
PTZ is a mechanical platform that carries the device and the protective enclosure and performs
remote control in all directions.
PTZ is consisted of two motors that can perform horizontal and vertical movement to provide
the all-around vision.
This section provides guidance to you about how to control directions (there are eight directions:
upper, lower, left, right, upper left, upper right, bottom left, and bottom right), focus, zoom, iris,
fast positioning, and 3-dimensional positioning through SDK.

Function Modules 20
2.6.2 Interface Overview
Interface Implication
CLIENT_DHPTZControlEx2 PTZ control extension interface
Table 2-7

2.6.3 Process
Direction control, focus, zoom and iris are the continuous operations. SDK provides start and
stop interfaces to you for timing control.
For the process of PTZ control, see Figure 2-9.

Figure 2-9

Both fast positioning and 3-dimensional positioning belong to one-time action, which needs to
call the PTZ control interface just one time.
For the process of one-time operation of PTZ control, see Figure 2-10.

Function Modules 21
Figure 2-10

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_DHPTZControlEx2 to operate the PTZ according to the situation.
Different PTZ command might need different parameters, and part of commands need
to call the corresponding stop command, such as moving left and moving right. For
details, see "2.6.4 Example Code."
Step 4 After using the function module, call CLIENT_Logout to logout the device.
Step 5 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Fast positioning: For the SD, take the current monitoring image center as origin, and the
valid range of horizontal and vertical coordinates is [–8191, 8191]. For example, if the
horizontal coordinate is 2000 and the vertical is 2000, the SD moves toward upper right
and gets a new origin, which means the coordinate specified every time is only relative to
the current location.
 3-dimensional positioning: For the SD, there is an initial position first. The horizontal
coordinate is [0, 3600] and the vertical is [–1800, 1800]. The coordinate specified each
time is the absolute coordinate and is irrelevant to the location of the SD image last time.
 For more example code see the SDK package on the website.

Function Modules 22
2.6.4 Example Code
LONG lParam1 = 0; // Rotating speed in horizontal direction.
LONG lParam2 = 4; // Rotating speed in vertical direction.
LONG lParam3 = 0;
// Continuous operation: take moving upward as example.
// Start moving upward.
BOOL bRet = CLIENT_DHPTZControlEx2(lLoginHandle, nChannelId, DH_PTZ_UP_CONTROL, lParam1,
lParam2, lParam3, FALSE, NULL);
// Stop moving upward.
bRet = CLIENT_DHPTZControlEx2(lLoginHandle, nChannelId, DH_PTZ_UP_CONTROL, lParam1, lParam2,
lParam3, TRUE, NULL);

// One-time operation movement: take fast positioning as an example.


lParam1 = 2000; // Horizontal coordinate, valid range[–8191,8191]
lParam2 = 2000; // Vertical coordinate, valid range [–8191,8191]
lParam3 = 1; // Zoom, valid range (-16–16),1 indicates rotating without zooming
bRet = CLIENT_DHPTZControlEx2(lLoginHandle, nChannelId, DH_EXTPTZ_FASTGOTO, lParam1, lParam2,
lParam3, FALSE, NULL);

2.7 Voice Talk


2.7.1 Introduction
Voice talk realizes the voice interaction between the local platform and the environment where
front-end devices are located.
This section introduces how to use SDK to realize the voice talk with the front-end devices.

2.7.2 Interface Overview


Interface Implication
CLIENT_StartTalkEx Start voice talk
CLIENT_StopTalkEx Stop voice talk
CLIENT_RecordStartEx Start client record (valid only in Windows system)
CLIENT_RecordStopEx Stop client record (valid only in Windows system)
CLIENT_TalkSendData Send voice data to the device
CLIENT_AudioDecEx Decode audio data (valid only in Windows system)
Table 2-8

Function Modules 23
2.7.3 Process
When SDK has collected the audio data from the local audio card, or SDK has received the
audio data from the front-end devices, SDK will call the callback of audio data.
You can call the SDK interface in the callback parameters to send the local audio data to the
front-end devices, or call SDK interface to decode and play the audio data received from the
front-end devices.
This process is valid only in Windows system. For the process of voice talk, see Figure 2-11.

Start

Initialize SDK
CLIENT_Init

Login the device


CLIENT_LoginEx2

Set coding information for


voice talk
CLIENT_SetDeviceMode

Start voice talk


CLIENT_StartTalkEx pfAudioDataCallBack receives
Set callback data
pfAudioDataCallBack

byAudioFlag
Start recording at PC value
CLIENT_RecordStartEx

Stop recording at PC 0: Audio data collected at PC 1: Audio returned by device


CLIENT_RecordStopEx

Stop voice talk


CLIENT_StopTalkEx

Logout Send the audio data of PC Decode the audio data of


CLIENT_Logout to the device the device
CLIENT_TalkSendData CLIENT_AudioDec
Release SDK resource
CLIENT_Cleanup

Stop

Figure 2-11

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.

Function Modules 24
Step 3 Call CLIENT_SetDeviceMode to set decoding information of voice talk. Set parameter
emType as DH_TALK_ENCODE_TYPE.
Step 4 Call CLIENT_StartTalkEx to set callback and start voice talk. In the callback, call
CLIENT_AudioDec to decode the audio data that is sent from the decoding device,
and call CLIENT_TalkSendData to send the audio data of the PC end to the device.
Step 5 Call CLIENT_RecordStartEx to start recording at PC. After this interface is called, the
voice talk callback in CLIENT_StartTalkEx will receive the local audio data.
Step 6 After using the voice talk function, call CLIENT_RecordStopEx to stop recording.
Step 7 Call CLIENT_StopTalkEx to stop voice talk.
Step 8 After using the function module, call CLIENT_Logout to logout the device.
Step 9 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 Voice encoding format: The example uses the common PCM format. SDK supports
accessing the voice encoding format supported by the device. For more details of the
example code, see the SDK package on the website. If the default PCM can satisfy the
requirement, it is not recommended to obtain the voice encoding format from the device.
 No sound at the device: The audio data needs to be collected by the device such as
microphone. It is recommended to check if the microphone or other equivalent device is
plugged in and if the CLIENT_RecordStartEx succeeded in returning.

2.7.4 Example Code


// Set the voice talk encoding data. Take PCM as an example.
DHDEV_TALKDECODE_INFO curTalkMode;
curTalkMode.encodeType = DH_TALK_PCM;
curTalkMode.nAudioBit = 16;
curTalkMode.dwSampleRate = 8000;
curTalkMode.nPacketPeriod = 25;
CLIENT_SetDeviceMode(lLoginHandle, DH_TALK_ENCODE_TYPE, &curTalkMode);
// Start voice talk
lTalkHandle = CLIENT_StartTalkEx(lLoginHandle, AudioDataCallBack, (LDWORD)NULL);
if(0 != lTalkHandle)
{
BOOL bSuccess = CLIENT_RecordStartEx(lLoginHandle);
}

// Stop local recording


if (!CLIENT_RecordStopEx(lLoginHandle))
{
printf("CLIENT_RecordStop Failed!Last Error[%x]\n", CLIENT_GetLastError());
}

Function Modules 25
// Stop voice talk
if (0 != lTalkHandle)
{
CLIENT_StopTalkEx(lTalkHandle);
}
void CALLBACK AudioDataCallBack(LLONG lTalkHandle, char *pDataBuf, DWORD dwBufSize, BYTE
byAudioFlag, LDWORD dwUser)
{
if(0 == byAudioFlag)
{
// Send the sound data detected by the PC to the device
LONG lSendLen = CLIENT_TalkSendData(lTalkHandle, pDataBuf, dwBufSize);
if(lSendLen != (LONG)dwBufSize)
{
printf("CLIENT_TalkSendData Failed!Last Error[%x]\n" , CLIENT_GetLastError());
}
}
else if(1 == byAudioFlag)
{
// Send the voice data from the device to SDK for encoding and play.
CLIENT_AudioDec(pDataBuf, dwBufSize);
}
}

2.8 Heat Map (Temperature)


2.8.1 Introduction
Heat map (temperature) function obtains the temperature distribution data, and the gray map
and temperature map.

Only the devices equipped with temperature measurement support this function.

2.8.2 Interface Overview


Interface Implication
CLIENT_RadiometryAttach Subscribe the temperature distribution data (heat map).
CLIENT_RadiometryDetach Cancel subscribing the temperature distribution data.
CLIENT_RadiometryFetch Inform start of obtaining the heat map data.

Function Modules 26
Interface Implication
Unzip the heat map data and convert it to the gray data
CLIENT_RadiometryDataParse
and temperature data in the unit of pixel.
Table 2-9

2.8.3 Process
For the process of heat map (temperature), see Figure 2-12.

Start

Initialize SDK
CLIENT_Init

Login the device


CLIENT_LoginEx2

Subscribe temperature
distribution data State callback
CLIENT_RadiometryAttach fRadiometryAttachCB gets
Set state callback temperature distribution data
fRadiometryAttachCB

Inform start of obtaining the Unzip and transform of heat


heat map data map data
CLIENT_RadiometryFetch CLIENT_RadiometryDataParse
gets gray map and
temperature map
Cancel subscribing
temperature distribution data
CLIENT_RadiometryDetach

Logout
CLIENT_Logout

Release SDK resoure


CLIENT_Cleanup

Stop

Figure 2-12

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_RadiometryAttach to subscribe the temperature distribution data and
register status callback. After the device has reported the temperature status, the
callback fRadiometryAttachCB will inform you.

Function Modules 27
Step 4 Call CLIENT_RadiometryFetch to inform the device to start obtaining the heat map
data. Call this interface whenever you need the heat map data.
Step 5 After receiving the temperature status information, call
CLIENT_RadiometryDataParse to get the gray data and temperature data of each
pixel.
Step 6 Call CLIENT_RadiometryDetach to cancel subscribing the temperature distribution
data after finishing use.
Step 7 After using the function module, call CLIENT_Logout to logout the device.
Step 8 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

 No uploaded heat map data: You will get the heat map data only after calling
CLIENT_RadiometryFetch. If you call CLIENT_RadiometryDetach before receiving the
heat map data, you will not receive the heat map data.
 Subscribing the channel number: If the camera has only one sensor, the subscription
channel number is 0; if the camera has double sensors, the subscription channel is 0 or 1.
For the TPC with double sensors, the second channel is TPC.
 The heat map data returned by the interface is not picture and needs to be converted to
pictures based on the rules provided by the device.

2.8.4 Example Code


// Temperature state callback
void CALLBACK cbRadiometryAttachCB(LLONG lAttachHandle, NET_RADIOMETRY_DATA* pBuf, int
nBufLen, LDWORD dwUser)
{
int nPixel = pBuf->stMetaData.nWidth*pBuf->stMetaData.nHeight;
unsigned short *pGray = new unsigned short[nPixel];
memset(pGray,0,nPixel);

float *pTemp = new float[nPixel];


memset(pTemp,0,nPixel);

CLIENT_RadiometryDataParse(pBuf,pGray,pTemp);
delete[] pGray;
delete[] pTemp;
}

// Subscribe the heat map


NET_IN_RADIOMETRY_ATTACH stIn = {sizeof(stIn), 1, cbRadiometryAttachCB};
NET_OUT_RADIOMETRY_ATTACH stOut = {sizeof(stOut)};

Function Modules 28
LLONG attachHandle = CLIENT_RadiometryAttach(loginId, &stIn, &stOut, 3000);
if (NULL == attachHandle)
{
// Subscription failed
}

// Inform the device to start collecting the data.


NET_IN_RADIOMETRY_FETCH stInFetch = {sizeof(stInFetch), 1};
NET_OUT_RADIOMETRY_FETCH stOutFetch = {sizeof(stOutFetch)};

CLIENT_RadiometryFetch(m_lLoginID, &stInFetch, &stOutFetch, 3000);

// Stop subscription after finishing using this function


CLIENT_RadiometryDetach(attachHandle);

2.9 Heat Map (Activity)


2.9.1 Introduction
Heat map (activity) function is a picture using different colors to show the statistical activity of an
area during a certain period.

The Heat map (activity) here is different from that of temperature in "2.8 Heat Map
(Temperature)".

2.9.2 Interface Overview


Interface Implication
CLIENT_QueryDevState Get the statistical activity information.
Table 2-10

2.9.3 Process
For the process of heat map (activity), see Figure 2-13.

Function Modules 29
Start

Initial SDK
CLIENT_Init

Login the device


CLIENT_LoginEx2

Get the statistical activity information


CLIENT_QueryDevState
Set type to
DH_DEVSTATE_GET_HEAT_MAP

Logout
CLIENT_Logout

Release SDK resource


CLIENT_Cleanup

Stop

Figure 2-13

Process Description

Step 1 Call CLIENT_Init to initialize SDK.


Step 2 Call CLIENT_LoginEx2 to login the device.
Step 3 Call CLIENT_QueryDevState to get the statistical activity information, and set the type
parameter to DH_DEVSTATE_GET_HEAT_MAP.
Step 4 After using the function module, call CLIENT_Logout to logout the device.
Step 5 After using all SDK functions, call CLIENT_Cleanup to release SDK resource.

Notes for Process

The heat map data returned by the interface is not picture data and needs to be converted to
pictures based on the rules provided by the device.

2.9.4 Example Code


int nRetLen = 0;
NET_QUERY_HEAT_MAP stHeatMap = {sizeof(stHeatMap)};
stHeatMap.stuIn.nChannel = 0;
NET_TIME_EX stBegin = {2017,10,1,0,0,0,0};
NET_TIME_EX stEnd = {2017,10,1,1,1,1,0};
stHeatMap.stuIn.stuBegin = stBegin;
stHeatMap.stuIn.stuEnd = stEnd;
stHeatMap.stuIn.nPlanID = 1;
stHeatMap.stuIn.emDataType = EM_HEAT_PIC_DATA_TYPE_GRAYDATA;// Support gray data by

Function Modules 30
default
stHeatMap.stuOut.nBufLen = 10*1024*1024;
stHeatMap.stuOut.pBufData = new char[stHeatMap.stuOut.nBufLen]; // Apply for memory according to
stHeatMap.stuOut.nBufLen
memset(stHeatMap.stuOut.pBufData, 0, stHeatMap.stuOut.nBufLen);
CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_GET_HEAT_MAP,(char
*)&stHeatMap,stHeatMap.dwSize, &nRetLen ,3000);

Function Modules 31
3 Interface Definition

3.1 SDK Initialization


3.1.1 SDK CLIENT_Init
Item Description
Name Initialize SDK.
BOOL CLIENT_Init(
fDisConnect cbDisConnect,
Function
LDWORD dwUser
);
[in]cbDisConnect Disconnection callback.
Parameter
[in]dwUser User parameter of disconnection callback.
 Success: TRUE.
Return value
 Failure: FALSE.
 The precondition for calling other function modules.
Note  If the callback is set as NULL, the callback will not be sent to the user
after the device is disconnected.

3.1.2 CLIENT_Cleanup
Item Description
Name Clean up SDK.
Function void CLIENT_Cleanup();
Parameter None.
Return value None.
Note Call the SDK cleanup interface before the process ends.

3.1.3 CLIENT_SetAutoReconnect
Item Description
Name Set auto reconnection callback.
void CLIENT_SetAutoReconnect(
fHaveReConnect cbAutoConnect,
Function
LDWORD dwUser
);
[in]cbAutoConnect Reconnection callback.
Parameter
[in]dwUser User parameter of disconnection callback.

Interface Definition 32
Item Description
Return value None.
Set the reconnection callback interface. If the callback is set as NULL, it will
Note
not connect automatically.

3.1.4 CLIENT_SetNetworkParam
Item Description
Name Set the related parameters for network environment.
void CLIENT_SetNetworkParam(
Function NET_PARAM *pNetParam
);
Parameters such as network delay, reconnection
Parameter [in]pNetParam
times, and cache size.
Return value None.
Note Adjust the parameters according to the actual network environment.

3.2 Device Initialization


3.2.1 CLIENT_StartSearchDevices
Item Description
Name Search the device.
LLONG CLIENT_StartSearchDevices (
fSearchDevicesCB cbSearchDevices,
Function void* pUserData,
char* szLocalIp=NULL
);
[in]cbSearchDevices Device information callback.
[out]pUserData User data.
 In case of single network card, enter NULL,
Parameter
which means using the host PC IP.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the specified network card.
Return value Searching handle.
Note Multi-thread calling is not supported.

3.2.2 CLIENT_InitDevAccount
Item Description
Name Initialize the device.

Interface Definition 33
Item Description
BOOL CLIENT_InitDevAccount(
const NET_IN_INIT_DEVICE_ACCOUNT *pInitAccountIn,
NET_OUT_INIT_DEVICE_ACCOUNT *pInitAccountOut,
Function
DWORD dwWaitTime,
char *szLocalIp
);
Corresponds to structure of
[in]pInitAccountIn
NET_IN_INIT_DEVICE_ACCOUNT.
Corresponds to structure of
[out]pInitAccountOut
NET_OUT_INIT_DEVICE_ACCOUNT.
Parameter [in]dwWaitTime Timeout.
 In case of single network card, the last
parameter is not required to be filled.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the host PC for the last parameter.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.2.3 CLIENT_GetDescriptionForResetPwd
Name Description
Name Get information for password reset.
BOOL CLIENT_GetDescriptionForResetPwd(
const NET_IN_DESCRIPTION_FOR_RESET_PWD *pDescriptionIn,
NET_OUT_DESCRIPTION_FOR_RESET_PWD
Function *pDescriptionOut,
DWORD dwWaitTime,
char *szLocalIp
);
Corresponds to structure of
[in]pDescriptionIn
NET_IN_DESCRIPTION_FOR_RESET_PWD.
Corresponds to structure of
[out]pDescriptionOut
NET_OUT_DESCRIPTION_FOR_RESET_PWD.
Parameter [in]dwWaitTime Timeout.
 In case of single network card, the last
parameter is not required to be filled.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the host PC for the last parameter.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

Interface Definition 34
3.2.4 CLIENT_CheckAuthCode
Item Description
Name Check the validity of security code.
BOOL CLIENT_CheckAuthCode(
const NET_IN_CHECK_AUTHCODE *pCheckAuthCodeIn,
NET_OUT_CHECK_AUTHCODE *pCheckAuthCodeOut,
Function
DWORD dwWaitTime,
char *szLocalIp
);
[in]pCheckAuthCodeI Corresponds to structure of
n NET_IN_CHECK_AUTHCODE.
[out]pCheckAuthCod Corresponds to structure of
eOut NET_OUT_CHECK_AUTHCODE.
Parameter [in]dwWaitTime Timeout.
 In case of single network card, the last
parameter is not required to be filled.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the host PC for the last parameter.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.2.5 CLIENT_ResetPwd
Item Description
Name Reset the password.
BOOL CLIENT_ResetPwd(
const NET_IN_RESET_PWD *pResetPwdIn,
NET_OUT_RESET_PWD *pResetPwdOut,
Function
DWORD dwWaitTime,
char *szLocalIp
);
Corresponds to structure of
[in]pResetPwdIn
NET_IN_RESET_PWD.
Corresponds to structure of
[out]pResetPwdOut
NET_OUT_RESET_PWD.
Parameter [in]dwWaitTime Timeout.
 In case of single network card, the last
parameter is not required to be filled.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the host PC for the last parameter.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

Interface Definition 35
3.2.6 CLIENT_GetPwdSpecification
Item Description
Name Get password rules.
BOOL CLIENT_GetPwdSpecification(
const NET_IN_PWD_SPECI *pPwdSpeciIn,
NET_OUT_PWD_SPECI *pPwdSpeciOut,
Function
DWORD dwWaitTime,
char *szLocalIp
);
Corresponds to structure of
[in]pPwdSpeciIn
NET_IN_PWD_SPECI.
Corresponds to structure of
[out]pPwdSpeciOut
NET_OUT_PWD_SPECI.
Parameter [in]dwWaitTime Timeout.
 In case of single network card, the last
parameter is not required to be filled.
[in]szLocalIp
 In case of multiple network card, enter the IP
of the host PC for the last parameter.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.2.7 CLIENT_StopSearchDevices
Item Description
Name Stop searching.
BOOL CLIENT_StopSearchDevices (
Function LLONG lSearchHandle
);
Parameter [in] lSearchHandle Searching handle.
 Success: TRUE.
Return value
 Failure: FALSE.
Note Multi-thread calling is not supported.

3.3 Device Login


3.3.1 CLIENT_LoginEx2
Item Description
Name Login the device.

Interface Definition 36
Item Description
LLONG CLIENT_LoginEx2(
const char *pchDVRIP,
WORD wDVRPort,
const char *pchUserName,
const char *pchPassword,
Function
EM_LOGIN_SPAC_CAP_TYPE emSpecCap,
void* pCapParam,
LPNET_DEVICEINFO_Ex lpDeviceInfo,
int *error
);
[in]pchDVRIP Device IP.
[in]wDVRPort Device port.
[in]pchUserName User name.
[in]pchPassword Password.
Parameter
[in]emSpecCap Login category.
[in]pCapParam Login category parameter.
[out]lpDeviceInfo Device information.
[out]error Error code for failure.
 Success: not 0.
Return value
 Failure: 0.
Note None.
The following table shows information about error code:
Code of error Meaning
1 Wrong password.
2 The user name does not exist.
3 Login timeout.
4 The account has logged in.
5 The account has been locked.
6 The account has been blacklisted.
7 The device resource is insufficient and the system is busy.
8 Sub connection failed.
9 Main connection failed.
10 Exceeds the maximum allowed number of user connections.
11 Lacks the dependent libraries such as avnetsdk or avnetsdk.
12 USB flash disk is not inserted or the USB flash disk information is wrong.
13 The IP at client is not authorized for login.
Table 3-1

3.3.2 CLIENT_Logout
Item Description
Name User logout the device.

Interface Definition 37
Item Description
BOOL CLIENT_Logout(
Function LLONG lLoginID
);
Parameter [in]lLoginID Return value of CLIENT_LoginEx2.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.4 Real-time Monitoring


3.4.1 CLIENT_RealPlayEx
Item Description
Name Open the real-time monitoring.
LLONG CLIENT_RealPlayEx(
LLONG lLoginID,
int nChannelID,
Function
HWND hWnd,
DH_RealPlayType rType
);
[in]lLoginID Return value of CLIENT_LoginEx2.
Video channel number is a round number starting
[in]nChannelID
Parameter from 0.
[in]hWnd Window handle valid only under Windows system.
[in]rType Preview type.
 Success: not 0
Return value
 Failure: 0
Windows system:
 When hWnd is valid, the corresponding window displays picture.
Note
 When hWnd is NULL, get the video data through setting a callback and
send to user for handle.
The following table shows information about preview type:
Preview type Meaning
DH_RType_Realplay Real-time preview
DH_RType_Multiplay Multi-picture preview
Real-time monitoring—main stream, equivalent to
DH_RType_Realplay_0
DH_RType_Realplay
DH_RType_Realplay_1 Real-time monitoring—sub stream 1
DH_RType_Realplay_2 Real-time monitoring—sub stream 2
DH_RType_Realplay_3 Real-time monitoring—sub stream 3
DH_RType_Multiplay_1 Multi-picture preview—1 picture
DH_RType_Multiplay_4 Multi-picture preview—4 pictures
DH_RType_Multiplay_8 Multi-picture preview—8 pictures

Interface Definition 38
Preview type Meaning
DH_RType_Multiplay_9 Multi-picture preview—9 pictures
DH_RType_Multiplay_16 Multi-picture preview—16 pictures
DH_RType_Multiplay_6 Multi-picture preview—6 pictures
DH_RType_Multiplay_12 Multi-picture preview—12 pictures
DH_RType_Multiplay_25 Multi-picture preview—25 pictures
DH_RType_Multiplay_36 Multi-picture preview—36 pictures
Table 3-2

3.4.2 CLIENT_StopRealPlayEx
Item Description
Name Stop the real-time monitoring.
BOOL CLIENT_StopRealPlayEx(
Function LLONG lRealHandle
);
Parameter [in]lRealHandle Return value of CLIENT_RealPlayEx.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.4.3 CLIENT_SaveRealData
Item Description
Name Save the real-time monitoring data as file.
BOOL CLIENT_SaveRealData(
LLONG lRealHandle,
Function
const char *pchFileName
);
[in] lRealHandle Return value of CLIENT_RealPlayEx.
Parameter
[in] pchFileName Save path.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.4.4 CLIENT_StopSaveRealData
Item Description
Name Stop saving the real-time monitoring data as file.
BOOL CLIENT_StopSaveRealData(
Function LLONG lRealHandle
);
Parameter [in] lRealHandle Return value of CLIENT_RealPlayEx.
 Success: TRUE.
Return value
 Failure: FALSE.

Interface Definition 39
Item Description
Note None.

3.4.5 CLIENT_SetRealDataCallBackEx2
Item Description
Name Set the callback of real-time monitoring data.
BOOL CLIENT_SetRealDataCallBackEx(
LLONG lRealHandle,
fRealDataCallBackEx2 cbRealData,
Function
LDWORD dwUser,
DWORD dwFlag
);
[in] lRealHandle Return value of CLIENT_RealPlayEx.
[in] cbRealData Callback of monitoring data flow.
[in] dwUser Parameter of callback for monitoring data flow.
Parameter
Type of monitoring data in callback. The type is
[in] dwFlag EM_REALDATA_FLAG and supports OR
operation.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.
The following table shows information about parameter dwFlag:
dwFlag Meaning
REALDATA_FLAG_RAW_DATA Initial data labels.
REALDATA_FLAG_DATA_WITH_FRAME_INFO Data labels with frame information.
REALDATA_FLAG_YUV_DATA YUV data labels.
REALDATA_FLAG_PCM_AUDIO_DATA PCM audio data labels.
Table 3-3

3.5 Video Snapshot


3.5.1 CLIENT_SnapPictureToFile
Item Description
Name Snapshot.
BOOL CLIENT_SnapPictureToFile(
LLONG lLoginID,
Function const NET_IN_SNAP_PIC_TO_FILE_PARAM* pInParam,
NET_OUT_SNAP_PIC_TO_FILE_PARAM* pOutParam, int nWaitTime
);
[in] lLoginID Return value of CLIENT_LoginEx2.
Parameter
[in] pInParam Input parameter.

Interface Definition 40
Item Description
[in] pOutParam Output parameter.
[in] nWaitTime Timeout. The unit is millisecond.
 Success: TRUE.
Return value
 Failure: FALSE.
 Synchronous interface. The device captures snapshot and sends to
Note the user through internet.
 The device is required to support this function.

3.5.2 CLIENT_CapturePictureEx
Item Description
Name Snapshot.
BOOL CLIENT_CapturePictureEx(
LLONG hPlayHandle,
Function const char *pchPicFileName,
NET_CAPTURE_FORMATS eFormat
);
[in] hPlayHandle Return value of CLIENT_RealPlayEx.
Parameter [in] pchPicFileName Save path.
[in] eFormat Picture format.
 Success: TRUE.
Return value
 Failure: FALSE.
 Synchronous interface. Directly write the picture data as file.
Note  Capture the pictures from the real-time monitoring data stream from
device.

3.6 PTZ Control


3.6.1 CLIENT_DHPTZControlEx2
Item Description
Name PTZ control.
BOOL CLIENT_DHPTZControlEx2(
LLONG lLoginID,
int nChannelID,
DWORD dwPTZCommand,
LONG lParam1,
Function
LONG lParam2,
LONG lParam3,
BOOL dwStop ,
void* param4
);

Interface Definition 41
Item Description
[in] lLoginID Return value of CLIENT_LoginEx2.
Video channel number that is a round number
[in] nChannelID
starting from 0.
[in] dwPTZCommand Control command type.
[in] lParam1 Parameter 1.
[in] lParam2 Parameter 2.
[in] lParam3 Parameter 3.
Stop mark, which is valid for operations of eight
[in] dwStop directions. When performing other operations,
Parameter enter FALSE for this parameter.
Support the following extension command:
DH_EXTPTZ_MOVE_ABSOLUTELY
DH_EXTPTZ_MOVE_CONTINUOUSLY
DH_EXTPTZ_GOTOPRESET
[in] param4 DH_EXTPTZ_SET_VIEW_RANGE
DH_EXTPTZ_FOCUS_ABSOLUTELY
DH_EXTPTZ_HORSECTORSCAN
DH_EXTPTZ_VERSECTORSCAN
DH_EXTPTZ_SET_FISHEYE_EPTZ
 Success: TRUE.
Return value
 Failure: FALSE.
For the relationship between dwPTZCommand and Param1, Param2 and
Note
Param3, see Table 3-4.
For the relationship between dwPTZCommand and Param1, Param2 and Param3, see Table
3-4.
dwPTZCommand macro
Function param1 param2 param3
definition
DH_PTZ_UP_CONTRO Vertical speed
Up None None
L (1–8)
DH_PTZ_DOWN_CONT Vertical speed
Down None None
ROL (1–8)
DH_PTZ_LEFT_CONTR Horizontal
Left None None
OL speed (1–8)
DH_PTZ_RIGHT_CONT Horizontal
Right None None
ROL speed (1–8)
DH_PTZ_ZOOM_ADD_
Zoom+ None Multi-speed None
CONTROL
DH_PTZ_ZOOM_DEC_
Zoom- None Multi-speed None
CONTROL
DH_PTZ_FOCUS_ADD
Focus+ None Multi-speed None
_CONTROL
DH_PTZ_FOCUS_DEC
Focus- None Multi-speed None
_CONTROL
DH_PTZ_APERTURE_A
Aperture+ None Multi-speed None
DD_CONTROL

Interface Definition 42
dwPTZCommand macro
Function param1 param2 param3
definition
DH_PTZ_APERTURE_
Aperture- None Multi-speed None
DEC_CONTROL
DH_PTZ_POINT_MOVE Move to preset Value of
None None
_CONTROL point preset point
DH_PTZ_POINT_SET_ Value of
Set None None
CONTROL preset point
DH_PTZ_POINT_DEL_ Value of
Delete None None
CONTROL preset point
76: Start
DH_PTZ_POINT_LOOP Cruise among
Cruise route None 99: Automatic
_CONTROL points
96: Stop
DH_PTZ_LAMP_CONT 0x01: Start
Lamp wiper None None
ROL x00: Stop
Vertical speed Horizontal
DH_EXTPTZ_LEFTTOP Left top None
(1–8) speed (1–8)
DH_EXTPTZ_RIGHTTO Vertical speed Horizontal
Right top None
P (1–8) speed (1–8)
DH_EXTPTZ_LEFTDO Vertical speed Horizontal
Left bottom None
WN (1–8) speed (1–8)
DH_EXTPTZ_RIGHTDO Vertical speed Horizontal
Right bottom None
WN (1–8) speed (1–8)
DH_EXTPTZ_ADDTOL Add preset Value of
Tour route None
OOP point to tour preset point
DH_EXTPTZ_DELFRO Delete preset Value of
Cruise route None
MLOOP point in cruise preset point
DH_EXTPTZ_CLOSELO
Delete cruise Cruise route None None
OP
DH_EXTPTZ_STARTPA Start horizontal
None None None
NCRUISE rotation
DH_EXTPTZ_STOPPAN Stop horizontal
None None None
CRUISE rotation
DH_EXTPTZ_SETLEFT
Set left border None None None
BORDER
DH_EXTPTZ_RIGHTBO
Set right border None None None
RDER
DH_EXTPTZ_STARTLI
Start line scan None None None
NESCAN
DH_EXTPTZ_CLOSELI
Stop line scan None None None
NESCAN
DH_EXTPTZ_SETMOD
Set mode start Mode route None None
ESTART
DH_EXTPTZ_SETMOD
Set mode stop Mode route None None
ESTOP

Interface Definition 43
dwPTZCommand macro
Function param1 param2 param3
definition
DH_EXTPTZ_RUNMOD
Running mode Mode route None None
E
DH_EXTPTZ_STOPMO
Stop mode Mode route None None
DE
DH_EXTPTZ_DELETEM
Delete mode Mode route None None
ODE
DH_EXTPTZ_REVERS Reverse
None None None
ECOMM command
Horizontal Vertical
DH_EXTPTZ_FASTGOT Fast
coordinate (0– coordinate Zoom (4)
O positioning
8192) (0–8192)
DH_EXTPTZ_AUXIOPE Open auxiliary
Auxiliary point None None
N switch
DH_EXTPTZ_AUXICLO Close auxiliary
Auxiliary point None None
SE switch
DH_EXTPTZ_OPENME
Open SD menu None None None
NU
DH_EXTPTZ_CLOSEM
Close menu None None None
ENU
DH_EXTPTZ_MENUOK Menu confirm None None None
DH_EXTPTZ_MENUCA
Menu cancel None None None
NCEL
DH_EXTPTZ_MENUUP Menu up None None None
DH_EXTPTZ_MENUDO
Menu down None None None
WN
DH_EXTPTZ_MENULE
Menu left None None None
FT
DH_EXTPTZ_MENURIG
Menu right None None None
HT
Alarm action
type: Linkage
DH_EXTPTZ_ALARMH Alarm action Alarm input  Preset value, such
ANDLE with PTZ channel point as preset
 Line scan point number
 Cruise
Monitor
device
DH_EXTPTZ_MATRIXS Video input Matrix
Matrix switch number (video
WITCH number number
output
number)
Refer to
DH_EXTPTZ_LIGHTCO DH_PTZ_LA
Light controller None None
NTROL MP_CONTRO
L

Interface Definition 44
dwPTZCommand macro
Function param1 param2 param3
definition
Horizontal Vertical
DH_EXTPTZ_EXACTG Zoom (1–
3D positioning angle (0– coordinate (0–
OTO 128)
3600) 900)
DH_EXTPTZ_RESETZE
Reset to zero None None None
RO
DH_EXTPTZ_UP_TELE UP +TELE Speed (1–8) None None
DH_EXTPTZ_DOWN_T
DOWN +TELE Speed (1–8) None None
ELE
DH_EXTPTZ_LEFT_TE
LEFT +TELE Speed (1–8) None None
LE
DH_EXTPTZ_RIGHT_T
RIGHT +TELE Speed (1–8) None None
ELE
DH_EXTPTZ_LEFTUP_ LEFTUP
Speed (1–8) None None
TELE +TELE
DH_EXTPTZ_LEFTDO LEFTDOWN
Speed (1–8) None None
WN_TELE +TELE
DH_EXTPTZ_TIGHTUP TIGHTUP
Speed (1–8) None None
_TELE +TELE
DH_EXTPTZ_RIGHTDO RIGHTDOWN
Speed (1–8) None None
WN_TELE +TELE
DH_EXTPTZ_UP_WIDE UP +WIDE Speed (1–8) None None
DH_EXTPTZ_DOWN_W
DOWN +WIDE Speed (1–8) None None
IDE
DH_EXTPTZ_LEFT_WI
LEFT +WIDE Speed (1–8) None None
DE
DH_EXTPTZ_RIGHT_W
RIGHT +WIDE Speed (1–8) None None
IDE
DH_EXTPTZ_LEFTUP_ LEFTUP
Speed (1–8) None None
WIDE +WIDE
DH_EXTPTZ_LEFTDO LEFTDOWN
Speed (1–8) None None
WN_WIDE +WIDE
DH_EXTPTZ_RIGHTUP RIGHTUP
Speed (1–8) None None
_WIDE +WIDE
DH_EXTPTZ_RIGHTDO RIGHTDOWN
Speed (1–8) None None
WN_WIDE +WIDE
Table 3-4

3.7 Voice Talk


3.7.1 CLIENT_StartTalkEx
Item Description

Interface Definition 45
Item Description
Name Start voice talk.
LLONG CLIENT_StartTalkEx(
LLONG lLoginID,
Function pfAudioDataCallBack pfcb,
LDWORD dwUser
);
[in] lLoginID Return value of CLIENT_LoginEx2.
Parameter [in] pfcb Audio data callback.
[in] dwUser Parameter of audio data callback.
 Success: Not 0.
Return value
 Failure: 0.
Note None.

3.7.2 CLIENT_StopTalkEx
Item Description
Name Stop voice talk.
BOOL CLIENT_StopTalkEx(
Function LLONG lTalkHandle
);
Parameter [in] lTalkHandle Return value of CLIENT_StartTalkEx.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.7.3 CLIENT_RecordStartEx
Item Description
Name Start local recording.
BOOL CLIENT_RecordStartEx(
Function LLONG lLoginID
);
Parameter [in] lLoginID Return value of CLIENT_LoginEx2.
 Success: TRUE.
Return value
 Failure: FALSE.
Note Valid only in Windows system.

3.7.4 CLIENT_RecordStopEx
Item Description
Name Stop local recording.
BOOL CLIENT_RecordStopEx(
Function LLONG lLoginID
);

Interface Definition 46
Item Description
Parameter [in] lLoginID Return value of CLIENT_LoginEx2.
 Success: TRUE.
Return value
 Failure: FALSE.
Note Valid only in Windows system.

3.7.5 CLIENT_TalkSendData
Item Description
Name Send audio data to device.
Function LONG CLIENT_TalkSendData(
LLONG lTalkHandle,
char *pSendBuf,
DWORD dwBufSize
);
Parameter [in] lTalkHandle Return value of CLIENT_StartTalkEx.
[in] pSendBuf Pointer of audio data block that needs to be sent.
[in] dwBufSize Length of audio data black that needs to be sent.
The unit is byte.
Return value  Success: Length of audio data block.
 Failure: -1.
Note None.

3.7.6 CLIENT_AudioDecEx
Item Description
Name Decode audio data.
BOOL CLIENT_AudioDecEx(
LLONG lTalkHandle,
Function char *pAudioDataBuf,
DWORD dwBufSize
);
[in] lTalkHandle Return value of CLIENT_StartTalkEx.
[in] pAudioDataBuf Pointer of audio data block that needs decoding.
Parameter
Length of audio data black that needs decoding.
[in] dwBufSize
The unit is byte.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

Interface Definition 47
3.8 Heat Map (Temperature)
3.8.1 CLIENT_RadiometryAttach
Item Description
Name Start subscribing heat map data.
LLONG CLIENT_RadiometryAttach(
LLONG lLoginID,
const NET_IN_RADIOMETRY_ATTACH* pInParam,
Function
NET_OUT_RADIOMETRY_ATTACH* pOutParam,
int nWaitTime
);
[in] lLoginID Return value of CLIENT_LoginEx2.
[in] pInParam Input parameter.
Parameter
[in] pOutParam Output parameter.
[in] nWaitTime Timeout. The unit is millisecond.
 Success: Not 0.
Return value
 Failure: 0.
Note None.

3.8.2 CLIENT_RadiometryDetach
Item Description
Name Stop subscribing heat map data.
BOOL CLIENT_RadiometryDetach(
Function LLONG lAttachHandle
);
Parameter [in] lAttachHandle Return value of CLIENT_ RadiometryAttach.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.8.3 CLIENT_RadiometryFetch
Item Description
Name Capture heat map data.
BOOL CLIENT_RadiometryFetch(
LLONG lLoginID,
const NET_IN_RADIOMETRY_FETCH* pInParam,
Function
NET_OUT_RADIOMETRY_FETCH* pOutParam,
int nWaitTime
);
[in] lLoginID Return value of CLIENT_LoginEx2.
Parameter
[in] pInParam Input parameter.

Interface Definition 48
Item Description
[in] pOutParam Output parameter.
[in] nWaitTime Timeout. The unit is millisecond.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.8.4 CLIENT_RadiometryDataParse
Item Description
Name Parse heat map data.
BOOL CLIENT_RadiometryDataParse(
const NET_RADIOMETRY_DATA* pBuf,
Function unsigned short* pImg,
float* pTemp
);
[in] pBuf Heat map data.
Unzipped data is a gray map.
[in out] pImg Introducing null pointer indicates this data is not
Parameter needed.
Temperature data of each pixel.
[in out] pTemp Introducing null pointer indicates this data is not
needed.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

3.9 Heat Map (Activity)


3.9.1 CLIENT_QueryDevState
Item Description
Name Get the connection state of remote device.
BOOL CLIENT_QueryDevState(
LLONG lLoginID,
int nType,
char *pBuf,
Function
int nBufLen,
int *pRetLen,
int waittime=1000
);
[in]lLoginID Return value of CLIENT_LoginEx2
Parameter
[in]nType Query information type.

Interface Definition 49
Item Description
Buffer used to receive the data returned by the query.
[out] pBuf The data structure of returned data is different
according to the type of query.
[in]nBufLen Buffer length. The unit is byte.
[out]pRetLen The data length returned actually. The unit is byte.
Waiting time for query state. The default waiting time
[in]waittime
is 1000ms. It can be set according to the needs.
 Success: TRUE.
Return value
 Failure: FALSE.
Note None.

Query Name nType pBuf


Get the statistical
DH_DEVSTATE_GET_HEAT_MAP NET_QUERY_HEAT_MAP
activity information

Interface Definition 50
4 Callback Definition

4.1 fSearchDevicesCB
Item Description
Name Callback of searching devices.
typedef void(CALLBACK *fSearchDevicesCB)(
DEVICE_NET_INFO_EX * pDevNetInfo,
Function
void* pUserData
);
[out]pDevNetInfo The searched device information.
Parameter
[out]pUserData User data.
Return value None.
Note None.

4.2 fDisConnect
Item Description
Name Disconnection callback.
typedef void (CALLBACK *fDisConnect)(
LLONG lLoginID,
char *pchDVRIP,
Function
LONG nDVRPort,
LDWORD dwUser
);
[out] lLoginID Return value of CLIENT_LoginEx2.
[out] pchDVRIP IP of the disconnected device.
Parameter
[out] nDVRPort Port of the disconnected device.
[out] dwUser User parameter of the callback.
Return value None.
Note None.

4.3 fHaveReConnect
Item Description
Name Reconnection callback.

Callback Definition 51
Item Description
typedef void (CALLBACK *fHaveReConnect)(
LLONG lLoginID,
char *pchDVRIP,
Function
LONG nDVRPort,
LDWORD dwUser
);
[out] lLoginID Return value of CLIENT_LoginEx2.
[out] pchDVRIP IP of the reconnected device.
Parameter
[out] nDVRPort Port of the reconnected device.
[out] dwUser User parameter of the callback.
Return value None.
Note None.

4.4 fRealDataCallBackEx2
Item Description
Name Callback of real-time monitoring data.
typedef void (CALLBACK * fRealDataCallBackEx2)(
LLONG lRealHandle,
DWORD dwDataType,
BYTE *pBuffer,
Function
DWORD dwBufSize,
LLONG param,
LDWORD dwUser
);
[out] lRealHandle Return value of CLIENT_RealPlayEx.
Data type:
 0: Initial data.
[out] dwDataType  1: Data with frame information.
Parameter
 2: YUV data.
 3: PCM audio data.
[out] pBuffer Address of monitoring data block.
[out] dwBufSize Length (unit: byte) of the monitoring data block.

Callback Definition 52
Item Description
Callback parameter structure. Different dwDataType
value corresponds to different type.
 The param is blank pointer when dwDataType is
0.
 The param is the pointer of
tagVideoFrameParam structure when
[out] param dwDataType is 1.
 The param is the pointer of
tagCBYUVDataParam structure when
dwDataType is 2.
 The param is the pointer of
tagCBPCMDataParam structure when
dwDataType is 3.
[out] dwUser User parameter of the callback.
Return value None.
Note None.

4.5 pfAudioDataCallBack
Item Description
Name Audio data callback of voice talk.
typedef void (CALLBACK *pfAudioDataCallBack)(
LLONG lTalkHandle,
char *pDataBuf,
Function DWORD dwBufSize,
BYTE byAudioFlag,
LDWORD dwUser
);
[out] lTalkHandle Return value of CLIENT_StartTalkEx.
[out] pDataBuf Address of audio data block.
[out] dwBufSize Length of the audio data block. The unit is byte.
Parameter Data type:
[out] byAudioFlag 0: Local collecting.
1: Sending from device.
[out] dwUser User parameter of the callback.
Return value None.
Note None.

4.6 fRadiometryAttachCB
Item Description

Callback Definition 53
Name Callback of temperature distribution data.
typedef void (CALLBACK *fRadiometryAttachCB)(
LLONG lAttachHandle,
NET_RADIOMETRY_DATA* pBuf,
Function
int nBufLen,
LDWORD dwUser
);
[out] lAttachHandle Return value of CLIENT_RadiometryAttach.
[out] pBuf Address of data block.
Parameter
[out] nBufLen Length of the data block. The unit is byte.
[out] dwUser User parameter of the callback.
Return value None.
Note None.

Callback Definition 54

You might also like