NetSDK - C# Programming Manual (Intelligent Buliding)
NetSDK - C# Programming Manual (Intelligent Buliding)
Programming Manual
Foreword I
V1.0.1
Foreword
General
Welcome to use NetSDK intelligent building (hereinafter referred to as "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 general function modules for
intelligent buildings. For more function modules and data structures, refer to NetSDK Development
Manual.
The sample code provided in the manual are only for demonstrating the procedure and not assured
to copy for use.
Intended Readers
Safety Instructions
The following categorized signal words with defined meaning might appear in the manual.
Signal Words Meaning
TIPS Provides methods to help you solve a problem or save you time.
Revision History
I
Version Revision Content Release Time
V1.0.0 First release. August 2020
The manual is for reference only. If there is inconsistency between the manual and the actual
product, the actual product shall prevail.
We are not liable for any loss caused by the operations that do not comply with the manual.
The manual would be updated according to the latest laws and regulations of related
jurisdictions. For detailed information, refer to the paper manual, CD-ROM, QR code or our
official website. If there is inconsistency between paper manual and the electronic version, the
electronic version shall prevail.
All the designs and software are subject to change without prior written notice. The product
updates might cause some differences between the actual product and the manual. Please
contact the customer service for the latest program and supplementary documentation.
There still might be deviation in technical data, functions and operations description, or errors
in print. If there is any doubt or dispute, we reserve the right of final explanation.
Upgrade the reader software or try other mainstream reader software if the manual (in PDF
format) cannot be opened.
All trademarks, registered trademarks and the company names in the manual are the properties
of their respective owners.
Please visit our website, contact the supplier or customer service if there is any problem
occurring when using the device.
If there is any uncertainty or controversy, we reserve the right of final explanation.
II
Glossary
This chapter provides the definitions to some terms appearing in the manual to help you understand
the function of each module.
Term Description
The alarm host has two scenario modes: "Outside" and "Home". Each of the
Scene mode
modes has relevant configurations which get effective after you selected.
When the scenarios switch to "Outside" or "Home", the planned protection zone
Outside/Home
will be armed and the others become bypass zones.
A kind of configuration to the intrusion alarm detecting circuit which cannot
Separation
report alarms till being reset manually.
Analog alarm The device has multiple alarm input channels to receive the external detection
channel (analog signals. When the channels are analog type, they are called analog alarm
protection zone) channels which can connect to analog detector and collect analog data.
A type of access card. When the user is forced to open the access, the duress card
Duress card
will be recognized by the system, and then the alarm will be generated.
III
Table of Contents
Foreword ............................................................................................................................................................ I
Glossary ........................................................................................................................................................... III
1 Overview ........................................................................................................................................................ 1
1.1 General ........................................................................................................................................................................................... 1
1.2 Applicability ................................................................................................................................................................................. 2
1.2.1 Supported System ........................................................................................................................................................ 2
1.2.2 Supported Devices ....................................................................................................................................................... 2
1.3 Application Scenarios ............................................................................................................................................................... 2
2 Main Functions .............................................................................................................................................. 5
2.1 General ........................................................................................................................................................................................... 5
2.1.1 SDK Initialization ........................................................................................................................................................... 5
2.1.2 Device Initialization...................................................................................................................................................... 8
2.1.3 Device Login .................................................................................................................................................................10
2.1.4 Realtime Monitor ........................................................................................................................................................12
2.1.5 Voice Talk ........................................................................................................................................................................18
2.1.6 Alarm Host .....................................................................................................................................................................23
2.2 Access Controller/All-in-one Fingerprint Machine (First-generation) ..................................................................26
2.2.1 Access Control ..............................................................................................................................................................27
2.2.2 Alarm Event ...................................................................................................................................................................30
2.2.3 Viewing Device Information ...................................................................................................................................39
2.2.4 Network Setting ..........................................................................................................................................................47
2.2.5 Device Time Setting ...................................................................................................................................................52
2.2.6 Maintenance Config ..................................................................................................................................................59
2.2.7 Personnel Management ...........................................................................................................................................69
2.2.8 Door Config...................................................................................................................................................................87
2.2.9 Door Time Config ........................................................................................................................................................90
2.2.10 Advanced Config of Door ................................................................................................................................... 103
2.2.11 Records Query ........................................................................................................................................................ 123
2.3 Access Controller/All-in-one Face Machine (Second-Generation) ..................................................................... 132
2.3.1 Access Control ........................................................................................................................................................... 132
2.3.2 Alarm Event ................................................................................................................................................................ 132
2.3.3 Viewing Device Information ................................................................................................................................ 132
2.3.4 Network Setting ....................................................................................................................................................... 134
2.3.5 Setting the Device Time ........................................................................................................................................ 134
2.3.6 Maintenance Config ............................................................................................................................................... 134
2.3.7 Personnel Management ........................................................................................................................................ 134
2.3.8 Door Config................................................................................................................................................................ 154
2.3.9 Door Time Config ..................................................................................................................................................... 155
2.3.10 Advanced Config of Door ................................................................................................................................... 159
2.3.11 Records Query ........................................................................................................................................................ 159
3 Interface Function ..................................................................................................................................... 164
3.1 Common Interface................................................................................................................................................................ 164
3.1.1 SDK Initialization ...................................................................................................................................................... 164
3.1.2 Device Initialization................................................................................................................................................. 165
IV
3.1.3 Device Login .............................................................................................................................................................. 166
3.1.4 Realtime Monitor ..................................................................................................................................................... 167
3.1.5 Device Control .......................................................................................................................................................... 170
3.1.6 Alarm Listening......................................................................................................................................................... 171
3.1.7 Getting Device Status............................................................................................................................................. 172
3.1.8 Voice Talk ..................................................................................................................................................................... 172
3.2 Access Controller/ All-in-one Fingerprint Machine (First-generation) .............................................................. 175
3.2.1 Access Control ........................................................................................................................................................... 175
3.2.2 Alarm Event ................................................................................................................................................................ 175
3.2.3 Viewing Device Information ................................................................................................................................ 176
3.2.4 Network Setting ....................................................................................................................................................... 178
3.2.5 Time Settings ............................................................................................................................................................. 179
3.2.6 Maintenance Config ............................................................................................................................................... 180
3.2.7 Personnel Management ........................................................................................................................................ 185
3.2.8 Door Config................................................................................................................................................................ 185
3.2.9 Door Time Config ..................................................................................................................................................... 185
3.2.10 Advanced Config of Door ................................................................................................................................... 186
3.2.11 Records Query ........................................................................................................................................................ 189
3.3 Access Controller/All-in-one Face Machine (Second-Generation) ..................................................................... 191
3.3.1 Access Control ........................................................................................................................................................... 191
3.3.2 Alarm Event ................................................................................................................................................................ 191
3.3.3 Viewing Device Information ................................................................................................................................ 191
3.3.4 Network Setting ....................................................................................................................................................... 192
3.3.5 Time Settings ............................................................................................................................................................. 192
3.3.6 Maintenance Config ............................................................................................................................................... 192
3.3.7 Personnel Management ........................................................................................................................................ 192
3.3.8 Door Config................................................................................................................................................................ 201
3.3.9 Door Time Config ..................................................................................................................................................... 201
3.3.10 Advanced Config of Door ................................................................................................................................... 203
3.3.11 Records Query ........................................................................................................................................................ 203
4 Callback Function ...................................................................................................................................... 205
4.1 Device Querying Callback .................................................................................................................................................. 205
4.2 Device Querying Callback .................................................................................................................................................. 205
4.3 Disconnection Callback ...................................................................................................................................................... 205
4.4 Reconnection Callback ....................................................................................................................................................... 206
4.5 Callback for Real-time Monitoring Data ....................................................................................................................... 206
4.6 Audio Data Callback ............................................................................................................................................................. 207
4.7 Alarm Callback ....................................................................................................................................................................... 207
4.8 Upgrade Progress Callback................................................................................................................................................ 211
Appendix 1 Cybersecurity Recommendations ........................................................................................... 213
V
1 Overview
1.1 General
This manual is about reference information of NetSDKCS, the packaging project of C# NetSDK library.
The main content is main functions, interface functions, and callback functions.
Main functions include: Common functions, alarm host, access control and other functions.
For files included by C# NetSDK library, see Table 1-1 and Table 1-2.
1
1.2 Applicability
2
Figure 1-1 Typical scenario
Network access control for medium and small-sized intelligent building, treasury house and jail
monitoring projects.
3
Figure 1-3 Network access control
4
2 Main Functions
2.1 General
2.1.1.1 Introduction
Initialization is the first step of SDK to conduct all the function modules. It does not have the
surveillance function but can set some parameters that affect the SDK overall functions.
Initialization occupies some memory.
Only the first initialization is valid within one process.
After using this function, call NETSDK cleaning interfaces to release resources.
5
2.1.1.3 Process Description
Start
SDK initialization
NETClient.Init
End
aandatory
Optional
Process
Note
You need to call the interfaces NETClient.Init and NETClient.Cleanup in pairs. It supports
single-thread multiple calling in pairs, but it is recommended to call the pair for only one time
overall.
6
Initialization: Internally calling the interface NETClient.Init multiple times is only for internal
count without repeating applying resources.
Cleaning up: The interface NETClient.Cleanup clears all the opened processes, such as login,
real-time monitoring, and alarm subscription.
Reconnection: NetSDK can set the reconnection function for the situations such as network
disconnection and power disconnection. NetSDK will keep logging in to the device until login
succeeded. Only the real-time monitoring, playback, intelligent event subscription, and alarm
function will be resumed after the reconnection.
// statement static call back entrusting (for common entrusting, releasing before callback might
occur)
private static fDisConnectCallBack m_DisConnectCallBack; //disconnection callback
private static fHaveReConnectCallBack m_ReConnectCallBack; /reconnection callback
// realize entrusting
m_DisConnectCallBack = new fDisConnectCallBack(DisConnectCallBack);
m_ReConnectCallBack = new fHaveReConnectCallBack(ReConnectCallBack);
7
2.1.2 Device Initialization
2.1.2.1 Introduction
The device is uninitialized by default. Please initialize the device before use.
Uninitialized devices cannot be logged in.
A password will be set up for the default admin account during initialization.
You can reset the password if you forgot it.
8
2.1.2.3 Process Description
Start
Initialize device
NETClient.InitDevAccount
Stop searching
NETClient.StopSearchDevices
End
Process
Note
Because the interface is working in multicast, the host PC and device must be in the same multicast
group.
9
2.1.2.4 Sample Code
// call the NETClient.StartQueryDevicesEx interface to get device infoin the callback function
//device initialization
NET_IN_INIT_DEVICE_ACCOUNT sInitAccountIn = {sizeof(sInitAccountIn)};
NET_OUT_INIT_DEVICE_ACCOUNT sInitAccountOut = {sizeof(sInitAccountOut)};
sInitAccountIn.byPwdResetWay = 1; //1 is mobile phone number resetting method, 2 is email address resetting
method
strncpy(sInitAccountIn.szMac, szMac, sizeof(sInitAccountIn.szMac) - 1);// configure mac
strncpy(sInitAccountIn.szUserName, szUserName, sizeof(sInitAccountIn.szUserName) - 1);// configure
username
strncpy(sInitAccountIn.szPwd, szPwd, sizeof(sInitAccountIn.szPwd) - 1);//configure password
strncpy(sInitAccountIn.szCellPhone, szRig, sizeof(sInitAccountIn.szCellPhone) - 1);// because the value of
byPwdResetWay is 1, szCellPhone field needs to be configured; if the value of byPwdResetWay is 2,
sInitAccountIn.szMail needs to be configured.
NETClient.InitDevAccount(&sInitAccountIn, &sInitAccountOut, 5000, NULL);
2.1.3.1 Introduction
Device login, also called user authentication, is the precondition of all the other function modules.
You can obtain a unique login ID upon logging in to the device and should use the login ID when
using other NetSDK interfaces. The login ID becomes invalid once logged out of the device.
10
2.1.3.3 Process Description
Start
Initialize SDK
NetClient.Init
Specific business
Log out
NETCLient.Logout
End
Process
Note
Login handle: When the login is successful, the returned value of the interface is not 0 (even the
handle is smaller than 0, the login is also successful). One device can log in multiple times with
different handle at each login. If there is not special function module, it is suggested to log in
only one time. The login handle can be repeatedly used on other function modules.
Duplicate handle: The login handle might be the same as the existing handle, and it is normal.
For example, log in to device A, you will get loginIDA; log out loginIDA, and then log in to the
device again, you will get LoginIDA again. However, in the life cycle of the handle, no duplicate
handle will appear.
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
11
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.
After the device is offline, the login ID of the device will be invalid, and the login ID will be valid
again if the device is logged in again.
2.1.4.1 Introduction
Real-time monitoring obtains the real-time stream from the storage device or front-end device,
which is an important part of the surveillance system.
SDK can get the main stream and sub stream from the device once logged in.
Supports passing in the window handle for SDK to directly decode and play the stream
(Windows system only).
Supports calling the real-time stream to you for independent treatment.
Supports saving the real-time record to the specific file through saving the callback stream or
calling the SDK interface.
12
2.1.4.2 Interface Overview
You can realize the real-time monitoring through SDK integrated play library or your play library.
13
Figure 2-4 SDK decoding play
Start
Initialize SDK
NETClient.Init
Stop hptional
Process
14
Note
NetSDK decoding play only supports Windows system. You need to call the decoding after
getting the stream for display in other systems.
Multi-thread calling: Multi-thread calling is not supported for the functions within the same
login session; however, multi-thread calling can deal with the functions of different login
sessions although such calling is not recommended.
Timeout: The application for monitoring resources in the interface should make some
agreements with the device before requesting the monitoring data. There are some timeout
settings (see "NET_PARAM structure"), and the field related to monitoring is nGetConnInfoTime.
If there is timeout due to the reasons such as bad network connection, you can modify the value
of nGetConnInfoTime bigger. The sample code is as follows. Call it for only one time after
having called the NETClient.Init.
NET_PARAM param = new NET_PARAM()
{
nGetConnInfoTime = 5000,// get sub connection info timeout duration (ms)
};
NETClient.SetNetworkParam(param);
Failed to repeat opening: Because some devices do not support opening the monitoring
function on the same channel for multiple times in one login, these devices might fail from the
second opening. In this case, you can try the following:
Close the opened channel first. For example, if you already opened the main stream video
on the channel 1 and still want to open the sub stream video on the same channel, you can
close the main stream video first and then open the sub stream video.
Log in twice to obtain two login handles to deal with the main stream and sub stream
respectively.
Calling succeeded but no image: SDK decoding needs to use dhplay.dll. It is suggested to check
if dhplay.dll and its auxiliary library are missing under the running directory. See Table 1-2 and
Table 1-1.
15
Figure 2-5 Third-party decoding play
Start
Initialize SDK
NETClient.Init
Log out
NETCLient.Logout
End
Process
Note
16
When using PlaySDK for decoding, there is a default channel cache size (the
PLAY_OpenStream interface in PlaySDK) for decoding. If the stream resolution value is big,
it is recommended to change the parameter value (for example changed to 3*1024*1024).
NetSDK callbacks can only move into the next process after returning from you. Do not do
time consuming operations; otherwise the performance could be affected.
// Disable monitoring
bool ret = NETClient.StopRealPlay(m_RealPlayID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
m_RealPlayID = IntPtr.Zero;
17
// to get stream data from the device, you need to call PlatSDK interfaces. For details, see NetSDK
monitoring demo source code
// for example, save data, send data, transform to YUV and more.
EM_REALDATA_FLAG type = (EM_REALDATA_FLAG)dwDataType;
switch (type)
{
case EM_REALDATA_FLAG.RAW_DATA:
//processing operations
break;
}
}
// close monitoring
bool ret = NETClient.StopRealPlay(m_RealPlayID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
m_RealPlayID = IntPtr.Zero;
2.1.5.1 Introduction
Voice talk realizes the voice interaction between the local platform and the environment where
front-end devices are located, to meet the need of voice communication between the local platform
and the site environment.
This chapter introduces how to use NetSDK to realize the voice talk with devices.
18
2.1.5.3 Process Description
When NetSDK collects the audio data from the local audio card or receives the audio data from the
front-end devices, it will call the audio data callback. You can call the NetSDK interface in the callback
to send the local audio data collected to the front-end devices, or call the NetSDK interface to
decode and play back the audio data received from the front-end devices.
The process is valid only in Windows system.
Figure 2-6 Second-generation voice talk
Start
Initialize SDK
NETClient.Init
byAudioFlag
Start recording on the PC value
NETClient.RecordStart
End
Process
19
Step 2 After successful initialization, call NETClient.LoginWithHighLevelSecurity to log in to the
device.
Step 3 Call NETClient.SetDeviceMode to get support for the second-generation or
third-generation voice talk. The value of emType should be
EM_USEDEV_MODE.TALK_ENCODE_TYPE
Step 4 Call NETClient.SetDeviceMode to set voice talk parameters. The value of emType should be
EM_USEDEV_MODE.TALK_SPEAK_PARAM.
Step 5 Call NETClient.StartTalk to set callback and start voice talk. In the callback, call
NETClient.AudioDec to decode the audio data sent from the decoding device, and call
NETClient.TalkSendData to send the audio data from the PC to the device.
Step 6 Call NETClient.RecordStart to start recording on the PC. After this interface is called, the
voice talk callback set by NETClient.StartTalk will receive the local audio data.
Step 7 After using the voice talk function, call NETClient.RecordStop to stop recording.
Step 8 Call NETClient.StopTalk to stop voice talk.
Step 9 Call NETClient.Logout to log out of the device.
Step 10 After using NetSDK, call NETClient.Cleanup to release NetSDK resources.
Note
Voice encoding format: The example uses the common PCM format. SDK supports getting the
voice encoding format supported by the device. The sample code is detailed in the SDK package
on the website. If the default PCM can meet the requirement, it is not necessary to get the voice
encoding format supported by the device.
No sound at the device: The audio data needs to be collected from devices such as microphone.
It is recommended to check if the microphone or other equivalent device is plugged in and if
the interface NETClient.RecordStart succeeded in returning.
20
speak.nSpeakerChannel = 0;
talkSpeakPointer = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_SPEAK_PARAM)));
Marshal.StructureToPtr(speak, talkSpeakPointer, true);
NETClient.SetDeviceMode(m_LoginID, EM_USEDEV_MODE.TALK_SPEAK_PARAM, talkSpeakPointer);
21
{
NETClient.StopTalk(m_TalkID);
m_TalkID = IntPtr.Zero;
MessageBox.Show(this, NETClient.GetLastError());
return;
}
DHDEV_TALKDECODE_INFO curTalkMode;
curTalkMode.encodeType = DH_TALK_PCM;
curTalkMode.nAudioBit = 16;
curTalkMode.dwSampleRate = 8000;
curTalkMode.nPacketPeriod = 25;
NETClient.SetDeviceMode(lLoginHandle, DH_TALK_ENCODE_TYPE, &curTalkMode);
// start voice talk
lTalkHandle = NETClient.StartTalk(lLoginHandle, AudioDataCallBack, (DWORD)NULL);
if(0 != lTalkHandle)
{
BOOL bSuccess = NETClient.RecordStart(lLoginHandle);
}
22
}
}
else if(1 == byAudioFlag)
{
// send voice data from devices to NetSDK to decode and play the voice data
NETClient.AudioDec(pDataBuf, dwBufSize);
}
}
2.1.6.1 Introduction
Alarm sending is realized by: Logging in to the device through NetSDK and then subscribing alarm
from devices. Once the device detected alarm events and sent the events to NetSDK, the alarm info
can be received through alarm callback function.
23
2.1.6.3 Process Description
Start
Initialize SDK
NetClient.Init
Log out
NETClient.Logout
End
Process
24
Note
If alarms cannot be sent anymore, you need to check if the device is disconnected from the
network. If the device is disconnected from the network, the alarm subscription will be resumed
automatically.
Please asynchronously process alarm info in the alarm callback function fMessCallBack. Do not
do too many operations in the callback or the callback might be blocked.
25
break;
}
return true;
}
// subscribe alarm
bool ret = NETClient.StartListen(m_LoginID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
// stop subscribing alarm
bool ret = NETClient.StopListen(m_LoginID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
Door
General Maintenance Personnel Records
Controlling
Config Config Management Query
Config
Reference
Reference
26
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.
Begin
Initialize SDK
CLIENT_Init
Log out
NETCLient.Logout
End
Process
27
Open the access: The emType value is EM_CtrlType.ACCESS_OPEN.
Close the access: The emType value is EM_CtrlType.ACCESS_CLOSE.
Step 4 Call NETClient.QueryDevState to query the door sensor.
Type: EM_DEVICE_STATE_DOOR _STATE
pBuf: NET_DOOR_STATUS_INFO.
Step 5 After completing this process, call NETClient.Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient.Cleanup to release SDK resources.
28
#endregion
29
{
MessageBox.Show(NETClient.GetLastError());
return;
}
info = (NET_DOOR_STATUS_INFO)objInfo;
switch (info.emStateType)
{
case EM_NET_DOOR_STATUS_TYPE.BREAK:
MessageBox.Show("Door abnormal unlock");
break;
case EM_NET_DOOR_STATUS_TYPE.CLOSE:
MessageBox.Show("Door closed");
break;
case EM_NET_DOOR_STATUS_TYPE.OPEN:
MessageBox.Show("Door opened");
break;
case EM_NET_DOOR_STATUS_TYPE.UNKNOWN:
MessageBox.Show("Unknown");
break;
default:
break;
}
#endregion
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.
30
Set device message callback to get the current device status
information; this function is independent of the calling
NETClient.SetDVRMessCallBack sequence, and the SDK is not called back by default. The
callback must call the alarm message subscription interface
NETClient.StartListen first before it takes effect.
NETClient.StopListen Stop subscription.
Start
Initialize
NETClient.Init
Stop subscribing
NETClient.StopListen
Log out
NETClient.Logout
End
Process
31
2.2.2.4 Sample Code
32
}
else
{
item.SubItems.Add("Failure");
}
33
}
34
NET_ALARM_ACCESS_CTL_REPEAT_ENTER_INFO repeat_info =
(NET_ALARM_ACCESS_CTL_REPEAT_ENTER_INFO)Marshal.PtrToStructure(pBuf,
typeof(NET_ALARM_ACCESS_CTL_REPEAT_ENTER_INFO));
item.Text = Alarm_Index.ToString();
item.SubItems.Add(repeat_info.stuTime.ToString());
item.SubItems.Add("RepeakIn");
item.SubItems.Add("");
item.SubItems.Add(repeat_info.szCardNo.ToString());
item.SubItems.Add(repeat_info.nDoor.ToString());
item.SubItems.Add("");
item.SubItems.Add("");
35
listView_event.Items.Insert(0, item);
if (listView_event.Items.Count > ListViewCount)
{
listView_event.Items.RemoveAt(ListViewCount);
}
listView_event.EndUpdate();
}));
Alarm_Index++;
break;
case EM_ALARM_TYPE.ALARM_CHASSISINTRUDED:
NET_ALARM_CHASSISINTRUDED_INFO chassisintruded_info =
(NET_ALARM_CHASSISINTRUDED_INFO)Marshal.PtrToStructure(pBuf,
typeof(NET_ALARM_CHASSISINTRUDED_INFO));
item.Text = Alarm_Index.ToString();
item.SubItems.Add(chassisintruded_info.stuTime.ToString());
if (chassisintruded_info.szReaderID.Length > 0)
{
item.SubItems.Add("CardreaderAntidemolition(card reader
tampering)");
}
else
{
item.SubItems.Add("ChassisIntruded(local device tampering)");
}
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add(chassisintruded_info.nChannelID.ToString());
item.SubItems.Add("");
if (chassisintruded_info.nAction == ALARM_START)
{
item.SubItems.Add("Start(start)");
}
else if (chassisintruded_info.nAction == ALARM_STOP)
{
item.SubItems.Add("Stop(stop)");
}
else
{
item.SubItems.Add("");
}
36
this.BeginInvoke(new Action(() =>
{
listView_event.BeginUpdate();
listView_event.Items.Insert(0, item);
if (listView_event.Items.Count > ListViewCount)
{
listView_event.Items.RemoveAt(ListViewCount);
}
listView_event.EndUpdate();
}));
Alarm_Index++;
break;
case EM_ALARM_TYPE.ALARM_ALARM_EX2:
NET_ALARM_ALARM_INFO_EX2 alarm_info =
(NET_ALARM_ALARM_INFO_EX2)Marshal.PtrToStructure(pBuf,
typeof(NET_ALARM_ALARM_INFO_EX2));
item.Text = Alarm_Index.ToString();
item.SubItems.Add(alarm_info.stuTime.ToString());
item.SubItems.Add("AlarmEx2(external alarm)");
item.SubItems.Add("");
item.SubItems.Add("");
item.SubItems.Add(alarm_info.nChannelID.ToString());
item.SubItems.Add("");
if (alarm_info.nAction == ALARM_START)
{
item.SubItems.Add("Start(start)");
}
else if (alarm_info.nAction == ALARM_STOP)
{
item.SubItems.Add("Stop(stop)");
}
else
{
item.SubItems.Add("");
}
37
listView_event.Items.Insert(0, item);
if (listView_event.Items.Count > ListViewCount)
{
listView_event.Items.RemoveAt(ListViewCount);
}
listView_event.EndUpdate();
}));
Alarm_Index++;
break;
default:
break;
}
return true;
}
#endregion
// alarm supscription
if (!m_IsListen)
{
bool ret = NETClient.StartListen(m_LoginID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
m_IsListen = true;
btn_StartListen.Text = "StopListen(stop subscription)";
}
else
{
bool ret = NETClient.StopListen(m_LoginID);
if (!ret)
{
MessageBox.Show(this, NETClient.GetLastError());
return;
}
m_IsListen = false;
listView_Event.Items.Clear();
btn_StartListen.Text = "StartListen(start sunscription)";
}
38
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.
39
2.2.3.1.3 Process Description
Figure 2-11 Device information viewing
Process
40
SDK_DEVCONFIG_CMD.NET_C Query record set
CFG_CAP_RECORDFINDER_INFO
FG_CAP_CMD_RECORDFINDER capability
Step 4 After completing this process, call the NETClient.Logout to log out of the device.
Step 5 After using all SDK functions, call the NETClient.Cleanup to release SDK resources.
int nCount = 0;
CFG_CAP_ACCESSCONTROL info = new CFG_CAP_ACCESSCONTROL();
object obj = info;
string strCommand =
SDK_DEVCONFIG_CMD.NET_CFG_CAP_CMD_ACCESSCONTROLMANAGER;
try
{
bool bQuery = NETClient.QueryNewSystemInfo(loginID, -1, strCommand, ref obj,
typeof(CFG_CAP_ACCESSCONTROL), 3000);
if (bQuery)
{
nCount = ((CFG_CAP_ACCESSCONTROL)obj).nAccessControlGroups;
textBox_Caps.Text = "Access Control Caps(Access controlling capability):" +
System.Environment.NewLine + "Access Control Num( number of access control devices)=" +
nCount.ToString() + System.Environment.NewLine + System.Environment.NewLine;
this.button_Query.Enabled = true;
}
}
catch (NETClientExcetion ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
#endregion
41
NET_CFG_CAP_RECORDFINDER_INFO RecordInfo = new
NET_CFG_CAP_RECORDFINDER_INFO();
obj = RecordInfo;
strCommand = SDK_DEVCONFIG_CMD.NET_CFG_CAP_CMD_RECORDFINDER;
try
{
bool bQuery = NETClient.QueryNewSystemInfo(loginID, 0, strCommand, ref obj,
typeof(NET_CFG_CAP_RECORDFINDER_INFO), 3000);
if (bQuery)
{
int nMaxPageSize =
((NET_CFG_CAP_RECORDFINDER_INFO)obj).nMaxPageSize;
textBox_Caps.Text += "RecordSetFinder Cap(record searching capability):" +
System.Environment.NewLine + "MaxPageSize(max records on each page)=" +
nMaxPageSize.ToString() + System.Environment.NewLine + System.Environment.NewLine;
this.button_Query.Enabled = true;
}
}
catch (NETClientExcetion ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
#endregion
if (bQuery)
{
int dwMaxLogItems = (int)((NET_CFG_CAP_LOG)obj).dwMaxLogItems;
int dwMaxPageItems = (int)((NET_CFG_CAP_LOG)obj).dwMaxPageItems;
42
string strSupportStartNo = "";
if (((NET_CFG_CAP_LOG)obj).bSupportStartNo)
{
strSupportStartNo = "Yes";
}
else
{
strSupportStartNo = "No";
}
43
}
}
catch (NETClientExcetion ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("GetAccessCount error:" + ex.Message);
}
#endregion
2.2.3.2.1 Introduction
To view device version and MAC, you need to issue a command through SDK to the access control
device, to get device information such as serial number, version number and Mac address.
44
2.2.3.2.3 Process Description
Figure 2-12 Device information viewing
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
45
object objInfo = VersionInfo;
bool ret = NETClient.QueryDevState(loginID, EM_DEVICE_STATE.SOFTWARE, ref
objInfo, typeof(NET_DEV_VERSION_INFO), 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
this.button_Query.Enabled = true;
VersionInfo = (NET_DEV_VERSION_INFO)objInfo;
46
stuNetInfo[i] = (NET_DEV_NETINTERFACE_INFO)objInfo2[i];
}
textBox_Version.Text += "MAC(physical address) : " + stuNetInfo[0].szMAC +
System.Environment.NewLine;
#endregion;
2.2.4.1 IP Settings
2.2.4.1.1 Introduction
To configure IP address, you need to call SDK interface to get and configure device information,
including IP address, subnet mask, and default gateway.
47
2.2.4.1.3 Process Description
Figure 2-13 IP setting
Start
Initialize
NETClient.Init
Log out
NETClient.Logout
Stop
Process
48
try
{
object objTemp = new object();
bool bRet = NETClient.GetNewDevConfig(loginID, -1, "Network", ref objTemp,
typeof(CFG_NETWORK_INFO), 5000);
if (!bRet)
{
MessageBox.Show(NETClient.GetLastError());
return cfg;
}
cfg = (CFG_NETWORK_INFO)objTemp;
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return cfg;
}
49
return bRet;
}
2.2.4.2.1 Introduction
To configure auto register, you need to call SDK interface to configure auto register information of
the device, including auto register enabling, device ID, and server.
Start
Initialize
NETClient.Init
Log out
NETClient.Logout
Stop
Process
50
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Auto register config.
Call NETClient.GetNewDevConfig to query the auto register config.
szCommand: DVRIP.
pBuf: NET_CFG_DVRIP_INFO.
Call NETClient.SetNewDevConfig to set the auto register config.
szCommand: DVRIP.
pBuf: NET_CFG_DVRIP_INFO.
Step 4 After completing this process, call NETClient.Logout to log out of the device.
Step 5 After using all SDK functions, call NETClient.Cleanup to release SDK resources.
51
public bool SetConfig_Dvrip(NET_CFG_DVRIP_INFO cfg_Dvrip)
{
bool bRet = false;
try
{
bRet = NETClient.SetNewDevConfig(loginID, -1, "DVRIP", (object)cfg_Dvrip,
typeof(NET_CFG_DVRIP_INFO), 5000);
}
catch (NETClientExcetion nex)
{
Console.WriteLine(nex.Message);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
return bRet;
}
2.2.5.1.1 Introduction
Device time setting process is that, you call SDK interface to get and set the device time.
52
2.2.5.1.3 Process Description
Figure 2-15 Time getting
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient.Init to initialize SDK.
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.SetupDeviceTime to set the access control time.
Step 4 After completing this process, call NETClient.Logout to log out of the device.
Step 5 After using all SDK functions, call NETClient.Cleanup to release SDK resources.
53
2.2.5.1.4 Sample Code
#region Get Deice Time get device time
NET_TIME stuInfo = new NET_TIME();
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.
54
Interface Description
NETClient.GetNewDevConfig Query config information.
NETClient.SetNewDevConfig Configure config information.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient. Init to initialize SDK.
Step 2 Call NETClient. LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.GetNewDevConfig to query the access NTP time sync and time zone config.
szCommand: NTP.
pBuf: NET_CFG_NTP_INFO.
Step 4 Call NETClient.SetNewDevConfig to set the access NTP time sync and time zone config.
szCommand: NTP.
pBuf: NET_CFG_NTP_INFO.
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
55
{
try
{
object objTemp = new object();
bool bRet = NETClient.GetNewDevConfig(loginID, -1, "NTP", ref objTemp,
typeof(NET_CFG_NTP_INFO), 5000);
if (bRet)
{
cfg = (NET_CFG_NTP_INFO)objTemp;
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return cfg;
}
56
{
Console.WriteLine(ex.Message);
}
return bRet;
}
DST Setting
2.2.5.3.1 Introduction
Daylight saving time (DST) setting process is that, you call SDK interface to get and set the DST.
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient.Init to initialize SDK.
57
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.GetNewDevConfig and NETClient.ParseData to query the access DST
config.
szCommand: Locales.
pBuf: NET_AV_CFG_Locales.
Step 4 Call NETClient. SetNewDevConfig and NETClient. PacketData to set the access DST config.
szCommand: Locales.
pBuf: NET_AV_CFG_Locales.
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
58
}
return bRet;
}
2.2.6.1.1 Introduction
The process to modify login password is that, you call SDK interface to modify the device login
password.
59
2.2.6.1.3 Process Description
Figure 2-19 Maintenance config
Start
Initialize SDK
NETClient.Init
Log in to the device
NETClient.LoginWithHighLevelSecurity
Log out
NETClient.Logout
End
Process
60
IntPtr insubPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_USER_INFO_NEW)));
try
{
2.2.6.2 Restart
2.2.6.2.1 Introduction
The restart process is that, you call SDK interface to restart the device.
61
2.2.6.2.3 Process Description
Figure 2-20 Device restart
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
62
2.2.6.3 Restoring the Factory Settings
2.2.6.3.1 Introduction
The process to restore factory defaults is that, you call SDK interface to restore factory defaults of the
device. After taking effect, all configurations and personnel information on the device will be cleared.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
63
Step 4 After completing this process, call NETClient.Logout to log out of the device.
Step 5 After using all SDK functions, call NETClient Cleanup to release SDK resources.
2.2.6.4.1 Introduction
The device upgrade process is that, you call SDK interface to upgrade the device program.
64
NETClient.SendUpgrade Start sending upgrade file.
NETClient.StopUpgrade Stop upgrading.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
65
MessageBox.Show("please choose a upgrade packet file.(please select remote
update package.)");
return;
}
2.2.6.5.1 Introduction
The auto maintenance process is that, you call SDK interface to configure the auto maintenance of
device, including information such as auto restart time.
66
2.2.6.5.2 Interface Overview
Table 2-22 Description of auto maintenance interfaces
Interface Description
NETClient.GetDevConfig Query config information.
NETClient.SetDevConfig Set config information.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
67
2.2.6.5.4 Sample Code
NET_DEV_AUTOMT_CFG cfg_AutoMT = new NET_DEV_AUTOMT_CFG();
public NET_DEV_AUTOMT_CFG GetDevConfig_AutoMT()
{
uint ret = 0;
IntPtr inPtr = IntPtr.Zero;
try
{
inPtr = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_DEV_AUTOMT_CFG)));
Marshal.StructureToPtr(cfg_AutoMT, inPtr, true);
bool result = NETClient.GetDevConfig(loginID, EM_DEV_CFG_TYPE.AUTOMTCFG,
0, inPtr, (uint)Marshal.SizeOf(typeof(NET_DEV_AUTOMT_CFG)), ref ret, 5000);
if (result && ret == (uint)Marshal.SizeOf(typeof(NET_DEV_AUTOMT_CFG)))
{
cfg_AutoMT = (NET_DEV_AUTOMT_CFG)Marshal.PtrToStructure(inPtr,
typeof(NET_DEV_AUTOMT_CFG));
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Marshal.FreeHGlobal(inPtr);
}
return cfg_AutoMT;
}
68
bool result = NETClient.SetDevConfig(loginID, EM_DEV_CFG_TYPE.AUTOMTCFG, 0,
inPtr, (uint)Marshal.SizeOf(typeof(NET_DEV_AUTOMT_CFG)), 5000);
if (!result)
{
MessageBox.Show(NETClient.GetLastError());
}
MessageBox.Show("Set successfully.(configured successfully)");
#endregion
2.2.7.1 Introduction
For personnel information, you can call SDK to add, delete, query and modify personnel information
fields of the access device (including No., name, face, card, fingerprint, password, user permission,
period, holiday plan and user type).
69
2.2.7.3 Process Description
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
70
Type Description emType Param
NET_CTRL_RECORDSET_PARAM
EM_DEVICE_STATE. ACCESSCTLCA
Get user info NET_RECORDSET_ACCESS_CTL_
DEV_RECORDSET RD
CARD
Step 5 Call the NETClient.ControlDevice to update user information.
2.2.7.4 Note
71
NET_RECORDSET_ACCESS_CTL_CARD info = new
NET_RECORDSET_ACCESS_CTL_CARD();
info.dwSize = (uint)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
info.nRecNo = Convert.ToInt32(textBox_RecNo.Text.Trim());
IntPtr infoPtr = IntPtr.Zero;
try
{
infoPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD)));
Marshal.StructureToPtr(info, infoPtr, true);
inp.pBuf = infoPtr;
inp.nBufLen = Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
object objInp = inp;
bool ret = NETClient.QueryDevState(loginID,
(int)EM_DEVICE_STATE.DEV_RECORDSET, ref objInp, typeof(NET_CTRL_RECORDSET_PARAM), 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
inp = (NET_CTRL_RECORDSET_PARAM)objInp;
info = (NET_RECORDSET_ACCESS_CTL_CARD)Marshal.PtrToStructure(inp.pBuf,
typeof(NET_RECORDSET_ACCESS_CTL_CARD));
// dateTimePicker_CreateTime.Value = info.stuCreateTime.ToDateTime();
textBox_CardNo.Text = info.szCardNo;
textBox_UserID.Text = info.szUserID;
comboBox_CardStatus.SelectedIndex = (int)info.emStatus + 1;
comboBox_CardType.SelectedIndex = (int)info.emType + 1;
textBox_CardPwd.Text = info.szPsw;
m_SelectDoorsAry = info.nNewDoors;
m_SelectTimeAry = info.nNewTimeSectionNo;
textBox_UseTimes.Text = info.nUseTime.ToString();
dateTimePicker_ValidStart.Value = info.stuValidStartTime.ToDateTime();
dateTimePicker_ValidEnd.Value = info.stuValidEndTime.ToDateTime();
checkBox_First.Checked = info.bFirstEnter;
72
if (2 == nCtlType)
{
OnChangeUIState(7);
}
else
{
OnChangeUIState(8);
}
// MessageBox.Show("Query Success(获取成功)");
}
finally
{
// Marshal.FreeHGlobal(infoPtr);
}
#endregion
stuInfo.stuCtrlRecordSetInfo.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_IN));
stuInfo.stuCtrlRecordSetInfo.emType = EM_NET_RECORD_TYPE.ACCESSCTLCARD;
stuInfo.stuCtrlRecordSetInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
stuInfo.stuCtrlRecordSetResult.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_OUT));
m_stuInfo.stuCreateTime.dwYear = (uint)DateTime.Now.Year;
m_stuInfo.stuCreateTime.dwMonth = (uint)DateTime.Now.Month;
m_stuInfo.stuCreateTime.dwDay = (uint)DateTime.Now.Day;
m_stuInfo.stuCreateTime.dwHour = (uint)DateTime.Now.Hour;
m_stuInfo.stuCreateTime.dwMinute = (uint)DateTime.Now.Minute;
m_stuInfo.stuCreateTime.dwSecond = (uint)DateTime.Now.Second;
73
m_stuInfo.szCardNo = this.textBox_CardNo.Text.Trim();
m_stuInfo.szUserID = this.textBox_UserID.Text.Trim();
m_stuInfo.emStatus =
(EM_ACCESSCTLCARD_STATE)comboBox_CardStatus.SelectedIndex -1;
m_stuInfo.emType =
(EM_ACCESSCTLCARD_TYPE)comboBox_CardType.SelectedIndex - 1;
m_stuInfo.szPsw = this.textBox_CardPwd.Text.Trim();
m_stuInfo.nUseTime = Convert.ToInt32(textBox_UseTimes.Text.Trim());
m_stuInfo.bNewDoor = true;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
m_stuInfo.nNewDoors[i] = m_selectDoorsList[i];
}
}
m_stuInfo.nNewDoorNum = m_selectDoorsList.Count;
if (m_selectTimesList.Count > 0)
{
for (int i = 0; i < m_selectTimesList.Count; i++)
{
m_stuInfo.nNewTimeSectionNo[i] = m_selectTimesList[i];
}
}
m_stuInfo.nNewTimeSectionNum = m_selectTimesList.Count;
m_stuInfo.stuValidStartTime.dwYear =
(uint)dateTimePicker_ValidStart.Value.Year;
m_stuInfo.stuValidStartTime.dwMonth =
(uint)dateTimePicker_ValidStart.Value.Month;
m_stuInfo.stuValidStartTime.dwDay = (uint)dateTimePicker_ValidStart.Value.Day;
m_stuInfo.stuValidStartTime.dwHour =
(uint)dateTimePicker_ValidStart.Value.Hour;
m_stuInfo.stuValidStartTime.dwMinute =
(uint)dateTimePicker_ValidStart.Value.Minute;
m_stuInfo.stuValidStartTime.dwSecond =
(uint)dateTimePicker_ValidStart.Value.Second;
74
m_stuInfo.stuValidEndTime.dwYear = (uint)dateTimePicker_ValidEnd.Value.Year;
m_stuInfo.stuValidEndTime.dwMonth =
(uint)dateTimePicker_ValidEnd.Value.Month;
m_stuInfo.stuValidEndTime.dwDay = (uint)dateTimePicker_ValidEnd.Value.Day;
m_stuInfo.stuValidEndTime.dwHour = (uint)dateTimePicker_ValidEnd.Value.Hour;
m_stuInfo.stuValidEndTime.dwMinute =
(uint)dateTimePicker_ValidEnd.Value.Minute;
m_stuInfo.stuValidEndTime.dwSecond =
(uint)dateTimePicker_ValidEnd.Value.Second;
m_stuInfo.bFirstEnter = this.checkBox_First.Checked;
stuInfo.stuCtrlRecordSetInfo.pBuf = inPtr;
stuInfo.stuCtrlRecordSetInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_INSERT, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
stuInfo =
(NET_CTRL_RECORDSET_INSERT_PARAM)Marshal.PtrToStructure(ptr,
typeof(NET_CTRL_RECORDSET_INSERT_PARAM));
MessageBox.Show("Execute Success\n RetNo="+
stuInfo.stuCtrlRecordSetResult.nRecNo.ToString());
}
finally
{
75
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
#endregion
m_stuInfo.nRecNo = Convert.ToInt32(textBox_RecNo.Text.Trim());
m_stuInfo.stuCreateTime.dwYear = (uint)DateTime.Now.Year;
m_stuInfo.stuCreateTime.dwMonth = (uint)DateTime.Now.Month;
m_stuInfo.stuCreateTime.dwDay = (uint)DateTime.Now.Day;
m_stuInfo.stuCreateTime.dwHour = (uint)DateTime.Now.Hour;
m_stuInfo.stuCreateTime.dwMinute = (uint)DateTime.Now.Minute;
m_stuInfo.stuCreateTime.dwSecond = (uint)DateTime.Now.Second;
m_stuInfo.szCardNo = this.textBox_CardNo.Text.Trim();
m_stuInfo.szUserID = this.textBox_UserID.Text.Trim();
m_stuInfo.emStatus =
(EM_ACCESSCTLCARD_STATE)comboBox_CardStatus.SelectedIndex - 1;
m_stuInfo.emType =
(EM_ACCESSCTLCARD_TYPE)comboBox_CardType.SelectedIndex - 1;
m_stuInfo.szPsw = this.textBox_CardPwd.Text.Trim();
m_stuInfo.nUseTime = Convert.ToInt32(textBox_UseTimes.Text.Trim());
m_stuInfo.bNewDoor = true;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
m_stuInfo.nNewDoors[i] = m_selectDoorsList[i];
}
}
m_stuInfo.nNewDoorNum = m_selectDoorsList.Count;
if (m_selectTimesList.Count > 0)
{
for (int i = 0; i < m_selectTimesList.Count; i++)
{
76
m_stuInfo.nNewTimeSectionNo[i] = m_selectTimesList[i];
}
}
m_stuInfo.nNewTimeSectionNum = m_selectTimesList.Count;
m_stuInfo.stuValidStartTime.dwYear =
(uint)dateTimePicker_ValidStart.Value.Year;
m_stuInfo.stuValidStartTime.dwMonth =
(uint)dateTimePicker_ValidStart.Value.Month;
m_stuInfo.stuValidStartTime.dwDay = (uint)dateTimePicker_ValidStart.Value.Day;
m_stuInfo.stuValidStartTime.dwHour =
(uint)dateTimePicker_ValidStart.Value.Hour;
m_stuInfo.stuValidStartTime.dwMinute =
(uint)dateTimePicker_ValidStart.Value.Minute;
m_stuInfo.stuValidStartTime.dwSecond =
(uint)dateTimePicker_ValidStart.Value.Second;
m_stuInfo.stuValidEndTime.dwYear = (uint)dateTimePicker_ValidEnd.Value.Year;
m_stuInfo.stuValidEndTime.dwMonth =
(uint)dateTimePicker_ValidEnd.Value.Month;
m_stuInfo.stuValidEndTime.dwDay = (uint)dateTimePicker_ValidEnd.Value.Day;
m_stuInfo.stuValidEndTime.dwHour = (uint)dateTimePicker_ValidEnd.Value.Hour;
m_stuInfo.stuValidEndTime.dwMinute =
(uint)dateTimePicker_ValidEnd.Value.Minute;
m_stuInfo.stuValidEndTime.dwSecond =
(uint)dateTimePicker_ValidEnd.Value.Second;
m_stuInfo.bFirstEnter = this.checkBox_First.Checked;
stuInfo.pBuf = inPtr;
stuInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
77
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_UPDATE, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Execute Success(operated successfully)" );
}
finally
{
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
OnChangeUIState(nCtlType);
#endregion
#region Remove record remove card record
NET_CTRL_RECORDSET_PARAM stuInfo = new NET_CTRL_RECORDSET_PARAM();
stuInfo.dwSize = (uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM));
stuInfo.emType = EM_NET_RECORD_TYPE.ACCESSCTLCARD;
m_stuInfo.nRecNo = Convert.ToInt32(textBox_RecNo.Text.Trim());
stuInfo.pBuf = inPtr;
stuInfo.nBufLen = (int)Marshal.SizeOf(typeof(int));
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
78
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_REMOVE, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Execute Success" );
}
finally
{
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
#endregion
#region Clear card record clear card record
NET_CTRL_RECORDSET_PARAM inParam = new
NET_CTRL_RECORDSET_PARAM();
inParam.dwSize = (uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM));
inParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLCARD;
IntPtr inPtr = IntPtr.Zero;
try
{
inPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM)));
Marshal.StructureToPtr(inParam, inPtr, true);
bool ret = NETClient.ControlDevice(loginID, EM_CtrlType.RECORDSET_CLEAR,
inPtr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Execute Success(operated successfully)");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
79
finally
{
Marshal.FreeHGlobal(inPtr);
}
#endregion
stuInfo.stuCtrlRecordSetInfo.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_IN));
stuInfo.stuCtrlRecordSetInfo.emType = EM_NET_RECORD_TYPE.ACCESSCTLCARD;
stuInfo.stuCtrlRecordSetInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
stuInfo.stuCtrlRecordSetResult.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_OUT));
m_stuInfo.stuCreateTime.dwYear = (uint)DateTime.Now.Year;
m_stuInfo.stuCreateTime.dwMonth = (uint)DateTime.Now.Month;
m_stuInfo.stuCreateTime.dwDay = (uint)DateTime.Now.Day;
m_stuInfo.stuCreateTime.dwHour = (uint)DateTime.Now.Hour;
m_stuInfo.stuCreateTime.dwMinute = (uint)DateTime.Now.Minute;
m_stuInfo.stuCreateTime.dwSecond = (uint)DateTime.Now.Second;
m_stuInfo.szCardNo = this.textBox_CardNo.Text.Trim();
m_stuInfo.szUserID = this.textBox_UserID.Text.Trim();
m_stuInfo.emStatus =
(EM_ACCESSCTLCARD_STATE)comboBox_CardStatus.SelectedIndex - 1;
m_stuInfo.emType =
(EM_ACCESSCTLCARD_TYPE)comboBox_CardType.SelectedIndex - 1;
m_stuInfo.szPsw = this.textBox_CardPwd.Text.Trim();
m_stuInfo.nUseTime = Convert.ToInt32(textBox_UseTimes.Text.Trim());
m_stuInfo.bNewDoor = true;
//m_stuInfo.nNewDoorNum;
// m_stuInfo.sznDoors;
// m_stuInfo.nNewTimeSectionNum;
80
//m_stuInfo.nNewTimeSectionNo
m_stuInfo.stuValidStartTime.dwYear =
(uint)dateTimePicker_ValidStart.Value.Year;
m_stuInfo.stuValidStartTime.dwMonth =
(uint)dateTimePicker_ValidStart.Value.Month;
m_stuInfo.stuValidStartTime.dwDay = (uint)dateTimePicker_ValidStart.Value.Day;
m_stuInfo.stuValidStartTime.dwHour =
(uint)dateTimePicker_ValidStart.Value.Hour;
m_stuInfo.stuValidStartTime.dwMinute =
(uint)dateTimePicker_ValidStart.Value.Minute;
m_stuInfo.stuValidStartTime.dwSecond =
(uint)dateTimePicker_ValidStart.Value.Second;
m_stuInfo.stuValidEndTime.dwYear = (uint)dateTimePicker_ValidEnd.Value.Year;
m_stuInfo.stuValidEndTime.dwMonth =
(uint)dateTimePicker_ValidEnd.Value.Month;
m_stuInfo.stuValidEndTime.dwDay = (uint)dateTimePicker_ValidEnd.Value.Day;
m_stuInfo.stuValidEndTime.dwHour = (uint)dateTimePicker_ValidEnd.Value.Hour;
m_stuInfo.stuValidEndTime.dwMinute =
(uint)dateTimePicker_ValidEnd.Value.Minute;
m_stuInfo.stuValidEndTime.dwSecond =
(uint)dateTimePicker_ValidEnd.Value.Second;
m_stuInfo.bFirstEnter = this.checkBox_First.Checked;
m_stuInfo.bEnableExtended = true;
m_stuInfo.stuFingerPrintInfoEx.nCount = 1;
m_stuInfo.stuFingerPrintInfoEx.nLength = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.nPacketLen = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.pPacketData =
Marshal.AllocHGlobal(m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
Marshal.Copy(FingerPrintInfo, 0, m_stuInfo.stuFingerPrintInfoEx.pPacketData,
m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
81
stuInfo.stuCtrlRecordSetInfo.pBuf = inPtr;
stuInfo.stuCtrlRecordSetInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_INSERT, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
stuInfo =
(NET_CTRL_RECORDSET_INSERT_PARAM)Marshal.PtrToStructure(ptr,
typeof(NET_CTRL_RECORDSET_INSERT_PARAM));
MessageBox.Show("Execute Success(operated successfully)\n RetNo=" +
stuInfo.stuCtrlRecordSetResult.nRecNo.ToString());
}
finally
{
Marshal.FreeHGlobal(m_stuInfo.stuFingerPrintInfoEx.pPacketData);
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
#endregion
m_stuInfo.nRecNo = Convert.ToInt32(textBox_RecNo.Text.Trim());
m_stuInfo.stuCreateTime.dwYear = (uint)DateTime.Now.Year;
m_stuInfo.stuCreateTime.dwMonth = (uint)DateTime.Now.Month;
m_stuInfo.stuCreateTime.dwDay = (uint)DateTime.Now.Day;
m_stuInfo.stuCreateTime.dwHour = (uint)DateTime.Now.Hour;
m_stuInfo.stuCreateTime.dwMinute = (uint)DateTime.Now.Minute;
m_stuInfo.stuCreateTime.dwSecond = (uint)DateTime.Now.Second;
m_stuInfo.szCardNo = this.textBox_CardNo.Text.Trim();
82
m_stuInfo.szUserID = this.textBox_UserID.Text.Trim();
m_stuInfo.emStatus =
(EM_ACCESSCTLCARD_STATE)comboBox_CardStatus.SelectedIndex - 1;
m_stuInfo.emType =
(EM_ACCESSCTLCARD_TYPE)comboBox_CardType.SelectedIndex - 1;
m_stuInfo.szPsw = this.textBox_CardPwd.Text.Trim();
m_stuInfo.nUseTime = Convert.ToInt32(textBox_UseTimes.Text.Trim());
m_stuInfo.bNewDoor = true;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
m_stuInfo.nNewDoors[i] = m_selectDoorsList[i];
}
}
m_stuInfo.nNewDoorNum = m_selectDoorsList.Count;
if (m_selectTimesList.Count > 0)
{
for (int i = 0; i < m_selectTimesList.Count; i++)
{
m_stuInfo.nNewTimeSectionNo[i] = m_selectTimesList[i];
}
}
m_stuInfo.nNewTimeSectionNum = m_selectTimesList.Count;
m_stuInfo.stuValidStartTime.dwYear =
(uint)dateTimePicker_ValidStart.Value.Year;
m_stuInfo.stuValidStartTime.dwMonth =
(uint)dateTimePicker_ValidStart.Value.Month;
m_stuInfo.stuValidStartTime.dwDay = (uint)dateTimePicker_ValidStart.Value.Day;
m_stuInfo.stuValidStartTime.dwHour =
(uint)dateTimePicker_ValidStart.Value.Hour;
m_stuInfo.stuValidStartTime.dwMinute =
(uint)dateTimePicker_ValidStart.Value.Minute;
m_stuInfo.stuValidStartTime.dwSecond =
(uint)dateTimePicker_ValidStart.Value.Second;
m_stuInfo.stuValidEndTime.dwYear = (uint)dateTimePicker_ValidEnd.Value.Year;
m_stuInfo.stuValidEndTime.dwMonth =
(uint)dateTimePicker_ValidEnd.Value.Month;
m_stuInfo.stuValidEndTime.dwDay = (uint)dateTimePicker_ValidEnd.Value.Day;
83
m_stuInfo.stuValidEndTime.dwHour = (uint)dateTimePicker_ValidEnd.Value.Hour;
m_stuInfo.stuValidEndTime.dwMinute =
(uint)dateTimePicker_ValidEnd.Value.Minute;
m_stuInfo.stuValidEndTime.dwSecond =
(uint)dateTimePicker_ValidEnd.Value.Second;
m_stuInfo.bFirstEnter = this.checkBox_First.Checked;
m_stuInfo.bEnableExtended = true;
m_stuInfo.stuFingerPrintInfoEx.nCount = 1;
m_stuInfo.stuFingerPrintInfoEx.nLength = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.nPacketLen = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.pPacketData =
Marshal.AllocHGlobal(m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
Marshal.Copy(FingerPrintInfo, 0, m_stuInfo.stuFingerPrintInfoEx.pPacketData,
m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
stuInfo.pBuf = inPtr;
stuInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_UPDATEEX, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Execute Success(operated successfully)");
}
84
finally
{
Marshal.FreeHGlobal(m_stuInfo.stuFingerPrintInfoEx.pPacketData);
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
OnChangeUIState(nCtlType);
#endregion
m_stuInfo.nRecNo = Convert.ToInt32(textBox_RecNo.Text.Trim());
m_stuInfo.stuCreateTime.dwYear = (uint)DateTime.Now.Year;
m_stuInfo.stuCreateTime.dwMonth = (uint)DateTime.Now.Month;
m_stuInfo.stuCreateTime.dwDay = (uint)DateTime.Now.Day;
m_stuInfo.stuCreateTime.dwHour = (uint)DateTime.Now.Hour;
m_stuInfo.stuCreateTime.dwMinute = (uint)DateTime.Now.Minute;
m_stuInfo.stuCreateTime.dwSecond = (uint)DateTime.Now.Second;
m_stuInfo.szCardNo = this.textBox_CardNo.Text.Trim();
m_stuInfo.szUserID = this.textBox_UserID.Text.Trim();
m_stuInfo.emStatus =
(EM_ACCESSCTLCARD_STATE)comboBox_CardStatus.SelectedIndex - 1;
m_stuInfo.emType =
(EM_ACCESSCTLCARD_TYPE)comboBox_CardType.SelectedIndex - 1;
m_stuInfo.szPsw = this.textBox_CardPwd.Text.Trim();
m_stuInfo.nUseTime = Convert.ToInt32(textBox_UseTimes.Text.Trim());
m_stuInfo.bNewDoor = true;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
m_stuInfo.nNewDoors[i] = m_selectDoorsList[i];
}
}
m_stuInfo.nNewDoorNum = m_selectDoorsList.Count;
85
if (m_selectTimesList.Count > 0)
{
for (int i = 0; i < m_selectTimesList.Count; i++)
{
m_stuInfo.nNewTimeSectionNo[i] = m_selectTimesList[i];
}
}
m_stuInfo.nNewTimeSectionNum = m_selectTimesList.Count;
m_stuInfo.stuValidStartTime.dwYear =
(uint)dateTimePicker_ValidStart.Value.Year;
m_stuInfo.stuValidStartTime.dwMonth =
(uint)dateTimePicker_ValidStart.Value.Month;
m_stuInfo.stuValidStartTime.dwDay = (uint)dateTimePicker_ValidStart.Value.Day;
m_stuInfo.stuValidStartTime.dwHour =
(uint)dateTimePicker_ValidStart.Value.Hour;
m_stuInfo.stuValidStartTime.dwMinute =
(uint)dateTimePicker_ValidStart.Value.Minute;
m_stuInfo.stuValidStartTime.dwSecond =
(uint)dateTimePicker_ValidStart.Value.Second;
m_stuInfo.stuValidEndTime.dwYear = (uint)dateTimePicker_ValidEnd.Value.Year;
m_stuInfo.stuValidEndTime.dwMonth =
(uint)dateTimePicker_ValidEnd.Value.Month;
m_stuInfo.stuValidEndTime.dwDay = (uint)dateTimePicker_ValidEnd.Value.Day;
m_stuInfo.stuValidEndTime.dwHour = (uint)dateTimePicker_ValidEnd.Value.Hour;
m_stuInfo.stuValidEndTime.dwMinute =
(uint)dateTimePicker_ValidEnd.Value.Minute;
m_stuInfo.stuValidEndTime.dwSecond =
(uint)dateTimePicker_ValidEnd.Value.Second;
m_stuInfo.bFirstEnter = this.checkBox_First.Checked;
m_stuInfo.bEnableExtended = true;
m_stuInfo.stuFingerPrintInfoEx.nCount = 1;
m_stuInfo.stuFingerPrintInfoEx.nLength = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.nPacketLen = PacketLen;
m_stuInfo.stuFingerPrintInfoEx.pPacketData =
Marshal.AllocHGlobal(m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
Marshal.Copy(FingerPrintInfo, 0, m_stuInfo.stuFingerPrintInfoEx.pPacketData,
m_stuInfo.stuFingerPrintInfoEx.nPacketLen);
86
IntPtr inPtr = IntPtr.Zero;
IntPtr ptr = IntPtr.Zero;
try
{
inPtr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD)));
Marshal.StructureToPtr(m_stuInfo, inPtr, true);
stuInfo.pBuf = inPtr;
stuInfo.nBufLen =
(int)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARD));
ptr =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_PARAM)));
Marshal.StructureToPtr(stuInfo, ptr, true);
bool ret = NETClient.ControlDevice(loginID,
EM_CtrlType.RECORDSET_UPDATEEX, ptr, 10000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Execute Success(operated successfully)");
}
finally
{
Marshal.FreeHGlobal(m_stuInfo.stuFingerPrintInfoEx.pPacketData);
Marshal.FreeHGlobal(inPtr);
Marshal.FreeHGlobal(ptr);
}
OnChangeUIState(nCtlType);
#endregion
2.2.8.1 Introduction
For door config information, you can call SDK interface to get and set door config of the access
device, including unlock mode, lock holding, lock timeout, holiday period number, unlock period,
and alarm enabling option.
87
2.2.8.2 Interunlockface Overview
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient.Init to initialize SDK.
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.GetNewDevConfig to query the access door info.
szCommand: AccessControl.
obj: NET_CFG_ACCESS_EVENT_INFO.
88
emDoorOpenMethod Unlock mode
bDuressAlarmEnable duress
bBreakInAlarmEnable Intrusion alarm enabling
bRepeatEnterAlarm Repeat entry alarm enabling
abDoorNotClosedAlarmEnable Interlock alarm enabling
abSensorEnable Door sensor enabling
Step 4 Call NETClient.SetNewDevConfig and NETClient.PacketData to set the access door info.
szCommand: AccessControl.
pBuf: NET_CFG_ACCESS_EVENT_INFO.
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
2.2.8.4 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.9.1 Period Config."
89
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return cfg;
}
2.2.9.1.1 Introduction
For period config information, you can call SDK interface to get and set the door period of the access
control device. The configuration of this template cannot directly take effect on the device and needs
to be called by other function modules.
90
NETClient.SetNewDevConfig Configure config information.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient.Init to initialize SDK.
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.GetNewDevConfig to query the access period info.
szCommand: AccessTimeSchedule.
pBuf: CFG_ACCESS_TIMESCHEDULE_INFO.
Step 4 Call NETClient.SetNewDevConfig to set the access period info.
szCommand: AccessTimeSchedule.
pBuf: CFG_ACCESS_TIMESCHEDULE_INFO.
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
91
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
timeSchedule = (NET_CFG_ACCESS_TIMESCHEDULE_INFO)objInfo;
textBox_Name.Text = timeSchedule.szName;
92
MessageBox.Show(NETClient.GetLastError());
return;
}
MessageBox.Show("Set success");
2.2.9.2.1 Introduction
For always open and always closed period config, you can call SDK interface to get and set the period
config of the access control device, including always open period, always closed period, remote
verification period.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
93
Process
Note
Set the serial number of always open period, always close period and remote verifitication. For
details, see "2.2.9.1 Period Config."
94
cfg = (NET_CFG_ACCESS_EVENT_INFO)objTemp;
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return cfg;
}
95
2.2.9.3 Holiday Config
2.2.9.3.1 Introduction
For holiday config, you can call SDK interface to get and configure the holiday of the access control
device.
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
96
Type Description emType Param
EM_NET_RECORD_
NET_CTRL_RECORDSET_INSERT_
EM_CtrlType. TYPE.
Add holiday PARAM
RECORDSET_INSERT ACCESSCTLHOLIDA
NET_RECORDSET_HOLIDAY
Y
EM_NET_RECORD_
EM_CtrlType.
TYPE. NET_CTRL_RECORDSET_PARAM
RECORDSET_REMO Delete holiday
ACCESSCTLHOLIDA NET_RECORDSET_HOLIDAY
VE
Y
EM_NET_RECORD_
EM_CtrlType. TYPE.
Clear holiday NET_CTRL_RECORDSET_PARAM
RECORDSET_CLEAR ACCESSCTLHOLIDA
Y
Step 4 Call the NETClient.QueryDevState interface to get holiday information.
try
{
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(result));
97
//package stuParam
stuParam.pBuf = pBuf;
stuParam.nBufLen = Marshal.SizeOf(result);
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLHOLIDAY;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
object obj = stuParam;
dateTimePicker_StartTime.Value =
update_holiday.stuStartTime.ToDateTime();
dateTimePicker_EndTime.Value = update_holiday.stuEndTime.ToDateTime();
textBox_HolidayNo.Text = update_holiday.szHolidayNo;
MessageBox.Show("Get succeed");
OnChangeUIState(5);
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Marshal.FreeHGlobal(pBuf );
}
// Add holiday
IntPtr pParam = IntPtr.Zero;
IntPtr pBuf = IntPtr.Zero;
98
NET_CTRL_RECORDSET_INSERT_PARAM stuInsertParam = new
NET_CTRL_RECORDSET_INSERT_PARAM();
NET_CTRL_RECORDSET_INSERT_PARAM stuOutParam = new
NET_CTRL_RECORDSET_INSERT_PARAM();
stuHoliday.stuStartTime.dwYear = (uint)dateTimePicker_StartTime.Value.Year;
stuHoliday.stuStartTime.dwMonth = (uint)dateTimePicker_StartTime.Value.Month;
stuHoliday.stuStartTime.dwDay = (uint)dateTimePicker_StartTime.Value.Day;
stuHoliday.stuEndTime.dwYear = (uint)dateTimePicker_EndTime.Value.Year;
stuHoliday.stuEndTime.dwMonth = (uint)dateTimePicker_EndTime.Value.Month;
stuHoliday.stuEndTime.dwDay = (uint)dateTimePicker_EndTime.Value.Day;
stuHoliday.szHolidayNo = textBox_HolidayNo.Text;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
stuHoliday.sznDoors[i] = m_selectDoorsList[i];
}
}
stuHoliday.nDoorNum = m_selectDoorsList.Count;
try
{
pParam =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_PARAM)));
pBuf =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_RECORDSET_HOLIDAY)));
//package stuInsertParam
99
stuInsertParam.stuCtrlRecordSetInfo.pBuf = pBuf;
stuInsertParam.stuCtrlRecordSetInfo.nBufLen = Marshal.SizeOf(stuHoliday);
stuInsertParam.dwSize = (uint)Marshal.SizeOf(stuInsertParam);
stuInsertParam.stuCtrlRecordSetInfo.dwSize =
(uint)Marshal.SizeOf(stuInsertParam.stuCtrlRecordSetInfo);
stuInsertParam.stuCtrlRecordSetInfo.emType =
EM_NET_RECORD_TYPE.ACCESSCTLHOLIDAY;
stuInsertParam.stuCtrlRecordSetResult.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_OUT));
Marshal.StructureToPtr(stuInsertParam, pParam, true);
stuOutParam =
(NET_CTRL_RECORDSET_INSERT_PARAM)Marshal.PtrToStructure(pParam,
typeof(NET_CTRL_RECORDSET_INSERT_PARAM));
if (bRet && stuOutParam.stuCtrlRecordSetResult.nRecNo > 0)
{
MessageBox.Show("Inster succeed 。 RecNO:" +
stuOutParam.stuCtrlRecordSetResult.nRecNo);
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//free resource
finally
{
Marshal.FreeHGlobal(pParam);
Marshal.FreeHGlobal(pBuf );
}
// update holiday
100
update_holiday.stuEndTime.dwDay = (uint)dateTimePicker_EndTime.Value.Day;
update_holiday.szHolidayNo = textBox_HolidayNo.Text;
if (m_selectDoorsList.Count > 0)
{
for (int i = 0; i < m_selectDoorsList.Count; i++)
{
update_holiday.sznDoors[i] = m_selectDoorsList[i];
}
}
update_holiday.nDoorNum = m_selectDoorsList.Count;
101
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Marshal.FreeHGlobal(pParam);
Marshal.FreeHGlobal(pBuf );
}
// remove holiday
IntPtr pParam = IntPtr.Zero;
IntPtr pBuf = IntPtr.Zero;
NET_CTRL_RECORDSET_PARAM stuParam = new NET_CTRL_RECORDSET_PARAM();
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLHOLIDAY;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
stuParam.pBuf = IntPtr.Zero;
stuParam.nBufLen = 0;
try
{
pParam = Marshal.AllocHGlobal(Marshal.SizeOf(stuParam));
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(int.Parse(textBox_RecNo.Text)));
Marshal.StructureToPtr(int.Parse(textBox_RecNo.Text), pBuf, true);
stuParam.pBuf = pBuf;
stuParam.nBufLen = Marshal.SizeOf(int.Parse(textBox_RecNo.Text));
Marshal.StructureToPtr(stuParam, pParam, true);
102
{
MessageBox.Show(ex.Message);
}
finally
{
Marshal.FreeHGlobal(pBuf );
Marshal.FreeHGlobal(pParam);
}
// clear holiday
IntPtr pParam = IntPtr.Zero;
NET_CTRL_RECORDSET_PARAM stuParam = new NET_CTRL_RECORDSET_PARAM();
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLHOLIDAY;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
pParam = Marshal.AllocHGlobal(Marshal.SizeOf(stuParam));
Marshal.StructureToPtr(stuParam, pParam, true);
2.2.10.1.1 Introduction
For unlock at designated intervals and first card unlock, you can call SDK interface to get and set the
config of unlock at designated intervals, first card unlock and first user unlock of the access control
device.
103
Interface Description
NETClient. GetNewDevConfig Query config information.
NETClient. SetNewDevConfig Set config information.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Step 1 Call NETClient.Init to initialize SDK.
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.GetNewDevConfig to query the access info of unlock at designated
intervals and first card unlock.
szCommand: AccessControl.
pBuf: NET_CFG_ACCESS_EVENT_INFO.
104
szCommand: AccessControl.
pBuf: NET_CFG_ACCESS_EVENT_INFO.
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
Note
105
public bool SetConfig(NET_CFG_ACCESS_EVENT_INFO cfg)
{
bool bRet = false;
try
{
bRet = NETClient.SetNewDevConfig(loginID, comboBox_Channel.SelectedIndex,
CFG_CMD_ACCESS_EVENT, (object)cfg, typeof(NET_CFG_ACCESS_EVENT_INFO), 5000);
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return bRet;
}
2.2.10.2.1 Introduction
For combination unlock by multiple persons, you can call SDK interface to get and set the config of
combination unlock by multiple persons of the access control device.
106
2.2.10.2.3 Process Description
Figure 2-30 Combination unlock by multiple persons
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
Release SDK
NETClient.Cleanup
End
Process
Note
Before configuring combination unlock by multiple persons, add personnel to the device.
Combination number: Group the personnel, and one door can configure up to 4 personnel
groups.
107
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.
108
}
2.2.10.3.1 Introduction
For inter-door lock config, you can call SDK interface to get and set the inter-door lock config of the
access control device.
109
2.2.10.3.3 Process Description
Figure 2-31 Inter-door lock config
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Note
110
{
bool bRet = false;
try
{
object objTemp = new object();
bRet = NETClient.GetNewDevConfig(loginID, -1, CFG_CMD_ACCESS_GENERAL, ref
objTemp, typeof(NET_CFG_ACCESS_GENERAL_INFO), 5000);
if (bRet)
{
cfg = (NET_CFG_ACCESS_GENERAL_INFO)objTemp;
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return bRet;
}
111
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return bRet;
}
2.2.10.4 Anti-passback
2.2.10.4.1 Introduction
For anti-passback config, you can call SDK interface to get and set the anti-passback config of the
access control device.
112
2.2.10.4.3 Process Description
Figure 2-32 Anti-passback config
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
Note
113
bool bRet = false;
try
{
object objTemp = new object();
bRet = NETClient.GetNewDevConfig(loginID, -1, CFG_CMD_OPEN_DOOR_ROUTE,
ref objTemp, typeof(NET_CFG_OPEN_DOOR_ROUTE_INFO), 5000);
if (bRet)
{
cfg = (NET_CFG_OPEN_DOOR_ROUTE_INFO)objTemp;
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (NETClientExcetion nex)
{
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return bRet;
}
114
MessageBox.Show(nex.Message);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
return bRet;
}
2.2.10.5.1 Introduction
For unlock password, you can call SDK interface to add, delete, query and modify the unlock
password of the access control device.
115
2.2.10.5.3 Process Description
Figure 2-33 Unlock password config
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
116
Step 5 After completing this process, call NETClient. Logout to log out of the device.
Step 6 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
Note
Before configuring combination unlock by multiple persons, add personnel to the device.
User number: Personnel card number.
try
{
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(result));
result.dwSize = (uint)Marshal.SizeOf(result);
Marshal.StructureToPtr(result, pBuf, true);
//package stuParam
stuParam.pBuf = pBuf;
stuParam.nBufLen = Marshal.SizeOf(result);
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLPWD;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
object obj = stuParam;
117
textBox_OpenPwd.Text =
Encoding.UTF8.GetString(update_pwd.szDoorOpenPwd);
textBox_UserID.Text = Encoding.UTF8.GetString(update_pwd.szUserID);
MessageBox.Show("Get succeed");
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
Marshal.FreeHGlobal(pBuf );
}
// Add password
IntPtr pParam = IntPtr.Zero;
IntPtr pBuf = IntPtr.Zero;
NET_CTRL_RECORDSET_INSERT_PARAM stuInsertParam = new
NET_CTRL_RECORDSET_INSERT_PARAM();
NET_CTRL_RECORDSET_INSERT_PARAM stuOutParam = new
NET_CTRL_RECORDSET_INSERT_PARAM();
118
{
stuPwd.sznDoors[i] = m_selectDoorsList[i];
}
}
stuPwd.nDoorNum = m_selectDoorsList.Count;
try
{
pParam =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_PARAM)));
pBuf =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_PWD)));
//package stuInsertParam
stuInsertParam.stuCtrlRecordSetInfo.pBuf = pBuf;
stuInsertParam.stuCtrlRecordSetInfo.nBufLen = Marshal.SizeOf(stuPwd);
stuInsertParam.dwSize = (uint)Marshal.SizeOf(stuInsertParam);
stuInsertParam.stuCtrlRecordSetInfo.dwSize =
(uint)Marshal.SizeOf(stuInsertParam.stuCtrlRecordSetInfo);
stuInsertParam.stuCtrlRecordSetInfo.emType =
EM_NET_RECORD_TYPE.ACCESSCTLPWD;
stuInsertParam.stuCtrlRecordSetResult.dwSize =
(uint)Marshal.SizeOf(typeof(NET_CTRL_RECORDSET_INSERT_OUT));
Marshal.StructureToPtr(stuInsertParam, pParam, true);
stuOutParam =
(NET_CTRL_RECORDSET_INSERT_PARAM)Marshal.PtrToStructure(pParam,
typeof(NET_CTRL_RECORDSET_INSERT_PARAM));
if (bRet && stuOutParam.stuCtrlRecordSetResult.nRecNo > 0)
{
MessageBox.Show("Inster succeed(added successfully. RecNO(Record No.):"
+ stuOutParam.stuCtrlRecordSetResult.nRecNo);
}
else
{
119
MessageBox.Show(NETClient.GetLastError());
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
//free resource
finally
{
Marshal.FreeHGlobal(pParam);
Marshal.FreeHGlobal(pBuf );
}
120
Marshal.StructureToPtr(update_pwd, pBuf, true);
stuParam.pBuf = pBuf;
stuParam.nBufLen = Marshal.SizeOf(update_pwd);
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLPWD;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
Marshal.StructureToPtr(stuParam, pParam, true);
// Remove passsword
bool result = false;
IntPtr pParam = IntPtr.Zero;
IntPtr pBuf = IntPtr.Zero;
NET_CTRL_RECORDSET_PARAM stuParam = new NET_CTRL_RECORDSET_PARAM();
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLPWD;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
stuParam.pBuf = IntPtr.Zero;
stuParam.nBufLen = 0;
try
{
pParam = Marshal.AllocHGlobal(Marshal.SizeOf(stuParam));
121
pBuf = Marshal.AllocHGlobal(Marshal.SizeOf(int.Parse(textBox_RecNo.Text)));
Marshal.StructureToPtr(int.Parse(textBox_RecNo.Text), pBuf, true);
stuParam.pBuf = pBuf;
stuParam.nBufLen = Marshal.SizeOf(int.Parse(textBox_RecNo.Text));
Marshal.StructureToPtr(stuParam, pParam, true);
// clear password
IntPtr pParam = IntPtr.Zero;
NET_CTRL_RECORDSET_PARAM stuParam = new NET_CTRL_RECORDSET_PARAM();
stuParam.emType = EM_NET_RECORD_TYPE.ACCESSCTLPWD;
stuParam.dwSize = (uint)Marshal.SizeOf(stuParam);
pParam = Marshal.AllocHGlobal(Marshal.SizeOf(stuParam));
Marshal.StructureToPtr(stuParam, pParam, true);
122
MessageBox.Show("Clear succeed(cleared successfully)。");
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
//
2.2.11.1.1 Introduction
For unlock records query, you can call SDK interface to query the unlock records of the access control
device. You can set query conditions and number of query entries.
123
2.2.11.1.3 Process Description
Figure 2-34 Record query
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
124
if (IntPtr.Zero == m_FindDoorRecordID)
{
NET_FIND_RECORD_ACCESSCTLCARDREC_CONDITION_EX condition = new
NET_FIND_RECORD_ACCESSCTLCARDREC_CONDITION_EX();
condition.dwSize =
(uint)Marshal.SizeOf(typeof(NET_FIND_RECORD_ACCESSCTLCARDREC_CONDITION_EX));
condition.bTimeEnable = true;
condition.stStartTime = NET_TIME.FromDateTime(dateTimePicker_Start.Value);
condition.stEndTime = NET_TIME.FromDateTime(dateTimePicker_End.Value);
object obj = condition;
listView_DoorRecord.Items.Clear();
}
125
// Get number of query
if (IntPtr.Zero == m_FindDoorRecordID)
{
return;
}
int nCount = 0;
try
{
if (NETClient.QueryRecordCount(m_FindDoorRecordID, ref nCount, 3000))
{
textBox_Count.Text = nCount.ToString();
}
else
{
MessageBox.Show(NETClient.GetLastError());
return;
}
}
catch (NETClientExcetion ex)
{
MessageBox.Show(NETClient.GetLastError());
return;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
126
cardrec.dwSize =
(uint)Marshal.SizeOf(typeof(NET_RECORDSET_ACCESS_CTL_CARDREC));
ls.Add(cardrec);
}
NETClient.FindNextRecord(m_FindDoorRecordID, max, ref retNum, ref ls,
typeof(NET_RECORDSET_ACCESS_CTL_CARDREC), 10000);
BeginInvoke(new Action(() =>
{
foreach (var item in ls)
{
NET_RECORDSET_ACCESS_CTL_CARDREC info =
(NET_RECORDSET_ACCESS_CTL_CARDREC)item;
var listitem = new ListViewItem();
listitem.Text = info.nRecNo.ToString();
listitem.SubItems.Add(info.stuTime.ToString());
listitem.SubItems.Add(info.szCardNo);
listitem.SubItems.Add(info.bStatus.ToString());
listitem.SubItems.Add(info.nDoor.ToString());
listitem.SubItems.Add(info.emMethod.ToString());
if (listView_DoorRecord != null)
{
listView_DoorRecord.BeginUpdate();
listView_DoorRecord.Items.Add(listitem);
listView_DoorRecord.EndUpdate();
}
}
}));
2.2.11.2.1 Introduction
For device log, you can call SDK interface to query the operation log of the access control device by
specifying the log type or the number of queries, or query by pages.
127
NETClient.StopQueryLog Stop querying logs.
Begin
Initialize SDK
NETClient.Init
Get logs
NETClient.QueryNextLog
Log out
NETClient.Logout
End
Process
128
pOutParam: NET_OUT_QUERYNEXTLOG.
Step 6 Call NETClient. StopQueryLog to stop querying logs.
Step 7 After completing this process, call NETClient.Logout to log out of the device.
Step 8 After using all SDK functions, call NETClient.Cleanup to release SDK resources.
btn_StartQuery.Text = "StopQuery";
btn_NextLog.Enabled = true;
btn_GetLogCount.Enabled = true;
}
else
{
NETClient.StopQueryLog(m_FindLogID);
m_FindLogID = IntPtr.Zero;
btn_StartQuery.Text = "StartQuery";
btn_NextLog.Enabled = false;
btn_GetLogCount.Enabled = false;
textBox_LogCount.Text = "";
listView_Log.Items.Clear();
}
//Get number of records
129
NET_IN_GETCOUNT_LOG_PARAM stuIn = new NET_IN_GETCOUNT_LOG_PARAM();
stuIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_GETCOUNT_LOG_PARAM));
NET_OUT_GETCOUNT_LOG_PARAM stuOut = new
NET_OUT_GETCOUNT_LOG_PARAM();
stuOut.dwSize = (uint)Marshal.SizeOf(typeof(NET_OUT_GETCOUNT_LOG_PARAM));
if (NETClient.QueryDevLogCount(loginID, ref stuIn, ref stuOut, 5000))
{
textBox_LogCount.Text = stuOut.nLogCount.ToString();
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
// Query the next record
listView_Log.Items.Clear();
int max = 10;
NET_IN_QUERYNEXTLOG stuIn = new NET_IN_QUERYNEXTLOG();
stuIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_QUERYNEXTLOG));
stuIn.nGetCount = max;
130
BeginInvoke(new Action(() =>
{
for (int i = 0; i < stuOut.nRetCount; i++)
{
IntPtr pDst = IntPtr.Add(stuOut.pstuLogInfo,
Marshal.SizeOf(typeof(NET_LOG_INFO)) * i);
NET_LOG_INFO retInfo =
(NET_LOG_INFO)Marshal.PtrToStructure(pDst, typeof(NET_LOG_INFO));
m_LogNum += 1;
var listitem = new ListViewItem();
listitem.Text = m_LogNum.ToString();
listitem.SubItems.Add(retInfo.stuTime.ToString());
listitem.SubItems.Add(retInfo.szUserName);
listitem.SubItems.Add(retInfo.szLogType);
listitem.SubItems.Add(retInfo.stuLogMsg.szLogMessage);
if (listView_Log != null)
{
listView_Log.BeginUpdate();
listView_Log.Items.Add(listitem);
listView_Log.EndUpdate();
}
}
}));
}
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
}
131
2.3 Access Controller/All-in-one Face Machine
(Second-Generation)
Reference
Reference
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.
132
Interface Description
Get the access control capability (sucha as access control, user,
NETClient.GetDevCaps
card, face, and fingerprint).
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
133
stuOut.stuFaceCaps = new NET_ACCESS_FACE_CAPS();
2.3.7.1.1 Introduction
Call SDK to add, delete, and query the user info fields of the access controllers (including user ID,
person name, type, status, ID card number, valid period, holiday plan, and user permission).
134
2.3.7.1.2 Interface Overview
Table 2-47 Description of user information interface
Interface Description
NETClient.StartFindUserInfo Start query user info
NETClient.DoFindUserInfo Stop getting user info.
NETClient.StopFindUserInfo Stop querying user info.
NETClient.InsertOperateAccessUserService Add or change access control user info.
NETClient.RemoveOperateAccessUserService Delete access control user info.
NETClient.ClearOperateAccessUserService Clear access control user info.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
135
Step 2 Call NETClient.LoginWithHighLevelSecurity to log in to the device.
Step 3 Call NETClient.StartFindUserInfo to start finding the user information.
Step 4 Call NETClient.DoFindUserInfo to obtain the user information.
Step 5 Call NETClient.StopFindUserInfo to stop finding the user information.
Step 6 Call NETClient.InsertOperateAccessUserService to add or change user information; call
NETClient.RemoveOperateAccessUserService to delete user info; call
NETClient.ClearOperateAccessUserService to clear user info.
Step 7 After completing this process, call NETClient. Logout to log out of the device.
Step 8 After using all SDK functions, call NETClient. Cleanup to release SDK resources.
userInfoList.Clear();
136
outInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_ACCESS_USER_INFO)) *
stuFindOut.nMaxNum);
for (int index = 0; index < stuFindOut.nMaxNum; index++)
{
IntPtr outInfoIndex = outInfo + index * Marshal.SizeOf(typeof(NET_ACCESS_USER_INFO));
if (stuOutUserInfo[index].GetType() == typeof(NET_ACCESS_USER_INFO))
//if obj is boxinged type of typeName, some param(ex. dwsize) need trans to unmanaged memory
{
Marshal.StructureToPtr(stuOutUserInfo[index], outInfoIndex, true);
}
else
{
for (int i = 0; i < Marshal.SizeOf(typeof(NET_ACCESS_USER_INFO)); i++)
{
Marshal.WriteByte(outInfoIndex, i, 0);
}
}
}
stuFindOut.pstuInfo = outInfo;
int startNum = 0;
while (true)
{
stuFindIn.nStartNo = startNum;
if (stuFindOut.nRetNum > 0)
{
startNum += stuFindOut.nRetNum;
for (int i = 0; i < stuFindOut.nRetNum; i++)
{
var userinfo =
(NET_ACCESS_USER_INFO)Marshal.PtrToStructure(IntPtr.Add(stuFindOut.pstuInfo,
Marshal.SizeOf(typeof(NET_ACCESS_USER_INFO)) * i), typeof(NET_ACCESS_USER_INFO));
userInfoList.Add(userinfo);
137
}
}
}
NETClient.StopFindUserInfo(m_FindUserID);
//Add or change
private NET_ACCESS_USER_INFO m_UserInfo = new NET_ACCESS_USER_INFO();
m_UserInfo.szUserID = txt_UserID.Text.Trim();
m_UserInfo.szName = txt_Name.Text.Trim();
m_UserInfo.szPsw = txt_Pwd.Text.Trim();
bool result = false;
NET_ACCESS_USER_INFO[] stuInArray = new NET_ACCESS_USER_INFO[1] { m_UserInfo };
NET_EM_FAILCODE[] stuOutErrArray = new NET_EM_FAILCODE[1];
result = NETClient.InsertOperateAccessUserService(m_LoginID, stuInArray, out stuOutErrArray, 5000);
if (!result)
{
for (int i = 0; i < stuOutErrArray.Length; i++)
{
MessageBox.Show(stuOutErrArray[i].emCode.ToString());
}
}
//删除
NET_EM_FAILCODE[] stuOutErrArray = new NET_EM_FAILCODE[1];
string[] InUserid = new string[] { szUserID }; // szUserID:szUserID of users to be deleted
bool result = NETClient.RemoveOperateAccessUserService(m_LoginID, InUserid, out stuOutErrArray,
3000);
if (!result)
{
for (int i = 0; i < stuOutErrArray.Length; i++)
{
MessageBox.Show(stuOutErrArray[i].emCode.ToString());
}
}
2.3.7.2.1 Introduction
Call SDK to add, delete, query, and modify the card information fields of the access control device
(including card number, user ID, and card type).
138
2.3.7.2.2 Interface Overview
Table 2-48 Description of card information interface
Interface Description
NETClient.StartFindCardInfo Start to find the card information.
NETClient.DoFindCardInfo Obtain the card information..
NETClient.StopFindCardInfo Stop finding the card information.
NETClient.InsertOperateAccessCardService Add access control card info.
NETClient.RemoveOperateAccessCardService Delete access control card info.
NETClient.ClearOperateAccessUserService Clear access control card info.
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
139
Process
140
stuFindOut.pstuInfo =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_ACCESS_CARD_INFO)) * stuFindOut.nMaxNum);
141
}
}
NETClient.StopFindCardInfo(cardFindId);
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
//新增
NET_ACCESS_CARD_INFO[] stuInArray = new NET_ACCESS_CARD_INFO[1] { m_CardInfo };
NET_EM_FAILCODE[] stuOutErrArray = new NET_EM_FAILCODE[1];
stuInArray[0].emType = (EM_ACCESSCTLCARD_TYPE)cmb_CardType.SelectedIndex;
stuInArray[0].szCardNo = txt_CardNum.Text;
result = NETClient.InsertOperateAccessCardService(m_LoginID, stuInArray, out stuOutErrArray, 5000);
if (!result)
{
for (int i = 0; i < stuOutErrArray.Length; i++)
{
MessageBox.Show(stuOutErrArray[i].emCode.ToString());
}
}
//更新
NET_ACCESS_CARD_INFO[] stuInArray = new NET_ACCESS_CARD_INFO[1] { m_CardInfo };
NET_EM_FAILCODE[] stuOutErrArray = new NET_EM_FAILCODE[1];
stuInArray[0].emType = (EM_ACCESSCTLCARD_TYPE)cmb_CardType.SelectedIndex;
result = NETClient.UpdateOperateAccessCardService(m_LoginID, stuInArray, out stuOutErrArray,
3000);
if (!result)
{
for (int i = 0; i < stuOutErrArray.Length; i++)
{
MessageBox.Show(stuOutErrArray[i].emCode.ToString());
}
}
//删除
NET_EM_FAILCODE[] stuOutErrArray = new NET_EM_FAILCODE[1];
142
string[] InCardid = new string[] { szCardNo };// szCardNo:szCardNo of users to be deleted.
bool result = NETClient.RemoveOperateAccessCardService(m_LoginID, InCardid, out stuOutErrArray,
3000);
if (!result)
{
for (int i = 0; i < stuOutErrArray.Length; i++)
{
MessageBox.Show(stuOutErrArray[i].emCode.ToString());
}
}
2.3.7.3.1 Introduction
Call SDK to add, delete, query, and modify the face information fields of the access control device
(including user ID and face picture).
143
2.3.7.3.3 Process Description
Figure 2-40 Management of face information
Start
Initialize SDK
NETCLient.Init
Log out
NETClient.Logout
End
Process
144
NET_IN_ACCESS_FACE_SERVICE_GET stuFaceGetIn = new NET_IN_ACCESS_FACE_SERVICE_GET();
stuFaceGetIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_ACCESS_FACE_SERVICE_GET));
stuFaceGetIn.nUserNum = 1;
stuFaceGetIn.szUserID = new NET_IN_ACCESS_FACE_SERVICE_UserID[100];
stuFaceGetIn.szUserID[0] = new NET_IN_ACCESS_FACE_SERVICE_UserID() { userID =
m_UserInfo.szUserID };//m_UserInfo.szUserID;
145
pstOutParam =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_OUT_ACCESS_FACE_SERVICE_GET)));
Marshal.StructureToPtr(stuFaceGetOut, pstOutParam, true);
if (stuFailCode.emCode == EM_FAILCODE.NOERROR)
{
MessageBox.Show(NETClient.GetLastError());
}
else if (stuFailCode.emCode != EM_FAILCODE.UNKNOWN)
{
MessageBox.Show(stuFailCode.emCode.ToString());
}
}
else
{
stuFaceInfo = (NET_ACCESS_FACE_INFO)Marshal.PtrToStructure(get_face_service.pFaceInfo,
typeof(NET_ACCESS_FACE_INFO));
if (stuFaceInfo.nFacePhoto > 0)
{
m_ImageData = new byte[stuFaceInfo.nOutFacePhotoLen[0]];
Marshal.Copy(stuFaceInfo.pFacePhoto[0], m_ImageData, 0,
stuFaceInfo.nOutFacePhotoLen[0]);
using (MemoryStream stream = new MemoryStream(m_ImageData))
{
Image image = Image.FromStream(stream);
pictureBox_face.Image = image;
pictureBox_face.Refresh();
}
}
}
//Add
146
NET_IN_ACCESS_FACE_SERVICE_INSERT stuFaceInsertIn = new
NET_IN_ACCESS_FACE_SERVICE_INSERT();
stuFaceInsertIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_ACCESS_FACE_SERVICE_INSERT));
stuFaceInsertIn.nFaceInfoNum = 1;
stuFaceInsertIn.pFaceInfo = IntPtr.Zero;
stuFaceInsertIn.pFaceInfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_ACCESS_FACE_INFO)));
147
bool result = NETClient.OperateAccessFaceService(m_LoginID,
EM_NET_ACCESS_CTL_FACE_SERVICE.INSERT, pstInParam, pstOutParam, 5000);
var faceinfo = (NET_OUT_ACCESS_FACE_SERVICE_INSERT)Marshal.PtrToStructure(pstOutParam,
typeof(NET_OUT_ACCESS_FACE_SERVICE_INSERT));
if (!result)
{
var failcode = (NET_EM_FAILCODE)Marshal.PtrToStructure(faceinfo.pFailCode,
typeof(NET_EM_FAILCODE));
if (failcode.emCode == EM_FAILCODE.NOERROR)
{
MessageBox.Show(NETClient.GetLastError());
}
else
{
MessageBox.Show(failcode.emCode.ToString());
}
}
//Update
NET_IN_ACCESS_FACE_SERVICE_UPDATE stuFaceUpdateIn = new
NET_IN_ACCESS_FACE_SERVICE_UPDATE();
stuFaceUpdateIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_ACCESS_FACE_SERVICE_UPDATE));
stuFaceUpdateIn.nFaceInfoNum = 1;
stuFaceUpdateIn.pFaceInfo = IntPtr.Zero;
stuFaceUpdateIn.pFaceInfo =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_ACCESS_FACE_INFO)));
148
stuFaceUpdateOut.dwSize =
(uint)Marshal.SizeOf(typeof(NET_OUT_ACCESS_FACE_SERVICE_UPDATE));
stuFaceUpdateOut.nMaxRetNum = 1;
stuFaceUpdateOut.pFailCode = IntPtr.Zero;
stuFaceUpdateOut.pFailCode = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_EM_FAILCODE)));
if (!result)
{
var failcode = (NET_EM_FAILCODE)Marshal.PtrToStructure(faceinfo.pFailCode,
typeof(NET_EM_FAILCODE));
if (failcode.emCode == EM_FAILCODE.NOERROR)
{
MessageBox.Show(NETClient.GetLastError());
}
else
{
MessageBox.Show(failcode.emCode.ToString());
}
}
//Delete
NET_IN_ACCESS_FACE_SERVICE_REMOVE stuFaceRemoveIn = new
NET_IN_ACCESS_FACE_SERVICE_REMOVE();
149
stuFaceRemoveIn.dwSize = (uint)Marshal.SizeOf(typeof(NET_IN_ACCESS_FACE_SERVICE_REMOVE));
stuFaceRemoveIn.nUserNum = 1;
stuFaceRemoveIn.szUserID = new NET_IN_ACCESS_FACE_SERVICE_UserID[100];
stuFaceRemoveIn.szUserID[0] = new NET_IN_ACCESS_FACE_SERVICE_UserID() { userID =
m_UserInfo.szUserID };
if (!result)
{
var failcode = (NET_EM_FAILCODE)Marshal.PtrToStructure(faceinfo.pFailCode,
typeof(NET_EM_FAILCODE));
if (failcode.emCode == EM_FAILCODE.NOERROR)
{
MessageBox.Show(NETClient.GetLastError());
}
else
150
{
MessageBox.Show(failcode.emCode.ToString());
}
}
2.3.7.4.1 Introduction
Call SDK to add, delete, query, and modify the fingerprint information fields of the access control
device (including user ID, fingerprint data packet, and duress fingerprint number).
Begin
Initialize SDK
NETC.lient.Init
Log out
NETCLient.Logout
End
151
Process
152
IntPtr pstOutParam = IntPtr.Zero;
pstOutParam =
Marshal.AllocHGlobal(Marshal.SizeOf(typeof(NET_OUT_ACCESS_FINGERPRINT_SERVICE_GET)));
Marshal.StructureToPtr(stuFingerPrintGetOut, pstOutParam, true);
//Add
m_FingerprintInfo.nPacketNum = 1;
m_FingerprintInfo.nPacketLen = m_PacketLen;
m_FingerprintInfo.szFingerPrintInfo = Marshal.AllocHGlobal(m_PacketLen);
for (int i = 0; i < m_PacketLen; i++)
{
Marshal.WriteByte(m_FingerprintInfo.szFingerPrintInfo, i, FingerPrintInfo[i]);
}
m_FingerprintInfo.nDuressIndex = 0;
if (ckb_Duress.Checked)
{
m_FingerprintInfo.nDuressIndex = 1;
}
//Update
153
for (int i = 0; i < m_PacketLen; i++)
{
Marshal.WriteByte(m_FingerprintInfo.szFingerPrintInfo, (m_FingerprintNum - 1) * m_PacketLen
+ i, FingerPrintInfo[i]);
}
if (ckb_Duress.Checked)
{
m_FingerprintInfo.nDuressIndex = m_FingerprintNum;
}
154
2.3.9 Door Time Config
2.3.9.3.1 Introduction
Configure the holiday group of the device through SDK, including the holiday group name, the start
and end time, and group enabling.
155
2.3.9.3.3 Process Description
Figure 2-42 Holiday group
Start
Initialize
NETClient.Init
Log out
NETClient.Logout
End
Process
156
object obj = stuIn;
bool ret = NETClient.GetOperateConfig(m_LoginID, EM_CFG_OPERATE_TYPE.SPECIALDAY_GROUP,
cmb_Index.SelectedIndex, ref obj, typeof(NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO), 5000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
}
m_SpecialdayGroupInfo = (NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO)obj;
//Configure
m_SpecialdayGroupInfo.bGroupEnable = chb_Enable.Checked;
m_SpecialdayGroupInfo.szGroupName = txt_Name.Text;
object obj = m_SpecialdayGroupInfo;
bool ret = NETClient.SetOperateConfig(m_LoginID, EM_CFG_OPERATE_TYPE.SPECIALDAY_GROUP,
cmb_Index.SelectedIndex, obj, typeof(NET_CFG_ACCESSCTL_SPECIALDAY_GROUP_INFO), 5000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
}
2.3.9.4.1 Introduction
Configure the holiday plan of the device through SDK, including the holiday plan name, enabling,
period, and valid door channel.
157
2.3.9.4.3 Process Description
Figure 2-43 Holiday plan
Start
Initialize SDK
NETClient.Init
Log out
NETClient.Logout
End
Process
158
object obj = stuIn;
bool ret = NETClient.GetOperateConfig(m_LoginID,
EM_CFG_OPERATE_TYPE.SPECIALDAYS_SCHEDULE, cmb_ScheduleGroup.SelectedIndex, ref obj,
typeof(NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO), 5000);
if (!ret)
{
MessageBox.Show(NETClient.GetLastError());
}
m_ScheduleInfo = (NET_CFG_ACCESSCTL_SPECIALDAYS_SCHEDULE_INFO)obj;
//Configure
m_ScheduleInfo.szSchduleName = txt_ScheduleName.Text;
m_ScheduleInfo.bSchdule = chb_ScheduleEnable.Checked;
m_ScheduleInfo.nGroupNo = int.Parse(txt_GroupNum.Text);
159
2.3.11.3 Alarm Records
2.3.11.3.1 Introduction
Query the alarm records of the access control device through the SDK interface.
160
2.3.11.3.3 Process Description
Figure 2-44 Record query
Start
Initialize SDK
NETClient.Init
Number of records
NETClient.QueryRecordCount
Log out
NETClient.Logout
End
Process
161
NET_FIND_NET_RECORD_ACCESS_ALARMRECORD_INFO_CONDITION condition = new
NET_FIND_NET_RECORD_ACCESS_ALARMRECORD_INFO_CONDITION();
condition.dwSize =
(uint)Marshal.SizeOf(typeof(NET_FIND_NET_RECORD_ACCESS_ALARMRECORD_INFO_CONDITION));
condition.stStartTime = NET_TIME.FromDateTime(dateTimePicker_DoorStart.Value);
condition.stEndTime = NET_TIME.FromDateTime(dateTimePicker_DoorEnd.Value);
object obj = condition;
//number of ercords
int nCount = 0;
if (NETClient.QueryRecordCount(m_FindAlarmRecordID, ref nCount, 3000))
{
txt_AlarmRecordCount.Text = nCount.ToString();
}
else
{
MessageBox.Show(NETClient.GetLastError());
}
//query records
int max = 20;
int retNum = 0;
List<object> ls = new List<object>();
for (int i = 0; i < max; i++)
{
NET_RECORD_ACCESS_ALARMRECORD_INFO alarm_rec = new
NET_RECORD_ACCESS_ALARMRECORD_INFO();
alarm_rec.dwSize = (uint)Marshal.SizeOf(typeof(NET_RECORD_ACCESS_ALARMRECORD_INFO));
ls.Add(alarm_rec);
}
NETClient.FindNextRecord(m_FindAlarmRecordID, max, ref retNum, ref ls,
typeof(NET_RECORD_ACCESS_ALARMRECORD_INFO), 10000);
foreach (var item in ls)
162
{
NET_RECORD_ACCESS_ALARMRECORD_INFO info =
(NET_RECORD_ACCESS_ALARMRECORD_INFO)item;
}
//End record query
NETClient.FindRecordClose(m_FindAlarmRecordID);
m_FindAlarmRecordID = IntPtr.Zero;
163
3 Interface Function
3.1 Common Interface
164
Item Description
void SetAutoReconnect(
fHaveReConnectCallBack cbAutoConnect,
Function
IntPtr dwUser
);
[in]cbAutoConnect Reconnection callback.
Parameter
[in]dwUser User parameters for reconnection callback.
Return Value None.
Configure reconnection callback interface. If the callback is set as NULL, the
Note
device will not be reconnected automatically.
165
Item Description
Description Initialize Device.
bool InitDevAccount(
NET_IN_INIT_DEVICE_ACCOUNT pInitAccountIn,
ref NET_OUT_INIT_DEVICE_ACCOUNT pInitAccountOut,
Function
uint dwWaitTime,
string szLocalIp
)
Input parameter, corresponding to
[in]pInitAccountIn
NET_IN_INIT_DEVICE_ACCOUNT structure.
Output parameter, corresponding to
[out]pInitAccountOut
NET_OUT_INIT_DEVICE_ACCOUNT structure.
Parameter [in]dwWaitTime Timeout period.
In the case of single network adapter, szLocalIp can be
left empty.
[in]szLocalIp
In the case of multiple network adapters, fill the host
IP in szLocalIp.
Return Success: TRUE
Value Failure: FALSE
Note None.
166
Item Description
IntPtr LoginWithHighLevelSecurity(
string pchDVRIP,
ushort wDVRPort,
string pchUserName,
Function string pchPassword,
EM_LOGIN_SPAC_CAP_TYPE emSpecCap,
IntPtr pCapParam,
ref NET_DEVICEINFO_Ex deviceInfo
);
[in]pchDVRIP Device IP
167
Item Description
IntPtr RealPlay(
IntPtr lLoginID,
int nChannelID,
Function
IntPtr hWnd,
EM_RealPlayType rType = EM_RealPlayType.Realplay
);
Return value of NETClient.
[in]lLoginID
LoginWithHighLevelSecurity.
Parameter [in]nChannelID Video channel number, an integer increasing from 0.
[in]hWnd Window handle, only valid in Windows system.
[in]rType Live view type.
Success: Non-0
Return Value
Failure: 0
In Windows environment:
When hWnd is valid, the picture is displayed in the corresponding
window.
Note
When hWnd is NULL, the way of getting stream is to get video data by
setting callback function, and then submit the data to users for
processing.
168
Item Description
bool StopRealPlay(
Function IntPtr lRealHandle
);
Parameter [in]lRealHandle Return value of RealPlay.
Success: TRUE
Return Value
Failure: FALSE
Note None.
169
Item Description
bool SetRealDataCallBack(
IntPtr lRealHandle,
fRealDataCallBackEx2 cbRealData,
Function
IntPtr dwUser,
EM_REALDATA_FLAG dwFlag
);
[in]lRealHandle Return value of RealPlay.
[in]cbRealData Callback function for monitoring data flow.
Parameter Parameters of the callback function for monitoring data
[in]dwUser
flow.
[in]dwFlag Type of monitoring data in callback.
Success: TRUE
Return Value
Failure: FALSE
Note None.
170
3.1.6 Alarm Listening
171
Item Description
bool StopListen(
Function IntPtr lLoginID
);
Parameter [in]lLoginID Return value of LoginWithHighLevelSecurity.
Success: TRUE
Return Value
Failure: FALSE
Note None.
172
Item Description
bool SetDeviceMode(
IntPtr lLoginID,
Function EM_USEDEV_MODE emType,
IntPtr pValue
);
[in]lLoginID Return value of LoginWithHighLevelSecurity.
[in]emType Enumerated value.
Parameter
For structure data pointers corresponding to the
[in]pValue
enumerated values.
Success: TRUE
Return Value
Failure: FALSE
Note None.
Table 3-23 Enumation of working modes and structural body
Emulated emType Definition Structural body
EM_USEDEV_MODE. Select a designated format to
NET_DEV_TALKDECODE_INFO
TALK_ENCODE_TYPE realize voice call.
EM_USEDEV_MODE. Configure client method for
None
TALK_CLIENT_MODE voice call.
EM_USEDEV_MODE. Configure speaking parameter
NET_SPEAK_PARAM
TALK_SPEAK_PARAM for voice call.
Configure voice call parameter
EM_USEDEV_MODE.
for the 3rd generation video door NET_TALK_EX
TALK_MODE3
phone.
173
Item Description
Description Stop voice talk.
bool StopTalk(
Function IntPtr lTalkHandle
);
Parameter [in]lTalkHandle Return value of StartTalk
Success: TRUE
Return Value
Failure: FALSE
Note None.
174
Item Description
int TalkSendData(
IntPtr lTalkHandle,
Function IntPtr pSendBuf,
uint dwBufSize
);
[in]lTalkHandle Return value of StartTalk.
Parameter [in]pSendBuf Pointer of audio data blocks to be sent.
[in]dwBufSize Length of audio data blocks to be sent, in bytes.
Length of audio data blocks successfully returned.
Return Value
Return -1 if failed.
Note None.
175
3.2.3 Viewing Device Information
176
Item Description
Success: TRUE,
Return Value
Failure: FALSE
Note None.
177
3.2.4 Network Setting
3.2.4.1 IP Settings
178
Item Description
[in]obj The content you configured.
179
3.2.5.3 DST Setting
180
3.2.6.2 Restart
181
For details of NETClient. ResetSystem, see Table 3-42.
182
emType Meanings
WEB_TYPE WEB upgrade
BOOT_YPE BOOT upgrade
CHARACTER_TYPE Chinese character library
LOGO_TYPE LOGO
EXE_TYPE EXE, such as player
Inherent device information settings (such as hardware
DEVCONSTINFO_TYPE
ID, MAC, SN)
PERIPHERAL_TYPE Peripheral access slave chip (such as vehicle chip)
GEOINFO_TYPE Geographic information positioning chip
MENU Menu (pictures in the device operating interface)
ROUTE Route file (such as bus routes)
ROUTE_STATE_AUTO Bus stop announcement audio (matching with routes)
SCREEN Dispatch screen (such as bus operating screen)
183
Item Description
Description Read device config information.
bool GetDevConfig(
IntPtr lLoginID,
EM_DEV_CFG_TYPE type,
int lChannel,
Function IntPtr lpOutBuffer,
uint dwOutBufferSize,
ref uint bytesReturned,
int waittime
)
[in] lLoginID Device login handle.
Device config command. See EM_DEV_CFG_TYPE
dwCommand
enumation.
Channel number. If all channel data obtained is
[in] lChannel 0xFFFFFFFF and the command does not require
Parameter
channel number, this parameter is invalid.
[out] lpOutBuffer Pointer of received data buffer.
[in] dwOutBufferSize Length of received data buffer (in bytes).
[out] lpBytesReturned Length of data actually received.
[in] waittime Timeout period for waiting.
Success: TRUE
Return Value
Failure: FALSE
Note None.
184
Item Description
Channel number. If all channel data obtained is
[in] lChannel 0xFFFFFFFF and the command does not require
channel number, this parameter is invalid.
[in] lpInBuffer Data buffer pointer.
[in] dwInBufferSize Data buffer length (in bytes).
[in] waittime Timeout period for waiting.
Success: TRUE
Return Value
Failure: FALSE
Note None.
185
3.2.9.2 Always Open and Always Closed Period Config
186
3.2.10.4 Anti-passback
187
Item Description
IntPtr StartQueryLog(
IntPtr lLoginID,
ref NET_IN_START_QUERYLOG pInParam,
Function
ref NET_OUT_START_QUERYLOG pOutParam,
int nWaitTime
)
[in]lLoginID Device login handle.
Parameter for starting querying logs. See
[in] pInParam
NET_IN_START_QUERYLOG for details.
Parameter
Output parameter for starting querying logs. See
[out] pOutParam
NET_OUT_START_QUERYLOG for details.
[in] nWaitTime Timeout period in query.
Success: non 0
Return Value
Failure: 0
Note None.
188
Item Description
Success: TRUE,
Return Value
Failure: FALSE
Description None.
189
Item Description
[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 FindNextRecord function to get the list of records. After the query is
completed, you can call FindRecordClose to close the query handle.
190
Item Description
Success: TRUE
Return Value
Failure: FALSE
Call FindRecord to open the query handle; after the Query is completed, you
Note
should call this function to close the Query for handles.
191
nType Description pInBuf pOutBuf
EM_DEVCAP_TYPE.
Get the access
ACCESSCONTROL_CAP NET_IN_AC_CAPS NET_OUT_AC_CAPS
control capability
S
192
3.3.7.1.2 Getting Personnel Information Interface
193
Item Description
[in] stOutParam1 User info management (output parameter).
[out] stOutParam2 User info Querying error type (input parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Note
Failure: FALSE
Description None.
194
3.3.7.1.7 Access Control User Info Clearing Interface
Table 3-67 Description of access control user info clearing interface
Item Description
Description Access control user info management interface.
bool ClearOperateAccessUserService(
IntPtr lLoginID,
Function
int nWaitTime
)
[in] lLoginID Login handle
Parameter
[in] nWaitTime Timeout duration
Success: TRUE
Return value
Failure: FALSE
Note None.
Table 3-68 Description of card information management interface for access control devices
Item Description
Description Card information management interface for access control devices.
IntPtr StartFindCardInfo(
IntPtr lLoginID,
ref NET_IN_CARDINFO_START_FIND pstIn,
Function
ref NET_OUT_CARDINFO_START_FIND pstOut,
int nWaitTime
)
[in] lLoginID Login handle.
Start Querying for card information interface (input
[in] pstIn
parameter).
Parameter
Start Querying for card information interface (output
[out] pstOut
parameter).
[in] nWaitTime Timeout duration
Success: login handle.
Return value
Failure: 0.
Description None
195
Item Description
bool DoFindCardInfo(
IntPtr lFindHandle,
ref NET_IN_CARDINFO_DO_FIND pstIn,
Function
ref NET_OUT_CARDINFO_DO_FIND pstOut,
int nWaitTime
)
[in] lFindHandle Return value of StartFindCardInfo.
Finding the card information interface (input
[in] pstIn
parameter).
Parameter
Finding the card information interface (output
[out] pstOut
parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
196
Item Description
Success: TRUE
Return value
Failure: FALSE
Note None.
197
Item Description
bool UpdateOperateAccessCardService(
IntPtr lLoginID,
Function NET_ACCESS_CARD_INFO[] stInParam,
out NET_EM_FAILCODE[] stOutParam,
int nWaitTime
[in] lLoginID Login handle.
[in] stInParam Card info management (input parameter)
Parameter
[out] stOutParam Card info management (output parameter)
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Note None.
Table 3-75 Description of face information management interface for access control devices
Item Description
Description Face information management interface for access control devices.
bool OperateAccessFaceService(
IntPtr lLoginID,
EM_NET_ACCESS_CTL_FACE_SERVICE emtype,
Function IntPtr pstInParam,
IntPtr pstOutParam,
int nWaitTime
)
[in] lLoginID Login handle.
[in] emtype Face information operation type.
Parameter [in] pstInParam Face information management (input parameter).
[out] pstOutParam Face information management (output parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Note None.
Table 3-76 Comparison of emtype, pInBuf and pOutBuf
emtype Description pInBuf pOutBuf
EM_NET_ACCESS_CTL_ Add the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE .INSERT information E_SERVICE_INSERT _SERVICE_INSERT
EM_NET_ACCESS_CTL_ Find the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE .GET information E_SERVICE_GET _SERVICE_GET
EM_NET_ACCESS_CTL_ Update the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE .UPDATE information E_SERVICE_UPDATE _SERVICE_UPDATE
198
emtype Description pInBuf pOutBuf
EM_NET_ACCESS_CTL_
Delete the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE .REMOV
information E_SERVICE_REMOVE _SERVICE_REMOVE
E
EM_NET_ACCESS_CTL_ Clear the face NET_IN_ACCESS_FAC NET_OUT_ACCESS_FACE
FACE_SERVICE .CLEAR information E_SERVICE_CLEAR _SERVICE_CLEAR
Table 3-77 Description of fingerprint information management interface for access control devices
Item Description
Description Fingerprint information management interface for access control devices.
bool GetOperateAccessFingerprintService(
IntPtr lLoginID,
string userid,
IntPtr pFingerprintData,
Function
int dataLen,
out NET_ACCESS_FINGERPRINT_INFO stOutParam1,
int nWaitTime
)
[in] lLoginID Login handle.
[in] userid User ID of users to be queried.
[out] pFingerprintData Fingerprint information data (output parameter).
Parameter Fingerprint information data length (output
[out] pFingerprintData
parameter).
[out] stOutParam2 Fingerprint info query error type (output parameter).
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Note None.
199
Item Description
[out] stOutParam Fingerprint info management (output parameter)
[in] nWaitTime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Note None.
200
3.3.8 Door Config
201
Item Description
ref object obj,
Type typeName,
int waittime
)
[in] lLoginID Login handle.
[in] cfg_type Set the type of configuration info.
[in] lChannel Channel number.
Parameter
[out] obj Returned data structural body.
[in] typeName Structural body type.
[in] waittime Timeout period.
Success: TRUE
Return value
Failure: FALSE
Description None.
202
3.3.9.4 Holiday Plan
203
3.3.11.2.4 Ending Record Query
See "3.2.11.1.4 Ending Record Query"
204
4 Callback Function
4.1 Device Querying Callback
Table 4-1 Description of callback function for Querying device
Item Description
Description Callback function for Querying device.
public delegate void fQueryDevicesCB(
IntPtr pDevNetInfo,
Function
IntPtr pUserData
);
[out]pDevNetInfo Device information.
Parameter
[out]pUserData User data.
Return Value None.
Note None.
205
Item Description
[out]nDVRPort Disconnected device port.
[out]dwUser User parameters for callback function.
Return Value None.
Note None.
206
Item Description
Parameter structure for callback data. The type is
different if the dwDataType value is different.
dwDataType is 0, param is null pointer
[out]param dwDataType is 1, param is
NET_VideoFrameParam structural body.
dwDataType is 3, param is
NET_CBPCMDataParam structural body.
[out]dwUser User parameters for callback function.
Return Value None.
Note None.
207
Item Description
bool bAlarmAckFlag,
int nEventID,
IntPtr dwUser
);
[out]lCommand Alarm type. See Table 4-8 for details.
[out]lLoginID Return value of login interface.
Buffer that receives alarm data, which is filled with
[out]pBuf different data according to different listening interfaces
called and lCommand values.
[out]dwBufLen Length of pBuf, in bytes.
Parameter [out]pchDVRIP Device IP.
[out]nDVRPort Port.
[out]bAlarmAckFlag TRUE, the event can be confirmed.
FALSE, the event cannot be confirmed.
[out]nEventID Used to assign value to input parameter AlarmAck. When
bAlarmAckFlag is TRUE, the data is valid.
[out]dwUser User-defined data.
Return Success: TRUE
Value Failure: FALSE
Usually, call the set callback function during application initialization, and process
Note properly in the callback function according to different device ID and command
values.
208
Alarm Alarm type
lCommand pBuf
business name
Device
ALARM_ARMMODE_CHANGE_ NET_ALARM_ARMMODE_CHAN
arming mode
EVENT GE_INFO
change event
Protection
zone bypass ALARM_BYPASSMODE_CHAN NET_ALARM_BYPASSMODE_CH
status change GE_EVENT ANGE_INFO
event
Alarm input
ALARM_INPUT_SOURCE_SIGN NET_ALARM_INPUT_SOURCE_SI
source signal
AL GNAL_INFO
event
Alarm NET_ALARM_ALARMCLEAR_INF
ALARM_ALARMCLEAR
clearing event O
Sub-system
ALARM_SUBSYSTEM_STATE_C NET_ALARM_SUBSYSTEM_STATE
status change
HANGE _CHANGE_INFO
event
Extension
NET_ALARM_MODULE_LOST_IN
module ALARM_MODULE_LOST
FO
offline event
PSTN offline NET_ALARM_PSTN_BREAK_LINE
ALARM_PSTN_BREAK_LINE
event _INFO
Analog
NET_ALARM_ANALOGPULSE_IN
quantity ALARM_ANALOG_PULSE
FO
alarm event
Alarm
ALARM_PROFILE_ALARM_TRA NET_ALARM_PROFILE_ALARM_
transmission
NSMIT TRANSMIT_INFO
event
Wireless
device low ALARM_WIRELESSDEV_LOWP NET_ALARM_WIRELESSDEV_LO
battery alarm OWER WPOWER_INFO
event
Protection
zone arming
and ALARM_DEFENCE_ARMMODE NET_ALARM_DEFENCE_ARMMO
disarming _CHANGE DECHANGE_INFO
status change
event
Sub-system
arming and
ALARM_SUBSYSTEM_ARMMO NET_ALARM_SUBSYSTEM_ARM
disarming
DE_CHANGE MODECHANGE_INFO
status change
event
Detector
NET_ALARM_SENSOR_ABNORM
abnormality ALARM_SENSOR_ABNORMAL
AL_INFO
alarm
209
Alarm Alarm type
lCommand pBuf
business name
Patient
NET_ALARM_PATIENTDETECTIO
activity status ALARM_PATIENTDETECTION
N_INFO
alarm event
Access control NET_ALARM_ACCESS_CTL_EVE
ALARM_ACCESS_CTL_EVENT
event NT_INFO
Details of
access control ALARM_ACCESS_CTL_NOT_CL NET_ALARM_ACCESS_CTL_NOT
unlocking OSE _CLOSE_INFO
event
Details of
ALARM_ACCESS_CTL_BREAK_I NET_ALARM_ACCESS_CTL_BRE
intrusion
N AK_IN_INFO
event
Details of
ALARM_ACCESS_CTL_REPEAT_ NET_ALARM_ACCESS_CTL_REPE
repeated
ENTER AT_ENTER_INFO
entry event
Malicious
ALARM_ACCESS_CTL_MALICI NET_ALARM_ACCESS_CTL_MALI
unlocking
OUS CIOUS
event
Details of
NET_ALARM_ACCESS_CTL_DUR
Access forced card ALARM_ACCESS_CTL_DURESS
ESS_INFO
Control swiping event
Combination
unlocking by NET_ALARM_OPEN_DOOR_GRO
ALARM_OPENDOORGROUP
multiple UP_INFO
persons event
Dismantleme
NET_ALARM_CHASSISINTRUDE
nt prevention ALARM_CHASSISINTRUDED
D_INFO
event
Local alarm
ALARM_ALARM_EX2 NET_ALARM_ALARM_INFO_EX2
event
Access control NET_ALARM_ACCESS_CTL_STAT
ALARM_ACCESS_CTL_STATUS
status event US_INFO
NET_ALARM_ACCESS_CTL_STAT
Bolt alarm ALARM_ACCESS_CTL_STATUS
US_INFO
Fingerprint
NET_ALARM_CAPTURE_FINGER
acquisition ALARM_FINGER_PRINT
_PRINT_INFO
event
No response
to the call in
NET_ALARM_CALL_NO_ANSWE
direct ALARM_CALL_NO_ANSWERED
RED_INFO
Video connection
Intercom event
Mobile phone
NET_ALARM_TELEPHONE_CHEC
number ALARM_TELEPHONE_CHECK
K_INFO
report event
210
Alarm Alarm type
lCommand pBuf
business name
VTS status NET_ALARM_VTSTATE_UPDATE_
ALARM_VTSTATE_UPDATE
report INFO
VTO face
ALARM_ACCESSIDENTIFY NET_ALARM_ACCESSIDENTIFY
recognition
Device
inviting
NET_ALARM_TALKING_INVITE_I
another party ALARM_TALKING_INVITE
NFO
to start talk
event
Device
ALARM_TALKING_IGNORE_INV NET_ALARM_TALKING_IGNORE_
canceling talk
ITE INVITE_INFO
request event
Device
actively NET_ALARM_TALKING_HANGUP
ALARM_TALKING_HANGUP
hanging up _INFO
talk event
Radar
monitoring NET_ALARM_RADAR_HIGH_SPE
ALARM_RADAR_HIGH_SPEED
overspeed ED_INFO
alarm event
211
Item Description
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.
212
Appendix 1 Cybersecurity Recommendations
Cybersecurity is more than just a buzzword: it’s something that pertains to every device that is
connected to the internet. IP video surveillance is not immune to cyber risks, but taking basic steps
toward protecting and strengthening networks and networked appliances will make them less
susceptible to attacks. Below are some tips and recommendations on how to create a more secured
security system.
Mandatory actions to be taken for basic device 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 device
(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 device 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 device network security:
1. Physical Protection
We suggest that you perform physical protection to device, especially storage devices. For
example, place the device 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 device (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 device 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.
213
6. Enable HTTPS
We suggest you to enable HTTPS, so that you visit Web service through a secure communication
channel.
7. MAC Address Binding
We recommend you to bind the IP and MAC address of the gateway to the device, thus reducing
the risk of ARP spoofing.
8. Assign Accounts and Privileges Reasonably
According to business and management requirements, reasonably add users and assign a
minimum set of permissions to them.
9. 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.
10. 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.
11. Secure Auditing
Check online users: we suggest that you check online users regularly to see if the device is
logged in without authorization.
Check device log: By viewing the logs, you can know the IP addresses that were used to log
in to your devices and their key operations.
12. Network Log
Due to the limited storage capacity of the device, 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.
13. Construct a Safe Network Environment
In order to better ensure the safety of device and reduce potential cyber risks, we recommend:
Disable the port mapping function of the router to avoid direct access to the intranet
devices from external network.
The network should be partitioned and isolated according to the actual network needs. If
there are no communication requirements between two sub networks, it is suggested to
use VLAN, network GAP and other technologies to partition the network, so as to achieve
the network isolation effect.
Establish the 802.1x access authentication system to reduce the risk of unauthorized access
to private networks.
Enable IP/MAC address filtering function to limit the range of hosts allowed to access the
device.
214