NetSDK Programming Manual (Intelligent Analysis Server)
NetSDK Programming Manual (Intelligent Analysis Server)
Programming Manual
V1.0.2
Foreword
Purpose
Reader
Safety Instructions
The following categorized signal words with defined meaning might appear in the manual.
Signal Words Meaning
TIPS Provides methods to help you solve a problem or save you time.
I
Revision History
The manual is for reference only. If there is inconsistency between the manual and the
actual product, the actual product shall prevail.
We are not liable for any loss caused by the operations that do not comply with the manual.
The manual would be updated according to the latest laws and regulations of related
jurisdictions. For detailed information, refer to the paper manual, CD-ROM, QR code or our
official website. If there is inconsistency between paper manual and the electronic version,
the electronic version shall prevail.
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 in technical data, functions and operations description, or
errors in print. If there is any doubt or dispute, we reserve the right of final explanation.
Upgrade the reader software or try other mainstream reader software if the manual (in PDF
format) cannot be opened.
All trademarks, registered trademarks and the company names in the manual are the
properties of their respective owners.
Please visit our website, contact the supplier or customer service if there is any problem
occurring when using the device.
If there is any uncertainty or controversy, we reserve the right of final explanation.
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 and
Main Stream
provides a better experience if the network resource is not restricted.
A type of video stream that usually has lower resolution and clarity than
Sub Stream the main stream but demands less network resources. The user can
choose the stream type according to the particular scenes.
A channel number for video stream transmission between SDK and
devices. For example, if NVR communicates with the front-end devices
Video Channel
such as SD, IPC, NVR manages SD or IPC as a video channel. If SDK
directly connects to a front-end device, usually the channel number is 0.
A unique ID for communication with device. It is of a round number and
Login Handle
not 0 and maintained within SDK.
A unique ID for data transmission with a video channel. It is of a round
Monitoring Handle
number and not 0.
A unique ID for subscribing real-time upload of intelligent event. It is of a
Subscription Handle
round number and not 0.
A set of capabilities for a single function or a set of functions. The
Capability Set
capability set might be different dependent on device model.
Detection of Crossing
Automatic detection of crossing fence behavior.
fence
Detection of Invading
Automatic detection of invading tripwire behavior.
Tripwire
Detection of Invading Automatic detection of invading warning area behavior: Crossing area
Area and staying in the area.
Detection of
Automatic detection of the emerging and still objects.
Abandoning Objects
Detection of Alarm for the selected objects that has been shaded for a long time or
Safeguarding Objects moved from the place.
Detection of Moving Alarm for the objects that has been moved from the detection covered
Objects place.
Detection of Automatic detection of invading behavior that stays longer than the
Wandering preset time.
Automatic detection of abnormal behaviors such as scene changes,
Detection of Video
video loss, video shade, excessive brightness, excessive darkness,
Abnormal
definition, stripe, noise, and color cast.
Detection of Climbing Automatic detection of climbing behavior in the warning area.
Detection of Fighting Automatic detection of fighting behavior in the warning area.
Detection of Off-post Automatic detection of leaving the post in the warning area.
Detection on Getting
Automatic detection when the target is getting up.
up
III
Detection on Crossing
Automatic detection of crossing over warning line.
Over Warning Line
Detection on Invading Automatic detection of invading warning line, including entering warning
Warning Line area, leaving warning area, and within the warning area.
Detection of Normal
Detection of normal face in face monitoring video.
Face
Detection of Abnormal Detection of abnormal face in face monitoring video, including covering
Face of mouse or eyes.
Detection of Detection of two faces that appear in the monitoring area indicating one
Neighboring Faces is following the other.
Illegal Sticky Notes The sticky notes on the cash slot monitoring video.
Detection of Entering
Detection of entering operation area in the cash slot monitoring video.
Operation Area
Detection of Leaving
Detection of leaving operation area in the cash slot monitoring video.
Operation Area
Detection of Staying
Detection of staying operation area in the cash slot monitoring video.
Operation Area
IV
Table of Contents
Foreword .................................................................................................................................................... I
Glossary ................................................................................................................................................... III
1 Overview ................................................................................................................................................. 1
1.1 General.......................................................................................................................................... 1
1.2 Applicability ................................................................................................................................... 2
1.3 Application Scenario ..................................................................................................................... 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 ............................................................................................................................... 6
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 ..............................................................................................................................11
2.3.4 Example Code .................................................................................................................. 12
2.4 Real-time Monitoring ................................................................................................................... 13
2.4.1 Introduction ....................................................................................................................... 13
2.4.2 Interface Overview ............................................................................................................ 13
2.4.3 Process ............................................................................................................................. 13
2.4.4 Example Code .................................................................................................................. 17
2.5 Detention Dedicated ................................................................................................................... 18
2.5.1 Introduction ....................................................................................................................... 18
2.5.2 Interface Overview ............................................................................................................ 19
2.5.3 Process ............................................................................................................................. 19
2.5.4 Example Code .................................................................................................................. 20
2.6 Intelligent ATM............................................................................................................................. 23
2.6.1 Introduction ....................................................................................................................... 23
2.6.2 Interface Overview ............................................................................................................ 24
2.6.3 Process ............................................................................................................................. 24
2.6.4 Example Code .................................................................................................................. 25
2.7 Guest Flow Statistics .................................................................................................................. 28
2.7.1 Introduction ....................................................................................................................... 28
2.7.2 Interfaces Overview .......................................................................................................... 29
2.7.3 Process ............................................................................................................................. 29
2.7.4 Example Code .................................................................................................................. 31
3 Interface Definition .............................................................................................................................. 36
V
3.1 SDK Initialization ......................................................................................................................... 36
3.1.1 SDK CLIENT_Init .............................................................................................................. 36
3.1.2 CLIENT_Cleanup.............................................................................................................. 36
3.1.3 CLIENT_SetAutoReconnect ............................................................................................. 36
3.1.4 CLIENT_SetNetworkParam.............................................................................................. 37
3.2 Device Initialization ..................................................................................................................... 37
3.2.1 CLIENT_StartSearchDevicesEx ....................................................................................... 37
3.2.2 CLIENT_InitDevAccount................................................................................................... 37
3.2.3 CLIENT_GetDescriptionForResetPwd ............................................................................. 38
3.2.4 CLIENT_CheckAuthCode................................................................................................. 39
3.2.5 CLIENT_ResetPwd........................................................................................................... 39
3.2.6 CLIENT_GetPwdSpecification.......................................................................................... 40
3.2.7 CLIENT_StopSearchDevices ........................................................................................... 40
3.3 Device Login ............................................................................................................................... 41
3.3.1 CLIENT_LoginWithHighLevelSecurity.............................................................................. 41
3.3.2 CLIENT_Logout ................................................................................................................ 42
3.4 Real-time Monitoring ................................................................................................................... 42
3.4.1 CLIENT_RealPlayEx ........................................................................................................ 42
3.4.2 CLIENT_StopRealPlayEx ................................................................................................. 43
3.4.3 CLIENT_SaveRealData .................................................................................................... 43
3.4.4 CLIENT_StopSaveRealData ............................................................................................ 44
3.4.5 CLIENT_SetRealDataCallBackEx2 .................................................................................. 44
3.5 Subscription of Intelligent Event ................................................................................................. 45
3.5.1 CLIENT_RealLoadPictureEx ............................................................................................ 45
3.5.2 CLIENT_StopLoadPic ...................................................................................................... 46
3.6 Guest Flow Statistics .................................................................................................................. 47
3.6.1 CLIENT_AttachVideoStatSummary ................................................................................. 47
3.6.2 CLIENT_DetachVideoStatSummary ................................................................................ 47
3.6.3 CLIENT_StartFindNumberStat ......................................................................................... 47
3.6.4 CLIENT_DoFindNumberStat ............................................................................................ 48
3.6.5 CLIENT_StopFindNumberStat ......................................................................................... 48
4 Callback Definition .............................................................................................................................. 49
4.1 fSearchDevicesCB ...................................................................................................................... 49
4.2 fSearchDevicesCBEx.................................................................................................................. 49
4.3 fDisConnect................................................................................................................................. 49
4.4 fHaveReConnect ......................................................................................................................... 50
4.5 fRealDataCallBackEx2 ................................................................................................................ 50
4.6 fAnalyzerDataCallBack ............................................................................................................... 51
4.7 fVideoStatSumCallBack .............................................................................................................. 52
Appendix 1 Cybersecurity Recommendations ................................................................................... 53
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, report and snapshot of intelligent events,
and guest flow statistics.
The development kit might be different dependent on the environment.
1
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 decode and
play the streams.
The auxiliary library decodes the audio and video streams for the functions such as
monitoring, playback, and bidirectional talk, and collects the local audios.
If the function library includes libavnetsdk.so or avnetsdk.dll, the corresponding auxiliary
library is necessary.
1.2 Applicability
2
2 Function Modules
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.3 Process
Figure 2-1 Process of SDK initialization
3
Process Description
4
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.
5
2.2.3 Process
Start
Initialization
CLIENT_Init
Search Device
CLIENT_StartSearchDevicesEx
Initialize device
CLIENT_InitDevAccount
Stop searching
CLIENT_StopSearchDevices
Logout
CLIENT_Logout
Stop
Process Description
6
Step 6 Call CLIENT_LoginWithHighLevelSecurity 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.
Because the interface is working in multicast, the host PC and device must be in the same
multicast group.
Start
Initialization
CLIENT_Init
Search device
CLIENT_StartSearchDevicesEx
Reset password
CLIENT_ResetPwd
Stop Searching
CLIENT_StopSearchDevices
Mandotory
Stop
Process Description
7
Multi-thread calling is not supported.
Step 3 Call CLIENT_GetDescriptionForResetPw 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.
Step 7 Call CLIENT_StopSearchDevices to stop searching.
Step 8 Call CLIENT_LoginWithHighLevelSecurity 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.
Because the interface is working in multicast, the host PC and device must be in the same
multicast group.
//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
8
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);
9
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 CLIENT_StartSearchDevice and CLIENT_StartSearchDeviceEx,
and CLIENT_SearchDevicesByIPs)
stIn3.byPwdResetWay = bPwdResetWay; // bPwdResetWay is the value of return field byPwdResetWay
of device search interface (Callback of CLIENT_SearchDevices CLIENT_StartSearchDevice and
CLIENT_StartSearchDeviceEx, 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.
2.3.1 Introduction
Device login, also called user authentication, is the precondition of all the other function
modules.
You can obtain a unique login ID upon logging in to the device and should call login ID before
using other SDK interfaces. The login ID becomes invalid once logged out.
10
2.3.3 Process
Figure 2-4 Process of device login
Start
Logout
CLIENT_Logout
Stop
Process Description
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.
11
Login failure: It is suggested to check the failure through the error parameter of the login
interface.
NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY stOutparam;
memset(&stOutparam, 0, sizeof(stOutparam));
stOutparam.dwSize = sizeof(stOutparam);
LLONG lLoginID = CLIENT_LoginWithHighLevelSecurity(&stInparam, &stOutparam);
12
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 for independent treatment.
Supports saving the real-time record to the specific file though saving the callback stream
or calling the SDK interface.
2.4.3 Process
You can realize the real-time monitoring through SDK decoding library or your play library.
Call PlaySDK library from the SDK auxiliary library to realize real-time play.
13
Figure 2-5 Process of playing by SDK decoding library
Start
Initialize SDK
CLIENT_Init
Close
Mandotory Optional
Process Description
SDK decoding play only supports Windows system. You need to call the decoding after
getting the stream in other systems.
14
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 a login. 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."
SDK calls back the real-time monitoring stream to you and you call PlaySDK to decode and
play.
15
Figure 2-6 Process of calling the third party play library
Start
Initialize SDK
CLIENT_Init
Logout
CLIENT_Logout
Stop
Process Description
16
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.
// 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);
}
17
getchar();
// Stop preview
if (0 != lRealHandle)
{
CLIENT_StopRealPlayEx(lRealHandle);
}
2.5.1 Introduction
Product Description
Prison dedicated function integrates audio & video data collecting, wire transmission, storage,
and intelligent detection and alarm. Besides the common outdoor intelligent detection functions,
it has the functions such as fight detecting, detecting on getting up, off-post detecting, detecting
on climbing, and video abnormal. This product is widely used in the particular places such as
prison and detention house.
Product Model
You can access to SDK to subscribe the intelligent event of behavior analysis from the
DH-IVS-IP7200 series device, and obtains the subscribed intelligent event and data
information.
Before subscribing the behavior detecting event, you need to configure the rules triggered by
behavior detecting at Web.
18
Table 2-6 Behavior detecting supported by the DH-IVS-IP7200 series product
Scenario Supported behavior detection
Analyze and detect the behaviors such as crossing fence, invading tripwire,
Ordinary abandoning objects, safeguarding objects, moving objects, wandering detecting,
and video abnormal.
Analyze and detect the behaviors such as sound abnormal, invading area,
Detention climbing detection, fighting detection, off-post detection, detecting upon getting
up, video abnormal, and wandering detection.
2.5.3 Process
Figure 2-7 Process of subscribing intelligent events on behaviors analysis
Start
Initialize SDK
CLIENT_Init
Logout
CLIENT_Logout
Stop
19
Process Description
Set data receiving cache: Because SDK default cache is 2 M, when the data is over 2 M,
call CLIENT_SetNetworkParam to set the receiving cache, otherwise the data pack will
be lost.
Handle the data of callback: It is not recommended to perform the time consuming
operations such as I/O or delay in parameter fAnalyzerDataCallBack, for example, local
picture saving, database insertion. In Windows system, you can use postMessage to throw
out the data and start threading treatment.
// "nSequence" represents the situation when the reported pictures are the same. "0" represents the first
appearance, "2" represents the last appearance or the appearance only once, and "1" represents there
will be more appearances from now on.
// "int nState = *(int*) reserved" represents the current status of the callback data. "0" represents the
current is real-time data, "1" represents the current callback data is offline, and "2" represents the offline
data transmission finished.
switch(dwAlarmType)
case EVENT_IVS_CROSSFENCEDETECTION:
20
DEV_EVENT_CROSSFENCEDETECTION_INFO* pCrossFence = NULL;
pCrossFence = (DEV_EVENT_CROSSFENCEDETECTION_INFO*)pAlarmInfo;
ivsInfoEx.stuEventInfo[0].alarmAction = pCrossFence->bEventAction;
ivsInfoEx.stuEventInfo[0].alarmType = dwAlarmType;
strncpy(ivsInfoEx.stuEventInfo[0].szRuleName, pCrossFence->szName,
? sizeof(ivsInfoEx.stuEventInfo[0].szRuleName) : sizeof(pCrossFence->szName)));
ivsInfoEx.stuEventInfo[0].nObjectNum = 1;
memcpy(&ivsInfoEx.stuEventInfo[0].stuObject[0],&pCrossFence->stuObject,
sizeof(pCrossFence->stuObject));
break;
case EVENT_IVS_CROSSLINEDETECTION:
//....................................................
break;
.......
default:
break;
// Download picture
// In order to prevent receiving several pictures simultaneously, use " i " to remark.
static int i;
time_t stuTime;
time(&stuTime);
21
FILE* pFile = fopen(szPicturePath, "wb");
if (NULL == pFile)
return 0;
int nWrite = 0;
while(nWrite != dwBufSize)
fclose(pFile);
return 1;
}
{
// Resource initialization
....................................................
// Device login
....................................................
LDWORD dwUser = 0;
int nChannel = 0;
// If you need to set the channel to upload all types of events, you can set dwAlarmType as
EVENT_IVS_ALL.
// If you need to set one channel to upload two types of event, please call
CLIENT_RealLoadPictureEx twice and import different types of events.
//....................................................
CLIENT_StopLoadPic(lRealLoadHandle))
22
// Exit
CLIENT_Logout(lLoginHandle))
CLIENT_Cleanup();
2.6.1 Introduction
Product Description
The intelligent Automatic Teller Machine (ATM) detects and analyzes the front-end devices
according to the analysis videos, rules and functions configured by the platform, and gives an
alarm when the illegal situations such as sticky notes, abnormal faces, wandering, abandoned
objects. This product mainly applies to Dahua intelligent analysis server DH-IVS-IF70XX series
of financial industry.
Product Model
You can access to SDK to subscribe the intelligent event of behavior analysis from the
DH-IVS-IF70XX series device, and obtain the subscribed intelligent event and data information.
Before subscribing the behavior detecting event, you need to configure the rules triggered by
behavior detecting at Web.
DH-IVS-IF70XX series product support the following behaviors detection: crossing the warning
line, invading the warning area, wandering, objects abandoning, objects moving, face abnormal,
similar faces, illegal sticky notes, and entering, leaving and staying in the operation area.
23
2.6.2 Interface Overview
Table 2-8 Interfaces of intelligent ATM
Interface Implication
Start analyzing intelligent events and
CLIENT_RealLoadPictureEx
subscribing data.
Stop analyzing intelligent events and
CLIENT_StopLoadPic
subscribing data.
fAnalyzerDataCallBack Intelligent events analysis data.
2.6.3 Process
Figure 2-8 Process of subscribing intelligent events on behaviors analysis in the intelligent ATM
Start
Initialize SDK
CLIENT_Init
Logout
CLIENT_Logout
Stop
Process Description
24
Notes for Process
Set data receiving cache: Because SDK default cache is 2 M, when the data is over 2 M,
call CLIENT_SetNetworkParam to set the receiving cache, otherwise the data pack will
be lost.
Handle the data of callback: It is not recommended to perform the time consuming
operations such as I/O or delay in parameter fAnalyzerDataCallBack, for example, local
picture saving, database insertion. In Windows system, you can use postMessage to throw
out the data and start threading treatment.
// "nSequence" represents the situation when the reported pictures are the same. "0" represents the first
appearance, "2" represents the last appearance or the appearance only once, and "1" represents there
will be more appearances from now on.
// "int nState = *(int*) reserved" represents the current status of the callback data. "0" represents the
current is real-time data, "1" represents the current callback data is offline, and "2" represents the offline
data transmission finished.
int nAlarmChn = 0;
ivsInfoEx.nEventsNum = 1;
switch(dwAlarmType)
case EVENT_IVS_CROSSFENCEDETECTION:
pCrossFence = (DEV_EVENT_CROSSFENCEDETECTION_INFO*)pAlarmInfo;
ivsInfoEx.stuEventInfo[0].alarmAction = pCrossFence->bEventAction;
ivsInfoEx.stuEventInfo[0].alarmType = dwAlarmType;
strncpy(ivsInfoEx.stuEventInfo[0].szRuleName, pCrossFence->szName,
25
(sizeof(pCrossFence->szName) >= sizeof(ivsInfoEx.stuEventInfo[0].szRuleName)
? sizeof(ivsInfoEx.stuEventInfo[0].szRuleName) : sizeof(pCrossFence->szName)));
ivsInfoEx.stuEventInfo[0].nObjectNum = 1;
memcpy(&ivsInfoEx.stuEventInfo[0].stuObject[0],&pCrossFence->stuObject,
sizeof(pCrossFence->stuObject));
break;
case EVENT_IVS_CROSSLINEDETECTION:
//....................................................
break;
.......
default:
break;
// Download picture
// In order to prevent receiving several pictures simultaneously, use " i " to remark.
static int i;
time_t stuTime;
time(&stuTime);
if (NULL == pFile)
return 0;
26
int nWrite = 0;
while(nWrite != dwBufSize)
fclose(pFile);
return 1;
}
{
// Resource initialization
....................................................
// Device login
....................................................
LDWORD dwUser = 0;
int nChannel = 0;
// If you need to set the channel to upload all types of events, you can set dwAlarmType as
EVENT_IVS_ALL.
// If you need to set one channel to upload two types of event, please call
CLIENT_RealLoadPictureEx twice and import different types of events.
//....................................................
CLIENT_StopLoadPic(lRealLoadHandle))
CLIENT_Logout(lLoginHandle))
CLIENT_Cleanup();
27
2.7 Guest Flow Statistics
2.7.1 Introduction
Product Description
The intelligent analysis server can accord to the front-end devices that are installed in the
business area to calculate accurately the guest flow through each entrance. Such function is
widely applied to the industries such as large-scale commercial complex, tourism, public
security, cultural expo, and chain operation business.
Figure 2-9 Network diagram of guest flow statistics
Product Model
Before subscribing the service of guest flow statistics, you need to configure the rules of guest
flow statistics at Web.
28
2.7.2 Interfaces Overview
Table 2-9 Interfaces of guest flow statistics
Interface Description
CLIENT_AttachVideoStatSummary Start subscribing the real-time guest flow statistics.
CLIENT_DetachVideoStatSummary Stop subscribing the real-time guest flow statistics.
fVideoStatSumCallBack Guest flow information.
CLIENT_StartFindNumberStat Start querying the historical guest flow information.
CLIENT_DoFindNumberStat Continue to inquire the historical guest flow information.
CLIENT_StopFindNumberStat Stop querying the historical guest flow information.
2.7.3 Process
The guest flow statistics mainly apply to the following two scenarios:
Real-time guest flow statistics
After SDK has subscribed the guest flow service from the device, the device will report the
real-time guest flow information to SDK.
Query of historical guest flow information
You can specify the start time and end time to inquire the guest flow information, and the
device returns the guest flow information for the specified period.
Start
Initialize SDK
CLIENT_Init
Logout
CLIENT_Logout
Stop
29
Process Description
Start
Initialize SDK
CLIENT_Init
Stop
30
Process Description
//
#include "stdafx.h"
#include "dhnetsdk.h"
#pragma comment(lib,"dhnetsdk.lib")
printf("Infomation:\n");
// Initialization
CLIENT_Init(NULL,0);
.........
// Login
NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY stInparam;
memset(&stInparam, 0, sizeof(stInparam));
stInparam.dwSize = sizeof(stInparam);
31
strncpy(stInparam.szPassword, g_szPasswd, sizeof(stInparam.szPassword) - 1);
stInparam.nPort = g_nPort;
stInparam.emSpecCap = EM_LOGIN_SPEC_CAP_TCP;
LLONG lLoginID = CLIENT_LoginWithHighLevelSecurity(&stInparam, &stOutparam);
if (lLoginID)
NET_IN_ATTACH_VIDEOSTAT_SUM
InParam={sizeof(NET_IN_ATTACH_VIDEOSTAT_SUM)};
InParam.nChannel=0;
InParam.cbVideoStatSum=VideoStatSumCallback;
NET_OUT_ATTACH_VIDEOSTAT_SUM OutParam={0};
OutParam.dwSize=sizeof(OutParam);
LLONG attachHnd = 0;
attachHnd = CLIENT_AttachVideoStatSummary(lLoginID,&InParam,&OutParam,nWaitTime)
if(attachHnd)
printf("CLIENT_AttachVideoStatSummary sucess\n");
else
printf("error number:%x",CLIENT_GetLastError());
else
printf("login fail\n");
.......
CLIENT_DetachVideoStatSummary(attachHnd);
32
// Exit the device
CLIENT_Logout(lLoginHandle));
CLIENT_Cleanup();
return 0;
//
#include "stdafx.h"
#include "dhnetsdk.h"
#pragma comment(lib,"dhnetsdk.lib")
printf("Infomation:\n");
// Initialization
CLIENT_Init(NULL,0);
.........
// Login
NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY stInparam;
memset(&stInparam, 0, sizeof(stInparam));
stInparam.dwSize = sizeof(stInparam);
stInparam.nPort = g_nPort;
stInparam.emSpecCap = EM_LOGIN_SPEC_CAP_TCP;
33
LLONG lLoginID = CLIENT_LoginWithHighLevelSecurity(&stInparam, &stOutparam);
if (lLoginID == 0)
CLIENT_Cleanup();
return 0;
NET_IN_FINDNUMBERSTAT inParam ;
inParam.dwSize = (uint)Marshal.SizeOf(inParam);
// Set the inquiry start time and end time to the hour for the moment.
......
NET_OUT_FINDNUMBERSTAT outParam;
outParam.dwSize = sizeof(outParam);
//
if (findHand == 0)
goto e_clear;;
NET_IN_DOFINDNUMBERSTAT inDoFind;
inDoFind.dwSize = sizeof(inDoFind);
NET_OUT_DOFINDNUMBERSTAT outStuDoFindNumStat =
{sizeof(NET_OUT_DOFINDNUMBERSTAT)};
34
for (int i = 0; i < 10 ; i++)
outStuDoFindNumStat.pstuNumberStat[i].dwSize = sizeof(DH_NUMBERSTAT);
outStuDoFindNumStat.nBufferLen = 10 * sizeof(DH_NUMBERSTAT);
int index = 0;
do
// Query result
else
break;
........
CLINET_StopFindNumberStat(findHand);
e_clear:
CLIENT_Logout(lLoginID))
CLIENT_Cleanup();
return 0;
35
3 Interface Definition
3.1.2 CLIENT_Cleanup
Table 3-2 Clean up SDK
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
Table 3-3 Set reconnection callback
Item Description
Name Set auto reconnection for callback.
void CLIENT_SetAutoReconnect(
fHaveReConnect cbAutoConnect,
Function
LDWORD dwUser
);
[in]cbAutoConnect Reconnection callback.
Parameter
[in]dwUser User parameter of disconnection callback.
36
Item Description
Return value None.
Set the reconnection callback interface. If the callback is set as NULL, it will not
Note
connect automatically.
3.1.4 CLIENT_SetNetworkParam
Table 3-4 Set network parameter
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.1 CLIENT_StartSearchDevicesEx
Table 3-5 Search for device
Item Description
Name Search the device.
LLONG CLIENT_StartSearchDevicesEx (
NET_IN_STARTSERACH_DEVICE* pInBuf,
Function
NET_OUT_STARTSERACH_DEVICE* pOutBuf
);
Output parameter. Refer to
[in] pInBuf
NET_IN_STARTSERACH_DEVICE
Parameter
Output parameter. Refer to
[out] pOutBuf
NET_OUT_STARTSERACH_DEVICE
Return value Searching handle.
Note Multi-thread calling is not supported.
3.2.2 CLIENT_InitDevAccount
Table 3-6 Initialize device
Item Description
Name Initialize the device.
37
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
Table 3-7 Get information for password reset
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 *pDescriptionOut,
Function
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.
38
3.2.4 CLIENT_CheckAuthCode
Table 3-8 Check the validity of security code
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
);
Corresponds to structure of
[in]pCheckAuthCodeIn
NET_IN_CHECK_AUTHCODE.
[out]pCheckAuthCode Corresponds to structure of
Out 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
Table 3-9 Reset the password
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
);
[in]pResetPwdIn Corresponds to structure of NET_IN_RESET_PWD.
Corresponds to structure of
[out]pResetPwdOut
NET_OUT_RESET_PWD.
[in]dwWaitTime Timeout.
Parameter
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.
39
Item Description
Note None.
3.2.6 CLIENT_GetPwdSpecification
Table 3-10 Get password rules
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
);
[in]pPwdSpeciIn Corresponds to structure of NET_IN_PWD_SPECI.
Corresponds to structure of
[out]pPwdSpeciOut
NET_OUT_PWD_SPECI.
[in]dwWaitTime Timeout.
Parameter
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
Table 3-11 Stop searching device
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.
40
3.3 Device Login
3.3.1 CLIENT_LoginWithHighLevelSecurity
Table 3-12 Log in with high level security
Item Description
Name Login the device with high level security.
LLONG CLIENT_LoginWithHighLevelSecurity (
NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY* pstInParam,
Function
NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY* pstOutParam
);
Parameter [in] pstInParam [in] dwSize
[in] szIP
[in] nPort
[in] szUserName
[in] szPassword
[in] emSpecCap
[in] pCapParam
[out] pstOutParam [in]dwSize
[out] stuDeviceInfo
[out] nError
Success: Not 0.
Return value
Failure: 0.
Login the device with high level security.
CLIENT_LoginEx2 can still be used,but there are security risks,so it is highly
Note
recommended to use the latest interface CLIENT_LoginWithHighLevelSecurity
to log in to the device.
41
3.3.2 CLIENT_Logout
Table 3-14 Log out
Item Description
Name Logout the device
BOOL CLIENT_Logout(
Function LLONG lLoginID
);
Return value of
Parameter [in]lLoginID
CLIENT_LoginWithHighLevelSecurity
Success: TRUE
Return value
Failure: FALSE
Note None
3.4.1 CLIENT_RealPlayEx
Table 3-15 Start the real-time monitoring
Item Description
Name Open the real-time monitoring.
LLONG CLIENT_RealPlayEx(
LLONG lLoginID,
int nChannelID,
Function
HWND hWnd,
DH_RealPlayType rType
);
Return value of
[in]lLoginID
CLIENT_LoginWithHighLevelSecurity.
Video channel number is a round number starting
Parameter [in]nChannelID
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.
42
Preview type Meaning
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
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
3.4.2 CLIENT_StopRealPlayEx
Table 3-17 Stop the real-time monitoring
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
Table 3-18 Save the real-time monitoring data as file
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
43
3.4.4 CLIENT_StopSaveRealData
Table 3-19 Stop saving the real-time monitoring data as file
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
Note None
3.4.5 CLIENT_SetRealDataCallBackEx2
Table 3-20 Set the callback of real-time monitoring data
Item Description
Name Set the callback of real-time monitoring data
BOOL CLIENT_SetRealDataCallBackEx2(
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
44
3.5 Subscription of Intelligent Event
3.5.1 CLIENT_RealLoadPictureEx
Table 3-22 Start subscribing the intelligent event
Item Description
Name Start subscribing the intelligent event.
LLONG CALL_METHOD CLIENT_RealLoadPictureEx(
LLONG lLoginID,
int nChannelID,
DWORD dwAlarmType,
Function BOOL bNeedPicFile,
fAnalyzer DataCallBack cbAnalyzerData,
LDWORD dwUser,
void* Reserved
);
[in] lLoginID Login handle.
[in] nChannelID Device channel number.
[in] dwAlarmType Subscribed alarm events type.
Parameter [in] bNeedPicFile Whether to subscribe the picture file.
[in] cbAnalyzerData Intelligent event callback.
[in] dwUser Customized data type.
[in] Reserved Reserved field.
Success: Subscription handle of LLONG type.
Return value
Failure: 0.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
45
Macro
Call corresponding
dwAlarmType macro definition definition Meaning
structure of pAlarmInfo
value
EVENT_IVS_WANDERDETECTI Wandering DEV_EVENT_WANDER_I
0x00000007
ON events NFO
DEV_EVENT_VIDEOABN
EVENT_IVS_VIDEOABNORMAL Video
0x00000013 ORMALDETECTION_INF
DETECTION abnormal
O
DEV_EVENT_IVS_AUDIO
EVENT_IVS_AUDIO_ABNORMA Sound
0x00000126 _ABNORMALDETECTION
LDETECTION abnormal
_INFO
Climbing DEV_EVENT_IVS_CLIMB
EVENT_IVS_CLIMBDETECTION 0x00000128
detection _INFO
Fighting DEV_EVENT_FLOWSTAT
EVENT_IVS_FIGHTDETECTION 0x0000000E
detection _INFO
Off-post DEV_EVENT_IVS_LEAVE
EVENT_IVS_LEAVEDETECTION 0x00000129
detection _INFO
EVENT_IVS_PRISONERRISEDE Detection on DEV_EVENT_PRISONER
0x0000011E
TECTION getting up RISEDETECTION_INFO
Detection on
DEV_EVENT_PASTE_INF
EVENT_IVS_PASTEDETECTION 0x00000004 illegal sticky
O
notes
3.5.2 CLIENT_StopLoadPic
Table 3-24 Stop subscription of intelligent events
Item Description
Name Stop subscription of intelligent events.
BOOL CALL_METHOD CLIENT_StopRealPlayEx(
Function LLONG lRealHandle
);
Parameter [in] lRealHandle Subscription handle of intelligent event.
BOOL type:
Return value Success: TRUE.
Failure: FALSE.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
46
3.6 Guest Flow Statistics
3.6.1 CLIENT_AttachVideoStatSummary
Table 3-25 Start subscribing guest flow statistics
Item Description
Name Start subscribing guest flow statistics.
LLONG CALL_METHOD CLIENT_AttachVideoStatSummary(
LLONG lLoginID,
Const NET_IN_ATTACH_VIDEOSTAT_SUM* pInParam,
Function
NET_OUT_ATTACH_VIDEOSTAT_SUM* pOutParam,
int nWaitTime
);
[in] lLoginID Login handle
[in]pInParam Input parameter of guest flow statistics.
Parameter
[out] pOutParam Output parameter of guest flow statistics.
[in]nWaitTime Timeout period.
LLONG type:
Return value Success: Not 0.
Failure: 0.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
3.6.2 CLIENT_DetachVideoStatSummary
Table 3-26 Stop subscribing guest flow statistics
Item Description
Name Stop subscribing guest flow statistics.
BOOL CALL_METHOD CLIENT_DetachVideoStatSummary(
Function LLONG lAttachHandle
);
Parameter [in] lAttachHandle Subscription handle.
BOOL type:
Return value Success: TRUE.
Failure: FALSE.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
3.6.3 CLIENT_StartFindNumberStat
Table 3-27 Start querying guest flow statistics
Item Description
Name Start querying guest flow statistics.
47
Item Description
LLONG CALL_METHOD CLIENT_StartFindNumberStat(
LLONG lLoginID,
Function NET_IN_FINDNUMBERSTAT* pstInParam,
NET_OUT_FINDNUMBERSTAT* pstOutParam
);
[in] lLoginID Login handle.
Parameter [in] pstInParam Input parameter.
[out] pstOutParam Output parameter.
LLONG type:
Return value Success: Not 0
Failure: 0
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
3.6.4 CLIENT_DoFindNumberStat
Table 3-28 Continue to query guest flow statistics
Item Description
Name Continue to query guest flow statistics.
int CALL_METHOD CLIENT_DoFindNumberStat(
LLONG lFindHandle,
Function NET_IN_DOFINDNUMBERSTAT* pstInParam,
NET_OUT_DOFINDNUMBERSTAT* pstOutParam
);
[in] lFindHandle Login handle.
Parameter [in]pstInParam Input parameter.
[out]pstOutParam Output parameter.
int type:
Return value Success: 1.
Failure: -1.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
3.6.5 CLIENT_StopFindNumberStat
Table 3-29 Stop querying guest flow statistics
Item Description
Name Stop querying guest flow statistics.
BOOL CALL_METHOD CLIENT_StopFindNumberStat(
Function LLONG lFindHandle
);
Parameter [in] lFindHandle Login handle.
BOOL type:
Return value Success: TRUE.
Failure: FALSE.
Note Interface returns failed. Use CLIENT_GetLastError to obtain the error code.
48
4 Callback Definition
4.1 fSearchDevicesCB
4.2 fSearchDevicesCBEx
Table 4-2 Callback of searching devices
Item Description
Name Callback of searching devices.
typedef void(CALLBACK * fSearchDevicesCBEx)(
LLONG lSearchHandle,
Function DEVICE_NET_INFO_EX2 *pDevNetInfo,
void* pUserData
);
[out] lSearchHandle Search Handle
Parameter [out]pDevNetInfo The searched device information.
[out]pUserData User data.
Return value None.
Note None.
4.3 fDisConnect
49
Item Description
LDWORD dwUser
);
Return value of
[out] lLoginID
CLIENT_LoginWithHighLevelSecurity.
Parameter [out] pchDVRIP IP of the disconnected device.
[out] nDVRPort Port of the disconnected device.
[out] dwUser User parameter of the callback.
Return value None.
Note None.
4.4 fHaveReConnect
4.5 fRealDataCallBackEx2
50
Item Description
);
[out] lRealHandle Return value of CLIENT_RealPlayEx.
Data type:
0: Initial data.
[out] dwDataType 1: Data with frame information.
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 parameter structure. Different dwDataType
value corresponds to different type.
The param is blank pointer when dwDataType is
Parameter
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.6 fAnalyzerDataCallBack
51
Item Description
[out]pBuffer Cache of pictures.
[out]dwBufSize Cache size of pictures.
[out]dwUser User parameter of the callback.
[out]reserved Reserved.
Return value None
Note None
4.7 fVideoStatSumCallBack
52
Appendix 1 Cybersecurity Recommendations
Cybersecurity is more than just a buzzword: it’s something that pertains to every device that is
connected to the internet. IP video surveillance is not immune to cyber risks, but taking basic
steps toward protecting and strengthening networks and networked appliances will make them
less susceptible to attacks. Below are some tips and recommendations on how to create a
more secured security system.
Mandatory actions to be taken for basic equipment network security:
1. Use Strong Passwords
Please refer to the following suggestions to set passwords:
The length should not be less than 8 characters;
Include at least two types of characters; character types include upper and lower case
letters, numbers and symbols;
Do not contain the account name or the account name in reverse order;
Do not use continuous characters, such as 123, abc, etc.;
Do not use overlapped characters, such as 111, aaa, etc.;
2. Update Firmware and Client Software in Time
According to the standard procedure in Tech-industry, we recommend to keep your
equipment (such as NVR, DVR, IP camera, etc.) firmware up-to-date to ensure the
system is equipped with the latest security patches and fixes. When the equipment is
connected to the public network, it is recommended to enable the “auto-check for
updates” function to obtain timely information of firmware updates released by the
manufacturer.
We suggest that you download and use the latest version of client software.
"Nice to have" recommendations to improve your equipment network security:
1. Physical Protection
We suggest that you perform physical protection to equipment, especially storage devices.
For example, place the equipment in a special computer room and cabinet, and implement
well-done access control permission and key management to prevent unauthorized
personnel from carrying out physical contacts such as damaging hardware, unauthorized
connection of removable equipment (such as USB flash disk, serial port), etc.
2. Change Passwords Regularly
We suggest that you change passwords regularly to reduce the risk of being guessed or
cracked.
3. Set and Update Passwords Reset Information Timely
The equipment supports password reset function. Please set up related information for
password reset in time, including the end user’s mailbox and password protection
questions. If the information changes, please modify it in time. When setting password
protection questions, it is suggested not to use those that can be easily guessed.
4. Enable Account Lock
The account lock feature is enabled by default, and we recommend you to keep it on to
guarantee the account security. If an attacker attempts to log in with the wrong password
several times, the corresponding account and the source IP address will be locked.
5. Change Default HTTP and Other Service Ports
53
We suggest you to change default HTTP and other service ports into any set of numbers
between 1024~65535, reducing the risk of outsiders being able to guess which ports you
are using.
6. Enable HTTPS
We suggest you to enable HTTPS, so that you visit Web service through a secure
communication channel.
7. Enable Whitelist
We suggest you to enable whitelist function to prevent everyone, except those with
specified IP addresses, from accessing the system. Therefore, please be sure to add your
computer’s IP address and the accompanying equipment’s IP address to the whitelist.
8. MAC Address Binding
We recommend you to bind the IP and MAC address of the gateway to the equipment,
thus reducing the risk of ARP spoofing.
9. Assign Accounts and Privileges Reasonably
According to business and management requirements, reasonably add users and assign a
minimum set of permissions to them.
10. Disable Unnecessary Services and Choose Secure Modes
If not needed, it is recommended to turn off some services such as SNMP, SMTP, UPnP,
etc., to reduce risks.
If necessary, it is highly recommended that you use safe modes, including but not limited to
the following services:
SNMP: Choose SNMP v3, and set up strong encryption passwords and authentication
passwords.
SMTP: Choose TLS to access mailbox server.
FTP: Choose SFTP, and set up strong passwords.
AP hotspot: Choose WPA2-PSK encryption mode, and set up strong passwords.
11. Audio and Video Encrypted Transmission
If your audio and video data contents are very important or sensitive, we recommend that
you use encrypted transmission function, to reduce the risk of audio and video data being
stolen during transmission.
Reminder: encrypted transmission will cause some loss in transmission efficiency.
12. Secure Auditing
Check online users: we suggest that you check online users regularly to see if the
device is logged in without authorization.
Check equipment log: By viewing the logs, you can know the IP addresses that were
used to log in to your devices and their key operations.
13. Network Log
Due to the limited storage capacity of the equipment, the stored log is limited. If you need
to save the log for a long time, it is recommended that you enable the network log function
to ensure that the critical logs are synchronized to the network log server for tracing.
14. Construct a Safe Network Environment
In order to better ensure the safety of equipment and reduce potential cyber risks, we
recommend:
Disable the port mapping function of the router to avoid direct access to the intranet
devices from external network.
The network should be partitioned and isolated according to the actual network needs.
If there are no communication requirements between two sub networks, it is
54
suggested to use VLAN, network GAP and other technologies to partition the network,
so as to achieve the network isolation effect.
Establish the 802.1x access authentication system to reduce the risk of unauthorized
access to private networks.
It is recommended that you enable your device's firewall or blacklist and whitelist
feature to reduce the risk that your device might be attacked.
55