NetSDK Programming Manual
NetSDK Programming Manual
2009-01-10
1 48
Foreword Thank you for using our VANGUARD devices. We are going to provide best service for you. This manual may contain spelling grammar and punctuation errors.We will update this manual regularly.
2 48
Modification History
Date
2008.10.22 2009.02.12 2009.02.18
Content Create
Add H264_DVR_SearchDevice for search device at LAN
2009.09.26
H264_DVR_GetDVRWorkState H264_DVR_ClickKey
3 48
Catalogue
1.
DESIG OF PRINCIPIA .................................................................................................... 6 1.3 PROGRAMMING DESCRIPTION ............................................................................... 6 1.4 API CALLING REFERENCE ..................................................................................... 7 2 DATA STRUCTURE DESCRIPTION ........................................................................ 9 2.1 CLIENT DATA STRUCTURE DESCRIPTION .............................................................. 9 2.1.1 Structure of device information ................................................................ 12 2.1.2 Date Information ........................................................................................ 12 2.1.3 Record File Information ............................................................................ 12 2.1.4 Structure of Configuration ........................................................................ 16 2.1.5 Network keyboard define .......................................................................... 28 3 API DEFINITION........................................................................................................ 31 3.1 SDK INITIALIZATION............................................................................................ 31 3.2 GET ALARM STATUS .............................................................................................. 32 3.3 DEVICE REGISTRATION ......................................................................................... 34 3.4 REAL-TIME MONITOR ............................................................................................ 35 3.5 PLAYBACK AND DOWNLOAD .................................................................................... 37 3.6 PLAYBACK CONTROL .............................................................................................. 40 3.7 PTZ CONTROL ....................................................................................................... 40 3.8 SYSTEM CONFIGURATION ....................................................................................... 41 3.9 LOG MANAGEMENT .................................................................................................. 42 3.10 REMOTE CONTROL ............................................................................................ 43 3.11 UPGRADE ............................................................................................................... 43 3.11 AUDIO TALK ....................................................................................................... 45 3.12 RECORD MODE ................................................................................................... 47 3.13 SET SYSTEM TIME .............................................................................................. 47 3.14 GET DEVICE STATUS ........................................................................................... 48 3.15 NET KEYBOARD .................................................................................................. 48
4 48
1. General Introduction
1.1 Introduction
This SDK is for VANGUARD DVR,network video server and etc. The text describes functions and interfaces as well as relations among them.It also provide detailed demonstration. This package includes two parts: operation and equipment management Operation state listening, real-time monitor, real-time preview, character overlay, audio control, record playback and download, data storage, PTZ control, alarm deployment, voice dialogue, log management, user management, action on alarm, transparent com port and etc. Device management remote upgrade, remote restart/shutdown, equipment parameters setup such as general setting, alarm, record, serial port, image, log, user management, device timing, motion detection, network and etc. The development package includes the following files Network library Assitante library NetSDK NetSDK.lib NetSDK.dll H264Play.dll DllDeinterlace.dll hi_h264dec_w.dll Head file Lib file Interface library Decode assistant library Decode assistant library Decode assistant library
1.2 Applicability
Support real-time monitor playback,AlarmRemote configlog management and etc Support TCP network tramsmisson, Max 10 TCP connections You can use this SDK to connect to device to develop client-end program, or you can use SDK callback interface to develop server program such as stream media transfer, playback, alarm and etc. The client supports multi- image resolutions including QCIFCIF2CIF
5 48
HalfD1D1VGA640480and etc. When SDK is playback/download, one logged ID can not operate playback and downalod for the same channel at the same time. SDK performance has relationship woth device running status and client-end PC capability. Basically, it can support 1024 users to register at the same time, 1024-ch network preview and playback at the same time. Support 1024-ch alarm upload at the same time .And 100-ch video display
Desig of principia
1.3 Programming Description
Initialization and clean up
1First calling H264_DVR_Init() to initialize SDKwhen Application exit, calling H264_DVR_Cleanup()to release all occupied resource. 2 Most API shall call after H264_DVR_Init(), before H264_DVR_Cleanup() But H264_DVR_GetLastError can be called anywhere. Login in and login out
Befor access device, you shall call H264_DVR_Login() login first, also you can call H264_DVR_LoginEx() to assign your client type logined. If login succeeded, will return a global handle, the handle is a session channel, you can use it to operate device. Call H264_DVR_Logout() to close this session. Callback Fuction
Callback function have a parameter: dwUser, it is elf-define parameter, you can define your owner data.
6 48
C. Login in Login in
H264_DVR_Login () H264_DVR_LoginEx ()
H264_DVR_SetupAlarmChan ()
D. Operation of device ,get and set parameter configuration Parameter configuration Log searching PTZ control
H264_DVR_GetDevConfig () H264_DVR_SetDevConfig () H264_DVR_FindDVRLog () H264_DVR_PTZControl () H264_DVR_PTZControlEx ()
E. Real-time preview Open and close monitor channel Callback for saving monitor data
H264_DVR_SetRealDataCallBack () H264_DVR_RealPlay () H264_DVR_StopRealPlay ()
Download
H264_DVR_GetDownloadPos() H264_DVR_StopGetFile ()
H264_DVR_Logout ()
H264_DVR_Cleanup ()
8 48
= = = = = = = = = = =
0, //no error 1, //success -10000, //invalid request -10001, //SDK not inited -10002, // illegal user parameter -10003, //handle is null -10004, //SDK clear error = -10005, //timeout -10006, //memory error -10007, //network error -10008, //open file fail -10009, //unknown error = -11000, //version mismatch
H264_DVR_ERROR_GET_DATA = -11001, //get data failincluding configure, user information and etc
H264_DVR_OPEN_CHANNEL_ERROR = -11200, //open channel fail H264_DVR_CLOSE_CHANNEL_ERROR = -11201, //close channel fail H264_DVR_SUB_CONNECT_ERROR = -11202, //open media connet fail H264_DVR_SUB_CONNECT_SEND_ERROR = -11203, //media connet send data fail /// error code of user management H264_DVR_NOPOWER = -11300, //no power H264_DVR_PASSWORD_NOT_VALID = -11301, // password not valid H264_DVR_LOGIN_USER_NOEXIST = -11302, // user not exist H264_DVR_USER_LOCKED = -11303, // user is locked H264_DVR_USER_IN_BLACKLIST = -11304, // user is in backlist H264_DVR_USER_HAS_USED = -11305, // user have logined H264_DVR_USER_NOT_LOGIN = -11305, // no login H264_DVR_CONNECT_DEVICE_ERROR = -11306, // maybe device no exist
10 48
/// error code of configure management H264_DVR_OPT_RESTART = -11400, // need to restart application H264_DVR_OPT_REBOOT = -11401, // need to reboot system H264_DVR_OPT_FILE_ERROR = -11402, // write file fail H264_DVR_OPT_CAPS_ERROR = -11403, // not support H264_DVR_OPT_VALIDATE_ERROR = -11404, // validate fail H264_DVR_OPT_CONFIG_NOT_EXIST = -11405, // config not exist H264_DVR_CTRL_PAUSE_ERROR = -11500, // pause fail };
};
//alarm information typedef struct SDK_ALARM_INFO { int nChannel; int iEvent; ///< refer to SDK_EventCodeTypes int iStatus; ///< 0: start 1: stop 11 48
int nFileType; //record type H264_DVR_TIME startTime; //start time H264_DVR_TIME endTime; //end time char szCard[32]; //card number }H264_DVR_FINDINFO;
)
struct SDK_STR_CONFIG_PTZ { char sProtocolName[NET_MAX_PTZ_PROTOCOL_LENGTH]; int ideviceNo; // PTZ device NO.
13 48
// Protocol
int iNumberInMatrixs; // NO. in matrixs int iPortNo; // serial port NO.: [1, 4] SDK_COMMATTRI dstComm; // attribute of serial }; //all channel of PTZ protocol struct SDK_STR_PTZCONFIG_ALL { SDK_STR_CONFIG_PTZ ptzAll[NET_MAX_CHANNUM]; };
14 48
//modify user typedef struct _CONF_MODIFYUSER { std::string sUserName; USER_INFO User; }CONF_MODIFYUSER; //modify group typedef struct _CONF_MODIFYGROUP { std::string sGroupName; USER_GROUP_INFO Group; }CONF_MODIFYGROUP;
/// modify password struct _CONF_MODIFY_PSW { std::string sUserName; std::string sPassword; std::string sNewPassword; };
)Log
Information
#define NET_MAX_RETURNED_LOGLIST 1024 //the max item of Log /// log search condition struct SDK_LogSearchCondition { int nType; ///< log type: 0: all 1: system 2: configure 3: storage 4: alarm 5record 6: account 7: file int iLogPosition; ///< return of last log item position in the whole logs SDK_SYSTEM_TIME stBeginTime; ///< begin time SDK_SYSTEM_TIME stEndTime; ///< end time }; //return of Log search
15 48
struct SDK_LogList { int iNumLog; struct LogItem { char sType[24]; ///< log type char sUser[32]; ///< Operator of log char sData[68]; ///< log data SDK_SYSTEM_TIME stLogTime; ///< the time of log happened } Logs[NET_MAX_RETURNED_LOGLIST]; };
)Real-Time Monitor
typedef struct{ int nChannel; //Channel NO. int nStream; //0: main stream1: extra stream int nMode; //0TCP, 1UDP }H264_DVR_CLIENTINFO,*LPH264_DVR_CLIENTINFO;
16 48
USER_MANAGE_INFO //add user USER_INFO //modify user CONF_MODIFYUSER //del user USER_INFO //add group USER_GROUP_INFO //modify group CONF_MODIFYGROUP //del group USER_GROUP_INFO //modify password _CONF_MODIFY_PSW
E_SDK_CONFIG_ABILTY_ENCODE, E_SDK_CONFIG_ABILITY_PTZPRO,
SDK_PTZPROTOCOLFUNC
E_SDK_COMFIG_ABILITY_COMMPRO,
SDK_COMMFUNC
E_SDK_CONFIG_ABILITY_MOTION_FUNC, //Motion detect SDK_MotionDetectFunction E_SDK_CONFIG_ABILITY_BLIND_FUNC, //Blind detect SDK_BlindDetectFunction E_SDK_CONFIG_ABILITY_DDNS_SERVER, // type of DDNS services support
SDK_DDNSServiceFunction
E_SDK_CONFIG_ABILITY_TALK, //Device configuration E_SDK_CONFIG_SYSINFO = 17, E_SDK_CONFIG_SYSNORMAL, E_SDK_CONFIG_SYSENCODE, E_SDK_CONFIG_SYSNET, E_SDK_CONFIG_PTZ, E_SDK_CONFIG_COMM, E_SDK_CONFIG_RECORD, E_SDK_CONFIG_MOTION, E_SDK_CONFIG_SHELTER, E_SDK_CONFIG_VIDEO_LOSS, E_SDK_CONFIG_ALARM_IN, E_SDK_CONFIG_ALARM_OUT, E_SDK_CONFIG_DISK_MANAGER E_SDK_CONFIG_OUT_MODE, E_SDK_CONFIG_AUTO, E_SDK_CONFIG_DEFAULT, E_SDK_CONFIG_DISK_INFO, E_SDK_CONFIG_LOG_INFO,
//system information H264_DVR_DEVICEINFO //general SDK_CONFIG_NORMAL //encode SDK_EncodeConfigAll //network SDK_CONFIG_NET_COMMON //ptz SDK_STR_PTZCONFIG_ALL //232 SDK_CommConfigAll //record SDK_RECORDCONFIG_ALL //motion detect SDK_MOTIONCONFIG //blind detect SDK_BLINDDETECTCONFIG_ALL //loss detect SDK_VIDEOLOSSCONFIG_ALL //alarm in SDK_ALARM_INPUTCONFIG_ALL //alarm out //disk management //out mode //auto maintain //set default //disk info //get log
SDK_AutoMaintainConfig SDK_StorageDeviceInformationAll
SDK_LogList
17 48
E_SDK_CONFIG_NET_IPFILTER,
SDK_NetIPFilterConfig
E_SDK_CONFIG_NET_DHCP, E_SDK_CONFIG_NET_DDNS,
SDK_NetDDNSConfigALL
E_SDK_CONFIG_NET_NTP, //network services NTP E_SDK_CONFIG_NET_PPPOE, //network services: PPPOE E_SDK_CONFIG_NET_DNS, //network services: DNS E_SDK_CONFIG_NET_FTPSERVER, //network services: FTP
SDK_FtpServerConfig E_SDK_CONFIG_SYS_TIME, //system time
E_SDK_CONFIG_CLEAR_LOG, E_SDK_REBOOT_DEV,
E_SDK_CONFIG_ABILITY_LANG, E_SDK_CONFIG_VIDEO_FORMAT, E_SDK_CONFIG_COMBINEENCODE, E_SDK_CONFIG_EXPORT, E_SDK_CONFIG_IMPORT, E_SDK_LOG_EXPORT, E_SDK_CONFIG_COMBINEENCODEMODE, E_SDK_WORK_STATE,
}SDK_CONFIG_TYPE;
/// type of DDNS support struct SDK_DDNSServiceFunction { int }; /// blind detect support struct SDK_BlindDetectFunction { int iBlindCoverNum; }; /// motion detect struct SDK_MotionDetectFunction { int iGridRow; ///< the number of row ///< the number of cover area support nTypeNum; char vDDNSType[NET_MAX_DDNS_TYPE][64];
18 48
int iGridColumn; ///< the number of colum }; /// protocols of 232 support struct SDK_COMMFUNC { int nProNum; }; /// protocols of PTZ struct SDK_PTZPROTOCOLFUNC { int nProNum; char vPTZProtocol[100][NET_MAX_PTZ_PROTOCOL_LENGTH]; }; /// encode information struct SDK_EncodeInfo { bool bEnable; int iStreamType; bool bHaveAudio; ///< enable ///< stream type see refer to capture_channel_t ///< is support audio ///< mask of capture_comp_t ///< mask of capture_size_t ///< the numbers of protocol char vCommProtocol[SDK_COM_TYPES][32]; ///< the name of protocol
unsigned int uiCompression; unsigned int uiResolution; }; /// encode power struct CONFIG_EncodeAbility { int iMaxEncodePower;
bool vEncodeFunction[SDK_ENCODE_FUNCTION_TYPE_NR]; ///< Encode Functions bool vAlarmFunction[SDK_ALARM_FUNCTION_TYPE_NR]; bool vNetServerFunction[SDK_NET_SERVER_TYPES_NR]; bool vPreviewFunction[SDK_PREVIEW_TYPES_NR]; }; ///< Auto-Maintain setting struct SDK_AutoMaintainConfig { ///< Alarm Fucntions ///< Net Server Functions ///< Preview Functions
19 48
int iAutoRebootDay; int iAutoRebootHour; int iAutoDeleteFilesDays; }; //Disk info struct SDK_STORAGEDISK { int int }; iPhysicalNo; iPartNumber;
///< interval of Auto-Reboot days ///< time to reboot [0, 23] ///< interval of Auto-Del record file [0, 30]
SDK_DriverInformation diPartitions[SDK_MAX_DRIVER_PER_DISK]; struct SDK_StorageDeviceInformationAll { int iDiskNumber; SDK_STORAGEDISK vStorageDeviceInfoAll[SDK_MAX_DISK_PER_MACHINE]; }; // Type of PTZ link enum PtzLinkTypes { PTZ_LINK_NONE, PTZ_LINK_PRESET, PTZ_LINK_TOUR, PTZ_LINK_PATTERN }; // PTZ Link Config struct SDK_PtzLinkConfig { int iType; int iValue; }; // handler of event struct SDK_EventHandler { unsigned int unsigned int unsigned int unsigned int unsigned int unsigned int int dwRecord; iRecordLatch; dwTour; dwSnapShot; dwAlarmOut; dwMatrix; // bitmask of record. Bit per channel // record latch10300 sec. // bitmask of tour. Bit per channel // bitmask of snapshot. Bit per channel // bitmask of alarm out. Bit per channel // bitmask of matrix. Bit per channel // interval of event(unit:sec.) // see refer to PtzLinkTypes // value of link type // NONE // GOTO PRESET // TOUR // PATTERN
iEventLatch;
20 48
int
iAOLatch;
// Alarm out latch10300 sec // PTZ link activation // weeksheet of record // enable flag of record // enable flag of tour // enable flag of snapshot // enable flag of alarm out // enable flag of PTZ link // enable flag of screen tip // enable flag of sending email // enable flag of sending message to alarm center // enable flag of buzzer beep // enable flag of voice tip // enable flag of FTP unload // no used // enable flag of log // no used
SDK_PtzLinkConfig PtzLink[NET_MAX_CHANNUM]; SDK_CONFIG_WORKSHEET schedule; bool bool bool bool bool bool bool bool bool bool bool bool bool bool }; ///< Blind detect struct SDK_BLINDDETECTCONFIG { bool bEnable; int iLevel; SDK_EventHandler hEvent; }; /// All channel of blind detect configuration struct SDK_BLINDDETECTCONFIG_ALL { ///< enable bRecordEn; bTourEn; bSnapEn; bAlarmOutEn; bPtzEn; bTip; bMail; bMessage; bBeep; bVoice; bFTP; bMatrixEn; bLog; bMessagetoNet;
SDK_BLINDDETECTCONFIG vBlindDetectAll[NET_MAX_CHANNUM]; }; ///< Alarm in struct SDK_ALARM_INPUTCONFIG { bool bEnable; int }; ///< All channel of alarm in configuration struct SDK_ALARM_INPUTCONFIG_ALL { iSensorType; SDK_EventHandler hEvent; ///< enable ///< Sensor Type: Normal Open or Normal Close ///< handler of alarm in
21 48
SDK_ALARM_INPUTCONFIG vAlarmConfigAll[NET_MAX_CHANNUM]; }; ///< Motion detect struct SDK_MOTIONCONFIG { bool bEnable; int iLevel; unsigned int mRegion[NET_MD_REGION_ROW]; region: 18*22 SDK_EventHandler hEvent; }; /// All channel of video motion configuration struct SDK_MOTIONCONFIG_ALL { SDK_MOTIONCONFIG vMotionDetectAll[NET_MAX_CHANNUM]; }; ///< video loss detect struct SDK_VIDEOLOSSCONFIG { bool bEnable; }; /// All channel of video loss configuration struct SDK_VIDEOLOSSCONFIG_ALL { SDK_VIDEOLOSSCONFIG vGenericEventConfig[NET_MAX_CHANNUM]; }; /// record mode type enum SDK_RecordModeTypes { SDK_RECORD_MODE_CLOSED, SDK_RECORD_MODE_MANUAL, SDK_RECORD_MODE_CONFIG, SDK_RECORD_MODE_NR, }; ///< record setting struct SDK_RECORDCONFIG { ///< Closed ///< Manual: record all the time ///< Configuration: according to SDK_RECORDCONFIG ///< enable ///< event handler SDK_EventHandler hEvent; //< handler of motion detect //< enable //< sensitivity[1,6] //< regions of motion detectone bit per column, Max
22 48
int iPreRecord; bool bRedundancy; bool bSnapShot; int iPacketLength; int iRecordMode;
///< pre-record timeUnit:sec. ///< redundancy record ///< no used ///< record lengthunit:minute[1, 255] ///< record moderefer to SDK_RecordModeTypes ///< worksheet ///< mask of record type, corresponding to
SDK_RECORDCONFIG vRecordConfigAll[NET_MAX_CHANNUM]; }; // General Configuration typedef struct _SDK_CONFIG_NORMAL { NEW_NET_TIME sysTime; int iLocalNo; int iOverWrite; int iSnapInterval; char sMachineName[64]; int iVideoStartOutPut; int iAutoLogout; int iVideoFormat; int iLanguage; int iDateFormat; int iDateSeparator; int iTimeFormat; int iDSTRule; int iWorkDay; DSTPoint dDSTStart; DSTPoint dDSTEnd; }SDK_CONFIG_NORMAL; // encode configuration struct SDK_CONFIG_ENCODE { SDK_MEDIA_FORMAT dstMainFmt[SDK_ENCODE_TYPE_NUM]; SDK_MEDIA_FORMAT dstExtraFmt[SDK_EXTRATYPES]; // // main stream Extra stream ///< system time ///< device No.:[0, 998] ///< when disk full, 0: OverWrite, 1: StopRecord ///< no used ///< device name ///< no used ///< auto logout [0, 120], 0 means never ///< video format: 0:PAL, 1:NTSC, 2:SECAM ///< language: 0:English, 1: SimpChinese, 2:TradChinese, 3: Italian, ///< date format: 0:YYMMDD, 1:MMDDYY, 2:DDMMYY ///< Date separator: 0: ., 1: -, 2: / ///< Time format: 0: 12, 1: 24 ///< DST rule: 0: OFF, 1: ON ///< work day
23 48
SDK_MEDIA_FORMAT dstSnapFmt[SDK_ENCODE_TYPE_NUM]; }; // all of channel encode configuration struct { SDK_CONFIG_ENCODE vEncodeConfigAll[NET_MAX_CHANNUM]; }; // combine-encode struct { SDK_CONFIG_ENCODE vEncodeConfigAll[NET_MAX_COMBINE_NUM]; }; // newwork configuration struct SDK_CONFIG_NET_COMMON { char HostName[NET_NAME_PASSWORD_LEN]; ///< hostname CONFIG_IPAddress HostIP; CONFIG_IPAddress Submask; CONFIG_IPAddress Gateway; int HttpPort; int TCPPort; int SSLPort; int UDPPort; int MaxConn; int MonMode; TCP now int MaxBps; int TransferPlan; bool bUseHSDownLoad; }; ///< no used ///< IP ///< Netmask ///< NetGateway ///< HTTP port ///< TCP port ///< no used ///< no used ///< max connect SDK_CombineEncodeConfigAll SDK_EncodeConfigAll
//
Snapshot
///< Translation policy: 0: AUTO 1: Quality first 2: fluency first ///< flag of high speed download
// PTZ configuration struct SDK_STR_CONFIG_PTZ { char sProtocolName[NET_MAX_PTZ_PROTOCOL_LENGTH]; int ideviceNo; int iNumberInMatrixs; int iPortNo; SDK_COMMATTRI dstComm; //< device No. //< No. in Matrixs //< Port No.[1, 4] //< comm attribute //< Protocol name
24 48
}; // all channel of PTZ configuration struct SDK_STR_PTZCONFIG_ALL { SDK_STR_CONFIG_PTZ ptzAll[NET_MAX_CHANNUM]; }; // 232 configuration struct SDK_CONFIG_COMM_X { char iProtocolName[32]; // Protocol name:Console int iPortNo; }; // all channel of 232 configuration struct SDK_CommConfigAll { SDK_CONFIG_COMM_X vCommConfig[SDK_COM_TYPES]; }; // Port No. // comm attribute SDK_COMMATTRI aCommAttri;
///< IP Fliter struct SDK_NetIPFilterConfig { bool Enable; ///< enable ///< black list ///< white list CONFIG_IPAddress BannedList[NET_MAX_FILTERIP_NUM]; CONFIG_IPAddress TrustList[NET_MAX_FILTERIP_NUM]; };
///< multicast struct SDK_NetMultiCastConfig { bool Enable; }; ///< pppoe struct SDK_NetPPPoEConfig { bool Enable; ///< enable ///< PPPOE server ///< ip get from PPPOE dial SDK_RemoteServerConfig Server; CONFIG_IPAddress addr; ///< enable ///< multicast server SDK_RemoteServerConfig Server;
25 48
}; ///< DDNS struct SDK_NetDDNSConfig { bool Enable; ///< enable char DDNSKey[NET_NAME_PASSWORD_LEN]; ///< the type of DDNS name char HostName[NET_NAME_PASSWORD_LEN]; ///< hostname SDK_RemoteServerConfig Server; }; ///< DDNS struct SDK_NetDDNSConfigALL { SDK_NetDDNSConfig ddnsConfig[5]; }; ///< FTP struct SDK_FtpServerConfig { ///< enable bool Enable; ///< FTP server SDK_RemoteServerConfig Server; ///< spare server IP CONFIG_IPAddress SpareIP; ///< path name in FTP server char RemotePathName[NET_MAX_PATH_LENGTH]; ///< max file lenght int FileMaxLen; ///< upload periods SDK_TIMESECTION UpLoadPeriod[NET_N_MIN_TSECT]; }; ///< DDNS server
///< NTP struct SDK_NetNTPConfig { ///< enable bool Enable; ///< NTP server SDK_RemoteServerConfig Server; ///< update period int UpdatePeriod;
26 48
///< time zone int TimeZone; }; #define #define #define NET_MAX_EMAIL_TITLE_LEN 64 NET_MAX_EMAIL_RECIEVERS NET_EMAIL_ADDR_LEN 32 5
///< EMAIL struct SDK_NetEmailConfig { ///< enalbe bool Enable; ///< smtp server SDK_RemoteServerConfig Server; ///< is need SSL ? bool bUseSSL; ///< sender address char SendAddr[NET_EMAIL_ADDR_LEN]; ///< receiver char Recievers[NET_MAX_EMAIL_RECIEVERS][NET_EMAIL_ADDR_LEN]; ///< email title char Title[NET_MAX_EMAIL_TITLE_LEN]; ///< time section SDK_TIMESECTION Schedule[NET_N_MIN_TSECT]; };
/// audio format for audio talk struct SDK_AudioInFormatConfig { int iBitRate; int iSampleRate; int iSampleBit; int iEncodeType; }; ///< bitrate(unit:kbps) ///< sample rate(unit:Hz) ///< sample bit ///< type of encodesee refer to AudioEncodeTypes
27 48
/// alarm status struct SDK_DVR_ALARMSTATE { int iVideoMotion; ///< motion detect status, bit mask for channel,bit0 means channel 1,and so on,1: alarming 0: normal int iVideoBlind; ///< blind detect status, bit mask for channel,bit0 means channel 1,and so on,1: alarming 0: normal int iVideoLoss; alarming 0: normal int iAlarmIn; ///< alarm in status, bit mask for channel,bit0 means channel 1,and so on,1: alarming 0: normal int iAlarmOut; alarming 0: normal }; // channel status struct SDK_DVR_CHANNELSTATE { bool bRecord; ///< is recording int iBitrate; ///< bitrate }; // device work status struct SDK_DVR_WORKSTATE { SDK_DVR_CHANNELSTATE vChnState[NET_MAX_CHANNUM]; SDK_DVR_ALARMSTATE vAlarmState; }; ///< alarm out status, bit mask for channel,bit0 means channel 1,and so on,1: ///< loss detect status, bit mask for channel,bit0 means channel 1,and so on,1:
2.1.5 Network
/// KEY VALUE
keyboard define
enum SDK_NetKeyBoardValue { SDK_NET_KEY_0, SDK_NET_KEY_1, SDK_NET_KEY_2, SDK_NET_KEY_3, SDK_NET_KEY_4, SDK_NET_KEY_5, SDK_NET_KEY_6, SDK_NET_KEY_7, SDK_NET_KEY_8, SDK_NET_KEY_9, SDK_NET_KEY_10, SDK_NET_KEY_11, SDK_NET_KEY_12, SDK_NET_KEY_13, SDK_NET_KEY_14, SDK_NET_KEY_15, SDK_NET_KEY_16, SDK_NET_KEY_10PLUS, SDK_NET_KEY_UP = 20, SDK_NET_KEY_DOWN, SDK_NET_KEY_LEFT, // UP // DOWN // LEFT
28 48
SDK_NET_KEY_RIGHT, SDK_NET_KEY_SHIFT, SDK_NET_KEY_PGUP, SDK_NET_KEY_PGDN, SDK_NET_KEY_RET, SDK_NET_KEY_ESC, SDK_NET_KEY_FUNC, SDK_NET_KEY_PLAY, SDK_NET_KEY_BACK, SDK_NET_KEY_STOP, SDK_NET_KEY_FAST, SDK_NET_KEY_SLOW, SDK_NET_KEY_NEXT, SDK_NET_KEY_PREV, SDK_NET_KEY_REC = 40, SDK_NET_KEY_SEARCH, SDK_NET_KEY_INFO, SDK_NET_KEY_ALARM, SDK_NET_KEY_ADDR, SDK_NET_KEY_BACKUP, SDK_NET_KEY_SPLIT, SDK_NET_KEY_SPLIT1, SDK_NET_KEY_SPLIT4, SDK_NET_KEY_SPLIT8, SDK_NET_KEY_SPLIT9, SDK_NET_KEY_SPLIT16, SDK_NET_KEY_SHUT, SDK_NET_KEY_MENU, SDK_NET_KEY_PTZ = 60, SDK_NET_KEY_TELE, SDK_NET_KEY_WIDE, SDK_NET_KEY_IRIS_SMALL, SDK_NET_KEY_IRIS_LARGE, SDK_NET_KEY_FOCUS_NEAR, SDK_NET_KEY_FOCUS_FAR, SDK_NET_KEY_BRUSH, SDK_NET_KEY_LIGHT, SDK_NET_KEY_SPRESET, SDK_NET_KEY_GPRESET, SDK_NET_KEY_DPRESET, SDK_NET_KEY_PATTERN, SDK_NET_KEY_AUTOSCAN, SDK_NET_KEY_AUTOTOUR,
// RIGHT // PAGE UP // PAGE DOWN // ENTER // ESC // FUNC // PLAY/PAUSE // BACK // STOP // FAST // SLOW // NEXT FILE // PREV FILE // ENTER RECORD SETTING PAGE // ENTER RECORD SEARCH PAGE // ENTER SYSTEM INFO PAGE // ENTER ALARM OUT PAGE // ENTER REMOTE ADDRESS SETTING PAGE // ENTER BACKUP PAGE // NEXT SPLIT MODE // SLPIT MODE 1 // SLPIT MODE 4 // SLPIT MODE 8 // SLPIT MODE 9 // SLPIT MODE 16 // SHUTDOWN // MENU // ENTER PTZ CONTROL PAGE // ZOOM // ZOOM + // APERTURE // APERTURE + // FOCUS // FOCUS + // BRUSH // LIGHT // SET PRESET POINT // GOTO PRESET POINT // CLEAR PRESET POINT // PATTERN // AUTO-SCAN ON/OFF // AUTO-TOUR ON/OFF
29 48
SDK_NET_KEY_AUTOPAN, }; /// keyboard status enum SDK_NetKeyBoardState { SDK_NET_KEYBOARD_KEYDOWN, SDK_NET_KEYBOARD_KEYUP, }; struct SDK_NetKeyBoardData { int iValue; int iState; };
// AUTO-PAN ON/OFF
30 48
3 API Definition
3.1 SDK Initialization
1.
H264_DVR_API long H264_DVR_GetLastError();;
API description: It is to return function failure code. when you failed to call the following interface, you can call this fucntion to get error code. Parameter: none Return: Please see refer to error code Reference API
typedef void (__stdcall *fDisConnect)(long lLoginID, char *pchDVRIP, long nDVRPort, unsigned long dwUser); 2. H264_DVR_API long H264_DVR_Init(fDisConnect cbDisConnect, unsigned long dwUser);
API descriptionInitialize SDK, calling before all SDK function Parameter cbDisConnect
Disconnect callback function. It is to callback disconnect device excluding device logout successfully(call H264_DVR_Logout(), set it as 0 when forbid callbacking.
pchDVRIP
Device IP
nDVRPort
Port
dwUser
User data, just the same with the above user data you have input.
3.
API descriptionClean up SDK and release occupied resource, calling after all SDK
31 48
function.
API descriptionSet device message callback fuction to get device current state. Callback
order does not matter here. SDK default setting is not to callback.You need to call alarm message subscription interface H264_DVR_SetupAlarmChan().It applies to current defined alarm status.Device state is callbacked every second.
Parameter cbAlarmcallback Message callback function.It is to callback device status (such as alarm status). When it is 0, system disables callback. [in] lUser user self-defined data
function parameters:
\Callback
lLoginID Return value of H264_DVR_Login pBuf Refer to see SDK_AlarmInfo dwBufLen pBuf length. Unit is byte. dwUser User self-defined data
4.
Parameter
[in]lLoginID Return value of H264_DVR_Login
32 48
5.
33 48
SDK
Parameter
[in] sDVRIP device IP [in] wDVRPort device port [in] sUserName user name [in] sPassword password [out] lpDeviceInfo device property. it is a output parameter. [out] error (when the function returned successfully, the parameter is null.Please refer to error code.
7.
Reference APIH264_DVR_Logout
H264_DVR_API long H264_DVR_LoginEx(char *sDVRIP, unsigned short wDVRPort, char *sUserName, char *sPassword, LPH264_DVR_DEVICEINFO lpDeviceInfo, int nType, int *error);
Parameter [in] sDVRIP device IP [in] wDVRPort device port [in] sUserName user name [in] sPassword
34 48
SDK
password [out] lpDeviceInfo device property. it is a output parameter. [in] nType the type as follows: enum LoginType { LOGIN_TYPE_GUI, ///< Local GUI LOGIN_TYPE_CONSOLE, ///< Console LOGIN_TYPE_WEB, ///< WEB LOGIN_TYPE_SNS, ///< SNS LOGIN_TYPE_MOBIL, ///< Mobile terminal LOGIN_TYPE_NETKEYBOARD, ///< Netkeyboard LOGIN_TYPE_SERVER, ///< Center servers LOGIN_TYPE_AUTOSEARCH, ///< IP search tool LOGIN_TYPE_UPGRADE, ///< Upgrade tool LOGIN_TYPE_MEGAEYE, ///< Megaeye LOGIN_TYPE_NR, }; [out] error (when the function returned successfully, the parameter is null.Please refer to error code.
SDK
10.
ReturnReturn real-time monitor handle if succeeded, return 0 if failed. Reference API H264_DVR_StopRealPlay H264_DVR_SetRealDataCallBack
H264_DVR_API bool H264_DVR_StopRealPlay(long lRealHandle);
11. H264_DVR_API bool H264_DVR_SetRealDataCallBack(long lRealHandle,fRealDataCallBack cbRealData, long dwUser); typedef int(__stdcall *fRealDataCallBack) (long lRealHandle, long dwDataType, unsigned char *pBuffer,long lbufsize,long dwUser);
Parameter
[in]lRealHandle Return value of H264_DVR_RealPlay cbRealData It is a callback function to output the current real-time data from the device. [in]dwUser User data
Callback function parameters: lRealHandle Return value of H264_DVR_RealPlay dwDataType 0: original data 1: Frame data 2: yuv data 3: pcm audio data pBuffer call-back data. Everytime calling back data of different lengths according to the different data types (except type
36 48
SDK
0). Other data types are based on frames, every time it calls back one frame. dwBufSize length of callback data.(Unit:byte). dwUser User self-defined
typedef void(__stdcall *fDownLoadPosCallBack) (long lPlayHandle, long lTotalSize, long lDownLoadSize, long dwUser) 13. H264_DVR_API long H264_DVR_PlayBackByName(long
37 48
lLoginID,
SDK
Parameter [in]lLoginID Return value of H264_DVR_Login [in] sPlayBackFile Recorded file information return by H264_DVR_FindFile [in] cbDownLoadPos Progress call-back function [in] fDownLoadDataCallBack Video data call-back function [in]dwUserData User self-defined data CallBack function
lPlayHandle Return value of H264_DVR_PlayBackByName dwTotalSize Current total play size, unit is KB. dwDownLoadSize Played sizeunit is KB. When value is -1, it means cureent playback is over. dwUser User data, just the same with user data in the above.
14.
38 48
SDK
15.
H264_DVR_API long H264_DVR_GetFileByName(long lLoginID,H264_DVR_FILE_DATA *sPlayBackFile,char *sSavedFileName, fDownLoadPosCallBack cbDownLoadPos = NULL, long dwDataUser = NULL );
CallBack function
lPlayHandle Return value of H264_DVR_PlayBackByName dwTotalSize Current total play size, unit is KB. dwDownLoadSize Played sizeunit is KB. When value is -1, it means cureent playback is over. dwUser User data, just the same with user data in the above.
16.
17.
39 48
SDK
Parameter
[in]lFileHandle The return value of H264_DVR_GetFileByName
40 48
SDK
Commands, see refer to PTZ_ControlType [in] bStop Whether stop or not. It applies to PTZ direction andlens operation. When you operate other functions, input this parameter as FALSE. [out] lSpeed Step/Speed. The value ranges from 1 to 8. 8 has the highest control capability(4 by default). dwStep is the preset value when you use preset function.
[in]lLoginID The return value of H264_DVR_Login [in]dwCommand Configuration type, Please refer to SDK_CONFIG_TYPE [in]nChannelNO Channel number. Set as -1 to configure all channels. The parameter is null if command does not need the channel number. [out] lpOutBuffer Receive data buffer pointer, buffer length depend on configuration structure size. [in]dwOutBufferSize Receive data buffer lenght(Unit:byte) [out]lpBytesReturned The data lenght actually received. [in]waittime Waiting time
41 48
SDK
21.
H264_DVR_API long H264_DVR_SetDevConfig(long lLoginID, unsigned long dwCommand, int nChannelNO, char * lpInBuffer, unsigned long dwInBufferSize, int waittime = 1000);
[in]lLoginID The return value of H264_DVR_Login [in]dwCommand Configuration type, Please refer to SDK_CONFIG_TYPE [in]nChannelNO Channel number. Set as -1 to configure all channels. The parameter is null if command does not need the channel number. [in]lpInBuffer Data buffer pointer [in]dwInBufferSize Data buffer lenght(unit is byte). [in]waittime Waitting time
42 48
SDK
Reference APINone
3.11 Upgrade
typedef void(__stdcall *fUpgradeCallBack) (long lLoginID, long lUpgradechannel, int nTotalSize, int nSendSize, long dwUser); H264_DVR_API long H264_DVR_Upgrade(long lLoginID, char *sFileName, int nType = 0, fUpgradeCallBack cbUpgrade = NULL, long dwUser = 0);
24.
CallBack function
fUpgradeCallBack
43 48
SDK
Callback of upgrade progress, lUpgradechannel is the upgrade handle, return by H264_DVR_Upgrade nTotalSize Upgrade file lenght,(Unit: BYTE) nSendSize data length have been upgraded,(unit: BYTE) [in]dwUser User self-define data
26.
27.
44 48
SDK
szBuf buffer length [in] pRetLen Return the structure total length of SDK_CONFIG_NET_COMMON [in] nSearchTime Waiting time
28.
29.
45 48
SDK
[in] lVoiceHandle Return value of H264_DVR_StartVoiceCom_MR [in] pSendBuf The audio data to be sent out. [in] lBufSize Audio data length to be sent out.(Unit:byte)
30.
31.
46 48
SDK
the return value of H264_DVR_Login [in] nChannelNo Channel No., -1 all of channel [in] lRecordType
Record mode, see refer to SDK_RecordModeTypes
33.
47 48
SDK
48 48