NetSDK Programming Manual (Intelligent Building)
NetSDK Programming Manual (Intelligent Building)
Programming Manual
Foreword I
V1.0.5
Foreword
General
Welcome to use NetSDK intelligent building (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
intelligent buildings. 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.
Intended Readers
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.
Revision History
I
Version Revision Content Release Time
Deleted function library avnetsdk.dll and
libavnetsdk.so related content, and
V1.0.4 March 2021
changed font.
Deleted fisheye correction library.
Add interfaces and functions of the
V1.0.3 June 2020
second-generation access control.
Modify the access controller models.
Add fucntions of the first-generation access
V1.0.2 controller. April 2020
Replace all device login interfaces with
high-security login interfaces.
V1.0.1 Delete some contents of table 1-1. January 2019
V1.0.0 First release. December 2017
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 terms appearing in the manual to help you understand
the function of each module.
Term Description
The alarm input channel can receive the externally detected signal and each
Protection zone
becomes a protection zone.
Armed: The armed area receives, processes, records and transfers the
Armed and external signals.
disarmed Disarmed: The disarmed area does not receive, process, record and transfer
the external signals.
When the device is in armed status, the protection zone can still monitor and
record the external detector but will not forward to the user. After the device is
Bypass
disarmed, the protection zone of bypass will turn to a normal status, and when it
is armed again, it can switch to a protection zone successfully.
When the device generates alarm, it will perform some linkage activities, such as
Alarm clearing buzzer and message. These activities usually last a period. Alarm clearing can stop
them ahead of time.
Real-time When the device is in armed status, if there is an alarm, the device will record and
protection zone forward alarm signals immediately.
When the protection zone is of time-delayed type, you can set the entrance delay
or exit delay.
Entrance delay: The alarm will be activated when user enters the protection zone
Time-delay
within the delayed period, but there will be no alarm linkage. After the delayed
protection zone
period, if the protection zone is still armed, there will be alarm linkage activated,
if disarmed, there will be no alarm linkage. After exit delay is set, the device will
enter the armed status after the end of exit delay.
Once the 24 hour protection zone has been configured, the setting gets effective
24 hour
immediately. You cannot arm or disarm this setting so it is applicable to fire alarm
protection zone
scenarios.
The alarm host has two scenario modes: "Outside" and "Home". Each of the
Scene mode
modes has relevant configurations which get effective after you selected.
When the scenarios switch to "Outside" or "Home", the planned protection zone
Outside/Home
will be armed and the others become bypass zones.
A kind of configuration to the intrusion alarm detecting circuit which cannot
Separation
report alarms till being reset manually.
Analog alarm The device has multiple alarm input channels to receive the external detection
channel (analog signals. When the channels are analog type, they are called analog alarm
protection zone) channels which can connect to analog detector and collect analog data.
A type of access card. When the user is forced to open the access, the duress card
Duress card
will be recognized by the system, and then the alarm will be generated.
III
Table of Contents
Foreword ............................................................................................................................................................ I
Glossary ........................................................................................................................................................... III
1 Overview ........................................................................................................................................................ 1
1.1 General ........................................................................................................................................................................................... 1
1.2 Applicability ................................................................................................................................................................................. 2
1.2.1 Supported System ........................................................................................................................................................ 2
1.2.2 Supported Devices ....................................................................................................................................................... 2
1.3 Application Scenarios ............................................................................................................................................................... 3
2 Main Functions .............................................................................................................................................. 6
2.1 General ........................................................................................................................................................................................... 6
2.1.1 SDK Initialization ........................................................................................................................................................... 6
2.1.2 Device Initialization...................................................................................................................................................... 8
2.1.3 Device Login .................................................................................................................................................................13
2.1.4 Realtime Monitor ........................................................................................................................................................15
2.1.5 Voice Talk ........................................................................................................................................................................21
2.1.6 Event Listening ............................................................................................................................................................24
2.2 Alarm host...................................................................................................................................................................................27
2.2.1 Arming and Disarming .............................................................................................................................................27
2.2.2 Protection Zone Status Setting..............................................................................................................................28
2.2.3 Protection Zone Status Query................................................................................................................................30
2.3 Access Controller/All-in-one Fingerprint Machine (First-generation) ..................................................................32
2.3.1 Access Control ..............................................................................................................................................................32
2.3.2 Alarm Event ...................................................................................................................................................................34
2.3.3 Viewing Device Information ...................................................................................................................................38
2.3.4 Network Setting ..........................................................................................................................................................42
2.3.5 Device Time Setting ...................................................................................................................................................46
2.3.6 Maintenance Config ..................................................................................................................................................51
2.3.7 Personnel Management ...........................................................................................................................................60
2.3.8 Door Config...................................................................................................................................................................63
2.3.9 Door Time Config ........................................................................................................................................................66
2.3.10 Advanced Config of Door ......................................................................................................................................76
2.3.11 Records Query ...........................................................................................................................................................91
2.4 Access Controller/All-in-one Face Machine (Second-Generation) ........................................................................98
2.4.1 Access Control ..............................................................................................................................................................98
2.4.2 Alarm Event ...................................................................................................................................................................98
2.4.3 Viewing Device Information ...................................................................................................................................98
2.4.4 Network Setting ....................................................................................................................................................... 100
2.4.5 Setting the Device Time ........................................................................................................................................ 100
2.4.6 Maintenance Config ............................................................................................................................................... 100
2.4.7 Personnel Management ........................................................................................................................................ 100
2.4.8 Door Config................................................................................................................................................................ 119
2.4.9 Door Time Config ..................................................................................................................................................... 119
2.4.10 Advanced Config of Door ................................................................................................................................... 123
IV
2.4.11 Records Query ........................................................................................................................................................ 123
3 Interface Function ..................................................................................................................................... 128
3.1 Common Interface................................................................................................................................................................ 128
3.1.1 SDK Initialization ...................................................................................................................................................... 128
3.1.2 Device Initialization................................................................................................................................................. 129
3.1.3 Device Login .............................................................................................................................................................. 133
3.1.4 Realtime Monitor ..................................................................................................................................................... 134
3.1.5 Device Control .......................................................................................................................................................... 136
3.1.6 Alarm Listening......................................................................................................................................................... 137
3.1.7 Getting Device Status............................................................................................................................................. 138
3.1.8 Voice Talk ..................................................................................................................................................................... 139
3.2 Alarm Host ............................................................................................................................................................................... 143
3.3 Access Controller/ All-in-one Fingerprint Machine (First-generation) .............................................................. 143
3.3.1 Access Control ........................................................................................................................................................... 143
3.3.2 Alarm Event ................................................................................................................................................................ 143
3.3.3 Viewing Device Information ................................................................................................................................ 143
3.3.4 Network Setting ....................................................................................................................................................... 147
3.3.5 Time Settings ............................................................................................................................................................. 149
3.3.6 Maintenance Config ............................................................................................................................................... 151
3.3.7 Personnel Management ........................................................................................................................................ 156
3.3.8 Door Config................................................................................................................................................................ 156
3.3.9 Door Time Config ..................................................................................................................................................... 157
3.3.10 Advanced Config of Door ................................................................................................................................... 157
3.3.11 Records Query ........................................................................................................................................................ 161
3.4 Access Controller/All-in-one Face Machine (Second-Generation) ..................................................................... 163
3.4.1 Access Control ........................................................................................................................................................... 163
3.4.2 Alarm Event ................................................................................................................................................................ 163
3.4.3 Viewing Device Information ................................................................................................................................ 163
3.4.4 Network Setting ....................................................................................................................................................... 164
3.4.5 Time Settings ............................................................................................................................................................. 164
3.4.6 Maintenance Config ............................................................................................................................................... 164
3.4.7 Personnel Management ........................................................................................................................................ 164
3.4.8 Door Config................................................................................................................................................................ 170
3.4.9 Door Time Config ..................................................................................................................................................... 171
3.4.10 Advanced Config of Door ................................................................................................................................... 173
3.4.11 Records Query ........................................................................................................................................................ 174
4 Callback Function ...................................................................................................................................... 177
4.1 Device Searching Callback fSearchDevicesCB ........................................................................................................... 177
4.2 Device Searching Callback fSearchDevicesCBEx ....................................................................................................... 177
4.3 Disconnection Callback fDisConnect ............................................................................................................................ 177
4.4 Reconnection Callback fHaveReConnect..................................................................................................................... 178
4.5 Callback for Real-time Monitoring Data fRealDataCallBackEx2........................................................................... 178
4.6 Audio Data Callback pfAudioDataCallBack ................................................................................................................. 179
4.7 Alarm Callback fMessCallBack .......................................................................................................................................... 180
4.8 Upgrade Progress Callback fUpgradeCallBackEx ...................................................................................................... 183
Appendix 1 Cybersecurity Recommendations ........................................................................................... 185
V
1 Overview
1.1 General
The manual introduces SDK interfaces that include main functions, interface functions, and callback
functions.
Main functions include: Common functions, alarm host, access control and other functions.
The development kit might include different files dependent on the environment.
1
1.2 Applicability
2
DHI-ASI7214X, DHI-ASI7214Y, DHI-ASI7214Y-D, DHI-ASI7214Y-V3
DHI-ASI7223X-A, DHI-ASI7223Y-A, DHI-ASI7223Y-A-V3
DHI-ASI8213Y-V3
DHI-ASI8214Y, DHI-ASI8214Y(V2), DHI-ASI8214Y-V3
DHI-ASI8223Y, ASI8223Y(V2), DHI-ASI8223Y-A(V2), DHI-ASI8223Y-A-V3
ASI1202M, ASI1202M-D
ASI7213X, ASI7213Y-D, ASI7213Y-V3
ASI7214X, ASI7214Y, ASI7214Y-D, ASI7214Y-V3
ASI7223X-A, ASI7223Y-A, ASI7223Y-A-V3
ASI8213Y-V3
ASI8214Y, ASI8214Y(V2), ASI8214Y-V3
ASI8223Y, ASI8223Y(V2), ASI8223Y-A(V2), ASI8223Y-A-V3
Video Intercom
VTA8111A
VTO1210B-X, VTO1210C-X
VTO1220B
VTO2000A, VTO2111D
VTO6210B, VTO6100C
VTO9231D, VTO9241D
VTH1510CH, VTH1510A, VTH1550CH
VTH5221D, VTH5241D
VTS1500A, VTS5420B, VTS8240B, VTS8420B
VTT201, VTT2610C
Alarm Host
ARC2008C, ARC2008C-G, ARC2016C, ARC2016C-G, ARC5408C, ARC5408C-C, ARC5808C,
ARC5808C-C, ARC9016C, ARC9016C-G
DH-ARC2008C, DH-ARC2008C-G, DH-ARC2016C, DH-ARC2016C-G, DH-ARC5408C,
DH-ARC5408C-C, DH-ARC5408C-E, DH-ARC5808C, DH-ARC5808C-C, DH-ARC5808C-E,
DH-ARC9016C, DH-ARC9016C-G,
DHI-ARC2008C, DHI-ARC2008C-G, DHI-ARC2016C, DHI-ARC2016C-G, DHI-ARC5808C,
DHI-ARC5808C-C, DHI-ARC5408C, DHI-ARC5408C-C, DHI-ARC9016C, DHI-ARC9016C-G,
ARC2008C, ARC2008C-G, ARC2016C, ARC2016C-G, ARC5408C, ARC5408C-C, ARC5408C-E,
ARC5808C-C, ARC5808C, ARC5808C-E, ARC9016C, ARC9016C-G
3
a) Typical scenario
Network access control for medium and small-sized intelligent building, treasury house and jail
monitoring projects.
4
c) Network access control
5
2 Main Functions
2.1 General
2.1.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 resources.
6
e) SDK initialization
Begin
Initialize SDK
CLIENT_Init
Required
End
Optional
Process
Note
You need to call the interfaces CLIENT_Init and CLIENT_Cleanup in pairs. It supports single-thread
multiple calling in pairs, but it is recommended to call the pair for only one time overall.
Initialization: Internally calling the interface 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 until succeeded. Only the real-time
monitoring and playback function modules will be resumed after the connection is back.
//Set this callback through CLIENT_Init. When the device is disconnected, SDK informs the user through this
callback
7
void CALLBACK DisConnectFunc(LLONG lLoginID, char *pchDVRIP, LONG nDVRPort, DWORD dwUser)
{
printf("Call DisConnectFunc: lLoginID[0x%x]\n", lLoginID);
}
//Initialize SDK
CLIENT_Init(DisConnectFunc, 0);
2.1.2.1 Introduction
The device is uninitialized by default. Please initialize the device before 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.
8
2.1.2.3.1 Device Initialization
f) Device initialization
Begin
Initialize SDK
CLIENT_Init
Initialize device
CLIENT_InitDevAccount
Stop searching
CLIENT_StopSearchDevices
Logout
CLIENT_Logout
End
Process
9
Note
Because the interface is working in multicast, the host PC and device must be in the same multicast
group.
Begin
Initialize SDK
CLIENT_Init
Reset password
CLIENT_ResetPwd
Stop searching
CLIENT_StopSearchDevices
Mandotory
End
Process
10
code of password reset, and then validate it through CLIENT_CheckAuthCode.
(Optional) Call CLIENT_GetPwdSpecification to get the password rules.
Call CLIENT_ResetPwd to reset the password.
Call CLIENT_StopSearchDevices to stop searching.
Call CLIENT_LoginWithHighLevelSecurity and log in to the device with the admin account and the
reset password.
After using the function module, call CLIENT_Logout to log out of the device.
After using all SDK functions, call CLIENT_Cleanup to release SDK resources.
Note
Because the interface is working in multicast, the host PC and device must be in the same multicast
group.
//Firstly, call the interface CLIENT_StartSearchDevicesEx to get the device information in the callback.
//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 cards, enter the host PC IP for the last parameter.
Set a correct password according to the device password rules obtained, and this step is mainly to prevent
users from setting some password formats 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
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, set the szCellPhone field; if the byPwdResetWay is set as 2, set sInitAccountIn.szMail.
CLIENT_InitDevAccount(&sInitAccountIn, &sInitAccountOut, 5000, NULL);
//Firstly, call the interface CLIENT_StartSearchDevicesEx to get the device information in the callback.
//Get the descriptive information for password reset
11
NET_IN_DESCRIPTION_FOR_RESET_PWD stIn = {sizeof(stIn)};
strncpy(stIn.szMac, szMac, sizeof(stIn.szMac) - 1); //Set mac value
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_StartSearchDevices, CLIENT_StartSearchDevicesEx, 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 cards, enter the host PC IP for the last parameter.
After successful interface execution, 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
strncpy(stIn1.szSecurity, szSecu, sizeof(stIn1.szSecurity) - 1); //szSecu is the security code sent to the reserved
mobile phone or email box in the previous step
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 cards, enter the host PC IP for the last parameter
//Get the password rules
NET_IN_PWD_SPECI stIn2 = {sizeof(stIn2)};
strncpy(stIn2.szMac, szMac, sizeof(stIn2.szMac) - 1); //Set mac
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 cards, enter the host PC IP for the last parameter.
Set a correct password according to the device password rules successfully obtained, and this step is mainly to
prevent users from setting some password formats that are not supported by the device
//Reset the 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 after scanning the QR code
stIn3.byInitStaus = bStstus; //bStstus is the value of return field byInitStatus of device search interface (callback
of CLIENT_SearchDevices, CLIENT_StartSearchDevices and CLIENT_StartSearchDevicesEx, and
CLIENT_SearchDevicesByIPs)
stIn3.byPwdResetWay = bPwdResetWay; //bPwdResetWay is the value of return field byPwdResetWay of
device search interface (callback of CLIENT_SearchDevices and CLIENT_StartSearchDevices,
12
CLIENT_StartSearchDevicesEx, 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 cards, enter the host PC IP for the last parameter
2.1.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 use the login ID before
using other SDK interfaces. The login ID becomes invalid once logged out.
13
h) Login
Begin
Initialize SDK
CLIENT_Init
Specific business
Log out
CLIENT_Logout
End
Process
Note
Login handle: When the login is successful, the returned value of the interface is not 0 (even the
handle is smaller than 0, the login is also successful). One device can log in multiple times with
different handle at each login. If there is not special function module, it is suggested to log in
only one time. The login handle can be repeatedly used on other function modules.
Logout: The interface will release the opened functions in the login session internally, but it is not
suggested to rely on the cleaning up function of the logout interface. 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
releases sources once logged out.
Login failure: It is suggested to check the failure through the error parameter (login error code) of the
login interface. For the common error codes, see Table 2-4.
14
Error Code Corresponding 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 blocklisted.
7 Out of resources, or 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.
12 USB flash disk is not inserted into device, or the USB flash disk information error.
13 The client IP address is not authorized with login.
For more information about error codes, see the description of
"CLIENT_LoginWithHighLevelSecurity" interface in the Network SDK Development Manual. The
example code to avoid error code 3 is as follows.
NET_PARAM stuNetParam = {0};
stuNetParam.nWaittime = 8000;
CLIENT_SetNetworkParam (&stuNetParam);
2.1.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.
15
SDK can get the main stream and sub stream from the device once logged in.
Supports passing in 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 through saving the callback stream or calling
the SDK interface.
You can realize the real-time monitoring through SDK integrated play library or your play library.
Call PlaySDK library from the SDK auxiliary library to realize real-time play.
16
i) SDK decoding play
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
Process
Note
SDK decoding play only supports Windows system. You need to call the decoding after getting the
stream for display 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 application for monitoring resources in the interface should make some agreements
17
with the device before requesting the monitoring data. There are some timeout settings (see
"NET_PARAM structure"), and the field related to 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 the CLIENT_Init.
NET_PARAM stuNetParam = {0};
stuNetParam. nGetConnInfoTime = 5000; // in ms
CLIENT_SetNetworkParam (&stuNetParam);
Failed to repeat opening: Because some devices do not support opening the monitoring function on
the same channel for multiple times in one login, these devices might fail from the second
opening. In this case, you can try the following:
Close the opened channel first. 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 video first and then open the sub stream video.
Log in 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-2 and
Table 1-1.
If the system resource is insufficient, the device might return error instead of recovering 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.
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, see "2.1.4.3.2 Calling the Third-party Decoding Play Library" for details.
SDK calls back the real-time monitoring stream to you and then you call PlaySDK to perform
decoding play.
18
j) Third-party decoding play
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Note
19
it is recommended to modify the parameter value smaller to such as 3 M.
SDK callbacks can only move 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 window
handle
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 live view
if (NULL != lRealHandle)
{
CLIENT_StopRealPlayEx(lRealHandle);
}
20
//Stop live view
if (0 != lRealHandle)
{
CLIENT_StopRealPlayEx(lRealHandle);
}
2.1.5.1 Introduction
Voice talk realizes the voice interaction between the local platform and the environment where
front-end devices are located, to meet the need of voice communication between the local platform
and the site environment.
This chapter introduces how to use SDK to realize the voice talk with devices.
When SDK collects the audio data from the local audio card or receives the audio data from the
21
front-end devices, it will call the audio data callback. You can call the SDK interface in the callback to
send the local audio data collected to the front-end devices, or call the SDK interface to decode and
play back the audio data received from the front-end devices.
The process is valid only in Windows system.
The voice talk mode is divided into second generation and third generation which share the same
process and differentiated by the parameters set by CLIENT_SetDeviceMode. You can use the
interface CLIENT_GetDevProtocolType to get the voice talk mode supported by the device.
k) Second-generation voice talk
Begin
Initialize SDK
CLIENT_Init
byAudioFla
Start recording on the PC
g value
CLIENT_RecordStartEx
End
Process
22
After successful initialization, call CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetDevProtocolType to get support for the second-generation or third-generation
voice talk.
Call CLIENT_SetDeviceMode to set voice talk parameters.
For the second-generation voice talk: Set encoding mode, client mode and speak mode. The
parameter emType is set as DH_TALK_ENCODE_TYPE, DH_TALK_CLIENT_MODE and
DH_TALK_SPEAK_PARAM.
For the third-generation voice talk: Set encoding mode, client mode, and parameters for
third-generation voice talk. The parameter emType is set as DH_TALK_ENCODE_TYPE,
DH_TALK_CLIENT_MODE and DH_TALK_MODE3.
Call CLIENT_StartTalkEx to set callback and start voice talk. In the callback, call CLIENT_AudioDec
to decode the audio data sent from the decoding device, and call CLIENT_TalkSendData to
send the audio data from the PC to the device.
Call CLIENT_RecordStartEx to start recording on the PC. After this interface is called, the voice talk
callback set by CLIENT_StartTalkEx will receive the local audio data.
After using the voice talk function, call CLIENT_RecordStopEx to stop recording.
Call CLIENT_StopTalkEx to stop voice talk.
Call CLIENT_Logout to log out of the device.
After using all SDK functions, call CLIENT_Cleanup to release SDK resources.
Note
Voice encoding format: The example uses the common PCM format. SDK supports getting the voice
encoding format supported by the device. The example code is detailed in the SDK package on
the website. If the default PCM can meet the requirement, it is not necessary to get the voice
encoding format supported by the device.
No sound at the device: The audio data needs to be collected from devices such as microphone. It is
recommended to check if the microphone or other equivalent device is plugged in and if the
interface CLIENT_RecordStartEx succeeded in returning.
//Get to know whether the device supports the second-generation or third-generation voice talk.
EM_DEV_PROTOCOL_TYPE emTpye = EM_DEV_PROTOCOL_UNKNOWN;
CLIENT_GetDevProtocolType(g_lLoginHandle, &emTpye);
23
//Set voice talk parameters according to the obtained type
if (emTpye == EM_DEV_PROTOCOL_V3) //Only the third-generation voice talk needs such parameters
{
NET_TALK_EX stuTalk = {sizeof(stuTalk)};
stuTalk.nAudioPort = RECEIVER_AUDIO_PORT; //User-defined receiving port
stuTalk.nChannel = 0;
stuTalk.nWaitTime = 5000;
CLIENT_SetDeviceMode(m_lLoginHandle, DH_TALK_MODE3, &stuTalk)
}
//Start voice talk
lTalkHandle = CLIENT_StartTalkEx(lLoginHandle, AudioDataCallBack, (LDWORD)NULL);
//Start local recording
CLIENT_RecordStartEx(lLoginHandle);
//Stop local recording
CLIENT_RecordStopEx(lLoginHandle)
//Stop voice talk
CLIENT_StopTalkEx(lTalkHandle);
//Process the voice talk callback data
void CALLBACK AudioDataCallBack(LLONG lTalkHandle, char *pDataBuf, DWORD dwBufSize, BYTE byAudioFlag,
LDWORD dwUser)
{
if(0 == byAudioFlag)
{
//Send the audio card data detected by the local PC to the device
CLIENT_TalkSendData(lTalkHandle, pDataBuf, dwBufSize);
}
else if(1 == byAudioFlag)
{
//Pass the audio data sent from the device to SDK for decoding play
CLIENT_AudioDec(pDataBuf, dwBufSize);
}
}
2.1.6.1 Introduction
Alarm reporting method: Use SDK to log in to the device and subscribe to the alarm function from
the device. When the device detects the alarm event, it will send the event to SDK immediately. The
user can get the corresponding alarm information through the alarm callback.
24
2.1.6.2 Interface Overview
l) Alarm reporting
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
25
use the callback set by CLIENT_SetDVRMessCallBack to inform the user of the alarm
events reported by the device.
For alarm events related to alarm host, access control and voice talk, see "4.7 Alarm Callback
fMessCallBack."
After using the alarm reporting function, call the CLIENT_StopListen to stop subscribing to alarm
from the device.
Call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
Note
If the alarms that were reported before are no longer reported, check if the device is disconnected. If
yes, please be noted that there will be no alarm reported after the device is reconnected, and in
this case, you need to cancel the subscription and subscribe to alarm again.
It is recommended to process the alarm information in the callback fMessCallBack in somewhere else
to avoid blocking the callback operations.
//Alarm callback
int CALLBACK afMessCallBack(LONG lCommand, LLONG lLinID, char *pBuf, DWORD dwBufLen,
char *pchDVRIP, LONG nDVRPort, LDWORD dwUser)
{
if(lCommand == DH_ALARM_ACCESS_CTL_EVENT) // Access control event. For more events related to access
control, see "4.7 Alarm Callback fMessCallBack."
{
ALARM_ACCESS_CTL_EVENT_INFO* pstAccessInfo =
(ALARM_ACCESS_CTL_EVENT_INFO*)pBuf;
//Then you can get the corresponding alarm information through pstAccessInfo.
}
……..
}
//Set alarm callback
CLIENT_SetDVRMessCallBack(afMessCallBack,0);
//Subscribe to alarm
CLIENT_StartListenEx(lLoginHandle);
//Stop subscribing to alarm
CLIENT_StopListen(lLoginHandle);
26
2.2 Alarm host
2.2.1.1 Introduction
Armed: All the protection zones are in armed status and can receive, process, record and transfer
external signals.
Disarmed: All the protection zones do not receive, process, record and transfer external signals.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
27
DH_CTRL_ARMED_EX.
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
stuParam.stuIn.emState = NET_ALARM_MODE_ARMING;
stuParam.stuIn.emSceneMode = NET_SCENE_MODE_OUTDOOR;
stuParam.stuIn.szDevPwd = "admin";
CLIENT_ControlDeviceEx(g_lLoginHandle, DH_CTRL_ARMED_EX, &stuParam, NULL,3000);
2.2.2.1 Introduction
You can set the protection zone status to control the normal, bypass and separation status of alarm
channels.
28
n) Protection zone status setting
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
29
2.2.3 Protection Zone Status Query
2.2.3.1 Introduction
Query the protection zone status, including alarm input, alarm output, and alarm signal.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
30
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
//Initialize the fields related to the alarm input channel of the extension module
stuAlarmChannelState.nExAlarmInCount = nNum;
stuAlarmChannelState.pbExAlarmInState = new BOOL[stuAlarmChannelState.nExAlarmInCount];
memset(stuAlarmChannelState.pbExAlarmInState, 0, stuAlarmChannelState.nExAlarmInCount * sizeof(BOOL));
stuAlarmChannelState.pnExAlarmInDestionation = new int[1024];
//Initialize the fields related to the alarm output channel of the extension module
stuAlarmChannelState.nExAlarmOutCount = nNum;
stuAlarmChannelState.pbExAlarmOutState = new BOOL[stuAlarmChannelState.nExAlarmOutCount];
memset(stuAlarmChannelState.pbExAlarmOutState, 0, stuAlarmChannelState.nExAlarmOutCount *
sizeof(BOOL));
stuAlarmChannelState.pnExAlarmOutDestionation = new int[1024];
int nRetLen = 0;
CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_ALL_ALARM_CHANNELS_STATE,
(char*)&stuAlarmChannelState, sizeof(NET_CLIENT_ALARM_CHANNELS_STATE), &nRetLen, 3000);
31
2.3 Access Controller/All-in-one Fingerprint Machine
(First-generation)
p) Function calling relationship
Door
General Maintenance Personnel Records
Controlling
Config Config Management Query
Config
Reference
Reference
2.3.1.1 Introduction
It is used to control the opening and closing of the access, and get door sensor status. Without
personnel information, it can remotely open and close the door directly.
32
2.3.1.3 Process Description
q) Access control
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
33
CLIENT_ControlDeviceEx((LLONG)g_lLoginHandle, DH_CTRL_ACCESS_OPEN, &stOpen, NULL, 3000);
2.3.2.1 Introduction
The process to get event is that, you call the SDK interface. SDK actively connect to the device, and
subscribe to alarm from the device, including door opening event and alarm event. Device sends
events to the SDK immediately when events generate. Stop susbcribtion if you want to stop
receiving events from device.
34
2.3.2.3 Process Description
r) Alarm event
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
BOOL CALLBACK MessCallBack(LONG lCommand, LLONG lLoginID, char *pBuf, DWORD dwBufLen, char
*pchDVRIP, LONG nDVRPort, LDWORD dwUser)
{
35
//Dismantlement prevention for device/card reader
if (DH_ALARM_CHASSISINTRUDED == lCommand)
{
ALARM_CHASSISINTRUDED_INFO* pstAlarm = (ALARM_CHASSISINTRUDED_INFO*)pBuf;
printf("Chassis intrusion\n");
printf("nAction:%d\n", pstAlarm->nAction);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
//External alarm event
else if (DH_ALARM_ALARM_EX2 == lCommand)
{
ALARM_ALARM_INFO_EX2* pstAlarm = (ALARM_ALARM_INFO_EX2*)pBuf;
printf("LocalAlarm\n");
printf("nAction:%d\n", pstAlarm->nAction);
printf("ChannelID:%d,SenseType:%d\n", pstAlarm->nChannelID, pstAlarm->emSenseType);
printf("DefenceAreaType:%d\n", pstAlarm->emDefenceAreaType);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
//Door timeout event
else if (DH_ALARM_ACCESS_CTL_NOT_CLOSE == lCommand)
{
ALARM_ACCESS_CTL_NOT_CLOSE_INFO* pstAlarm =
(ALARM_ACCESS_CTL_NOT_CLOSE_INFO*)pBuf;
printf("DoorNotClosed\n");
printf("nAction:%d\n", pstAlarm->nAction);
printf("DoorNO.:%d,EventID:%d\n", pstAlarm->nDoor, pstAlarm->nEventID);
printf("DoorName:%s\n", pstAlarm->szDoorName);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
//Intrusion event
else if (DH_ALARM_ACCESS_CTL_BREAK_IN == lCommand)
{
ALARM_ACCESS_CTL_BREAK_IN_INFO* pstAlarm = (ALARM_ACCESS_CTL_BREAK_IN_INFO*)pBuf;
printf("BreakIn\n");
36
printf("DoorNO.:%d\n", pstAlarm->nDoor);
printf("BreakMethod:%d,EventID:%d\n", pstAlarm->emMethod, pstAlarm->nEventID);
printf("DoorName:%s\n", pstAlarm->szDoorName);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
//Forced event
else if (DH_ALARM_ACCESS_CTL_DURESS == lCommand)
{
ALARM_ACCESS_CTL_DURESS_INFO* pstAlarm = (ALARM_ACCESS_CTL_DURESS_INFO*)pBuf;
printf("Duress\n");
printf("DoorNO.:%d\n", pstAlarm->nDoor);
printf("CardNo:%d,EventID:%d\n", pstAlarm->szCardNo, pstAlarm->nEventID);
printf("DoorName:%s,SN:%s,UserID:%s\n", pstAlarm->szDoorName, pstAlarm->szSN,
pstAlarm->szUserID);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
//Passback event
else if (DH_ALARM_ACCESS_CTL_REPEAT_ENTER == lCommand)
{
ALARM_ACCESS_CTL_REPEAT_ENTER_INFO* pstAlarm =
(ALARM_ACCESS_CTL_REPEAT_ENTER_INFO*)pBuf;
printf("Duress\n");
printf("DoorNO.:%d\n", pstAlarm->nDoor);
printf("CardNo:%d,EventID:%d\n", pstAlarm->szCardNo, pstAlarm->nEventID);
printf("DoorName:%s\n", pstAlarm->szDoorName);
printf("%d.%d.%d %d:%d:%d:%d\n",
pstAlarm->stuTime.dwYear,pstAlarm->stuTime.dwMonth,pstAlarm->stuTime.dwDay,
pstAlarm->stuTime.dwHour,pstAlarm->stuTime.dwMinute,pstAlarm->stuTime.dwSecond);
}
return TRUE;
}
37
if (bRet)
{
printf("CLIENT_StartListenEx success!\n");
}
else
{
printf("CLIENT_StartListenEx failed! LastError = %x\n" , CLIENT_GetLastError());
}
}
2.3.3.1.1 Introduction
The process to view device information is that, you issue a command through SDK to the access
control device, to get the capability of another device.
38
2.3.3.1.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
39
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
2.3.3.2.1 Introduction
The process to view device version and MAC is that, you issue a command through SDK to the access
control device, to get device information such as serial number, version number and Mac address.
Table 2-15 Description of interfaces for viewing device version and MAC
Interface Description
Query device status (query serial number, software
CLIENT_QueryDevState
version, compiling time, Mac address).
40
2.3.3.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
41
BOOL bRet = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_SOFTWARE, (char *)&stuVersion,
sizeof(stuVersion), &nRet, 5000);
//View Mac
int nRet = 0;
DHDEV_NETINTERFACE_INFO stuNet = {sizeof(stuNet)};
BOOL bRet0 = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_NETINTERFACE, (char *)&stuNet,
sizeof(stuNet), &nRet, 5000);
2.3.4.1 IP Settings
2.3.4.1.1 Introduction
IP setting process is that, you call SDK interface to get and configure device information such as IP,
including IP address, subnet mask, and default gateway.
42
2.3.4.1.3 Process Description
u) IP setting
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
43
3000);
if(bRet){
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_NETWORK, szOut1, &stOut2, sizeof(CFG_NTP_INFO), NULL);
}
else{
printf("parse failed!!!");
}
//Set IP network config information
char * szOut = new char[1024*32];
stOut2.nInterfaceNum = 1;
memcpy(stOut2.stuInterfaces[0].szIP, "192.168.1.108", sizeof(stOut2.stuInterfaces[0].szIP)-1);
memcpy(stOut2.stuInterfaces[0].szDefGateway, "192.168.1.1", sizeof(stOut2.stuInterfaces[0]. szDefGateway)-1);
memcpy(stOut2.stuInterfaces[0].szSubnetMask, "255.255.255.0", sizeof(stOut2.stuInterfaces[0].
szSubnetMask)-1);
BOOL bRet0 = CLIENT_PacketData(CFG_CMD_NETWORK, (char *)&stOut2, sizeof(CFG_NETWORK_INFO), szOut,
1024*32);
if(bRet){
BOOL bRet1 = CLIENT_SetNewDevConfig(g_lLoginHandle, CFG_CMD_NETWORK, 0, szOut, 1024*32,
NULL, NULL, 3000);
}
2.3.4.2.1 Introduction
The auto register config process is that, you call SDK interface to configure auto register information
of the device, including auto register enabling, device ID, server.
44
2.3.4.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
45
int nError = 0;
BOOL bRet = CLIENT_GetNewDevConfig(g_lLoginHandle, CFG_CMD_DVRIP, 0, szOut1, 1024*32, &nError,
3000);
if(bRet){
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_DVRIP, szOut1, &stOut2, sizeof(CFG_NTP_INFO), NULL);
}
else{
printf("parse failed!!!");
}
//Set auto register network config information
char * szOut = new char[1024*32];
stOut2.nTcpPort = 46650;
BOOL bRet0 = CLIENT_PacketData(CFG_CMD_DVRIP, (char *)&stOut2, sizeof(CFG_DVRIP_INFO), szOut,
1024*32);
if(bRet)
{
BOOL bRet1 = CLIENT_SetNewDevConfig(g_lLoginHandle, CFG_CMD_DVRIP, 0, szOut, 1024*32, NULL,
NULL, 3000);
}
2.3.5.1.1 Introduction
Device time setting process is that, you call SDK interface to get and set the device time.
46
2.3.5.1.3 Process Description
w) Time setting
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_SetupDeviceTime to set the access control time.
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
2.3.5.2.1 Introduction
NTP server and time zone setting process is that, you call SDK interface to get and set the NTP server
and time zone.
47
2.3.5.2.2 Interface Overview
Begin
Initialize SDK
CLIENT_Init
Get NTP time sync and time zone config Set NTP time sync and time zone config
CLIENT_GetNewDevConfig CLIENT_SetNewDevConfig
is used with CLIENT_ParseData is used with CLIENT_PacketData
szCommand: CFG_CMD_NTP szCommand: CFG_CMD_NTP
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access NTP time sync and
time zone config.
szCommand: CFG_CMD_NTP.
pBuf: CFG_NTP_INFO.
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access NTP time sync and time
zone config.
szCommand: CFG_CMD_NTP.
pBuf: CFG_NTP_INFO.
After completing this process, call the CLIENT_Logout to log out of the device.
48
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
2.3.5.3.1 Introduction
Daylight saving time (DST) setting process is that, you call SDK interface to get and set the DST.
49
2.3.5.3.3 Process Description
y) DST setting
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Step 2 Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Step 3 Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access DST config.
szCommand: CFG_CMD_LOCALS.
pBuf: AV_CFG_Locales.
Step 4 Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access DST config.
szCommand: CFG_CMD_ LOCALS.
pBuf: AV_CFG_Locales.
Step 5 After completing this process, call the CLIENT_Logout to log out of the device.
Step 6 After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
50
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_NTP, szOut1, &stOut2, sizeof(AV_CFG_Locales), NULL);
}
else{
printf("parse failed!!!");
}
//Set DST config information
char * szOut = new char[1024*32];
stOut2.bEnable = TRUE;
BOOL bRet0 = CLIENT_PacketData(CFG_CMD_LOCALS, (char *)&stOut2, sizeof(AV_CFG_Locales), szOut,
1024*32);
if(bRet)
{
BOOL bRet1 = CLIENT_SetNewDevConfig(g_lLoginHandle, CFG_CMD_LOCALS, 0, szOut, 1024*32,
NULL, NULL, 3000);
}
2.3.6.1.1 Introduction
The process to modify login password is that, you call SDK interface to modify the device login
password.
51
2.3.6.1.3 Process Description
z) Maintenance config
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
2.3.6.2 Restart
52
2.3.6.2.1 Introduction
The restart process is that, you call SDK interface to restart the device.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
//Restart
CLIENT_ControlDevice(g_lLoginHandle, DH_CTRL_REBOOT, NULL, 3000);
53
2.3.6.3 Restoring the Factory Settings
2.3.6.3.1 Introduction
The process to restore factory defaults is that, you call SDK interface to restore factory defaults of the
device. After taking effect, all configurations and personnel information on the device will be cleared.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
54
restore factory defaults.
Type: DH_CTRL_RESTOREDEFAULT.
Param: DH_RESTORE_COMMON.
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
2.3.6.4.1 Introduction
The device upgrade process is that, you call SDK interface to upgrade the device program.
55
2.3.6.4.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
56
cout << "lLoginID or lUpgradechannel is zero" << endl;
m_isNeedStop = TRUE;
return;
}
if (0 == nTotalSize && -1 == nSendSize) //It represents the end of upgrade
{
m_isNeedStop = TRUE;
cout << "Upgrade completed!" << endl;
}
else if (0 == nTotalSize && -2 == nSendSize) //It represents upgrade error
{
m_isNeedStop = TRUE;
cout << "Upgrade error" << endl;
}
else if (nTotalSize > 0 && nSendSize >= 0) // It represents the sending progress
{
float fPross = (float)(nSendSize/nTotalSize);
printf("Upgrade file sending progress (total file size: % d, sent size: % d, sending progress: %.2f%%)
\n", nTotalSize, nSendSize, fPross*100);
if (nTotalSize == nSendSize)
{
cout << "The upgrade file has been sent! The device start upgrading ........." << endl;
}
}
else if (nTotalSize == -1 && nSendSize >= 0)
{
cout << "....................Upgrade progress: " << nSendSize << "........................" << endl;
}
}
void Test()
{
char szFileName[256] = {0};
cout << "Enter the upgrade program file name (including the full path):" << endl;
cin >> szFileName;
//Start upgrading the device program
LLONG lUpHandle = CLIENT_StartUpgradeEx(g_lLoginHandle, DH_UPGRADE_BOOT_YPE, szFileName,
UpgradeCallBack, 0);
if (0 == lUpHandle)
{
57
printf("CLIENT_StartUpgrade failed. ErrorCode[%x]\n", CLIENT_GetLastError());
return;
}
//Send the upgrade file
BOOL bRet = CLIENT_SendUpgrade(lUpHandle);
if (!bRet)
{
printf("CLIENT_SendUpgrade failed. ErrorCode[%x]\n", CLIENT_GetLastError());
//Stop upgrading the program
CLIENT_StopUpgrade(lUpHandle);
return;
}
while (true)
{
if (m_isNeedStop)
{
//Stop upgrading the program
bRet = CLIENT_StopUpgrade(lUpHandle);
if (!bRet)
{
printf("CLIENT_SendUpgrade failed. ErrorCode[%x]\n", CLIENT_GetLastError());
return;
}
cout << "Success to stop upgrade!!" << endl;
break;
}
}
}
2.3.6.5.1 Introduction
The auto maintenance process is that, you call SDK interface to configure the auto maintenance of
device, including information such as auto restart time.
58
2.3.6.5.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
59
2.3.7 Personnel Management
2.3.7.1 Introduction
For personnel information, you can call SDK to add, delete, query and modify personnel information
fields of the access device (including No., name, face, card, fingerprint, password, user permission,
period, holiday plan and user type).
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
60
Type Description emType Param
DH_CTRL_RECORDSE NET_CTRL_RECORDSET_INS
NET_RECORD_
T_INSERT ERT_PARAM
Add user info ACCESSCTLCA
DH_CTRL_RECORDSE NET_RECORDSET_ACCESS_
RD
T_INSERTEX CTL_CARD
NET_CTRL_RECORDSET_PA
NET_RECORD_
DH_CTRL_RECORDSET_RE Delete user RAM
ACCESSCTLCA
MOVE info NET_RECORDSET_ACCESS_
RD
CTL_CARD
NET_RECORD_
DH_CTRL_RECORDSET_CL
Clear user info ACCESSCTLCA NET_CTRL_RECORDSET_PARAM
EAR
RD
Call the CLIENT_QueryDevState interface to get user information.
Note
61
NET_RECORDSET_ACCESS_CTL_CARD stuInfo = {sizeof(stuInfo)};
stuInfo.emSex = NET_ACCESSCTLCARD_SEX_MALE;
stuInfo.nDoorNum = 2;
stuInfo.sznDoors[0] = 1223;
memcpy(stuInfo.szUserID, "ddjdj", sizeof(stuInfo.szUserID));
memcpy(stuInfo.szPsw, "543543", sizeof(stuInfo.szPsw));
stuParam.stuCtrlRecordSetResult.dwSize = sizeof(NET_CTRL_RECORDSET_INSERT_OUT);
int nRet = 0;
62
BOOL bRet3 = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_DEV_RECORDSET,
(char*)&stuParam3,
sizeof(stuParam3), &nRet, 5000);
//Update
stuInfo.nRecNo = 123456789;
NET_CTRL_RECORDSET_PARAM stuParam4 = {sizeof(stuParam4)};
stuParam4.emType = NET_RECORD_ACCESSCTLHOLIDAY;
stuParam4.pBuf = (void*)&stuInfo;
stuParam4.nBufLen = sizeof(stuInfo);
int nRet4 = 0;
BOOL bRet4 = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_DEV_RECORDSET,
(char*)&stuParam4,sizeof(stuParam4), &nRet4, 5000);
if (bRet4)
{
stuInfo.emSex = NET_ACCESSCTLCARD_SEX_MALE;
stuInfo.nDoorNum = 2;
stuInfo.sznDoors[0] = 1223;
memcpy(stuInfo.szUserID, "2222", sizeof(stuInfo.szUserID));
memcpy(stuInfo.szPsw, "fdsfds", sizeof(stuInfo.szPsw));
stuParam4.emType = NET_RECORD_ACCESSCTLHOLIDAY;
stuParam4.pBuf = (void*)&stuInfo;
stuParam4.nBufLen = sizeof(stuInfo);
// Update info
BOOL bRet4 = CLIENT_ControlDevice(g_lLoginHandle, DH_CTRL_RECORDSET_UPDATE, &stuParam,
5000);
}
else{
printf("CLIENT_QueryDevState failed!");
}
2.3.8.1 Introduction
For door config information, you can call SDK interface to get and set door config of the access
device, including unlock mode, lock holding, lock timeout, holiday period number, unlock period,
and alarm enabling option.
63
2.3.8.2 Interunlockface Overview
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access door info.
szCommand: CFG_CMD_ACCESS_EVENT.
pBuf: CFG_ACCESS_EVENT_INFO.
64
emDoorOpenMethod Unlock mode
bDuressAlarmEnable duress
bBreakInAlarmEnable Intrusion alarm enabling
bRepeatEnterAlarm Repeat entry alarm enabling
abDoorNotClosedAlarmEnable Interlock alarm enabling
abSensorEnable Door sensor enabling
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access door info.
szCommand: CFG_CMD_ACCESS_EVENT.
pBuf: CFG_ACCESS_EVENT_INFO.
Note
When the intrusion alarm and unlock alarm are enabled, users need enable door sensor so that the
intrusion alarm and door open alarm can be implemented.
Set the serial number of always open period, always close period and remote verifitication. For
details, see "2.3.9.1 Period Config."
65
printf("unlock duration: %d\n",stOut2.nUnlockHoldInterval);
printf("lock timeout period: %d\n",stOut2.nCloseTimeout);
printf("unlock mode: %d\n",stOut2.emDoorOpenMethod);
printf("duress: %d\n",stOut2.bDuressAlarmEnable);
}
}
else{
printf("parse failed!!!");
}
//Set door config information
char * szOut = new char[1024*32];
stOut2.emState = ACCESS_STATE_NORMAL;//Door status
stOut2.nUnlockHoldInterval = 10;//Unlock duration
stOut2.nCloseTimeout = 10;//Lock timeout period
stOut2.emDoorOpenMethod = CFG_DOOR_OPEN_METHOD_PWD_ONLY;//Unlock mode
stOut2.bDuressAlarmEnable = FALSE;//Duress
BOOL bRet2 = CLIENT_PacketData(CFG_CMD_ACCESS_EVENT, (char *)&stOut2,
sizeof(CFG_ACCESS_EVENT_INFO), szOut, 1024*32);
if(bRet2)
{
BOOL bRet3 = CLIENT_SetNewDevConfig(g_lLoginHandle, CFG_CMD_ACCESS_EVENT, 0, szOut,
1024*32, NULL, NULL, 3000);
if (bRet3)
{
printf("CLIENT_SetNewDevConfig Success!\n");
}
else{
printf("CLIENT_SetNewDevConfig failed! Last Error[%x]\n", CLIENT_GetLastError());
}
}
else{
printf("CLIENT_PacketData failed! Last Error[%x]\n", CLIENT_GetLastError());
}
66
2.3.9.1.1 Introduction
For period config information, you can call SDK interface to get and set the door period of the access
control device. The configuration of this template cannot directly take effect on the device and needs
to be called by other function modules.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access period info.
szCommand: CFG_CMD_ACCESSTIMESCHEDULE.
pBuf: CFG_ACCESS_TIMESCHEDULE_INFO.
67
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access period info.
szCommand: CFG_CMD_ACCESSTIMESCHEDULE.
pBuf: CFG_ACCESS_TIMESCHEDULE_INFO.
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
68
printf("CLIENT_SetNewDevConfig failed! Last Error[%x]\n", CLIENT_GetLastError());
}
}
else{
printf("CLIENT_PacketData failed! Last Error[%x]\n", CLIENT_GetLastError());
}
2.3.9.2.1 Introduction
For always open and always closed period config, you can call SDK interface to get and set the period
config of the access control device, including always open period, always closed period, remote
verification period.
Table 2-35 Description of always open and always closed period config interfaces
Interface Description
CLIENT_GetNewDevConfig Query config information.
CLIENT_ParseData Parse the queried config information.
CLIENT_SetNewDevConfig Set config information.
Pack the config information to be set into the
CLIENT_PacketData
string format.
69
2.3.9.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Always open and always closed period and Always open and always closed period and
remote verification period config remote verification period config
Get: CLIENT_GetNewDevConfig Set: CLIENT_SetNewDevConfig
is used with CLIENT_ParseData is used with CLIENT_PacketData
szCommand: CFG_CMD_ACCESS_EVENT szCommand: CFG_CMD_ACCESS_EVENT
Log out
CLIENT_Logout
End
Process
70
CFG_ACCESS_EVENT_INFO Description
nOpenAlwaysTimeIndex Always open period config
nCloseAlwaysTimeIndex Always closed period config
stuAutoRemoteCheck Remote verification period
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
Note
Set the serial number of always open period, always close period and remote verifitication. For
details, see "2.3.9.1 Period Config."
//Get always open, always closed and remote verification period config information
char * szOut1 = new char[1024*32];
CFG_ACCESS_EVENT_INFO stOut2 = {sizeof(stOut2)};
int nError = 0;
BOOL bRet = CLIENT_GetNewDevConfig(g_lLoginHandle, CFG_CMD_ACCESS_EVENT, 0, szOut1, 1024*32,
&nError, 3000);
if(bRet){
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_ACCESS_EVENT, szOut1, &stOut2,
sizeof(CFG_ACCESS_EVENT_INFO), NULL);
if (bRet1)
{
printf("always open period config: %d\n",stOut2.nOpenAlwaysTimeIndex);
printf("always clsoed period config: %s\n",stOut2.nCloseAlwaysTimeIndex);
printf("remote verification period enabling: %d\n", stOut2.stuAutoRemoteCheck.bEnable);
}
}
else{
printf("parse failed!!!");
}
char * szOut = new char[1024*32];
stOut2.nOpenAlwaysTimeIndex = 02;
stOut2.nCloseAlwaysTimeIndex = 03;
stOut2.stuAutoRemoteCheck.bEnable = TRUE;
//Get always open, always closed and remote verification period config information
BOOL bRet2 = CLIENT_PacketData(CFG_CMD_ACCESS_EVENT, (char *)&stOut2,
sizeof(CFG_ACCESS_EVENT_INFO), szOut, 1024*32);
if(bRet2)
{
BOOL bRet3 = CLIENT_SetNewDevConfig(g_lLoginHandle, CFG_CMD_ACCESS_EVENT, 0, szOut,
71
1024*32, NULL, NULL, 3000);
if (bRet3)
{
printf("CLIENT_SetNewDevConfig Success!\n");
}
else{
printf("CLIENT_SetNewDevConfig failed! Last Error[%x]\n", CLIENT_GetLastError());
}
}
else{
printf("CLIENT_PacketData failed! Last Error[%x]\n", CLIENT_GetLastError());
}
2.3.9.3.1 Introduction
For holiday config, you can call SDK interface to get and configure the holiday of the access control
device.
72
2.3.9.3.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
73
Type Description emType Param
NET_CTRL_RECORDSET_PA
DH_CTRL_RECORDSE NET_RECORD_AC
Update holiday RAM
T_UPDATE CESSCTLHOLIDAY
NET_RECORDSET_HOLIDAY
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
//Add holiday
NET_RECORDSET_HOLIDAY stuInfo = {sizeof(stuInfo)};
stuInfo.bEnable = TRUE;
stuInfo.nDoorNum = 2;
stuInfo.sznDoors[0] = 1223;
stuInfo.stuEndTime.dwYear = 2019;
stuInfo.stuEndTime.dwMonth = 12;
stuInfo.stuEndTime.dwDay = 4;
stuInfo.stuEndTime.dwHour = 12;
stuInfo.stuEndTime.dwMinute = 22;
stuInfo.stuEndTime.dwSecond = 12;
stuInfo.stuStartTime.dwYear = 2019;
stuInfo.stuStartTime.dwMonth = 12;
stuInfo.stuStartTime.dwDay = 6;
stuInfo.stuStartTime.dwHour = 12;
stuInfo.stuStartTime.dwMinute = 22;
stuInfo.stuStartTime.dwSecond = 12;
stuParam.stuCtrlRecordSetResult.dwSize = sizeof(NET_CTRL_RECORDSET_INSERT_OUT);
74
//Delete holiday
stuInfo.nRecNo = 123456789;
NET_CTRL_RECORDSET_PARAM stuParam1 = {sizeof(stuParam1)};
stuParam1.emType = NET_RECORD_ACCESSCTLHOLIDAY;
stuParam1.pBuf = (void*)&stuInfo.nRecNo;
stuParam1.nBufLen = sizeof(stuInfo.nRecNo);
int nRet = 0;
BOOL bRet = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_DEV_RECORDSET,
(char*)&stuParam,sizeof(stuParam), &nRet, 5000);
if (bRet)
{
stuInfo.bEnable = TRUE;
stuInfo.nDoorNum = 2;
stuInfo.sznDoors[0] = 1223;
stuInfo.stuEndTime.dwYear = 2019;
stuInfo.stuEndTime.dwMonth = 10;
75
stuInfo.stuEndTime.dwDay = 4;
stuInfo.stuEndTime.dwHour = 12;
stuInfo.stuEndTime.dwMinute = 22;
stuInfo.stuEndTime.dwSecond = 12;
stuInfo.stuStartTime.dwYear = 2019;
stuInfo.stuStartTime.dwMonth = 12;
stuInfo.stuStartTime.dwDay = 6;
stuInfo.stuStartTime.dwHour = 12;
stuInfo.stuStartTime.dwMinute = 22;
stuInfo.stuStartTime.dwSecond = 12;
stuParam.emType = NET_RECORD_ACCESSCTLHOLIDAY;
stuParam.pBuf = (void*)&stuInfo;
stuParam.nBufLen = sizeof(stuInfo);
2.3.10.1.1 Introduction
For unlock at designated intervals and first card unlock, you can call SDK interface to get and set the
config of unlock at designated intervals, first card unlock and first user unlock of the access control
device.
Table 2-42 Description of interfaces for unlock at designated intervals and first card unlock
Interface Description
CLIENT_GetNewDevConfig Query config information.
CLIENT_ParseData Parse the queried config information.
76
Interface Description
CLIENT_SetNewDevConfig Set config information.
CLIENT_PacketData Pack the config information to be set into the string format.
Begin
Initialize SDK
CLIENT_Init
Config of unlock at designated intervals and Config of unlock at designated intervals and
first card unlock first card unlock
Get: CLIENT_GetNewDevConfig Set: CLIENT_SetNewDevConfig
is used with CLIENT_ParseData is used with CLIENT_PacketData
szCommand: CFG_CMD_ACCESS_EVENT szCommand: CFG_CMD_ACCESS_EVENT
Log out
CLIENT_Logout
End
Process
Step 1 Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access info of unlock at
designated intervals and first card unlock.
szCommand: CFG_CMD_ACCESS_EVENT.
pBuf: CFG_ACCESS_EVENT_INFO.
77
Table 2-44 Description of CFG_ACCESS_EVENT_INFO
CFG_ACCESS_EVENT_INFO Description
stuDoorTimeSection Config of unlock at designated intervals
stuFirstEnterInfo First user/first card unlock config
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
Note
//Get config information of unlock at designated intervals and first card/first user unlock
char * szOut1 = new char[1024*32];
CFG_ACCESS_EVENT_INFO stOut2 = {sizeof(stOut2)};
int nError = 0;
BOOL bRet = CLIENT_GetNewDevConfig(g_lLoginHandle, CFG_CMD_ACCESS_EVENT, 0, szOut1, 1024*32,
&nError, 3000);
if(bRet){
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_ACCESS_EVENT, szOut1, &stOut2,
sizeof(CFG_ACCESS_EVENT_INFO), NULL);
if (bRet1)
{
printf("whether it is first card/first user unlock: %d\n",stOut2.stuFirstEnterInfo.bEnable);
printf("Access status after passing first card permission
verification: %d\n",stOut2.stuFirstEnterInfo.emStatus);
printf("Periods that need first card verification: %d\n", stOut2.stuFirstEnterInfo.nTimeIndex);
}
}
else{
printf("parse failed!!!");
}
char * szOut = new char[1024*32];
//First user/first card unlock config
stOut2.stuFirstEnterInfo.bEnable = TRUE;
stOut2.stuFirstEnterInfo.emStatus = ACCESS_FIRSTENTER_STATUS_KEEPOPEN;
stOut2.stuFirstEnterInfo.nTimeIndex = 0;
//Config of unlock at designated intervals
stOut2.stuDoorTimeSection[0][0].emDoorOpenMethod = CFG_DOOR_OPEN_METHOD_PWD_ONLY;
stOut2.stuDoorTimeSection[0][0].stuTime.stuStartTime.dwHour = 9;
78
stOut2.stuDoorTimeSection[0][0].stuTime.stuStartTime.dwMinute = 11;
stOut2.stuDoorTimeSection[0][0].stuTime.stuStartTime.dwSecond = 45;
stOut2.stuDoorTimeSection[0][0].stuTime.stuEndTime.dwHour = 19;
stOut2.stuDoorTimeSection[0][0].stuTime.stuEndTime.dwMinute = 11;
stOut2.stuDoorTimeSection[0][0].stuTime.stuEndTime.dwSecond = 45;
2.3.10.2.1 Introduction
For combination unlock by multiple persons, you can call SDK interface to get and set the config of
combination unlock by multiple persons of the access control device.
79
2.3.10.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Note
Before configuring combination unlock by multiple persons, add personnel to the device.
Combination number: Group the personnel, and one door can configure up to 4 personnel groups.
Personnel group: Person within the group and one group has up to 50 persons who should be added
to device in advance.
Number of valid persons: Should be less than or equal to the current number of persons in the group,
and the total number of valid persons for one door is less than or equal to five persons.
80
Set the unlock method for the personnel group: You can select from card or fingerprint.
int nError = 0;
BOOL bRet = CLIENT_GetNewDevConfig(g_lLoginHandle, CFG_CMD_OPEN_DOOR_GROUP, 0, szOut1,
1024*32, &nError, 3000);
if(bRet){
BOOL bRet1 = CLIENT_ParseData(CFG_CMD_OPEN_DOOR_GROUP, szOut1, &stOut2,
sizeof(CFG_OPEN_DOOR_GROUP_INFO), NULL);
if (bRet1)
{
printf("number of valid combinations:%d\n",stOut2.nGroup);
81
printf("[%d]-[%d]-[%d]MethodEx:%d\n", i, m, n,
stOut2.stuGroupInfo[i].pstuGroupDetailEx[m].emMethodEx);
}
printf("[%d]-[%d]UserID:%s\n", i, m,
stOut2.stuGroupInfo[i].pstuGroupDetailEx[m].szUserID);
}
}
printf("[%d]GroupNum:%d\n", i, stOut2.stuGroupInfo[i].nGroupNum);
for (int j = 0; j < stOut2.stuGroupInfo[i].nGroupNum; j++)
{
printf("[%d],[%d]user ID:%s\n", i, j, stOut2.stuGroupInfo[i].stuGroupDetail[j].szUserID);
}
}
}
}
else{
printf("parse failed!!!");
}
char * szOut = new char[1024*32];
stOut2.nGroup = 1;
stOut2.stuGroupInfo[0].bGroupDetailEx = FALSE;
stOut2.stuGroupInfo[0].nGroupNum = 1;
stOut2.stuGroupInfo[0].stuGroupDetail[0].emMethod = EM_CFG_OPEN_DOOR_GROUP_METHOD_ANY;
82
else{
printf("CLIENT_PacketData failed! Last Error[%x]\n", CLIENT_GetLastError());
}
2.3.10.3.1 Introduction
For inter-door lock config, you can call SDK interface to get and set the inter-door lock config of the
access control device.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
83
Process
Note
84
}
}
else{
printf("parse failed!!!");
}
//Set inter-door lock config information
char * szOut = new char[1024*32];
stOut2.stuABLockInfo.bEnable = TRUE;
stOut2.stuABLockInfo.nDoors = 1;
stOut2.stuABLockInfo.stuDoors[0].nDoor = 2;
stOut2.stuABLockInfo.stuDoors[0].anDoor[0] = 0;
stOut2.stuABLockInfo.stuDoors[0].anDoor[0] = 1;
2.3.10.4 Anti-passback
2.3.10.4.1 Introduction
For anti-passback config, you can call SDK interface to get and set the anti-passback config of the
access control device.
85
Interface Description
CLIENT_GetNewDevConfig Query config information.
CLIENT_ParseData Parse the queried config information.
CLIENT_SetNewDevConfig Set config information.
Pack the config information to be set into the
CLIENT_PacketData
string format.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
86
Note
stOut2.nDoorList = 1;
stOut2.nResetTime = 1;
87
stOut2.nTimeSection = 2;
stOut2.stuDoorList[0].nResetTime = 0;
2.3.10.5.1 Introduction
For unlock password, you can call SDK interface to add, delete, query and modify the unlock
password of the access control device.
88
2.3.10.5.3 Process Description
Begin
Initialize SDK
CLIENT_Init
End
Process
89
Type Description emType Param
NET_CTRL_RECORDSET_PA
DH_DEVSTATE_DEV Get unlock NET_RECORD_ACCE RAM
_RECORDSET password SSCTLPWD NET_RECORDSET_ACCESS_
CTL_PWD
Call the CLIENT_ControlDevice to update unlock password information.
Note
Before configuring combination unlock by multiple persons, add personnel to the device.
User number: Personnel card number.
//Add
stuInfo.bNewDoor = TRUE;
stuInfo.nDoorNum = 2;
stuInfo.sznDoors[0] = 1223;
stuParam.stuCtrlRecordSetResult.dwSize = sizeof(NET_CTRL_RECORDSET_INSERT_OUT);
90
stuParam2.emType = NET_RECORD_ACCESSCTLPWD;
stuParam2.pBuf = (void*)&stuInfo;
stuParam2.nBufLen = sizeof(stuInfo);
int nRet = 0;
BOOL bRet1 = CLIENT_QueryDevState(g_lLoginHandle, DH_DEVSTATE_DEV_RECORDSET,
(char*)&stuParam2,
sizeof(stuParam2), &nRet, 5000);
if (bRet)
{
stuParam2.emType = NET_RECORD_ACCESSCTLPWD;
stuParam2.pBuf = (void*)&stuInfo;
stuParam2.nBufLen = sizeof(stuInfo);
// update info
BOOL bRet2 = CLIENT_ControlDevice(g_lLoginHandle, DH_CTRL_RECORDSET_UPDATE, &stuParam2,
5000);
}
else{
printf("CLIENT_QueryDevState failed!\n");
}
//Delete
stuInfo.nRecNo = 123456;
NET_CTRL_RECORDSET_PARAM stuParam3 = {sizeof(stuParam3)};
stuParam3.emType = NET_RECORD_ACCESSCTLPWD;
stuParam3.pBuf = (void*)&stuInfo.nRecNo;
stuParam3.nBufLen = sizeof(stuInfo.nRecNo);
91
2.3.11.1.1 Introduction
For unlock records query, you can call SDK interface to query the unlock records of the access control
device. You can set query conditions and number of query entries.
92
2.3.11.1.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
93
stuIn.emType = NET_RECORD_ACCESS_ALARMRECORD;
int i = 0, j = 0;
int nMaxNum = 10;
NET_IN_FIND_NEXT_RECORD_PARAM stuIn1 = {sizeof(stuIn1)};
stuIn1.lFindeHandle = stuOut.lFindeHandle;
stuIn1.nFileCount = nMaxNum;
94
{
pstuCard[i].dwSize = sizeof(NET_RECORDSET_ACCESS_CTL_CARD);
}
stuOut2.pRecordList = (void*)pstuCard;
2.3.11.2.1 Introduction
For device log, you can call SDK interface to query the operation log of the access control device by
specifying the log type or the number of queries, or query by pages.
95
2.3.11.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Get logs
CLIENT_QueryNextLog
Log out
CLIENT_Logout
End
Process
96
After completing this process, call the CLIENT_Logout to log out of the device.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
97
2.4 Access Controller/All-in-one Face Machine
(Second-Generation)
Reference
Reference
2.4.3.1.1 Introduction
The process to view device information is that, you issue a command through SDK to the access
control device, to get the capability of another device.
98
2.4.3.1.2 Interface Overview
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
99
}
else
{
return FALSE;
}
2.4.7.1.1 Introduction
Call SDK to add, delete, and query the user info fields of the access controllers (including user ID,
person name, type, status, ID card number, valid period, holiday plan, and user permission).
100
2.4.7.1.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
//Get
101
NET_IN_USERINFO_START_FIND stuStartIn = {sizeof(stuStartIn)};
NET_OUT_USERINFO_START_FIND stuStartOut = {sizeof(stuStartOut)};
stuStartOut.nTotalCount = 0;
stuStartOut.nCapNum = 10;
LLONG UserFindId = CLIENT_StartFindUserInfo(m_lLoginID, &stuStartIn, &stuStartOut,SDK_API_WAIT);
if (UserFindId != NULL)
{
m_UserInfoVector.clear();
//
int nStartNo = 0;
m_bIsDoFindNext = TRUE;
while (m_bIsDoFindNext)
{
NET_ACCESS_USER_INFO* pUserInfo = new NET_ACCESS_USER_INFO[10];
if (pUserInfo)
{
int nRecordNum = 0;
NET_IN_USERINFO_DO_FIND stuFindIn = {sizeof(stuFindIn)};
stuFindIn.nStartNo = nStartNo;
stuFindIn.nCount = 10;
NET_OUT_USERINFO_DO_FIND stuFindOut = {sizeof(stuFindOut)};
stuFindOut.nMaxNum = 10;
stuFindOut.pstuInfo = pstuAlarm;
if (CLIENT_DoFindUserInfo(m_UserFindId, &stuFindIn, &stuFindOut, SDK_API_WAIT))
{
if (stuFindOut.nRetNum > 0)
{
nRecordNum = stuFindOut.nRetNum;
m_bIsDoFindNext = TURE;
}
}
m_bIsDoFindNext = FALSE;
for (int i=0;i<nRecordNum;i++)
{
NET_ACCESS_USER_INFO stuUserInfo;
memset(&stuUserInfo,0,sizeof(NET_ACCESS_USER_INFO));
memcpy(&stuUserInfo,&pUserInfo[i],sizeof(NET_ACCESS_USER_INFO));
m_UserInfoVector.push_back(stuUserInfo);
}
nStartNo = nRecordNum;
102
delete []pUserInfo;
pUserInfo = NULL;
}
else
{
m_bIsDoFindNext = FALSE;
}
}
CLIENT_StopFindUserInfo(m_UserFindId);
return TRUE;
}
else
{
return FALSE;
}
//Add
NET_ACCESS_USER_INFO stuUserInfo;
memset(&stuUserInfo,0,sizeof(NET_ACCESS_USER_INFO));
memcpy(&stuUserInfo,pstuUserInfo,sizeof(NET_ACCESS_USER_INFO));
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
NET_IN_ACCESS_USER_SERVICE_INSERT stuUserInsertIn = {sizeof(stuUserInsertIn)};
stuUserInsertIn.nInfoNum = nNum;
stuUserInsertIn.pUserInfo = &stuUserInfo;
NET_OUT_ACCESS_USER_SERVICE_INSERT stuUserINsertOut = {sizeof(stuUserINsertOut)};
stuUserINsertOut.nMaxRetNum = nNum;
stuUserINsertOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessUserService(m_lLoginID,
NET_EM_ACCESS_CTL_USER_SERVICE_INSERT, &stuUserInsertIn, &stuUserINsertOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Delete
NET_IN_ACCESS_USER_SERVICE_REMOVE stuUserRemoveIn = {sizeof(stuUserRemoveIn)};
stuUserRemoveIn.nUserNum = 1;
NET_ACCESS_USER_INFO stuUserInfo;
memset(&stuUserInfo,0,sizeof(NET_ACCESS_USER_INFO));
103
memcpy(&stuUserInfo,&m_UserInfoVector[m_nUserInfoIndex],sizeof(NET_ACCESS_USER_INFO));
strncpy(stuUserRemoveIn.szUserID[0],stuUserInfo.szUserID,DH_MAX_USERID_LEN-1);
2.4.7.2.1 Introduction
Call SDK to add, delete, query, and modify the card information fields of the access control device
(including card number, user ID, and card type).
104
2.4.7.2.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
105
2.4.7.2.4 Example Code
//Get
NET_IN_CARDINFO _START_FIND stuStartIn = {sizeof(stuStartIn)};
NET_OUT_CARDINFO _START_FIND stuStartOut = {sizeof(stuStartOut)};
stuStartOut.nTotalCount = 0;
stuStartOut.nCapNum = 10;
LLONG CardFindId = CLIENT_StartFindCardInfo(m_lLoginID, &stuStartIn, &stuStartOut,SDK_API_WAIT);
if (CardFindId != NULL)
{
m_CardInfoVector.clear();
//
int nStartNo = 0;
m_bIsDoFindNext = TRUE;
while (m_bIsDoFindNext)
{
NET_ACCESS_CARD_INFO* pCardInfo = new NET_ACCESS_CARD_INFO[10];
if (pCardInfo)
{
int nRecordNum = 0;
NET_IN_CARDINFO_DO_FIND stuFindIn = {sizeof(stuFindIn)};
stuFindIn.nStartNo = nStartNo;
stuFindIn.nCount = 10;
NET_OUT_CARDINFO_DO_FIND stuFindOut = {sizeof(stuFindOut)};
stuFindOut.nMaxNum = 10;
stuFindOut.pstuInfo = pstuAlarm;
if (CLIENT_DoFindCardInfo(m_CardFindId, &stuFindIn, &stuFindOut, SDK_API_WAIT))
{
if (stuFindOut.nRetNum > 0)
{
nRecordNum = stuFindOut.nRetNum;
m_bIsDoFindNext = TURE;
}
}
m_bIsDoFindNext = FALSE;
for (int i=0;i<nRecordNum;i++)
{
NET_ACCESS_CARD_INFO stuCardInfo;
memset(&stuCardInfo,0,sizeof(NET_ACCESS_CARD_INFO));
memcpy(&stuCardInfo,&pCardInfo[i],sizeof(NET_ACCESS_CARD_INFO));
106
m_CardInfoVector.push_back(stuCardInfo);
}
nStartNo = nRecordNum;
delete []pCardInfo;
pCardInfo = NULL;
}
else
{
m_bIsDoFindNext = FALSE;
}
}
CLIENT_StopFindCardInfo (m_CardFindId);
return TRUE;
}
else
{
return FALSE;
}
//Add
NET_ACCESS_CARD_INFO stuCardInfo;
memset(&stuCardInfo,0,sizeof(stuCardInfo));
memcpy(&stuCardInfo, pstuCardInfo, sizeof(stuCardInfo));
memcpy(stuCardInfo.szUserID,m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
NET_IN_ACCESS_CARD_SERVICE_INSERT stuCardInsertIn = {sizeof(stuCardInsertIn)};
stuCardInsertIn.nInfoNum = nNum;
stuCardInsertIn.pCardInfo = &stuCardInfo;
NET_OUT_ACCESS_CARD_SERVICE_INSERT stuCardINsertOut = {sizeof(stuCardINsertOut)};
stuCardINsertOut.nMaxRetNum = nNum;
stuCardINsertOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessCardService(m_lLoginID,
NET_EM_ACCESS_CTL_CARD_SERVICE_INSERT, &stuCardInsertIn, &stuCardINsertOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Update
107
NET_ACCESS_CARD_INFO stuCardInfo;
memset(&stuCardInfo,0,sizeof(stuCardInfo));
memcpy(&stuCardInfo, pstuCardInfo, sizeof(stuCardInfo));
memcpy(stuCardInfo.szUserID,m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
NET_IN_ACCESS_CARD_SERVICE_UPDATE stuCardUpdateIn = {sizeof(stuCardUpdateIn)};
stuCardUpdateIn.nInfoNum = nNum;
stuCardUpdateIn.pCardInfo = &stuCardInfo;
NET_OUT_ACCESS_CARD_SERVICE_UPDATE stuCardUpdateOut = {sizeof(stuCardUpdateOut)};
stuCardUpdateOut.nMaxRetNum = nNum;
stuCardUpdateOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessCardService(m_lLoginID,
NET_EM_ACCESS_CTL_CARD_SERVICE_UPDATE, &stuCardUpdateIn, &stuCardUpdateOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Delete
NET_IN_ACCESS_CARD_SERVICE_REMOVE stuCardRemoveIn = {sizeof(stuCardRemoveIn)};
stuCardRemoveIn.nCardNum = 1;
NET_ACCESS_CARD_INFO stuCardInfo = m_CardInfoVector[m_nCardIndex];
memcpy(&stuCardRemoveIn.szCardNo[0], stuCardInfo.szCardNo, sizeof(stuCardInfo.szCardNo));
NET_OUT_ACCESS_CARD_SERVICE_REMOVE stuCardRemoveOut = {sizeof(stuCardRemoveOut)};
stuCardRemoveOut.nMaxRetNum = 1;
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
stuCardRemoveOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessCardService(m_lLoginID, NET_EM_ACCESS_CTL_CARD_SERVICE_REMOVE,
&stuCardRemoveIn, &stuCardRemoveOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Clear
NET_IN_ACCESS_CARD_SERVICE_CLEAR stuCardClearIn = {sizeof(stuCardClearIn)};
NET_OUT_ACCESS_CARD_SERVICE_CLEAR stuCardClearOut = {sizeof(stuCardClearOut)};
BOOL bRet = CLIENT_OperateAccessCardService(m_lLoginID,
108
NET_EM_ACCESS_CTL_CARD_SERVICE_CLEAR, &stuCardClearIn, &stuCardClearOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
2.4.7.3.1 Introduction
Call SDK to add, delete, query, and modify the face information fields of the access control device
(including user ID and face picture).
109
2.4.7.3.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
//Add
NET_IN_ACCESS_FACE_SERVICE_INSERT stuFaceInsertIn = {sizeof(stuFaceInsertIn)};
stuFaceInsertIn.nFaceInfoNum = 1;
NET_ACCESS_FACE_INFO stuFaceInfo;
memset(&stuFaceInfo,0,sizeof(stuFaceInfo));
memcpy(&stuFaceInfo.szUserID, &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
stuFaceInfo.nFacePhoto = 1;
110
FILE *fPic = fopen(m_szFilePath, "rb");
if (fPic == NULL)
{
FaceUIState(TRUE);
MessageBox(ConvertString("Open picture fail"), ConvertString("Prompt"));
return;
}
fseek(fPic, 0, SEEK_END);
int nLength = ftell(fPic);
if (nLength <= 0)
{
goto FREE_RETURN;
}
rewind(fPic);
stuFaceInfo.nInFacePhotoLen[0]= nLength;
stuFaceInfo.nOutFacePhotoLen[0] = nLength;
stuFaceInfo.pFacePhoto[0] = new char[nLength];
memset(stuFaceInfo.pFacePhoto[0], 0, nLength);
int nReadLen = fread(stuFaceInfo.pFacePhoto[0], 1, nLength, fPic);
fclose(fPic);
fPic = NULL;
if (nReadLen <= 0)
{
goto FREE_RETURN;
}
stuFaceInsertIn.pFaceInfo = &stuFaceInfo;
111
BOOL bRet = CLIENT_OperateAccessFaceService(m_lLoginID,
NET_EM_ACCESS_CTL_FACE_SERVICE_INSERT, &stuFaceInsertIn, &stuFaceINsertOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Get
NET_IN_ACCESS_FACE_SERVICE_GET stuFaceGetIn = {sizeof(stuFaceGetIn)};
stuFaceGetIn.nUserNum = 1;
memcpy(&stuFaceGetIn.szUserID[0], &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
//Update
NET_IN_ACCESS_FACE_SERVICE_INSERT stuFaceInsertIn = {sizeof(stuFaceInsertIn)};
stuFaceInsertIn.nFaceInfoNum = 1;
NET_ACCESS_FACE_INFO stuFaceInfo;
memset(&stuFaceInfo,0,sizeof(stuFaceInfo));
112
memcpy(&stuFaceInfo.szUserID, &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
stuFaceInfo.nFacePhoto = 1;
fseek(fPic, 0, SEEK_END);
int nLength = ftell(fPic);
if (nLength <= 0)
{
goto FREE_RETURN;
}
rewind(fPic);
stuFaceInfo.nInFacePhotoLen[0]= nLength;
stuFaceInfo.nOutFacePhotoLen[0] = nLength;
stuFaceInfo.pFacePhoto[0] = new char[nLength];
memset(stuFaceInfo.pFacePhoto[0], 0, nLength);
int nReadLen = fread(stuFaceInfo.pFacePhoto[0], 1, nLength, fPic);
fclose(fPic);
fPic = NULL;
if (nReadLen <= 0)
{
goto FREE_RETURN;
}
stuFaceInsertIn.pFaceInfo = &stuFaceInfo;
113
stuFaceUpdateOut.nMaxRetNum = nNum;
stuFaceUpdateOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessFaceService(m_lLoginID,
NET_EM_ACCESS_CTL_FACE_SERVICE_UPDATE, &stuFaceUpdateIn, &stuFaceUpdateOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Delete
NET_IN_ACCESS_FACE_SERVICE_REMOVE stuFaceRIn = {sizeof(stuFaceRIn)};
stuFaceRIn.nUserNum = 1;
memcpy(&stuFaceRIn.szUserID[0], &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
NET_OUT_ACCESS_FACE_SERVICE_REMOVE stuFaceROut = {sizeof(stuFaceROut)};
stuFaceROut.nMaxRetNum = 1;
NET_EM_FAILCODE stuFailCodeR = NET_EM_FAILCODE_NOERROR;
stuFaceROut.pFailCode = &stuFailCodeR;
BOOL bRet = CLIENT_OperateAccessFaceService(m_lLoginID, NET_EM_ACCESS_CTL_FACE_SERVICE_REMOVE,
&stuFaceRIn, &stuFaceROut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Clear
NET_IN_ACCESS_FACE_SERVICE_CLEAR stuFaceClearIn = {sizeof(stuFaceClearIn)};
NET_OUT_ACCESS_FACE_SERVICE_CLEAR stuFaceClearOut = {sizeof(stuFaceClearOut)};
BOOL bRet = CLIENT_OperateAccessFaceService(m_lLoginID,
NET_EM_ACCESS_CTL_FACE_SERVICE_CLEAR, &stuFaceClearIn, &stuFaceClearOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
114
2.4.7.4.1 Introduction
Call SDK to add, delete, query, and modify the fingerprint information fields of the access control
device (including user ID, fingerprint data packet, and duress fingerprint number).
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
115
2.4.7.4.4 Example Code
//Add
NET_ACCESS_FINGERPRINT_INFO stuFingerPrintInfo;
memset(&stuFingerPrintInfo,0,sizeof(stuFingerPrintInfo));
memcpy(&stuFingerPrintInfo.szUserID, &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
stuFingerPrintInfo.nPacketLen = m_nFingerprintLen;
stuFingerPrintInfo.nPacketNum = 1;
stuFingerPrintInfo.szFingerPrintInfo = new char[m_nFingerprintLen];
memset(stuFingerPrintInfo.szFingerPrintInfo, 0, m_nFingerprintLen);
memcpy(stuFingerPrintInfo.szFingerPrintInfo, m_byFingerprintData, m_nFingerprintLen);
if (bDuress)
{
stuFingerPrintInfo.nDuressIndex = 1;
}
//stuFingerPrintInfo.nDuressIndex
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
NET_IN_ACCESS_FINGERPRINT_SERVICE_INSERT stuFingerPrintInsertIn = {sizeof(stuFingerPrintInsertIn)};
stuFingerPrintInsertIn.nFpNum = nNum;
stuFingerPrintInsertIn.pFingerPrintInfo = &stuFingerPrintInfo;
NET_OUT_ACCESS_FINGERPRINT_SERVICE_INSERT stuFingerPrintINsertOut =
{sizeof(stuFingerPrintINsertOut)};
stuFingerPrintINsertOut.nMaxRetNum = nNum;
stuFingerPrintINsertOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessFingerprintService(m_lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_INSERT, &stuFingerPrintInsertIn, &stuFingerPrintINsertOut,
SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
if (stuFingerPrintInfo.szFingerPrintInfo != NULL)
{
delete[] stuFingerPrintInfo.szFingerPrintInfo;
stuFingerPrintInfo.szFingerPrintInfo = NULL;
}
//Get
NET_IN_ACCESS_FINGERPRINT_SERVICE_GET stuFingerPrintGetIn = {sizeof(stuFingerPrintGetIn)};
memcpy(&stuFingerPrintGetIn.szUserID[0], &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
116
BOOL bRet = CLIENT_OperateAccessFingerprintService(m_lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_GET, &stuFingerprintGetIn, &stuFingerprintGetOut,
SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Update
NET_ACCESS_FINGERPRINT_INFO stuFingerPrintInfo;
memset(&stuFingerPrintInfo,0,sizeof(stuFingerPrintInfo));
memcpy(&stuFingerPrintInfo.szUserID, &m_stuUserInfo.szUserID, sizeof(m_stuUserInfo.szUserID));
if (m_nFingerprintLen != m_stuFingerprint.nSinglePacketLength)
{
MessageBox(ConvertString("FingerprintLen error"), ConvertString("Prompt"));
FingerPrintUIState(TRUE);
return;
}
stuFingerPrintInfo.nPacketLen = m_nFingerprintLen;
stuFingerPrintInfo.nPacketNum = m_stuFingerprint.nRetFingerPrintCount;
stuFingerPrintInfo.szFingerPrintInfo = new char[m_nFingerprintLen *
m_stuFingerprint.nRetFingerPrintCount];
memset(stuFingerPrintInfo.szFingerPrintInfo, 0, m_nFingerprintLen *
m_stuFingerprint.nRetFingerPrintCount);
memcpy(stuFingerPrintInfo.szFingerPrintInfo, m_stuFingerprint.pbyFingerData,
m_stuFingerprint.nRetFingerDataLength);
memcpy(stuFingerPrintInfo.szFingerPrintInfo + m_nFingerprintIndex * m_nFingerprintLen,
m_byFingerprintData, m_nFingerprintLen);
if (bDuress)
{
stuFingerPrintInfo.nDuressIndex = m_nFingerprintIndex + 1;
}
//stuFingerPrintInfo.nDuressIndex
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
NET_IN_ACCESS_FINGERPRINT_SERVICE_UPDATE stuFingerprintUpdateIn =
{sizeof(stuFingerprintUpdateIn)};
stuFingerprintUpdateIn.nFpNum = nNum;
stuFingerprintUpdateIn.pFingerPrintInfo = &stuFingerPrintInfo;
NET_OUT_ACCESS_FINGERPRINT_SERVICE_UPDATE stuFingerprintUpdateOut =
{sizeof(stuFingerprintUpdateOut)};
117
stuFingerprintUpdateOut.nMaxRetNum = nNum;
stuFingerprintUpdateOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessFingerprintService(m_lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_UPDATE, &stuFingerprintUpdateIn, &stuFingerprintUpdateOut,
SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
if (stuFingerPrintInfo.szFingerPrintInfo != NULL)
{
delete[] stuFingerPrintInfo.szFingerPrintInfo;
stuFingerPrintInfo.szFingerPrintInfo = NULL;
}
//Delete
NET_IN_ACCESS_FINGERPRINT_SERVICE_REMOVE stuFingerPrintRemoveIn = {sizeof(stuFingerPrintRemoveIn)};
stuFingerPrintRemoveIn.nUserNum = 1;
memcpy(&stuFingerPrintRemoveIn.szUserID[0], &m_stuUserInfo.szUserID,
sizeof(m_stuUserInfo.szUserID));
NET_OUT_ACCESS_FINGERPRINT_SERVICE_REMOVE stuFingerPrintRemoveOut =
{sizeof(stuFingerPrintRemoveOut)};
stuFingerPrintRemoveOut.nMaxRetNum = 1;
NET_EM_FAILCODE stuFailCode = NET_EM_FAILCODE_NOERROR;
stuFingerPrintRemoveOut.pFailCode = &stuFailCode;
BOOL bRet = CLIENT_OperateAccessFingerprintService(m_lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_REMOVE, &stuFingerprintRemoveIn,
&stuFingerprintRemoveOut, SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
//Clear
NET_IN_ACCESS_FINGERPRINT_SERVICE_CLEAR stuFingerprintClearIn = {sizeof(stuFingerprintClearIn)};
NET_OUT_ACCESS_FINGERPRINT_SERVICE_CLEAR stuFingerprintClearOut =
{sizeof(stuFingerprintClearOut)};
BOOL bRet = CLIENT_OperateAccessFingerprintService(m_lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_CLEAR, &stuFingerprintClearIn, &stuFingerprintClearOut,
118
SDK_API_WAIT);
if (bRet)
{
return TRUE;
}
return FALSE;
2.4.9.3.1 Introduction
Configure the holiday group of the device through SDK, including the holiday group name, the start
and end time, and group enabling.
119
2.4.9.3.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
//Get
NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO stuIn = {sizeof(stuIn)};
120
BOOL bret = CLIENT_GetConfig((LLONG)m_lLoginID, NET_EM_CFG_ACCESSCTL_SPECIALDAY_GROUP,
nId,&stuSpecialdayGroup, sizeof(NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO));
if (!bret)
{
return FALSE;
}
else
{
return TRUE;
}
//Set
NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO stuSpecialdayGroup;
stuSpecialdayGroup.bGroupEnable = m_chkGroupEnable.GetCheck() ? TRUE : FALSE;
BOOL bret = CLIENT_SetConfig((LLONG)m_lLoginID, NET_EM_CFG_ACCESSCTL_SPECIALDAY_GROUP, nId,
&stuSpecialdayGroup, sizeof(NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO));// The channel is the holiday
group number 0-127.
if (!bret)
{
return FALSE;
}
else
{
return TRUE;
}
2.4.9.4.1 Introduction
Configure the holiday plan of the device through SDK, including the holiday plan name, enabling,
period, and valid door channel.
121
2.4.9.4.3 Process Description
Start
Log out
CLIENT_Logout
End
Process
//Get
NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO stuSpecialdaySchedule =
122
{sizeof(stuSpecialdaySchedule)};
BOOL bret = CLIENT_GetConfig((LLONG)m_lLoginID,
NET_EM_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE, nId,& stuSpecialdaySchedule,
sizeof(NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO));
if (!bret)
{
return FALSE;
}
else
{
return TRUE;
}
//Set
NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO stuSpecialdaySchedule;
stuSpecialdaySchedule.bSchdule = m_chkSpeciadayEnable.GetCheck() ? TRUE : FALSE;
stuSpecialdaySchedule.nGroupNo = 1;
BOOL bret = CLIENT_SetConfig((LLONG)m_lLoginID, NET_EM_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE, nId,
& stuSpecialdaySchedule, sizeof(NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO));
if (!bret)
{
return FALSE;
}
else
{
return TRUE;
}
123
See "2.3.11.2 Device log."
2.4.11.3.1 Introduction
Query the alarm records of the access control device through the SDK interface.
124
2.4.11.3.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
125
After using all SDK functions, call the CLIENT_Cleanup to release SDK resource.
//Start finding
stuIn.emType = NET_RECORD_ACCESS_ALARMRECORD;
m_AlarmFindId = stuOut.lFindeHandle;
return TRUE;
else
return FALSE;
stuIn.lFindeHandle = m_AlarmFindId;
nCount = stuOut.nRecordCount;
return TRUE;
else
return FALSE;
NET_RECORD_ACCESS_ALARMRECORD_INFO pstuAlarm;
stuIn.lFindeHandle = m_AlarmFindId;
stuIn.nFileCount = nMaxNum;
stuOut.nMaxRecordNum = nMaxNum;
stuOut.pRecordList = (void*)pstuAlarm;
126
if (CLIENT_FindNextRecord(&stuIn, &stuOut, SDK_API_WAIT) >= 0)
if (stuOut.nRetRecordNum > 0)
nRecordNum = stuOut.nRetRecordNum;
return TRUE;
return FALSE;
if (bret)
m_AlarmFindId = NULL;
return TRUE;
else
return FALSE;
127
3 Interface Function
128
Item Description
void CLIENT_SetAutoReconnect(
fHaveReConnect cbAutoConnect,
Function
LDWORD dwUser
);
[in]cbAutoConnect Reconnection callback.
Parameter
[in]dwUser User parameters for reconnection callback.
Return Value None.
Set reconnection callback interface. If the callback is set as NULL, the device will
Note
not be reconnected automatically.
129
Table 3-6 Description of device initialization
Item Description
Description Initialize Device.
BOOL CLIENT_InitDevAccount(
const NET_IN_INIT_DEVICE_ACCOUNT *pInitAccountIn,
NET_OUT_INIT_DEVICE_ACCOUNT *pInitAccountOut,
Function
DWORD dwWaitTime,
char *szLocalIp
);
Input parameter, corresponding to
[in]pInitAccountIn
NET_IN_INIT_DEVICE_ACCOUNT structure.
Output parameter, corresponding to
[out]pInitAccountOut
NET_OUT_INIT_DEVICE_ACCOUNT structure.
Parameter [in]dwWaitTime Timeout period.
In the case of single network adapter, szLocalIp can be
left empty.
[in]szLocalIp
In the case of multiple network adapters, fill the host
IP in szLocalIp.
Return Success: TRUE
Value Failure: FALSE
Note None.
CLIENT_GetDescriptionForResetPwd
130
Item Description
Note None
131
Item Description
In the case of single network adapter, the last
parameter can be left empty.
[in]szLocalIp
In the case of multiple network adapters, please
fill the host IP in the last parameter.
Success: TRUE
Return Value
Failure: FALSE
Note None.
132
3.1.3 Device Login
133
Item Description
BOOL CLIENT_Logout(
Function LLONG lLoginID
);
Parameter [in]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity.
Success: TRUE
Return Value
Failure: FALSE
Description None.
134
Live view type Meanings
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
135
Item Description
BOOL CLIENT_StopSaveRealData(
Function LLONG lRealHandle
);
Parameter [in]lRealHandle Return value of CLIENT_RealPlayEx.
Success: TRUE
Return Value
Failure: FALSE
Note None.
136
Item Description
BOOL CLIENT_ControlDeviceEx(
LLONG lLoginID,
CtrlType emType,
Function Void *pInBuf,
Void *pOutBuf = NULL,
int nWaitTime = 1000
);
[in]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity.
[in]emType Control type.
[in]pInBuf Input parameters, which vary by emType.
Parameter Output parameters, NULL by default; for some
[out]pOutBuf
emTypes, there are corresponding output structures.
Timeout period, 1000 ms by default, which can be set
[in]waittime
as needed.
Success: TRUE
Return Value
Failure: FALSE
Note None.
137
Item Description
Message callback function
Status in which devices can be called back, such as
[in]cbMessage alarm status.
Parameter
When the value is set as 0, it means callback is
forbidden.
[in]dwUser User-defined data.
Return Value None
Set device message callback function to get the current device status
information; this function is independent of the calling sequence, and the
Note SDK is not called back by default.
The callback function fMessCallBack must call the alarm message
subscription interface CLIENT_StartListenEx first before it takes effect.
138
Table 3-27 Description of getting device status
Item Description
Description Directly get the connection status of remote devices.
BOOL CLIENT_QueryDevState(
LLONG lLoginID,
int nType,
char *pBuf,
Function
int nBufLen,
int *pRetLen,
int waittime=1000
);
[in]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity.
[in]nType Query information type.
To receive the returned data buffer in query. Based on
[out]pBuf different query types, the structures of returned data are
Parameter also different. See Table 3-28 for details.
[in]nBufLen Buffer length, in bytes.
[out]pRetLen Length of data actually returned, in bytes.
Waiting time in query status, 1000 ms by default, which
[in]waittime
can be set as needed.
Success: TRUE
Return Value
Failure: FALSE
Note None.
CLIENT_GetDevProtocolType
139
Item Description
Protocol type supported by the device,
[out]pemProtocolType corresponding to EM_DEV_PROTOCOL_TYPE
structure.
Success: TRUE
Return Value
Failure: FALSE
Note None.
140
Item Description
[in]pfcb Audio data callback function.
[in]dwUser Parameters of audio data callback function.
Success: Non-0
Return Value
Failure: 0
Note None.
141
3.1.8.7 Sending Voice CLIENT_TalkSendData
142
3.2 Alarm Host
CLIENT_QueryNewSystemInfo
143
Item Description
Timeout period, 1000ms by default, which can be set
[in]waittime
as needed.
Success: TRUE
Return Value
Failure: FALSE
The information got is in string format, and information contained in each
Note
string is parsed by CLIENT_ParseData.
144
szCommand Query type Corresponding structure
Access control event config
(door config information,
always open and always
CFG_CMD_ACCESS_EVENT CFG_ACCESS_EVENT_INFO
closed period config, unlock
at designated intervals, first
card unlocking config)
Card swiping period for
CFG_CMD_ACCESSTIMESC
access control (period CFG_ACCESS_TIMESCHEDULE_INFO
HEDULE
config)
CFG_CMD_OPEN_DOOR_G Combination unlocking by
CFG_OPEN_DOOR_GROUP_INFO
ROUP multiple persons config
CFG_CMD_ACCESS_GENER Basic config for access
CFG_ACCESS_GENERAL_INFO
AL control (inter-door lock)
Collection of routes to open
CFG_CMD_OPEN_DOOR_R
the door, also called CFG_OPEN_DOOR_ROUTE_INFO
OUTE
anti-passback route config
145
nType Description pInBuf pOutBuf
Obtain the
capability set for NET_IN_GET_FACEINF NET_OUT_GET_FACEINF
NET_FACEINFO_CAPS
face access O_CAPS O_CAPS
controller
146
3.3.4 Network Setting
3.3.4.1 IP Settings
For details about CLIENT_ParseData, see "3.3.3.2 Parsing the Queried Config Information
CLIENT_ParseData."
Table 3-47 Description of error codes and meanings of the parameter error
Error code Corresponding meanings
0 Successful
1 Failed
2 Illegal data
3 Cannot be set for now
4 Permission denied
147
3.3.4.1.3 Setting Config Information CLIENT_SetNewDevConfig
Table 3-49 Description of error codes and meanings of the parameter error
Error code Corresponding meanings
0 Successful
1 Failed
2 Illegal data
3 Cannot be set for now
4 Permission denied
148
Item Description
BOOL CLIENT_PacketData (
char *szCommand,
LPVOID lpInBuffer,
Function DWORD dwInBufferSize,
char *szOutBuffer,
DWORD dwOutBufferSize
);
Command parameter. See "3.3.3.2 Parsing the
[in] szCommand Queried Config Information CLIENT_ParseData" for
details.
Input buffer. For structure types, see "3.3.3.2 Parsing
Parameter [in] lpInBuffer
the Queried Config Information CLIENT_ParseData."
[in] dwInBufferSize Input buffer size.
[out] szOutBuffer Output buffer.
[in] dwOutBufferSize Output buffer size.
Success: TRUE,
Return Value
Failure: FALSE
This interface is used with CLIENT_SetNewDevConfig. After using
Note CLIENT_PacketData, set the packed information onto the device by
CLIENT_SetNewDevConfig.
149
Item Description
Description Set the current time of the device.
BOOL CLIENT_SetupDeviceTime (
LLONG lLoginID,
Function
LPNET_TIME pDeviceTime,
);
Login handle, return value of
[in] lLoginID
Parameter CLIENT_LoginWithHighLevelSecurity.
[in] pDeviceTime Set device time pointer.
Success: TRUE,
Return Value
Failure: FALSE
When it is applied in system time sync, change the current system time of the
Note
front-end device to be synchronized with the local system time.
150
3.3.6 Maintenance Config
3.3.6.2 Restart
151
Item Description
BOOL CLIENT_ControlDevice(
LLONG lLoginID,
CtrlType type,
Function
void *param,
int nWaitTime = 1000
);
[in]lLoginID Return value of CLIENT_Login or CLIENT_LoginEx.
[in]type Control type.
Parameter [in]param Control parameters vary by type.
Timeout period, 1000ms by default, which can be set
[in]waittime
as needed.
Success: TRUE
Return Value
Failure: FALSE
Note None.
152
Item Description
BOOL CLIENT_ResetSystem (
LLONG lLoginID,
const NET_IN_RESET_SYSTEM* pstInParam,
Function
NET_OUT_RESET_SYSTEM* pstOutParam,
int nWaitTime
);
[in]lLoginID Return value of CLIENT_Login or CLIENT_LoginEx.
[in] pstInParam Input parameter for restoring to factory defaults.
Parameter
[out] pstOutParam Output parameter for restoring to factory defaults.
[in] nWaitTime Timeout period.
Success: TRUE
Return Value
Failure: FALSE
153
emType Meanings
DH_UPGRADE_CHARACTER_TYPE Chinese character library
DH_UPGRADE_LOGO_TYPE LOGO
DH_UPGRADE_EXE_TYPE EXE, such as player
Inherent device information settings (such as
DH_UPGRADE_DEVCONSTINFO_TYPE
hardware ID, MAC, SN)
DH_UPGRADE_PERIPHERAL_TYPE Peripheral access sub chip (such as vehicle chip)
DH_UPGRADE_GEOINFO_TYPE Geographic information positioning chip
DH_UPGRADE_MENU Menu (pictures in the device operating interface)
DH_UPGRADE_ROUTE Route file (such as bus routes)
Bus stop announcement audio (matching with
DH_UPGRADE_ROUTE_STATE_AUTO
routes)
DH_UPGRADE_SCREEN Dispatch screen (such as bus operating screen)
154
Item Description
BOOL CLIENT_GetDevConfig (
LLONG lLoginID,
DWORD dwCommand,
LONG lChannel,
Function LPVOID lpOutBuffer,
DWORD dwOutBufferSize,
LPDWORD lpBytesReturned,
int waittime =500
);
[in] lLoginID Device login handle.
For device config commands, see Table 3-62 for
details. Different dwCommand and lpOutBuffer
[in] dwCommand
correspond to different structures. See Table 3-62 for
details.
Channel number. If all channel data obtained is
Parameter
[in] lChannel 0xFFFFFFFF and the command does not require
channel number, this parameter is invalid.
[out] lpOutBuffer Pointer of received data buffer.
[in] dwOutBufferSize Length of received data buffer (in bytes).
[out] lpBytesReturned Length of data actually received.
[in] waittime Timeout period for waiting.
Success: TRUE
Return Value
Failure: FALSE
Note None.
155
Item Description
For device config commands, see Table 3-62 for
details. Different dwCommand and lpInBuffer
[in] dwCommand
correspond to different structures. See Table 3-62 for
details.
Channel number. If all channel data obtained is
[in] lChannel 0xFFFFFFFF and the command does not require
channel number, this parameter is invalid.
[in] lpInBuffer Data buffer pointer.
[in] dwInBufferSize Data buffer length (in bytes).
[in] waittime Timeout period for waiting.
Success: TRUE
Return Value
Failure: FALSE
Note None.
See "3.3.6.2.1 Device Control CLIENT_ControlDevice" and "3.3.3.4 Querying Device Status
CLIENT_QueryDevState."
156
3.3.9 Door Time Config
See "3.3.6.2.1 Device Control CLIENT_ControlDevice" and "3.3.3.4 Querying Device Status
CLIENT_QueryDevState."
157
3.3.10.1.1 Parsing Config Information CLIENT_GetNewDevConfig
158
3.3.10.4 Anti-passback
159
3.3.10.6.2 Starting Querying Logs CLIENT_StartQueryLog
160
Item Description
BOOL CLIENT_StopQueryLog (
Function LLONG lLogID,
);
Parameter [in] lLogID Query log handle.
Success: TRUE,
Return Value
Failure: FALSE
Description None.
161
Item Description
[in]lLoginID Device login handle.
[in] pInParam Input parameter for querying records.
Parameter Output parameter for querying records. Return to the
[out] pOutParam
query handle.
[in] waittime Timeout period for waiting.
Success: TRUE,
Return Value
Failure: FALSE
You can call this interface first to get the query handle, then call the
Note CLIENT_FindNextRecord function to get the list of records. After the query is
completed, you can call CLIENT_FindRecordClose to close the query handle.
162
Item Description
Description Stop record query.
BOOL CLIENT_FindRecordClose (
Function LLONG lFindHandle,
);
Parameter [in] lFindHandle Return value of CLIENT_FindRecord.
Success: TRUE
Return Value
Failure: FALSE
Call CLIENT_FindRecord to open the query handle; after the query is
Note
completed, you should call this function to close the query handle.
163
Item Description
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-75 Comparison of nType, pInBuf and pOutBuf
nType Description pInBuf pOutBuf
NET_ACCESSCONTROL Get the access
NET_IN_AC_CAPS NET_OUT_AC_CAPS
_CAPS control capability
Table 3-76 Description of user information management interface for access control devices
Item Description
Description Personnel information management interface for access control devices.
164
Item Description
BOOL CLIENT_OperateAccessUserService (
LLONG lLoginID,
NET_EM_ACCESS_CTL_USER_SERVICE emtype,
Function void* pstInParam,
void* pstOutParam,
int nWaitTime
);
[in] lLoginID Login handle.
[in] emtype User information operation type.
Parameter [in] pInBuf User information management (input parameter).
[out] pOutBuf User information management (output parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-77 Comparison of nType, pInBuf and pOutBuf
emtype Description pInBuf pOutBuf
NET_EM_ACCESS_CTL_ NET_IN_ACCESS_USE NET_OUT_ACCESS_USE
Add user info
USER_SERVICE_INSERT R_SERVICE_INSERT R_SERVICE_INSERT
NET_EM_ACCESS_CTL_
NET_IN_ACCESS_USE NET_OUT_ACCESS_USE
USER_SERVICE_REMOV Delete user info
R_SERVICE_REMOVE R_SERVICE_REMOVE
E
NET_EM_ACCESS_CTL_ Clear all user NET_IN_ACCESS_USE NET_OUT_ACCESS_USE
USER_SERVICE_CLEAR information R_SERVICE_CLEAR R_SERVICE_CLEAR
165
3.4.7.1.3 Finding the Personnel Information Interface CLIENT_DoFindUserInfo
3.4.7.2.1 Card Information Management Interface for Access Control Devices CLIENT_OperateAccessCardService
Table 3-81 Description of card information management interface for access control devices
Item Description
Description Card information management interface for access control devices.
166
Item Description
BOOL CLIENT_OperateAccessCardService (
LLONG lLoginID,
NET_EM_ACCESS_CTL_CARD_SERVICE emtype,
Function void* pstInParam,
void* pstOutParam,
int nWaitTime
);
[in] lLoginID Login handle.
[in] emtype Card information operation type.
Parameter [in] pInBuf Card information management (input parameter).
[out] pOutBuf Card information management (output parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None
Table 3-82 Comparison of nType, pInBuf and pOutBuf
emtype Description pInBuf pOutBuf
NET_EM_ACCESS_CTL_ Add the card NET_IN_ACCESS_CAR NET_OUT_ACCESS_CAR
CARD_SERVICE_INSERT information D_SERVICE_INSERT D_SERVICE_INSERT
NET_EM_ACCESS_CTL_
Delete the card NET_IN_ACCESS_CAR NET_OUT_ACCESS_CAR
CARD_SERVICE_REMO
information D_SERVICE_REMOVE D_SERVICE_REMOVE
VE
NET_EM_ACCESS_CTL_ Clear all card NET_IN_ACCESS_CAR NET_OUT_ACCESS_CAR
CARD_SERVICE_CLEAR information D_SERVICE_CLEAR D_SERVICE_CLEAR
167
3.4.7.2.3 Finding the Card Information Interface CLIENT_DoFindCardInf
3.4.7.3.1 Face Information Management Interface for Access Control Devices CLIENT_OperateAccessFaceService
Table 3-86 Description of face information management interface for access control devices
Item Description
Description Face information management interface for access control devices.
168
Item Description
BOOL CLIENT_OperateAccessFaceService (
LLONG lLoginID,
NET_EM_ACCESS_CTL_FACE_SERVICE emtype,
Function void* pstInParam,
void* pstOutParam,
int nWaitTime
);
[in] lLoginID Login handle.
[in] emtype Face information operation type.
Parameter [in] pInBuf Face information management (input parameter).
[out] pOutBuf Face information management (output parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-87 Comparison of nType, pInBuf and pOutBuf
emtype Description pInBuf pOutBuf
NET_EM_ACCESS_CTL_ Add the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE_INSERT information E_SERVICE_INSERT _SERVICE_INSERT
NET_EM_ACCESS_CTL_ Find the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE_GET information E_SERVICE_GET _SERVICE_GET
NET_EM_ACCESS_CTL_
Update the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE_UPDAT
information E_SERVICE_UPDATE _SERVICE_UPDATE
E
NET_EM_ACCESS_CTL_
Delete the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE_REMOV
information E_SERVICE_REMOVE _SERVICE_REMOVE
E
NET_EM_ACCESS_CTL_ Clear the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE_CLEAR information E_SERVICE_CLEAR _SERVICE_CLEAR
Table 3-88 Description of fingerprint information management interface for access control devices
Item Description
Description Fingerprint information management interface for access control devices.
169
Item Description
BOOL CLIENT_OperateAccessFingerprintService (
LLONG lLoginID,
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE emtype,
Function void* pstInParam,
void* pstOutParam,
int nWaitTime
);
[in] lLoginID Login handle.
[in] emtype Fingerprint information operation type.
Fingerprint information management (input
[in] pInBuf
Parameter parameter).
Fingerprint information management (output
[out] pOutBuf
parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-89 Comparison of nType, pInBuf and pOutBuf
emtype Description pInBuf pOutBuf
NET_EM_ACCESS_CTL_ NET_IN_ACCESS_FIN NET_OUT_ACCESS_FING
Add the fingerprint
FINGERPRINT_SERVICE GERPRINT_SERVICE_I ERPRINT_SERVICE_INSER
information
_INSERT NSERT T
NET_EM_ACCESS_CTL_ NET_IN_ACCESS_FIN
Find the fingerprint NET_OUT_ACCESS_FING
FINGERPRINT_SERVICE GERPRINT_SERVICE_
information ERPRINT_SERVICE_GET
_GET GET
NET_EM_ACCESS_CTL_ Update the NET_IN_ACCESS_FIN NET_OUT_ACCESS_FING
FINGERPRINT_SERVICE fingerprint GERPRINT_SERVICE_ ERPRINT_SERVICE_UPDA
_UPDATE information UPDATE TE
NET_EM_ACCESS_CTL_ Delete the NET_IN_ACCESS_FIN NET_OUT_ACCESS_FING
FINGERPRINT_SERVICE fingerprint GERPRINT_SERVICE_R ERPRINT_SERVICE_REM
_REMOVE information EMOVE OVE
NET_EM_ACCESS_CTL_ NET_IN_ACCESS_FIN NET_OUT_ACCESS_FING
Clear the fingerprint
FINGERPRINT_SERVICE GERPRINT_SERVICE_C ERPRINT_SERVICE_CLEA
information
_CLEAR LEAR R
170
3.4.8.1.2 Querying Config Information CLIENT_GetNewDevConfig
171
3.4.9.3 Holiday group
172
Item Description
int waittime=3000
int * restart=NULL
void * reserve=NULL
);
Parameter [in] lLoginID Login handle.
[in] emCfgOpType Set the configuration type.
Holiday group config:
NET_EM_CFG_ACCESSCTL_SPECIALDAY_GROUP.
[in] nChannelID Channel.
[in] szInBuffer Configured buffer address.
[in] dwInBufferSize Buffer address size.
[in] waittime Timeout period.
[in] restart Whether to restart.
[in] reserve Reserved parameter.
Return value Success: TRUE
Failure: FALSE
Description None.
173
3.4.11 Records Query
174
Item Description
Success: TRUE,
Return Value
Failure: FALSE
You can call this interface first to get the query handle, then call the
Note CLIENT_FindNextRecord function to get the list of records. After the query is
completed, you can call CLIENT_FindRecordClose to close the query handle.
175
Item Description
Parameter [in] lFindHandle Return value of CLIENT_FindRecord.
Success: TRUE
Return Value
Failure: FALSE
Call CLIENT_FindRecord to open the query handle; after the query is
Note
completed, you should call this function to close the query handle.
176
4 Callback Function
177
Item Description
typedef void (CALLBACK *fDisConnect)(
LLONG lLoginID,
char *pchDVRIP,
Function
LONG nDVRPort,
LDWORD dwUser
);
[out]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity.
[out]pchDVRIP Disconnected device IP.
Parameter
[out]nDVRPort Disconnected device port.
[out]dwUser User parameters for callback function.
Return Value None.
Note None.
178
Item Description
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 means raw data
[out]dwDataType 1 means data with frame information
2 means YUV data
3 means PCM audio data
[out]pBuffer Monitoring data block address.
[out]dwBufSize Length of monitoring data block, in bytes.
Parameter structure for callback data. The type is
Parameter
different if the dwDataType value is different.
When dwDataType is 0, param is null pointer.
When dwDataType is 1, param is the structure
[out]param pointer tagVideoFrameParam.
When dwDataType is 2, param is the structure
pointer tagCBYUVDataParam.
When dwDataType is 3, param is the structure
pointer tagCBPCMDataParam.
[out]dwUser User parameters for callback function.
Return Value None.
Note None.
179
Item Description
Flag of data type
[out]byAudioFlag 0 means that the data is locally collected.
1 means that the data is sent from the device.
[out]dwUser User parameters for callback function.
Return Value None.
Note None.
180
Alarm Alarm type
lCommand pBuf
business name
Dismantleme
DH_ALARM_CHASSISINTRUDE ALARM_CHASSISINTRUDED_INF
nt prevention
D O
event
Extended
DH_ALARM_ALARMEXTENDE ALARM_ALARMEXTENDED_INF
alarm input
D O
channel event
The data is a 16-byte array, and
each byte represents a channel
Emergency
DH_URGENCY_ALARM_EX status
event
1: With alarms
0: Without alarms
Low battery DH_ALARM_BATTERYLOWPO ALARM_BATTERYLOWPOWER_I
voltage event WER NFO
Device
inviting
DH_ALARM_TALKING_INVITE ALARM_TALKING_INVITE_INFO
platform to
talk event
Device
DH_ALARM_ARMMODE_CHA ALARM_ARMMODE_CHANGE_I
arming mode
NGE_EVENT NFO
change event
Protection
zone bypass DH_ALARM_BYPASSMODE_CH ALARM_BYPASSMODE_CHANG
status change ANGE_EVENT E_INFO
event
Alarm input
DH_ALARM_INPUT_SOURCE_S ALARM_INPUT_SOURCE_SIGNA
source signal
IGNAL L_INFO
event
Alarm
DH_ALARM_ALARMCLEAR ALARM_ALARMCLEAR_INFO
clearing event
Sub-system
DH_ALARM_SUBSYSTEM_STAT ALARM_SUBSYSTEM_STATE_CH
status change
E_CHANGE ANGE_INFO
event
Extension
module DH_ALARM_MODULE_LOST ALARM_MODULE_LOST_INFO
offline event
PSTN offline DH_ALARM_PSTN_BREAK_LIN ALARM_PSTN_BREAK_LINE_INF
event E O
Analog
quantity DH_ALARM_ANALOG_PULSE ALARM_ANALOGPULSE_INFO
alarm event
Alarm
DH_ALARM_PROFILE_ALARM_ ALARM_PROFILE_ALARM_TRAN
transmission
TRANSMIT SMIT_INFO
event
181
Alarm Alarm type
lCommand pBuf
business name
Wireless
device low DH_ALARM_WIRELESSDEV_LO ALARM_WIRELESSDEV_LOWPO
battery alarm WPOWER WER_INFO
event
Protection
zone arming
and DH_ALARM_DEFENCE_ARMM ALARM_DEFENCE_ARMMODEC
disarming ODE_CHANGE HANGE_INFO
status change
event
Sub-system
arming and
DH_ALARM_SUBSYSTEM_ARM ALARM_SUBSYSTEM_ARMMOD
disarming
MODE_CHANGE ECHANGE_INFO
status change
event
Detector
DH_ALARM_SENSOR_ABNOR ALARM_SENSOR_ABNORMAL_I
abnormality
MAL NFO
alarm
Patient
DH_ALARM_PATIENTDETECTIO ALARM_PATIENTDETECTION_IN
activity status
N FO
alarm event
Access control DH_ALARM_ACCESS_CTL_EVE ALARM_ACCESS_CTL_EVENT_I
event NT NFO
Details of
access control DH_ALARM_ACCESS_CTL_NO ALARM_ACCESS_CTL_NOT_CLO
unlocking T_CLOSE SE_INFO
event
Details of
DH_ALARM_ACCESS_CTL_BRE ALARM_ACCESS_CTL_BREAK_I
intrusion
AK_IN N_INFO
event
Details of
DH_ALARM_ACCESS_CTL_REP ALARM_ACCESS_CTL_REPEAT_E
Access repeated
EAT_ENTER NTER_INFO
Control entry event
Malicious
DH_ALARM_ACCESS_CTL_MA ALARM_ACCESS_CTL_MALICIO
unlocking
LICIOUS US
event
Details of
DH_ALARM_ACCESS_CTL_DU ALARM_ACCESS_CTL_DURESS_I
forced card
RESS NFO
swiping event
Combination
unlocking by DH_ALARM_OPENDOORGROU ALARM_OPEN_DOOR_GROUP_I
multiple P NFO
persons event
182
Alarm Alarm type
lCommand pBuf
business name
Dismantleme
DH_ALARM_CHASSISINTRUDE ALARM_CHASSISINTRUDED_INF
nt prevention
D O
event
Local alarm
DH_ALARM_ALARM_EX2 ALARM_ALARM_INFO_EX2
event
Access control DH_ALARM_ACCESS_CTL_STA ALARM_ACCESS_CTL_STATUS_I
status event TUS NFO
DH_ALARM_ACCESS_CTL_STA ALARM_ACCESS_CTL_STATUS_I
Bolt alarm
TUS NFO
Fingerprint
ALARM_CAPTURE_FINGER_PRI
acquisition DH_ALARM_FINGER_PRINT
NT_INFO
event
No response
to the call in
DH_ALARM_CALL_NO_ANSW NET_ALARM_CALL_NO_ANSWE
direct
ERED RED_INFO
connection
event
Mobile phone
DH_ALARM_TELEPHONE_CHE ALARM_TELEPHONE_CHECK_IN
number
CK FO
report event
VTS status ALARM_VTSTATE_UPDATE_INF
DH_ALARM_VTSTATE_UPDATE
report O
VTO object
DH_ALARM_ACCESSIDENTIFY NET_ALARM_ACCESSIDENTIFY
recognition
Device
Video inviting
Intercom another DH_ALARM_TALKING_INVITE ALARM_TALKING_INVITE_INFO
device to start
talk event
Device
DH_ALARM_TALKING_IGNORE ALARM_TALKING_IGNORE_INVI
canceling talk
_INVITE TE_INFO
request event
Device
actively DH_ALARM_TALKING_HANGU ALARM_TALKING_HANGUP_INF
hanging up P O
talk event
Radar
monitoring DH_ALARM_RADAR_HIGH_SP ALARM_RADAR_HIGH_SPEED_I
overspeed EED NFO
alarm event
183
Item Description
Description Upgrade progress callback function.
Function void (CALLBACK *fUpgradeCallBackEx)(
LLONG lLoginID,
LLONG lUpgradechannel,
INT64 nTotalSize,
INT64 nSendSize,
LDWORD dwUser
);
Parameter [out]lLoginID Return value of login interface.
Upgrade handle ID returned by
[out] lUpgradechannel
CLIENT_StartUpgradeEx2.
[out] nTotalSize Total length of upgrade file, in bytes.
Sent file length, in bytes; when it is -1, it means the
[out] nSendSize
sending of upgrade file has ended.
[out]dwUser User-defined data.
Return
None.
Value
Description Device upgrade program callback function prototype supports upgrade files above
G.
nTotalSize = 0, nSendSize = -1 means that upgrade is completed.
nTotalSize = 0, nSendSize = -2 means upgrade error.
nTotalSize = 0, nSendSize = -3 means that the user has no upgrade permission.
nTotalSize = 0, nSendSize = -4 means that the upgrade program version is too low.
nTotalSize = -1, nSendSize = XX means upgrade progress.
nTotalSize = XX, nSendSize = XX means the progress of sending upgrade files.
184
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
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.
185
6. Enable HTTPS
We suggest you to enable HTTPS, so that you visit Web service through a secure communication
channel.
7. Enable Allowlist
We suggest you to enable allowlist 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 allowlist.
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 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
186
to private networks.
It is recommended that you enable your device's firewall or blocklist and allowlist feature to
reduce the risk that your device might be attacked.
187