NetSDK - JAVA Programming Manual (Intelligent Buliding)
NetSDK - JAVA Programming Manual (Intelligent Buliding)
Programming Manual
Foreword I
V1.0.0
Foreword
General
Welcome to use NetSDK_JAVA (hereinafter referred to be "SDK") programming manual (hereinafter
referred to as "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 intelligent function modules for
Intelligent Video Surveillance System (IVSS), Network Video Recorder (NVR), IP Camera (IPC),
Intelligent Traffic Camera (ITC), people flow statistics devices and barrier.
The example codes provided in the Manual are only for demonstrating the procedure and not
assured to copy for use.
Intended Readers
Software development engineers
Product managers
Project managers who use SDK
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
Version Revision Content Release Time
V1.0.0 First release. December 2023
I
About the Manual
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.
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
General ........................................................................................................................................................................................... 1
Applicability ................................................................................................................................................................................. 2
1.2.1 Supported System ........................................................................................................................................................ 2
1.2.2 Supported Devices ....................................................................................................................................................... 2
Application Scenarios ............................................................................................................................................................... 3
2 Main Functions .............................................................................................................................................. 6
General ........................................................................................................................................................................................... 6
2.1.1 SDK Initialization ........................................................................................................................................................... 6
2.1.2 Device Login .................................................................................................................................................................10
Access Controller/All-in-one Fingerprint Machine (First-generation) ..................................................................13
2.2.1 Access Control ..............................................................................................................................................................14
2.2.2 Alarm Event ...................................................................................................................................................................16
2.2.3 Viewing Device Information ...................................................................................................................................21
2.2.4 Network Setting ..........................................................................................................................................................27
2.2.5 Device Time Setting ...................................................................................................................................................31
2.2.6 Personnel Management ...........................................................................................................................................34
2.2.7 Door Config...................................................................................................................................................................40
2.2.8 Door Time Config ........................................................................................................................................................43
2.2.9 Advanced Config of Door ........................................................................................................................................48
2.2.10 Records Query ...........................................................................................................................................................60
Access Controller/All-in-one Face Machine (Second-Generation).........................................................................67
2.3.1 Access Control ..............................................................................................................................................................67
2.3.2 Alarm Event ...................................................................................................................................................................67
2.3.3 Viewing Device Information ...................................................................................................................................68
2.3.4 Network Setting ..........................................................................................................................................................74
2.3.5 Setting the Device Time ...........................................................................................................................................75
2.3.6 Personnel Management ...........................................................................................................................................75
2.3.7 Door Config...................................................................................................................................................................97
2.3.8 Door Time Config ........................................................................................................................................................97
2.3.9 Advanced Config of Door ..................................................................................................................................... 102
2.3.10 Records Query ........................................................................................................................................................ 102
3 Interface Function ..................................................................................................................................... 103
Common Interface................................................................................................................................................................ 103
3.1.1 SDK Initialization ...................................................................................................................................................... 103
3.1.2 Device Login .............................................................................................................................................................. 104
3.1.3 Device Control .......................................................................................................................................................... 105
Access Controller/ All-in-one Fingerprint Machine (First-generation) .............................................................. 106
3.2.1 Access Control ........................................................................................................................................................... 106
3.2.2 Viewing Device Information ................................................................................................................................ 106
3.2.3 Network Setting ....................................................................................................................................................... 109
IV
3.2.4 Time Settings ............................................................................................................................................................. 112
3.2.5 Personnel Management ........................................................................................................................................ 114
3.2.6 Door Config................................................................................................................................................................ 114
3.2.7 Door Time Config ..................................................................................................................................................... 114
3.2.8 Advanced Config of Door ..................................................................................................................................... 115
3.2.9 Records Query........................................................................................................................................................... 118
Access Controller/All-in-one Face Machine (Second-Generation)...................................................................... 120
3.3.1 Access Control ........................................................................................................................................................... 120
3.3.2 Viewing Device Information ................................................................................................................................ 120
3.3.3 Network Setting ....................................................................................................................................................... 121
3.3.4 Time Settings ............................................................................................................................................................. 121
3.3.5 Personnel Management ........................................................................................................................................ 121
3.3.6 Door Config................................................................................................................................................................ 127
3.3.7 Door Time Config ..................................................................................................................................................... 127
3.3.8 Advanced Config of Door ..................................................................................................................................... 130
3.3.9 Records Query........................................................................................................................................................... 130
4 Callback Function ...................................................................................................................................... 133
Disconnection Callback fDisConnect ............................................................................................................................ 133
Reconnection Callback fHaveReConnect..................................................................................................................... 133
Callback for Real-time Monitoring Data fRealDataCallBackEx2........................................................................... 134
Audio Data Callback pfAudioDataCallBack ................................................................................................................. 134
Alarm Callback fMessCallBack .......................................................................................................................................... 135
Upgrade Progress Callback fUpgradeCallBackEx ...................................................................................................... 139
Cybersecurity Recommendations ........................................................................................... 140
V
1 Overview
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
Applicability
2
DHI-ASI7213X, DHI-ASI7213Y, DHI-ASI7213Y-D, DHI-ASI7213Y-V3
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
Application Scenarios
Typical scenario.
3
Typical scenario
Network access control for medium and small-sized intelligent building, treasury house and jail
monitoring projects.
4
Network access control
5
2 Main Functions
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
2.1.1.3 Process Description
SDK initialization
Begin
Initialize SDK
CLIENT_Init
Required
End
Optional
Process
Call CLIENT_Init to initialize SDK.
(Optional) Call CLIENT_SetAutoReconnect to set reconnection callback to allow the auto
reconnecting after disconnection within SDK.
(Optional) Call CLIENT_SetNetworkParam to set network login parameter that includes the
timeout period for device login and the number of attempts.
After using all SDK functions, call CLIENT_Cleanup to release SDK resources.
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.
7
2.1.1.4 Example Code
/**
* Realized by the login interface.
* It mainly includes initialization, login and logout.
*/
public class LoginModule {
// Login handle
public static LLong m_hLoginHandle = new LLong(0);
//Initialization
public static boolean init(NetSDKLib.fDisConnect disConnect, NetSDKLib.fHaveReConnect
haveReConnect) {
bInit = netsdk.CLIENT_Init(disConnect, null);
if(!bInit) {
System.out.println("Initialize SDK failed");
return false;
}
8
if(!bLogopen ) {
System.err.println("Failed to open NetSDK log");
}
// Set the callback interface for reconnection when it is disconnected. After the callback
function is set for disconnection, the SDK automatically reconnects the device when disconnection
occurs.
// This operation is optional, but we recommend you set it.
netsdk.CLIENT_SetAutoReconnect(haveReConnect, null);
// Set more network parameters, nWaittime for NET PARAM, nConnectTryNum members
and CLIENT SetConnectTime
// The login timeout period set for the interface is the same as the login attempts. It is
optional.
NetSDKLib.NET_PARAM netParam = new NetSDKLib.NET_PARAM();
netParam.nConnectTime = 10000; // The timeout period for trying to establish a link
during login.
netParam.nGetConnInfoTime = 3000; // Set the timeout period of the sub connection.
netsdk.CLIENT_SetNetworkParam(netParam);
return true;
}
// Clear environment
public static void cleanup() {
if(bLogopen) {
netsdk.CLIENT_LogClose();
}
if(bInit) {
netsdk.CLIENT_Cleanup();
}
}
}
9
2.1.2 Device Login
2.1.2.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.
Login
Begin
Initialize SDK
CLIENT_Init
Specific business
Log out
CLIENT_Logout
End
10
Process
Call CLIENT_Init to initialize SDK.
Call CLIENT_LoginWithHighLevelSecurity to log in to the device.
After successful login, you can realize the required function module.
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
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-3.
11
//SDK initialization. Skip SDK clearing.
// Device information
public static NetSDKLib.NET_DEVICEINFO_Ex m_stDeviceInfo = new
NetSDKLib.NET_DEVICEINFO_Ex();
//Login handle
public static LLong m_hLoginHandle = new LLong(0);
if(m_hLoginHandle.longValue() == 0) {
System.err.printf("Login Device[%s] Port[%d]Failed. %s\n", m_strIp, m_nPort,
ToolKits.getErrorCodePrint());
} else {
System.out.println("Login Success ");
}
12
}
return bRet;
}
}
Door
General Maintenance Personnel Records
Controlling
Config Config Management Query
Config
Reference
Reference
13
2.2.1 Access Control
2.2.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.
Access control
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_ControlDeviceEx to control the access.
14
Open the access: The emType value is CTRLTYPE_CTRL_ACCESS_OPEN.
Close the access: The emType value is CTRLTYPE_CTRL_ACCESS_CLOSE.
Call CLIENT_QueryDevState to query the door sensor.
Type: CTRLTYPE_DEVSTATE_DOOR_STATE
pBuf: NET_DOOR_STATUS_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.
/**
* Close the door
*/
public void closeDoor() {
final NetSDKLib.NET_CTRL_ACCESS_CLOSE close = new NetSDKLib.NET_CTRL_ACCESS_CLOSE();
close.nChannelID = 0; // The corresponding door number. - How to open all the doors.
close.write();
boolean result = netsdkApi.CLIENT_ControlDeviceEx(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_ACCESS_CLOSE,
close.getPointer(),
null,
5000);
close.read();
if (!result) {
System.err.println("close error: 0x" + Long.toHexString(netsdkApi.CLIENT_GetLastError()));
}
}
/**
* Search for the door status (open or closed)
*/
public void queryDoorStatus() {
int cmd = NetSDKLib.NET_DEVSTATE_DOOR_STATE;
NetSDKLib.NET_DOOR_STATUS_INFO doorStatus = new NetSDKLib.NET_DOOR_STATUS_INFO();
IntByReference retLenByReference = new IntByReference(0);
doorStatus.write();
boolean bRet = netsdkApi.CLIENT_QueryDevState(loginHandle,
cmd,
doorStatus.getPointer(),
doorStatus.size(),
retLenByReference,
3000);
doorStatus.read();
if (!bRet) {
System.err.println("Failed to queryDoorStatus. Error Code 0x"
+ Integer.toHexString(netsdkApi.CLIENT_GetLastError()));
15
return;
}
String stateType[] = {"Unknown ", "Door Open", "Door Closed", "Door Abnormally Open"};
System.out.println("doorStatus -> Channel: " + doorStatus.nChannel
+ " type: " + stateType[doorStatus.emStateType]);
}
2.2.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.
16
2.2.2.3 Process Description
Alarm event
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Set alarm arming config (you can ignore this if the alarm arming has been configured).
Set the alarm callback CLIENT_SetDVRMessCallBack.
Call the CLIENT_StartListenEx to subscribe to alarm information from the device.
After the alarm reporting process ends, you need to stop the interface for subscribing to
alarm CLIENT_StopListen.
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.
/**
* Subscribe to alarm information
17
*/
public void startListen() {
// Set the alarm callback function
netsdk.CLIENT_SetDVRMessCallBack(fAlarmDataCB.getCallBack(), null);
// Subscribe to alarms
boolean bRet = netsdk.CLIENT_StartListenEx(m_hLoginHandle);
if (!bRet) {
System.err.println("Failed to subscribe to alarms. LastError = 0x%x\n" + netsdk.CLIENT_GetLastError());
}
else {
System.out.println("Successfully subscribed to alarm.");
}
}
/**
* Unsubscribe from alarm information
*/
public void stopListen() {
// Stop subscribing to alarms
boolean bRet = netsdk.CLIENT_StopListen(m_hLoginHandle);
if (bRet) {
System.out.println("Unsubscribe from alarm information.");
}
}
/**
* Alarm information callback function prototype. We recommend writing it as singleton pattern.
*/
private static class fAlarmDataCB implements NetSDKLib.fMessCallBack{
private fAlarmDataCB(){}
public boolean invoke(int lCommand, NetSDKLib.LLong lLoginID, Pointer pStuEvent, int dwBufLen, String
strDeviceIP, NativeLong nDevicePort, Pointer dwUser){
switch (lCommand)
{
case NetSDKLib.NET_ALARM_TALKING_INVITE: { // The device requests the other party to
initiate an intercom event (corresponding to the structure ALARM_TALKING_INVITE_INFO)
System.out.println("The device requests the other party to initiate an intercom event");
NetSDKLib.ALARM_TALKING_INVITE_INFO msg = new
18
NetSDKLib.ALARM_TALKING_INVITE_INFO();
ToolKits.GetPointerData(pStuEvent, msg);
System.out.println("emCaller :" + msg.emCaller);
System.out.println("szCallID :" + new String(msg.szCallID).trim());
System.out.println("nLevel :" + msg.nLevel);
/**
Whether RealUTC is valid. When bRealUTC is TRUE, use RealUTC. Otherwise use the
stuTime field.
*/
int bRealUTC
= msg.bRealUTC;
System.out.println("bRealUTC :" + bRealUTC);
if(bRealUTC==1){
System.out.println("RealUTC :" + msg.RealUTC.toStringTime());
}else {
System.out.println("stuTime :" + msg.stuTime.toStringTime());
NetSDKLib.TALKINGINVITE_REMOTEDEVICEINFO stuRemoteDeviceInfo
= msg.stuRemoteDeviceInfo;
int emProtocol = stuRemoteDeviceInfo.emProtocol;
System.out.println("emProtocol:" + emProtocol);
try {
System.out.println("szIP:" + new String(stuRemoteDeviceInfo.szIP,encode));
System.out.println("nPort:" + stuRemoteDeviceInfo.nPort);
System.out.println("szPassword:" + new
String(stuRemoteDeviceInfo.szPassword,encode));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
break;
}
case NetSDKLib.NET_ALARM_TALKING_HANGUP :{ // The device hangs up the intercom event
(corresponding to structure ALARM_TALKING_HANGUP_INFO)
System.out.println("The device hangs up the intercom event");
19
ALARM_TALKING_HANGUP_INFO msg=new ALARM_TALKING_HANGUP_INFO();
ToolKits.GetPointerData(pStuEvent, msg);
try {
System.out.println("szRoomNo :" + new String(msg.szRoomNo,encode));
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
/**
Whether RealUTC is valid. When bRealUTC is TRUE, use RealUTC. Otherwise use the
stuTime field.
*/
int bRealUTC
= msg.bRealUTC;
System.out.println("bRealUTC :" + bRealUTC);
if(bRealUTC==1){
System.out.println("RealUTC :" + msg.RealUTC.toStringTime());
}else {
System.out.println("stuTime :" + msg.stuTime.toStringTime());
default:
System.out.println("Event:"+lCommand);
break;
}
return true;
}
}
20
2.2.3 Viewing Device Information
2.2.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.
21
2.2.3.1.3 Process Description
Device information viewing
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_QueryNewSystemInfo and CLIENT_ParseData to query access control
capability set.
22
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.
23
2.2.3.2 Viewing Device Version and MAC
2.2.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.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_QueryDevState to query access control device information such as serial
number, version and mac.
24
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.
/**
* Get all mobile network interfaces
*/
public void getNetAppMobileInterface() {
// Input parameters
NET_IN_NETAPP_GET_MOBILE_INTERFACE pstuIn = new NET_IN_NETAPP_GET_MOBILE_INTERFACE();
// Output parameters
NET_OUT_NETAPP_GET_MOBILE_INTERFACE pstuOut = new
NET_OUT_NETAPP_GET_MOBILE_INTERFACE();
pstuIn.write();
pstuOut.write();
boolean bRet = netsdk.CLIENT_RPC_NetApp(m_hLoginHandle,
EM_RPC_NETAPP_TYPE.EM_PRC_NETAPP_TYPE_GET_MOBILE_INTERFACE.getId(), pstuIn.getPointer(),
pstuOut.getPointer(), 3000);
if(bRet) {
pstuOut.read();
25
System.out.println("Number of valid network interfaces:"+pstuOut.nInterfaceNum);
System.out.println("Mobile network interface information ");
NETDEV_NETINTERFACE_INFO[] stuInterface = pstuOut.stuInterface;
for (int i = 0; i < pstuOut.nInterfaceNum; i++) {
int a = i+1;
System.out.println("-----No. "+a+" ----");
System.out.println("Valid or not:"+stuInterface[i].bValid);
try {
System.out.println("Network port name:"+new String(stuInterface[i].szName,encode));
System.out.println("Actual number of network modes supported by
3G:"+stuInterface[i].nSupportedModeNum);
} else {
System.err.println("getNetAppMobileInterface Failed!" + ToolKits.getErrorCode());
}
}
26
2.2.4 Network Setting
2.2.4.1 IP Settings
2.2.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.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
27
Process
Call the CLIENT_Init function to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access IP network
config.
szCommand: CFG_CMD_NETWORK.
pBuf: CFG_NETWORK_INFO.
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access IP network
config.
szCommand: CFG_CMD_NETWORK.
pBuf: CFG_NETWORK_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.
// gET
if (ToolKits.GetDevConfig(m_hLoginHandle, channel, command, network)) {
System.out.println("Host name : " + new String(network.szHostName).trim());
for (int i = 0; i < network.nInterfaceNum; i++) {
System.out.println("Network interface name : " + new
String(network.stuInterfaces[i].szName).trim());
System.out.println("IP Address : " + new String(network.stuInterfaces[i].szIP).trim());
System.out.println("Subnet mask : " + new String(network.stuInterfaces[i].szSubnetMask).trim());
System.out.println("Defult gateway : " + new
String(network.stuInterfaces[i].szDefGateway).trim());
System.out.println(
"DNS server address : " + new
String(network.stuInterfaces[i].szDnsServersArr[0].szDnsServers).trim()
+ "\n" + new
String(network.stuInterfaces[i].szDnsServersArr[1].szDnsServers).trim());
System.out.println("MAC address : " + new String(network.stuInterfaces[i].szMacAddress).trim());
}
28
} else {
System.err.println("Get NETWORK Failed!" + netsdk.CLIENT_GetLastError());
}
}
2.2.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.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
29
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Access network config.
Call CLIENT_GetNewDevConfig and CLIENT_ParseData to query the access IP
network config.
szCommand: CFG_CMD_DVRIP.
pBuf: CFG_DVRIP_INFO.
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access IP network
config.
szCommand: CFG_CMD_DVRIP.
pBuf: CFG_DVRIP_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.
// Get
if (ToolKits.GetDevConfig(m_hLoginHandle, channel, command, dvrIp)) {
System.out.println("TCP service port : " + dvrIp.nTcpPort);
System.out.println("SSL service port :" + dvrIp.nSSLPort);
System.out.println("UDP service port :" + dvrIp.nUDPPort);
System.out.println("Multicast port :" + dvrIp.nMCASTPort);
30
2.2.5 Device Time Setting
2.2.5.1.1 Introduction
Device time setting process is that, you call SDK interface to get and set the device time.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
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.
31
public void setupDeviceTime() {
SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = simpleDate.format(new java.util.Date());
if(netsdkApi.CLIENT_SetupDeviceTime(loginHandle, pDeviceTime)) {
System.out.println("Successfully synchronized the time. ");
} else {
System.out.println("Failed to synchronize the time." + ToolKits.getErrorCode());
}
}
2.2.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.
32
2.2.5.2.3 Process Description
NTP time sync
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
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.
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
33
System.out.println("szTimeZoneDesc : " + new String(ntpInfo.szTimeZoneDesc).trim());
}
// Configure
ntpInfo.bEnable = 1;
ntpInfo.emTimeZoneType = NetSDKLib.EM_CFG_TIME_ZONE_TYPE.EM_CFG_TIME_ZONE_0;
if (ToolKits.SetDevConfig(loginHandle, -1, NetSDKLib.CFG_CMD_NTP, ntpInfo)) {
System.out.println("SetNTP Succeed!");
}
}
2.2.6.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).
34
2.2.6.3 Process Description
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_ControlDevice to operate holiday information.
35
Type Description emType Param
NET_CTRL_RECORDSET_PA
NET_RECORD_
NET_DEVSTATE_DEV_REC RAM
Get user info ACCESSCTLCA
ORDSET NET_RECORDSET_ACCESS_
RD
CTL_CARD
Call the CLIENT_ControlDevice to update user information.
Note
Card number: Personnel card number.
Card type: When the card is set as duress card, if the person bound to this card opens the door
with card password, unlock password or by fingerprint, the duress alarm will be triggered.
Card password: Suitable for card + password mode.
Period: Select the serial number corresponding to the configured time period. If there is no
serial number, set it in "2.2.8.1 Period Config."
Unlock password: After setting this password, you can directly enter the password to open the
door without swiping card.
Valid number of times: Only guest users can set this field.
Whether it is first card: Select as needed. For according to the actual situation. For the
configuration method of the first card, see "2.2.9.1 Unlock at Designated Intervals and First Card
Unlock."
/**
* Insert the password
*/
public void insertPassword() {
// Unlock password
final String openDoorPassword = "888887";
36
System.arraycopy(userId.getBytes(), 0, accessInsert.szUserID,
0, userId.getBytes().length);
System.arraycopy(openDoorPassword.getBytes(), 0, accessInsert.szDoorOpenPwd,
0, openDoorPassword.getBytes().length);
/// The following fields can be fixed. The values must be provided because of the current restrictions.
accessInsert.nDoorNum = 2; // Number of doors. It indicates double door controller.
accessInsert.sznDoors[0] = 0; // It indicates having the permission for the first door.
accessInsert.sznDoors[1] = 1; // It indicates having the permission for the second door.
accessInsert.nTimeSectionNum = 2; // It corresponds to the number of doors.
accessInsert.nTimeSectionIndex[0] = 255; // It indicates that the setting of the first door is valid for the
whole day.
accessInsert.nTimeSectionIndex[1] = 255; // It indicates that the setting of the second door is valid for the
whole day.
accessInsert.write();
insert.write();
boolean success = netSdk.CLIENT_ControlDevice(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_INSERT, insert.getPointer(), 5000);
insert.read();
accessInsert.read();
if(!success) {
System.err.println("insert password failed. 0x" + Long.toHexString(netSdk.CLIENT_GetLastError()));
return;
}
/**
* Update the password
*/
public void updatePassword() {
37
/// Password number. This parameter is required. Otherwise, password update does not take effect.
final String userId = String.valueOf(accessUpdate.nRecNo);
System.arraycopy(userId.getBytes(), 0, accessUpdate.szUserID,
0, userId.getBytes().length);
/// The following fields can be fixed. The values must be provided because of the current restrictions.
accessUpdate.nDoorNum = 2; // Number of doors. It indicates double door controller.
accessUpdate.sznDoors[0] = 0; // It indicates having the permission for the first door.
accessUpdate.sznDoors[1] = 1; // It indicates having the permission for the second door.
accessUpdate.nTimeSectionNum = 2; // It corresponds to the number of doors.
accessUpdate.nTimeSectionIndex[0] = 255; // It indicates that the setting of the first door is valid for the
whole day.
accessUpdate.nTimeSectionIndex[1] = 255; // It indicates that the setting of the second door is valid for
the whole day.
accessUpdate.write();
update.write();
boolean result = netSdk.CLIENT_ControlDevice(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_UPDATE, update.getPointer(), 5000);
update.read();
accessUpdate.read();
if (!result) {
System.err.println("update password failed. 0x" + Long.toHexString(netSdk.CLIENT_GetLastError()));
}else {
System.out.println("update password success");
}
}
/**
* Delete all
*/
public void alldeleteOperate() {
int type = NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_CLEAR;
NetSDKLib.NET_CTRL_RECORDSET_PARAM param = new NetSDKLib.NET_CTRL_RECORDSET_PARAM();
if (flg) {
param.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICREDLIST;
} else {
38
param.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_TRAFFICBLACKLIST;
}
param.write();
boolean zRet = netsdk.CLIENT_ControlDevice(m_hLoginHandle, type, param.getPointer(), 5000);
if (zRet) {
System.out.println("Successfully deleted all. ");
} else {
System.err.println("Failed to delete all " + String.format("0x%x", netsdk.CLIENT_GetLastError()));
}
}
public static boolean queryRecordState(SdkStructure condition) {
condition.write();
record.write();
if (!netsdkApi.CLIENT_QueryDevState(loginHandle, NetSDKLib.NET_DEVSTATE_DEV_RECORDSET,
record.getPointer(), record.size(), intRetLen, 3000)) {
return false;
}
record.read();
condition.read();
output(condition);
return true;
}
private static void output(SdkStructure record) { // The specific output is defined at the upper level.
printRecord((NET_RECORDSET_ACCESS_CTL_CARDREC)record);
39
printRecord((NET_RECORDSET_ACCESS_CTL_CARD)record);
}
}
type = EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLCARD;
type = EM_NET_RECORD_TYPE.NET_RECORD_ACCESSQRCODE;
type = EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLPWD;
type = EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLCARDREC_EX;
return type;
}
}
2.2.7.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.
40
2.2.7.2 Interunlockface Overview
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
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.
41
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.2.8.1 Period Config."
42
channel number:" + access.stuFirstEnterInfo.nTimeIndex);
}
// Configure
boolean bRet = ToolKits.SetDevConfig(loginHandle, nChn, szCommand, access);
if (bRet) {
System.out.println("Set Succeed!");
}
}
2.2.8.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.
43
2.2.8.1.3 Process Description
Period config
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
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.
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.
44
// Get
if(ToolKits.GetDevConfig(loginHandle, nChannel, strCmd, msg)) {
System.out.println("Enable:" + msg.bEnable);
try {
System.out.println("Custom name:" + new String(msg.szName, "GBK").trim());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Configure
if(ToolKits.SetDevConfig(loginHandle, nChannel, strCmd, msg)) {
System.out.println("Set AccessTimeSchedule Succeed!");
} else {
System.err.println("Set AccessTimeSchedule Failed!" + ToolKits.getErrorCode());
}
} else {
System.err.println("Get AccessTimeSchedule Failed!" + ToolKits.getErrorCode());
}
}
2.2.8.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.
45
2.2.8.2.3 Process Description
Always open and always closed period config
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
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 always open
and always closed period info, and remote verification period.
szCommand: CFG_CMD_ACCESS_EVENT.
pBuf: CFG_ACCESS_EVENT_INFO.
46
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.2.8.1 Period Config."
// Get
if(ToolKits.GetDevConfig(loginHandle, nChannel, strCmd, msg)) {
System.out.println("Enable:" + msg.bEnable);
try {
System.out.println("Custom name:" + new String(msg.szName, "GBK").trim());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// Configure
if(ToolKits.SetDevConfig(loginHandle, nChannel, strCmd, msg)) {
System.out.println("Set AccessTimeSchedule Succeed!");
} else {
System.err.println("Set AccessTimeSchedule Failed!" + ToolKits.getErrorCode());
}
} else {
System.err.println("Get AccessTimeSchedule Failed!" + ToolKits.getErrorCode());
47
}
}
2.2.9.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.
48
2.2.9.1.3 Process Description
Unlock at designated intervals and first card unlock
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
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.
49
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
User ID of first card refers to card number.
To implement first card unlock function, add the person of the user ID to device and select the
card as first card; otherwise, the first card unlock function cannot be used.
// Configure
// access.emReadCardState = EM_CFG_CARD_STATE.EM_CFG_CARD_STATE_SWIPE; // Swipe card on
the access control device
access.emReadCardState = EM_CFG_CARD_STATE.EM_CFG_CARD_STATE_COLLECTION; // Collect the
card information by the access control device
// access.emReadCardState = EM_CFG_CARD_STATE.EM_CFG_CARD_STATE_UNKNOWN; // Exit card
reading
50
}
}
2.2.9.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.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
51
Process
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
combination unlock by multiple persons
szCommand: CFG_CMD_OPEN_DOOR_GROUP.
pBuf: CFG_OPEN_DOOR_GROUP_INFO.
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access info of
combination unlock by multiple persons.
szCommand: CFG_CMD_OPEN_DOOR_GROUP.
pBuf: CFG_OPEN_DOOR_GROUP_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.
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.
Set the unlock method for the personnel group: You can select from card or fingerprint.
//Configure
msg.stuGroupInfo[0].stuGroupDetail[0].emMethod=1;
msg.stuGroupInfo[0].stuGroupDetail[1].emMethod=1;
System.arraycopy("123".getBytes(), 0, msg.stuGroupInfo[0].stuGroupDetail[0].szUserID, 0,
"123".getBytes().length);
52
System.arraycopy("234".getBytes(), 0, msg.stuGroupInfo[0].stuGroupDetail[1].szUserID, 0,
"234".getBytes().length);
for(int i=0;i<msg.stuGroupInfo.length;i++){
msg.stuGroupInfo[i].nUserCount=2;
msg.stuGroupInfo[i].nGroupNum=2;
msg.stuGroupInfo[i].bGroupDetailEx=true;
}
if(!ToolKits.SetDevConfig(loginHandle, nChannel, szCommand, msg)){
System.err.println("Set more open door Failed!");
return false;
}
System.out.println("Set more open door Succeed!");
return true;
}
2.2.9.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.
53
2.2.9.3.3 Process Description
Inter-door lock config
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
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 inter-door
lock info.
szCommand: CFG_CMD_ACCESS_GENERAL.
pBuf: CFG_ACCESS_GENERAL_INFO.
Call CLIENT_SetNewDevConfig and CLIENT_PacketData to set the access inter-door lock
info.
szCommand: CFG_CMD_ACCESS_GENERAL.
pBuf: CFG_ACCESS_GENERAL_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.
Note
One device supports only one inter-door lock scheme.
54
modifying other irrelevant configuration items.
CFG_ACCESS_GENERAL_INFO inParam = new CFG_ACCESS_GENERAL_INFO();
inParam =
(CFG_ACCESS_GENERAL_INFO)
configModule.getNewConfig(loginHandler, CFG_CMD_ACCESS_GENERAL, inParam, 0, 3000);
System.out.println("Before configuration, enable inter-lock:" + inParam.stuABLockInfo.bEnable + ",
configure to:");
for (int i = 0; i < inParam.stuABLockInfo.nDoors; i++) {
for (int j = 0; j < inParam.stuABLockInfo.stuDoors[i].nDoor; j++) {
// Inter-lock information
System.out.println(i + "," + j + ",door:" + inParam.stuABLockInfo.stuDoors[i].anDoor[j]);
}
}
// Modify inter-lock configuration
inParam.abABLockInfo = 1;
inParam.stuABLockInfo.bEnable = !inParam.stuABLockInfo.bEnable;
inParam.stuABLockInfo.nDoors = 1;
int doors = 2;
inParam.stuABLockInfo.stuDoors[0].nDoor = doors;
inParam.stuABLockInfo.stuDoors[0].anDoor[0] = 1;
inParam.stuABLockInfo.stuDoors[0].anDoor[1] = 2;
inParam.stuABLockInfo.stuDoors[1].nDoor = doors;
inParam.stuABLockInfo.stuDoors[1].anDoor[0] = 0;
inParam.stuABLockInfo.stuDoors[1].anDoor[1] = 3;
boolean result =
configModule.setNewConfig(loginHandler, CFG_CMD_ACCESS_GENERAL, inParam, 0, 3000);
// If the configuration was sent successfully, get the configuration again and print
if (result) {
inParam =
(CFG_ACCESS_GENERAL_INFO)
configModule.getNewConfig(loginHandler, CFG_CMD_ACCESS_GENERAL, inParam, 3, 3000);
System.out.println("After the modification, enable inter-lock:" + inParam.stuABLockInfo.bEnable +
",configure to:");
}
}
2.2.9.4.1 Introduction
For unlock password, you can call SDK interface to add, delete, query and modify the unlock
password of the access control device.
55
Interface Description
CLIENT_ControlDevice Device control.
Begin
Initialize SDK
CLIENT_Init
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_ControlDevice to operate unlock password information.
56
Type Description emType Param
NET_CTRL_RECORDSET_PA
NET_DEVSTATE_DE Get unlock NET_RECORD_ACCE RAM
V_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.
/**
* Insert the password
*/
public void insertPassword() {
// Unlock password
final String openDoorPassword = "888887";
System.arraycopy(userId.getBytes(), 0, accessInsert.szUserID,
0, userId.getBytes().length);
System.arraycopy(openDoorPassword.getBytes(), 0, accessInsert.szDoorOpenPwd,
0, openDoorPassword.getBytes().length);
/// The following fields can be fixed. The values must be provided because of the current restrictions.
57
accessInsert.nDoorNum = 2; // Number of doors. It indicates double door controller.
accessInsert.sznDoors[0] = 0; // It indicates having the permission for the first door.
accessInsert.sznDoors[1] = 1; // It indicates having the permission for the second door.
accessInsert.nTimeSectionNum = 2; // It corresponds to the number of doors.
accessInsert.nTimeSectionIndex[0] = 255; // It indicates that the setting of the first door is valid for the
whole day.
accessInsert.nTimeSectionIndex[1] = 255; // It indicates that the setting of the second door is valid for the
whole day.
accessInsert.write();
insert.write();
boolean success = netSdk.CLIENT_ControlDevice(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_INSERT, insert.getPointer(), 5000);
insert.read();
accessInsert.read();
if(!success) {
System.err.println("insert password failed. 0x" + Long.toHexString(netSdk.CLIENT_GetLastError()));
return;
}
/**
* Update the password
*/
public void updatePassword() {
/// Password number. This parameter is required. Otherwise, password update does not take effect.
final String userId = String.valueOf(accessUpdate.nRecNo);
System.arraycopy(userId.getBytes(), 0, accessUpdate.szUserID,
0, userId.getBytes().length);
58
final String newPassord = "333333";
System.arraycopy(newPassord.getBytes(), 0,
accessUpdate.szDoorOpenPwd, 0, newPassord.getBytes().length);
/// The following fields can be fixed. The values must be provided because of the current restrictions.
accessUpdate.nDoorNum = 2; // Number of doors. It indicates double door controller.
accessUpdate.sznDoors[0] = 0; // It indicates having the permission for the first door.
accessUpdate.sznDoors[1] = 1; // It indicates having the permission for the second door.
accessUpdate.nTimeSectionNum = 2; // It corresponds to the number of doors.
accessUpdate.nTimeSectionIndex[0] = 255; // It indicates that the setting of the first door is valid for the
whole day.
accessUpdate.nTimeSectionIndex[1] = 255; // It indicates that the setting of the second door is valid for
the whole day.
accessUpdate.write();
update.write();
boolean result = netSdk.CLIENT_ControlDevice(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_UPDATE, update.getPointer(), 5000);
update.read();
accessUpdate.read();
if (!result) {
System.err.println("update password failed. 0x" + Long.toHexString(netSdk.CLIENT_GetLastError()));
}else {
System.out.println("update password success");
}
}
/**
* Delete the password
*/
public void deletePassword() {
NetSDKLib.NET_CTRL_RECORDSET_PARAM remove = new NetSDKLib.NET_CTRL_RECORDSET_PARAM();
remove.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLPWD;
remove.pBuf = new IntByReference(passwordRecordNo).getPointer();
remove.write();
boolean result = netSdk.CLIENT_ControlDevice(loginHandle,
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_REMOVE, remove.getPointer(), 5000);
remove.read();
if(!result){
59
System.err.println(" remove pawssword failed. 0x" +
Long.toHexString(netSdk.CLIENT_GetLastError()));
}else {
System.out.println("remove password success");
}
}
2.2.10.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.
60
2.2.10.1.3 Process Description
Record query
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_FindRecord to get the query handle.
emType unlock record: NET_RECORD_ACCESSCTLCARDREC.
Call the CLIENT_QueryRecordCount to find the count of records.
Cal the CLIENT_FindNextRecord to get the list of records.
After query, call CLIENT_FindRecordClose to close the query handle.
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.
61
NetSDKLib.FIND_RECORD_ACCESSCTLCARDREC_CONDITION_EX recordCondition = new
NetSDKLib.FIND_RECORD_ACCESSCTLCARDREC_CONDITION_EX();
recordCondition.bCardNoEnable = 1; //Enable searching by card number
String cardNo = "FB0DCF65";
System.arraycopy(cardNo.getBytes(), 0, recordCondition.szCardNo, 0, cardNo.getBytes().length);
recordCondition.write();
if (netsdkApi.CLIENT_FindRecord(loginHandle, stuFindInParam, stuFindOutParam, 5000)) {
recordCondition.read();
System.out.println("FindRecord Succeed" + "\n" + "FindHandle :" + stuFindOutParam.lFindeHandle);
62
while (true) { // Cycle search
if (netsdkApi.CLIENT_FindNextRecord(stuFindNextInParam, stuFindNextOutParam, 5000)) {
ToolKits.GetPointerDataToStructArr(stuFindNextOutParam.pRecordList, pstRecord);
2.2.10.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.
63
2.2.10.2.2 Interface Overview
Table 2-34 Description of device log interfaces
Interface Description
CLIENT_QueryDevLogCount Query the count of device logs.
CLIENT_StartQueryLog Start querying logs.
CLIENT_QueryNextLog Get logs.
CLIENT_StopQueryLog Stop querying logs.
Begin
Initialize SDK
CLIENT_Init
Get logs
CLIENT_QueryNextLog
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
64
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call the CLIENT_QueryDevLogCount to set the number of queried logs.
Call the CLIENT_StartQueryLog to start querying log information.
pInParam: NET_IN_START_QUERYLOG.
pOutParam: NET_OUT_START_QUERYLOG.
Call the CLIENT_QueryNextLog to get log information.
pInParam: NET_IN_QUERYNEXTLOG.
pOutParam: NET_OUT_QUERYNEXTLOG.
Call the CLIENT_StopQueryLog to stop querying logs.
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.
int num = 1024;// If the number of logs in a certain period is too large, search for logs in different batches.
Do not select a large value to avoid memory issues.
// Initialize
NET_LOG_INFO[] info = new NET_LOG_INFO[num];
for (int i = 0; i < info.length; i++) {
info[i] = new NET_LOG_INFO();
}
65
// Number of logs to be searched for.
stIn1.nGetCount = num;
stIn1.write();
66
}
}
Reference
Reference
67
2.3.3 Viewing Device Information
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.
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetDevCaps and assign NET_ACCESSCONTROL_CAPS to nType, to get the
access control.
After completing this process, call the CLIENT_Logout to log out of the device.
68
After using all SDK functions, call the CLIENT_Cleanup to release SDK resources.
// Input parameters
NET_IN_AC_CAPS stIn = new NET_IN_AC_CAPS();
// Output parameters
NET_OUT_AC_CAPS stOut = new NET_OUT_AC_CAPS();
stIn.write();
stOut.write();
System.out.println("nChannels:"+stuACCaps.nChannels);
/**
Whether the access control alarm logs can be recorded in the recordset
*/
int bSupAccessControlAlarmRecord
= stuACCaps.bSupAccessControlAlarmRecord;
System.out.println("bSupAccessControlAlarmRecord:"+bSupAccessControlAlarmRecord);
/**
AccessControlCustomPassword Storage method of record passwords, 0: Plaintext. 0 by default;
1: MD5
*/
69
int nCustomPasswordEncryption
= stuACCaps.nCustomPasswordEncryption;
System.out.println("nCustomPasswordEncryption:"+nCustomPasswordEncryption);
/**
Supports information function or not. 0 : Unknown. It is the default value. 1: Do not support. 2:
Support
*/
int nSupportFingerPrint
= stuACCaps.nSupportFingerPrint;
System.out.println("nSupportFingerPrint:"+nSupportFingerPrint);
/**
User operation capability set
*/
System.out.println("User operation capability set ");
/**
Maximum number of users
*/
int nMaxUsers
= stuUserCaps.nMaxUsers;
System.out.println("nMaxUsers:"+nMaxUsers);
/**
The maximum amount of information that can be recorded per user
*/
int nMaxFingerPrintsPerUser
= stuUserCaps.nMaxFingerPrintsPerUser;
System.out.println("nMaxFingerPrintsPerUser:"+nMaxFingerPrintsPerUser);
/**
The maximum number of cards that can be recorded per user
*/
int nMaxCardsPerUser
= stuUserCaps.nMaxCardsPerUser;
70
System.out.println("nMaxCardsPerUser:"+nMaxCardsPerUser);
/**
Card operation capability set
*/
NET_ACCESS_CARD_CAPS stuCardCaps
= stOut.stuCardCaps;
System.out.println("Card operation capability set ");
/**
Maximum number of items that can be sent at a time
*/
int nMaxInsertRate1
= stuCardCaps.nMaxInsertRate;
System.out.println("nMaxInsertRate1:"+nMaxInsertRate1);
/**
Maximum number of cards
*/
int nMaxCards
= stuCardCaps.nMaxCards;
System.out.println("nMaxCards:"+nMaxCards);
/**
Information operation capability set
*/
NET_ACCESS_FINGERPRINT_CAPS stuFingerprintCaps
= stOut.stuFingerprintCaps;
/**
Maximum number of items that can be sent at a time
*/
int nMaxInsertRate2
= stuFingerprintCaps.nMaxInsertRate;
System.out.println("nMaxInsertRate2:"+nMaxInsertRate2);
/**
71
The maximum number of bytes of a single message
*/
int nMaxFingerprintSize = stuFingerprintCaps.nMaxFingerprintSize;
System.out.println("nMaxFingerprintSize:"+nMaxFingerprintSize);
/**
Maximum amount of information
*/
int nMaxFingerprint = stuFingerprintCaps.nMaxFingerprint;
System.out.println("nMaxFingerprint:"+nMaxFingerprint);
/**
Target operation capability set
*/
NET_ACCESS_FACE_CAPS stuFaceCaps
= stOut.stuFaceCaps;
/**
Target storage limit
*/
int nMaxFace
= stuFaceCaps.nMaxFace;
System.out.println("nMaxFace:"+nMaxFace);
/**
Target recognition type. 0: White light. 1: IR
*/
int nRecognitionType
= stuFaceCaps.nRecognitionType;
System.out.println("nRecognitionType:"+nRecognitionType);
72
/**
Target recognition algorithm.
*/
int nRecognitionAlgorithm
= stuFaceCaps.nRecognitionAlgorithm;
System.out.println("nRecognitionAlgorithm:"+nRecognitionAlgorithm);
/**
Eyes related capability set
*/
NET_ACCESS_IRIS_CAPS stuIrisCaps
= stOut.stuIrisCaps;
/**
Maximum number of items that can be inserted at a time.
*/
int nMaxInsertRate4
= stuIrisCaps.nMaxInsertRate;
System.out.println("nMaxInsertRate4:"+nMaxInsertRate4);
/**
Minimum size of eye information image in KB
*/
int nMinIrisPhotoSize
= stuIrisCaps.nMinIrisPhotoSize;
System.out.println("nMinIrisPhotoSize:"+nMinIrisPhotoSize);
/**
Minimum size of eye information image in KB
*/
int nMaxIrisPhotoSize
= stuIrisCaps.nMaxIrisPhotoSize;
System.out.println("nMaxIrisPhotoSize:"+nMaxIrisPhotoSize);
/**
The supported maximum number of groups for each user
*/
int nMaxIrisGroup
73
= stuIrisCaps.nMaxIrisGroup;
System.out.println("nMaxIrisGroup:"+nMaxIrisGroup);
/**
Eye recognition algorithm provider identifier.
*/
int nRecognitionAlgorithmVender
= stuIrisCaps.nRecognitionAlgorithmVender;
System.out.println("nRecognitionAlgorithmVender:"+nRecognitionAlgorithmVender);
/**
Version number of the algorithm (model). If the version number has more than one digit, it
indicates a version every 8 bits in ascending order from Major to Minor. For example, 1.5.2 indicates
0x00010502
*/
int nRecognitionVersion
= stuIrisCaps.nRecognitionVersion;
System.out.println("nRecognitionVersion:"+nRecognitionVersion);
/**
Eye information storage limit
*/
int nMaxIrisesCount
= stuIrisCaps.nMaxIrisesCount;
System.out.println("nMaxIrisesCount:"+nMaxIrisesCount);
} else {
System.err.println("GetDevCaps Failed!" + ToolKits.getErrorCode());
}
}
74
2.3.5 Setting the Device Time
See "2.2.5 Device Time Setting"
2.3.6.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).
75
2.3.6.1.3 Process Description
User info management
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_StartFindUserInfo to start finding the user information.
Call CLIENT_DoFindUserInfo to obtain the user information.
Call CLIENT_StopFindUserInfo to stop finding the user information.
Call CLIENT_OperateAccessUserService to add, delete, and clear the user information
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.
76
*/
public void operateAccessUserService(){
/**
* User information array
*/
// Initialize the user information array first
NetSDKLib.NET_ACCESS_USER_INFO[] users = new NetSDKLib.NET_ACCESS_USER_INFO[nMaxNum];
floors.clear(size);
info.pstuFloorsEx2=floors;
NET_ACCESS_USER_INFO_EX pstuUserInfoEx=
new NET_ACCESS_USER_INFO_EX();
Pointer pstuUserInfo
= new Memory(pstuUserInfoEx.size());
pstuUserInfo.clear(pstuUserInfoEx.size());
info.pstuUserInfoEx=pstuUserInfo;
users[i]=info;
77
failCodes[i] = new NetSDKLib.FAIL_CODE();
}
/**
* Input parameters NET_IN_ACCESS_USER_SERVICE_GET
*/
NetSDKLib.NET_IN_ACCESS_USER_SERVICE_GET stIn = new
NetSDKLib.NET_IN_ACCESS_USER_SERVICE_GET();
// Number of user IDs
stIn.nUserNum = userIDs.length;
// User ID
for (int i = 0; i < userIDs.length; i++) {
System.arraycopy(userIDs[i].getBytes(), 0,
stIn.szUserIDs[i].szUserID, 0, userIDs[i].getBytes().length);
}
/**
* Output parameters NET_OUT_ACCESS_USER_SERVICE_GET
*/
NetSDKLib.NET_OUT_ACCESS_USER_SERVICE_GET stOut = new
NetSDKLib.NET_OUT_ACCESS_USER_SERVICE_GET();
stOut.nMaxRetNum = nMaxNum;
ToolKits.SetStructArrToPointerData(users, stOut.pUserInfo);
ToolKits.SetStructArrToPointerData(failCodes, stOut.pFailCode);
stIn.write();
stOut.write();
if (netSdk.CLIENT_OperateAccessUserService(loginHandle, emtype,
stIn.getPointer(), stOut.getPointer(), 3000)) {
// Convert pointers into specific information
ToolKits.GetPointerDataToStructArr(stOut.pUserInfo, users);
ToolKits.GetPointerDataToStructArr(stOut.pFailCode, failCodes);
78
/**
* Print the specific information
*/
for (int i = 0; i < nMaxNum; i++) {
try {
System.out.println("[" + i + "]Username:"
+ new String(users[i].szName, "GBK").trim());
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
System.out.println("[" + i + "]Password:"
+ new String(users[i].szPsw).trim());
System.out.println("[" + i + "]User search result: "
+ failCodes[i].nFailCode);
}
} else {
System.err.println("Failed to search for the users, " + ToolKits.getErrorCode());
}
}
2.3.6.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).
79
2.3.6.2.3 Process Description
Management of card information
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_StartFindCardInfo to start finding the card information.
Call CLIENT_DoFindCardInfo to obtain the card information.
Call CLIENT_StopFindCardInfo to stop finding the card information.
Call CLIENT_OperateAccessCardService to add, update, delete, and clear the card
information.
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.
80
2.3.6.2.4 Example Code
/**
* Search for all card information
*/
public void queryAllCard() {
// String userId = "1011";
// ////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Input parameters
*/
NET_IN_CARDINFO_START_FIND stInFind = new NET_IN_CARDINFO_START_FIND();
// User ID. When it is left blank or not specified, all cards of all users will be searched for.
// System.arraycopy(userId.getBytes(), 0, stInFind.szUserID, 0,
// userId.getBytes().length);
/**
* Output parameters
*/
NET_OUT_CARDINFO_START_FIND stOutFind = new NET_OUT_CARDINFO_START_FIND();
if (lFindHandle.longValue() == 0) {
return;
}
if (stOutFind.nTotalCount <= 0) {
return;
}
// ////////////////////////////////////////////////////////////////////////////////////////////////
// Start number
int startNo = 0;
while (true) {
81
/**
* Input parameter
*/
NET_IN_CARDINFO_DO_FIND stInDoFind = new NET_IN_CARDINFO_DO_FIND();
// Start number
stInDoFind.nStartNo = startNo;
/**
* Output parameters
*/
NET_OUT_CARDINFO_DO_FIND stOutDoFind = new NET_OUT_CARDINFO_DO_FIND();
stOutDoFind.nMaxNum = nFindCount;
ToolKits.SetStructArrToPointerData(cardInfos, stOutDoFind.pstuInfo);
if (netsdkApi.CLIENT_DoFindCardInfo(lFindHandle, stInDoFind,
stOutDoFind, TIME_OUT)) {
if (stOutDoFind.nRetNum <= 0) {
return;
}
ToolKits.GetPointerDataToStructArr(stOutDoFind.pstuInfo,
cardInfos);
82
// ////////////////////////////////////////////////////////////////////////////////////////////////
// Stop the search
if (lFindHandle.longValue() != 0) {
netsdkApi.CLIENT_StopFindCardInfo(lFindHandle);
lFindHandle.setValue(0);
}
}
2.3.6.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).
83
2.3.6.3.3 Process Description
Management of face information
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_OperateAccessFaceService to add, obtain, update, and delete the face
information.
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.
84
// ////////////////////// Initialize the face information of each user ////////////////////////
NetSDKLib.NET_ACCESS_FACE_INFO[] faces = new NetSDKLib.NET_ACCESS_FACE_INFO[nMaxCount];
for (int i = 0; i < faces.length; i++) {
faces[i] = new NetSDKLib.NET_ACCESS_FACE_INFO();
// Request the memory according to the actual number of face images of each user. Up to 5 images
are supported for each user.
// Initialize
NetSDKLib.FAIL_CODE[] failCodes = new NetSDKLib.FAIL_CODE[nMaxCount];
for (int i = 0; i < failCodes.length; i++) {
failCodes[i] = new NetSDKLib.FAIL_CODE();
}
/**
* Input parameters
*/
NetSDKLib.NET_IN_ACCESS_FACE_SERVICE_GET stIn = new
NetSDKLib.NET_IN_ACCESS_FACE_SERVICE_GET();
stIn.nUserNum = nMaxCount;
for (int i = 0; i < nMaxCount; i++) {
System.arraycopy(userIDs[i].getBytes(), 0,
stIn.szUserIDs[i].szUserID, 0, userIDs[i].getBytes().length);
}
/**
* Output parameters NET_OUT_ACCESS_FACE_SERVICE_GET
*/
85
stOut.nMaxRetNum = nMaxCount;
ToolKits.SetStructArrToPointerData(faces, stOut.pFaceInfo);
ToolKits.SetStructArrToPointerData(failCodes, stOut.pFailCode);
stIn.write();
stOut.write();
if (netSdk.CLIENT_OperateAccessFaceService(loginHandle, emtype,
stIn.getPointer(), stOut.getPointer(), 3000)) {
// Convert the obtained result information to a concrete structure
ToolKits.GetPointerDataToStructArr(stOut.pFaceInfo, faces);
ToolKits.GetPointerDataToStructArr(stOut.pFailCode, failCodes);
for(int n=0;n<nFaceData;n++){
NetSDKLib.FACEDATA szFaceData = szFaceDatas[i];
86
stIn.read();
stOut.read();
}
2.3.6.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
87
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_OperateAccessFingerprintService to add, obtain, update, delete, and clear
the fingerprint information.
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.
88
+
"lNH8nRUGD8niPUp/xI6f28/czRPMPMfH2QvIvQSNEcyNB/zIyRSM/8zXzUvMzYfNFQ/IzUh9CNSf1X//xL0U6Moh
GebIWlDNWhRZi/xIVgkVP+Hhn"
+
"9f9RAUWhRi8eafk+QXSytDwtFjGCklxSMTK8pNZYFILYkrkkYmS30qhUEcKqtNswRwKFkq8QQSHHkRBtESNRkfh
dEbK9ovslIVKMoYYdMtGdgSM0"
+ "ERE1cnIOQQTYoLJkIQJ0gJsNFFTugetWEhME5zESEnLokpsbFFS+kYVfVLGbs"
+ "E4qQTaYgcEOIRPEkfQRJGDhkWsOEmXWoLdpRKKNoA5tRENBoM"
+
"5GEFEkosISZBLUkKlXIHbdkGRRAQHRoAwLDw4NFwgJChglKxEoKiYaGQcSBDIbIy0pNBQWFVVs";
/**
* Add the information data
*/
// User ID
System.arraycopy(userId.getBytes(), 0, fingerprint.szUserID, 0,
userId.getBytes().length);
// Information data
// Request the memory first
fingerprint.szFingerPrintInfo = new Memory(fingerPrintBuffer.length);
fingerprint.szFingerPrintInfo.clear(fingerPrintBuffer.length);
fingerprint.szFingerPrintInfo.write(0, fingerPrintBuffer, 0,
fingerPrintBuffer.length);
// //////////////////////////////////////////////////////////////////////////////////////////
89
// Initialize
FAIL_CODE failCode = new FAIL_CODE();
/**
* Input parameters
*/
NET_IN_ACCESS_FINGERPRINT_SERVICE_INSERT stIn = new
NET_IN_ACCESS_FINGERPRINT_SERVICE_INSERT();
stIn.nFpNum = 1;
stIn.pFingerPrintInfo = fingerprint.getPointer();
/**
* Output parameters
*/
NET_OUT_ACCESS_FINGERPRINT_SERVICE_INSERT stOut = new
NET_OUT_ACCESS_FINGERPRINT_SERVICE_INSERT();
stOut.nMaxRetNum = 1;
stOut.pFailCode = failCode.getPointer();
stIn.write();
stOut.write();
fingerprint.write();
failCode.write();
if (netsdkApi.CLIENT_OperateAccessFingerprintService(loginHandle,
emtype, stIn.getPointer(), stOut.getPointer(), TIME_OUT)) {
fingerprint.read();
90
failCode.read();
stIn.read();
stOut.read();
}
/**
* Modify the information by user ID (one user ID corresponds to one piece of information)
*/
public void modifyFingerprint() {
String userId = "1011";
91
/**
* Add the information data
*/
// User ID
System.arraycopy(userId.getBytes(), 0, fingerprint.szUserID, 0,
userId.getBytes().length);
// Information data
// Request the memory first
fingerprint.szFingerPrintInfo = new Memory(fingerPrintBuffer.length);
fingerprint.szFingerPrintInfo.clear(fingerPrintBuffer.length);
fingerprint.szFingerPrintInfo.write(0, fingerPrintBuffer, 0,
fingerPrintBuffer.length);
// //////////////////////////////////////////////////////////////////////////////////////////
// //////////////////////////////////////////////////////////////////////////////////////////
// Initialize
FAIL_CODE failCode = new FAIL_CODE();
/**
* Input parameters
*/
92
NET_IN_ACCESS_FINGERPRINT_SERVICE_UPDATE stIn = new
NET_IN_ACCESS_FINGERPRINT_SERVICE_UPDATE();
stIn.nFpNum = 1;
stIn.pFingerPrintInfo = fingerprint.getPointer();
/**
* Output parameters
*/
NET_OUT_ACCESS_FINGERPRINT_SERVICE_UPDATE stOut = new
NET_OUT_ACCESS_FINGERPRINT_SERVICE_UPDATE();
stOut.nMaxRetNum = 1;
stOut.pFailCode = failCode.getPointer();
stIn.write();
stOut.write();
fingerprint.write();
failCode.write();
if (netsdkApi.CLIENT_OperateAccessFingerprintService(loginHandle,
emtype, stIn.getPointer(), stOut.getPointer(), TIME_OUT)) {
fingerprint.read();
failCode.read();
stIn.read();
stOut.read();
}
/**
* Get a single piece of information by user ID (one user ID corresponds to one piece of information)
*/
public void getFingerprint() {
String userId = "1011";
93
// Type of information operations
// Get the information data
int emtype =
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE.NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_GET;
/**
* Input parameters
*/
NET_IN_ACCESS_FINGERPRINT_SERVICE_GET stIn = new NET_IN_ACCESS_FINGERPRINT_SERVICE_GET();
// User ID
System.arraycopy(userId.getBytes(), 0, stIn.szUserID, 0,
userId.getBytes().length);
/**
* Output parameters
*/
NET_OUT_ACCESS_FINGERPRINT_SERVICE_GET stOut = new
NET_OUT_ACCESS_FINGERPRINT_SERVICE_GET();
// The maximum length of the cache that receives information data
stOut.nMaxFingerDataLength = 1024;
stIn.write();
stOut.write();
if (netsdkApi.CLIENT_OperateAccessFingerprintService(loginHandle,
emtype, stIn.getPointer(), stOut.getPointer(), TIME_OUT)) {
// Get the specific information at this point.
stIn.read();
stOut.read();
94
System.err.println("Failed to get the information, " + getErrorCode());
}
}
/**
* Delete the information by user ID
*/
public void deleteFingerprint() {
String userID = "1011";
// Initialize
FAIL_CODE failCode = new FAIL_CODE();
/**
* Input parameterts
*/
NET_IN_ACCESS_FINGERPRINT_SERVICE_REMOVE stIn = new
NET_IN_ACCESS_FINGERPRINT_SERVICE_REMOVE();
stIn.nUserNum = 1;
System.arraycopy(userID.getBytes(), 0, stIn.szUserIDs[0].szUserID, 0,
userID.getBytes().length);
/**
* Output parameters
*/
NET_OUT_ACCESS_FINGERPRINT_SERVICE_REMOVE stOut = new
NET_OUT_ACCESS_FINGERPRINT_SERVICE_REMOVE();
stOut.nMaxRetNum = 1;
stOut.pFailCode = failCode.getPointer();
stIn.write();
stOut.write();
if (netsdkApi.CLIENT_OperateAccessFingerprintService(loginHandle,
emtype, stIn.getPointer(), stOut.getPointer(), TIME_OUT)) {
95
// Print the specific information
System.out.println("Result of deleting the information: " + failCode.nFailCode);
} else {
System.err.println("Failed to delete the information, " + getErrorCode());
}
stIn.read();
stOut.read();
}
/**
* Clear all information
*/
public void clearFingerprint() {
// Type of information operations
// Clear the information data
int emtype =
NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE.NET_EM_ACCESS_CTL_FINGERPRINT_SERVICE_CLEAR;
/**
* Input parameters
*/
NET_IN_ACCESS_FINGERPRINT_SERVICE_CLEAR stIn = new
NET_IN_ACCESS_FINGERPRINT_SERVICE_CLEAR();
/**
* Output parameters
*/
NET_OUT_ACCESS_FINGERPRINT_SERVICE_CLEAR stOut = new
NET_OUT_ACCESS_FINGERPRINT_SERVICE_CLEAR();
stIn.write();
stOut.write();
if (netsdkApi.CLIENT_OperateAccessFingerprintService(loginHandle,
emtype, stIn.getPointer(), stOut.getPointer(), TIME_OUT)) {
System.out.println("Successfully cleared the information.");
} else {
System.err.println("Failed to clear the information, " + getErrorCode());
96
}
stIn.read();
stOut.read();
}
2.3.8.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.
97
2.3.8.3.3 Process Description
Holiday group
Begin
Initialize SDK
CLIENT_Init
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetConfig to query the holiday group config info for the access control
device.
98
2.3.8.3.4 Example Code
/**
* Send holiday group configuration
*
* @return Whether the configuration was sent successfully
*/
public boolean setSpecialDayGroup() {
NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO config = new
NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO();
config.bGroupEnable = true;
config.nSpeciaday = 2;
// byte[]Use System.arraycopy() to assign the values
System.arraycopy("test".getBytes(), 0, config.szGroupName, 0, "test".getBytes().length);
System.arraycopy(
"test1".getBytes(), 0, config.stuSpeciaday[0].szDayName, 0, "test1".getBytes().length);
config.stuSpeciaday[0].stuStartTime = new NET_TIME(2020, 10, 19, 0, 0, 0);
config.stuSpeciaday[0].stuEndTime = new NET_TIME(2020, 10, 21, 23, 59, 59);
config.stuSpeciaday[1].szDayName = "test2".getBytes();
System.arraycopy(
"test2".getBytes(), 0, config.stuSpeciaday[1].szDayName, 0, "test2".getBytes().length);
config.stuSpeciaday[1].stuStartTime = new NET_TIME(2020, 10, 22, 10, 10, 10);
config.stuSpeciaday[1].stuEndTime = new NET_TIME(2020, 10, 23, 12, 0, 0);
return configModule.setConfig(
loginHandler, NET_EM_CFG_OPERATE_TYPE.NET_EM_CFG_ACCESSCTL_SPECIALDAY_GROUP, config, 0);
}
99
2.3.8.4 Holiday Plan
2.3.8.4.1 Introduction
Configure the holiday plan of the device through SDK, including the holiday plan name, enabling,
period, and valid door channel.
Start
Log out
CLIENT_Logout
End
Process
Call the CLIENT_Init to initialize SDK.
Call the CLIENT_LoginWithHighLevelSecurity to log in to the device.
Call CLIENT_GetConfig to query the holiday plan config info for the access control device.
100
Call CLIENT_SetConfig to set the the holiday plan config info for the access control device.
101
0);
if (config != null) {
System.out.println(config.toString());
}
}
102
3 Interface Function
Common Interface
103
Item Description
Set reconnection callback interface. If the callback is set as NULL, the device will
Note
not be reconnected automatically.
104
Error code Corresponding meanings
7 Out of resources, the system is busy.
8 Sub-connection failed.
9 Primary connection failed.
10 Exceeded the maximum number of user connections.
11 Lack of avnetsdk or avnetsdk dependent library.
USB flash drive is not inserted into device, or the USB flash disk information
12
error.
13 The client IP address is not authorized with login.
105
emType Description pInBuf pOutBuf
CTRLTYPE_CTRL_ARMED_ Arming and
CTRL_ARM_DISARM_PARAM NULL
EX Disarming
CTRLTYPE_CTRL_SET_BYP Bypass setting
NET_CTRL_SET_BYPASS NULL
ASS function
CTRLTYPE_CTRL_ACCESS_ Access
NET_CTRL_ACCESS_OPEN NULL
OPEN control--open
CTRLTYPE_CTRL_ACCESS_ Access
NET_CTRL_ACCESS_CLOSE NULL
CLOSE control--close
CLIENT_QueryNewSystemInfo
106
Item Description
[out] szOutBuffer Received protocol buffer.
[in] dwOutBufferSize Total number of bytes received (in bytes).
[out] error Error number.
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.
107
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
108
3.2.2.4 Querying Device Status CLIENT_QueryDevState
3.2.3.1 IP Settings
109
3.2.3.1.2 Querying Config Information CLIENT_GetNewDevConfig
Table 3-18 Description of querying config information
Item Description
Description Get config in string format.
public boolean CLIENT_GetNewDevConfig(
LLong lLoginID,
String szCommand,
int nChannelID,
byte[] szOutBuffer,
Function
int dwOutBufferSize,
IntByReference error,
int waiitime,
Pointer pReserved
);
Login handle, return value of
[in] lLoginID
CLIENT_LoginWithHighLevelSecurity.
Command parameter. See "3.2.2.2 Parsing the
[in] szCommand
Queried Config Information CLIENT_ParseData."
Parameter [in] nChannelID Channel.
[out]szOutBuffer Output buffer.
[in] dwOutBufferSize Output buffer size.
[out] error Error Code.
[in] waittime Timeout period for waiting.
Success: TRUE,
Return Value
Failure: FALSE
Get config in string format, and information contained in each string is parsed
Note
by CLIENT_ParseData.
Table 3-19 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
110
Item Description
public boolean CLIENT_SetNewDevConfig(
LLong lLoginID,
String szCommand,
int nChannelID,
Function byte[] szInBuffer,
int dwInBufferSize,
IntByReference error,
IntByReference restart, int waittime
);
Login handle, return value of
[in] lLoginID
CLIENT_LoginWithHighLevelSecurity.
Command parameter information. See "3.2.2.2
[in] szCommand Parsing the Queried Config Information
CLIENT_ParseData."
[in] nChannelID Channel.
Parameter
[in] szInBuffer Output buffer.
[in] dwInBufferSize Output buffer size.
[out] error Error Code.
Whether the device is required to restart after the
[out] restart
config is set. 1 means required; 0 means not required.
[in] waittime Timeout period for waiting.
Success: TRUE,
Return Value
Failure: FALSE
Set config in string format, and information contained in each string is packed
Note
by CLIENT_PacketData.
Table 3-21 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
111
Item Description
Command parameter. See "3.2.2.2 Parsing the
[in] szCommand Queried Config Information CLIENT_ParseData" for
details.
Input buffer. For structure types, see "3.2.2.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.
112
Item Description
[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.
113
3.2.5 Personnel Management
114
3.2.7.2 Always Open and Always Closed Period Config
115
3.2.8.2.3 Setting Config Information CLIENT_SetNewDevConfig
See "3.2.3.1.3 Setting Config Information CLIENT_SetNewDevConfig."
116
Item Description
Note None.
117
3.2.8.4.4 Ending Querying Logs CLIENT_StopQueryLog
Table 3-27 Description of ending querying logs
Item Description
Description Stop querying device logs.
Function public boolean CLIENT_StopQueryLog(LLong lLogID);
Parameter [in] lLogID Query log handle.
Success: TRUE,
Return Value
Failure: FALSE
Description None.
118
Item Description
public boolean CLIENT_FindRecord(
LLong lLoginID,
NET_IN_FIND_RECORD_PARAM pInParam,
Function
NET_OUT_FIND_RECORD_PARAM pOutParam,
int waittime
);
[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.
119
pOutParam Structure Value Assignment Description
NET_RECORDSET_ACCESS_
pRecordList Query door unlook records.
CTL_CARDREC
120
Item Description
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-35 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
121
Item Description
Success: TRUE
Return value
Failure: FALSE
Description None.
Table 3-37 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
122
Item Description
Finding the personnel information interface (input
[in] pstIn
parameter).
Finding the personnel information interface (output
[out] pstOut
parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
123
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
124
Item Description
Success: TRUE
Return value
Failure: FALSE
Description None.
125
emtype Description pInBuf pOutBuf
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
126
emtype Description pInBuf pOutBuf
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
127
3.3.7.1.4 Packing into String Format CLIENT_PacketData
See "3.2.3.1.4 Packing into String Format CLIENT_PacketData."
128
Item Description
Success: TRUE
Return value
Failure: FALSE
Description None.
129
3.3.7.4 Holiday plan
For details, see "3.3.7.3 Holiday group."
130
Item Description
[in] waittime Timeout period in query.
Success: TRUE
Return Value
Failure: FALSE
Before calling this interface, you should call CLIENT_FindRecord first to open
Note
the query handle.
131
Item Description
Input parameter for querying records. The pInParam >
[in] pInParam lFindeHandle is pOutParam > lFindeHandle of
CLIENT_FindRecord.
Parameter
[out]
Output parameter for querying records. Return to recods info.
pOutParam
[in] waittime Timeout period for waiting.
1: Successfully get one record.
Return
0: All records are got.
Value
-1: Parameter error.
Note None.
132
4 Callback Function
133
Callback for Real-time Monitoring Data
fRealDataCallBackEx2
Table 4-3 Description of callback function for real-time monitoring data
Item Description
Description Callback function for real-time monitoring data.
public interface fRealDataCallBackEx2 extends SDKCallback{
void invoke(
LLong lRealHandle,
int dwDataType,
Function Pointer pBuffer,
int dwBufSize,
LLong param,
Pointer 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.
134
Item Description
public interface pfAudioDataCallBack extends StdCallCallback {
public void invoke(
LLong lTalkHandle,
Function
Pointer pDataBuf, int dwBufSize,
byte byAudioFlag, Pointer dwUser);
}
[out]lTalkHandle Return value of CLIENT_StartTalkEx.
[out]pDataBuf Audio data block address.
[out]dwBufSize Length of audio data block, in bytes.
Parameter 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.
135
Item Description
values.
136
Alarm Alarm type
lCommand pBuf
business name
Analog
quantity NET_ALARM_ANALOG_PULSE ALARM_ANALOGPULSE_INFO
alarm event
Alarm
NET_ALARM_PROFILE_ALARM ALARM_PROFILE_ALARM_TRAN
transmission
_TRANSMIT SMIT_INFO
event
Wireless
device low NET_ALARM_WIRELESSDEV_L ALARM_WIRELESSDEV_LOWPO
battery alarm OWPOWER WER_INFO
event
Protection
zone arming
and NET_ALARM_DEFENCE_ARMM ALARM_DEFENCE_ARMMODEC
disarming ODE_CHANGE HANGE_INFO
status change
event
Sub-system
arming and
NET_ALARM_SUBSYSTEM_AR ALARM_SUBSYSTEM_ARMMOD
disarming
MMODE_CHANGE ECHANGE_INFO
status change
event
Detector
NET_ALARM_SENSOR_ABNOR ALARM_SENSOR_ABNORMAL_I
abnormality
MAL NFO
alarm
Patient
NET_ALARM_PATIENTDETECTI ALARM_PATIENTDETECTION_IN
activity status
ON FO
alarm event
Access control NET_ALARM_ACCESS_CTL_EV ALARM_ACCESS_CTL_EVENT_I
event ENT NFO
Details of
access control NET_ALARM_ACCESS_CTL_NO ALARM_ACCESS_CTL_NOT_CLO
unlocking T_CLOSE SE_INFO
event
Details of
NET_ALARM_ACCESS_CTL_BR ALARM_ACCESS_CTL_BREAK_I
intrusion
EAK_IN N_INFO
Access event
Control Details of
NET_ALARM_ACCESS_CTL_RE ALARM_ACCESS_CTL_REPEAT_E
repeated
PEAT_ENTER NTER_INFO
entry event
Malicious
NET_ALARM_ACCESS_CTL_MA ALARM_ACCESS_CTL_MALICIO
unlocking
LICIOUS US
event
Details of
NET_ALARM_ACCESS_CTL_DU ALARM_ACCESS_CTL_DURESS_I
forced card
RESS NFO
swiping event
137
Alarm Alarm type
lCommand pBuf
business name
Combination
unlocking by NET_ALARM_OPENDOORGRO ALARM_OPEN_DOOR_GROUP_I
multiple UP NFO
persons event
Dismantleme
NET_ALARM_CHASSISINTRUD ALARM_CHASSISINTRUDED_INF
nt prevention
ED O
event
Local alarm
NET_ALARM_ALARM_EX2 ALARM_ALARM_INFO_EX2
event
Access control NET_ALARM_ACCESS_CTL_ST ALARM_ACCESS_CTL_STATUS_I
status event ATUS NFO
NET_ALARM_ACCESS_CTL_ST ALARM_ACCESS_CTL_STATUS_I
Bolt alarm
ATUS NFO
Fingerprint
ALARM_CAPTURE_FINGER_PRI
acquisition NET_ALARM_FINGER_PRINT
NT_INFO
event
No response
to the call in
NET_ALARM_CALL_NO_ANSW NET_ALARM_CALL_NO_ANSWE
direct
ERED RED_INFO
connection
event
Mobile phone
NET_ALARM_TELEPHONE_CHE ALARM_TELEPHONE_CHECK_IN
number
CK FO
report event
VTS status NET_ALARM_VTSTATE_UPDAT ALARM_VTSTATE_UPDATE_INF
report E O
VTO object
NET_ALARM_ACCESSIDENTIFY NET_ALARM_ACCESSIDENTIFY
recognition
Device
Video inviting
Intercom another NET_ALARM_TALKING_INVITE ALARM_TALKING_INVITE_INFO
device to start
talk event
Device
NET_ALARM_TALKING_IGNOR ALARM_TALKING_IGNORE_INVI
canceling talk
E_INVITE TE_INFO
request event
Device
actively NET_ALARM_TALKING_HANG ALARM_TALKING_HANGUP_INF
hanging up UP O
talk event
Radar
monitoring NET_ALARM_RADAR_HIGH_SP ALARM_RADAR_HIGH_SPEED_I
overspeed EED NFO
alarm event
138
Upgrade Progress Callback fUpgradeCallBackEx
Table 4-7 Description of upgrade progress callback function
Item Description
Description Upgrade progress callback function.
Function public interface fUpgradeCallBackEx extends SDKCallback {
public void invoke(
LLong lLoginID,
LLong lUpgradechannel,
int nTotalSize,
int nSendSize,
Pointer dwUserData);
}
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.
139
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.
140
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.
141
Establish the 802.1x access authentication system to reduce the risk of unauthorized access
to private networks.
It is recommended that you enable your device's firewall or blocklist and allowlist feature to
reduce the risk that your device might be attacked.
142