Device Network SDK Programming Manual (IPC) PDF
Device Network SDK Programming Manual (IPC) PDF
Device Network SDK Programming Manual (IPC) PDF
(For IPC)
I
Device Network SDK User Manual
Index
Index.................................................................................................................................................. I
1 SDK Overview ............................................................................................................................ 1
2 SDK Version Update................................................................................................................... 4
3 API Calling Procedure ................................................................................................................ 5
3.1 Main calling procedure of SDK .................................................................................... 5
3.2 Live view procedure .................................................................................................... 7
3.3 Playback and download procedure ............................................................................. 9
3.4 Parameter configuration procedure .......................................................................... 10
3.5 Remote device maintainence procedure .................................................................. 11
3.6 Voice talk or voice forward procedure ...................................................................... 12
3.7 Alarm procedure ....................................................................................................... 13
3.7.1 Alarm (arming) procedure .............................................................................. 13
3.7.2 Alarm (listening) procedure ............................................................................ 14
3.8 Transparent channel setup procedure ...................................................................... 15
4 API Calling Example ................................................................................................................. 16
4.1 Example code of live view ......................................................................................... 16
4.2 Example code of playback and download ................................................................. 20
4.3 Example code of parameter configuration ................................................................ 28
4.4 Example code of remote device maintainence ......................................................... 29
4.5 Example code of voice talk and voice forward .......................................................... 32
4.6 Example code of alarm .............................................................................................. 33
4.7 Example code of transparent channel....................................................................... 37
5 API Description ........................................................................................................................ 40
5.1 SDK Initialization ..................................................................................................... 40
5.1.1 Initialize SDK: NET_DVR_Init ........................................................................... 40
5.1.2 Release SDK resource: NET_DVR_Cleanup ..................................................... 40
5.1.3 Set network connection timeout and connection attempt times:
NET_DVR_SetConnectTime............................................................................................. 40
5.1.4 Set reconnecting time interval: NET_DVR_SetReconnect .............................. 41
5.1.5 Get the dynamic IP address of the device by IP server or EasyDDNS:
NET_DVR_GetDVRIPByResolveSvr_EX ............................................................................ 41
5.2 Exception Message Callback...................................................................................... 42
5.2.1 Register window handle or callback function to receive exception,
reconnection or other message: NET_DVR_SetExceptionCallBack_V30 ........................ 42
5.3 SDK Information and Log........................................................................................... 44
5.3.1 Get SDK version: NET_DVR_GetSDKVersion ................................................... 44
5.3.2 Get SDK version and build information: NET_DVR_GetSDKBuildVersion ....... 44
5.3.3 Get SDK current state: NET_DVR_GetSDKState .............................................. 45
5.3.4 Get SDK ability: NET_DVR_GetSDKAbility ....................................................... 45
5.3.5 Start writing log to file: NET_DVR_SetLogToFile ............................................. 45
II
Device Network SDK User Manual
Set the callback function of the alarm message uploaded by the device ....................... 75
5.16.1 Register the callback function to receive the alarm message:
NET_DVR_SetDVRMessageCallBack_V30........................................................................ 75
Arm and disarm ............................................................................................................... 76
5.16.2 Setup the uploading channel of alarm meassge:
NET_DVR_SetupAlarmChan_V30 .................................................................................... 76
5.16.3 Close the uploading channel of alarm message:
NET_DVR_CloseAlarmChan_V30 .................................................................................... 76
5.17 Alarm of Listening Mode ........................................................................................... 76
Listening 76
5.17.1 Start listening to receive the alarm message uploaded actively by the device:
NET_DVR_StartListen_V30 .............................................................................................. 76
5.17.2 Stop listening (support multi-thread): NET_DVR_StopListen_V30 ................. 78
5.18 PTZ Control ................................................................................................................ 78
PTZ control operation ...................................................................................................... 78
5.18.1 PTZ control (requires starting live view firstly): NET_DVR_PTZControl........... 78
5.18.2 PTZ control (not require live view before calling it):
NET_DVR_PTZControl_Other .......................................................................................... 79
5.18.3 PTZ control with speed (requires starting live view firstly):
NET_DVR_PTZControlWithSpeed.................................................................................... 80
5.18.4 PTZ control with speed (not require live view before calling it):
NET_DVR_PTZControlWithSpeed_Other ........................................................................ 82
PTZ preset operation ....................................................................................................... 83
5.18.5 PTZ preset operation (requires starting live view firstly): NET_DVR_PTZPreset
83
5.18.6 PTZ preset operation: NET_DVR_PTZPreset_Other ........................................ 84
PTZ Patrol operation........................................................................................................ 84
5.18.7 PTZ patrol operation (requires starting live view firstly): NET_DVR_PTZPCruise
84
5.18.8 PTZ patrol operation: NET_DVR_PTZPCruise_Other ....................................... 85
PTZ pattern operation ..................................................................................................... 86
5.18.9 PTZ pattern operation(requires starting live view firstly): NET_DVR_PTZTrack
86
5.18.10 PTZ pattern operation: NET_DVR_PTZTrack_Other ........................................ 87
Transparent PTZ Control .................................................................................................. 87
5.18.11 Tansparent PTZ control(requires starting live view firstly): NET_DVR_TransPTZ
87
5.18.12 Tansparent PTZ control: NET_DVR_TransPTZ_Other ...................................... 88
PTZ Region Zoom control ................................................................................................ 88
5.18.13 PTZ control to enlarge or narrow the selected image region (requires starting
live view firstly): NET_DVR_PTZSelZoomIn ..................................................................... 88
5.18.14 PTZ control to enlarge or narrow the selected image region:
NET_DVR_PTZSelZoomIn_Ex ........................................................................................... 89
Get patrol path of IP dome .............................................................................................. 89
V
Device Network SDK User Manual
5.21.2 Send data to the serial port of the device by transparent channel:
NET_DVR_SerialSend .................................................................................................... 104
5.21.3 Close the transparent channel: NET_DVR_SerialStop .................................. 104
5.22 Send data to the serial port directly........................................................................ 104
5.22.1 Send data to the serial port directly, and it dosn not require to setup
transparent channel: NET_DVR_SendToSerialPort ....................................................... 104
5.22.2 Send data to RS232 directly and it doesn’t require to setup transparent
channel: NET_DVR_SendTo232Port .............................................................................. 105
5.23 Hard Disk Management........................................................................................... 105
5.23.1 Remotely format hard disk of the device: NET_DVR_FormatDisk ................ 105
5.23.2 Get the format progress: NET_DVR_GetFormatProgress ............................. 105
5.23.3 Close the formatting handle, and release the resource:
NET_DVR_CloseFormatHandle ..................................................................................... 106
5.24 Device Maintenance Management ......................................................................... 106
Get device work state.................................................................................................... 106
5.24.1 Get work state of the device: NET_DVR_GetDVRWorkState_V30 ................ 106
Remote upgrade ............................................................................................................ 107
5.24.2 Set the networt environment of remote upgrade:
NET_DVR_SetNetworkEnvironment ............................................................................. 107
5.24.3 Remote upgrade: NET_DVR_Upgrade ........................................................... 107
5.24.4 Get the progress of the remote upgrade: NET_DVR_GetUpgradeProgress .. 108
5.24.5 Get the state of the remote upgrade: NET_DVR_GetUpgradeState ............. 108
5.24.6 Get the step information of the remote upgrade: NET_DVR_GetUpgradeStep
108
5.24.7 Close the upgrade handle, and release the resource:
NET_DVR_CloseUpgradeHandle ................................................................................... 109
Log Query ...................................................................................................................... 109
5.24.8 Query the log information of the device (supports to search log with
S.M.A.R.T information): NET_DVR_FindDVRLog_V30 ................................................... 109
5.24.9 Get the log one by one: NET_DVR_FindNextLog_V30 .................................. 115
5.24.10 Stop querying the log and release the resource: NET_DVR_FindLogClose_V30
116
Remote backup ............................................................................................................. 116
5.24.11 Backup record files, pictures, or log information: NET_DVR_Backup ........... 116
Restore device default configuration ............................................................................ 117
5.24.12 Restore device default configuration: NET_DVR_RestoreConfig .................. 117
Import or export configuration file ............................................................................... 117
5.24.13 Export the configuration file from the device: NET_DVR_GetConfigFile_V30
117
5.24.14 Export the configuration file from the device: NET_DVR_GetConfigFile...... 117
5.24.15 Import the configuration file to the device: NET_DVR_SetConfigFile_EX .... 118
5.24.16 Import the configuration file to the device: NET_DVR_SetConfigFile .......... 118
5.25 Shutdown and Reboot............................................................................................. 118
5.25.1 Reboot the device: NET_DVR_RebootDVR ................................................... 118
VII
Device Network SDK User Manual
1 SDK Overview
The device network SDK is developed based on private network communication protocol,
and it is designed for the remote connection and configuration of embedded devices. This
document is mainly for IP camera and IP dome.
This document introduces only the major function supported by IPC and IP dome, and
please get more information about other function and related structures from “Device Network
SDK Programming Manual.chm”.
The device network SDK has both Windows and Linux version.
2. Linux version (32bit or 64bit SDK) supports the system that gcc-v is 4.1 or above. The
tested system have RedHat AS 5/6, (Fedora)FC10/12, CentOS 5, SUSE 10, openSUSE 11, and
Ubuntu 9.04/10.04. The SDK has the files:
libPlayCtrl.so SO file
HCNetSDK is required to be loaded for client development, and the other '.dll' files are
optional components.
The network communication library is the main functional part of the device network SDK.
It is used for communication between the client and devices, including remote control &
configuration, video stream acquiring and handling, etc; and network communication library
will dynamically loading RTSP communication library, Software decoding library, Hardware
decoding library, etc. Network communication library combines a lot of functions from the
Software decoding library and Hardware decoding library to facilitate the programming work.
However, it is suggested the users to get video stream from 'HCNetSDK.dll', and call relative
APIs in the Software decoding library or Hardware decoding library directly if you want to
build a system with more complete functions, or in a more flexible way.
RTSP Communication Library supports to get stream from the device by RTSP protocol.
Users must load this component for stream of the devices that use RTSP protocol.
Encapsulation transformation library function can be divided into two pieces: one is
converting standard stream data to private encapsulation format stream data. When users
need to capture private format stream data from products supporting RTSP protocol(that is
setting callback function ofNET_DVR_RealPlay_V30 interface for capturing data or
callNET_DVR_SetRealDataCallBack interface to capture data), must load this component.
Another is converting standard stream data to other package format, such as 3GPP,PS and so
on. For example, when users need to capture specific package format real-time stream data
from products supporting RTSP protocol(corresponding SDK interface is
NET_DVR_SaveRealData), must load this component.
Voice talk library is used for voice talk to encode or decode th audio data according to the
assigned format. The SDK of V4.2.2.5 or earlier versions, it uses Windows API to realize the
related function. For the later version, it supports calling NET_DVR_SetSDKLocalConfig to
select the mode. OpenAL32.dll is the dependent librariy of AudioIntercom.dll, and must load
it in the mode of using voice talk library. There is no voice talk function in Linux system.
3
Device Network SDK User Manual
Before calling NET_DVR_GetDeviceAbility to get the capability set of devices, we can enable
the simulate capability set by calling NET_DVR_SetSDKLocalConfig, and then "LocalXml.zip"
should be loaded (should be loaded in the same path with Network Communication Library).
The Qos library is stream bitrate control library, used for push mode SDK.
Software Decoding Library is used for decoding real-time video stream (remote live view),
playback files, etc. It has included standard stream decoding function. If users needs to play
real-time stream or recoding data and display(i.e. the second structure parameter play
handle of NET_DVR_RealPlay_V30 interface set to effective), must load this component.
However, if users just need to use it for capturing data, then do external operation, needn't
load this component, this way is more flexible. Linux 64bit does not support the software
decoding function, and the window handle when calling the API of live view or playback
should be set to NULL, just to get stream from the device while not decode and display.
Hardware Decoding Library can only be used when there is MDI card. For IPC and IP dome,
it is not required.
4
Device Network SDK User Manual
Version 4.1.0(2012-5-9)
New APIs of thermal network camera:
NET_DVR_ShutterCompensation, NET_DVR_CorrectDeadPixel
New APIs of IPC v4.0
NET_DVR_FocusOnePush, NET_DVR_ResetLens, NET_DVR_RemoteControl
New configuration function:
NET_DVR_AUDIO_INPUT_PARAM, NET_DVR_CAMERA_DEHAZE_CFG, NET_IPC_AUX_ALARMCFG
New alarm type:
NET_IPC_AUXALARM_RESULT
New capability set:
DEVICE_ALARM_ABILITY
Version 4.1.0(2012-4-5)
New APIs to encode and decode G726 audio data:
NET_DVR_InitG726Encoder, NET_DVR_EncodeG726Frame, NET_DVR_ReleaseG726Encoder、
NET_DVR_InitG726Decoder, NET_DVR_DecodeG726Frame, NET_DVR_ReleaseG726Decoder
5
Device Network SDK User Manual
The part in dashed box is optional and will not affect the function and use of other process
and modules. It can be divided into ten parts by different realization functions. The following four
parts: initialize SDK, user register devices, logout and release SDK resource is essential to each
module.
SDK initial(NET_DVR_Init): Initialization of the whole network SDK, operations like memory
pre-allocation.
Set connection timeout (NET_DVR_SetConnectTime ):This part is optional, and used to set
6
Device Network SDK User Manual
the network connection timeout of SDK. User can set this value to their own needs. You will
use the default value when you don't call this interface to set timeout.
Set reception message callback function(NET_DVR_SetDVRMessage or
NET_DVR_SetExceptionCallBack_V30):Most module functions of the SDK are achieved by
the asynchronous mode, so we provide this interface for receiving reception message of
preview, alarm, playback, transparent channel and voice talk process. Clients can set this
callback function after initializing SDK, receive process exception message of each module in
application layer.
Obtain the device IP address from IP analyze server(NET_DVR_GetDVRIPByResolveSvr_Ex):
This interface provides a way to obtain device IP address information from IP analyze server
when just know the device name and serial number. Such as: the current device obtain a
dynamic IP address via dial-up access, and PC runs IPServer software can be aan analyze
server, we could input the analyze server IP address, device name and serial number for
searching the IP address of this device. IPServer is a domain name analyze server software
provided by us.
User register to device(NET_DVR_Login_V30 ): Realize user register function,After registering
sucessfully,The returned user ID as a Unique identifier for other function operations. The
max register users is 512. IPC or IP dome permits 16 register user names and at most 128
user register.
Preview module:Get real-time stream data from front-end sever, functions like decoding
display and play control, and support software and hardware decoding at the same time.
See the specific process Live View Module Procedure.
Playback and download module:Remote playback or download the record files in front-end
server by time or file name, then do decoding or storing. Also supports HTTP functionality.
See the specific process Playback and Download Module Procedure.
Parameter configuration module: set and retrieve the parameters of front-end server,
including information like device parameters, network parameters, channel compression
parameters, serial port parameters, alarm parameters, abnormal parameters, transaction
information and user configuration parameters. See Parameter Configuration Module
Procedure.
Remote equipment maintenance module: imlementing trun off the device, restart the
device, resotre the default values, format a remote HDD, remote upgrade and configuration
file import/export. See Remote Device Maintenance Module Procedure.
Voice talk and forward module: implement voice talk with front-end and obtain voice data,
audio encoding format can be specified. See Voice Talk And Forward Module Procedure.
Alarm module: handle all kinds of alarm signals uploaded by front-end. Alarm can be
devided into two ways into "arm" and "listen", it doesn't require you to do operations like
"user register" when using "listen" module and without the need of obtain user ID. See the
specific process Alarm Module Procedure.
Transparent channel module: transparent channel is a technology that analyzing data
packets and sent diretly to serial prot. Actually an extension of serail device control in
distance. You can use IP network to control serial device, such as decoder, matrix, alarm
host,access control, instrumentation and other serial devices, user only see point to point
transparent, without concern for network transmission process, so it's called a transparent
7
Device Network SDK User Manual
serial channel. Network SDK provides 485 and 232 serial ports as transparent channels, you
must set 232 work mode to transparent channel in 232 configuration information structure
NET_DVR_RS232CFG at first, so that 232 can be used as transparent channel. See the
specific process Transparent Channel Module Procedure.
PTZ control module: To achieve the basic operations of PTZ, preset, cruise, track and
transparent PTZ control. SDK will be divided into two modes: one is the handle returned by
the image preview control, the other is no limited preview, do PTZ control through user
register ID.
The modules shown by dotted line is related with preview module, and these interfaces can
be called only after starting preview. They are parallel and realize their corresponding function
independently.
Sound control function mainly realizes opening or closing the exclusive or share sound, and
volume control. Related API: NET_DVR_OpenSound, NET_DVR_CloseSound,
NET_DVR_OpenSoundShare, NET_DVR_CloseSoundShare, NET_DVR_Volume
Module of real-time stream data capture and record mainly realizes data callback and local
8
Device Network SDK User Manual
Playback or download by file need to get file information through reseaching file function at
first(regarding interface NET_DVR_FindFile_V30, NET_DVR_FindNextFile_V30),then start
playback or download refer to obtained file name(regarding interface
NET_DVR_PlayBackByName, NET_DVR_GetFileByName),especially note that you must use
start play command(NET_DVR_PLAYSTART) of control interface
(NET_DVR_PlayBackControl_V40)after calling playback or download interfaces.
Playback or download by time, user couldn't call interfaces regarding researching record files.
Just need to fix start and finish time of playback or download interface(regarding interface
NET_DVR_PlayBackByTime, NET_DVR_GetFileByTime),Then must call start play
command(NET_DVR_PLAYSTART)of control interface(NET_DVR_PlayBackControl_V40). At
this time, start playback or download within the specified time with record videos in the
recent period of time. User can call the relevant interfaces of researching record files, obtain
start and finish time of file, and specify the time parameters of playback or download
10
Device Network SDK User Manual
If you want to do parameters configuration, you must do SDK initialization and user register
at first, use the returned ID number as the first parameter of interface configuration.
Proposal to call interface(NET_DVR_GetDVRConfig) to get parameters for complete
argument structure before setting each certain parameter, modify the parameters need to
change, as input parameters for setting parameter interface. At last call setting parameter
interface(NET_DVR_SetDVRConfig),Setting successfully if return successfully.
Example Code
11
Device Network SDK User Manual
Remote maintenance module for device consists of getting device state, remote upgrade, log
query, restoring default settings, and importing & exporting configuration file.
Get device state: get current state of hard disks, channels, alarm input & output, local
display, voice channels, and so on. Related API: NET_DVR_GetDVRWorkState_V30.
Remote upgrade: upgrade device remotely, and get current progress and state of upgrade.
Related API: NET_DVR_Upgrade, NET_DVR_GetUpgradeProgress,
NET_DVR_GetUpgradeState.
Query log: query log message, including alarm, exception, operation, and log with S.M.A.R.T
information. Related API: NET_DVR_FindDVRLog_V30, NET_DVR_FindNextLog_V30.
Restore default configuration for device. Related API: NET_DVR_RestoreConfig.
Import or export configuration file: export and save all configuration information, or import
configuration to the device. Related API: NET_DVR_GetConfigFile_V30,
NET_DVR_GetConfigFile, NET_DVR_SetConfigFile_EX, NET_DVR_SetConfigFile.
Example Code
12
Device Network SDK User Manual
Voice talk function realizes audio sending and receiving between PC client and device, by
calling interface NET_DVR_StartVoiceCom_V30 after device registers successfully. User can
set callback function with this interface to get data sent from current device or sample by PC
(choose callback encoded or PCM data by requirments).
Voice forward function realizes forward encoded audio data to device, the steps is as
following:
Please call NET_DVR_StartVoiceCom_MR_V30 to start voice forward with a
device(build connection with the device, wait for sending data at this time).
Ready for sending data(need to encode at first), corresponds dotted part of the above
image, if data has been handled according the audio compression format, this part
could be omitted. Data sources can be collected from the PC sound card, or read from
files, but need to compressed by private algorithm, SDK provides a set of coding
interfaces:
If the audio format is G722: 1)initialize audio codec- NET_DVR_InitG722Encoder;
2)G722 audio codec- NET_DVR_EncodeG722Frame,parameters of the interface have
certain requirments, please see details from the API description; 3)Please call
NET_DVR_ReleaseG722Encoder to release encoding audio resources after all encoding
process finished.
If the auido format is G711: please call NET_DVR_EncodeG711Frame to encoding
the audio data directly.
13
Device Network SDK User Manual
There are two alarm mode: "arm" and "listen". You can receive information like motion
detection alarm, video loss alarm, block alarm and signal occlusion alarm uploaded by devices.
"Arm" alarm mode: SDK connects to device actively, and send alarm uploading command to
the device. And device will send alarm message to SDK immediatly when there's an alarm.
Refer to the above "procedure chart","arm" needs to register (NET_DVR_Login_V30)at first.
Dotted part is the necessary condition if you want the device uploading the alarm
information, and this part mainly completes the configuration of relevant alarm conditions
and handling ways, the parameter configuration interface is NET_DVR_GetDVRConfig and
NET_DVR_SetDVRConfig. The supported alarm types are motion detection, video signal loss,
block and signal alarm, the configuration structure of first three alarm types corresponding
alarm conditions and handle ways is NET_DVR_PICCFG_V30,and signal alarm configuration
structure is NET_DVR_ALARMINCFG_V30. If these parameters are already configured,
dotted part can be omitted. The following is setting alarm callback function
(NET_DVR_SetDVRMessageCallBack_V30 and other functions), and also need to arm the
device on the client end(NET_DVR_SetupAlarmChan_V30). It needs to call function
NET_DVR_CloseAlarmChan_V30 to disarm interface if you want to finish the whole alarm
uploading process.
Example Code
"Listen" alarm mode: SDK dosen't connect to device actively, just listen to alarm message
that uploaded actively by the device at the set listening port.
This procedure needs to remotely configure device alarm host IP address(PC address) and
alarm host port(PC listen port). Alarm host listens and receives the uploaded alarm message
15
Device Network SDK User Manual
at this port. If alarm host address and alarm host port have been configured, the dotted part
of the above chart- "user register" and "cofigure alarm host address and port" parts, can be
omitted. But if no configuration beforehand, must call parameter configuration interface
(NET_DVR_GetDVRConfig and NET_DVR_SetDVRConfig) to configure network parameters by
(NET_DVR_NETCFG_V30). And the dotted part"configure alarm conditions and handle ways"
is the same with "arm". After setting all the parameters which need to be configured, please
call NET_DVR_StartListen_V30 to open SDK listening port, ready for receiving device
uploaded alarm information. This method is applicable, if some device upload alarm to a
client, and the client doesn't need to login the device. Also, it doesn't affect alarm uploading
if the device reboots. The drawback of this mode is that devices support to configure one
alarm host address and one port number only.
Example Code
SDK provides to use 485 and 232 as transparent channels. when using 232 serial port as
transparent channel. At first you must set work mode of 232 configuration information to
transparent channel mode.The specific way is calling interface NET_DVR_GetDVRConfig and
NET_DVR_SetDVRConfig to get and set parameter dwWorkMode of
NET_DVR_RS232CFG_V30 to transparent channel. When using 485 serial port as transparent
channel. This step can be omitted. Call NET_DVR_SerialStart to build transparent channel
and NET_DVR_SerialSend to send data . Need to do operations like break transparent
channel (NET_DVR_SerialStop)after the whole process finished.
Example Code
16
Device Network SDK User Manual
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
#include <time.h>
using namespace std;
void CALLBACK g_ExceptionCallBack(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser)
{
char tempbuf[256] = {0};
switch(dwType)
{
case EXCEPTION_RECONNECT: // reconnect when preview
printf("----------reconnect--------%d\n", time(NULL));
break;
default:
break;
}
}
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
//Login the device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
17
Device Network SDK User Manual
return;
}
18
Device Network SDK User Manual
Mode 2 Users theirselves deal with stream data which called back by g_RealDataCallBack_V30.
Here takes software decoding as an example.
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
#include <time.h>
#include "plaympeg4.h"
using namespace std;
void CALLBACK g_ExceptionCallBack(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser)
{
char tempbuf[256] = {0};
switch(dwType)
{
case EXCEPTION_RECONNECT: //reconnect when preview
printf("----------reconnect--------%d\n", time(NULL));
break;
default:
break;
}
}
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connection time and reconnection time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
20
Device Network SDK User Manual
//---------------------------------------
//Set exception callback function
NET_DVR_SetExceptionCallBack_V30(0, NULL,g_ExceptionCallBack, NULL);
//---------------------------------------
//Start preview and set to callback stream data
LONG lRealPlayHandle;
NET_DVR_CLIENTINFO ClientInfo = {0};
ClientInfo.hPlayWnd = NULL;
//If need to decode, please set it valid. If want to get stream data only, we can set to NULL
ClientInfo.lChannel = 1; //Preview channel number.
ClientInfo.lLinkMode = 0; /*If 31st bit is 0, it means connect main stream, is 1 means sub stream.
Bit 0~bit 30 are used for link mode: 0- TCP mode, 1- UDP mode, 2- Multi-play mode, 3- RTP mode, 4- RTP over
RTSP, 5- RTP over HTTP */
ClientInfo.sMultiCastIP = NULL; //Multicast IP. Please set when require to preview in multicast mode.
BOOL bPreviewBlock = false;
//whether blocked when requiring a stream connection, 0 means unblocked, 1 means blocked
lRealPlayHandle = NET_DVR_RealPlay_V30(lUserID, &ClientInfo, g_RealDataCallBack_V30, NULL, 0);
if (lRealPlayHandle < 0)
{
printf("NET_DVR_RealPlay_V30 error\n");
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//---------------------------------------
//Close preview
NET_DVR_StopRealPlay(lRealPlayHandle);
//Logout
NET_DVR_Logout_V30(lUserID);
NET_DVR_Cleanup();
return;
}
Example no.1 Search the recording files and download the files
#include <stdio.h>
#include <iostream>
#include "Windows.h"
21
Device Network SDK User Manual
#include "HCNetSDK.h"
using namespace std;
int nPos = 0;
for(nPos = 0; nPos < 100&&nPos>=0; nPos = NET_DVR_GetDownloadPos(hPlayback))
{
Sleep(5000); //millisecond
}
printf("have got %d\n", nPos);
if(!NET_DVR_StopGetFile(hPlayback))
{
printf("failed to stop get file [%d]\n",NET_DVR_GetLastError());
bRes = -1;
return bRes;
}
printf("%s\n",srcfile);
if(nPos<0||nPos>100)
{
printf("download err [%d]\n",NET_DVR_GetLastError());
bRes=-1;
return bRes;
}
else
{
22
Device Network SDK User Manual
return 0;
}
}
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login the device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
NET_DVR_FILECOND struFileCond;
struFileCond.dwFileType = 0xFF;
struFileCond.lChannel = 1;
struFileCond.dwIsLocked = 0xFF;
struFileCond.dwUseCardNo = 0;
struFileCond.struStartTime.dwYear = 2011;
struFileCond.struStartTime.dwMonth = 3;
struFileCond.struStartTime.dwDay = 1;
struFileCond.struStartTime.dwHour = 10;
struFileCond.struStartTime.dwMinute = 6;
struFileCond.struStartTime.dwSecond =50;
struFileCond.struStopTime.dwYear = 2011;
struFileCond.struStopTime.dwMonth = 3;
struFileCond.struStopTime.dwDay = 1;
struFileCond.struStopTime.dwHour = 11;
struFileCond.struStopTime.dwMinute = 7;
struFileCond.struStopTime.dwSecond = 0;
//---------------------------------------
//Search recording files
int lFindHandle = NET_DVR_FindFile_V30(lUserID, &struFileCond);
23
Device Network SDK User Manual
if(lFindHandle < 0)
{
printf("find file fail,last error %d\n",NET_DVR_GetLastError());
return;
}
NET_DVR_FINDDATA_V30 struFileData;
while(true)
{
int result = NET_DVR_FindNextFile_V30(lFindHandle, &struFileData);
if(result == NET_DVR_ISFINDING)
{
continue;
}
else if(result == NET_DVR_FILE_SUCCESS)
{
char strFileName[256] = {0};
sprintf(strFileName, "./%s", struFileData.sFileName);
saveRecordFile(lUserID, struFileData.sFileName, strFileName);
break;
}
else if(result == NET_DVR_FILE_NOFIND || result == NET_DVR_NOMOREFILE)
{
break;
}
else
{
printf("find file fail for illegal get file state");
break;
}
}
//Stop searching
if(lFindHandle > 0)
{
NET_DVR_FindClose_V30(lFindHandle);
}
// Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
//---------------------------------------
//Playback by time
25
Device Network SDK User Manual
int hPlayback;
hPlayback = NET_DVR_PlayBackByTime(lUserID, 1, &struStartTime, &struStopTime, hWnd);
if(hPlayback < 0)
{
printf("NET_DVR_GetFileByTime fail,last error %d\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//---------------------------------------
//Start playing
if(!NET_DVR_PlayBackControl(hPlayback, NET_DVR_PLAYSTART, 0, NULL))
{
printf("play back control failed [%d]\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
Sleep(15000); //millisecond
if(!NET_DVR_StopPlayBack(hPlayback))
{
printf("failed to stop file [%d]\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
// Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
26
Device Network SDK User Manual
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
//---------------------------------------
//Download by time
int hPlayback;
hPlayback = NET_DVR_GetFileByTime(lUserID, 1, &struStartTime, &struStopTime, "./test.mp4");
if(hPlayback < 0)
{
printf("NET_DVR_GetFileByTime fail,last error %d\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
27
Device Network SDK User Manual
return;
}
//---------------------------------------
//Start downloading
if(!NET_DVR_PlayBackControl(hPlayback, NET_DVR_PLAYSTART, 0, NULL))
{
printf("play back control failed [%d]\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
int nPos = 0;
for(nPos = 0; nPos < 100&&nPos>=0; nPos = NET_DVR_GetDownloadPos(hPlayback))
{
Sleep(5000); //millisecond
}
if(!NET_DVR_StopGetFile(hPlayback))
{
printf("failed to stop get file [%d]\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
if(nPos<0||nPos>100)
{
printf("download err [%d]\n",NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
28
Device Network SDK User Manual
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
int iRet;
//Get compression parameter
DWORD dwReturnLen;
NET_DVR_COMPRESSIONCFG_V30 struParams = {0};
iRet = NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_COMPRESSCFG_V30, struDeviceInfo.byStartChan, \
&struParams, sizeof(NET_DVR_COMPRESSIONCFG_V30), &dwReturnLen);
if (!iRet)
{
printf("NET_DVR_GetDVRConfig NET_DVR_GET_COMPRESSCFG_V30 error.\n");
NET_DVR_Logout_V30(lUserID);
NET_DVR_Cleanup();
29
Device Network SDK User Manual
return;
}
Log query
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
30
Device Network SDK User Manual
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
struStopTime.dwYear = 2011;
struStopTime.dwMonth = 3;
struStopTime.dwDay = 2;
struStopTime.dwHour = 9;
struStopTime.dwMinute = 10;
struStopTime.dwSecond = 0;
//---------------------------------------
//Query log
int lFindHandle = NET_DVR_FindDVRLog_V30(lUserID, 0, 0, 0, &struStartTime, &struStopTime, FALSE);
if(lFindHandle < 0)
{
printf("find log fail,last error %d\n",NET_DVR_GetLastError());
31
Device Network SDK User Manual
return;
}
NET_DVR_LOG_V30 struLog;
while(true)
{
int result = NET_DVR_FindNextLog_V30(lFindHandle, &struLog);
if(result == NET_DVR_ISFINDING)
{
printf("finding\n");
continue;
}
else if(result == NET_DVR_FILE_SUCCESS)
{
char strLog[256] = {0};
printf("log:%04d-%02d-%02d %02d:%02d:%02d\n", struLog.strLogTime.dwYear,
struLog.strLogTime.dwMonth, struLog.strLogTime.dwDay, \
struLog.strLogTime.dwHour,struLog.strLogTime.dwMinute, struLog.strLogTime.dwSecond);
}
else if(result == NET_DVR_FILE_NOFIND || result == NET_DVR_NOMOREFILE)
{
printf("find ending\n");
break;
}
else
{
printf("find log fail for illegal get file state\n");
break;
}
}
//Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
32
Device Network SDK User Manual
Voice talk
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
//Voice talk
LONG lVoiceHanle;
lVoiceHanle = NET_DVR_StartVoiceCom_V30(lUserID, 1,0, fVoiceDataCallBack, NULL);
if (lVoiceHanle < 0)
{
33
Device Network SDK User Manual
Sleep(5000); //millisecond
//Stop voice talk
if (!NET_DVR_StopVoiceCom(lVoiceHanle))
{
printf("NET_DVR_StopVoiceCom error, %d!\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
case COMM_ALARM:
{
switch (struAlarmInfo.dwAlarmType)
{
case 3: //motion detection alarm
for (i=0; i<16; i++) //#define MAX_CHANNUM 16 //The max mumber of channels
{
if (struAlarmInfo.dwChannel[i] == 1)
{
printf("Motion detection channel number: %d\n", i+1);
}
}
break;
default:
break;
}
}
break;
default:
break;
}
}
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
#include <stdio.h>
#include <iostream>
#include "Windows.h"
#include "HCNetSDK.h"
using namespace std;
{
switch (struAlarmInfo.dwAlarmType)
{
case 3: // motion detection alarm
for (i=0; i<16; i++) //#define MAX_CHANNUM 16 // The max mumber of channels
{
if (struAlarmInfo.dwChannel[i] == 1)
{
printf("Motion detection channel number: %d\n", i+1);
}
}
break;
default:
break;
}
}
break;
default:
break;
}
}
void main() {
//---------------------------------------
//Initialize SDK
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
// Login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("172.0.0.100", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
//Start listening
LONG lHandle;
lHandle = NET_DVR_StartListen_V30(NULL,7200, MessageCallback, NULL);
if (lHandle < 0)
{
printf("NET_DVR_SetupAlarmChan_V30 error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
Sleep(5000);
//Stop listening
if (!NET_DVR_StopListen_V30(lHandle))
{
printf("NET_DVR_StopListen_V30 error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//Logout
NET_DVR_Logout(lUserID);
// Release SDK resource
NET_DVR_Cleanup();
return;
}
void main() {
//---------------------------------------
38
Device Network SDK User Manual
//Init device
NET_DVR_Init();
//Set connect time and reconnect time
NET_DVR_SetConnectTime(2000, 1);
NET_DVR_SetReconnect(10000, true);
//---------------------------------------
//login device
LONG lUserID;
NET_DVR_DEVICEINFO_V30 struDeviceInfo;
lUserID = NET_DVR_Login_V30("192.0.0.64", 8000, "admin", "12345", &struDeviceInfo);
if (lUserID < 0)
{
printf("Login error, %d\n", NET_DVR_GetLastError());
NET_DVR_Cleanup();
return;
}
/*Set 232 to transparent channel mode(485 is not necessary to call this interface used for 232 transparent
channel)*/
DWORD dwReturned = 0;
NET_DVR_RS232CFG_V30 struRS232Cfg;
memset(&struRS232Cfg, 0, sizeof(NET_DVR_RS232CFG_V30));
if (!NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_RS232CFG_V30, 0, &struRS232Cfg,
sizeof(NET_DVR_RS232CFG_V30), &dwReturned))
{
printf("NET_DVR_GET_RS232CFG_V30 error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
struRS232Cfg.struRs232.dwWorkMode = 2;
//set 232 to transparent channel mode: 0- narrow-band transmission, 1- console, 2- transparent channel
if (!NET_DVR_SetDVRConfig(lUserID, NET_DVR_SET_RS232CFG_V30, 0, &(struRS232Cfg),
sizeof(NET_DVR_RS232CFG)))
{
printf("NET_DVR_SET_RS232CFG_V30 error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
//Set up transparent channel
LONG lTranHandle;
int iSelSerialIndex = 1; //1:RS-232;RS-485
lTranHandle = NET_DVR_SerialStart(lUserID, iSelSerialIndex, g_fSerialDataCallBack, lUserID);
//configure callback function to obtain transparent data
39
Device Network SDK User Manual
if (lTranHandle < 0)
{
printf("NET_DVR_SerialStart error, %d\n", NET_DVR_GetLastError());
NET_DVR_Logout(lUserID);
NET_DVR_Cleanup();
return;
}
5 API Description
NET_DVR_SetConnectTime
EasyDDNS: NET_DVR_GetDVRIPByResolveSvr_EX
NET_DVR_SetExceptionCallBack_V30
Example:
NET_DVR_GetSDKBuildVersion
Return to index
same time. If set bAutoDel to TRUE, it will automatically delete the files which
exceed the limit. If the path is changed, it will use the new path when writing
next file.
Return to index
NET_DVR_GetErrorMsg
DEVICE_ENCODE_ALL_ABILITY Get all encoding ability None Device all encoding ability
of current device described by XML
DEVICE_ENCONE_CURRENT Get current encoding Device current Device current encoding ability
ability of current device encoding ability described by XML
described by XML
Return to index
NET_DVR_MakeKeyFrame
Return to index
50
Device Network SDK User Manual
NET_DVR_MakeKeyFrameSub
Return to index
error code.
Remarks: This API is used to realize live view. It supports to set current operation to be
blocked or not(by the parameter: bBlocked). If set to be unblocked, it means it
will think the connection is successful when start to connect with the device. If
failed to receive stream and play, it will notify the upper layer by preview
exception mode. And it can reduce dwell time of loop play, the same to
NET_DVR_RealPlay. If set to be blocked, it means it will return whether
successful or not after playing operation.
The callback function of this API can be set to NULL, and it will not callback the
stream data to user. And then user can call NET_DVR_SetRealDataCallBack or
NET_DVR_SetStandardDataCallBack to register callback function to capture
stream data.
Return to index
5.7.6 Get player handle for decoding and display when live view:
NET_DVR_GetRealPlayerIndex
NET_DVR_RigisterDrawFun
write on the DC, like drawing on the window client DC. But this DC is not DC of
window client area, it is DC on the Off-Screen surface of Player
DirectDraw.bBlocked should be set to 1(TRUE) when call
NET_DVR_RealPlay_V30, or this API will return FALSE, and the error code will
be 12 (calling order error) .
Return to index
NET_DVR_SetPlayerBufNumber
Return to index
NET_DVR_ThrowBFrame
Remarks: Throw B frame can reduce CPU utilization when doing multi-channel playing.
When play more than one channel, throw B frame can reduce the CPU
resources, while if play one channel only, it’d better not to throw the B frame.
Return to index
NET_DVR_SetRealDataCallBack
Return to index
Return to index
NET_DVR_CaptureJPEGPicture
Return to index
5.13.4 Capture a frame and save as JPEG image to the assigned buffer:
NET_DVR_CaptureJPEGPicture_NEW
Return to index
61
Device Network SDK User Manual
Get the video's starting time and stopping time of the channel
Return to index
handle firstly. The interface only supports to get one file. We should call the
interface repetitively to get all files. We can get other information, like card
number and whether the file is locked, by calling this API as well.
The max number of files searched once is 4000.
Return to index
NET_DVR_FindClose_V30
Return to index
seconds.
After calling the API successfully, you can register callback function by calling
NET_DVR_SetPlayDataCallBack, capture the stream data and handle by
yourself.
Return to index
NET_DVR_PLAYPAUSE 3 Pause
NET_DVR_PLAYRESTART 4 Resume
NET_DVR_PLAYFAST 5 Fast
NET_DVR_PLAYSLOW 6 Slow
Return to index
Remarks:
Return to index
NET_DVR_PlayBackSaveData
Return to index
Return to index
NET_DVR_SetPlayDataCallBack
Return to index
5.14.11 Get the display OSD time when playback the record file:
NET_DVR_GetPlayBackOsdTime
Return to index
69
Device Network SDK User Manual
NET_DVR_PlayBackCaptureFile
Return to index
NET_DVR_RefreshPlay
Return to index
5.14.14 Get player handle for decoding and display when playback:
NET_DVR_GetPlayBackPlayerIndex
Return to index
Return to index
Return to index
NET_DVR_PLAYPAUSE 3 Pause
NET_DVR_PLAYRESTART 4 Resume
Return to index
Return to index
73
Device Network SDK User Manual
NET_DVR_GetDownloadPos
Return to index
Return to index
Return to index
74
Device Network SDK User Manual
NET_DVR_StartDVRRecord
Return to index
Remarks:
Return to index
Set the callback function of the alarm message uploaded by the device
NET_DVR_SetDVRMessageCallBack_V30
COMM_IPC_AUXALA 0x2820 PIR alarm, wireless alarm, or calling for help alarm
RM_RESULT upload
Return to index
76
Device Network SDK User Manual
NET_DVR_SetupAlarmChan_V30
Return to index
NET_DVR_CloseAlarmChan_V30
Return to index
Listening
COMM_IPC_AUXALA 0x2820 PIR alarm, wireless alarm, or calling for help alarm
RM_RESULT upload
Return to index
78
Device Network SDK User Manual
NET_DVR_PTZControl
TILT_UP 21 Tilt up
79
Device Network SDK User Manual
Return to index
5.18.2 PTZ control (not require live view before calling it):
NET_DVR_PTZControl_Other
TILT_UP 21 Tilt up
Return to index
5.18.3 PTZ control with speed (requires starting live view firstly):
NET_DVR_PTZControlWithSpeed
TILT_UP 21 Tilt up
needs to re-configure the decoder parameter. If the PTZ doesn't support the
parameter, it will not able to control PTZ.
Return to index
5.18.4 PTZ control with speed (not require live view before calling it):
NET_DVR_PTZControlWithSpeed_Other
TILT_UP 21 Tilt up
Return to index
NET_DVR_PTZPreset
Return to index
NET_DVR_PTZPCruise
list table.
[in] byCruiseRoute The number of patrol route, it supports
maximum 32 routes, the number starts from 1
[in] byCruisePoint The number of preset, it supports maximum 32
presets, the number starts from 1
[in] wInput The value is different for different commands,
preset(maximum is 128), dwell time (maximum
is 255), Speed (maximum is 40)
Macro Definition Value Implication
FILL_PRE_SEQ 30 Add preset to the patrol sequence
Return to index
Return to index
NET_DVR_PTZTrack
Return to index
Return to index
NET_DVR_TransPTZ
Return to index
Return to index
Return to index
NET_DVR_PTZSelZoomIn_Ex
Return to index
Voice talk
If current encoding format is G711 or G726, the audio data sampling frequency
is 8000, 16 bytes sampling and monophonic. Audio playing format should be
defined as following:
const int SAMPLES_PER_SECOND_G711_MU = 8000;
const int CHANNEL = 1;
const int BITS_PER_SAMPLE = 16;
WAVEFORMATEX m_wavFormatEx;
m_wavFormatEx.cbSize = sizeof(m_wavFormatEx);
m_wavFormatEx.nBlockAlign = CHANNEL * BITS_PER_SAMPLE / 8;
m_wavFormatEx.nChannels = CHANNEL;
m_wavFormatEx.nSamplesPerSec = SAMPLES_PER_SECOND_G711_MU;
m_wavFormatEx.wBitsPerSample = BITS_PER_SAMPLE;
m_wavFormatEx.nAvgBytesPerSec = SAMPLES_PER_SECOND_G711_MU*
m_wavFormatEx.nBlockAlign;
Return to index
NET_DVR_SetVoiceComClientVolume
Return to index
Return to index
Voice fowarding
NET_DVR_StartVoiceCom_MR_V30
Before calling this API, it supports to get the audio encoding format
(NET_DVR_COMPRESSION_AUDIO) of the device, by calling
NET_DVR_GetDVRConfig.
If current encoding format is OggVorbis, audio data sampling frequency is
16000, 16 bytes sampling and monophonic. Audio playing format should be
defined as following:
const int SAMPLES_PER_SECOND = 16000;
const int CHANNEL = 1;
const int BITS_PER_SAMPLE = 16;
WAVEFORMATEX m_wavFormatEx;
m_wavFormatEx.cbSize = sizeof(m_wavFormatEx);
m_wavFormatEx.nBlockAlign = CHANNEL * BITS_PER_SAMPLE / 8;
m_wavFormatEx.nChannels = CHANNEL;
m_wavFormatEx.nSamplesPerSec = SAMPLES_PER_SECOND;
m_wavFormatEx.wBitsPerSample = BITS_PER_SAMPLE;
m_wavFormatEx.nAvgBytesPerSec =
SAMPLES_PER_SECOND*m_wavFormatEx.nBlockAlign
If current encoding format is G711 or G726, the audio data sampling frequency
is 8000, 16 bytes sampling and monophonic. Audio playing format should be
defined as following:
const int SAMPLES_PER_SECOND_G711_MU = 8000;
const int CHANNEL = 1;
const int BITS_PER_SAMPLE = 16;
WAVEFORMATEX m_wavFormatEx;
m_wavFormatEx.cbSize = sizeof(m_wavFormatEx);
m_wavFormatEx.nBlockAlign = CHANNEL * BITS_PER_SAMPLE / 8;
m_wavFormatEx.nChannels = CHANNEL;
m_wavFormatEx.nSamplesPerSec = SAMPLES_PER_SECOND_G711_MU;
m_wavFormatEx.wBitsPerSample = BITS_PER_SAMPLE;
m_wavFormatEx.nAvgBytesPerSec = SAMPLES_PER_SECOND_G711_MU*
m_wavFormatEx.nBlockAlign;
Return to index
NET_DVR_VoiceComSendData
Return to index
Return to index
Voice broadcast
NET_DVR_ClientAudioStart_V30
Return to index
5.20.8 Add one voice channel of the device to the broadcast group:
NET_DVR_AddDVR_V30
Return to index
5.20.9 Delete the voice channel of the device from the broadcast group:
NET_DVR_DelDVR_V30
Return to index
NET_DVR_ClientAudioStop
Return to index
NET_DVR_InitG722Encoder
Return to index
NET_DVR_EncodeG722Frame
Return to index
NET_DVR_ReleaseG722Encoder
Return to index
NET_DVR_InitG722Decoder
Return to index
Return to index
NET_DVR_ReleaseG722Decoder
Return to index
NET_DVR_EncodeG711Frame
Return to index
Return to index
NET_DVR_InitG726Encoder
Return to index
NET_DVR_EncodeG726Frame
Return to index
NET_DVR_ReleaseG726Encoder
Return to index
102
Device Network SDK User Manual
NET_DVR_InitG726Decoder
Return to index
Return to index
103
Device Network SDK User Manual
NET_DVR_ReleaseG726Decoder
Return to index
Return to index
104
Device Network SDK User Manual
channel: NET_DVR_SerialSend
Return to index
Return to index
5.22.1 Send data to the serial port directly, and it dosn not require to
Return to index
Return to index
Return to index
NET_DVR_FormatDisk
[out] pCurrentFormatDisk The pointer of the hard disk number which is
formatted currently, the hard disk number starts
from 0, and -1 is the initial state
[out] pCurrentDiskPos The pointer of formatting progress of current
hard disk, and the progress value range: 0~100
[out] pFormatStatic The pointer of hard disk formatting state:
0- it is being formatted
1- the formatting of hard disk has finished
2- there is exception when formatting, and the
progress is stopped. It will appear in both local
and network disk
3- exception in network that leads to to the
loss of network disk, and it will not able to start
formatting
Return: Return TRUE on success, FALSE on failure. Please call NET_DVR_GetLastError
to get the error code.
Remarks:
Return to index
NET_DVR_CloseFormatHandle
Return to index
LPNET_DVR_WORKSTATE_V30 lpWorkState)
Parameters: [in] lUserID The return value of NET_DVR_Login_V30
[out] lpWorkState Pointer to the structure of work state
Return: Return TRUE on success, FALSE on failure. Please call NET_DVR_GetLastError
to get the error code.
Remarks: This API is used to get device state, including the state of channel, alarm input,
alarm output, voice channel, etc.
Return to index
Remote upgrade
NET_DVR_SetNetworkEnvironment
Return to index
Return to index
NET_DVR_GetUpgradeProgress
Return to index
NET_DVR_GetUpgradeState
Return to index
NET_DVR_GetUpgradeStep
*pSubProgress)
Parameters: [in] lUpgradeHandle The return value of NET_DVR_Upgrade
[in] pSubProgress Step sub progress of the upgrade
Return: Return -1 if it is failed. Other value is defined as below:
Macro Definition Value Implication
STEP_RECV_DATA 1 Receive the upgrade package data
STEP_UPGRADE 2 Upgrade the device system
STEP_BACKUP 3 Backup the device system
STEP_SEARCH 255 The devcie is being searching upgrade file
Please call NET_DVR_GetLastError to get the error code.
Remarks:
Return to index
NET_DVR_CloseUpgradeHandle
Return to index
Log Query
5.24.8 Query the log information of the device (supports to search log
dwMinorType List:
Macro Definition of Major Type Value Implication
MAJOR_ALARM 0x1 Alarm
Macro Definition of Minor Type Value Implication
MINOR_ALARM_IN 0x1 Input of alarm
Return: Return -1 if it is failed, and the other values could be used as a parameter of
NET_DVR_FindNextLog_V30. Please call NET_DVR_GetLastError to get the
error code.
Remarks: For general devices, such as DS-81xx and DS-80xx series, it supports to query
up to 2000 normal logs; for DS-90xx series(v2.0 or higher), supports up to 4000
logs; For DS-81xxHF-ST,it supports up to 1000 logs.If to query S.M.A.R.T logs, it
supports max 500 logs at one time.
If S.M.A.R.T information is not needed, we can search all logs by setting
bOnlySmart to FALSE.
S.M.A.R.T information: HD working record.
Return to index
Remarks: Before calling this API, please call NET_DVR_FindDVRLog_V30 to get current
searching handle firstly.
Return to index
116
Device Network SDK User Manual
NET_DVR_FindLogClose_V30
Remote backup
NET_DVR_Backup
Return to index
117
Device Network SDK User Manual
NET_DVR_GetConfigFile_V30
NET_DVR_GetConfigFile
NET_DVR_SetConfigFile_EX
NET_DVR_SetConfigFile
Return to index
Remarks:
Return to index
Return to index
parameters
Return to index
output
Return: Return TRUE on success, FALSE on failure. Please call NET_DVR_GetLastError
to get the error code.
Remarks:
Return to index
NET_DVR_GetScaleCFG_V30
Return to index
NET_DVR_SetScaleCFG_V30
NET_DVR_StartEmailTest
NET_DVR_GetEmailTestProgress
NET_DVR_ShutterCompensation
NET_DVR_RTSP_DESCRIBESERVERERR 416 "RTSP DECRIBE" device returns the error that values
401 or 501.
NET_DVR_RTSP_OVER_MAX_CHAN 426 "RTSP SETUP" device returns the error that values
401 or 501. It exceeds the max connection number.
NET_DVR_RTSP_PLAYSERVERERR 436 "RTSP PLAY" device returns the error that values 401
or 501.
mode.
NET_PLAYM4_SUPPORT_FILE_ONLY 514 This API can be called only for file playback mode.
NET_PLAYM4_SUPPORT_STREAM_ONLY 515 This API can be called only when playing stream.
NET_PLAYM4_SYS_NOT_SUPPORT 516 Not support by the system. Decoder can only work
on the system above Pentium 3.
NET_PLAYM4_CHECK_FILE_ERROR 520 The file is too short, or the stream data is unknown.