Professional Documents
Culture Documents
API Reference
Copyright
ⓒ2011-2014 Hanwha Techwin Co., Ltd. All rights reserved.
XNS_ACTIVEX_API_EN
Trademark
Ed.1.43.20
XNS ActiveX is a registered trademark of Hanwha Techwin
2016-03-25 Co., Ltd.
Other trademarks mentioned in this document are the
registered trademarks of Samsung Techwin Co., Ltd.
Restriction
Copyright of this document is owned by Hanwha Techwin
Co., Ltd. Making a copy or change, distribution or
reproduction of this document without written formal
authorization by Hanwha Techwin is strictly prohibited.
Disclaimer
Hanwha Techwin Co., Ltd. has made its best effort to
ensure the integrity and accuracy of this document.
However, the Company shall not take any responsibility
for this document. Use and the result of use of this
document solely depend upon the user.
This document is subject to change without prior
notification by Hanwha Techwin Co., Ltd.
Contact Information
HANWHA TECHWIN Co., LTD.
Hanwha techwin R&D Center, 6, Pangyo-ro 319beon-gil,
Bundang-gu, Seongnam-si, Gyeonggi-do, Korea, 463-400
TEL: +82-70-7147-8740~60 FAX: +82-31-8018-3745
http://www.samsungsecuritypartner.com
Purpose Organization
This document is prepared to provide necessary This document consists of:
information so that you can create an application using
ㆍ CHAPTER 1. XNS ActiveX SDK: Structure and
XNS ActiveX SDK developed by Hanwha Techwin. You
installation of XNS ActiveX SDK.
can use XNS ActiveX SDK to obtain AV data from a
network camera or control the PTZ operations or the ㆍ CHAPTER 2. XnsSdkDevice: Description about
Scope
Installation of XNS ActiveX SDK and implementation of
application are included in the scope of this document.
Convention
ㆍ Brackets ([,]) indicate button names and menus.
1.3.1 2011.6.24 New models are added to Table 1.1 Supported Device List (SDK v1.30)
Add a setup procedure in Windows 7 environment
Add a GMT time set-up information
Add DEP Trouble shooting section
Add API specification
ㆍ OpenMediaEx
ㆍ AreaZoom(), Zoom1X()
ㆍ OnIvEvent()
ㆍ GetPtzPos(), SetPtzPos()
ㆍ OnGetPtzPos()
ㆍ LocalTimeToDeviceUTC()
ㆍ SetDefogMode
Change SDK Architecture view and description
Fix the example code of Stop() function
Change a description of Start()function
Add a restriction when using Device Control object (SDK v1.30.06)
1.42.50 2015.08.24 Add description about getting/setting PTZ position API and event
ㆍ XnsSdkDevice::GetPtzPosNormalize()
ㆍ XnsSdkDevice::SetPtzPosNormalize()
ㆍ XnsSdkDevice::OnGetPtzPosNormalize()
Preface...........................................................................................................................................................................................................................2
Revision History.......................................................................................................................................................................................................3
Table of Contents....................................................................................................................................................................................................7
Figures ........................................................................................................................................................................................................................18
Tables...........................................................................................................................................................................................................................19
Overview ....................................................................................................................................................................... 21
SDK Structure.............................................................................................................................................................. 23
Compatibility ............................................................................................................................................................... 24
CHAPTER 2 XnsSdkDevice............................................................................................................................................................................25
Initialize .......................................................................................................................................................................... 26
Initialize ..................................................................................................................................................................... 26
GetConfigPath........................................................................................................................................................ 27
Find .................................................................................................................................................................................. 27
FindVendor .............................................................................................................................................................. 28
FindModel................................................................................................................................................................ 29
FindDevice ............................................................................................................................................................... 30
GetFindSize ............................................................................................................................................................. 30
GetFindString ......................................................................................................................................................... 31
GetFindLong ........................................................................................................................................................... 32
GetFindDouble ...................................................................................................................................................... 33
CloseFind .................................................................................................................................................................. 34
CreateDevice........................................................................................................................................................... 35
ReleaseDevice ........................................................................................................................................................ 35
SetConnectionInfo ............................................................................................................................................... 36
SetConnectionInfo2 ............................................................................................................................................ 39
GetDeviceID ............................................................................................................................................................ 41
GetDeviceStatus .................................................................................................................................................... 41
GetVendorName ................................................................................................................................................... 42
GetModelName..................................................................................................................................................... 43
GetVersion ............................................................................................................................................................... 43
GetAddressType .................................................................................................................................................... 44
GetIP ........................................................................................................................................................................... 45
GetMac ...................................................................................................................................................................... 45
GetURL ...................................................................................................................................................................... 46
GetPort ...................................................................................................................................................................... 47
GetHttpPort............................................................................................................................................................. 47
GetUserID ................................................................................................................................................................. 48
GetPassword ........................................................................................................................................................... 49
GetLatestUpdateTime ......................................................................................................................................... 49
GetDeviceHandle .................................................................................................................................................. 50
GetDeviceUTC ........................................................................................................................................................ 51
GetDeviceLocalTime ............................................................................................................................................ 51
ChangeDeviceAdminPassword ...................................................................................................................... 52
Connect/Disconnect ................................................................................................................................................ 53
Connect ..................................................................................................................................................................... 53
ConnectNonBlock ................................................................................................................................................ 54
Disconnect ............................................................................................................................................................... 55
GetControlCount .................................................................................................................................................. 60
GetControlType ..................................................................................................................................................... 60
GetControlNumber .............................................................................................................................................. 61
GetControlDepth .................................................................................................................................................. 62
GetControlLocalName ........................................................................................................................................ 63
GetControlRemoteName .................................................................................................................................. 64
GetControlStatus .................................................................................................................................................. 65
GetControlCapability .......................................................................................................................................... 67
ChangeControlLocalName ............................................................................................................................... 71
GetParentControlID ............................................................................................................................................. 73
GetVideoResolution ............................................................................................................................................ 74
GetVideoFrameRate ............................................................................................................................................ 75
GetVideoQuality.................................................................................................................................................... 76
GetVideoCodec ..................................................................................................................................................... 76
AcquireMediaAuthority ..................................................................................................................................... 78
ReleaseMediaAuthority ..................................................................................................................................... 78
OpenMedia ............................................................................................................................................................. 79
OpenMediaEx ......................................................................................................................................................... 81
CloseMedia.............................................................................................................................................................. 82
OpenStream ............................................................................................................................................................ 83
CloseStream ............................................................................................................................................................ 84
SuspendStream ..................................................................................................................................................... 85
SuspendAllStream ................................................................................................................................................ 86
ResumeStream ....................................................................................................................................................... 87
ResumeAllStream.................................................................................................................................................. 88
IsPlaying .................................................................................................................................................................... 89
HasAuthority ........................................................................................................................................................... 90
SetVideoFrameInfoReceived ........................................................................................................................... 91
PlayControl ................................................................................................................................................................... 92
Play.............................................................................................................................................................................. 92
Pause .......................................................................................................................................................................... 93
Seek ............................................................................................................................................................................ 94
FrameAdvance ....................................................................................................................................................... 95
SearchCalendar...................................................................................................................................................... 96
SearchOverLap....................................................................................................................................................... 97
GetStartRecordingTime ..................................................................................................................................... 98
GetEndRecordingTime ....................................................................................................................................... 99
SearchDay ..............................................................................................................................................................100
GetMotionGrid ....................................................................................................................................................101
MotionSearch .......................................................................................................................................................102
SetTalk......................................................................................................................................................................104
SetListen .................................................................................................................................................................105
SendAudioData ...................................................................................................................................................107
SendAudioData2.................................................................................................................................................108
StopAudioData2..................................................................................................................................................109
SetAlarm .................................................................................................................................................................109
ControlPtz ..............................................................................................................................................................110
ControlPtzFreeMove .........................................................................................................................................112
ControlPtzSpeedZoomIn ................................................................................................................................113
ControlPtzSpeedZoomOut ............................................................................................................................114
ControlPPtz ...........................................................................................................................................................115
ControlMenu ........................................................................................................................................................117
ExecuteHPtz ..........................................................................................................................................................118
GetPresetList .........................................................................................................................................................120
SetPreset.................................................................................................................................................................121
DeletePreset ..........................................................................................................................................................122
DeletePresetAll ....................................................................................................................................................123
GetPresetCount ...................................................................................................................................................124
GetPreset ................................................................................................................................................................125
GetPtzPos ...............................................................................................................................................................126
SetPtzPos ................................................................................................................................................................127
GetPtzPosNormalize .........................................................................................................................................129
SetPtzPosNormalize ..........................................................................................................................................129
AreaZoom ..............................................................................................................................................................131
Zoom1X ..................................................................................................................................................................133
Timeline .......................................................................................................................................................................134
GetCameraCount ................................................................................................................................................135
GetTimelineCount ..............................................................................................................................................135
GetTimeline ...........................................................................................................................................................137
Recording....................................................................................................................................................................140
StartLocalRecording ..........................................................................................................................................140
StopLocalRecording ..........................................................................................................................................141
StartAviLocalRecording ....................................................................................................................................142
StopAviLocalRecording ....................................................................................................................................143
ToggleDvrRecording .........................................................................................................................................144
Backup ..........................................................................................................................................................................145
StartBackup ...........................................................................................................................................................145
StopBackup ...........................................................................................................................................................147
StartAviBackup .....................................................................................................................................................147
StopAviBackup .....................................................................................................................................................149
GetAviOptionSize ...............................................................................................................................................150
SetAviOptionSize ................................................................................................................................................150
GetAviOptionPeriod ..........................................................................................................................................151
SetAviOptionPeriod ...........................................................................................................................................151
StartSecBackup ....................................................................................................................................................152
CreateFileReader .................................................................................................................................................154
ReleaseFileReader...............................................................................................................................................155
GetFileName .........................................................................................................................................................155
GetMediaSource .................................................................................................................................................156
GetTimelineHandle ............................................................................................................................................156
PlayReader .............................................................................................................................................................157
PauseReader .........................................................................................................................................................158
ConvertRec2Avi ...................................................................................................................................................159
StopRec2Avi ..........................................................................................................................................................159
UploadSoftware...................................................................................................................................................160
ImportConfig ........................................................................................................................................................161
ExportConfig.........................................................................................................................................................162
SaveDeviceProfile ...............................................................................................................................................164
DeleteDeviceProfile ...........................................................................................................................................165
ReadConfigValue ................................................................................................................................................166
WriteConfigValue ...............................................................................................................................................167
DeleteConfigValue .............................................................................................................................................167
CopyXml .................................................................................................................................................................168
FindConfigChildeKeyList .................................................................................................................................169
Miscellaneous ...........................................................................................................................................................169
DateToTimet..........................................................................................................................................................170
TimetToDate..........................................................................................................................................................171
LocalTimeToDeviceUTC ....................................................................................................................................172
UTCToDeviceLocalTime ....................................................................................................................................173
AutoScan ................................................................................................................................................................174
IPInstall ....................................................................................................................................................................175
IPInstallDhcp .........................................................................................................................................................176
SetEventDiscardTime ........................................................................................................................................178
GetErrorString ......................................................................................................................................................178
PowerRestart.........................................................................................................................................................179
Events ...........................................................................................................................................................................180
OnControlLocalNameChanged ....................................................................................................................180
OnDeviceDetected .............................................................................................................................................181
OnDeviceDetected2 ..........................................................................................................................................183
OnDeviceDetected3 ..........................................................................................................................................185
OnDeviceInstalled ..............................................................................................................................................187
OnConnectFailed ................................................................................................................................................189
OnSearchCalendar .............................................................................................................................................190
OnSearchOverLap ..............................................................................................................................................192
OnGetStartRecordingTime .............................................................................................................................193
OnGetEndRecordingTime ...............................................................................................................................194
OnSearchDay ........................................................................................................................................................195
OnGetMotionGrid ..............................................................................................................................................196
OnMotionSearch ................................................................................................................................................198
OnGetPresetList ..................................................................................................................................................200
OnUploadSoftwareProgress ..........................................................................................................................201
OnImportConfigProgress ...............................................................................................................................202
OnExportConfigProgress ................................................................................................................................203
OnDeviceStatusChanged ................................................................................................................................204
OnControlStatusChanged ..............................................................................................................................205
OnControlCapabilityChanged ......................................................................................................................207
OnMotionEvent ...................................................................................................................................................208
OnSensorEvent ....................................................................................................................................................209
OnIvOccurEvent ..................................................................................................................................................210
OnVideoLossEvent .............................................................................................................................................212
OnHDDFailed........................................................................................................................................................213
OnHDDFulled .......................................................................................................................................................213
OnHDDNumChanged ......................................................................................................................................214
OnPasswordChanged .......................................................................................................................................215
OnBackupProgress.............................................................................................................................................216
OnNewMedia .......................................................................................................................................................217
OnFanBroken ........................................................................................................................................................223
OnFanStatusChanged .......................................................................................................................................223
OnPtzControlFailed............................................................................................................................................224
OnAlarmOutControlFailed..............................................................................................................................225
OnControlRemoteNameChanged ..............................................................................................................226
OnGetPtzPos.........................................................................................................................................................227
OnGetPtzPosNormalize ...................................................................................................................................228
OnAreaZoomMoving ........................................................................................................................................229
OnVideoFrameInfoReceived..........................................................................................................................231
OnRecordingErrorEvent ...................................................................................................................................232
OnPowerRestart ..................................................................................................................................................233
OnRecordingStatusChanged .........................................................................................................................234
OnTrackingEventChanged ..............................................................................................................................235
OnFaceDetectionEventChanged..................................................................................................................237
OnAudioDetectionEventChanged ..............................................................................................................238
OnAMDEventChanged .....................................................................................................................................240
OnSystemEventChanged ................................................................................................................................242
OnChangeDeviceAdminPassword ..............................................................................................................245
CHAPTER 3 XnsSdkWindow....................................................................................................................................................................247
Initialize ...................................................................................................................................................................248
Start ..........................................................................................................................................................................249
Stop...........................................................................................................................................................................250
GetDeviceID ..........................................................................................................................................................250
GetControlID.........................................................................................................................................................251
GetImageWidth ...................................................................................................................................................251
GetImageHeight .................................................................................................................................................252
IsMedia ....................................................................................................................................................................252
GetMediaType ......................................................................................................................................................253
ZoomLevel .............................................................................................................................................................254
ZoomRate ..............................................................................................................................................................255
GetZoomInfo ........................................................................................................................................................256
ClearZoom .............................................................................................................................................................257
DrawRect ................................................................................................................................................................258
ClearDraw...............................................................................................................................................................259
DrawShape ............................................................................................................................................................259
OSD Menu..................................................................................................................................................................261
SetOSDOnOff .......................................................................................................................................................261
SetDateTimeFormat ..........................................................................................................................................262
SetCustomOSD ....................................................................................................................................................263
SetCustomOSDOnOff .......................................................................................................................................264
SetVolume..............................................................................................................................................................265
GetVolume .............................................................................................................................................................266
SetVideoRawDataReceived ............................................................................................................................266
UnSetVideoRawDataReceived ......................................................................................................................267
Snapshot .....................................................................................................................................................................268
SaveSnapshot .......................................................................................................................................................268
SaveSnapshotWithString.................................................................................................................................269
SaveSnapshotWithData ...................................................................................................................................271
PrintSnapshot .......................................................................................................................................................272
PushMedia .............................................................................................................................................................273
SetPlaySpeed ........................................................................................................................................................274
GetPlaySpeed .......................................................................................................................................................275
MoveFrameAdvance .........................................................................................................................................275
ClearMediaBuffer ................................................................................................................................................276
IsBufferFull .............................................................................................................................................................277
IsBufferEmpty .......................................................................................................................................................277
SetBufferSize.........................................................................................................................................................278
GetBufferSize ........................................................................................................................................................278
GetRemainingBufferSize..................................................................................................................................279
GetCurrentFrameTime ......................................................................................................................................280
GetFirstFrameTime.............................................................................................................................................280
SetBrightness........................................................................................................................................................285
GetBrightness .......................................................................................................................................................285
SetContrast ............................................................................................................................................................286
GetContrast ...........................................................................................................................................................286
SetDeinterlaceMode .........................................................................................................................................287
SetDefogMode ....................................................................................................................................................287
SetImageFlip .........................................................................................................................................................288
GetVideoPixelFormat ........................................................................................................................................289
SetAspectRatio ....................................................................................................................................................289
Miscellaneous ...........................................................................................................................................................290
DisplayNoData .....................................................................................................................................................290
SetCursor................................................................................................................................................................291
GetLastError ..........................................................................................................................................................291
DateToTimet..........................................................................................................................................................292
TimetToDate..........................................................................................................................................................293
Events ...........................................................................................................................................................................294
OnFrameTimeChanged....................................................................................................................................294
OnImageResolutionChanged........................................................................................................................295
OnMediaOn ..........................................................................................................................................................296
OnMediaOff ..........................................................................................................................................................297
OnVideoRawDataReceived ............................................................................................................................297
OnLButtonDown .................................................................................................................................................299
OnLButtonUp .......................................................................................................................................................300
OnRButtonDown.................................................................................................................................................301
OnRButtonUp .......................................................................................................................................................302
OnLButtonDblClk ................................................................................................................................................303
OnRButtonDblClk ...............................................................................................................................................304
OnMouseMove....................................................................................................................................................305
OnMouseHover ...................................................................................................................................................306
OnMouseLeave....................................................................................................................................................307
OnBufferFull ..........................................................................................................................................................308
OnBufferEmpty ....................................................................................................................................................308
OnPreBufferFull ...................................................................................................................................................309
OnPreBufferEmpty .............................................................................................................................................309
OnEventStatusChanged ...................................................................................................................................310
OnKeyDown ..........................................................................................................................................................311
OnKeyUp ................................................................................................................................................................312
Glossary..................................................................................................................................................................................................................320
Abbreviations......................................................................................................................................................................................................321
Index............................................................................................................................................................................................................................322
Table 3-3 Description About nFlags Items for the OnKeyDown Event .......................................... 311
Table 3-4 Description about nFlags Items for the OnKeyUp Event .............................................. 313
CHAPTER 1
Contents
ㆍ Overview
ㆍ SDK Architecture
ㆍ SDK Structure
ㆍ Compatibility
CHAPTER 1
Overview
XNS ActiveX SDK is a XNS library-based library where Active X technology developed by
Microsoft is applied. By introducing ActiveX technology, the developer can take advantage of
the XNS ActiveX library in various platforms and languages such as Java script in Internet
Explorer, Visual Basic, Visual C++ and .Net framwork.
XNS library supports low-level streaming and receiving events while XNS ActiveX library can
display the video and play audio signal as well. The purpose of developing XNS ActiveX library
is to make the development personnel integrate Samsung network devices (i.e., camera, DVR)
in a simple and smart way.
To implement an application using XNS ActiveX library, the system requires DLL files and
ActiveX provided by XNS ActiveX SDK. The ActiveX file (i.e., ocx file), in particular, should be
added to the registry. The installer program of XNS ActiveX SDK saves the DLL and ActiveX files
in a predefined path. For more details about the installation, see the "Installing SDK" section
later in the XNS AcitveX Programmer’s Guide.
SDK Architecture
• Application
- User program that enables monitoring, playing and searching for the video data stored
in the network device such as DVR or network camera.
- XNS Device: ActiveX control that enables you to manage the network devices and XNS
library.
- XNS Manager: DLL library that manages XNS library and events.
- SP Library: Transfers video data incoming from a network device to XNS Manager and
controls the device by user commands.
SDK Structure
- DLL files and OCX files that are used in the development process of an application.
• Configuration file
- XML file for the system configuration will be saved in the "{$SDK path}\Bin\Config"
folder.
- In particular, XNS or XML file contains information on DLLs for each protocol file.
- If the file location is changed, the Xns.xml document should be changed accordingly.
- If the application saves/make backup of the media stream in ‘SEC’ format, the media can
be played using this player. Then, the file name in the viewer should be the same as
backup file name specified in the library. If the application runs the viewer, the SEC file
with the same name will be loaded automatically.
• Header file
- For the application to take advantage of XNS, these header files should be included.
• Document
• Sample codes
- Sample codes to monitor/play video data and to control the PTZ operations provided.
- Executables of the sample code are installed in the “{$SDK path}\Bin” folder.
Compatibility
Note
It’s not mean all devices can support all functions of the SDK. You should check first if your
device can satisfy your requirement using the SDK. The SDK provides a GetControlCapability()
function to check capabilities of the device.
XnsSdkDevice
Contents
ㆍ Initialize
ㆍ Find
ㆍ Create/Release Device
ㆍ Connect/Disconnect
ㆍ Play Control
ㆍ Control PTZ
ㆍ Timeline
ㆍ Recording
ㆍ Backup
ㆍ Device Profile
ㆍ XML File
ㆍ Miscellaneous
ㆍ Events
CHAPTER 2
XnsSdkDevice Initialize
Initialize
Initialize
Description
Initializes the DLL files. For this, XnsActiveX library requires config.xml, device.xml, and xns.xml
files and the DLL file list should be mentioned in Xns.xml file. The path of the DLL file cannot
exceed 512 bytes in length. The XnsActiveX library searches for xns.xml using XnsSDKDevice.ocx
installed in "{$SDK path}\Config" folder.
Syntax
long Initialize(void);
Return Value
When this function is completed successfully, it returns ERR_SUCCES. Otherwise, it returns an
error code.
Remarks
If failed to load the DLL file listed in Xns.xml, an error message will appear on the screen. The
error message includes information about the device ID.
Caution
XNS Active Device Control instance should be constructed once within a process. So be careful
that you might not call this Initialize function once more.
Example
[C++]
long ErrCode = m_ctlXnsDevice.Initialize();
{
char str[100];
sprintf(str, "ErrorCode[0x%x]\n", ErrCode);
OutputDebugString(str);
}
See Also
XnsSdkWindow::Initialize
GetConfigPath
Description
Returns the full path of the Configuration folder (i.e., {$SDK path}\Bin\Config). The Xns.xml file
must be included in the returned path by this function.
Syntax
BSTR GetConfigPath(void);
Return Value
Returns the full path of the Configuration folder.
Example
[C++]
CString str = m_ctlXnsDevice.GetConfigPath();
Find
Finds information mentioned in the configuration file before returning. To enable this function,
follow the steps below:
Procedure
Step 3. Use GetFindString() to obtain the vendor name and model name.
Step 4. Use GetFindLong() and GetFindDouble0 to obtain the device ID. (Repeat this process if
necessary)
Example
[C++]
long hFind = m_ctlXnsDevice.FindModel(“Samsung");
long nFindSize = m_ctlXnsDevice.GetFindSize(hFind);
CString str;
for (int i=0; i<nFindSize; i++)
{
str = m_ctlXnsDevice.GetFindString(hFind, i);
OutputDebugString(str);
}
m_ctlXnsDevice.CloseFind(hFind);
[C#]
int hFind = this._axXnsDevice.FindVendor();
int nFindSize = this._axXnsDevice.GetFindSize(hFind);
FindVendor
Description
Returns the vendor list described in Xns.xml.
Syntax
long FindVendor(void);
Return Value
Returns the handle of the Find array. Returns Null(0) if no vendor list is found.
Example
[C++]
long hFind = m_ctlXnsDevice.FindVendor();
long nFindSize = m_ctlXnsDevice.GetFindSize(hFind);
CString str;
for (int i=0; i<nFindSize; i++)
{
str = m_ctlXnsDevice.GetFindString(hFind, i);
OutputDebugString(str);
}
m_ctlXnsDevice.CloseFind(hFind);
See Also
FindModel, FindDevice
FindModel
Description
Returns the model list mentioned in Xns.xml.
Syntax
long FindModel(BSTR szVendorName);
Parameters
szVendorName
Return Value
Returns the handle of the Find array. Returns NULL(0) if no model list is found.
Example
See the examples in the "Find" section.
See Also
FindVendor, FindDevice
FindDevice
Description
Returns all device IDs listed in the device list file. The file will be created automatically when
using SaveDeviceProfile() to save the device information.
Syntax
long FindDevice(void);
Return Value
Returns the handle of the Find array.
Example
See the examples in the "Find" section.
See Also
FindVendor, FindModel, SaveDeviceProfile
GetFindSize
Description
Returns the length of the array that is created using FindVendor(), FindModel(), and
FindDevice().
Syntax
long GetFindSize(long hFind);
Parameters
hFind
Return Value
Returns the length of the array that is created using FindVendor(), FindModel(), and
FindDevice().
Example
See the examples in the "Find" section.
See Also
FindVendor, FindModel, FindDevice
GetFindString
Description
Reads in the string array that is created in the process of the FindXXX() function. Call
FindVendor() or FindModel() to return hFind and create an array containing strings, which can
be read using GetFindString().
Syntax
BSTR GetFindString(
long hFind,
long nIndex
);
Parameters
hFind
nIndex
[in] Index number of the array which you will get data from.
Return Value
Returns data of nIndex from the array created using FindVendor() and FindModel(). If nIndex is
larger than the actual array, "" will be returned.
Example
See the examples in the "Find" section.
See Also
GetFindLong
Description
Reads the device ID from the array created in the process of the FindDevice() faction. Call
FindDevice() to return hFind and create an array containing the device ID, which can be read
using GetFindLong() (data type: long).
Syntax
long GetFindLong(
long hFind,
long nIndex
);
Parameters
hFind
nIndex
[in] Index number of the array which you will get data from.
Return Value
Returns data of nIndex from the array created using FindDevice(). If nIndex is larger than the
actual array, -1 will be returned.
Example
[C++]
long hFind = m_ctlXnsDevice.FindDevice();
long nFindSize = m_ctlXnsDevice.GetFindSize(hFind);
long data;
OutputDebugString(str);
}
}
m_ctlXnsDevice.CloseFind(hFind);
See Also
FindDevice
GetFindDouble
Description
Reads Double data-type data from the array that is created in the process of the FindXXX()
function.
Syntax
double GetFindDouble(
long hFind,
long nIndex
);
Parameters
hFind
nIndex
[in] Index number of the array which you will get data from.
Return Value
Returns data of nIndex from the array created using FindXXX(). If nIndex is larger than the
actual array, -1 will be returned.
Remarks
Currently, there exists no Double type of data in the array created using FindXXX(). This
function will be used in the future accordingly.
Example
[C++]
See Also
FindDevice
CloseFind
Description
Closes the Find command. Releases the memory space assigned by FindXXX().
Syntax
void CloseFind(long hFind);
Parameters
hFind
Example
[C++]
m_ctlXnsDevice.CloseFind(hFind);
See Also
FindVendor, FindModel, FindDevice
Create/Release Device
CreateDevice
Description
Assigns memory space for saving device information. This function will return the device
handle, which the application can use to control the device.
Syntax
long CreateDevice(long nDeviceID);
Parameters
nDeviceID
Return Value
If memory space is properly assigned, this will return the device handle. Otherwise, it will return
Null (0).
Example
[C++]
long m_nDevice;
m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);
See Also
GetDeviceID
ReleaseDevice
Description
Cancels the memory space assigned for the device information by CreateDevice(). The device
should be disconnected from the application before this function is called.
Syntax
void ReleaseDevice(long hDevice);
Parameters
hDevice
Example
[C++]
long m_hDevice;
m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);
m_ctlXnsDevice.ReleaseDevice(m_hDevice);
See Also
CreateDevice
SetConnectionInfo
Description
Sets the device information so the application can connect to the device.
Syntax
void SetConnectionInfo(
long hDevice,
BSTR szVendorName,
BSTR szModelName,
long nAddressType,
BSTR szAddress,
long nPort,
long nHttpPort,
BSTR szUserID,
BSTR szPassword
);
Parameters
hDevice
szVendorName
szModelName
[in] Name of model to connect to. The maximum length allowed is 126-byte.
nAddressType
szAddress
[in] Actual address according to nAddressType. The max length varies depending on
nAddressType (see Table 2-2).
nPort
nHttpPort
szUserID
szPassword
Example
[C++]
long m_nDevice;
m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);
See Also
CreateDevice
SetConnectionInfo2
Description
This function is the same as the SetConnectionInfo function. This function is required when
using the SUNAPI protocol. (*Precondition for using multicast : setting multicast on Webviewer)
Syntax
void SetConnectionInfo(
long hDevice,
BSTR szVendorName,
BSTR szModelName,
long nAddressType,
BSTR szAddress,
long nPort,
long nHttpPort,
BSTR szUserID,
BSTR szPassword,
long nDeviceProtocolType,
long nMediaProtocolType
);
Parameters
hDevice
szVendorName
szModelName
[in] Name of model to connect to. The maximum length allowed is 126-byte. (see Table 2-1
Device Model NameTable 2-2)
nAddressType
szAddress
[in] Actual address according to nAddressType. The max length varies depending on
nAddressType (see Table 2-2).
nPort
nHttpPort
szUserID
szPassword
nDeviceProtocolType
nDeviceProtocolType
The value of szAddress varies according to nAddresType. (see Table 2-2 of SetConnectionInfo()).
Example
[C++]
long m_nDevice;
m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);
See Also
CreateDevice
GetDeviceID
Description
Returns the device ID of the given device handle.
Syntax
long GetDeviceID(long hDevice);
Parameters
hDevice
Return Value
Device ID The returned ID will be used as a parameter of CreateDevice(). If hDevice is not valid,
this will return -1(ERR_NOT_EXIST_DEVICE).
Example
[C++]
long nDeviceID = m_ctlXnsDevice.GetDeviceID(m_hDevice);
See Also
CreateDevice, GetDeviceHandle
GetDeviceStatus
Description
Returns the connection status of the device.
Syntax
Parameters
hDevice
Return Value
• XDEVICE_STATUS_DISCONNECTED(0): Disconnected.
• XDEVICE_STATUS_CONNECTED(1): Connected.
Example
[C++]
long nDeviceStatus = m_ctlXnsDevice.GetDeviceID(m_hDevice);
See Also
SetConnectionInfo
GetVendorName
Description
Returns the vendor name of the device.
Syntax
BSTR GetVendorName(long hDevice);
Parameters
hDevice
Return Value
Vendor name. If hDevice is not valid, this will return "".
Example
[C++]
See Also
SetConnectionInfo
GetModelName
Description
Returns the model name of the device.
Syntax
BSTR GetModelName(long hDevice);
Parameters
hDevice
Return Value
Name of the device. If hDevice is not valid, this will return ““.
Example
[C++]
CString strModel = m_ctlXnsDevice.GetModelName(m_hDevice);
See Also
SetConnectionInfo
GetVersion
Description
Returns version of the device firmware. This function will be enabled after the application is
connected to the device.
Syntax
BSTR GetVersion(long hDevice);
Parameters
hDevice
Return Value
Firmware version of the device.
Example
[C++]
CString strVersion = m_ctlXnsDevice.GetVersion(m_hDevice);
See Also
SetConnectionInfo
GetAddressType
Description
Returns the address type specified in the device.
Syntax
long GetAddressType(long hDevice);
Parameters
hDevice
Return Value
• XADDRESS_URL(2): URL.
• XADDRESS_S1DDNS(4): S1 DDNS.
Example
[C++]
long addressType = m_ctlXnsDevice.GetAddressType(m_hDevice);
See Also
SetConnectionInfo
GetIP
Description
Returns the IP address specified in the device.
Syntax
BSTR GetIP(long hDevice);
Parameters
hDevice
Return Value
Device IP address. If the device is using a dynamic IP, this value will be filled by the actual IP
address after the application is connected to the device.
Example
[C++]
CString strIp = m_ctlXnsDevice.GetIP(m_hDevice);
See Also
SetConnectionInfo
GetMac
Description
Returns the MAC address specified in the device.
Syntax
Parameters
hDevice
Return Value
MAC address. If the application does not specify this value, it will be filled automatically after
the application is connected.
Example
[C++]
CString strMac = m_ctlXnsDevice.GetMac(m_hDevice);
See Also
SetConnectionInfo
GetURL
Description
Returns URL specified in the device. The returned value is valid only if the address type
(nAddressType) is XADDRESS_URL(=2).
Syntax
BSTR GetURL(long hDevice);
Parameters
hDevice
Return Value
URL Address.
Example
[C++]
CString strURL = m_ctlXnsDevice.GetURL(m_hDevice);
See Also
SetConnectionInfo
GetPort
Description
Returns the port number specified in the device.
Syntax
long GetPort(long hDevice);
Parameters
hDevice
Return Value
Port number of the device. This port number is used when the application connects to the
device using Samsung protocols (SSNP, SVNP, VNP and DVR protocol).
Example
[C++]
long nPort = m_ctlXnsDevice.GetPort(m_hDevice);
See Also
SetConnectionInfo
GetHttpPort
Description
Returns the HTTP port number specified in the device. This port number is used when the
application connects to the device using the web browser.
Syntax
long GetHttpPort(long hDevice);
Parameters
hDevice
Return Value
HTTP port number of the device.
Example
[C++]
long nHttpPort = m_ctlXnsDevice.GetHttpPort(m_hDevice);
See Also
SetConnectionInfo
GetUserID
Description
Returns the user ID specified in the device. This value is the same as the value set by
SetConnectionInfo().
Syntax
BSTR GetUserID(long hDevice);
Parameters
hDevice
Return Value
User ID. This value is used for logging into the device.
Example
[C++]
CString strUserId = m_ctlXnsDevice.GetUserID(m_hDevice);
See Also
SetConnectionInfo
GetPassword
Description
Returns the password specified for the device. This value is the same as the value set by
SetConnectionInfo().
Syntax
BSTR GetPassword(long hDevice);
Parameters
hDevice
Return Value
User password. This value is used for logging into the device.
Example
[C++]
CString strPassword = m_ctlXnsDevice.GetPassword(m_hDevice);
See Also
SetConnectionInfo
GetLatestUpdateTime
Description
Returns the last updated time for the device. You have to call this function after making at least
1 firmware update before you can get the valid value. The update time will be recorded in the
device's configuration file in the local PC.
Syntax
long GetLatestUpdateTime(long hDevice);
Parameters
hDevice
Return Value
Last updated time. The data type of this value is time_t.
Example
[C++]
time_t tLatestUpdateTime = m_ctlXnsDevice.GetLatestUpdateTime(m_hDevice);
GetDeviceHandle
Description
Returns the device handle corresponding to the given device ID. When an event occurs, the
device ID will be forwarded to the parameter of the event handler. However, most of
XnsSdkDevice functions require the device handle as a parameter. So you should use this
function to convert device ID with device handler to enable those functions.
Syntax
long GetDeviceHandle(long nDeviceID);
Parameters
hDevice
Return Value
Device handle corresponding to nDeviceID. If no device corresponds to nDeviceID, you will get
0 returned.
Example
[C++]
long hDevice = m_tlXnsDevice.GetDeviceHandle(nDeviceID);
See Also
GetDeviceID
GetDeviceUTC
Description
Returns the UTC Time of DVR/NVR.
Syntax
long GetDeviceUTC(long hDevice);
Parameters
hDevice
Return Value
UTC Time of DVR/NVR.
Example
[C++]
time_t tDeviceUTC = m_ctlXnsDevice.GetDeviceUTC(m_hDevice);
GetDeviceLocalTime
Description
Returns the Local Time of DVR/NVR.
Syntax
long GetDeviceLocalTime (long hDevice);
Parameters
hDevice
Return Value
Local Time of DVR/NVR.
Example
[C++]
time_t tDeviceLocalTime = m_ctlXnsDevice.GetDeviceLocalTime(m_hDevice);
ChangeDeviceAdminPassword
Description
This function is changing password of Admin account for Camera. Available only when
connected by SUNAPI protocol. The result of this function can be obtained through
OnChangeDeviceAdminPassword event.
Syntax
void ChangeDeviceAdminPassword(
long hDevice,
LPCTSTR szCurrentPassword,
LPCTSTR szNewPassword,
LPCTSTR szConfirmPassword
);
Parameters
hDevice
szCurrentPassword
szNewPassword
szConfirmPassword
Example
[C++]
M_ctlXnsDevice.ChangeDeviceAdminPassword(m_hDevice, m_strCurrentPw, m_strNewPw,
m_strConfirmPw);
See Also
OnChangeDeviceAdminPassword
Connect/Disconnect
Connect
Description
Enables the application to connect to the device using the connection information. As the
connection information should be specified using SetConnectionInfo(), this function will operate
as a blocking function. If the network connection is unstable, it will take a max of 30 seconds
to perform this function.
Syntax
long Connect(
long hDevice,
BOOL bForced,
BOOL bReconnect
);
Parameters
hDevice
bForced
[in] Flag to decide where to forcibly log in or not. (Only support DVR/NVR products)
bReconnect
[in] When the device is disconnected, you can use this flag to decide if to connect again
automatically. If this value is 1, try to connect again.
Note
Some devices do not allow multiple admin accounts to make connection simultaneously. Thus,
if one application is already connected, no other applications can make connections to the
device. If the bForced parameter is 1, this application can connect to the device while any
already-connected application will be forcibly disconnected.
Return Value
Remarks
When an instance of XNS ActiveX Device Control tries more than one connection to same
device, use CreateDevice function for each connection.
Caution
XNS Active Device Control instance should be constructed once within a process. So be careful
that you might not call this Initialize function once more.
Example
[C++]
long Res = m_ctlXnsDevice.Connect(m_hDevice, 0, 0);
if (ERR_ADMIN_CONFLICT == Res)
Res = m_ctlXnsDevice.Connect(m_hDevice, 1, 0);
See Also
ConnectNonBlock
ConnectNonBlock
Description
Enables the application to connect to the device using the connection information. You can use
SetConnectionInfo() to configure the connection settings. This function performs as non-
blocking function, and will be returned immediately even if the connection is not completed.
The connection result will be transferred through the event. When connection is made
successfully, the OnDeviceStatusChanged() event will occur. When failed, the OnConnectFailed
event occurs.
Syntax
long ConnectNonBlock(
long hDevice,
BOOL bForced,
BOOL bReconnect
);
Parameters
hDevice
bForced
[in] Flag to decide where to forcibly log in or not. (Only support DVR/NVR products)
bReconnect
[in] When the device is disconnected, you can use this flag to decide if to connect again
automatically. If this value is 1, try to connect again.
Note
Some devices do not allow multiple admin accounts to make connection simultaneously. Thus,
if one application is already connected, no other application can make connection to the
device. If the bForced parameter is 1, this application can connect to the device while any
already-connected application will be forcibly disconnected.
Remarks
When an instance of XNS ActiveX Device Control tries more than one connection to same
device, use CreateDevice function for each connection.
Caution
XNS Active Device Control instance should be constructed once within a process. So be careful
that you might not call this Initialize function once more.
Example
[C++]
long Res = m_ctlXnsDevice.ConnectNonBlock(m_hDevice, 0, 0);
See Also
Connect, OnConnectFailed, OnDeviceStatusChanged, SetConnectionInfo
Disconnect
Description
Disconnects from the device.
Syntax
long Disconnect(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
long Res = m_ctlXnsDevice.Disconnect(m_hDevice);
See Also
Connect, ConnectNonBlock
One product consists of multiple independent control modules. Each control module has its
own capabilities. The control module has the following tree structure with a unique control ID.
As shown, DVR itself is a control module. One DVR can be connected to 16 cameras, each of
which is an independent control module. The application can get streaming data or contents
from each camera. If multiple cameras are connected as you can see above, we use indexes to
separate one from the others which is called control number.
For instance, the first camera in the above figure has 2 for the control ID, and 1 for the control
number.
Besides, the DVR has equipped with sensor input and alarm out ports, each of which can have
the status information (On/Off). The application can control the alarm out port. Therefore, this
port also has the control ID .
The network camera supports multiple streams. If this is the case, the application will get
streams using the pre-defined stream format (i.e., profile). As such, the network camera has a
3-depth tree structure.
Each control module features capabilities available, which will vary depending on the module
type. For capabilities according to the module type, see the table below:
Note
The device itself (i.e., root device) should have control ID set as 1.
GetControlCount
Description
Returns the number of control modules. The application can get the number of a specific type
of control modules, and can also get the whole number of video recorders or cameras.
Syntax
long GetControlCount(
long hDevice,
long nType
);
Parameters
hDevice
nType
Return Value
Number of nType of control modules
Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
See Also
GetControlType
GetControlType
Description
Returns the type of control module corresponding to the control ID.
Syntax
long GetControlType(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Type of control module. For more information on type of control module, refer to the ‘Table 2.2
Capabilities According to the Control Module Type’ in this document.
Example
[C++]
long nType;
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
See Also
GetControlCount, ControlID
GetControlNumber
Description
Returns the number of control modules corresponding to the control ID.
Syntax
long GetControlNumber(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Number of control module.
Example
[C++]
long m_nNumber;
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
See Also
GetControlCount, ControlID
GetControlDepth
Description
Returns the depth of control module corresponding to the control ID.
Syntax
long GetControlDepth(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Depth of the control module.
Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
See Also
GetControlCount, ControlID
GetControlLocalName
Description
Returns the name of the control module specified in the application. The default name is
“IpAddress:portNumber-channelNumber". To change the name, you have to use
ChangeControlLocalName().
Syntax
BSTR GetControlLocalName(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Name of control module.
Example
[C++]
void CTestSampleDlg::OnOnControlLocalNameChangedXnssdkdevicectrl1(long nDeviceID, long
nControlID)
{
OutputDebugString("Event Local Name Changed\n");
char str[300];
int hDevice = m_ctlXnsDevice.GetDeviceHandle(nDeviceID);
sprintf(str, "nDeviceID[%d], nControlID[%d], Changed Name[%s]\n", nDeviceID, nControlID,
m_ctlXnsDevice.GetControlLocalName(hDevice, nControlID));
OutputDebugString(str);
}
See Also
OnControlLocalNameChanged, ChangeControlLocalName, ControlID
GetControlRemoteName
Description
Returns the name of the control module specified in the device.
Syntax
BSTR GetControlRemoteName(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Name of the control module specified in the device. The maximum length of return value
allowed is 127-byte.
Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
CString strRemoteName[m_nControlCount];
for (int i=0; i<m_nControlCount; i++)
{
strName[i] = m_ctlXnsDevice.GetControlRemoteName(m_hDevice, i);
}
See Also
GetControlLocalName, OnControlRemoteNameChanged, ControlID
GetControlStatus
Description
Gets the status of the control module.
Syntax
long GetControlStatus(
long hDevice,
long nControlID,
long nStatusID
);
Parameters
hDevice
nControlID
nStatusID
[in] ID for each item of the status information (see Table 2-4).
Name ID Description
Return Value
The returned value for each nStatusID using this function has the following meaning:
XCAM_STATUS_SIGNAL (=0x00000002)
XCAM_STATUS_COVERT1 (=0x00000004)
XCAM_STATUS_COVERT2 (=0x00000008)
XCAM_STATUS_ACTIVATED (=0x00000010)
XRECORDING_STATUS 0
XLISTEN_STATUS 0
XTALK_STATUS 0
XALARM_STATUS 0
XLOCALREC_STATUS 0
When the Status ID is XCAMERA_STATUS, return value is calculated by ORing operation. For
example, 16(0x10), 17(0x11), 21(0x15) means as follows:
Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);
See Also
OnControlStatusChanged, ControlID
GetControlCapability
Description
Returns the capabilities of the control module.
Syntax
BOOL GetControlCapability(
long hDevice,
long nControlID,
long nCapabilityID
);
Parameters
hDevice
nControlID
nCapabilityID
XCTL_CAP_NONE 0 Obsolete.
XCTL_CAP_SEEK 34 Seek.
XCTL_CAP_FSTEP 35 Forward.
XCTL_CAP_BSTEP 36 Rewind.
XCTL_CAP_LISTEN 41 Listen.
XCTL_CAP_TALK 42 Talk.
XCTL_CAP_PTZ_AUTOPAN 50 Autopan
XCTL_CAP_PTZ_SCAN 51 Scan
XCTL_CAP_PTZ_PATTERN 52 Pattern
XCTL_CAP_PTZ_SWING 53 Swing
XCTL_CAP_PTZ_TOUR 54 Tour
Return Value
Informs if the device provides the capability corresponding to the capability ID.
Example
[C++]
// The following function is the event handler of OnDeviceStatusChanged called,
// when the device has changed its status.
void CMy01_SimpleLiveDlg::OnOnDeviceStatusChangedXnssdkdevicectrl1(long nDeviceID, long
nErrorCode, long nDeviceStatus, long nHddCondition)
{
if (nErrorCode == ERR_SUCCESS && nDeviceStatus == 1)
{
for(int i=0; i<m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_CAMERA); i++)
{
if (m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_LIVE))
{
m_ctlXnsDevice.OpenMedia(m_hDevice, i+2,
MEDIA_TYPE_LIVE, 0, 0, &m_hMediaSource[i]);
m_ctlXnsWindow[i].Start(m_hMediaSource[i]);
}
}
}
}
See Also
ControlID
ChangeControlLocalName
Description
Changes the name of the control module specified in the local PC.
Syntax
void ChangeControlLocalName(
long hDevice,
long nControlID,
BSTR szName
);
Parameters
hDevice
nControlID
szName
Remarks
After the control module name is changed, the OnControlNameChanged event occurs.
Example
[C++]
CString strName = "Local Change Name";
m_ctlXnsDevice.ChangeControlLocalName(m_hDevice, 2, strName);
See Also
OnControlLocalNameChanged, ControlID
GetVideoControlID
Description
Returns the ID of the control module setting the Video module and Camera module.
Syntax
long GetVideoControlID(
long hDevice,
long nCameraIndex,
long nVideoIndex
);
Parameters
hDevice
nCameraIndex
nVideoIndex
Return Value
ID of the control module setting Camera module and Video module.
Example
[C++]
long nControlID = m_ctlXnsDevice.GetVideoControlID(m_hDevice, m_nCameraIndex,
m_nVideoIndex);
See Also
ControlID
GetParentControlID
Description
Returns the ID of the parent control module.
Syntax
long GetParentControlID(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
ID of the parent control module.
Example
[C++]
long nParentControlID = m_ctlXnsDevice.GetParentControlID(m_hDevice, nControlID);
See Also
ControlID
GetVideoResolution
Description
Gets the video resolution of control module corresponding to the control ID.
Syntax
long GetVideoResolution(
long hDevice,
long nControlID,
long* pnVideoWidth,
long* pnVideoHeight
);
Parameters
hDevice
nControlID
pnVideoWidth
[out] The width of the video resolution.
pnVideoHeight
[out] The height of the video resolution.
Return Value
Example
[C++]
long nVideoWidth = 0;
long nVideoHeight = 0;
m_ctlXnsDevice.GetVideoResolution(m_hDevice, m_nControlID, &nVideoWidth, &nVideoHeight);
See Also
ControlID
GetVideoFrameRate
Description
Ruterns the video frame rate of control module corresponding to the control ID.
Syntax
long GetVideoFrameRate(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Video frame rate of control module.
Example
[C++]
long nFrameRate = 0;
nFrameRate = m_ctlXnsDevice.GetVideoFrameRate(m_hDevice, m_nControlID);
See Also
ControlID
GetVideoQuality
Description
Ruterns the video quality of control module corresponding to the control ID.
Syntax
long GetVideoQuality(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Video quality of control module.
Example
[C++]
long nVideoQuality = 0;
nVideoQuality = m_ctlXnsDevice.GetVideoQuality(m_hDevice, m_nControlID);
See Also
ControlID
GetVideoCodec
Description
Ruterns the video codec of control module corresponding to the control ID.
Syntax
BSTR GetVideoCodec(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Video codec Name of the control module specified in the device. The maximum length of
return value allowed is 63-byte.
• “JPEG” : JPEG
• “MJPEG” : MJPEG
• “MP4V” : MPEG4
• “H264” : H264
• “UNKNOWN” : Unknown
Example
[C++]
CString strVideoCodec;
strVideoCodec = m_ctlXnsDevice.GetVideoCodec(m_hDevice, m_nControlID);
See Also
ControlID
AcquireMediaAuthority
Description
Acquires the permission to play the recorded multimedia. The application should acquire the
permission using this function before it can play video.
Syntax
long AcquireMediaAuthority(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.AcquireMediaAuthority(m_hDevice);
See Also
OpenMedia, Play, Pause, Seek, FrameAdvance, SearchCalendar, SearchDay
ReleaseMediaAuthority
Description
Releases the permission to play the multimedia contents. The application should release the
play permission using this function after playing the multimedia contents.
Syntax
long ReleaseMediaAuthority(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ReleaseMediaAuthority(m_hDevice);
See Also
OpenMedia, Play, Pause, Seek, FrameAdvance, SearchCalendar, SearchDay
OpenMedia
Description
When called, it will start getting media streams from the device.
The receiving media streams will, then, be forwarded to the XnsSdkWindow component that
will play the streams after decoding.
phMediaSource is needed to link the stream data with XnsSdkWindow. The value can be
obtained from a parameter (out-parameter) of OpenMedia(). When XnsSdkWindow receives this
value, it can get stream data from the device.
phMediaSource is also used for controlling playback of multimedia files. As a result, the
application should keep this value at all times.
Syntax
long OpenMedia(
long hDevice,
long nControlID,
long nMediaType,
long tStart,
long tEnd,
long* phMediaSource
);
Parameters
hDevice
nControlID
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
tStart
[in] Play start time. Format: 4-byte time_t. (only for XMEDIA_BAKCUP type)
tEnd
[in] Play end time. Format: 4-byte time_t. (only for XMEDIA_BACKUP type)
phMediaSource
[out] Media stream ID. This is needed for controlling the media stream and also used as a
parameter of XnsSdkWindow::Start().
Return Value
Example
[C++]
long m_pMediaLiveSource;
long ret;
See Also
OpenMediaEx, CloseMedia, XnsSdkWindow::Start, ControlID
OpenMediaEx
Description
It will start getting media streams from the device, used by Javascript.
Syntax
long OpenMediaEx(
long hDevice,
long nControlID,
long nMediaType,
long tStart,
long tEnd
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] control ID of video control module.
nMediaType
[in] Type of media
tStart
[in] Play start time. Format: 4-byte time_t. (only for XMEDIA_BAKCUP type)
tEnd
[in] Play end time. Format: 4-byte time_t. (only for XMEDIA_BAKCUP type)
Return Value
Handle of media stream. Returns ‘0’ when failed.
Example
[C++]
long hMediaSource = 0;
hMediaSource = m_ctlXnsDevice.OpenMediaEx(m_hDevice, 2, XMEDIA_LIVE, 0, 0);
See Also
OpenMedia, CloseMedia, XnsSdkWindow::Start, ControlID
CloseMedia
Description
Terminates transferring media stream data from the device. The media stream data will be
separated by hMediaSource (i.e., phMediaSource of OpenMedia()).
Syntax
long CloseMedia(
long hDevice,
long hMediaSource
);
Parameters
hDevice
hMediaSource
Return Value
Example
[C++]
long ret;
long m_pMediaLiveSource;
ret = m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);
See Also
OpenMedia, OpenMediaEx
OpenStream
Description
Starts receiving the media stream data from the device. The incoming media stream will then
forwarded to the OnNewMedia event. The application can decode or forward this data to
XnsSdkWindow before playing.
Syntax
long OpenStream(
long hDevice,
long nControlID,
long nType,
long tStart,
long tEnd
);
Parameters
hDevice
nControlID
nType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
tStart
[in] Play start time. Format: 4-byte time_t. (only for XMEDIA_BAKCUP type)
tEnd
[in] Play end time. Format: 4-byte time_t. . (only for XMEDIA_BAKCUP type)
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.OpenStream(m_hDevice, 2, XMEDIA_LIVE, 0, 0);
See Also
CloseStream, XnsSdkWindow::Start, ControlID, OnNewMedia
CloseStream
Description
Terminates transferring the media stream. The media stream data will be identified by the
control ID.
Syntax
long CloseStream(
long hDevice,
long nControlID,
long nType
);
Parameters
hDevice
nControlID
nType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.CloseStream(m_hDevice, 2, XMEDIA_LIVE);
See Also
OpenStream, ControlID
SuspendStream
Description
Suspends transferring the media stream data. The media stream data will be identified by the
control ID.
Syntax
long SuspendStream(
long hDevice,
long nControlID,
long nMediaType
);
Parameters
hDevice
nControlID
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SuspendStream(m_hDevice, 2, XMEDIA_LIVE);
See Also
ResumeStream, SuspendAllStream, ControlID
SuspendAllStream
Description
Suspends transfers all media stream data.
Syntax
long SuspendAllStream(
long hDevice,
long nMediaType
);
Parameters
hDevice
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
Return Value
Example
[C++]
long ret;
ret = m_ctlXnsDevice.SuspendAllStream(m_hDevice, XMEDIA_LIVE);
See Also
SuspendStream, ResumeAllStream, ControlID
ResumeStream
Description
Resumes transferring the media stream. The media stream data will be identified by the control
ID.
Syntax
long ResumeStream(
long hDevice,
long nControlID,
long nMediaType
);
Parameters
hDevice
nControlID
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ResumeStream(m_hDevice, 2, XMEDIA_LIVE);
See Also
SuspendStream, SuspendAllStream, ResumeAllStream
ResumeAllStream
Description
Resumes transferring all media stream.
Syntax
long ResumeAllStream(
long hDevice,
long nMediaType
);
Parameters
hDevice
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ResumeAllStream(m_hDevice, XMEDIA_LIVE);
See Also
SuspendStream, SuspendAllStream, ResumeStream
IsPlaying
Description
Informs if the media stream is currently playing.
Syntax
BOOL IsPlaying(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
if (!m_ctlXnsDevice.IsPlaying(m_hDevice))
{
m_ctlXnsDevice.Play(m_hDevice, 2, 1.0);
}
See Also
Play
HasAuthority
Description
Confirms if the application has the permission to play the multimedia file.
Syntax
BOOL HasAuthority(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
long ret;
ret = m_ctlXnsDevice.GetControlCapability(m_hDevice, 1, XCTL_CAP_MEDIA_AUTHORITY);
See Also
AcquireMediaAuthority, ReleaseMediaAuthority
SetVideoFrameInfoReceived
Description
After getting media streams from the device, this function can be called. Then a video frame
information will forwarded to the OnVideoFrameInfoReceived event per a second.
Syntax
long SetVideoFrameInfoReceived
(
long hDevice,
long nControlID,
long nMediaType,
long bFlag
);
Parameters
hDevice
nControlID
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
bFlag
Return Value
Example
[C++]
long ret;
See Also
OpenMedia, ControlID, OnVideoFrameInfoReceived
PlayControl
Note
To enable play-related functions, the application should get the applicable permissions using
AcquireMediaAuthority in advance. And it should return the permissions using
ReleaseMediaAuthority().
Play
Description
Plays the multimedia at a specified speed.
Syntax
long Play(
long hDevice,
long nControlID,
double dSpeed
);
Parameters
hDevice
nControlID
dSpeed
Return Value
Example
[C++]
if (!m_ctlXnsDevice.IsPlaying(m_hDevice))
m_ctlXnsDevice.Play(m_hDevice, 2, 1.0);
See Also
IsPlaying, Pause, ControlID
Pause
Description
Stops playing the media stream temporarily.
Syntax
long Pause(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
m_ctlXnsDevice.Pause(m_hDevice, 2);
See Also
Play, ControlID
Seek
Description
Searches for a specific time point of the media stream.
Syntax
long Seek(
long hDevice,
long nControlID,
long tPos
);
Parameters
hDevice
nControlID
tPos
Return Value
Example
[C++]
long tPos = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 15, 0, 0);
m_ctlXnsDevice.Seek(m_hDevice, 2, tPos);
See Also
DateToTimet, ControlID
FrameAdvance
Description
Gets the next I-frame.
Syntax
long FrameAdvance(
long hDevice,
long nControlID,
long nDelta
);
Parameters
hDevice
nControlID
nDelta
[in] Number of frames to skip. If the value is less than 0, it will get the previous frame.
Return Value
Example
[C++]
m_ctlXnsDevice.FrameAdvance(m_hDevice, 2, 1); // forward
m_ctlXnsDevice.FrameAdvance(m_hDevice, 2, -1); // backward
See Also
Play, ControlID
SearchCalendar
Description
Gets the video recording dates from a specific month. The result of this function can be
obtained from the OnSearchCalendar event.
Syntax
long SearchCalendar(
long hDevice,
long nControlID,
long tStart
);
Parameters
hDevice
nControlID
tStart
For instance, if the application wants to get the recording information on January 2010, tStart
uses DateToTimet to convert “Jan 1, 2010 00:00:00” to time_t.
Return Value
Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 1, 0, 0, 0); // September. 1. 2010
long nUTCtime = m_ctlXnsDevice.LocalTimeToDeviceUTC(m_hDevice, tStart); // UTC time
long ret = m_ctrlXnsSdkDevice.AcquireMediaAuthority(m_hDevice);
ret = m_ctlXnsDevice.SearchCalendar(m_hDevice, 1, nUTCtime);
DisplayErrCode(“SearchCalendar”, ret);
See Also
OnSearchCalendar, DateToTimet, SearchDay, ControlID,
LocalTimeToDeviceUTC, AcquireMediaAuthority
SearchOverLap
Description
Gets a list of overlapped track for a specific day. The result of this function can be obtained
from the OnSearchOverLap event.
Syntax
long SearchOverLap(
long hDevice,
long tStart,
long tEnd,
);
Parameters
hDevice
tStart
tEnd
Return Value
Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2012, 9, 04, 0, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2012, 9, 04, 23, 59, 59);
DisplayErrCode("SearchOverLap", ret);
See Also
OnSearchCalendar, OnSearchOverLap, OnSearchDay, DateToTimet, SearchCalendar,
LocalTimeToDeviceUTC, AcquireMediaAuthority
GetStartRecordingTime
Description
Gets the video start recording times. The result of this function can be obtained from the
OnGetStrtRecordingTime event.
Syntax
long GetStartRecordingTime(
long hDevice,
);
Parameters
hDevice
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.GetStartRecordingTime(m_hDevice);
See Also
OnGetStartRecordingTime, GetEndRecordingTime, OnGetEndRecordingTime
GetEndRecordingTime
Description
Gets the video end recording times. The result of this function can be obtained from the
OnGetEndRecordingTime event.
Syntax
long GetEndRecordingTime(
long hDevice,
);
Parameters
hDevice
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.GetEndRecordingTime(m_hDevice);
See Also
OnGetEndRecordingTime, GetStartRecordingTime, OnGetStartRecordingTime
SearchDay
Description
Gets a list of recording data for a specific day. The result of this function can be obtained from
the OnSearchDay event.
Syntax
long SearchDay(
long hDevice,
long nControlID,
long tStart,
long tEnd,
long nRecType
);
Parameters
hDevice
nControlID
tStart
tEnd
nRecType
Return Value
Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 0, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 23, 59, 59);
DisplayErrCode("SearchDay", ret);
See Also
OnSearchDay, DateToTimet, SearchCalendar, ControlID,
LocalTimeToDeviceUTC
GetMotionGrid
Description
It loads from Motion Grid information of DVR. The result of this function can be obtained from
the OnGetMotionGrid event.
Syntax
long GetMotionGrid(
long hDevice,
long nControlID,
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.GetMotionGrid(m_hDevice, m_nControlID);
DisplayErrCode("GetMotionGrid", ret);
See Also
OnGetMotionGrid, MotionSearch, OnMotionSearch
MotionSearch
Description
It loads from recorded data information from Grid setting. This is the motion event type. The
result of this function can be obtained from the OnMotionSearch event.
Syntax
long MotionSearch(
long hDevice,
long nControlID,
long tStart,
long tEnd,
long nGridWidth,
long nGridHeight,
long pGridArray
);
Parameters
hDevice
nControlID
tStart
tEnd
nGridWidth
nGridHeight
pGridArray
Return Value
Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 0, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 23, 59, 59);
char m_pGridArray[64][64];
DisplayErrCode("MotionSearch", ret);
See Also
OnMotionSearch, GetMotionGrid, OnGetMotionGrid, DateToTimet, SearchCalendar,
LocalTimeToDeviceUTC, ControlID
SetTalk
Description
Turns the Talk function on or off. Talk can enable the device to play the audio source. The
application should use SendAudioData()/SendAudioData2() to transfer the audio source that it
wants to play. Talk is available only in live streaming mode and only if the control module
supports XCTL_CAP_TALK capability.
Syntax
long SetTalk(
long hDevice,
long nControlID,
BOOL bState
);
Parameters
hDevice
nControlID
bState
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SetTalk(m_hDevice, 2, 1);
See Also
SetListen, SendAudioData, SendAudioData2, ControlID
SetListen
Description
Enable or disable the Listen icon from XnsSDKWindow control, when the Listen function is set
to ON or OFF. Turns on or off the Listen function. Listen enables the application to play the
audio source. To enable this function, the control module should support XCTL_CAP_LISTEN
capability.
Syntax
long SetListen(
long hDevice,
long nControlID,
long nMediaType,
BOOL bState
);
Parameters
hDevice
nControlID
[in] Control ID
nMediaType
bState
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SetListen(m_hDevice, 2, XMEDIA_LIVE, 1);
See Also
SetSound, SetTalk, ControlID
SendAudioData
Description
Transfers the audio data to the device. This function is used when the application transfers the
audio data to the device using Talk. Then, the audio data should be encoded to be suitable for
the device. This function is valid only in live mode.
Syntax
long SendAudioData(
long hDevice,
long hData,
long nDataSize,
long nTimeStamp
);
Parameters
hDevice
hData
[in] Pointer to indicate the memory where the audio data is stored.
nDataSize
nTimeStamp
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SendAudioData(m_hDevice, pAudio, nAudioSize, nTimeStamp);
See Also
SetTalk
SendAudioData2
Description
Transfers the audio data to the device. This function is used when the application transfers the
audio data to the device using Talk. This function is valid only in live mode.
Syntax
long SendAudioData2(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SendAudioData2(m_hDevice, nControlID);
See Also
SetTalk, StopAudioData2
StopAudioData2
Description
Stops SendAudioData2 function.
Syntax
long StopAudioData2( long hDevice );
Parameters
hDevice
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.StopAudioData2(m_hDevice);
See Also
SetTalk, SendAudioData2
SetAlarm
Description
Turns the alarm-out device(also called digital-out device) on or off. To enable this function, the
control module should support the XCTL_CAP_ALARM_ONOFF capability.
Syntax
long SetAlarm(
long hDevice,
long nControlID,
BOOL bState
);
Parameters
hDevice
nControlID
bState
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.SetAlarm(m_hDevice, 30, 1);
See Also
ControlID
Control PTZ
ControlPtz
Description
Moves the camera to the predefined PTZ position. This function is valid as long as the
application is receiving media stream from the camera.
Syntax
long ControlPtz(
long hDevice,
long nControlID,
long nPtzCommand,
long nSpeed
);
Parameters
hDevice
nControlID
nPtzCommand
nSpeed
[in] If nPtzCommand is a speed-related command, this value indicates the PTZ operation speed.
(1~100) This value is valid only if the camera supports the XCTL_CAP_PTZ_SPEED capability.
XPTZ_UP 1 Tilt up
XPTZ_ZOOMIN 9 Zoom in
Return Value
Example
[C++]
long bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_PTZ_SPEED);
if (bIsCap)
m_ctlXnsDevice.ControlPtz(m_hDevice, 2, XPTZ_UPLEFT, nSpeed);
else
m_ctlXnsDevice.ControlPtz(m_hDevice, 2, XPTZ_UPLEFT, 10);
See Also
ControlPtzFreeMove, ControlID
ControlPtzFreeMove
Description
Moves the camera to any PTZ position. This function is valid as long as the application is
receiving media stream from the camera.
Syntax
long ControlPtzFreeMove(
long hDevice,
long nControlID,
long nX,
long nY
);
Parameters
hDevice
nControlID
nX
[in] X-axis speed. The value is between 1 and 100. The greater the value, the faster the speed.
nY
[in] Y-axis speed. The value is between 1 and 100. The greater the value, the faster the speed.
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ControlPtzFreeMove(m_hDevice, 2, 10, 22);
See Also
ControlPtz, ControlID
ControlPtzSpeedZoomIn
Description
Performs the zoom-in at a defined speed. This function is valid as long as the application is
receiving media stream from the camera.
Syntax
long ControlPtzSpeedZoomIn(
long hDevice,
long nControlID,
long nSpeed
);
Parameters
hDevice
nControlID
nSpeed
[in] Zoom speed. Range of this parameter is from 1 to 100, which larger value means faster
speed.
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ControlPtzSpeedZoomIn(m_hDevice, 2, 6);
See Also
ControlPtzSpeedZoomOut
ControlPtzSpeedZoomOut
Description
Performs the zoom-out at a defined speed. This function is valid as long as the application is
receiving media stream from the camera.
Syntax
long ControlPtzSpeedZoomOut(
long hDevice,
long nControlID,
long nSpeed
);
Parameters
hDevice
nControlID
nSpeed
[in] Zooming speed. The value is between 1 and 4. The greater the value, the faster the speed.
Return Value
Example
[C++]
long ret = m_ctlXnsDevice.ControlPtzSpeedZoomOut(m_hDevice, 2, 3);
See Also
ControlPtzSpeedZoomOut, ControlID
ControlPPtz
Description
Control Power PTZ. Moves the current position of pan, tilt and zoom. This function can be used
just for some models developed by Samsung. Power PTZ can move the camera position for
the currently transferring video image. Any parameter should be resized to the standard VGA
image. The top left of the image is (0,0) and the bottom right is (640, 480) in coordinates. If
the application sets the coordinates to 320 for nX and 25 for nY, the camera will move down
slightly (tilt down). nZ is a zoom factor. If the value is positive, the camera will zoom in. If
negative, it will zoom out.
This function is valid as long as the application is receiving media stream from the camera.
Syntax
long ControlPPtz(
long hDevice,
long nControlID,
long nX,
long nY,
long nZ
);
Parameters
hDevice
nControlID
nX
nY
nZ
Return Value
Example
[C++]
BOOL bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_PTZ_POWER);
DisplayLong("GetPtz XCTL_CAP_PTZ_POWER Cap", bIsCap);
See Also
ControlPtzFreeMove, ControlID
ControlMenu
Description
Controls the OSD menus of the camera. This function is valid as long as the application is
receiving media stream from the camera.
Syntax
long ControlMenu(
long hDevice,
long nControlID,
long nMenuCommand
);
Parameters
hDevice
nControlID
nMenuCommand
Return Value
Remark
OSD control command is supported for some device, like SNP-1000A.
Example
[C++]
BOOL bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_CAM_MENU);
DisplayLong("GetPtz XCTL_CAP_CAM_MENU Cap", bIsCap);
See Also
ControlID
ExecuteHPtz
Description
Performs operations of Preset, Autopan, Scan and Pattern. This function is valid as long as the
application is receiving media stream from the camera.
Syntax
long ExecuteHPtz(
long hDevice,
long nControlID,
long nType,
long nNumber
);
Parameters
hDevice
nControlID
nType
• XHPTZ_PRESET(1): Preset
• XHPTZ_AUTOPAN(2): Autopan(Swing)
• XHPTZ_SCAN(3): Scan
• XHPTZ_PATTERN(4): Pattern
• XHTPZ_SWING(5): Swing
• XHPTZ_TOUR(6): Tour
nNumber
[in] Index of camera's list of features (Preset, AutoPan, Scan, Pattern). (start with 1) For instance,
if multiple presets are defined, a list of presets will be created and the user should specify the
index of the list.
Return Value
Example
[C++]
BOOL bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_PTZ_SCAN);
See Also
ControlID
GetPresetList
Description
Gets the preset list. A preset is a user-defined position of the camera. The number of presets
available varies depending on the model. However, the XNS ActiveX library can support up to
20 presets. The result of this function will be forwarded by the OnGetPresetList event.
This function is valid as long as the application is receiving media stream from the camera.
Syntax
long GetPresetList(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long m_hPreset = m_ctlXnsDevice.GetPresetList(m_hDevice, 2);
See Also
OnGetPresetList, ControlID
SetPreset
Description
Sets the current camera position to a preset. The position will be saved in the camera. This
function is valid as long as the application is receiving media stream from the camera.
Syntax
long SetPreset(
long hDevice,
long nControlID,
long nNumber,
LPCTSTR szName
);
Parameters
hDevice
nControlID
nNumber
szName
[in] Preset name. The camera will save the name including the preset position (English only).
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.SetPreset(m_hDevice, 2, 10, “Preset 10”);
See Also
DeletePreset, ControlID
DeletePreset
Description
Deletes a defined preset. This function is valid as long as the application is receiving media
stream from the camera.
Syntax
long DeletePreset(
long hDevice,
long nControlID,
long nNumber
);
Parameters
hDevice
nControlID
nNumber
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.DeletePreset(m_hDevice, 2, 10);
See Also
SetPreset, DeletePresetAll, ControlID
DeletePresetAll
Description
Deletes all presets. This function is valid as long as the application is receiving media stream
from the camera.
Syntax
long DeletePresetAll(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.DeletePresetAll(m_hDevice, 2);
See Also
GetPresetCount
Description
Gets the number of presets defined. This value is used to get the preset name and information.
This function is valid as long as the application is receiving media stream from the camera.
Syntax
long GetPresetCount(long hPresetList);
Parameters
hPresetList
[in] Handle of the preset list. This handle can be obtained from the OnGetPresetList event.
Return Value
Whole number of presets defined in the camera.
Remarks
This function is valid only within the event handler of the OnGetPresetList event.
Example
[C++]
// This is a event handler function that will be called when the OnGetPresetList event occurs.
void CTestSampleDlg::OnOnGetPresetListXnssdkdevicectrl1(long nDeviceID, long nControlID,
long hPresetListList)
{
char str[100];
long nNumber;
long nPresetCount;
CString strPresetName;
nPresetCount = m_ctlXnsDevice.GetPresetCount(hPresetListList);
sprintf(str, "Event OnGetPresetList.. nDevice[%d], nControlId[%d], resetCount[%d]\n",
nDeviceID, nControlID, nPresetCount);
OutputDebugString(str);
See Also
GetPresetList, OnGetPresetList, GetPreset
GetPreset
Description
Returns the preset number and name corresponding to the given index in the preset list of
XnsSdkDevice.
Syntax
CString GetPreset(
long hPresetList,
long nPresetIndex,
long* pnNumber
);
Parameters
hPresetList
[in] Handle of the preset list. This handle can be obtained from the OnGetPresetList event.
nPresetIndex
[in] Preset index to get the preset information (start with 1).
pnNumber
Return Value
Preset name specified in the camera.
Remarks
This function is valid only within the event handler of the OnGetPresetList event.
Example
[C++]
// This is a event handler function that will be called when the OnGetPresetList event occurs.
void CTestSampleDlg::OnOnGetPresetListXnssdkdevicectrl1(long nDeviceID, long nControlID,
long hPresetListList)
{
char str[100];
long nNumber;
long nPresetCount;
CString strPresetName;
nPresetCount = m_ctlXnsDevice.GetPresetCount(hPresetListList);
sprintf(str, "Event OnGetPresetList.. nDevice[%d], nControlId[%d], resetCount[%d]\n",
nDeviceID, nControlID, nPresetCount);
OutputDebugString(str);
See Also
GetPresetList, OnGetPresetList
GetPtzPos
Description
Returns an absolute coordinate of the camera, is available when application receives media
stream from the camera. The value themselves could be read by using OnGetPtzPos event
handler.
Syntax
long GetPtzPos(
long hDevice,
long nControlID
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
Return Value
Example
[C++]
m_ctlXnsDevice.GetPtzPos(m_hDevice, 2);
See Also
OnGetPtzPos, SetPtzPos, ControlID
SetPtzPos
Description
Change the absolute coordinate of the camera, is available when application receives media
stream from the camera.
Syntax
long SetPtzPos (
long hDevice,
long nControlID,
long nPan,
long nTilt,
long nZoom
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
nPan
nTilt
nZoom
Return Value
Example
[C++]
long nRet = m_ctlXnsDevice.SetPtzPos(m_hDevice, 2, m_nPan, m_nTilt, m_nZoom);
if(nRet != ERR_SUCCESS)
{
TRACE (_T("SetPtzPos() fail:: nRet = %d(%s)\n"),
nRet, m_ctlXnsDevice.GetErrorString(nRet));
}
See Also
GetPtzPosNormalize
Description
Returns the coordinate of the camera, is available when device is connected by SUNAPI
protocol and application receives media stream from the camera. The value themselves could
be read by using OnGetPtzPosNormalize event handler.
Syntax
long GetPtzPosNormalize(
long hDevice,
long nControlID
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
Return Value
Example
[C++]
m_ctlXnsDevice.GetPtzPosNormalize(m_hDevice, 2);
See Also
OnGetPtzPosNormalize, SetPtzPosNormalize, ControlID
SetPtzPosNormalize
Description
Change the coordinate of the camera, is available when device is connected by SUNAPI
protocol and application receives media stream from the camera.
Syntax
long SetPtzPosNormalize (
long hDevice,
long nControlID,
float fPan,
float fTilt,
float fZoom
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
fPan
fTilt
fZoom
Return Value
Example
[C++]
long nRet = m_ctlXnsDevice.SetPtzPosNormalize(m_hDevice, 2, m_fPan, m_fTilt, m_fZoom);
if(nRet != ERR_SUCCESS)
{
TRACE (_T("SetPtzPosNormalize() fail:: nRet = %d(%s)\n"),
nRet, m_ctlXnsDevice.GetErrorString(nRet));
}
See Also
OnGetPtzPosNormalize, GetPtzPosNormalize, ControlID
AreaZoom
Description
Set up AreaZoom feature, which is available when application receives media stream from the
camera.
Syntax
long AreaZoom(
long hDevice,
long nControlID,
long nStartX,
long nStartY,
long nEndX,
long nEndY,
long nWindowWidth,
long nWindowHeight,
long nImageWidth,
long nImageHeight
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
nStartX
nStartY
nEndX
nEndY
nWindowWidth
nWindowHeight
nImageWidth
nImageHeight
Return Value
Example
[C++]
void CMy01_LiveDlg::OnLButtonDownXnssdkwindowctrl(long nFlags, long nX, long nY)
{
// TODO: Add your message handler code here
WIN_LOG(_T("On LButtonUp XNSWindow1"));
m_nStartX = nX;
m_nStartY = nY;
}
CRect rt;
m_ctlXnsWindow[0].GetClientRect(rt);
long nWindowWidth = rt.Width();
long nWindowHeight = rt.Height();
m_nEndX = nX;
m_nEndY = nY;
if(nRet != ERR_SUCCESS)
{
WIN_LOG(_T("AreaZoom() fail:: nRet = %d(%s)\n"), nRet,
m_ctlXnsDevice.GetErrorString(nRet));
}
}
See Also
Zoom1X, ControlID
Zoom1X
Description
Set up AreaZoom feature, especially return zoom setup value to ‘1’. This function could be
called when application receives media stream from camera.
Syntax
long Zoom1X(
long hDevice,
long nControlID,
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
nControlID
[in] Control ID.
Return Value
Example
[C++]
long nRet = m_ctlXnsDevice.Zoom1X(m_hDevice, 2);
if(nRet != ERR_SUCCESS)
{
WIN_LOG(_T("AreaZoom() fail:: nRet = %d(%s)\n"),
nRet, m_ctlXnsDevice.GetErrorString(nRet));
}
See Also
AreaZoom, ControlID
Timeline
GetCameraCount
Description
Returns the number of cameras existing in the timeline.
Syntax
long GetCameraCount(long hTimeline);
Parameters
hTimeline
Return Value
Number of the cameras (from those connected in the system) that have recording data on a
specified date.
Remarks
This function is valid only within the event handler of the OnSearchDay event.
Example
[C++]
// This is a event handler function that will be called when the OnSearchDay event occurs.
void CTestSampleDlg::OnOnSearchDayXnssdkdevicectrl1(long nDeviceID, long nControlID, long
hTimeline)
{
long CamCount = m_ctlXnsDevice.GetCameraCount(hTimeline);
// ...
}
See Also
OnSearchDay, GetTimelineCount
GetTimelineCount
Description
Number of blocks of the recording data in the timeline. This value is used as a parameter of
Syntax
long GetTimelineCount(
long hTimeline,
long nCameraIndex
);
Parameters
hTimeline
nCameraIndex
Return Value
Number of blocks of the recording data in the timeline.
Remarks
This function is valid only within the event handler of the OnSearchDay event.
Example
[C++]
// This is a event handler function that will be called when the OnSearchDay event occurs
void CTestSampleDlg::OnOnSearchDayXnssdkdevicectrl1(long nDeviceID, long nControlID, long
hTimeline)
{
long CamCount = m_ctlXnsDevice.GetCameraCount(hTimeline);
long TimelineCount = m_ctlXnsDevice.GetTimelineCount(hTimeline, 0);
CString strRecInfo;
long tStart, tEnd;
long nRecType;
long nRecId;
long StartYear, StartMon, StartDay, EndYear, EndMon, EndDay;
long StartHour, StartMin, StartSec, EndHour, EndMin, EndSec;
{
m_ctlXnsDevice.GetTimeline(hTimeline, 0, i, XTIME_UTC, &tStart, &tEnd,
&nRecType, &nRecId);
m_ctlXnsDevice.TimetToDate(tStart, &StartYear, &StartMon, &StartDay,
&StartHour, &StartMin, &StartSec);
m_ctlXnsDevice.TimetToDate(tEnd, &EndYear, &EndMon, &EndDay, &EndHour,
&EndMin, &EndSec);
// ...
}
See Also
OnSearchDay, GetCameraCount, GetTimeline
GetTimeline
Description
Returns information on the recording data block.
Syntax
void GetTimeline(
long hTimeline,
long nCameraIndex,
long nTimelineIndex,
long nType,
long* ptStart,
long* ptEnd,
long* pnRecType,
long* pnRecID
);
Parameters
hTimeline
nCameraIndex
nTimelineIndex
nType
• XTIME_UTC (=0): tStart and tEnd will be converted to UTC time counterpart.
• XTIME_LOCAL (=1): tStart and tEnd will be converted to local time counterpart.
ptStart
ptEnd
pnRecType
[out] Recording type. Cause of starting the recording (see Table 2-9). If there is more than one
cause to start recording, the bit-wise ORing value will be set as valid.
pnRecID
[out] If there are at least two data items in the same timeline, this function will identify them
by the ID.
Remarks
This function is valid only within the event handler of the OnSearchDay and OnMotionSearch
event.
Example
[C++]
// This is a event handler function that will be called when the OnSearchDay event occurs.
void CTestSampleDlg::OnSearchDayXnssdkdevicectrl(long nDeviceID, long nControlID, long
hTimeline)
{
long CamCount = m_ctlXnsDevice.GetCameraCount(hTimeline);
long TimelineCount = m_ctlXnsDevice.GetTimelineCount(hTimeline, 0);
CString strRecInfo;
long tStart, tEnd;
long nRecType;
long nRecId;
long StartYear, StartMon, StartDay, EndYear, EndMon, EndDay;
long StartHour, StartMin, StartSec, EndHour, EndMin, EndSec;
See Also
OnSearchDay, GetTimelineCount, TimetToDate
Recording
StartLocalRecording
Description
Starts recording the stream data in the local PC.
Syntax
long StartLocalRecording(
long hDevice,
long nControlID,
LPCTSTR szFile,
long nFileType
);
Parameters
hDevice
nControlID
szFile
nFileType
• REC_WRITER (=2): Samsung proprietary format. This file can be played only using
Samsung XNS ActiveX SDK.
Note
The mini player will be saved in the same folder when the recording is finished.
Return Value
Example
[C++]
CString strFile = "d:\\test";
long nErrCode = m_ctlXnsDevice.StartLocalRecording(m_hDevice, 2, strFile, REC_WRITER);
See Also
StopLocalRecording, CreateFileReader, ControlID
StopLocalRecording
Description
Stops recording in the local PC.
Syntax
long StopLocalRecording(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.StopLocalRecording(m_hDevice, 2);
See Also
StartLocalRecording, ControlID
StartAviLocalRecording
Description
Starts Avi recording the stream data in the local PC.
Syntax
long StartLocalRecording(
long hDevice,
long nControlID,
LPCTSTR szFile,
);
Parameters
hDevice
nControlID
szFile
Note
When to create
When the size of backup data exceeds 1GB
When resolution is changed
When Video,Audio codec is changed
When framerate is changed
Return Value
Example
[C++]
CString strFile = "d:\\test";
long nErrCode = m_ctlXnsDevice.StartAviLocalRecording(m_hDevice, 2, strFile);
See Also
StopAviLocalRecording, CreateFileReader, ControlID
StopAviLocalRecording
Description
Stops Avi recording in the local PC.
Syntax
long StopAviLocalRecording(
long hDevice,
long nControlID
);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.StopAviLocalRecording(m_hDevice, 2);
See Also
StartAviLocalRecording, ControlID
ToggleDvrRecording
Description
Starts or stops recording by DVR.
Note
This function is only available for some of DVR models. SRD-480D, SVR-9XX, SVR-16XX, SVR-
3200 does not support this function.
Syntax
long ToggleDvrRecording(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.ToggleDvrRecording(m_hDevice);
Backup
Backup is to save the streaming data recorded in the device to the local PC.
StartBackup
Description
Starts backup.
Syntax
long StartBackup(
long hDevice,
long nControlID,
LPCTSTR szFile,
long nFileType,
long tStart,
long tEnd
);
Parameters
hDevice
nControlID
szFile
nFileType
SEC_WRITER = 1 Video stream including When the size of backup data exceeds
small size player 700MB
When date is changed
When resolution is changed
When DST ends
tStart
[in] Start time to backup on the recording data (Format: UTC time_t).
tEnd
[in] End time to backup on the recording date (Format: UTC time_t).
Note
The mini player will be saved in the same folder when the backup is finished.
Return Value
Example
[C++]
CString strFile = "d:\\test";
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 15, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 20, 0, 0);
See Also
StopBackup, , ControlID
StopBackup
Description
Stops backup.
Syntax
long StopBackup(long hDevice, long nControlID);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long errCode = m_ctlXnsDevice.StopBackup(m_hDevice, 2);
See Also
StartBackup
StartAviBackup
Description
Starts Avi backup.
Syntax
long StartAviBackup(
long hDevice,
long nControlID,
LPCTSTR szFile,
long tStart,
long tEnd
long nTrackID
);
Parameters
hDevice
nControlID
tStart
[in] Start time to backup on the recording data (Format: UTC time_t).
tEnd
[in] End time to backup on the recording date (Format: UTC time_t).
nTrackID
Note
When to create
When the size of backup data exceeds 1GB (default)
Every 1 Hr (default)
When resolution is changed
When Video,Audio codec is changed
When framerate is changed
Return Value
Example
[C++]
CString strFile = "d:\\test";
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 15, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 20, 0, 0);
See Also
StopAviBackup, ControlID
StopAviBackup
Description
Stops Avi backup.
Syntax
long StopAviBackup(long hDevice, long nControlID);
Parameters
hDevice
nControlID
Return Value
Example
[C++]
long errCode = m_ctlXnsDevice.StopAviBackup(m_hDevice, 2);
See Also
StartAviBackup
GetAviOptionSize
Description
Returns maximum size of currently set AVI file.
Syntax
long GetAviOptionSize( );
Return Value
Maximum size of currently set AVI file (The value is betwenn 1 and 2048. Units : megabyte)
Example
[C++]
long nAviSize = m_ctlXnsDevice.GetAviOptionSize();
See Also
SetAviOptionSize, StartBackup, StartAviLocalRecording
SetAviOptionSize
Description
Sets up the maximum size of the AVI file. The values set by this function is maximum size of
AVI file that is created when the StartAviLocalRecording, StartAviBackup function is used. If the
maximum size is exceeded, the file will be separated and newly created.
Syntax
void SetAviOptionSize(long nAviSize );
Parameters
nAviSize
[in] AVI file size. (The value is betwenn 1 and 2048. Units : megabyte.)
Example
[C++]
m_ctlXnsDevice.SetAviOptionSize(1024);
See Also
GetAviOptionSize, StartBackup, StartAviLocalRecording
GetAviOptionPeriod
Description
Returns the maximum recording time of currently set AVI files.
Syntax
long GetAviOptionPeriod( );
Return Value
Maximum recording time of currently set AVI file (The value is betwenn 10 and 7200. Units :
second)
Example
[C++]
long nAviPeriod = m_ctlXnsDevice.GetAviOptionPeriod();
See Also
SetAviOptionPeriod, StartBackup, StartAviLocalRecording
SetAviOptionPeriod
Description
Sets up the maximum recording time of the AVI file. The values set by this function is
maximum recording time of AVI file that is created when the StartAviLocalRecording and
StartAviBackup function is used. If the maximum recording time is exceeded, the file will be
separated and newly created.
Syntax
void SetAviOptionPeriod(long nAviPeriod);
Parameters
nAviPeriod
[in] Maximum recording time of AVI file (The value is betwenn 10 and 7200. Units : second)
Example
[C++]
m_ctlXnsDevice.SetAviOptionPeriod(3600);
See Also
GetAviOptionSize, StartBackup, StartAviLocalRecording
StartSecBackup
Description
Starts SEC backup.
Syntax
long StartSecBackup(
long hDevice,
long nControlID,
LPCTSTR szFile,
long nFileType,
long tStart,
long tEnd,
long nTrackID,
LPCTSTR szPassword
);
Parameters
hDevice
nControlID
szFile
nFileType
[in] Format of backup file.
SEC_WRITER = 1 Video stream including When the size of backup data exceeds
small size player 700MB
When date is changed
When resolution is changed
When DST ends
tStart
[in] Start time to backup on the recording data (Format: UTC time_t).
tEnd
[in] End time to backup on the recording date (Format: UTC time_t).
nTrackID
szPassword
Note
The mini player will be saved in the same folder when the backup is finished.
Return Value
Example
[C++]
CString strFile = "d:\\test";
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 15, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 20, 0, 0);
See Also
StopBackup, , ControlID
CreateFileReader
Description
Creates the file reader. The file reader is used to play backup or recoding data.
Syntax
long CreateFileReader(LPCTSTR szFile);
Parameters
szFile
Return Value
Handle of file reader. This handle is used as a parameter of functions: GetMediaSource(),
GetFileName(), GetTimelineHandle(), PlayReader(), PauseReader().
Example
[C++]
CString strFile = "d:\\test";
long m_hFileReader = m_ctlXnsDevice.CreateFileReader(strFile);
See Also
ReleaseFileReader
Description
Releases the file reader.
Syntax
void ReleaseFileReader(long hReader);
Parameters
hReader
[in] Handle of the file currently playing. This value can be obtained using CreateFileReader().
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
m_ctlXnsDevice.ReleaseFileReader(m_hFileReader);
See Also
CreateFileReader
GetFileName
Description
Returns the file name and saving path of the given file handle.
Syntax
CString GetFileName(long hReader);
Parameters
hReader
[in] Handle of the file to play. This value can be obtained using CreateFileReader().
Return Value
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
CString filename = m_ctlXnsDevice.GetFileName(m_hFileReader);
See Also
CreateFileReader
GetMediaSource
Description
Gets the handle of the media source from the file handle. This value is used to display images
using XnsSdkWindows.
Syntax
long GetMediaSource(long hReader);
Parameters
hReader
[in] Handle of the file to play. This value can be obtained using CreateFileReader().
Return Value
Handle of the media source.
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
long hMediaSource = m_ctlXnsDevice.GetMediaSource(m_hReader);
See Also
CreateFileReader
GetTimelineHandle
Description
Gets the handle of the timeline from the file handle. This value is used to display videos in the
recording timeline on the screen.
Syntax
long GetTimelineHandle(long hReader);
Parameters
hReader
[in] Handle of the file to play. This value can be obtained using CreateFileReader().
Return Value
Handle of the timeline.
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
long hTimeline = m_ctlXnsDevice.GetTimelineHandle(m_hReader);
See Also
CreateFileReader
PlayReader
Description
Plays the backup file at a specified speed.
Syntax
long PlayReader(
long hReader,
double dSpeed
);
Parameters
hReader
[in] Handle of the file to play. This value can be obtained using CreateFileReader().
dSpeed
Return Value
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
long nErrCode = m_ctlXnsDevice.PlayReader(m_hFileReader, 1);
See Also
CreateFileReader, PauseReader
PauseReader
Description
Stops playing the backup file temporarily. Can resume playing using PlayReader().
Syntax
long PauseReader(long hReader);
Parameters
hReader
[in] Handle of the file to play. This value can be obtained using CreateFileReader().
Return Value
Example
[C++]
// m_hFileReader is returned from CreateFileReader().
long nErrCode = m_ctlXnsDevice.PauseReader(hFileReader);
See Also
CreateFileReader, PlayReader
ConvertRec2Avi
Description
Creates the file reader. The file reader is used to play backup or recoding data.
Syntax
long ConvertRec2Avi(LPCTSTR szFile);
Parameters
szFile
Return Value
Handle of file. This handle is used as a parameter of functions: StopRec2Avi().
Example
[C++]
CString strFile = "d:\\test";
long m_hFileHandle = m_ctlXnsDevice.ConvertRec2Avi(strFile);
See Also
StopRec2Avi
StopRec2Avi
Description
Stops converting the file temporarily.
Syntax
void StopRec2Avi(long hFileHandle);
Parameters
hFileHandle
[in] Handle of the file to convert. This value can be obtained using ConvertRec2Avi ().
Example
[C++]
// m_hFileHandle is returned from ConvertRec2Avi().
m_ctlXnsDevice.StopRec2Avi (hFileHandle);
See Also
ConvertRec2Avi
UploadSoftware
Description
Uploads the firmware file of the device for upgrading purpose. The status (progress/completion)
of the upload will be informed from the OnUploadSoftwareProgress event. If the upload has
failed, the OnUploadSoftwareProgress event occurs.
Syntax
long UploadSoftware(
long hDevice,
LPCTSTR szFile
);
Parameters
hDevice
szFile
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
long nErrCode = m_ctlXnsDevice.UploadSoftware(m_hDevice, “d:\\shr-detroit-
pkg_v2.10_100723093736.img”);
DisplayErrCode(“OnUploadSoftware”, nErrCode);
See Also
CreateDevice, OnUploadSoftwareProgress
ImportConfig
Description
Transfers or applies the configuration file to the device. The progress of exporting the
configuration file to the device will be informed from the OnImportConfigProgress event. If the
export fails, the OnImportConfigProgress event occurs. The value of nErrorCode obtained
through OnImportConfigProgress event could not be 0(ERR_SUCCESS) and
84(FILE_TRANSFERRING). This method is valid for DVR devices only by July 2011.
Syntax
long ImportConfig(
long hDevice,
LPCTSTR szFile,
BOOL bWithNetSetting
);
Parameters
hDevice
szFile
bWithNetSetting
[in] Informs if the configuration file includes information on the network settings.
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
long nErrCode = m_ctlXnsDevice.ImportConfig(m_hDevice, "d:\\DvrConfig", FALSE);
DisplayErrCode("OnImportConfig", nErrCode);
See Also
CreateDevice, ExportConfig
ExportConfig
Description
Gets the configuration file from the device. The status (progress/completion) of importing the
configuration file will be informed from the OnExportConfigProgress event. If the import fails,
he OnExportConfigProgress event occurs. The value of nErrorCode obtained through
OnExportConfigProgress event could not be 0(ERR_SUCCESS) and
84(FILE_TRANSFERRING). This method is valid for DVR devices only by July 2011.
Syntax
long ExportConfig(
long hDevice,
LPCTSTR szFile
);
Parameters
hDevice
szFile
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
long nErrCode = m_ctlXnsDevice.ExportConfig(m_hDevice, "d:\\DvrConfig");
DisplayErrCode("OnExportConfig", nErrCode);
See Also
ImportConfig
Device Profile
LoadDeviceProfile
Description
Reads device information from device.xml. The device.xml file includes the following data items:
Field Description
Syntax
long LoadDeviceProfile(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
long nErrCode = m_ctlXnsDevice.LoadDeviceProfile(m_hDevice);
DisplayErrCode("LoadDeviceProfile ", nErrCode);
See Also
CreateDevice, SaveDeviceProfile, DeleteDeviceProfile
SaveDeviceProfile
Description
Saves device information to device.xml. For the information saved in device.xml, see Table 2-10.
Syntax
long SaveDeviceProfile(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
long nErrCode = m_ctlXnsDevice.SaveDeviceProfile(m_hDevice);
DisplayErrCode("SaveDeviceProfile ", nErrCode);
See Also
CreateDevice, LoadDeviceProfile, DeleteDeviceProfile
DeleteDeviceProfile
Description
Deletes device information from device.xml.
Syntax
long DeleteDeviceProfile(long hDevice);
Parameters
hDevice
Return Value
Example
[C++]
// m_hDevice is returned from CreateDevice().
See Also
CreateDevice, LoadDeviceProfile, SaveDeviceProfile
XML File
ReadConfigValue
Description
Reads a configuration value from config.xml.
Syntax
CString ReadConfigValue(LPCTSTR szKey);
Parameters
szKey
Return Value
Configuration value corresponding to szKey. If no configuration file exists, it will return Null. If
the configuration value does not exist (i.e., <DATETIME/>), it will return "".
Example
[C++]
CString strValue = m_ctlXnsDevice.ReadConfigValue(“aspectratio”);
See Also
WriteConfigValue, DeleteConfigValue
WriteConfigValue
Description
Saves the configuration values in config.xml.
Syntax
BOOL WriteConfigValue(
LPCTSTR szKey,
LPCTSTR szValue
);
Parameters
szKey
szValue
Return Value
If performed successfully, it will return TRUE. Otherwise, it will return FALSE as below:
Example
[C++]
BOOL bSave = m_ctlXnsDevice.WriteConfigValue(“aspectratio”, “true”);
See Also
ReadConfigValue, DeleteConfigValue
DeleteConfigValue
Description
Syntax
void DeleteConfigValue(LPCTSTR szKey);
Parameters
szKey
Example
[C++]
m_ctlXnsDevice. DeleteConfigValue(“aspectratio”);
See Also
ReadConfigValue, WriteConfigValue
CopyXml
Description
Copies a specific item in config.xml to other file.
Syntax
BOOL CopyXml(
LPCTSTR szFile1,
LPCTSTR szKey1,
LPCTSTR szFile2,
LPCTSTR szKey2
);
Parameters
szFile1
szKey1
szFile2
szKey2
Return Value
If performed successfully, it will return TRUE(=1). If failed, it returns FALSE(=0).
Example
[C++]
BOOL bSuccess = m_ctlXnsDevice.CopyXml(“./config.xml”, “aspectratio”, “./config2.xml”,
“aspectratio”);
FindConfigChildeKeyList
Description
Gets the child list from a specific key.
Syntax
long FindConfigChildeKeyList(LPCTSTR szKey);
Parameters
szKey
Return Value
Handler for the search result.
Example
[C++]
Long hFind = m_ctlXnsDevice.FindConfigChildeKeyList(“ROOT”);
Miscellaneous
DateToTimet
Description
Converts the date (MM/DD/YY) and time (HH:MM:SS) to the time_t format.
Syntax
long DateToTimet(
long nYear,
long nMonth,
long nDay,
long nHour,
long nMinute,
long nSecond
);
Parameters
nYear
[in] Year
nMonth
[in] Month
nDay
[in] Day
nHour
[in] Hour
nMinute
[in] Minute
nSecond
[in] Second
Return Value
Converted values in time_t format.
Example
[C++]
long tPos = m_ctlXnsDevice.DateToTimet(2010, 9, 6, 15, 0, 0);
See Also
TimetToDate
TimetToDate
Description
Converts the time_t format to the date (MM/DD/YY) and time (HH:MM:SS).
Syntax
void TimetToDate(
long tTime,
long* pnYear,
long* pnMonth,
long* pnDay,
long* pnHour,
long* pnMinute,
long* pnSecond
);
Parameters
tTime
pnYear
[out] Year
pnMonth
[out] Month
pnDay
[out] Day
pnHour
[out] Hour
pnMinute
[out] Minute
pnSecond
[out] Second
Example
[C++]
// This is a event handler function that will be called when the OnSearchDay event occurs.
void CTestSampleDlg::OnOnSearchDayXnssdkdevicectrl1(long nDeviceID, long nControlID, long
hTimeline)
{
// ...
long TimelineCount = m_ctlXnsDevice.GetTimelineCount(hTimeline, 0);
CString strRecInfo;
long tStart, tEnd;
long nRecType;
long nRecId;
long StartYear, StartMon, StartDay, EndYear, EndMon, EndDay;
long StartHour, StartMin, StartSec, EndHour, EndMin, EndSec;
See Also
DateToTimet
LocalTimeToDeviceUTC
Description
Covert local time to UTC time.
Syntax
long LocalTimeToDeviceUTC (
long hDevice,
long tLocal,
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
tLocal
[in] local time_t value.
Return Value
UTC Time (time_t)
Note
Coordinated Universal Time (abbreviated UTC)[1] is the time standard by which the world
regulates clocks and time. Time zones around the world can be expressed as positive or
negative offsets from UTC. UTC 00:00 is same as Greenwich Mean Time(GMT). In the UTC time
scale, Korea time is UTC +9:00. This time interval should be considered when converting time
to UTC time.
Example
[C++]
long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tStart);
long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tEnd);
See Also
DateToTimet, TimetToDate
UTCToDeviceLocalTime
Description
Covert UTC time to Local time.
Syntax
long UTCToDeviceLocalTime (
long hDevice,
long tUTC,
);
Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().
tUTC
Return Value
Local Time (time_t format)
Note
Coordinated Universal Time (abbreviated UTC)[1] is the time standard by which the world
regulates clocks and time. Time zones around the world can be expressed as positive or
negative offsets from UTC. UTC 00:00 is same as Greenwich Mean Time(GMT). In the UTC time
scale, Korea time is UTC +9:00. This time interval should be considered when converting time
to UTC time.
Example
[C++]
tLocalStart = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice, tStart);
tLocalEnd = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice, tEnd);
See Also
DateToTimet, TimetToDate
AutoScan
Description
Requests a scan for all devices in the network. The result of this function will be forwarded by
the OnDeviceDetected, OnDeviceDetected2 event.
Syntax
long AutoScan(long nScanDuration);
Parameters
nScanDuration
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.AutoScan(10);
See Also
IPInstall, OnDeviceDetected, OnDeviceDetected2
IPInstall
Description
Makes the network configuration for the network camera. This function is valid only for the
network camera. And the result of this function will be forwarded by the OnDeviceInstalled
event.
Syntax
long IPInstall(
LPCTSTR szVendorName,
LPCTSTR szModelName,
LPCTSTR szIP,
LPCTSTR szSubnetMask,
LPCTSTR szGateway,
LPCTSTR szMac,
long nPort,
long nHttpPort,
LPCTSTR szPassword
);
Parameters
szVendorName
szModelName
szIP
szSubnetMask
szGateway
szMac
nPort
nHttpPort
szPassword
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.IpInstall(“Samsung”, “SNB-5000”, “192.168.1.200”,
“255.255.255.0”, “192.168.1.1”, “00166cabcdef”, 4520, 80, “4321”);
See Also
AutoScan, OnDeviceInstalled
IPInstallDhcp
Description
Makes the network configuration for the network camera, used by DHCP mode. This function is
valid only for the network camera. And the result of this function will be forwarded by the
OnDeviceInstalled event.
Syntax
long IPInstallDhcp(
LPCTSTR szVendorName,
LPCTSTR szModelName,
LPCTSTR szMac,
long nPort,
long nHttpPort,
LPCTSTR szPassword
);
Parameters
szVendorName
szModelName
szMac
nPort
nHttpPort
szPassword
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.IpInstallDhcp(“Samsung”, “SNB-5000”, “00166cabcdef”, 4520,
80, “4321”);
See Also
AutoScan, OnDeviceInstalled
SetEventDiscardTime
Description
Specify the event discard time. If an event occurs within this time, the event will be deleted.
Syntax
long SetEventDiscardTime(
long nEventType,
long nDiscardTime
);
Parameters
nEventType
nDiscardTime
Return Value
Example
[C++]
long nErrCode = m_ctlXnsDevice.SetEventDiscardTime(30);
GetErrorString
Description
Returns description about the error code.
Syntax
BSTR GetErrorString(long nErrorCode);
Parameters
nErrorCode
Return Value
Description of the error code. For instance, if nErrCode is 0, the application can get the
"ERR_SUCCESS" string as a return value; if nErrCode is 0x10, it will get “ERR_INVALID_CFG_FILE”
as a return value.
Example
[C++]
if (nErrCode)
{
OuptutDebugString(m_ctlXnsDevice.GetErrorString(nErrCode);
}
See Also
오류! 참조 원본을 찾을 수 없습니다.. 오류! 참조 원본을 찾을 수 없습니다..
PowerRestart
Description
Returns description about the error code.
Syntax
BSTR GetErrorString(long nErrorCode);
Parameters
nErrorCode
Return Value
Description of the error code. For instance, if nErrCode is 0, the application can get the
Example
[C++]
if (nErrCode)
{
OuptutDebugString(m_ctlXnsDevice.GetErrorString(nErrCode);
}
See Also
오류! 참조 원본을 찾을 수 없습니다.. 오류! 참조 원본을 찾을 수 없습니다..
Events
In this section, details are provided about the event that will occur if a device event or an
XnsSdkDevice function is called. Below is a list of event handlers that will be called if the
corresponding event occurs.
OnControlLocalNameChanged
Description
If the control module is renamed in the local PC, the ActiveX object will trigger the
OnControlLocalNameChanged event. The event will also occur if the application tries to rename
the control module using ChangeControlLocalName().
Syntax
void OnControlLocalNameChanged(
long nDeviceID,
long nControlID
);
Parameters
nDeviceID
nControlID
Example
[C++]
void CTestSampleDlg::OnControlLocalNameChangedXnssdkdevicectrl(long nDeviceID, long
nControlID)
{
OutputDebugString("Event Local Name Changed\n");
char str[300];
See Also
ChangeControlLocalName, GetControlLocalName, ControlID
OnDeviceDetected
Description
This event will occur if the application uses AutoScan() to broadcast the scanning message and
to get response. Each time it gets response, this event will occur.
Syntax
void OnDeviceDetected(
BSTR szVendorName,
BSTR szModelName,
BSTR szDeviceName,
BSTR szIP,
BSTR szSubnetMask,
BSTR szGateway,
BSTR szMac,
long nPort,
long nHttpPort,
BOOL bSupportIpInstall
);
Parameters
szVendorName
szModelName
szDeviceName
szIP
szSubnetMask
szGateway
szMac
nPort
nHttpPort
bSupportIpInstall
Example
[C++]
void CTestSampleDlg::OnDeviceDetectedXnssdkdevicectrl(LPCTSTR szVendorName, LPCTSTR
szModelName, LPCTSTR szDeviceName, LPCTSTR szIP, LPCTSTR szSubnetMask, LPCTSTR
szGateway, LPCTSTR szMac, long nPort, long nHttpPort, BOOL bSupportIpInstall)
{
char str[300];
sprintf(str, "Vendor[%s], Model[%s], Device[%s], ip[%s], subnet[%s], Gateway[%s], Mac[%s],
Port[%d], HttpPort[%d], bSupportIpInstall[%d]\n", szVendorName, szModelName,
szDeviceName, szIP, szSubnetMask, szGateway, szMac, nPort, nHttpPort, bSupportIpInstall);
OutputDebugString(str);
See Also
AutoScan
OnDeviceDetected2
Description
This event is the same as the OnDeviceDetected event. And Informs the Network mode.
Syntax
void OnDeviceDetected2(
BSTR szVendorName,
BSTR szModelName,
BSTR szDeviceName,
BSTR szIP,
BSTR szSubnetMask,
BSTR szGateway,
BSTR szMac,
long nPort,
long nHttpPort,
BSTR szModelType,
BOOL bSupportIpInstall,
long nNetworkMode
);
Parameters
szVendorName
szModelName
szDeviceName
szIP
szSubnetMask
szGateway
szMac
nPort
nHttpPort
szModelType
bSupportIpInstall
nNetworkMode
Example
[C++]
void CTestSampleDlg::OnDeviceDetected2Xnssdkdevicectrl(LPCTSTR szVendorName, LPCTSTR
OutputDebugString(str);
See Also
AutoScan
OnDeviceDetected3
Description
This event is the same as the OnDeviceDetected event. You can check protocol type of device.
Syntax
void OnDeviceDetected3(
BSTR szVendorName,
BSTR szModelName,
BSTR szDeviceName,
BSTR szIP,
BSTR szSubnetMask,
BSTR szGateway,
BSTR szMac,
long nPort,
long nHttpPort,
BSTR szModelType,
BOOL bSupportIpInstall,
long nNetworkMode,
BOOL bIsDhcpIPInstall,
long nDeviceProtocolType,
LPCTSTR szUUID
);
Parameters
szVendorName
szModelName
szDeviceName
szIP
szSubnetMask
szGateway
szMac
nPort
nHttpPort
szModelType
bSupportIpInstall
nNetworkMode
nbIsDhcpIPInstall
[in] Informs whether the device supports the changing IP using DHCP
nDeviceProtocolType
szUUID
Example
[C++]
void CTestSampleDlg::OnDeviceDetected3Xnssdkdevicectrl(LPCTSTR szVendorName, LPCTSTR
szModelName, LPCTSTR szDeviceName, LPCTSTR szIP, LPCTSTR szSubnetMask, LPCTSTR
szGateway, LPCTSTR szMac, long nPort, long nHttpPort, LPCTSTR szModelType, BOOL
bSupportIpInstall, long nNetworkMode, BOOL bIsDhcpIPInstall, long nDeviceProtocolType,
LPCTSTR szUUID)
{
char str[300];
sprintf(str, "Vendor[%s], Model[%s], Device[%s], ip[%s], subnet[%s], Gateway[%s], Mac[%s],
Port[%d], HttpPort[%d], ModelType[%s], SupportIpInstall[%d],
NetworkMode[%d],DhcpIPInstall[%d], ProtocolType[%d], szUUID[%s]\n", szVendorName,
szModelName, szDeviceName, szIP, szSubnetMask, szGateway, szMac, nPort, nHttpPort,
szModelType, bSupportIpInstall, nNetworkMode, bIsDhcpIPInstall, nDeviceProtocolType,
szUUID);
OutputDebugString(str);
}
See Also
AutoScan
OnDeviceInstalled
Description
This event will occur if the application uses IPInstall(), IPInstallDhcp().
Syntax
void OnDeviceInstalled(
long nErrorCode,
BSTR szVendorName,
BSTR szModelName,
BSTR szDeviceName,
BSTR szIP,
BSTR szSubnetMask,
BSTR szGateway,
BSTR szMac,
long nPort,
long nHttpPort,
BSTR szPassword,
long nNetworkMode
);
Parameters
nErrorCode
szVendorName
szModelName
szDeviceName
szIP
szSubnetMask
szGateway
szMac
nPort
nHttpPort
szPassword
nNetworkMode
Example
[C++]
void CTestSampleDlg::OnDeviceInstalledXnssdkdevicectrl(long nErrorCode, LPCTSTR
szVendorName, LPCTSTR szModelName, LPCTSTR szDeviceName, LPCTSTR szIP, LPCTSTR
szSubnetMask, LPCTSTR szGateway, LPCTSTR szMac, long nPort, long nHttpPort, LPCTSTR
szPassword, long nNetworkMode)
{
char str[300];
sprintf(str, "Error[%s], Vendor[%s], Model[%s], Device[%s], ip[%s], subnet[%s], Gateway[%s],
Mac[%s], Port[%d], HttpPort[%d], Password[%s], NetworkMode[%d]\n",
m_ctlXnsDevice.GetErrorString(nErrorCode), szVendorName, szModelName, szDeviceName, szIP,
szSubnetMask, szGateway, szMac, nPort, nHttpPort, szPassword, nNetworkMode);
OutputDebugString(str);
See Also
IPInstall, IPInstallDhcp
OnConnectFailed
Description
If the application has failed in non-blocking connection using ConnectNonBlock(), the
OnConnectFailed event occurs. Note that a failed Connect() returns an immediate error
message and does not trigger this event.
Syntax
void OnConnectFailed(
long nDeviceID,
long nErrorCode
);
Parameters
nDeviceID
nErrorCode
Example
[C++]
void CTestSampleDlg::OnConnectFailedXnssdkdevicectrl(long nDeviceID, long nErrorCode)
{
char str[100];
sprintf(str, "Connection Fail.. nDeviceID[%d], Error[%s]\n", nDeviceID,
m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ConnectNonBlock, Connect
OnSearchCalendar
Description
This event occurs if the application calls SearchCalendar(), which contains the search result.
Syntax
void OnSearchCalendar(
long nDeviceID,
long nControlID,
long nRecDay
);
Parameters
nDeviceID
nControlID
nRecDay
[in] Returns the dates containing recording data on a specified month by SearchCalendar().
Each unit of nRecDay indicates the corresponding date on that month, and the right most bit is
day 1. As one month can have a max of 31 days, the left most bit (32th bit) should be 0.
For example, if nRecDay has a bit combination of "0001 0000 0000 0000 0000 0000 0000 1011",
recording data exists on day 1, day 2, day 4, and day 29.
Example
[C++]
void CTestSampleDlg::OnSearchCalendarXnssdkdevicectrl(long nDeviceID, long nControlID, long
nRecDay)
{
CString strDay = "01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31\n";
OutputDebugString(strDay);
See Also
OnSearchOverLap
Description
This event occurs if the application calls SearchOverLap(), which contains the overlapped search
result.
Syntax
void OnSearchOverLap(
long nDeviceID,
long tStart,
long tEnd,
long nTrackNum,
long nTrackValue
);
Parameters
nDeviceID
tStart
tEnd
nTrackNum
nTrackValue
Example
[C++]
void CTestSampleDlg::OnSearchOverLapXnssdkdevicectrl(long nDeviceID, long tStart, long tEnd,
long nTrackNum, long nTrackValue)
{
unsigned int* trackValue = (unsigned int*)nTrackValue;
m_nTrackNum = nTrackNum;
See Also
SearchCalendar, SearchOverLap, SearchDay, OnSearchDay
OnGetStartRecordingTime
Description
This event occurs if the application calls GetStartRecordingTime(), which contains the start
recording time of DVR.
Syntax
void OnGetStartRecordingTime(
long nDeviceID,
long tRecUTC
);
Parameters
nDeviceID
tRecUTC
Example
[C++]
void CTestSampleDlg::OnSearchOverLapXnssdkdevicectrl(long nDeviceID, long tStart, long tEnd,
long nTrackNum, long nTrackValue)
{
CString str;
str.Format("OnGetStartRecordingTime.. DeviceID[%d], RecUTC[%d]\n", nDeviceID,
tRecUTC);
OutputDebugString(str);
}
See Also
GetStartRecordingTime, GetEndRecordingTime, OnGetEndRecordingTime
OnGetEndRecordingTime
Description
This event occurs if the application calls GetendRecordingTime(), which contains the end
recording time of DVR.
Syntax
void OnGetEndRecordingTime(
long nDeviceID,
long tRecUTC
);
Parameters
nDeviceID
tRecUTC
Example
[C++]
void CTestSampleDlg::OnGetEndRecordingTimeXnssdkdevicectrl(long nDeviceID, long tRecUTC)
{
CString str;
str.Format("OnGetEndRecordingTime.. DeviceID[%d], RecUTC[%d]\n", nDeviceID, tRecUTC);
OutputDebugString(str);
}
See Also
GetEndRecordingTime, GetStartRecordingTime, OnGetStartRecordingTime
OnSearchDay
Description
This event occurs if the application calls SearchDay(). The timeline handle will be forwarded to
a parameter of the event handler. Some functions such as GetTimeline() use this handle as a
parameter.
Syntax
void OnSearchDay(
long nDeviceID,
long nControlID,
long hTimeline
);
Parameters
nDeviceID
nControlID
hTimeline
[in] Timeline handle. This value is used as an input parameter for timeline-related functions.
Example
[C++]
void CTestSampleDlg::OnOnSearchDayXnssdkdevicectrl1(long nDeviceID, long nControlID, long
hTimeline)
{
long CamCount = m_ctlXnsDevice.GetCameraCount(hTimeline);
long TimelineCount = m_ctlXnsDevice.GetTimelineCount(hTimeline, 0);
CString strRecInfo;
long tStart, tEnd;
long nRecType;
long nRecId;
long StartYear, StartMon, StartDay, EndYear, EndMon, EndDay;
long StartHour, StartMin, StartSec, EndHour, EndMin, EndSec;
long tLocalStart = 0;
tLocalStart = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice,
tStart);
m_ctlXnsDevice.TimetToDate(tLocalStart, &StartYear, &StartMon, &StartDay,
&StartHour, &StartMin, &StartSec);
long tLocalEnd = 0;
tLocalEnd = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice,
tEnd);
m_ctlXnsDevice.TimetToDate(tLocalEnd, &EndYear, &EndMon, &EndDay,
&EndHour, &EndMin, &EndSec);
See Also
SearchDay, OnSearchCalendar, SearchCalendar, ControlID, LocalTimeToDeviceUTC
OnGetMotionGrid
Description
This event occurs if the application calls GetMotionGrid(), which contains the Motion Grid
information of DVR.
Syntax
void OnGetMotionGrid(
long nDeviceID,
long nControlID,
long nGridWidth,
long nGridHeight,
long pGridArray
);
Parameters
nDeviceID
nControlID
nGridWidth
nGridHeight
pGridArray
Example
[C++]
void CTestSampleDlg:: OnGetMotionGridXnssdkdevicectrl(long nDeviceID, long nControlID, long
nGridWidth, long nGridHeight, long pGridArray)
{
CString str;
char m_pGridArray[64][64];
m_nGridWidth = nGridWidth;
m_nGridHeight = nGridHeight;
See Also
GetMotionGrid, MotionSearch, OnMotionSearch
OnMotionSearch
Description
This event occurs if the application calls MotionSearch(). The timeline handle will be forwarded
to a parameter of the event handler. Some functions such as GetTimeline() use this handle as a
parameter.
Syntax
void OnMotionSearch(
long nDeviceID,
long nControlID,
long hTimeline
);
Parameters
nDeviceID
nControlID
hTimeline
[in] Timeline handle. This value is used as an input parameter for timeline-related functions.
Example
[C++]
void CTestSampleDlg::OnMotionSearchXnssdkdevicectrl(long nDeviceID, long nControlID, long
hTimeline)
{
long CamCount = m_ctlXnsDevice.GetCameraCount(hTimeline);
long TimelineCount = m_ctlXnsDevice.GetTimelineCount(hTimeline, 0);
CString strRecInfo;
long tStart, tEnd;
long nRecType;
long nRecId;
long StartYear, StartMon, StartDay, EndYear, EndMon, EndDay;
long StartHour, StartMin, StartSec, EndHour, EndMin, EndSec;
long tLocalStart = 0;
tLocalStart = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice,
tStart);
m_ctlXnsDevice.TimetToDate(tLocalStart, &StartYear, &StartMon, &StartDay,
&StartHour, &StartMin, &StartSec);
long tLocalEnd = 0;
tLocalEnd = m_ctrlXnsSdkDevice.UTCToDeviceLocalTime(m_hDevice,
tEnd);
m_ctlXnsDevice.TimetToDate(tLocalEnd, &EndYear, &EndMon, &EndDay,
&EndHour, &EndMin, &EndSec);
See Also
MotionSearch, GetMotionGrid, OnGetMotionGrid, OnSearchCalendar, SearchCalendar, ControlID,
LocalTimeToDeviceUTC
OnGetPresetList
Description
This event occurs if GetPresetList() is called. The handle of the preset list will be forwarded to
the parameter of event handler. This handle is input as a parameter of GetPresetCount(), and is
used to get information about the preset.
Syntax
void OnGetPresetList(
long nDeviceID,
long nControlID,
long hPresetListList
);
Parameters
nDeviceID
nControlID
hPresetListList
Example
[C++]
void CTestSampleDlg::OnGetPresetListXnssdkdevicectrl(long nDeviceID, long nControlID, long
hPresetListList)
{
CString str;
long nNumber;
long nPresetCount;
CString strPresetName;
nPresetCount = m_ctlXnsDevice.GetPresetCount(hPresetListList);
str.Format("Event OnGetPresetList.. nDevice[%d], nControlId[%d], PresetCount[%d]\n",
nDeviceID, nControlID, nPresetCount);
OutputDebugString(str);
See Also
GetPresetList, GetPresetCount, ControlID
OnUploadSoftwareProgress
Description
This event occurs at a regular interval each time the progress of uploading software to the
device using UploadSoftware() increases by 5%. It contains the progress(in percentage) and
error code.
Syntax
void OnUploadSoftwareProgress(
long nDeviceID,
long nErrorCode,
long nProgress
);
Parameters
nDeviceID
nErrorCode
nProgress
Example
[C++]
void CTestSampleDlg::OnUploadSoftwareProgressXnssdkdevicectrl(long nDeviceID, long
nErrorCode, long nProgress)
{
char str[200];
sprintf(str, "Upload Software DeviceID[%d] Progress[%d%], ErrCode[%s]\n", nDeviceID,
nProgress, m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
UploadSoftware
OnImportConfigProgress
Description
This event occurs if the application uses ImportConfig() to get the configuration file from the
device. It occurs at a regular interval each time the progress increases by 5%, and it contains
the error code.
Syntax
void OnImportConfigProgress(
long nDeviceID,
long nErrorCode,
long nProgress
);
Parameters
nDeviceID
nErrorCode
nProgress
Example
[C++]
void CTestSampleDlg::OnImportConfigProgressXnssdkdevicectrl(long nDeviceID, long
nErrorCode, long nProgress)
{
char str[200];
sprintf(str, "Import Config DeviceID[%d] Progress[%d%], ErrCode[%s]\n", nDeviceID,
nProgress, m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ImportConfig
OnExportConfigProgress
Description
This event occurs at a regular interval each time the progress of exporting configuration file to
the device using ExportConfig() increases by 5%. It contains the progress (%) and error code.
Syntax
void OnExportConfigProgress(
long nDeviceID,
long nErrorCode,
long nProgress
);
Parameters
nDeviceID
nErrorCode
nProgress
Example
[C++]
void CTestSampleDlg::OnExportConfigProgressXnssdkdevicectrl(long nDeviceID, long
nErrorCode, long nProgress)
{
char str[200];
sprintf(str, "Export Config DeviceID[%d] Progress[%d%], ErrCode[%s]\n", nDeviceID,
nProgress, m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ExportConfig
OnDeviceStatusChanged
Description
This event occurs if the device status has changed. It occurs if the application uses Connect() to
connect or reconnect to the device after disconnected.
When reconnection, nDeviceStatus is ‘true’, and call the OpenMedia() or OpenStream() function
to re-open all the media.
Syntax
void OnDeviceStatusChanged(
long nDeviceID,
long nErrorCode,
long nDeviceStatus,
long nHddCondition
);
Parameters
nDeviceID
nErrorCode
nDeviceStatus
nHddCondition
[in] Obsolete.
Example
[C++]
void CTestSampleDlg::OnDeviceStatusChangedXnssdkdevicectrl(long nDeviceID, long
nErrorCode, long nDeviceStatus, long nHddCondition)
{
char str[200];
if (nErrorCode == ERR_SUCCESS && nDeviceStatus == 1)
{
if ( m_ctlXnsDevice.GetDeviceStatus(m_hDevice) == XDEVICE_STATUS_CONNECTED )
m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0,
&m_pMediaLiveSource);
}
sprintf(str, "OnDevice Status Changed DeviceID[%d], nDeviceStatus[%d%],
nHddCondition[%d], ErrCode[%s]\n", nDeviceID, nDeviceStatus, nHddCondition,
m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
Connect
OnControlStatusChanged
Description
This event occurs if the device status or the capability of the control module has changed.
When receiving this event, the application can use GetControlStatus() to check the changes.
Syntax
void OnControlStatusChanged(
long nDeviceID,
long nControlID,
long nErrorCode,
long nStatusMask
);
Parameters
nDeviceID
nControlID
nErrorCode
nStatusMask
[in] Informs which setting of the control module has changed (see Table 2-11).
Example
[C++]
void CTestSampleDlg::OnControlStatusChangedXnssdkdevicectrl(long nDeviceID, long
nControlID, long nErrorCode, long nStatusMask)
{
char str[200];
sprintf(str, "Control Status Changed DeviceID[%d] ControlID[%d], Status[%d],
ErrCode[%s]\n", nDeviceID, nControlID, nStatusMask,
m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ControlID
OnControlCapabilityChanged
Description
This event occurs if the control module has changed its capability.
Syntax
void OnControlCapabilityChanged(
long nDeviceID,
long nControlID,
long nCapabilityMask
);
Parameters
nDeviceID
nControlID
nCapabilityMask
[in] Informs which capability of the control module has changed (see Table 2-12).
Example
[C++]
void CTestSampleDlg::OnControlCapabilityChangedXnssdkdevicectrl(long nDeviceID, long
nControlID, long nCapabilityMask)
{
char str[200];
sprintf(str, "Control Capability Changed DeviceID[%d] ControlID[%d], Status[%d]\n",
nDeviceID, nControlID, nCapabilityMask);
OutputDebugString(str);
}
See Also
ControlID
OnMotionEvent
Description
This event indicates that a motion event occurs from the device.
Syntax
void OnMotionEvent(
long nDeviceID,
long nControlID,
long tEventUTC
);
Parameters
nDeviceID
nControlID
tEventUTC
Example
[C++]
void CTestSampleDlg::OnMotionEventXnssdkdevicectrl(long nDeviceID, long nControlID, long
tEventUTC)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("Motion Event DeviceID[%d] ControlID[%d], time[%d-%d-
%d %02d:%02d:%02d]\n", nDeviceID, nControlID, Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);
}
See Also
ControlID
OnSensorEvent
Description
This events indicates that a sensor-in (i.e., alarm-in) event occurs from the device.
Syntax
void OnSensorEvent(
long nDeviceID,
long nControlID,
long nSensorNumber,
long tEventUTC
);
Parameters
nDeviceID
nControlID
nSensorNumber
tEventUTC
Example
[C++]
void CTestSampleDlg::OnSensorEventXnssdkdevicectrl(long nDeviceID, long nControlID, long
nSensorNumber, long tEventUTC)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("SensorEvent DeviceID[%d] ControlID[%d], SensorInput[%d], time[%d-%d-
%d %02d:%02d:%02d]\n", nDeviceID, nControlID, nSensorNumber, Year, Mon, Day, Hour, Min,
Sec);
OutputDebugString(str);
}
See Also
ControlID
OnIvOccurEvent
Description
This events indicates that IV event occurs at device.
Syntax
void OnIvOccurEvent (
long nDeviceID,
long nControlID,
long tEventUTC
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
tEventUTC
[in] Event occurred time. Format: 4-byte time_t.
Example
[C++]
void CIV_TESTDlg::OnIvOccurEventXnssdkdevicectrl(long nDeviceID, long nControlID, long
tEventUTC, long nIvType)
{
// TODO: Add your message handler code here
long year, mon, day, hour, min, sec;
See Also
ControlID
OnVideoLossEvent
Description
This event informs that a video loss event occurs from the device.
Syntax
void OnVideoLossEvent(
long nDeviceID,
long nControlID,
long tEventUTC
);
Parameters
nDeviceID
nControlID
tEventUTC
Example
[C++]
void CTestSampleDlg::OnVideoLossEventXnssdkdevicectrl(long nDeviceID, long nControlID, long
tEventUTC)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("VideoLossEvent DeviceID[%d] ControlID[%d], time[%d-%d-
%d %02d:%02d:%02d]\n", nDeviceID, nControlID, Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);
}
See Also
ControlID
OnHDDFailed
Description
This event occurs if DVR has failed to record, recognize or play contents in the hard disk drive.
Syntax
void OnHDDFailed(
long nDeviceID,
long nHDDNumber
);
Parameters
nDeviceID
nHDDNumber
Example
[C++]
void CTestSampleDlg::OnHDDFailedXnssdkdevicectrl(long nDeviceID, long nHDDNumber)
{
CString str;
str.Format("HDD Failed DeviceID[%d], nHDDNumber[%d]\n", nDeviceID, nHDDNumber);
OutputDebugString(str);
}
OnHDDFulled
Description
This event occurs when the HDD of DVR is full. If DVR has activated the Overwrite option, this
event will not be triggered.
Syntax
void OnHDDFulled(
long nDeviceID,
long nHDDNumber
);
Parameters
nDeviceID
nHDDNumber
Example
[C++]
void CTestSampleDlg::OnHDDFulledXnssdkdevicectrl(long nDeviceID, long nHDDNumber)
{
CString str;
str.Format("HDD Fulled DeviceID[%d], nHDDNumber[%d]\n", nDeviceID, nHDDNumber);
OutputDebugString(str);
}
OnHDDNumChanged
Description
This event occurs when a number of HDD in DVR decreases. This event doesn't occur when a
number of HDD increases.
Syntax
void OnHDDNumChanged(
long nDeviceID,
);
Parameters
nDeviceID
Example
[C++]
void CTestSampleDlg::OnHDDNumChangedXnssdkdevicectrl(long nDeviceID)
{
CString str;
str.Format("HDD NumChanged DeviceID[%d]\n", nDeviceID);
OutputDebugString(str);
}
OnPasswordChanged
Description
This event occurs if the password for DVR has changed.
Syntax
void OnPasswordChanged(
long nDeviceID,
BSTR szID
);
Parameters
nDeviceID
szID
Example
[C++]
void CTestSampleDlg::OnPasswordChangedXnssdkdevicectrl(long nDeviceID, LPCTSTR szID)
{
char str[200];
sprintf(str, "PasswordChanged DeviceID[%d] szID[%s]\n", nDeviceID, szID);
OutputDebugString(str);
OnBackupProgress
Description
This event occurs at a regular interval each time the progress of multimedia data backup
increases by 5%. It contains the progress (%) and error code.
Syntax
void OnBackupProgress(
long nDeviceID,
long nControlID,
long nErrorCode,
long nProgress,
long tStart,
long tEnd
);
Parameters
nDeviceID
nControlID
nErrorCode
nProgress
tStart
tEnd
Example
[C++]
void CTestSampleDlg::OnBackupProgressXnssdkdevicectrl(long nDeviceID, long nControlID, long
See Also
StartBackup, ControlID
OnNewMedia
Description
This event occurs when the application receives the frame data. If the application uses
OpenStream() to request stream data, then the frame data will be transferred through this
event.
Syntax
void OnNewMedia(
long nDeviceID,
long nControlID,
long nMediaType,
long hMediaData,
long nInputType,
long nFrameType,
long nFrameTime,
long nFrameSize,
long nTimeStamp
);
Parameters
nDeviceID
nControlID
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
hMediaData
[in] Handle of frame data. To display the data, call XnsSdkWindow::PushMedia() and enter this
handle as parameter.
nInputType
• XINPUT_METADATA(=3): Metadata
nFrameType
[in] Frame type. The following types are valid only if nInputType is set to XINPUT_VIDEO.
• XFRAME_UNKNOWN (=0)
• XFRAME_END (=4)
nFrameTime
nFrameSize
nTimeStamp
[in] Frame play time. (Unit: millisecond) Use to check if the current frame is how ms has passed
from the previous frame. For instance, if the first frame is 3042 and the second is after 30ms,
nTimeStamp of the second frame will become 3072.
Remarks
hMediaData is memory address for the media stream, and first 296bytes of hMediaData
pointer means header information, then next bytes means encoded media data.
Example
[C++]
void CTestSampleDlg::OnNewMediaXnssdkdevicectrl(long nDeviceID, long nControlID, long
nMediaType, long hMediaData, long nInputType, long nFrameType, long nFrameTime, long
nFrameSize, long nTimeStamp)
{
// this function draw video on the window control
m_ctlXnsWindow.PushMedia(hMediaData);
// or you can use the encoded video data as follows
char *video_header = (char *) hMediaData;
char *video_data = video_header+296;
XNSE_MEDIA_TYPE
typedef enum
{
XNSE_MTYPE_NONE = 0X00,
XNSE_MTYPE_LIVE = 0x01,
XNSE_MTYPE_SEARCH_NET = 0x02,
XNSE_MTYPE_REPLAY = 0x04,
XNSE_MTYPE_SEARCH_LOCAL = 0x08,
XNSE_MTYPE_SEARCH_CLIP = 0x10,
XNSE_MTYPE_BACKUP_NET = 0x20,
XNSE_MTYPE_BACKUP_LOCAL = 0x40,
XNSE_MTYPE_COPY = 0x80,
XNSE_MTYPE_METADATA = 0x0100,
XNSE_MTYPE_METADATA_SEARCH = 0x0200,
XNSE_MTYPE_METADATA_BACKUP = 0x0400,
} XNSE_MEDIA_TYPE;
XNSE_MEDIA_CODEC_TYPE
typedef enum
{
XNSE_CODEC_UNKNOWN = 0x00000000,
XNSE_CODEC_JPEG = 0x00000001,
XNSE_CODEC_MJPEG = 0x00000002,
XNSE_CODEC_MP4V = 0x00000004,
XNSE_CODEC_MP4V_ASP = 0x00000008,
XNSE_CODEC_PENTA = 0x00000010,
XNSE_CODEC_SOLO = 0x00000020,
XNSE_CODEC_H264 = 0x00000040,
XNSE_CODEC_JPEG2000 = 0x00000080,
XNSE_CODEC_IDIS_MPEG4 = 0x00000100,
XNSE_CODEC_IDIS_H264 = 0x00000200,
XNSE_CODEC_G711 = 0x00010000,
XNSE_CODEC_G726 = 0x00020000,
XNSE_CODEC_PCM = 0x00040000,
XNSE_CODEC_G726_504X = 0x00080000,
XNSE_CODEC_IMA_ADPCM = 0x00100000,
XNSE_CODEC_G723 = 0x00200000,
XNSE_CODEC_G723_SVR = 0x00400000,
XNSE_CODEC_PCM_WESP = 0x00800000,
XNSE_CODEC_G726_SNR = 0x01000000,
XNSE_CODEC_DVI4_HISILICON = 0x02000000,
XNSE_CODEC_G711U_HISILICON = 0x04000000,
XNSE_CODEC_G726_VER = 0x08000000,
XNSE_CODEC_G711_IPCAM = 0x10000000,
XNSE_CODEC_AAC = 0x20000000,
} XNSE_MEDIA_CODEC_TYPE;
XNSE_MEDIA_TYPE
typedef enum
{
XNSE_MPEG_UNKNOWN = 0,
XNSE_MPEG_IVOP,
XNSE_MPEG_PVOP,
XNSE_MPEG_BVOP,
XNSE_BACKUP_END,
XNSE_THUMBNAIL,
XNSE_THUMBNAIL_END,
XNSE_BACKUP_FAILED,
XNSE_BACKUP_CHUNK_END,
} MPEG_FRAME_TYPE; // frame type
See Also
OpenStream, XnsSdkWindow::PushMedia, ControlID
OnFanBroken
Description
This event occurs if the fan of Camera malfunctions.
Syntax
void OnFanBroken(long nDeviceID);
Parameters
nDeviceID
Example
[C++]
void CTestSampleDlg::OnFanBrokenXnssdkdevicectrl(long nDeviceID)
{
CString str;
str.Format("Fan Broken DeviceID[%d]\n", nDeviceID);
OutputDebugString(str);
}
OnFanStatusChanged
Description
This event occurs if the fan of DVR/NVR status has changed.
Syntax
void OnFanStatusChanged(long nDeviceID, long tEventUTC, long nFanNo, long nStatus);
Parameters
nDeviceID
tEventUTC
[in] Event occurred time. Format: 4-byte time_t.
nFanNo
[in] Fan number.
nStatus
[in] Fan Status.
• (1): broken.
• (0): normal.
Example
[C++]
void CTestSampleDlg::OnFanStatusChangedXnssdkdevicectrl(long nDeviceID, long tEventUTC,
long nFanNo, long nStatus)
{
CString str;
str.Format("Fan Status Changed DeviceID[%d], FanNo[%d], Status[%d] \n", nDeviceID,
nFanNo, nStatus);
OutputDebugString(str);
}
OnPtzControlFailed
Description
This event occurs if the PTZ control has failed.
Syntax
void OnPtzControlFailed(
long nDeviceID,
long nControlID,
long nErrorCode
);
Parameters
nDeviceID
nControlID
nErrorCode
Example
[C++]
void CTestSampleDlg::OnPtzControlFailedXnssdkdevicectrl(long nDeviceID, long nControlID, long
nErrorCode)
{
char str[200];
sprintf(str, "Ptz Control Failed DeviceID[%d] ControlID[%d], nErrorCode[%s]\n",
nDeviceID, nControlID, m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ControlID
OnAlarmOutControlFailed
Description
This event occurs if the application has failed to control the alarm-out.
Syntax
void OnAlarmOutControlFailed (
long nDeviceID,
long nControlID,
long nErrorCode
);
Parameters
nDeviceID
nControlID
nErrorCode
Example
[C++]
void CTestSampleDlg::OnOnAlarmOutControlFailedXnssdkdevicectrl1(long nDeviceID, long
nControlID, long nErrorCode)
{
CString str;
str.Format("AlarmOut Control Failed DeviceID[%d] ControlID[%d], Status[%d]\n",
nDeviceID, nControlID, m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}
See Also
ControlID
OnControlRemoteNameChanged
Description
This event occurs if a control module of DVR has been renamed.
Syntax
void OnControlRemoteNameChanged(
long nDeviceID,
long nControlID
);
Parameters
nDeviceID
nControlID
Example
[C++]
void CTestSampleDlg::OnControlRemoteNameChangedXnssdkdevicectrl(long nDeviceID, long
nControlID)
{
CString str;
str.Format("Control RemoteName Changed DeviceID[%d] ControlID[%d]\n", nDeviceID,
nControlID);
OutputDebugString(str);
}
See Also
ControlID
OnGetPtzPos
Description
This event occurs when GetPtzPos() is called. One of the parameter of event handler is the
handle of preset list, which used to get the absolute coordinate of camera.
Syntax
void OnGetPtzPos(
long nDeviceID,
long nControlID,
long nErrorCode,
long nPan,
long nTilt,
long nZoom
);
Parameters
nDeviceID
[in] Device ID.
nControlID
nErrorCode
[in] return value.
nPan
[in] Absolute value of Pan.
nTilt
[in] Absolute value of Tilt.
nZoom
[in] Absolute value of Zoom.
Example
[C++]
See Also
GetPtzPos, SetPtzPos, ControlID
OnGetPtzPosNormalize
Description
This event occurs when GetPtzPosNormalize() is called. One of the parameter of event handler
is the handle of preset list, which used to get the coordinate of camera.
Syntax
void OnGetPtzPosNormalize(
long nDeviceID,
long nControlID,
long nErrorCode,
float fPan,
float fTilt,
float fZoom
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nErrorCode
[in] return value.
fPan
[in] Value of Pan.
fTilt
[in] Value of Tilt.
fZoom
[in] Value of Zoom.
Example
[C++]
See Also
GetPtzPosNormalize, SetPtzPosNormalize, ControlID
OnAreaZoomMoving
Description
This event occurs if a AreaZoomMoving of Device has been changed. This function is
valid only within the Device in AreaZoom support.
Syntax
void OnAreaZoomMoving(
long nDeviceID,
long nControlID,
long nStatus,
long nReserved
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nStatus
[in] AreaZoomMoving status.
• 1: Moving
• 2: Moved
nReserved
[in] Reserved. Set Zero
Example
[C++]
See Also
AreaZoom, ControlID
OnVideoFrameInfoReceived
Description
This event occurs if a video frame has been received. This function is valid only call
SetVideoInfoReceived() before.
Syntax
void OnVideoFrameInfoReceived(
long nDeviceID,
long nControlID,
long nMediaType,
long nFps,
long nKbps,
long nVideoWidth,
long nVideoHeight,
long nCodecType
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nMediaType
• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).
nFps
[in] fps
nKbps
[in] Bitrate (Kbps)
nVideoWidth
[in] Video width
nVideoHeight
[in] Video height
nCodecType
[in] Video codec information
Example
[C++]
See Also
SetVideoInfoReceived, ControlID
OnRecordingErrorEvent
Description
This event indicates that a recording error event occurs from the device.
Syntax
void OnRecordingErrorEvent(
long nDeviceID,
long tEventUTC
);
Parameters
nDeviceID
tEventUTC
Example
[C++]
void CTestSampleDlg::OnRecordingErrorEventXnssdkdevicectrl(long nDeviceID, long tEventUTC)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("Recording Error Event DeviceID[%d], time[%d-%d-%d %02d:%02d:%02d]\n",
nDeviceID, Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);
}
OnPowerRestart
Description
This event will occur if the application uses PowerRestart().
Syntax
void OnPowerRestart(
long nDeviceID,
long nErrorCode
);
Parameters
nDeviceID
nErrorCode
Example
[C++]
void CMy01_LiveDlg::OnPowerRestartXnssdkdevicectrl(long nDeviceID, long nErrorCode)
{
char str[100];
sprintf(str, "Power Restart.. nDeviceID[%d], Error[%s]\n", nDeviceID,
m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);}
See Also
PowerRestart
OnRecordingStatusChanged
Description
This event occurs when the recording status of the device has changed.
Syntax
void OnRecordingStatusChanged(
long nDeviceID,
long tEventUTC,
long nControlID,
long nStatus
);
Parameters
nDeviceID
[in] Device ID.
tEventUTC
nControlID
nStatus
[in] Recording Status.
Example
[C++]
void CTestSampleDlg::OnRecordingStatusChangedXnssdkdevicectrl(long nDeviceID, long
tEventUTC, long nControlID, long nStatus)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("RecordingStatusChanged Event DeviceID[%d], time[%d-%d-
%d %02d:%02d:%02d], ControlID[%d], Status[%d]\n", nDeviceID, Year, Mon, Day, Hour, Min,
Sec, nControlID, nStatus);
OutputDebugString(str);
See Also
ToggleDvrRecording
OnTrackingEventChanged
Description
This events indicates that a tracking event occurs from the device.
Syntax
void OnTrackingEventChanged(
long nDeviceID,
long nControlID,
long nSubEvent,
long tEventUTC,
long nParam1,
long nParam2,
long nParam3,
long nParam4,
LPCTSTR description,
LPCTSTR strParam
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nSubEvent
tEventUTC
nParam1
[in] Reserved.
nParam2
[in] Reserved.
nParam3
[in] Reserved.
nParam4
[in] Reserved.
description
[in] Reserved.
strParam
[in] Reserved.
Example
[C++]
void CTestSampleDlg::OnTrackingEventChangedXnssdkdevicectrl1(long nDeviceID, long
nControlID, long nSubEvent, long tEventUTC, long nParam1, long nParam2, long nParam3, long
nParam4, LPCTSTR description, LPCTSTR strParam)
{
// TODO: Add your message handler code here
long year, mon, day, hour, min, sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &year, &mon, &day, &hour, &min, &sec);
DBG_LOG(_T("$$Tracking Event Detected, device=%d, cid=%d, time=[%04d-%02d-
%02d %02d:%02d:%02d]\n"),
nDeviceID, nControlID, year, mon, day, hour, min, sec);
if(nSubEvent & XEVT_TRACKING_OCCUR)
DBG_LOG(_T("$$SUBEVENT TYPE : OCCUR\n"));
}
OnFaceDetectionEventChanged
Description
This events indicates that a face detection event occurs from the device.
Syntax
void OnFaceDetectionEventChanged(
long nDeviceID,
long nControlID,
long nSubEvent,
long tEventUTC,
long nParam1,
long nParam2,
long nParam3,
long nParam4,
LPCTSTR description,
LPCTSTR strParam
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nSubEvent
tEventUTC
nParam1
[in] Reserved.
nParam2
[in] Reserved.
nParam3
[in] Reserved.
nParam4
[in] Reserved.
description
[in] Reserved.
strParam
[in] Reserved.
Example
[C++]
void CTestSampleDlg::OnFaceDetectionEventChangedXnssdkdevicectrl1(long nDeviceID, long
nControlID, long nSubEvent, long tEventUTC, long nParam1, long nParam2, long nParam3, long
nParam4, LPCTSTR description, LPCTSTR strParam)
{
// TODO: Add your message handler code here
long year, mon, day, hour, min, sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &year, &mon, &day, &hour, &min, &sec);
DBG_LOG(_T("$$Face Detection Event Detected, device=%d, cid=%d, time=[%04d-%02d-
%02d %02d:%02d:%02d]\n"),
nDeviceID, nControlID, year, mon, day, hour, min, sec);
if(nSubEvent & XEVT_FACE_DETECTION_OCCUR)
DBG_LOG(_T("$$SUBEVENT TYPE : OCCUR\n"));
}
OnAudioDetectionEventChanged
Description
This events indicates that a audio detection event occurs from the device.
Syntax
void OnAudioDetectionEventChanged(
long nDeviceID,
long nControlID,
long nSubEvent,
long tEventUTC,
long nParam1,
long nParam2,
long nParam3,
long nParam4,
LPCTSTR description,
LPCTSTR strParam
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nSubEvent
tEventUTC
nParam1
[in] Reserved.
nParam2
[in] Reserved.
nParam3
[in] Reserved.
nParam4
[in] Reserved.
description
[in] Reserved.
strParam
[in] Reserved.
Example
[C++]
OnAMDEventChanged
Description
This events indicates that event related with Advanced Motion Detected occurs from
the device.
Syntax
void OnAMDEventChanged(
long nDeviceID,
long nControlID,
long nSubEvent,
long tEventUTC,
long nParam1,
long nParam2,
long nParam3,
long nParam4,
LPCTSTR description,
LPCTSTR strParam
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nSubEvent
tEventUTC
nParam1
[in] Reserved.
nParam2
[in] Reserved.
nParam3
[in] Reserved.
nParam4
[in] Reserved.
description
[in] Reserved.
strParam
[in] Reserved.
XEVT_AMD_DSP_VA_START 17 DSP(DM8167) VA 시작
XEVT_AMD_DSP_VA_FAIL 18 DSP(DM8167) VA 실패
Example
[C++]
void CTestSampleDlg::OnAMDEventChangedXnssdkdevicectrl1(long nDeviceID, long nControlID,
long nSubEvent, long tEventUTC, long nParam1, long nParam2, long nParam3, long nParam4,
LPCTSTR description, LPCTSTR strParam)
{
// TODO: Add your message handler code here
long year, mon, day, hour, min, sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &year, &mon, &day, &hour, &min, &sec);
DBG_LOG(_T("$$AMD Event Detected, device=%d, cid=%d, time=[%04d-%02d-
%02d %02d:%02d:%02d]\n"),
nDeviceID, nControlID, year, mon, day, hour, min, sec);
if(nSubEvent & XEVT_AMD_ROI_MOTION_DETECTION_START)
DBG_LOG(_T("$$SUBEVENT TYPE : ROI_MOTION_DETECTION_START\n"));
}
OnSystemEventChanged
Description
This events indicates that a audio system event occurs from the device.
Syntax
void OnSystemEventChanged(
long nDeviceID,
long nControlID,
long nSubEvent,
long tEventUTC,
long nParam1,
long nParam2,
long nParam3,
long nParam4,
LPCTSTR description,
LPCTSTR strParam
);
Parameters
nDeviceID
[in] Device ID.
nControlID
[in] Control ID.
nSubEvent
tEventUTC
nParam1
[in] Reserved.
nParam2
[in] Reserved.
nParam3
[in] Reserved.
nParam4
[in] Reserved.
description
[in] Reserved.
strParam
[in] Reserved.
maximum.
Example
[C++]
void CTestSampleDlg::OnSystemEventChangedXnssdkdevicectrl1(long nDeviceID, long
nControlID, long nSubEvent, long tEventUTC, long nParam1, long nParam2, long nParam3, long
nParam4, LPCTSTR description, LPCTSTR strParam)
{
// TODO: Add your message handler code here
long year, mon, day, hour, min, sec;
m_ctlXnsDevice.TimetToDate(tEventUTC, &year, &mon, &day, &hour, &min, &sec);
DBG_LOG(_T("$$System Event Detected, device=%d, cid=%d, time=[%04d-%02d-
%02d %02d:%02d:%02d]\n"),
nDeviceID, nControlID, year, mon, day, hour, min, sec);
OnChangeDeviceAdminPassword
Description
This event occurs if the application changed password of Admin account by using
ChangeDeviceAdminPassword. And it contains the result of function execution.
Syntax
void OnChangeDeviceAdminPassword(
long nDeviceID,
long nErrorCode
);
Parameters
nDeviceID
nErrorCode
Example
[C++]
void CSdkTestDlg::OnChangeDeviceAdminPasswordXnssdkdevicectrl(long nDeviceID, long
nErrorCode)
{
WLOGD(_T("Change Password, errcode=[%d](%s)\n"), nErrorCode,
m_ctrlXnsDevice.GetErrorString(nErrorCode));
if(nErrorCode == ERR_SUCCESS)
{
m_pDlgDeviceInfo->ReconnectNewPw(m_pChangePw->m_strNewPw);
}
}
See Also
ChangeDeviceAdminPassword
XnsSdkWindow
Features included:
ㆍ Zoom control
ㆍ OSD menu
ㆍ Volume control
ㆍ Media play
ㆍ Buffer management
Contents
ㆍ Initialize the Control
ㆍ Control Zoom
ㆍ OSD Menu
ㆍ Control Volume
ㆍ Snapshot
ㆍ Control Playback
ㆍ Control Buffer
ㆍ Miscellaneous
ㆍ Events
CHAPTER 3
XnsSdkWindow Initialize the Control
XnsSdkWindow.ocx should be initialized using Initialize() before it can be enabled. However, the
application doesn't need to call the close function after it has finished.
Initialize
Description
Initializes the XnsSdkWindow control. Namely, this will specify the window handle in order to
display images on the screen.
Syntax
long Initialize(
long hDrawWnd,
long hTopWnd
);
Parameters
hDrawWnd
[in] Window handle. If this is Null, XnsSdkWindow will use the default window.
hTopWnd
[in] Parent window handle. If this is Null, XnsSdkWindow will use the default window.
Return Value
Example
[C++]
long ErrCode = m_ctlXnsWindow.Initialize(NULL, NULL);
char str[100];
sprintf(str, "ErrorCode[0x%x]\n", ErrCode);
OutputDebugString(str);
See Also
XnsSdkDevice::Initialize
Start
Description
Adds the media source handle to XnsSdkWindow.
Syntax
long Start(long hMediaSource);
Parameters
hMediaSource
[in] Media source handle. This value can be obtained using XnsSdkDevice::OpenMedia().
Return Value
Example
[C++]
m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);
m_ctlXnsWindow.Start(m_pMediaLiveSource);
See Also
XnsSdkDevice::OpenMedia, Stop
Stop
Description
Stops receiving the stream data from the media source handle (pMediaSource).
Syntax
long Stop(void);
Return Value
Media source handle.
Example
[C++]
m_ctlXnsWindow.Stop();
m_ctlXnsDevice.CloseMedia(m_hDevice, m_pMediaLiveSource);
m_pMediaLiveSource = NULL;
See Also
XnsSdkDevice::CloseMedia, Start
GetDeviceID
Description
Returns the ID of the device that is connected to media source.
Syntax
long GetDeviceID(void);
Return Value
Device ID If the return value is 0, then no device ID exists.
Example
[C++]
long nDeviceID = m_ctlXnsWindow.GetDeviceID();
DisplayLong("GetDeviceID", nDeviceID);
See Also
XnsSdkDevice::CreateDevice
GetControlID
Description
Returns the control ID from media source.
Syntax
long GetControlID(void);
Return Value
Control ID connected to media source.
Example
[C++]
long nControlID = m_ctlXnsWindow.GetControlID();
DisplayLong("GetControlID", nControlID);
GetImageWidth
Description
Returns the width of the source image.
Syntax
long GetImageWidth(void);
Return Value
Width of the source image.
Example
[C++]
long nWidth = m_ctlXnsWindow.GetImageWidth();
DisplayLong("ImageWidth", nWidth);
See Also
GetImageHeight
GetImageHeight
Description
Returns the height of the source image.
Syntax
long GetImageHeight(void);
Return Value
Height of the source image.
Example
[C++]
long nHeight = m_ctlXnsWindow.GetImageHeight ();
DisplayLong("ImageHeight", nHeight);
See Also
GetImageWidth
IsMedia
Description
Syntax
long IsMedia(void);
Return Value
‘1’ will be returned in the following cases, otherwise ‘0’ will be returned.
• XnsSdkWindow initialized.
• hMediaSource is valid.
Example
[C++]
long isMedia = m_ctlXnsWindow.IsMedia();
DisplayLong("IsMedia", isMedia);
See Also
Start
GetMediaType
Description
Returns the type of media currently playing.
Syntax
long GetMediaType(void);
Return Value
Media type.
Example
[C++]
long MediaType = m_ctlXnsWindow.GetMediaType();
DisplayLong("GetMediaType", MediaType);
Control Zoom
ZoomLevel
Description
Controls the digital zoom.
Syntax
long ZoomLevel(
long nX,
long nY,
long nLevel
);
Parameters
nX
nY
nLevel
[in] Zoom factor of zoom in/out. Positive value indicates zoom-in while negative indicates
zoom-out. If this value is 100, the zoom factor is x1 (full image). If the value is 200, zoom-in
will performed at x2. (i.e., 200% zoom-in) the maximum is 10000.
Note
The top left of the image is (0,0) and the bottom right is (width, height).
Return Value
Zoom factor (%) If the return value of IsMedia is FALSE, then function will be fixed to 100.
Example
[C++]
long nZoomLevel = m_ctlXnsWindow.ZoomLevel(50, 50, 400);
DisplayLong("ZoomLevel", nZoomLevel);
See Also
IsMedia
ZoomRate
Description
Use the zoom ratio to control the digital zooming.
Syntax
long ZoomRate(
double lfX,
double lfY,
double lfWidth,
double lfHeight
);
Parameters
lfX
[in] Use the zoom ratio to calculate the top left X coordinate.
lfY
[in] Use the zoom ratio to calculate the top left Y coordinate.
lfWidth
lfHeight
For instance, the XnsSdkWindow control sizes 640X480 and the zoom rectangles sizes 320 x
240, and the top left is (100,50), the parameter will be calculated as below:
Return Value
Zoom factor (%).If the return value of IsMedia is FALSE, that of this function will be fixed to 100.
Example
[C++]
long ZoomRate = m_ctlXnsWindow.ZoomRate(.25, .25, .5, .5);
DisplayLong("ZoomRate", ZoomRate);
See Also
ZoomLevel, ClearZoom
GetZoomInfo
Description
Returns the ratio of the currently set digital zoom.
Syntax
long GetZoomInfo(
double* plfX,
double* plfY,
double* plfWidth,
double* plfHeight
);
Parameters
plfX
[out] Use the zoom ratio to calculate the top left X coordinate.
plfY
[out] Use the zoom ratio to calculate the top left Y coordinate.
plfWidth
plfHeight
Note
For calculating the zoom ratio, see the samples of ZoomRate.
Return Value
Zoom factor (%). When IsMedia() returns FALSE, this return value will be fixed as 100.
Example
[C++]
double lfX, lfY, lfWidth, lfHeight;
long nZoomFactor = m_ctlXnsWindow.GetZoomInfo(&lfX, &lfY, &lfWidth, &lfHeight);
CString str;
str.Format("GetZoomInfo.. lfX[%f], lfY[%f], lfWidth[%f], lfHeight[%f]\n", lfX, lfY, lfWidth, lfHeight);
OutputDebugString(str);
See Also
ZoomRate
ClearZoom
Description
Deletes the zoom settings. Restores the image to the original size.
Syntax
void ClearZoom(void);
Example
[C++]
m_ctlXnsWindow.ClearZoom();
See Also
ZoomLevel, ZoomRate
DrawRect
Description
Uses the blue brush to draw a rectangle on XnsSdkWindow. If this function is called more than
twice, the existing rectangle will be replaced with a new one.
Syntax
void DrawRect(
long nX,
long nY,
long nWidth,
long nHeight
);
Parameters
nX
nY
nWidth
nHeight
Example
[C++]
m_ctlXnsWindow.DrawRect(10, 10, 50, 50);
See Also
ClearDraw, DrawShape
ClearDraw
Description
Deletes the existing rectangle on the screen.
Syntax
void ClearDraw(void);
Example
[C++]
m_ctlXnsWindow.ClearDraw();
See Also
DrawRect
DrawShape
Description
Draws a rectangle in color and line thickness specified by the application. If you want to delete
the rectangle, set the parameter in the same way as previous one and only change the
thickness (nThick) to 0 before calling this function again.
Syntax
void DrawShape(
long nIndex,
long nType,
long nX,
long nY,
long nWidth,
long nHeight,
long nR,
long nG,
long nB,
long nThick
);
Parameters
nIndex
nType
nX
nY
nWidth
nHeight
nR
nG
nB
nThick
Example
[C++]
m_ctlXnsWindow.DrawShape(1, 1, 10, 10, 50, 50, 255, 0, 0, 10);
See Also
DrawRect
OSD Menu
SetOSDOnOff
Description
Displays OSD menu on the video screen or closes OSD menu.
Syntax
void SetOSDOnOff(
long nOSDID,
BOOL bOnOff
);
Parameters
nOSDID
bOnOff
Example
[C++]
m_ctlXnsWindow.SetOsdOnOff(OSD_ALL, 0);
SetDateTimeFormat
Description
Changes the format of time and date that will be displayed on the screen.
Syntax
void SetDateTimeFormat(long nFormatID);
Parameters
nFormatID
• 1: YYYY-MM-DD hh:mm:ss
• 2: YYYY-MM-DD hh:mm
• 3: MM-DD-YYYY hh:mm:ss
• 4: MM-DD-YYYY hh:mm
• 5: DD-MM-YYYY hh:mm:ss
• 6: DD-MM-YYYY hh:mm
Remarks
If time and date cannot be displayed both due to the window width, XnsSdkWindow does not
display the date information.
Example
[C++]
m_ctlXnsWindow.SetDateTimeFormat(5);
SetCustomOSD
Description
Sets the information of custom OSD that will be displayed on the screen.
Syntax
long SetOSDOnOff(
BSTR szOSDText,
long nX,
long nY,
long nR,
long nG,
long nB
);
Parameters
szOSDText
nX
nY
nR
nG
nB
Example
[C++]
m_ctlXnsWindow.SetOSDText(“Custom string”, 10, 10, 255, 255, 255);
See Also
SetCustomOSDOnOff
SetCustomOSDOnOff
Description
Displays custom OSD text on the video screen or closes custom OSD text.
Syntax
void SetCustomOSDOnOff(
BOOL bOnOff
);
Parameters
bOnOff
Example
[C++]
m_ctlXnsWindow.SetCustomOSDOnOff(1);
See Also
SetCustomOSD
Control Volume
SetSound
Description
Turns on or off the sound.
Syntax
void SetSound(BOOL bSound);
Parameters
bSound
• 1: On the sound
Example
[C++]
m_ctlXnsWindow.SetSound(0);
See Also
SetVolume, GetVolume, SetListen, SetVolume, GetVolume
SetVolume
Description
Specify the volume level of the sound.
Syntax
void SetVolume(long nVolume);
Parameters
nVolume
Example
[C++]
m_ctlXnsWindow.SetVolume(70);
See Also
GetVolume, SetSound
GetVolume
Description
Returns the sound volume that is currently specified.
Syntax
long GetVolume(void);
Return Value
Current sound volume. If there is no previous setting, the default value of 50 will be returned.
Example
[C++]
m_ctlXnsWindow.GetVolume();
See Also
SetSound, SetVolume
SetVideoRawDataReceived
Description
Uses this function to receive decoded video raw data. When this function is called,
OnVideoRawDataReceived() Event will be occurred.
Syntax
long SetVideoRawDataReceived(
long hMediaSource
);
Parameters
hMediaSource
[in] Media source handle. This value can be obtained using XnsSdkDevice::OpenMedia()..
Return Value
Example
[C++]
m_ctrlXnsSdkDevice.OpenMedia(m_hDevice, 3, 1, 0, 0, &m_hMediaSource);
m_ctrlXnsSdkWindow.Start(m_hMediaSource);
m_ctrlXnsSdkWindow.SetVideoRawDataReceived(m_hMediaSource);
See Also
UnsetVideoRawDataReceived, OnVideoRawDataReceived, SaveSnapshotWithData, OpenMedia,
Start
UnSetVideoRawDataReceived
Description
Uses this function to cancel SetVideoRawDataReceived() call. When this function is called,
OnVideoRawDataReceived() Event will not be occurred.
Syntax
long UnSetVideoRawDataReceived(
long hMediaSource
);
Parameters
hMediaSource
[in] Media source handle. This value can be obtained using XnsSdkDevice::OpenMedia()..
Return Value
Example
[C++]
m_ctrlXnsSdkDevice.OpenMedia(m_hDevice, 3, 1, 0, 0, &m_hMediaSource);
m_ctrlXnsSdkWindow.Start(m_hMediaSource);
m_ctrlXnsSdkWindow.SetVideoRawDataReceived(m_hMediaSource);
m_ctrlXnsSdkWindow.UnSetVideoRawDataReceived(m_hMediaSource);
See Also
SetVideoRawDataReceived, OnVideoRawDataReceived, SaveSnapshotWithData
Snapshot
SaveSnapshot
Description
Saves the snapshot of the current image.
Syntax
long SaveSnapshot(
BSTR szFile,
long nFormat
);
Parameters
szFile
nFormat
• 0: BMP file
• 1: JPG file
Return Value
If saving the snapshot is successful, it returns 1. If saving it fails, it returns 0.
Example
[C++]
long nSuccess= m_ctlXnsWindow.SaveSnapshot("d:\\test_XnsWindow1.jpg", 1);
DisplayLong("SaveSnapshot", nSuccess);
See Also
PrintSnapshot
SaveSnapshotWithString
Description
Saves the snapshot of the current image with device’s information.
Syntax
long SaveSnapshotWithString(
LPCTSTR szFile,
long nFormat,
BOOL bShowCameraName,
BOOL bUseLocalName,
BOOL bShowDateTime,
LPCTSTR szUserNote,
BOOL bUseTempSavedImage
);
Parameters
szFile
nFormat
• 0: BMP file
• 1: JPG file
bShowCameraName
bUseLocalName
bShowDateTime
szUserNote
bUseTempSavedImage
Return Value
If saving the snapshot is successful, it returns 1. If saving it fails, it returns 0.
Example
[C++]
long nSuccess= m_ctlXnsWindow.SaveSnapshotWithString("d:\\test_XnsWindow1.jpg", 1, 1, 0,
1, “Area : Floor1”, 0 );
DisplayLong("SaveSnapshotWithString", nSuccess);
See Also
PrintSnapshot
SaveSnapshotWithData
Description
Save the snapshot image of the raw video data from OnVideoRawDataReceived() event.
Syntax
long SaveSnapshotWithData(
long pData,
long nDataSize,
long nImageWidth,
long nImageHeight,
BSTR szFile,
long nFormat
);
Parameters
pData
[in] Decoded video data buffer
nDataSize
[in] Size of the decoded video data
nImageWidth
[in] Width resolution of the decoded video data.
nImageHeight
[in] Height resolution of the decoded video data.
szFile
nFormat
• 0: BMP file
• 1: JPG file
Return Value
If saving the snapshot is successful, it returns 1. If saving it fails, it returns 0.
Example
[C++]
void CVideoRawDataDlg::OnVideoRawDataReceivedXnssdkwindowctrl(long nDeviceID, long
nControlID, long nWidth, long nHeight, long nVideoSize, long pVideoData)
{
m_nWidth = nWidth;
m_nHeight = nHeight;
unsigned char *pVideo = (unsigned char*)pVideoData;
See Also
SetVideoRawDataReceived, OnVideoRawDataReceived, UnSetVideoRawDataReceived
PrintSnapshot
Description
Prints out the snapshot of the current image.
Syntax
long PrintSnapshot(void);
Return Value
If it succeeds, it returns 1. If it fails, it returns 0.
Example
[C++]
long nSuccess= m_ctlXnsWindow.PrintSnapshot();
DisplayLong("PrintSnapshot", nSuccess);
See Also
SaveSnapshot
Control Playback
PushMedia
Description
Transfers stream data to XnsSdkWindow so that the media stream will be displayed on the
window after decoded.
Syntax
long PushMedia(long hMediaData);
Parameters
hMediaData
[in] Media data. This value will be forwarded to the parameter of the OnNewMedia event
handler, and will be valid within the event handle functions.
Return Value
Remarks
Start() should be called before you can use this function.
Example
[C++]
// Start() should be called before you can use this function.
void CTestSampleDlg::PushMedia()
{
m_pMediaSource = 0;
m_ctlXnsWindow.Start(m_pMediaSource);
m_bPushMedia = 1;
}
See Also
Start, OnNewMedia Event of XnsSdkDevice
SetPlaySpeed
Description
Sets the play speed.
This function has no upper or lower limit (max/min) of the play speed. However, if some
devices exceed the upper limit, this function will set the play speed to the max automatically. If
the transfer rate is too low, you may encounter buffering. This function is valid only if opening
the stream data in playback mode. This function is available only if XnsSdkDevice::OpenStream()
has set nType to XMEDIA_PLAYBACK.
Syntax
void SetPlaySpeed(double dPlaySpeed);
Parameters
dPlaySpeed
Example
[C++]
m_ctlXnsWindow.SetPlaySpeed(4.0);
See Also
XnsSdkDevice::OpenStream, GetPlaySpeed
GetPlaySpeed
Description
Gets the play speed currently specified.
This function is valid only if opening the stream data is in playback mode. This function is
available only if XnsSdkDevice::OpenStream() has set nType to XMEDIA_PLAYBACK.
Syntax
double GetPlaySpeed(void);
Return Value
Current play speed.
Example
[C++]
double PlaySpeed = m_ctlXnsWindow.GetPlaySpeed();
See Also
SetPlaySpeed, XnsSdkDevice::OpenStream
MoveFrameAdvance
Description
Displays the next frame.
To enable this function, the play speed should be set to 0. This function is valid only if opening
the stream data is in playback mode. This function is available only if
XnsSdkDevice::OpenStream() has set nType to XMEDIA_PLAYBACK.
Syntax
void MoveFrameAdvance(void);
Example
[C++]
if (m_ctlXnsWindow.GetPlaySpeed() == 0)
m_ctlXnsWindow.MoveFrameAdvance();
See Also
SetPlaySpeed, GetPlaySpeed, XnsSdkDevice::OpenStream
Control Buffer
ClearMediaBuffer
Description
Clears the buffer contents.
In playback mode, XnsSdkWindow will pile up the stream data in the buffer due to a difference
between transfer rate and playback speed. If the application performs search with unclear
buffer, the remaining contents in the buffer will be displayed after the search. This function will
be called to clear the buffer before performing the search.
Syntax
void ClearMediaBuffer(void);
Example
[C++]
m_ctlXnsWindow.ClearMediaBuffer();
long tPos = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 15, 0, 0);
m_ctlXnsDevice.Seek(m_hDevice, 2, tPos);
See Also
XnsSdkDevice::Seek, DateToTimet
IsBufferFull
Description
Checks if the buffer is full of data.
Syntax
BOOL IsBufferFull(void);
Return Value
If the buffer is full, it will return TRUE.
Example
[C++]
BOOL IsBufferFull = m_ctlXnsWindow.IsBufferFull();
if (IsBufferFull == TRUE)
m_ctlXnsWindow.ClearBuffer();
See Also
IsBufferEmpty, SetBufferSize, GetBufferSize
IsBufferEmpty
Description
Checks if the buffer is empty.
Syntax
BOOL IsBufferEmpty(void);
Return Value
If the buffer is empty, it will return TRUE.
Example
[C++]
if(m_ctlXnsWindow.IsBufferEmpty())
return;
See Also
IsBufferFull, SetBufferSize, GetBufferSize
SetBufferSize
Description
Resizes the buffer to save the video data. The buffer is assigned 5MB by default until the
application calls this function. (where, nMinRemainingSize is 0) If the remaining number of
buffers (i.e., video data count) is less than nMinRemainingSize, then OnPreBufferEmpty event
occurs.
Syntax
void SetBufferSize(
long nBufferSize,
long nMinRemainingSize
);
Parameters
nBufferSize
nMinRemainingSize
[in] Minimum number of buffers to trigger the OnPreBufferEmpty event. If the video data count
is less than this value, the OnPreBufferEmpty event occurs.
Example
[C++]
m_ctlXnsWindow.SetBufferSize(10*1024*1025, 5);
See Also
GetBufferSize, GetRemainingBufferSize, OnPreBufferEmpty
GetBufferSize
Description
Returns the current buffer size. The buffer is assigned 5MB (5x1024x1024) by default.
Syntax
long GetBufferSize(void);
Return Value
Current buffer size (Unit: byte).
Example
[C++]
long nBufferSize = m_ctlXnsWindow.GetBufferSize();
See Also
SetBufferSize, GetRemainingBufferSize
GetRemainingBufferSize
Description
Returns the minimum number of buffers to trigger the PreBufferEmpty event. (indicates the
nMinRemainingSize parameter of SetBufferSize())
Syntax
long GetRemainingBufferSize(void);
Return Value
Minimum number of buffers (video data count) to trigger the PreBufferEmpty event.
Example
[C++]
long RemainBuffer = m_ctlXnsWindow.GetRemainingBufferSize();
DisplayLong("GetRemainingBufferSize",RemainBuffer);
See Also
SetBufferSize, GetBufferSize
GetCurrentFrameTime
Description
Gets the frame time that is currently displayed on the screen.
Syntax
long GetCurrentFrameTime(void);
Return Value
Returns the current frame time in time_t format.
Example
[C++]
long tTime = m_ctlXnsWindow.GetCurrentFrameTime();
See Also
OnFrameTimeChanged, GetFirstFrameTime
GetFirstFrameTime
Description
Gets the first frame time.
Syntax
long GetFirstFrameTime(void);
Return Value
Returns the first frame time in time_t format.
Example
[C++]
long tTime = m_ctlXnsWindow.GetFirstFrameTime();
See Also
GetCurrentFrameTime
Description
Returns the type of media that is being played in XnsSdkWindow.
To enable this function, the application should keep the hMediaData value from the event
handler of the OnNewMedia event.
Syntax
long GetInputType(long hMediaData);
Parameters
hMediaData
Return Value
Media type.
Example
[C++]
long nInputType = m_ctlXnsWindow.GetInputType(hMediaData);
See Also
OnNewMedia Event of XnsSdkDevice
Description
Gets the frame type that is currently being played.
To enable this function, the application should keep the hMediaData value from the event
handler of the OnNewMedia event.
Syntax
long GetFrameType(long hMediaData);
Parameters
hMediaData
Return Value
Frame type.
Example
[C++]
See Also
GetFrameTime, GetFrameSize
Description
Returns the time of stream that is being played.
To enable this function, the application should keep the hMediaData value from the event
handler of the OnNewMedia event.
Syntax
long GetFrameTime(long hMediaData);
Parameters
hMediaData
Return Value
Returns the frame time of the current stream in time_t format.
Example
[C++]
long tFrameTime = m_ctlXnsWindow.GetFrameTime(hMediaData);
See Also
GetCurrentFrameTime
Description
Gets the size of the frame that is currently being played.
To enable this function, the application should keep the hMediaData value from the event
handler of the OnNewMedia event.
Syntax
long GetFrameSize(long hMediaData);
Parameters
hMediaData
Return Value
Returns the data size of the frame in bytes.
Example
[C++]
long nFrameSize = m_ctlXnsWindow.GetFrameSize(hMediaData);
See Also
GetFrameTime
Description
Gets the time stamp of the media data (hMediaData).
To enable this function, the application should keep the hMediaData value from the event
handler of the OnNewMedia event.
The time stamp indicates the time elapsed since the device boot, and will be measured in
milliseconds. As a result, the application can use this value to calculate the time difference
between current and previous frames.
Syntax
long GetTimeStamp(long hMediaData);
Parameters
hMediaData
Return Value
Time stamp.
Example
[C++]
long tFrameTime = m_ctlXnsWindow.GetFrameTimeStamp(hMediaData);
See Also
GetFrameTime, GetCurrentFrameTime, GetFirstFrameTime
SetBrightness
Description
Sets the brightness of the image.
Syntax
void SetBrightness(long nValue);
Parameters
nValue
Example
[C++]
m_ctlXnsWindow.SetBrightness(20);
See Also
GetBrightness, SetContrast, GetContrast
GetBrightness
Description
Gets the specified value of brightness.
Syntax
long GetBrightness(void);
Return Value
Example
[C++]
long Brightness = m_ctlXnsWindow.GetBrightness();
DisplayLong("GetBrightness", Brightness);
See Also
SetBrightness, SetContrast, GetContrast
SetContrast
Description
Sets the contrast.
Syntax
void SetContrast(long nValue);
Parameters
nValue
Example
[C++]
m_ctlXnsWindow.SetContrast(20);
See Also
GetContrast, SetBrightness, GetBrightness
GetContrast
Description
Gets the specified value of contrast.
Syntax
long GetContrast(void);
Return Value
Current contrast value.
Example
[C++]
long Contrast = m_ctlXnsWindow.GetContrast();
DisplayLong("GetContrast", Contrast);
See Also
SetContrast, SetBrightness, GetBrightness
SetDeinterlaceMode
Description
Turns de-interlace mode on or off.
Syntax
void SetDeinterlaceMode(BOOL bMode);
Parameters
bMode
Example
[C++]
m_ctlXnsWindow.SetDeinterlaceMode(1);
SetDefogMode
Description
Enable or disable the defog mode. It supports one window control only, so it is blocked when
another window control is using the defog mode.
Syntax
void SetDefogMode(BOOL bOn);
Parameters
bMode
[in] Defog mode
• 1: enable defog.
• 0: disable defog.
Example
[C++]
m_ctlXnsWindow.SetDefogMode(1);
SetImageFlip
Description
Enable or disable the flip mode.
Syntax
long SetImageFlip(BOOL bHFlip, BOOL bVFlip);
Parameters
bHFlip
[in] Horizontal flip mode
bVFlip
[in] Vertical flip mode
Example
[C++]
m_ctlXnsWindow.SetImageFlip(1, 1);
GetVideoPixelFormat
Description
Gets information of current video pixel format.
Syntax
long GetVideoPixelFormat(void);
Return Value
Video Pixel format.
Example
[C++]
long pixel_format = m_ctlXnsWindow.GetVideoPixelFormat();
See Also
OnVideoRawDataReceived
SetAspectRatio
Description
Enable or disable to keep aspect ratio.
Syntax
Parameters
bMode
[in] Keep aspect ratio
Example
[C++]
m_ctlXnsWindow.SetAspectRatio(1);
Miscellaneous
DisplayNoData
Description
If there is no recording data, this will display a message of "No Data".
This function works properly only if the media type is in playback mode.
Syntax
void DisplayNoData(BOOL bState);
Parameters
bState
Example
[C++]
m_ctlXnsWindow.DisplayNoData(1);
SetCursor
Description
Sets the cursor type.
Syntax
void SetCursor(long nCursorID);
Parameters
nCursorID
• 0: Default type.
• 1: Zoom-in cursor.
• 2: Zoom-out cursor.
• 3: Hand cursor.
• 4: Grab cursor.
Example
[C++]
m_ctlXnsWindow.setCursor(3);
GetLastError
Description
Returns the recent error code.
Syntax
long GetLastError(void);
Return Value
Example
[C++]
long LastError = m_ctlXnsWindow.GetLastError();
DisplayLong("ImageWidth", LastError);
DateToTimet
Description
Converts the date (MM/DD/YY) and time (HH:MM:SS) to the time_t format.
Syntax
long DateToTimet(
long nYear,
long nMonth,
long nDay,
long nHour,
long nMinute,
long nSecond
);
Parameters
nYear
[in] Year
nMonth
[in] Month
nDay
[in] Day
nHour
[in] Hour
nMinute
[in] Minute
nSecond
[in] Second
Return Value
Converted values in time_t format.
Example
[C++]
long tStart = m_ctlXnsWindow.DateToTimet(2010, 8, 31, 0, 0, 10);
See Also
TimetToDate
TimetToDate
Description
Converts the time_t format to the date (MM/DD/YY) and time (HH:MM:SS).
Syntax
void TimetToDate(
long tTime,
long* pnYear,
long* pnMonth,
long* pnDay,
long* pnHour,
long* pnMinute,
long* pnSecond
);
Parameters
tTime
pnYear
[out] Year
pnMonth
[out] Month
pnDay
[out] Day
pnHour
[out] Hour
pnMinute
[out] Minute
pnSecond
[out] Second
Example
[C++]
long tTime = m_ctlXnsWindow.GetCurrentFrameTime();
See Also
DateToTimet
Events
In this section, we provide details about events that occur in XnsSdkWindow or those that
occur if an XnsSdkDevice function is called. Below is a list of event handlers that will be called
if the corresponding event occurs.
OnFrameTimeChanged
Description
This event occurs if the frame time displayed on the screen is changed. This happens every
second that a video is played.
Syntax
void OnFrameTimeChanged (long tFrameTime);
Parameters
tFrameTime
Example
[C++]
void CTestSampleDlg::OnOnFrameTimeChangedXnssdkwindowctrl1(long tFrameTime)
{
CString str;
long Year, Mon, Day, Hour, Min, Sec;
m_ctlXnsWindow.TimetToDate(tFrameTime, &Year, &Mon, &Day, &Hour, &Min, &Sec);
str.Format("On FrameTime Changed XnsWindow1 [%04d-%02d-
02d %02d:%02d:%02d]\n", Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);
}
See Also
GetCurrentFrameTime
OnImageResolutionChanged
Description
This event occurs if the resolution of the original image is changed.
Syntax
void OnImageResolutionChanged (
long nWidth,
long nHeight
);
Parameters
nWidth
nHeight
Example
[C++]
void CTestSampleDlg::OnOnImageResolutionChangedXnssdkwindowctrl1(long nWidth, long
nHeight)
{
CString str;
str.Format("On ImageResolutionChanged XnsWindow1 nWidth[%d]
nHeight[%d]\n",nWidth, nHeight);
OutputDebugString(str);
}
See Also
GetImageWidth, GetImageHeight
OnMediaOn
Description
This occurs if the XnsSdkWindow component receives media stream.
Syntax
void OnMediaOn(void);
Example
[C++]
void CTestSampleDlg::OnOnMediaOnXnssdkwindowctrl1()
{
OutputDebugString("On Media On Event XnsWindow1\n");
}
See Also
XnsSdkDevice::OpenMedia
OnMediaOff
Description
This occurs if receiving media stream is stopped or completed.
Syntax
void OnMediaOff(void);
Example
[C++]
void CTestSampleDlg::OnOnMediaOffXnssdkwindowctrl1()
{
OutputDebugString("On Media Off Event XnsWindow1\n");
}
See Also
OnMediaOn
OnVideoRawDataReceived
Description
This event is occurred when the decoded video data is made. To receive this event, you should
call SetVideoRawDataReceived() function in advance. To cancel receiving event, use
UnsetVidoRawDataReceived.
Syntax
void OnVideoRawDataReceived
(
long nDeviceID,
long nControlID,
long nWidth,
long nHeight,
long nVideoSize,
long pVideoData
);
Parameters
nDeviceID
[in] Devide ID
nControlID
[in] Control ID.
nWidth
[in] Width size of the decoded video data.
nHeight
[in] Height size of the decoded video data.
nVideoSize
[in] Data size of the decoded video data..
pVideoData
[in] Buff address of the decoded video data.
Example
[C++]
// Call OnPaint
Invalidate(FALSE);
}
See Also
OnLButtonDown
Description
This event occurs if a left button on the mouse is pressed in XnSdkWindow. This event is valid
only if both the XnsSdkWindow handle and the parent window handle are reset to Null.
Syntax
void OnLButtonDown(
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnLButtonDownXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On LButtonDown XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnLButtonUp, OnRButtonDown, OnRButtonUp
OnLButtonUp
Description
This event occurs if the left mouse button is pressed and released in XnSdkWindow. This event
is valid only if both the XnsSdkWindow handle and the parent window handle are reset to Null.
Syntax
void OnLButtonUp(
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnLButtonUpXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On LButtonUp XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnLButtonDown, OnRButtonDown, OnRButtonUp
OnRButtonDown
Description
This event occurs if a right button on the mouse is pressed in XnSdkWindow. This event is valid
only if both XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnRButtonDown(
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnRButtonDownXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On RButtonDown XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnLButtonDown, OnLButtonUp, OnRButtonUp
OnRButtonUp
Description
This event occurs if the right mouse buton is pressed and released in XnSdkWindow. This event
is valid only if both XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnRButtonUp (
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnRButtonUpXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On RButtonUp XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnLButtonDown, OnLButtonUp, OnRButtonDown
OnLButtonDblClk
Description
This event occurs if the left mouse button is pressed and released twice in XnSdkWindow. This
event is valid only if both XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnLButtonDblClk (
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnLButtonDblClkXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On LButtonDblClk XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnRButtonDblClk
OnRButtonDblClk
Description
This event occurs if the right mouse button is pressed and released twice in XnSdkWindow.
This event is valid only if both XnsSdkWindow handle and parent window handle are reset to
Null.
Syntax
void OnRButtonDblClk (
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnRButtonDblClkXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On RButtonDblClk XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnLButtonDblClk
OnMouseMove
Description
This event occurs if the mouse pointer is moving. This event is valid only if both
XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnMouseMove (
long nFlags,
long nX,
long nY
);
Parameters
nFlags
nX
nY
Example
[C++]
void CTestSampleDlg::OnOnMouseMoveXnssdkwindowctrl1(long nFlags, long nX, long nY)
{
char str[100];
sprintf(str, "On MouseMove XnsWindow1 nFlags[%d] nX[%d] nY[%d]\n", nFlags, nX, nY);
OutputDebugString(str);
}
See Also
OnMouseHover, OnMouseLeave
OnMouseHover
Description
This event occurs if the mouse pointer enters XnsSdkWindow. This event is valid only if both
XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnMouseHover (void);
Example
[C++]
void CTestSampleDlg::OnOnMouseHoverXnssdkwindowctrl1()
{
OutputDebugString("On MouseHover XnsWindow1\n");
}
See Also
OnMouseMove, OnMouseLeave
OnMouseLeave
Description
This event occurs if the mouse pointer moves out of XnsSdkWindow. This event is valid only if
both XnsSdkWindow handle and parent window handle are reset to Null.
Syntax
void OnMouseLeave (void);
Example
[C++]
void CTestSampleDlg::OnOnMouseLeaveXnssdkwindowctrl1()
{
OutputDebugString("On MouseLeave XnsWindow1\n");
}
See Also
OnMouseMove, OnMouseHover
OnBufferFull
Description
This event occurs if the buffer of XnsSdkWindow component is full. The application can use
ClearMediaBuffer() o empty the buffer or use SetBufferSize() to resize it.
Syntax
void OnBufferFull (void);
Example
[C++]
void CTestSampleDlg::OnOnBufferFullXnssdkwindowctrl1()
{
m_ctlXnsWindow.ClearMediaBuffer();
}
See Also
OnPreBufferFull, ClearMediaBuffer, SetBufferSize
OnBufferEmpty
Description
This event occurs if the buffer of the XnsSdkWindow component is empty.
Syntax
void OnBufferEmpty (void);
Example
[C++]
void CTestSampleDlg::OnOnBufferEmptyXnssdkwindowctrl1()
{
OutputDebugString("On BufferEmpty XnsWindow1\n");
}
See Also
OnPreBufferEmpty
OnPreBufferFull
Description
This event occurs at the point when the remaining space of the XnsSdkWindow buffer gets less
than the minimum required space. The application can use SetBufferSize() to adjust the
minimum required space for the buffer. (adjust the nMinRemainingSize parameter of
SetBufferSize()) The minimum space defaulted by nMinRemainingSize is 0.
Syntax
void OnPreBufferFull (void);
Example
[C++]
void CTestSampleDlg::OnOnPreBufferFullXnssdkwindowctrl1()
{
OutputDebugString("On PreBufferFull XnsWindow1\n");
}
See Also
SetBufferSize, OnBufferFull, OnPreBufferEmpty
OnPreBufferEmpty
Description
This event occurs if the remaining data size in the XnsSdkWindow buffer is less than specified.
Namely, this occurs if the remaining data size is less than required by the nMinRemainingSize
parameter of SetBufferSize().The minimum space defaulted by nMinRemainingSize is 0.
Syntax
void OnPreBufferEmpty (void);
Example
[C++]
void CTestSampleDlg::OnOnPreBufferEmptyXnssdkwindowctrl1()
{
OutputDebugString("On PreBufferEmpty XnsWindow1\n");
}
See Also
OnBufferEmpty, OnPreBufferFull, SetBufferSize
OnEventStatusChanged
Description
This event occurs if the event status has changed. Event types include: video loss, alarm, and
motion detection.
Syntax
void OnEventStatusChanged (
long nOldEventStatus,
long nNewEventStatus
);
Parameters
nOldEventStatus
nNewEventStatus
The event status can be combined in bit-wise method, which has the following values.
Event Value
XEVENT_ALL 0x000000ff
XEVENT_SENSOR 0x00000001
XEVENT_MOTION 0x00000002
XEVENT_VIDEOLOSS 0x00000004
Example
[C++]
OnKeyDown
Description
This event occurs if the non-system key is pressed.
Syntax
void OnKeyDown (
long nChar,
long nRepCnt,
long nFlags
);
Parameters
nChar
nRepCnt
[in] Repetition count (Count of keystrokes by the user pressing the key repeatedly).
nFlags
Table 3-3 Description About nFlags Items for the OnKeyDown Event
Bit Description
9~10 Obsolete.
Example
[C++]
void CTestSampleDlg::OnOnKeyDownXnssdkwindowctrl1(long nChar, long nRepCnt, long nFlags)
{
CString str;
str.Format("On KeyDown XnsWindow1 nChar[%d] nRepCnt[%d] nFlags[%d]\n", nChar,
nRepCnt, nFlags);
OutputDebugString(str);
}
See Also
OnKeyUp
OnKeyUp
Description
This event occurs if the non-system key is pressed and released.
Syntax
void OnKeyUp (
long nChar,
long nRepCnt,
long nFlags
);
Parameters
nChar
nRepCnt
[in] Repetition count. (Count of keystrokes by the user pressing the key repeatedly).
nFlags
Table 3-4 Description about nFlags Items for the OnKeyUp Event
Bit Description
9~10 Obsolete.
Example
[C++]
void CTestSampleDlg::OnOnKeyUpXnssdkwindowctrl1(long nChar, long nRepCnt, long nFlags)
{
CString str;
str.Format("On KeyDown XnsWindow1 nChar[%d] nRepCnt[%d] nFlags[%d]\n", nChar,
nRepCnt, nFlags);
OutputDebugString(str);
}
See Also
OnKeyDown
In case of C++
Procedure
Step 1. Right-click on the project from the [Solution Explorer], and then select Properties
Step 2. Select Configuration Propertes > Linker > Advanced in Property window.
Step 3. When Data Execution Prevention(DEP) is ‘YES’, change it from YES to NO.
In case of C#
Procedure
Step 1. Right-click on the project from the [Solution Explorer], and then select Properties.
APPENDIX A
Trouble shooting DEP problem
Step 2. Select [Build Events] tab, and then enter event command like following:
call "$(DevEnvDir)..\tools\vsvars32.bat"
editbin.exe /NXCOMPAT:NO "$(TargetPath)"
Procedure
Step 1. Right-click on the project from the [Solution Explorer], and then select Properties.
Step 2. Select [Compile] > [Build Events], and then enter command like follows:
call "$(DevEnvDir)..\tools\vsvars32.bat"
editbin.exe /NXCOMPAT:NO "$(TargetPath)"
In this chapter, the description of error codes returned by XNS ActiveX library is
provided.
Initialize
Device Connection
Device Disconnection
Login Error
Query Request
File Transfer
Media Open
PTZ Control
XnsWindow Error
File Error
OTHERS
N
Non-system Key
Character keys, which do not use any combination of special keys like Alt, Ctrl, etc.
Abbreviations
D
DLL
Dynamic Linking Library
DVR
Digital Video Recorder
M
MFC
Microsoft Foundation Class
O
OCX
Object Linking and Embedding (OLE) Custom Control
P
PTZ
Pan/Tilt/Zoom
S
SDK
A D
AcquireMediaAuthority ..........................................64 DateToTimet ...................................................136, 211
Application...................................................................18 DeleteConfigValue ................................................. 134
AreaZoom ................................................................. 107 DeleteDeviceProfile ............................................... 131
AutoScan ................................................................... 141 DeletePreset ............................................................. 100
DeletePresetAll ........................................................ 101
Disconnect .................................................................. 47
DisplayNoData ........................................................ 210
T
TimetToDate ...................................................137, 213
S ToggleDvrRecording ............................................. 118
SaveDeviceProfile................................................... 131
SaveSnapshot .......................................................... 193
SearchCalendar ..........................................................82
SearchDay ....................................................................83 U
Seek ................................................................................80
UploadSoftware ...................................................... 126
SendAudioData..........................................................87
UTCToDeviceLocalTime ....................................... 140
SetAlarm .......................................................................88
SetBrightness ........................................................... 206
SetBufferSize ............................................................ 199
SetConnectionInfo....................................................32
SetContrast ............................................................... 207
W
SetCursor ................................................................... 210 WriteConfigValue ................................................... 133
SetDateTimeFormat .............................................. 190
SetDefogMode ....................................................... 209
SetDeinterlaceMode ............................................. 209
SetEventDiscardTime ............................................ 143 X
SetListen........................................................................85
XNS ActiveX ............................................................... 17
SetOSDOnOff .......................................................... 189
XnsSdkDevice: ........................................................... 21
SetPlaySpeed ........................................................... 196
SetPreset .......................................................................99
SetPtzPos ................................................................... 105
SetSound ................................................................... 191
SetTalk ............................................................................84 Z
SetVolume ................................................................. 192 Zoom1X ...................................................................... 109
Start ............................................................................. 177 ZoomLevel................................................................. 182
StartBackup .............................................................. 119 ZoomRate .................................................................. 183
StartLocalRecording .............................................. 116
Stop .............................................................................. 178
OPEN SOURCE LICENSE REPORT ON THE PRODUCT
The software contains copyrighted software that is licensed under the GPL2.0, LGPL 2.1, MITLicense, zlib/libpng License,
OpenSSL Combined License, Apache 2.0 License, bzip2 License, Common Public License.
You may obtain the Corresponding Source code from us for a period of three years after our last shipment of this
product by sending email to help.cctv@hanwha.com. If you want to obtain the complete Corresponding Source code in
the physical medium such as CD-ROM, the cost of physically performing source distribution might be charged.
••GPL 2.0 : gzip (http://sourceforge.net/projects/gnuwin32)
••LGPL 2.1 : Live555 (http://www.live555.com/liveMedia), FFmpeg (http://ffmpeg.org)
••MITLicense : Rapidxml - 1.13
••zlib/libpng Lisence: Nullsoft Scriptable Install System 2.46, tinyxml 2.6.2
••OpenSSL Combined License: OpenSSL
••Apache 2.0 License : Condor
••bzip2 License : Nullsoft Scriptable Install System 2.46
••Common Public License version 1.0 : Nullsoft Scriptable Install System 2.46 (http://sourceforge.net/projects/nsis)
Acknowledgement
This software includes modified version of Live555.
GNU GENERAL PUBLIC LICENSE get it if you want it, that you can change the software or
use pieces of it in new free programs; and that you know
Version 2, June 1991
you can do these things.
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
To protect your rights, we need to make restrictions that
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
forbid anyone to deny you these rights or to ask you to
USA
surrender the rights. These restrictions translate to certain
Everyone is permitted to copy and distribute verbatim
responsibilities for you if you distribute copies of the
copies of this license document, but changing it is not
software, or if you modify it.
allowed.
For example, if you distribute copies of such a program,
Preamble
whether gratis or for a fee, you must give the recipients
The licenses for most software are designed to take away
all the rights that you have. You must make sure that
your freedom to share and change it. By contrast, the
they, too, receive or can get the source code. And you
GNU General Public License is intended to guarantee
must show them these terms so they know their rights.
your freedom to share and change free software--to
We protect your rights with two steps: (1) copyright the
make sure the software is free for all its users. This
software, and (2) offer you this license which gives you
General Public License applies to most of the Free
legal permission to copy, distribute and/or modify the
Software Foundation's software and to any other program
software.
whose authors commit to using it. (Some other Free
Also, for each author's protection and ours, we want to
Software Foundation software is covered by the GNU
make certain that everyone understands that there is no
Lesser General Public License instead.) You can apply it to
warranty for this free software. If the software is modified
your programs, too.
by someone else and passed on, we want its recipients to
When we speak of free software, we are referring to
know that what they have is not the original, so that any
freedom, not price. Our General Public Licenses are
problems introduced by others will not reflect on the
designed to make sure that you have the freedom to
original authors' reputations.
distribute copies of free software (and charge for this
Finally, any free program is threatened constantly by
service if you wish), that you receive source code or can
software patents. We wish to avoid the danger that
redistributors of a free program will individually obtain and the date of any change.
patent licenses, in effect making the program proprietary. b) You must cause any work that you distribute or
To prevent this, we have made it clear that any patent publish, that in whole or in part contains or is derived
must be licensed for everyone's free use or not licensed from the Program or any part thereof, to be licensed as
at all. a whole at no charge to all third parties under the
The precise terms and conditions for copying, distribution terms of this License.
and modification follow. c) If the modified program normally reads commands
TERMS AND CONDITIONS FOR COPYING, interactively when run, you must cause it, when started
DISTRIBUTION AND MODIFICATION running for such interactive use in the most ordinary
0. This License applies to any program or other work way, to print or display an announcement including an
which contains a notice placed by the copyright holder appropriate copyright notice and a notice that there is
saying it may be distributed under the terms of this no warranty (or else, saying that you provide a
General Public License. The "Program", below, refers to warranty) and that users may redistribute the program
any such program or work, and a "work based on the under these conditions, and telling the user how to
Program" means either the Program or any derivative view a copy of this License. (Exception: if the Program
work under copyright law: that is to say, a work itself is interactive but does not normally print such an
containing the Program or a portion of it, either verbatim announcement, your work based on the Program is not
language. (Hereinafter, translation is included without These requirements apply to the modified work as a
limitation in the term "modification".) Each licensee is whole. If identifiable sections of that work are not derived
Activities other than copying, distribution and independent and separate works in themselves, then this
modification are not covered by this License; they are License, and its terms, do not apply to those sections
outside its scope. The act of running the Program is not when you distribute them as separate works. But when
restricted, and the output from the Program is covered you distribute the same sections as part of a whole which
only if its contents constitute a work based on the is a work based on the Program, the distribution of the
Program (independent of having been made by running whole must be on the terms of this License, whose
the Program). Whether that is true depends on what the permissions for other licensees extend to the entire
Program does. whole, and thus to each and every part regardless of who
1. You may copy and distribute verbatim copies of the wrote it.
Program's source code as you receive it, in any medium, Thus, it is not the intent of this section to claim rights or
provided that you conspicuously and appropriately contest your rights to work written entirely by you; rather,
publish on each copy an appropriate copyright notice the intent is to exercise the right to control the
and disclaimer of warranty; keep intact all the notices distribution of derivative or collective works based on the
warranty; and give any other recipients of the Program a In addition, mere aggregation of another work not based
copy of this License along with the Program. on the Program with the Program (or with a work based
You may charge a fee for the physical act of transferring on the Program) on a volume of a storage or distribution
a copy, and you may at your option offer warranty medium does not bring the other work under the scope
2. You may modify your copy or copies of the Program or 3. You may copy and distribute the Program (or a work
any portion of it, thus forming a work based on the based on it, under Section 2) in object code or
Program, and copy and distribute such modifications or executable form under the terms of Sections 1 and 2
work under the terms of Section 1 above, provided that above provided that you also do one of the following:
you also meet all of these conditions: a) Accompany it with the complete corresponding
a) You must cause the modified files to carry machine-readable source code, which must be
prominent notices stating that you changed the files distributed under the terms of Sections 1 and 2 above
on a medium customarily used for software Program), you indicate your acceptance of this License to
interchange; or, do so, and all its terms and conditions for copying,
b) Accompany it with a written offer, valid for at least distributing or modifying the Program or works based on
three years, to give any third party, for a charge no it.
more than your cost of physically performing source 6. Each time you redistribute the Program (or any work
distribution, a complete machine-readable copy of the based on the Program), the recipient automatically
corresponding source code, to be distributed under receives a license from the original licensor to copy,
the terms of Sections 1 and 2 above on a medium distribute or modify the Program subject to these terms
customarily used for software interchange; or, and conditions. You may not impose any further
c) Accompany it with the information you received as restrictions on the recipients' exercise of the rights
to the offer to distribute corresponding source code. granted herein. You are not responsible for enforcing
(This alternative is allowed only for noncommercial compliance by third parties to this License.
distribution and only if you received the program in 7. If, as a consequence of a court judgment or allegation
object code or executable form with such an offer, in of patent infringement or for any other reason (not
accord with Subsection b above.) limited to patent issues), conditions are imposed on you
The source code for a work means the preferred form of (whether by court order, agreement or otherwise) that
the work for making modifications to it. For an contradict the conditions of this License, they do not
executable work, complete source code means all the excuse you from the conditions of this License. If you
source code for all modules it contains, plus any cannot distribute so as to satisfy simultaneously your
associated interface definition files, plus the scripts used obligations under this License and any other pertinent
to control compilation and installation of the executable. obligations, then as a consequence you may not
However, as a special exception, the source code distribute the Program at all. For example, if a patent
distributed need not include anything that is normally license would not permit royalty-free redistribution of the
distributed (in either source or binary form) with the Program by all those who receive copies directly or
major components (compiler, kernel, and so on) of the indirectly through you, then the only way you could
operating system on which the executable runs, unless satisfy both it and this License would be to refrain
that component itself accompanies the executable. entirely from distribution of the Program.
If distribution of executable or object code is made by If any portion of this section is held invalid or
offering access to copy from a designated place, then unenforceable under any particular circumstance, the
offering equivalent access to copy the source code from balance of the section is intended to apply and the
the same place counts as distribution of the source code, section as a whole is intended to apply in other
even though third parties are not compelled to copy the circumstances.
source along with the object code. It is not the purpose of this section to induce you to
4. You may not copy, modify, sublicense, or distribute the infringe any patents or other property right claims or to
Program except as expressly provided under this License. contest validity of any such claims; this section has the
Any attempt otherwise to copy, modify, sublicense or sole purpose of protecting the integrity of the free
distribute the Program is void, and will automatically software distribution system, which is implemented by
terminate your rights under this License. However, parties public license practices. Many people have made
who have received copies, or rights, from you under this generous contributions to the wide range of software
License will not have their licenses terminated so long as distributed through that system in reliance on consistent
such parties remain in full compliance. application of that system; it is up to the author/donor to
5. You are not required to accept this License, since you decide if he or she is willing to distribute software
have not signed it. However, nothing else grants you through any other system and a licensee cannot impose
permission to modify or distribute the Program or its that choice.
derivative works. These actions are prohibited by law if This section is intended to make thoroughly clear what is
you do not accept this License. Therefore, by modifying believed to be a consequence of the rest of this License.
or distributing the Program (or any work based on the 8. If the distribution and/or use of the Program is
restricted in certain countries either by patents or by HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
copyrighted interfaces, the original copyright holder who AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED
places the Program under this License may add an ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING
explicit geographical distribution limitation excluding ANY GENERAL, SPECIAL, INCIDENTAL OR
those countries, so that distribution is permitted only in CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE
or among countries not thus excluded. In such case, this OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
License incorporates the limitation as if written in the NOT LIMITED TO LOSS OF DATA OR DATA BEING
body of this License. RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU
9. The Free Software Foundation may publish revised OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO
and/or new versions of the General Public License from OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
time to time. Such new versions will be similar in spirit to HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
the present version, but may differ in detail to address POSSIBILITY OF SUCH DAMAGES.
new problems or concerns. END OF TERMS AND CONDITIONS
Each version is given a distinguishing version number. If How to Apply These Terms to Your New
the Program specifies a version number of this License Programs
which applies to it and "any later version", you have the If you develop a new program, and you want it to be of
option of following the terms and conditions either of the greatest possible use to the public, the best way to
that version or of any later version published by the Free achieve this is to make it free software which everyone
Software Foundation. If the Program does not specify a can redistribute and change under these terms.
version number of this License, you may choose any To do so, attach the following notices to the program. It
version ever published by the Free Software Foundation. is safest to attach them to the start of each source file to
10. If you wish to incorporate parts of the Program into most effectively convey the exclusion of warranty; and
other free programs whose distribution conditions are each file should have at least the "copyright" line and a
different, write to the author to ask for permission. For pointer to where the full notice is found.
software which is copyrighted by the Free Software one line to give the program's name and an idea of what
Foundation, write to the Free Software Foundation; we it does.
sometimes make exceptions for this. Our decision will be Copyright (C) yyyy name of author
guided by the two goals of preserving the free status of This program is free software; you can redistribute it
all derivatives of our free software and of promoting the and/or modify it under the terms of the GNU General
sharing and reuse of software generally. Public License as published by the Free Software
NO WARRANTY Foundation; either version 2 of the License, or (at your
11. BECAUSE THE PROGRAM IS LICENSED FREE OF option) any later version.
CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, This program is distributed in the hope that it will be
TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT useful, but WITHOUT ANY WARRANTY; without even the
WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT implied warranty of MERCHANTABILITY or FITNESS FOR A
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PARTICULAR PURPOSE. See the GNU General Public
PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, License for more details.
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT You should have received a copy of the GNU General
LIMITED TO, THE IMPLIED WARRANTIES OF Public License along with this program; if not, write to
MERCHANTABILITY AND FITNESS FOR A PARTICULAR the Free Software Foundation, Inc., 51 Franklin Street,
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND Fifth Floor, Boston, MA 02110-1301, USA.
PERFORMANCE OF THE PROGRAM IS WITH YOU. Also add information on how to contact you by
SHOULD THE PROGRAM PROVE DEFECTIVE, YOU electronic and paper mail.
ASSUME THE COST OF ALL NECESSARY SERVICING, If the program is interactive, make it output a short
REPAIR OR CORRECTION. notice like this when it starts in an interactive mode:
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE Gnomovision version 69, Copyright (C) year name of
LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT author
Gnomovision comes with ABSOLUTELY NO WARRANTY; your freedom to share and change it. By contrast, the
for details type `show w'. This is free software, and you GNU General Public Licenses are intended to guarantee
are welcome to redistribute it under certain conditions; your freedom to share and change free software--to
type `show c' for details. make sure the software is free for all its users.
The hypothetical commands `show w' and `show c' This license, the Lesser General Public License, applies to
should show the appropriate parts of the General Public some specially designated software packages--typically
License. Of course, the commands you use may be called libraries--of the Free Software Foundation and other
something other than `show w' and `show c'; they could authors who decide to use it. You can use it too, but we
even be mouse-clicks or menu items--whatever suits your suggest you first think carefully about whether this
program. license or the ordinary General Public License is the
You should also get your employer (if you work as a better strategy to use in any particular case, based on the
programmer) or your school, if any, to sign a "copyright explanations below.
disclaimer" for the program, if necessary. Here is a When we speak of free software, we are referring to
sample; alter the names: freedom of use, not price. Our General Public Licenses
Yoyodyne, Inc., hereby disclaims all copyright are designed to make sure that you have the freedom to
interest in the program `Gnomovision' distribute copies of free software (and charge for this
(which makes passes at compilers) written service if you wish); that you receive source code or can
by James Hacker. get it if you want it; that you can change the software
signature of Ty Coon, 1 April 1989 and use pieces of it in new free programs; and that you
Ty Coon, President of Vice are informed that you can do these things.
This General Public License does not permit incorporating To protect your rights, we need to make restrictions that
your program into proprietary programs. If your program forbid distributors to deny you these rights or to ask you
is a subroutine library, you may consider it more useful to to surrender these rights. These restrictions translate to
permit linking proprietary applications with the library. If certain responsibilities for you if you distribute copies of
this is what you want to do, use the GNU Lesser General the library or if you modify it.
Public License instead of this License. For example, if you distribute copies of the library,
whether gratis or for a fee, you must give the recipients
all the rights that we gave you. You must make sure that
GNU LESSER GENERAL PUBLIC LICENSE
they, too, receive or can get the source code. If you link
2.1 other code with the library, you must provide complete
We used the FFmpeg in our application and we did not object files to the recipients, so that they can relink them
modify the source code. We modified the Live555 in the with the library after making changes to the library and
source code and used it in our application. recompiling it. And you must show them these terms so
Copyright(C) they know their rights.
•• Live555 (1991, 1999 Free Software Foundation, Inc.) We protect your rights with a two-step method: (1) we
•• FFmpeg(1991, 1999 Free Software Foundation, Inc.) copyright the library, and (2) we offer you this license,
Version 2.1, February 1999 which gives you legal permission to copy, distribute
Copyright (C) 1991, 1999 Free Software Foundation, Inc. and/or modify the library.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 To protect each distributor, we want to make it very clear
USA Everyone is permitted to copy and distribute that there is no warranty for the free library. Also, if the
verbatim copies of this license document, but changing it library is modified by someone else and passed on, the
is not allowed. recipients should know that what they have is not the
[This is the first released version of the Lesser GPL. It also original version, so that the original author’s reputation
counts as the successor of the GNU Library Public License, will not be affected by problems that might be
version 2, hence the version number 2.1.] introduced by others.
Preamble Finally, software patents pose a constant threat to the
The licenses for most software are designed to take away existence of any free program. We wish to make sure that
a company cannot effectively restrict the users of a free freedom and the wherewithal to run that program using
program by obtaining a restrictive license from a patent a modified version of the Library.
holder. Therefore, we insist that any patent license The precise terms and conditions for copying, distribution
obtained for a version of the library must be consistent and modification follow. Pay close attention to the
with the full freedom of use specified in this license. difference between a “work based on the library” and a
Most GNU software, including some libraries, is covered “work that uses the library”. The former contains code
by the ordinary GNU General Public License. This license, derived from the library, whereas the latter must be
the GNU Lesser General Public License, applies to certain combined with the library in order to run.
designated libraries, and is quite different from the TERMS AND CONDITIONS FOR COPYING,
ordinary General Public License. We use this license for DISTRIBUTION AND MODIFICATION
certain libraries in order to permit linking those libraries 0. This License Agreement applies to any software library
into non-free programs. or other program which contains a notice placed by the
When a program is linked with a library, whether copyright holder or other authorized party saying it may
statically or using a shared library, the combination of the be distributed under the terms of this Lesser General
two is legally speaking a combined work, a derivative of Public License (also called “this License”). Each licensee is
the original library. The ordinary General Public License addressed as “you”.
therefore permits such linking only if the entire A “library” means a collection of software functions
combination fits its criteria of freedom. The Lesser and/or data prepared so as to be conveniently linked
General Public License permits more lax criteria for with application programs(which use some of those
linking other code with the library. functions and data) to form executables.
We call this license the “Lesser” General Public License The “Library”, below, refers to any such software library or
because it does Less to protect the user’s freedom than work which has been distributed under these terms. A
the ordinary General Public License. It also provides other “work based on the Library” means either the Library or
free software developers Less of an advantage over any derivative work under copyright law: that is to say, a
competing non-free programs. These disadvantages are work containing the Library or a portion of it, either
the reason we use the ordinary General Public License for verbatim or with modifications and/or translated
many libraries. However, the Lesser license provides straightforwardly into another language. (Hereinafter,
advantages in certain special circumstances. translation is included without limitation in the term
For example, on rare occasions, there may be a special “modification”.)
need to encourage the widest possible use of a certain “Source code” for a work means the preferred form of
library, so that it becomes a de-facto standard. To achieve the work for making modifications to it. For a library,
this, non-free programs must be allowed to use the complete source code means all the source code for all
library. A more frequent case is that a free library does modules it contains, plus any associated interface
the same job as widely used non-free libraries. In this definition files, plus the scripts used to control
case, there is little to gain by limiting the free library to compilation and installation of the library.
free software only, so we use the Lesser General Public Activities other than copying, distribution and
License. modification are not covered by this License; they are
In other cases, permission to use a particular library in outside its scope. The act of running a program using the
non-free programs enables a greater number of people Library is not restricted, and output from such a program
to use a large body of free software. For example, is covered only if its contents constitute a work based on
permission to use the GNU C Library in non-free the Library (independent of the use of the Library in a
programs enables many more people to use the whole tool for writing it). Whether that is true depends on what
GNU operating system, as well as its variant, the the Library does and what the program that uses the
GNU/Linux operating system. Library does.
Although the Lesser General Public License is Less 1. You may copy and distribute verbatim copies of the
protective of the users’ freedom, it does ensure that the Library’s complete source code as you receive it, in any
user of a program that is linked with the Library has the medium, provided that you conspicuously and
appropriately publish on each copy an appropriate Thus, it is not the intent of this section to claim rights or
copyright notice and disclaimer of warranty; keep intact contest your rights to work written entirely by you; rather,
all the notices that refer to this License and to the the intent is to exercise the right to control the
absence of any warranty; and distribute a copy of this distribution of derivative or collective works based on the
License along with the Library. Library.
You may charge a fee for the physical act of transferring In addition, mere aggregation of another work not based
a copy, and you may at your option offer warranty on the Library with the Library (or with a work based on
protection in exchange for a fee. the Library) on a volume of a storage or distribution
2. You may modify your copy or copies of the Library or medium does not bring the other work under the scope
any portion of it, thus forming a work based on the of this License.
Library, and copy and distribute such modifications or 3. You may opt to apply the terms of the ordinary GNU
work under the terms of Section 1 above, provided that General Public License instead of this License to a given
you also meet all of these conditions: copy of the Library. To do this, you must alter all the
a) The modified work must itself be a software library. notices that refer to this License, so that they refer to the
b) You must cause the files modified to carry ordinary GNU General Public License, version 2, instead
prominent notices stating that you changed the files of to this License. (If a newer version than version 2 of
and the date of any change. the ordinary GNU General Public License has appeared,
c) You must cause the whole of the work to be then you can specify that version instead if you wish.) Do
licensed at no charge to all third parties under the not make any other change in these notices.
terms of this License. Once this change is made in a given copy, it is
d) If a facility in the modified Library refers to a irreversible for that copy, so the ordinary GNU General
function or a table of data to be supplied by an Public License applies to all subsequent copies and
application program that uses the facility, other than as derivative works made from that copy.
an argument passed when the facility is invoked, then This option is useful when you wish to copy part of the
you must make a good faith effort to ensure that, in code of the Library into a program that is not a library.
the event an application does not supply such function 4. You may copy and distribute the Library (or a portion
or table, the facility still operates, and performs or derivative of it, under Section 2) in object code or
whatever part of its purpose remains meaningful. executable form under the terms of Sections 1 and 2
(For example, a function in a library to compute square above provided that you accompany it with the complete
roots has a purpose that is entirely well-defined corresponding machine-readable source code, which
independent of the application. Therefore, Subsection must be distributed under the terms of Sections 1 and 2
2d requires that any application-supplied function or above on a medium customarily used for software
table used by this function must be optional: if the interchange.
application does not supply it, the square root function If distribution of object code is made by offering access
must still compute square roots.) to copy from a designated place, then offering equivalent
These requirements apply to the modified work as a access to copy the source code from the same place
whole. If identifiable sections of that work are not derived satisfies the requirement to distribute the source code,
from the Library, and can be reasonably considered even though third parties are not compelled to copy the
independent and separate works in themselves, then this source along with the object code.
License, and its terms, do not apply to those sections 5. A program that contains no derivative of any portion
when you distribute them as separate works. But when of the Library, but is designed to work with the Library by
you distribute the same sections as part of a whole which being compiled or linked with it, is called a "work that
is a work based on the Library, the distribution of the uses the Library". Such a work, in isolation, is not a
whole must be on the terms of this License, whose derivative work of the Library, and therefore falls outside
permissions for other licensees extend to the entire the scope of this License.
whole, and thus to each and every part regardless of who However, linking a "work that uses the Library" with the
wrote it. Library creates an executable that is a derivative of the
Library (because it contains portions of the Library), modified Library. (It is understood that the user who
rather than a "work that uses the library". The executable changes the contents of definitions files in the Library
is therefore covered by this License. Section 6 states will not necessarily be able to recompile the
terms for distribution of such executables. application to use the modified definitions.)
When a "work that uses the Library" uses material from a b) Use a suitable shared library mechanism for linking
header file that is part of the Library, the object code for with the Library. A suitable mechanism is one that (1)
the work may be a derivative work of the Library even uses at run time a copy of the library already present
though the source code is not. Whether this is true is on the user's computer system, rather than copying
especially significant if the work can be linked without library functions into the executable, and (2) will
the Library, or if the work is itself a library. The threshold operate properly with a modified version of the library,
for this to be true is not precisely defined by law. if the user installs one, as long as the modified version
If such an object file uses only numerical parameters, is interface-compatible with the version that the work
data structure layouts and accessors, and small macros was made with.
and small inline functions (ten lines or less in length), c) Accompany the work with a written offer, valid for at
then the use of the object file is unrestricted, regardless least three years, to give the same user the materials
of whether it is legally a derivative work. (Executables specified in Subsection 6a, above, for a charge no
containing this object code plus portions of the Library more than the cost of performing this distribution.
will still fall under Section 6.) d) If distribution of the work is made by offering
Otherwise, if the work is a derivative of the Library, you access to copy from a designated place, offer
may distribute the object code for the work under the equivalent access to copy the above specified materials
terms of Section 6. Any executables containing that work from the same place.
also fall under Section 6, whether or not they are linked e) Verify that the user has already received a copy of
directly with the Library itself. these materials or that you have already sent this user
6. As an exception to the Sections above, you may also a copy.
combine or link a "work that uses the Library" with the For an executable, the required form of the "work that
Library to produce a work containing portions of the uses the Library" must include any data and utility
Library, and distribute that work under terms of your programs needed for reproducing the executable from it.
choice, provided that the terms permit modification of However, as a special exception, the materials to be
the work for the customer's own use and reverse distributed need not include anything that is normally
engineering for debugging such modifications. distributed (in either source or binary form) with the
You must give prominent notice with each copy of the major components (compiler, kernel, and so on) of the
work that the Library is used in it and that the Library operating system on which the executable runs, unless
and its use are covered by this License. You must supply that component itself accompanies the executable.
a copy of this License. If the work during execution It may happen that this requirement contradicts the
displays copyright notices, you must include the license restrictions of other proprietary libraries that do
copyright notice for the Library among them, as well as a not normally accompany the operating system. Such a
reference directing the user to the copy of this License. contradiction means you cannot use both them and the
Also, you must do one of these things: Library together in an executable that you distribute.
a) Accompany the work with the complete 7. You may place library facilities that are a work based
corresponding machine-readable source code for the on the Library side-by-side in a single library together
Library including whatever changes were used in the with other library facilities not covered by this License,
work (which must be distributed under Sections 1 and and distribute such a combined library, provided that the
2 above); and, if the work is an executable linked with separate distribution of the work based on the Library
the Library, with the complete machine-readable "work and of the other library facilities is otherwise permitted,
that uses the Library", as object code and/or source and provided that you do these two things:
code, so that the user can modify the Library and then a) Accompany the combined library with a copy of the
relink to produce a modified executable containing the same work based on the Library, uncombined with any
other library facilities. This must be distributed under If any portion of this section is held invalid or
the terms of the Sections above. unenforceable under any particular circumstance, the
b) Give prominent notice with the combined library of balance of the section is intended to apply, and the
the fact that part of it is a work based on the Library, section as a whole is intended to apply in other
and explaining where to find the accompanying circumstances.
uncombined form of the same work. It is not the purpose of this section to induce you to
8. You may not copy, modify, sublicense, link with, or infringe any patents or other property right claims or to
distribute the Library except as expressly provided under contest validity of any such claims; this section has the
this License. Any attempt otherwise to copy, modify, sole purpose of protecting the integrity of the free
sublicense, link with, or distribute the Library is void, and software distribution system which is implemented by
will automatically terminate your rights under this License. public license practices. Many people have made
However, parties who have received copies, or rights, generous contributions to the wide range of software
from you under this License will not have their licenses distributed through that system in reliance on consistent
terminated so long as such parties remain in full application of that system; it is up to the author/donor to
compliance. decide if he or she is willing to distribute software
9. You are not required to accept this License, since you through any other system and a licensee cannot impose
have not signed it. However, nothing else grants you that choice.
permission to modify or distribute the Library or its This section is intended to make thoroughly clear what is
derivative works. These actions are prohibited by law if believed to be a consequence of the rest of this License.
you do not accept this License. Therefore, by modifying 12. If the distribution and/or use of the Library is
or distributing the Library (or any work based on the restricted in certain countries either by patents or by
Library), you indicate your acceptance of this License to copyrighted interfaces, the original copyright holder who
do so, and all its terms and conditions for copying, places the Library under this License may add an explicit
distributing or modifying the Library or works based on it. geographical distribution limitation excluding those
10. Each time you redistribute the Library (or any work countries, so that distribution is permitted only in or
based on the Library), the recipient automatically receives among countries not thus excluded. In such case, this
a license from the original licensor to copy, distribute, link License incorporates the limitation as if written in the
with or modify the Library subject to these terms and body of this License.
conditions. You may not impose any further restrictions 13. The Free Software Foundation may publish revised
on the recipients' exercise of the rights granted herein. and/or new versions of the Lesser General Public License
You are not responsible for enforcing compliance by third from time to time. Such new versions will be similar in
parties with this License. spirit to the present version, but may differ in detail to
11. If, as a consequence of a court judgment or allegation address new problems or concerns.
of patent infringement or for any other reason (not Each version is given a distinguishing version number. If
limited to patent issues), conditions are imposed on you the Library specifies a version number of this License
(whether by court order, agreement or otherwise) that which applies to it and "any later version", you have the
contradict the conditions of this License, they do not option of following the terms and conditions either of
excuse you from the conditions of this License. If you that version or of any later version published by the Free
cannot distribute so as to satisfy simultaneously your Software Foundation. If the Library does not specify a
obligations under this License and any other pertinent license version number, you may choose any version ever
obligations, then as a consequence you may not published by the Free Software Foundation.
distribute the Library at all. For example, if a patent 14. If you wish to incorporate parts of the Library into
license would not permit royalty-free redistribution of the other free programs whose distribution conditions are
Library by all those who receive copies directly or incompatible with these, write to the author to ask for
indirectly through you, then the only way you could permission. For software which is copyrighted by the Free
satisfy both it and this License would be to refrain Software Foundation, write to the Free Software
entirely from distribution of the Library. Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving Copyright (C) year name of author
the free status of all derivatives of our free software and This library is free software; you can redistribute it and/or
of promoting the sharing and reuse of software generally. modify it under the terms of the GNU Lesser General
NO WARRANTY Public License as published by the Free Software
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, Foundation; either version 2.1 of the License, or (at your
THERE IS NO WARRANTY FOR THE LIBRARY, TO THE option) any later version.
EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN This library is distributed in the hope that it will be useful,
OTHERWISE STATED IN WRITING THE COPYRIGHT but WITHOUT ANY WARRANTY; without even the implied
HOLDERS AND/OR OTHER PARTIES PROVIDE THE warranty of MERCHANTABILITY or FITNESS FOR A
LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, PARTICULAR PURPOSE. See the GNU Lesser General
EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT Public License for more details.
LIMITED TO, THE IMPLIED WARRANTIES OF You should have received a copy of the GNU Lesser
MERCHANTABILITY AND FITNESS FOR A PARTICULAR General Public License along with this library; if not, write
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND to the Free Software Foundation, Inc., 51 Franklin Street,
PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD Fifth Floor, Boston, MA 02110-1301 USA
THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST Also add information on how to contact you by
OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. electronic and paper mail.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE You should also get your employer (if you work as a
LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT programmer) or your school, if any, to sign a "copyright
HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY disclaimer" for the library, if necessary. Here is a sample;
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED alter the names:
ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING Yoyodyne, Inc., hereby disclaims all copyright interest in
ANY GENERAL, SPECIAL, INCIDENTAL OR the library `Frob' (a library for tweaking knobs) written
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE by James Random Hacker.
OR INABILITY TO USE THE LIBRARY (INCLUDING BUT signature of Ty Coon, 1 April 1990
NOT LIMITED TO LOSS OF DATA OR DATA BEING Ty Coon, President of Vice
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU That's all there is to it!
OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO
OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH The MIT License
HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE Copyright (c) 2006, 2009 Marcin Kalicinski
POSSIBILITY OF SUCH DAMAGES. Permission is hereby granted, free of charge, to any
END OF TERMS AND CONDITIONS person obtaining a copy of this software and associated
How to Apply These Terms to Your New Libraries documentation files (the “Software”), to deal in the
If you develop a new library, and you want it to be of the Software without restriction, including without limitation
greatest possible use to the public, we recommend the rights to use, copy, modify, merge, publish, distribute,
making it free software that everyone can redistribute sublicense, and/or sell copies of the Software, and to
and change. You can do so by permitting redistribution permit persons to whom the Software is furnished to do
under these terms (or, alternatively, under the terms of so, subject to the following conditions:
the ordinary General Public License). The above copyright notice and this permission notice
To apply these terms, attach the following notices to the shall be included in all copies or substantial portions of
library. It is safest to attach them to the start of each the Software.
source file to most effectively convey the exclusion of THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT
warranty; and each file should have at least the WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
"copyright" line and a pointer to where the full notice is INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
found. MERCHANTABILITY, FITNESS FOR A PARTICULAR
one line to give the library's name and an idea of what it PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
does. THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER this software must display the following acknowledgment:
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, “This product includes software developed by the
ARISING FROM, OUT OF OR IN CONNECTION WITH THE OpenSSL Project for use in the OpenSSL Toolkit.
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE (http://www.openssl.org/)”
SOFTWARE. 4. The names “OpenSSL Toolkit” and “OpenSSL Project”
must not be used to endorse or promote products
The zlib/libpng License derived from this software without prior written
permission. For written permission, please contact
Copyright (c) 2011 Lee Thomason
opensslcore@openssl.org.
Copyright (c) 1995-2012 Jean-loup Gailly and Mark Adler
5. Products derived from this software may not be called
Copyright (c) 1998-2012 Glenn Randers-Pehrson
“OpenSSL” nor may “OpenSSL” appear in their names
Copyright (c) 2003-2005 Hector Mauricio Rodriguez
without prior written permission of the OpenSSL Project.
Segura
6. Redistributions of any form whatsoever must retain the
Copyright (c) 1995-2015 Nullsoft and Contributors
following acknowledgment:
Copyright (c) 2002-2008 Davide Pizzolato
“This product includes software developed by the
This software is provided ‘as-is’, without any express or
OpenSSL Project for use in the OpenSSL Toolkit
implied warranty. In no event will the authors be held
(http://www.openssl.org/)”
liable for any damages arising from the use of this
THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT
software.;
“AS IS” AND ANY EXPRESSED OR IMPLIED WARRANTIES,
Permission is granted to anyone to use this software for
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
any purpose, including commercial applications, and to
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
alter it and redistribute it freely, subject to the following
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
restrictions:
SHALL THE OpenSSL PROJECT OR ITS CONTRIBUTORS BE
1. The origin of this software must not be misrepresented;
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
you must not claim that you wrote the original software.
EXEMPLARY, OR CONSEQUENTIAL DAMAGES
If you use this software in a product, an acknowledgment
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
in the product documentation would be appreciated but
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
is not required.
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
2. Altered source versions must be plainly marked as such,
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
and must not be misrepresented as being the original
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
software.
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
3. This notice may not be removed or altered from any
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
source distribution.
THE POSSIBILITY OF SUCH DAMAGE.
This product includes cryptographic software written by
OpenSSL License
Eric Young (eay@cryptsoft.com). This product includes
Copyright (c) 1998-2008 The OpenSSL Project. All rights
software written by Tim Hudson (tjh@cryptsoft.com).
reserved.
Redistribution and use in source and binary forms, with
Apache License
or without modification, are permitted provided that the
Version 2.0, January 2004
following conditions are met:
http://www.apache.org/licenses/
1. Redistributions of source code must retain the above
TERMS AND CONDITIONS FOR USE, REPRODUCTION,
copyright notice, this list of conditions and the following
AND DISTRIBUTION
disclaimer.
1. Definitions.
2. Redistributions in binary form must reproduce the
"License" shall mean the terms and conditions for use,
above copyright notice, this list of conditions and the
reproduction, and distribution as defined by Sections 1
following disclaimer in the documentation and/or other
through 9 of this document.
materials provided with the distribution.
"Licensor" shall mean the copyright owner or entity
3. All advertising materials mentioning features or use of
authorized by the copyright owner that is granting the control systems, and issue tracking systems that are
License. managed by, or on behalf of, the Licensor for the
"Legal Entity" shall mean the union of the acting entity purpose of discussing and improving the Work, but
and all other entities that control, are controlled by, or excluding communication that is conspicuously marked
are under common control with that entity. For the or otherwise designated in writing by the copyright
purposes of this definition, "control" means (i) the power, owner as "Not a Contribution."
direct or indirect, to cause the direction or management "Contributor" shall mean Licensor and any individual or
of such entity, whether by contract or otherwise, or (ii) Legal Entity on behalf of whom a Contribution has been
ownership of fifty percent (50%) or more of the received by Licensor and subsequently incorporated
outstanding shares, or (iii) beneficial ownership of such within the Work.
entity. 2. Grant of Copyright License. Subject to the terms and
"You" (or "Your") shall mean an individual or Legal Entity conditions of this License, each Contributor hereby grants
exercising permissions granted by this License. to You a perpetual, worldwide, non-exclusive, no-charge,
"Source" form shall mean the preferred form for making royalty-free, irrevocable copyright license to reproduce,
modifications, including but not limited to software prepare Derivative Works of, publicly display, publicly
source code, documentation source, and configuration perform, sublicense, and distribute the Work and such
files. Derivative Works in Source or Object form.
"Object" form shall mean any form resulting from 3. Grant of Patent License. Subject to the terms and
mechanical transformation or translation of a Source form, conditions of this License, each Contributor hereby grants
including but not limited to compiled object code, to You a perpetual, worldwide, non-exclusive, no-charge,
generated documentation, and conversions to other royalty-free, irrevocable (except as stated in this section)
media types. patent license to make, have made, use, offer to sell, sell,
"Work" shall mean the work of authorship, whether in import, and otherwise transfer the Work, where such
Source or Object form, made available under the License, license applies only to those patent claims licensable by
as indicated by a copyright notice that is included in or such Contributor that are necessarily infringed by their
attached to the work (an example is provided in the Contribution(s) alone or by combination of their
Appendix below). Contribution(s) with the Work to which such
"Derivative Works" shall mean any work, whether in Contribution(s) was submitted. If You institute patent
Source or Object form, that is based on (or derived from) litigation against any entity (including a cross-claim or
the Work and for which the editorial revisions, counterclaim in a lawsuit) alleging that the Work or a
annotations, elaborations, or other modifications Contribution incorporated within the Work constitutes
represent, as a whole, an original work of authorship. For direct or contributory patent infringement, then any
the purposes of this License, Derivative Works shall not patent licenses granted to You under this License for that
include works that remain separable from, or merely link Work shall terminate as of the date such litigation is filed.
(or bind by name) to the interfaces of, the Work and 4. Redistribution. You may reproduce and distribute
Derivative Works thereof. copies of the Work or Derivative Works thereof in any
"Contribution" shall mean any work of authorship, medium, with or without modifications, and in Source or
including the original version of the Work and any Object form, provided that You meet the following
modifications or additions to that Work or Derivative conditions:
Works thereof, that is intentionally submitted to Licensor a.You must give any other recipients of the Work or
for inclusion in the Work by the copyright owner or by Derivative Works a copy of this License; and
an individual or Legal Entity authorized to submit on b.You must cause any modified files to carry prominent
behalf of the copyright owner. For the purposes of this notices stating that You changed the files; and
definition, "submitted" means any form of electronic, c.You must retain, in the Source form of any Derivative
verbal, or written communication sent to the Licensor or Works that You distribute, all copyright, patent,
its representatives, including but not limited to trademark, and attribution notices from the Source
communication on electronic mailing lists, source code form of the Work, excluding those notices that do not
pertain to any part of the Derivative Works; and for determining the appropriateness of using or
d.If the Work includes a "NOTICE" text file as part of its redistributing the Work and assume any risks associated
distribution, then any Derivative Works that You with Your exercise of permissions under this License.
distribute must include a readable copy of the 8. Limitation of Liability. In no event and under no legal
attribution notices contained within such NOTICE file, theory, whether in tort (including negligence), contract, or
excluding those notices that do not pertain to any part otherwise, unless required by applicable law (such as
of the Derivative Works, in at least one of the following deliberate and grossly negligent acts) or agreed to in
places: within a NOTICE text file distributed as part of writing, shall any Contributor be liable to You for
the Derivative Works; within the Source form or damages, including any direct, indirect, special, incidental,
documentation, if provided along with the Derivative or consequential damages of any character arising as a
Works; or, within a display generated by the Derivative result of this License or out of the use or inability to use
Works, if and wherever such third-party notices the Work (including but not limited to damages for loss
normally appear. The contents of the NOTICE file are of goodwill, work stoppage, computer failure or
for informational purposes only and do not modify the malfunction, or any and all other commercial damages or
License. You may add Your own attribution notices losses), even if such Contributor has been advised of the
within Derivative Works that You distribute, alongside possibility of such damages.
or as an addendum to the NOTICE text from the Work, 9. Accepting Warranty or Additional Liability. While
provided that such additional attribution notices redistributing the Work or Derivative Works thereof, You
cannot be construed as modifying the License. may choose to offer, and charge a fee for, acceptance of
You may add Your own copyright statement to Your support, warranty, indemnity, or other liability obligations
modifications and may provide additional or different and/or rights consistent with this License. However, in
license terms and conditions for use, reproduction, or accepting such obligations, You may act only on Your
distribution of Your modifications, or for any such own behalf and on Your sole responsibility, not on behalf
Derivative Works as a whole, provided Your use, of any other Contributor, and only if You agree to
reproduction, and distribution of the Work otherwise indemnify, defend, and hold each Contributor harmless
complies with the conditions stated in this License. for any liability incurred by, or claims asserted against,
5. Submission of Contributions. Unless You explicitly state such Contributor by reason of your accepting any such
otherwise, any Contribution intentionally submitted for warranty or additional liability.
inclusion in the Work by You to the Licensor shall be END OF TERMS AND CONDITIONS
under the terms and conditions of this License, without APPENDIX: How to apply the Apache License to
any additional terms or conditions. Notwithstanding the your work
above, nothing herein shall supersede or modify the To apply the Apache License to your work, attach the
terms of any separate license agreement you may have following boilerplate notice, with the fields enclosed by
executed with Licensor regarding such Contributions. brackets "[]" replaced with your own identifying
6. Trademarks. This License does not grant permission to information. (Don't include the brackets!) The text should
use the trade names, trademarks, service marks, or be enclosed in the appropriate comment syntax for the
product names of the Licensor, except as required for file format. We also recommend that a file or class name
reasonable and customary use in describing the origin of and description of purpose be included on the same
the Work and reproducing the content of the NOTICE file. "printed page" as the copyright notice for easier
7. Disclaimer of Warranty. Unless required by applicable identification within third-party archives.
law or agreed to in writing, Licensor provides the Work Copyright [yyyy] [name of copyright owner]
(and each Contributor provides its Contributions) on an Licensed under the Apache License, Version 2.0 (the
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS "License");
OF ANY KIND, either express or implied, including, you may not use this file except in compliance with the
without limitation, any warranties or conditions of TITLE, License.
NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS You may obtain a copy of the License at
FOR A PARTICULAR PURPOSE. You are solely responsible http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on Common Public License version 1.0
an "AS IS" BASIS, WITHOUT WARRANTIES OR
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
CONDITIONS OF ANY KIND, either express or implied.
THE TERMS OF THIS COMMON PUBLIC LICENSE
See the License for the specific language governing
("AGREEMENT"). ANY USE, REPRODUCTION OR
permissions and limitations under the License.
DISTRIBUTION OF THE PROGRAM CONSTITUTES
RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
bzip2 license
1. DEFINITIONS
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the "Contribution" means:
following conditions are met: a) in the case of the initial Contributor, the initial code and
documentation distributed under this Agreement, and b) in
1. Redistributions of source code must retain the the case of each subsequent Contributor:
above copyright notice, this list of conditions and
i) changes to the Program, and
the following disclaimer.
2. The origin of this software must not be ii) additions to the Program;
misrepresented; you must not claim that you
where such changes and/or additions to the Program
wrote the original software. If you use this
originate from and are distributed by that particular
software in a product, an acknowledgment in the
Contributor. A Contribution 'originates' from a Contributor
product documentation would be appreciated
if it was added to the Program by such Contributor itself
but is not required.
or anyone acting on such Contributor's behalf.
3. Altered source versions must be plainly marked as Contributions do not include additions to the Program
such, and must not be misrepresented as being which: (i) are separate modules of software distributed in
the original software. conjunction with the Program under their own license
4. The name of the author may not be used to agreement, and (ii) are not derivative works of the
endorse or promote products derived from this Program.
software without specific prior written permission.
"Contributor" means any person or entity that distributes
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS the Program.
IS AND ANY EXPRESS OR IMPLIED WARRANTIES,
"Licensed Patents " mean patent claims licensable by a
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
Contributor which are necessarily infringed by the use or
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
sale of its Contribution alone or when combined with the
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
Program.
SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR "Program" means the Contributions distributed in
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT accordance with this Agreement.
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
"Recipient" means anyone who receives the Program
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
under this Agreement, including all Contributors.
INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2. GRANT OF RIGHTS
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR a) Subject to the terms of this Agreement, each
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF Contributor hereby grants Recipient a non-exclusive,
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY worldwide, royalty-free copyright license to reproduce,
OF SUCH DAMAGE. prepare derivative works of, publicly display, publicly
Julian Seward, Cambridge, UK. perform, distribute and sublicense the Contribution of such
Contributor, if any, and such derivative works, in source
jseward@acm.org
code and object code form.
b) Subject to the terms of this Agreement, each ii) effectively excludes on behalf of all Contributors all
Contributor hereby grants Recipient a non-exclusive, liability for damages, including direct, indirect, special,
worldwide, royalty-free patent license under Licensed incidental and consequential damages, such as lost profits;
Patents to make, use, sell, offer to sell, import and
iii) states that any provisions which differ from this
otherwise transfer the Contribution of such Contributor, if
Agreement are offered by that Contributor alone and not
any, in source code and object code form. This patent
by any other party; and
license shall apply to the combination of the Contribution
and the Program if, at the time the Contribution is added iv) states that source code for the Program is available
by the Contributor, such addition of the Contribution from such Contributor, and informs licensees how to
causes such combination to be covered by the Licensed obtain it in a reasonable manner on or through a medium
Patents. The patent license shall not apply to any other customarily used for software exchange.
combinations which include the Contribution. No hardware When the Program is made available in source code form:
per se is licensed hereunder.
a) it must be made available under this Agreement; and
c) Recipient understands that although each Contributor
b) a copy of this Agreement must be included with each
grants the licenses to its Contributions set forth herein, no
copy of the Program.
assurances are provided by any Contributor that the
Program does not infringe the patent or other intellectual Contributors may not remove or alter any copyright
property rights of any other entity. Each Contributor notices contained within the Program.
disclaims any liability to Recipient for claims brought by
Each Contributor must identify itself as the originator of its
any other entity based on infringement of intellectual
Contribution, if any, in a manner that reasonably allows
property rights or otherwise. As a condition to exercising
subsequent Recipients to identify the originator of the
the rights and licenses granted hereunder, each Recipient
Contribution.
hereby assumes sole responsibility to secure any other
4. COMMERCIAL DISTRIBUTION
intellectual property rights needed, if any. For example, if a
third party patent license is required to allow Recipient to Commercial distributors of software may accept certain
distribute the Program, it is Recipient's responsibility to responsibilities with respect to end users, business partners
acquire that license before distributing the Program. and the like. While this license is intended to facilitate the
commercial use of the Program, the Contributor who
d) Each Contributor represents that to its knowledge it has
includes the Program in a commercial product offering
sufficient copyright rights in its Contribution, if any, to
should do so in a manner which does not create potential
grant the copyright license set forth in this Agreement.
liability for other Contributors. Therefore, if a Contributor
3. REQUIREMENTS
includes the Program in a commercial product offering,
A Contributor may choose to distribute the Program in such Contributor ("Commercial Contributor") hereby agrees
object code form under its own license agreement, to defend and indemnify every other Contributor
provided that: ("Indemnified Contributor") against any losses, damages
and costs (collectively "Losses") arising from claims,
a) it complies with the terms and conditions of this
lawsuits and other legal actions brought by a third party
Agreement; and
against the Indemnified Contributor to the extent caused
b) its license agreement: by the acts or omissions of such Commercial Contributor
i) effectively disclaims on behalf of all Contributors all in connection with its distribution of the Program in a
warranties and conditions, express and implied, including commercial product offering. The obligations in this
warranties or conditions of title and non-infringement, and section do not apply to any claims or Losses relating to
implied warranties or conditions of merchantability and any actual or alleged intellectual property infringement. In