NetSDK - JAVA Programming Manual (Field Surveillance Unit)
NetSDK - JAVA Programming Manual (Field Surveillance Unit)
Surveillance Unit)
User’s Manual
V1.0.1
Foreword
Safety Instructions
The following categorized signal words with defined meaning might appear in the manual.
Signal Words Meaning
TIPS Provides methods to help you solve a problem or save you time.
Revision History
Version Revision Content Release Time
I
Glossary
This chapter provides the definitions to some of the terms appearing in the Manual to help you
understand the function of each module.
Term Description
This ID uniquely identifies an external device for the monitoring and collection of
Device ID
various data. It is described as DeviceID in the interface structure.
External device monitoring point setting, identified by a unique ID. It is described
Monitoring Point
as ID in the interface structure.
Remote Signaling Monitoring point alarm information.
Telemetering Monitoring data upload of monitoring point.
II
Table of Contents
Foreword ............................................................................................................................................................ I
Glossary ............................................................................................................................................................ II
1 Introduction................................................................................................................................................... 1
1.1 Overview ....................................................................................................................................................................................... 1
1.2 Applicability ................................................................................................................................................................................. 1
1.3 Field Surveillance Unit.............................................................................................................................................................. 2
1.4 Scenes ............................................................................................................................................................................................ 2
2 Main Functions .............................................................................................................................................. 3
2.1 Initializing SDK ............................................................................................................................................................................ 3
2.1.1 Introduction .................................................................................................................................................................... 3
2.1.2 Interface Overview ....................................................................................................................................................... 3
2.1.3 Process Description ...................................................................................................................................................... 3
2.1.4 Example Code ................................................................................................................................................................ 4
2.2 Device Login and Logout ........................................................................................................................................................ 7
2.2.1 Introduction .................................................................................................................................................................... 7
2.2.2 Interface Overview ....................................................................................................................................................... 7
2.2.3 Process Description ...................................................................................................................................................... 7
2.2.4 Example Code ................................................................................................................................................................ 9
2.3 Getting Device List ..................................................................................................................................................................10
2.3.1 Introduction ..................................................................................................................................................................10
2.3.2 Interface Overview .....................................................................................................................................................10
2.3.3 Process Description ....................................................................................................................................................11
2.3.4 Example Code ..............................................................................................................................................................11
2.4 Get Device Point Information. .............................................................................................................................................13
2.4.1 Introduction ..................................................................................................................................................................13
2.4.2 Interface Overview .....................................................................................................................................................13
2.4.3 Process Description ....................................................................................................................................................14
2.4.4 Example Code ..............................................................................................................................................................14
2.5 Subscribing to Monitoring Point Alarm...........................................................................................................................15
2.5.1 Introduction ..................................................................................................................................................................15
2.5.2 Interface Overview .....................................................................................................................................................15
2.5.3 Process Description ....................................................................................................................................................16
2.5.4 Example Code ..............................................................................................................................................................17
2.6 Subscribing to Monitoring Point Information ...............................................................................................................17
2.6.1 Introduction ..................................................................................................................................................................17
2.6.2 Interface Overview .....................................................................................................................................................17
2.6.3 Process Description .................................................................................................................................................... 18
2.6.4 Example Code ..............................................................................................................................................................18
2.7 Subscribing to General Alarm .............................................................................................................................................19
2.7.1 Introduction ..................................................................................................................................................................19
2.7.2 Interface Overview .....................................................................................................................................................20
2.7.3 Process Description ....................................................................................................................................................20
2.7.4 Example Code ..............................................................................................................................................................21
3 Interface Function ....................................................................................................................................... 22
III
3.1 Initializing SDK ..........................................................................................................................................................................22
3.1.1 CLIENT_Init ....................................................................................................................................................................22
3.1.2 CLIENT_Cleanup ..........................................................................................................................................................22
3.1.3 CLIENT_SetAutoReconnect .....................................................................................................................................22
3.1.4 CLIENT_SetNetworkParam ......................................................................................................................................23
3.2 Logging in and out ..................................................................................................................................................................23
3.2.1 CLIENT_LoginWithHighLevelSecurity .................................................................................................................23
3.2.2 CLIENT_Logout ............................................................................................................................................................23
3.3 Searching for Devices CLIENT_QueryDevState ............................................................................................................24
3.4 Get Device Point Information CLIENT_SCADAGetAttributeInfo ............................................................................24
3.5 Subscribing to Monitoring Point Alarm...........................................................................................................................25
3.5.1 CLIENT_SCADAAlarmAttachInfo ...........................................................................................................................25
3.5.2 Stopping Subscription CLIENT_SCADAAlarmDetachInfo ...........................................................................25
3.6 Subscription to Real-time Information of Monitoring Point....................................................................................25
3.6.1 CLIENT_SCADAAttachInfo .......................................................................................................................................25
3.6.2 CLIENT_SCADADetachInfo ......................................................................................................................................26
3.7 Reporting Alarm .......................................................................................................................................................................26
3.7.1 CLIENT_SetDVRMessCallBack.................................................................................................................................26
3.7.2 CLIENT_StartListenEx ................................................................................................................................................27
3.7.3 CLIENT_StopListen .....................................................................................................................................................27
4 Callback ........................................................................................................................................................ 28
4.1 fDisConnect ................................................................................................................................................................................28
4.2 fHaveReConnect .......................................................................................................................................................................28
4.3 fSCADAAlarmAttachInfoCallBack.......................................................................................................................................28
4.4 fMessCallBack ............................................................................................................................................................................29
Appendix 1 Cybersecurity Recommendations ............................................................................................. 30
IV
1 Introduction
1.1 Overview
The Manual introduces SDK interfaces that include main functions, interface functions, and callbacks.
The main functions include: SDK initialization, device login, device list acquisition, subscription to
point information, subscription to real-time information of monitoring point, and subscription to
device status alarm.
The development kit might include different files according to the environment.
For the files included in Windows development kit, see Table 1-1.
Table 1-1 Files included in the development kit
Library Type Library File Name Description
dhnetsdk.h Header file
dhnetsdk.lib Lib file
Function Library
dhnetsdk.dll Library file
avnetsdk.dll Library file
Configuration Library dhconfigsdk.dll Library file
Transcoding Library StreamConvertor.dll Library file
For the files included in Linux development kit, see Table 1-2.
Table 1-2 Files included in the development kit
Library Type Library File Name Description
dhnetsdk.h Header file
Function Library libdhnetsdk.so Library file
libavnetsdk.so Library file
libdhconfigsdk.so Library file
Configuration Library
dhconfigsdk.h Header file
Transcoding Library StreamConvertor.so Library file
1.2 Applicability
1
Linux
Common Linux systems such as Red Hat/SUSE
1.4 Scenes
The unit can be applied to the security in various fields and departments such as energy, natural gas,
mining, telecommunication, power, agriculture, transportation, intelligent communities, factories,
warehouses, resources, and water conservancy facilities.
2
2 Main Functions
2.1 Initializing SDK
2.1.1 Introduction
Initialization is the first step of SDK to conduct all the function modules. It does not have the
surveillance function but can set some parameters that affect the SDK overall functions.
Initialization occupies some memory.
Only the first initialization is valid within one process.
After initialization, call the SDK cleaning up interface to release resource.
Start
End
3
Process Description
Notes
You need to call the interfaces CLIENT_Init and CLIENT_Cleanup in pairs. It supports
single-thread multiple calling in pairs, but it is suggested to call the pair for only one time
overall.
Initialization: Internally calling the interface CLIENT_Init multiple times is only for internal count
without repeating applying resources.
Cleaning up: The interface CLIENT_Cleanup clears all the opened processes, such as login,
real-time monitoring, and alarm subscription.
Reconnection: SDK can set the reconnection function for the situations such as network
disconnection and power off. SDK will keep logging until succeeded. Only the real-time
monitoring and playback function modules can be restored after reconnection.
Load dynamic library: If an error such as “Unable to load library
'./wrongpath/libs/win64/dhnetsdk': Specified module not found” occurred when loading the
dynamic library, the cause is usually path mismatch. You need to adjust the location of the
dynamic library or modify the code according to the error message. This problem often occurs
when packaging the engineering as a jar package to provide to other projects. Because this
problem is related to the platform and engineering usage, it should be analyzed case by case.
For example, when directly using the engineering on the Linux platform, you can load the
dynamic library path to the dynamic library search path through the following method.
1. Enter export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/XXX at the terminal, and the current
terminal takes effect.
2. Modify ~/.bashrc or ~/.bash_profile, add export
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/XXX in the last row, and then save it. Use source.
bashrc to execute the file, and the current user takes effect.
3. Modify /etc/profile, add the same content as item 2, and then save it. Use source to execute
the file, and all users take effect.
import main.java.com.netsdk.lib.NetSDKLib;
import main.java.com.netsdk.lib.NetSDKLib.LLong;
import main.java.com.netsdk.lib.ToolKits;
4
import com.sun.jna.ptr.IntByReference;
/**
* Login interface implementation
* Main functions: Initialization, login, and logout
*/
public class LoginModule {
// Login handle
public static LLong m_hLoginHandle = new LLong(0);
// Initialization
public static boolean init(NetSDKLib.fDisConnect disConnect, NetSDKLib.fHaveReConnect
haveReConnect) {
bInit = netsdk.CLIENT_Init(disConnect, null);
if(!bInit) {
System.out.println("Initialize SDK failed");
return false;
}
5
if(!bLogopen ) {
System.err.println("Failed to open NetSDK log");
}
// Set the reconnection callback interface. After the reconnection callback is successfully set,
when the device is disconnected, the SDK will automatically reconnect it.
// This operation is optional, but it is recommended to set it.
netsdk.CLIENT_SetAutoReconnect(haveReConnect, null);
return true;
}
// Clear environment.
public static void cleanup() {
if(bLogopen) {
netsdk.CLIENT_LogClose();
}
if(bInit) {
netsdk.CLIENT_Cleanup();
}
}
}
6
2.2 Device Login and Logout
2.2.1 Introduction
Device login, also called user authentication, is the precondition of all the other function modules.
You can obtain a unique login ID upon logging in to the device and should pass in login ID before
using other SDK interfaces. The login ID becomes invalid once logged out.
Start
End
Process Description
7
Notes
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 no special function module, it is suggested to log in
only one time. The login handle can be repeatedly used on other function modules.
Handle repetition: The login handle might be the same as an existing handle, which is normal.
For example, if you log in to Device A and get loginID, then cancel loginID, you might get
loginID again when you log in again. However, throughout the life cycle of a handle, the same
handle will not 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
enabled the monitoring function, you should call the interface that stops the monitoring
function when it is no longer required.
Use login and logout in pairs: The login consumes some memory and socket information and
releases sources once logged out.
Login failure: It is suggested to check the failure through the error parameter (login error code)
of the login interface. For common error codes, see Table 2-3.
Login to multiple devices: After SDK initialization, you can log in to multiple devices, but the
corresponding login handle and information need to be adjusted.
Table 2-3 Common error codes and meanings
Error Code Meaning
1 Incorrect password
8 Sub-connection failed.
USB flash drive is not inserted into device, or the USB flash drive information
12
error
8
2.2.4 Example Code
import java.io.File;
import main.java.com.netsdk.lib.NetSDKLib;
import main.java.com.netsdk.lib.NetSDKLib.LLong;
import main.java.com.netsdk.lib.ToolKits;
import com.sun.jna.ptr.IntByReference;
if(m_hLoginHandle.longValue() == 0) {
System.err.printf("Login Device[%s] Port[%d]Failed. %s\n", m_strIp, m_nPort,
9
ToolKits.getErrorCodePrint());
} else {
System.out.println("Login Success ");
}
return bRet;
}
}
2.3.1 Introduction
Get the ID of devices that are connected to the unit.
10
2.3.3 Process Description
Figure 2-3 Process of getting device list
Start
SDK initialization
CLIENT_Init
End
Process Description
11
NET_SCADA_DEVICE_ID_INFO[] stuDeviceIDList = new
NET_SCADA_DEVICE_ID_INFO[nCount];
for (int i = 0; i < stuDeviceIDList.length; ++i) {
stuDeviceIDList[i] = new NET_SCADA_DEVICE_ID_INFO();
}
if (queryDevState(NetSDKLib.NET_DEVSTATE_SCADA_DEVICE_LIST, stuSCADADeviceInfo)) {
System.err.println("Failed to get the IDs of external devices that are connected to the
current unit" + ToolKits.getErrorCode()); // Failed to call the interface
return false;
}
if (stuSCADADeviceInfo.nRet == 0) {
System.out.println("The number of valid IDs of external devices that are connected to
the current unit is 0."); // External devices do not have valid IDs.
return false;
}
12
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
m_lstDeviceID.add(deviceID); // Update the list of external device IDs.
}
return true;
}
2.4.1 Introduction
Get the corresponding monitoring point information according to the ID of each device on the field
surveillance unit.
13
2.4.3 Process Description
Figure 2-4 Process of getting device point information
Start
SDK initialization
CLIENT_Init
End
Process Description
14
conditionInfo.szDeviceID = "A15DFG56".getBytes();
outParam.nMaxAttributeInfoNum = 20;
NET_ATTRIBUTE_INFO attributeInfo = new NET_ATTRIBUTE_INFO();
attributeInfo.write();
outParam.pstuAttributeInfo = attributeInfo.getPointer();
inParam.write();
outParam.write();
boolean ret = netsdkApi.CLIENT_SCADAGetAttributeInfo(m_hLoginHandle,
inParam.getPointer(), outParam.getPointer(), 3000);
if (ret){
System.out.println("SCADAGetAttributeInfo succeed!");
outParam.read();
int retAttributeInfoNum = outParam.nRetAttributeInfoNum;
for (int i = 0; i < retAttributeInfoNum; i++) {
NET_ATTRIBUTE_INFO out = new NET_ATTRIBUTE_INFO();
ToolKits.GetPointerDataToStruct(outParam.pstuAttributeInfo, 0, out);
System.out.println(out.emStatus);
}
}
2.5.1 Introduction
Monitor the alarm information of each monitoring point.
15
2.5.3 Process Description
Figure 2-5 Process of monitoring point alarm information
Start
SDK initialization
CLIENT_Init
End
Process Description
16
2.5.4 Example Code
/**
* Subscribe to monitoring point alarm information.
*/
public void scadaAlarmAttach() {
// Input parameter
NET_IN_SCADA_ALARM_ATTACH_INFO stIn = new
NET_IN_SCADA_ALARM_ATTACH_INFO();
stIn.cbCallBack = SCADAAlarmAttachInfoCallBack.getInstance();
// Output parameter
NET_OUT_SCADA_ALARM_ATTACH_INFO stOut = new
NET_OUT_SCADA_ALARM_ATTACH_INFO();
m_hAlarmAttachHandle = netsdkApi.CLIENT_SCADAAlarmAttachInfo(m_hLoginHandle,
stIn, stOut, 3000);
if (m_hAlarmAttachHandle.longValue() != 0) {
System.out.println("Successfully subscribed to monitoring point alarm information.");
} else {
System.err.println("Failed to subscribe to monitoring point alarm information." +
ToolKits.getErrorCode());
}
}
2.6.1 Introduction
Monitor the information upload of each monitoring point.
17
2.6.3 Process Description
Figure 2-6 Process of monitoring point information
Start
SDK initialization
CLIENT_Init
End
Process Description
18
public void case_scada_real_attach() {
// Input parameter
NET_IN_SCADA_ATTACH_INFO stIn = new NET_IN_SCADA_ATTACH_INFO();
stIn.cbCallBack = SCADAAttachInfoCallBack.getInstance();
stIn.emPointType = EM_NET_SCADA_POINT_TYPE.EM_NET_SCADA_POINT_TYPE_ALL;
// Output parameter
NET_OUT_SCADA_ATTACH_INFO stOut = new NET_OUT_SCADA_ATTACH_INFO();
/**
* Cancel real-time information of monitoring point
*/
public void case_scada_real_detach() {
if (m_hAttachHandle.longValue() != 0) {
netsdkApi.CLIENT_SCADADetachInfo(m_hAttachHandle);
m_hAttachHandle.setValue(0);
}
}
2.7.1 Introduction
Alarm reporting method: Use NetSDK to log in to the device and subscribe to the alarm function
from the device. When the device detects the alarm event, it will send the event to NetSDK
immediately. You can get the corresponding alarm information through the alarm callback.
19
2.7.2 Interface Overview
Table 2-8 Description of alarm reporting interfaces
Interface Description
CLIENT_SetDVRMessCallBack Set alarm callback interface.
CLIENT_StartListenEx Extension interface for subscribing to alarm.
CLIENT_StopListen Stop subscribing to alarm.
Start
SDK initialization
CLIENT_Init
End
Process Description
20
Step 3 Call CLIENT_LoginWithHighLevelSecurity to log in to the device.
Step 4 Call CLIENT_StartListenEx to subscribe to alarm from the device. After successful
subscription, alarm events reported by the device are notified to you through the callback
set in the CLIENT_SetDVRMessCallBack function.
Step 5 After using the alarm reporting function, call CLIENT_StopListen to stop subscribing to
alarm from the device.
Step 6 Call CLIENT_Logout to log out of the device.
Step 7 After using NetSDK, call CLIENT_Cleanup to release NetSDK resource.
/**
* Unsubscribe from alarm information
*/
public void case_stopListen() {
if (bListening) {
System.out.println("Unsubscribe from alarm information.");
netsdkApi.CLIENT_StopListen(m_hLoginHandle);
bListening = false;
}
}
21
3 Interface Function
3.1 Initializing SDK
3.1.1 CLIENT_Init
Table 3-1 SDK Initialization CLIENT_Init
Item Description
Description Initialize the SDK
public boolean CLIENT_Init(
Methods
Callback cbDisConnect, Pointer dwUser);
[in]cbDisConnect Disconnection callback
Parameter
[in]dwUser User parameters for disconnection callback
Success: TRUE
Return Value
Failure: FALSE
Prerequisite for calling other functions of the network SDK
Description When the callback is set as NULL, the device will not be called back to
the user after disconnection
3.1.2 CLIENT_Cleanup
Table 3-2 SDK Cleaning UP CLIENT_Cleanup
Item Description
Description Clean up SDK
Methods public void CLIENT_Cleanup();
Parameter None
Return Value None
Description SDK cleaning up interface is finally called before the end
3.1.3 CLIENT_SetAutoReconnect
Table 3-3 Set Reconnection Callback CLIENT_SetAutoReconnect
Item Description
Description Set auto reconnection callback
public void CLIENT_SetAutoReconnect(
Methods
Callback cbAutoConnect, Pointer dwUser);
[in]cbAutoConnect Reconnection callback
Parameter
[in]dwUser User parameters for reconnection callback
Return Value None
Set reconnection callback interface. If the callback is set as NULL, the device will not
Description
be reconnected automatically
22
3.1.4 CLIENT_SetNetworkParam
Table 3-4 Set Network Parameter CLIENT_SetNetworkParam
Item Description
Description Set related parameters of network environment
public void CLIENT_SetNetworkParam(
Methods
NET_PARAM pNetParam);
Network delay, number of reconnections, buffer size
Parameter [in]pNetParam
and other parameters
Return Value None
Description You can adjust parameters according to the actual network environment
3.2.1 CLIENT_LoginWithHighLevelSecurity
Table 3-5 Log in to device CLIENT_LoginWithHighLevelSecurity
Item Description
Description The user logs in to the device
public LLong CLIENT_LoginWithHighLevelSecurity(
Methods NET_IN_LOGIN_WITH_HIGHLEVEL_SECURITY pstInParam,
NET_OUT_LOGIN_WITH_HIGHLEVEL_SECURITY pstOutParam);
[in]pstInParam Input parameter
Parameter
[out]pstOutParam Output parameter
Success: Login handle
Return Value
Failure: 0
This method is packaged in the NetSDKLib interface and called as follows:
Description m_hLoginHandle = netsdk.CLIENT_CLIENT_LoginWithHighLevelSecurity(pstInParam,
pstOutParam);
3.2.2 CLIENT_Logout
Table 3-6 Log out of device CLIENT_Logout
Item Description
Description The user logs out of the device
Methods public boolean CLIENT_Logout(LLong lLoginID);
Parameter [in]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity
Success: TRUE
Return Value
Failure: FALSE
This method is packaged in the NetSDKLib interface and called as follows:
Description
netsdk.CLIENT_Logout(m_hLoginHandle);
23
3.3 Searching for Devices CLIENT_QueryDevState
24
3.5 Subscribing to Monitoring Point Alarm
3.5.1 CLIENT_SCADAAlarmAttachInfo
Table 3-9 Enable subscription CLIENT_SCADAAlarmAttachInfo
Item Description
Description Start subscription to intelligent event
public LLong CLIENT_SCADAAlarmAttachInfo(LLong lLoginID,
Methods NET_IN_SCADA_ALARM_ATTACH_INFO pInParam,
NET_OUT_SCADA_ALARM_ATTACH_INFO pOutParam, int nWaitTime);
[in]lLoginID Return value of CLIENT_LoginWithHighLevelSecurity
[in] pInParam Input parameter
Parameter
[out] pOutParam Output parameter
[in] nWaitTime Timeout period, in ms
Success: Subscription handle of LLONG type
Return Value
Failure: 0
Description If the interface fails to return, call CLIENT_GetLastError to get the error code
3.6.1 CLIENT_SCADAAttachInfo
Table 3-11 Subscribe to real-time information of monitoring point CLIENT_SCADAAttachInfo
Item Description
Description Subscribing to real-time information of monitoring point
public LLong CLIENT_SCADAAttachInfo(LLong lLoginID,
Function NET_IN_SCADA_ATTACH_INFO pInParam, NET_OUT_SCADA_ATTACH_INFO
pOutParam, int nWaitTime);
25
Item Description
[in]lLoginID Return value of LoginWithHighLevelSecurity
[in]pInParam Subscription input parameter
Parameter
[out]pOutParam Subscription output parameter
[in]waittime Waiting time
Success: Non-0 value
Return Value
Failure: 0
Description None
3.6.2 CLIENT_SCADADetachInfo
Table 3-12 Unsubscribe from Point Information CLIENT_SCADADetachInfo
Item Description
Description Unsubscribe from point information
Function public boolean CLIENT_SCADADetachInfo(LLong lAttachHandle);
Parameter [in]lAttachHandle Return value of CLIENT_SCADAAttachInfo
Success: TRUE
Return Value
Failure: FALSE
Description None
3.7.1 CLIENT_SetDVRMessCallBack
Table 3-13 Set alarm callback CLIENT_SetDVRMessCallBack
Item Description
Description Set alarm callback
Function public void CLIENT_SetDVRMessCallBack(Callback cbMessage, Pointer dwUser);
Message callback, which can call back the device
status, such as alarm status
[in]cbMessage
Parameter When the value is set as 0, it means callback is
forbidden
[in]dwUser User-defined data
Return
None
Value
Set device message callback to get the current device status information; this
function is independent of the calling sequence, and the NetSDK is not called
Description back by default
The callback fMessCallBack must call the alarm message subscription interface
StartListenEx first before it takes effect
26
3.7.2 CLIENT_StartListenEx
Table 3-14 Subscribe to alarm CLIENT_StartListenEx
Item Description
Description Subscribe to alarm
Function public boolean CLIENT_StartListenEx(LLong lLoginID);
Parameter [in]lLoginID Return value of LoginWithHighLevelSecurity
Return Success: TRUE
Value Failure: FALSE
Subscribe to device message, and the message received is called back from the set
Description
value of SetDVRMessCallBack
3.7.3 CLIENT_StopListen
Table 3-15 Stop subscribing to alarm CLIENT_StopListen
Item Description
Description Stop subscribing to alarm
Function public boolean CLIENT_StopListen(LLong lLoginID);
Parameter [in]lLoginID Return value of LoginWithHighLevelSecurity
Success: TRUE
Return Value
Failure: FALSE
Description None
27
4 Callback
4.1 fDisConnect
Table 4-1 Disconnection callback fDisConnect
Item Description
Description Disconnection callback
public interface fDisConnect extends StdCallCallback {
public void invoke(
LLong lLoginID,
Function
String pchDVRIP, int nDVRPort,
Pointer dwUser);
}
[out]lLoginID Return value of Client.LoginWithHighLevelSecurity
[out]pchDVRIP Disconnected device IP
Parameter
[out]nDVRPort Disconnected device port
[out]dwUser User parameters for callback
Return Value None
Description None
4.2 fHaveReConnect
Table 4-2 Reconnection callback fHaveReConnect
Item Description
Description Reconnection callback
public interface fHaveReConnect extends StdCallCallback {
public void invoke(
LLong lLoginID,
Function
String pchDVRIP, int nDVRPort,
Pointer dwUser);
}
[out]lLoginID Return value of Client.LoginWithHighLevelSecurity
[out]pchDVRIP Reconnected device IP
Parameter
[out]nDVRPort Reconnected device port
[out]dwUser User parameters for callback
Return Value None
Description None
4.3 fSCADAAlarmAttachInfoCallBack
Table 4-3 Data callback fSCADAAlarmAttachInfoCallBack
28
Item Description
Description Telemetering callback
public interface fSCADAAlarmAttachInfoCallBack extends Callback {
public void invoke(LLong lAttachHandle,
Function NET_SCADA_NOTIFY_POINT_ALARM_INFO_LIST pInfo, int nBufLen, Pointer
dwUser);
}
[out]lAttachHandle Return value of Client_SCADAAttachInfo
[out]pInfo Alarm message data
Parameter
[out]nBuffer Address of alarm message data block
[out]dwUser User parameters for callback
Return Value None
Description None
4.4 fMessCallBack
Table 4-4 Alarm callback fMessCallBack
Item Description
Description alarm callback
public interface fMessCallBack extends Callback{
public boolean invoke(int lCommand, LLong lLoginID, Pointer pStuEvent,
Function
int dwBufLen, String strDeviceIP, NativeLong nDevicePort, Pointer dwUser);
}
[out]lLoginID Return value of Client.LoginWithHighLevelSecurity
Monitor and collect alarm events of devices
[out]Command
(corresponding structure ALARM_SCADA_DEV_INFO)
[out]pStuEvent Monitor and collect alarm events of devices
Parameter
[out]nBufLen Length of reported information data block, in bytes
[out]nDeviceIP Device IP
[out]nDevicePort Device port
[out]dwUser User parameters for callback
Return Value None
Description None
29
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.
30
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.
31