You are on page 1of 342

Samsung XNS ActiveX SDK

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

SAMSUNG TECHWIN AMERICA Inc.


1480 Charles Willard St, Carson, CA 90746, UNITED STATES
Tol Free: +1-877-213-1222 FAX: +1-310-632-2195

SAMSUNG TECHWIN EUROPE LTD.


Samsung House, 1000 Hillswood Drive, Hillswood Business
Park Chertsey, Surrey, UNITED KINGDOM KT16 OPS
TEL: +44-1932-45-5300 FAX: +44-1932-45-5325
Preface

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

alarm feature efficiently. functions belonging to XnsSdkDevice component.

ㆍ CHAPTER 3. XnsSdkWindow: Description about


functions belonging to XnsSdkWindow component.

Audience ㆍ APPENDIX A. Error Code: Error codes defined in XNS


The purpose of this document is to provide information ActiveX library.
for developers who use XNS ActiveX SDK to create
applications (CMS, Viewer, etc.).

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.

ㆍ Angle brackets (>) indicate menu paths.

ㆍ Italic font letters indicate parameters and variables.


Revision History
The table below provides the revision history of this document.

Version Date Description

0.9 2010. 8. 16 First draft

1.0 2010. 11. 25 API Reference (SDK v1.23)

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.4.0 2011.08.29 Delete ‘CHAPTER 2. Development Environment’ caused by dividing


document into Programmer’s Guide and API Reference.
Add description about UTCToDeviceLocalTime() method.
Change the name of Event, that is from OnIvEvent to OnIvOccurEvent.

1.4.1 2011.09.20 Change description about OpenStream() Return value

1.4.2 2011.09.29 Add description about AreaZoomMoving event

1.34.00 2011.11.02 Change version naming of the document


Compatibility update

1.35.00 2012.01.06 Add note about XnsSdkWindow::Start()


Update Error Code

1.37.00 2012.03.09 Add note about a bForced parameter in XnsSdkDevice::Connect()


Add API specification
ㆍ XnsSdkWindow::SetVideoRawDataReceived()
ㆍ XnsSdkWindow::UnsetVideoRawDataReceived()
ㆍ XnsSdkWindow::OnVideoRawDataReceived()
ㆍ XnsSdkWindwo::SaveSnapshotWidthData()
1.38.00 2012.05.30 Update Capability ID information in Table 2-5

1.39.00 2012.08.31 Add description about OnFanStatusChanged event


Add Swing, Tour parameter in XnsSdkDevice::ExecuteHPtz()
Add remarks and sample codes of OnNewMedia event
Change supported model list (Integration of model name)

1.39.10 2012.12.03 Add description about AVI backup API


ㆍ XnsSdkDevice::StartAviLocalRecording()
ㆍ XnsSdkDevice::StopAviLocalRecording()
ㆍ XnsSdkDevice::StartAviBackup()
ㆍ XnsSdkDevice::StopAviBackup()
Add description about Overlapped track API and event
ㆍ XnsSdkDevice::SearchOverLap()
ㆍ XnsSdkDevice::OnSearchOverLap()
Add description about AutoScan, IPInstallDhcp API and event
ㆍ XnsSdkDevice::IPInstallDhcp()
ㆍ XnsSdkDevice::OnDeviceDetected2()
ㆍ XnsSdkDevice::OnDeviceInstalled()
Add description about SetVideoFrameInfoReceived API,
OnVideoFrameInfoReceived event to receive video frame information
ㆍ XnsSdkDevice:: SetVideoFrameInfoReceived()
ㆍ XnsSdkDevice:: OnVideoFrameInfoReceived()
Add description about MotionGrid API and event
ㆍ XnsSdkDevice::GetMotionGrid()
ㆍ XnsSdkDevice::MotionSearch()
ㆍ XnsSdkDevice::OnGetMotionGrid()
ㆍ XnsSdkDevice::OnMotionSearch()
Add description about OnHDDNumChanged event
ㆍ XnsSdkDevice::OnHDDNumChanged()
Add description about GetRecordingTime API and event
ㆍ XnsSdkDevice::GetStartRecordingTime()
ㆍ XnsSdkDevice::GetEndRecordingTime()
ㆍ XnsSdkDevice::OnGetStartRecordingTime()
ㆍ XnsSdkDevice::OnGetEndRecordingTime()
Add description about OnRecordingErrorEvent event
ㆍ XnsSdkDevice:: OnRecordingErrorEvent()
Add description about Power Restart API and event
ㆍ XnsSdkDevice::PowerRestart()
ㆍ XnsSdkDevice::OnPowerRestart()

1.40.00 2013.03.29 Add description about OnRecordingStatusChanged event


ㆍ XnsSdkDevice::OnRecordingStatusChanged()
Add description about video information API of the control module.
ㆍ XnsSdkDevice::GetVideoResolution()
ㆍ XnsSdkDevice::GetVideoFrameRate()
ㆍ XnsSdkDevice::GetVideoQuality()
ㆍ XnsSdkDevice::GetVideoCodec()

1.40.10 2013.04.24 Add description about Custom OSD API


ㆍ XnsSdkWindow::SetCustomOSD()
ㆍ XnsSdkWindow::SetCustomOSDOnOff()
Add description about Image Flip API
ㆍ XnsSdkWindow::SetImageFlip()
Add description about Video Pixel Format API
ㆍ XnsSdkWindow::GetVideoPixelFormat()

1.40.30 2013.09.02 Add comments about restriction of the API

1.41.00 2014.03.28 Add description about convert REC to AVI API.


ㆍ XnsSdkDevice::ConvertRec2Avi()
ㆍ XnsSdkDevice::StopRec2Avi()
Add description about SendAudioData2.
ㆍ XnsSdkDevice::SendAudioData2()
ㆍ XnsSdkDevice::StopAudioData2()
Add description about setting AVI recording
ㆍ XnsSdkDevice::GetAviOptionSize()
ㆍ XnsSdkDevice::SetAviOptionSize()
ㆍ XnsSdkDevice::GetAviOptionPeriod()
ㆍ XnsSdkDevice::SetAviOptionPeriod()

1.41.10 2014.07.24 Modify supported device list

1.41.20 2014.08.27 Change technical support web page address

1.41.70 2014.11.13 Add description about event


ㆍ XnsSdkDevice::OnTrackingEventChanged()
ㆍ XnsSdkDevice::OnFaceDatectionEventChanged()
ㆍ XnsSdkDevice::OnAudioDetectionEventChanged()
ㆍ XnsSdkDevice::OnAMDEventChanged()
ㆍ XnsSdkDevice::OnSystemEventChanged()
Add description about XNS_AUDIO_HEADER2
ㆍ OnNewMedia()
Change description about the return values of GetDeviceID() and
GetDeviceStatus() API
Add API specification
ㆍ XnsSdkDevice::SetConnectionInfo2()
ㆍ XnsSdkDevice::OnDeviceDetected3()

1.41.90 2014.12.15 Add API specification


ㆍ XnsSdkWindow::SaveSnapshotWithString()
1.42.30 2015.03.06 Add description about getting DVR/NVR’s time information
ㆍ XnsSdkDevice::GetDeviceUTC()
ㆍ XnsSdkDevice::GetDeviceLocalTime()
Add API and event for changing camera password
ㆍ XnsSdkDevice::ChangeDeviceAdminPassword()
ㆍ XnsSdkDevice::OnChangeDeviceAdminPassword()
Add Metadata in OnNewMedia()

1.42.40 2015.03.31 Add API about SEC encrypted backup


ㆍ XnsSdkDevice::StartSecBackup()

1.42.50 2015.08.24 Add description about getting/setting PTZ position API and event
ㆍ XnsSdkDevice::GetPtzPosNormalize()
ㆍ XnsSdkDevice::SetPtzPosNormalize()
ㆍ XnsSdkDevice::OnGetPtzPosNormalize()

1.42.90 2015.11.12 Add description about keeping aspect ratio API


ㆍ XnsSdkWindow::SetAspectRatio()
Modify Table1.1 Supported Device List
Add Table2.1 Device Model Name
Add Trouble shooting DEP problem

1.43.20 2015.03.25 Add description about getting ControlID API


ㆍ XnsSdkDevice::GetVideoControlID()
Add Figure2.3 Controllable Module Architecture of DVR/NVR suppoting
multi-profile
Table of Contents

Preface...........................................................................................................................................................................................................................2

Revision History.......................................................................................................................................................................................................3

Table of Contents....................................................................................................................................................................................................7

Figures ........................................................................................................................................................................................................................18

Tables...........................................................................................................................................................................................................................19

CHAPTER 1 XNS ActiveX SDK....................................................................................................................................................................20

Overview ....................................................................................................................................................................... 21

SDK Architecture ....................................................................................................................................................... 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

Create/Release Device ............................................................................................................................................ 35

CreateDevice........................................................................................................................................................... 35
ReleaseDevice ........................................................................................................................................................ 35

Get/Set Device Information ................................................................................................................................. 36

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

Control Module Information ............................................................................................................................... 56

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

Start/End to Play Media ........................................................................................................................................ 77

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

Control Audio and Alarm-out ..........................................................................................................................104

SetTalk......................................................................................................................................................................104

SetListen .................................................................................................................................................................105

SendAudioData ...................................................................................................................................................107

SendAudioData2.................................................................................................................................................108

StopAudioData2..................................................................................................................................................109

SetAlarm .................................................................................................................................................................109

Control PTZ ................................................................................................................................................................110

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

Update Firmware and Import/Export Configuration .............................................................................160

UploadSoftware...................................................................................................................................................160

ImportConfig ........................................................................................................................................................161

ExportConfig.........................................................................................................................................................162

Device Profile ............................................................................................................................................................163


LoadDeviceProfile...............................................................................................................................................163

SaveDeviceProfile ...............................................................................................................................................164

DeleteDeviceProfile ...........................................................................................................................................165

XML File .......................................................................................................................................................................166

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 the Control ..............................................................................................................................................248

Initialize ...................................................................................................................................................................248

Start and Stop ..........................................................................................................................................................249

Start ..........................................................................................................................................................................249

Stop...........................................................................................................................................................................250

Get Device Information .......................................................................................................................................250

GetDeviceID ..........................................................................................................................................................250

GetControlID.........................................................................................................................................................251

GetImageWidth ...................................................................................................................................................251

GetImageHeight .................................................................................................................................................252

IsMedia ....................................................................................................................................................................252

GetMediaType ......................................................................................................................................................253

Control Zoom ...........................................................................................................................................................254

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

Control Volume ........................................................................................................................................................265


SetSound ................................................................................................................................................................265

SetVolume..............................................................................................................................................................265

GetVolume .............................................................................................................................................................266

Video Raw Data .......................................................................................................................................................266

SetVideoRawDataReceived ............................................................................................................................266

UnSetVideoRawDataReceived ......................................................................................................................267

Snapshot .....................................................................................................................................................................268

SaveSnapshot .......................................................................................................................................................268

SaveSnapshotWithString.................................................................................................................................269

SaveSnapshotWithData ...................................................................................................................................271

PrintSnapshot .......................................................................................................................................................272

Control Playback .....................................................................................................................................................273

PushMedia .............................................................................................................................................................273

SetPlaySpeed ........................................................................................................................................................274

GetPlaySpeed .......................................................................................................................................................275

MoveFrameAdvance .........................................................................................................................................275

Control Buffer ...........................................................................................................................................................276

ClearMediaBuffer ................................................................................................................................................276

IsBufferFull .............................................................................................................................................................277

IsBufferEmpty .......................................................................................................................................................277

SetBufferSize.........................................................................................................................................................278

GetBufferSize ........................................................................................................................................................278

GetRemainingBufferSize..................................................................................................................................279

Get Display Information ......................................................................................................................................280

GetCurrentFrameTime ......................................................................................................................................280

GetFirstFrameTime.............................................................................................................................................280

Not Used(deprecated) - GetInputType....................................................................................................281

Not Used(deprecated) - GetFrameType..................................................................................................282

Not Used(deprecated) - GetFrameTime .................................................................................................283

Not Used(deprecated) - GetFrameSize ...................................................................................................283

Not Used(deprecated) - GetTimeStamp .................................................................................................284

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

APPENDIX A Trouble shooting DEP problem...............................................................................................................................314

APPENDIX B Error Code..............................................................................................................................................................................317

Glossary..................................................................................................................................................................................................................320

Abbreviations......................................................................................................................................................................................................321

Index............................................................................................................................................................................................................................322

OPENSOURCELICENSEREPORTONTHEPRODUCT..............................................오류! 책갈피가 정의되어 있지 않습니다.


Figures
Figure 1.1 XNS ActiveX Architecture ........................................................................................... 22

Figure 2.1 Controllable Module Architecture of DVR (SRD-1670).................................................. 57

Figure 2.2 Controllable Module Architecture of DVR/NVR suppoting multi-profile ........................ 58

Figure 2.3 Controllable Module Architecture of Network Camera (SNB-5000) ............................... 59

Figure 3.1 Example of Zoom Rectangle..................................................................................... 256


Tables
Table 1-1 Supported Device List ................................................................................................. 24

Table 2-1 Device Model Name ................................................................................................... 37

Table 2-2 Actual Address According to the Address Type ............................................................ 38

Table 2-2 Capabilities According to the Control Module Type ...................................................... 59

Table 2-3 Status ID .................................................................................................................... 66

Table 2-4 Return Values of GetControlStatus() ............................................................................. 66

Table 2-5 Capability ID .............................................................................................................. 68

Table 2-6 PTZ Command .......................................................................................................... 111

Table 2-7 Menu Control Command ........................................................................................... 117

Table 2-8 Recording Type ........................................................................................................ 138

Table 2-9 Device Information in device.xml ............................................................................... 163

Table 2-10 Control Module Status ............................................................................................ 206

Table 2-11 Control Module Capability ...................................................................................... 207

Table 2-12 AMD Subevent List ................................................................................................. 241

Table 2-13 System Subevent List .............................................................................................. 243

Table 3-1 OSD Type................................................................................................................. 261

Table 3-2 Event Status ............................................................................................................. 310

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

XNS ActiveX SDK

This chapter provides an overview of XNS ActiveX SDK.

Contents
ㆍ Overview

ㆍ SDK Architecture

ㆍ SDK Structure

ㆍ Compatibility
CHAPTER 1

XNS ActiveX SDK Overview

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.

XNS ActiveX library provides:

• Real-time video monitoring.

• Play and obtain video data stored in the network device.

• Save video in a local PC before playing it in the local PC.

• Backup of video in the network device to a local PC.

• Firmware upgrade of the network device.

• Control the PTZ operations of the network device (camera).

• Obtain the event information that occurred in the network device.

SDK Architecture

The system structure of XNS ActiveX is as follows:

Samsung XNS ActiveX SDK | 21


CHAPTER 1

XNS ActiveX SDK SDK Architecture

Figure 1.1 XNS ActiveX 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 ActiveX SDK

- XNS Device: ActiveX control that enables you to manage the network devices and XNS
library.

- XNS Window: ActiveX control that enables you to play AV data.

- XNS Manager: DLL library that manages XNS library and events.

- XMedia: Execute Decoding & Rendering on video/audio data.

- SP Library: Transfers video data incoming from a network device to XNS Manager and
controls the device by user commands.

• Network Device (DVR, Network camera)

- Transfers video data collected in a specific area to other device.

Samsung XNS ActiveX SDK | 22


CHAPTER 1

XNS ActiveX SDK SDK Structure

SDK Structure

XNS ActiveX SDK consists of:

• Library and ActiveX control

- DLL files and OCX files that are used in the development process of an application.

- Installed in the bin folder.

• 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.

• Protocol implementation file (DLL)

- Installed in "$SDK path}\Bin\SP" folder.

- If the file location is changed, the Xns.xml document should be changed accordingly.

• Simple backup file player

- Installed in the “{$SDK path}\Bin\Viewer” folder.

- 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

- Installed in the “{$SDK path}\sample_code\include” folder.

- For the application to take advantage of XNS, these header files should be included.

• Document

- Installed in the “{$SDK path}\\Doc” folder.

• Sample codes

- Saved in the “{$SDK path}\sample_code" folder.

- 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.

Samsung XNS ActiveX SDK | 23


CHAPTER 1

XNS ActiveX SDK Compatibility

Compatibility

XNS ActiveX SDK is compliant with devices in the below list:

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.

Table 1-1 Supported Device List

Device Type Model Name


N/W Camera All Network cameras and Encoders on the market
Encoder *Except Home network camera
All DVR on the market
DVR
*Except PC DVR(SRP-XXXX)
All NVR on the market
NVR
*Except SRN-872

Samsung XNS ActiveX SDK | 24


CHAPTER 2

XnsSdkDevice

XnsSdkDevice is a network component that enables you to manage connection


between network devices and XNS library and to control the network devices.

Contents
ㆍ Initialize

ㆍ Find

ㆍ Create/Release Device

ㆍ Get/Set Device Information

ㆍ Connect/Disconnect

ㆍ Control Module Information

ㆍ Start/End to Play Media

ㆍ Play Control

ㆍ Control Audio and Alarm-out

ㆍ Control PTZ

ㆍ Timeline

ㆍ Recording

ㆍ Backup

ㆍ Update Firmware and Import/Export Configuration

ㆍ 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.

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_CFG_FILE: Invalid Xns.xml file.

• ERR_ALREADY_INITIALIZE: Library already initialized.

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.

If Initialize API failed, see

Example
[C++]
long ErrCode = m_ctlXnsDevice.Initialize();
{
char str[100];
sprintf(str, "ErrorCode[0x%x]\n", ErrCode);

Samsung XNS ActiveX SDK | 26


CHAPTER 2
XnsSdkDevice Find

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 1. Use FindVendor(), FindModel(), FindDevice() to start searching.

Step 2. Use GetFindSize() to get the array size.

Step 3. Use GetFindString() to obtain the vendor name and model name.

Samsung XNS ActiveX SDK | 27


CHAPTER 2
XnsSdkDevice Find

Step 4. Use GetFindLong() and GetFindDouble0 to obtain the device ID. (Repeat this process if
necessary)

Step 5. Call CloseFind0 to end the search.

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);

string[] VendorList = new string[nFindSize];


for (int i=0; i<nFindSize; i++)
{
VendorList[i] = this._axXnsDevice.GetFindString(hFind, i);
}
this._axXnsDevice.CloseFind(hFind);

FindVendor

Description
Returns the vendor list described in Xns.xml.

Syntax
long FindVendor(void);

Samsung XNS ActiveX SDK | 28


CHAPTER 2
XnsSdkDevice Find

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

[in] Vendor name. The value should be "Samsung" (case no sensitive).

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.

Samsung XNS ActiveX SDK | 29


CHAPTER 2
XnsSdkDevice Find

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

[in] Handle returned in FindXXX().

Return Value

Samsung XNS ActiveX SDK | 30


CHAPTER 2
XnsSdkDevice Find

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

[in] Handle returned in FindXXX().

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

Samsung XNS ActiveX SDK | 31


CHAPTER 2
XnsSdkDevice Find

FindVendor, FindModel, FindDevice

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

[in] Handle returned in FindXXX().

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;

for (int i=0; i<nFindSize; i++)


{
data = m_ctlXnsDevice.GetFindLong(hFind, i);
{
char str[100];
sprintf(str, “data[%d] = [%d]\n”, i, data);

Samsung XNS ActiveX SDK | 32


CHAPTER 2
XnsSdkDevice Find

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

[in] Handle returned in FindXXX().

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++]

Samsung XNS ActiveX SDK | 33


CHAPTER 2
XnsSdkDevice Find

long hFind = m_ctlXnsDevice.FindDevice();


long nFindSize = m_ctlXnsDevice.GetFindSize(hFind);
double data;

for (int i=0; i<nFindSize; i++)


{
data = m_ctlXnsDevice.GetFindDouble(hFind, i);
{
char str[100];
sprintf(str, “data[%d] = [%f]\n”, i, data);
OutputDebugString(str);
}
}
m_ctlXnsDevice.CloseFind(hFind);

See Also
FindDevice

CloseFind

Description
Closes the Find command. Releases the memory space assigned by FindXXX().

Syntax
void CloseFind(long hFind);

Parameters
hFind

[in] Handle returned in FindXXX().

Example
[C++]
m_ctlXnsDevice.CloseFind(hFind);

See Also
FindVendor, FindModel, FindDevice

Samsung XNS ActiveX SDK | 34


CHAPTER 2
XnsSdkDevice Create/Release Device

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

[in] Device ID The value should be a greater integer than 0.

Min. : 1, Max: 3000

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.

Samsung XNS ActiveX SDK | 35


CHAPTER 2
XnsSdkDevice Get/Set Device Information

Syntax
void ReleaseDevice(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Example
[C++]
long m_hDevice;

m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);

// Place your code here.

m_ctlXnsDevice.ReleaseDevice(m_hDevice);

See Also
CreateDevice

Get/Set Device Information

SetConnectionInfo

Description
Sets the device information so the application can connect to the device.

Syntax
void SetConnectionInfo(
long hDevice,
BSTR szVendorName,
BSTR szModelName,

Samsung XNS ActiveX SDK | 36


CHAPTER 2
XnsSdkDevice Get/Set Device Information

long nAddressType,
BSTR szAddress,
long nPort,
long nHttpPort,
BSTR szUserID,
BSTR szPassword
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

szVendorName

[in] Fixed as 'Samsung'. The maximum length allowed is 126-byte.

szModelName

[in] Name of model to connect to. The maximum length allowed is 126-byte.

Table 2-1 Device Model Name

Device Type Model Name

Network Camera/Encoder Samsung Network Camera/Encoder

DVR Samsung DVR

NVR Samsung NVR

Exception * Below listed products use Model name


- Camera/Encoder : SNB-1000, SNB-2000, SNB-3000,
SND-3080, SND-3080C, SND-3080F, SND-3080CF, SNV-
3080, SNC-B2315, SNC-B2331, SNC-B2335, SNC-B5368,
SNC-B5395, SNC-C6225, SNC-C7225, , SNC-C7478, SNC-
M300, SNV-3370, SNP-3370TH, SNP-3301, SNP-3301H,
SNC-550, SNC-570, SNC-1300, SND-460V, SND-560, SNP-
1000A, SNP-3300A, SNP-3350, SNP-3750, SNS-100, SNS-
400, SNT-1010
- DVR : SHR-504X, SHR-604X, SVR-1670, SVR-1640A, SVR-
1650E, SVR-950E, SVR-450, SVR-470, SVR-480, SRD-480D,
SVR-940, SVR-945, SVR-960, SVR-960C, SVR-1645, SVR-
1660, SVR-1660C, SVR-1680, SVR-1680C, SVR-3200
- NVR : SNR-3200, SNR-6400, SRN-3250, SRN-6450
- NET-i ware : SNS-SF064, SNS-SF032, SNS-SF016, SNS-
SF008, SNS-SF004

nAddressType

[in] Address type

Samsung XNS ActiveX SDK | 37


CHAPTER 2
XnsSdkDevice Get/Set Device Information

• XADDRESS_IP (=1): Static IP

• XADDRESS_URL (=2): URL

• XADDRESS_SSDDNS (=3): Samsung DDNS (use MAC address)

• XADDRESS_S1DDNS (=4): S1 DDNS (use MAC address)

• XADDRESS_IPOLISDDNS (=5): iPolis DDNS (use ID)

szAddress

[in] Actual address according to nAddressType. The max length varies depending on
nAddressType (see Table 2-2).

nPort

[in] Port number

nHttpPort

[in] Port number for web access

szUserID

[in] Login ID. The maximum length allowed is 62-byte

szPassword

[in] Login password. The maximum length allowed is 18-byte

The value of szAddress varies according to nAddresType.

Table 2-2 Actual Address According to the Address Type

Address Type (nAddressType) Data Type Max Length (byte) Description/Example

XADDRESS_IP String 15 IPv4 IP address,


“192.168.1.200”.

XADDRESS_URL String 254 URL,


“habcdef.websamsung.net”.

XADDRESS_SSDDNS String 12 MAC address.

XADDRESS_S1DDNS String 12 MAC address.

XADDRESS_IPOLISDDNS String 20 ID, "mymodelid" registered


at '‘www.samsungipolis.com’
(created by the user).

Example
[C++]
long m_nDevice;
m_hDevice = m_ctlXnsDevice.CreateDevice(nDeviceID);

Samsung XNS ActiveX SDK | 38


CHAPTER 2
XnsSdkDevice Get/Set Device Information

m_ctlXnsDevice.SetConnectionInfo(m_hDevice, “Samsung”, “SHR-6164”, XADDRESS_IP,


“192.168.10.94”, 554, 80, “admin”, “4321”);

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

[in] Device handle. This value is returned from CreateDevice().

szVendorName

[in] Fixed as 'Samsung'. The maximum length allowed is 126-byte.

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

Samsung XNS ActiveX SDK | 39


CHAPTER 2
XnsSdkDevice Get/Set Device Information

[in] Address type

• XADDRESS_IP (=1): Static IP

• XADDRESS_URL (=2): URL

• XADDRESS_SSDDNS (=3): Samsung DDNS (use MAC address)

• XADDRESS_S1DDNS (=4): S1 DDNS (use MAC address)

• XADDRESS_IPOLISDDNS (=5): iPolis DDNS (use ID)

szAddress

[in] Actual address according to nAddressType. The max length varies depending on
nAddressType (see Table 2-2).

nPort

[in] Port number

nHttpPort

[in] Port number for web access

szUserID

[in] Login ID. The maximum length allowed is 62-byte

szPassword

[in] Login password. The maximum length allowed is 18-byte

nDeviceProtocolType

[in] Device protocol type

• XDEVICE_PROTOCOL_UNKNOWN (=0): protocol unspecified

• XDEVICE_PROTOCOL_SUNAPI (=1): set-up connection information to use SUNAPI protocol

nDeviceProtocolType

[in] Media protocol type

• XMEDIA_PROTOCOL_TCP (=0): TCP

• XMEDIA_PROTOCOL_UDP (=1): UDP

• XMEDIA_PROTOCOL_MULTICAST (=2): Multicast. Valid only in live mode.

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);

Samsung XNS ActiveX SDK | 40


CHAPTER 2
XnsSdkDevice Get/Set Device Information

m_ctlXnsDevice.SetConnectionInfo2(m_hDevice, “Samsung”, “SHR-6164”, XADDRESS_IP,


“192.168.10.94”, 554, 80, “admin”, “4321”, XDEVICE_PROTOCOL_UNKNOWN, 0);

See Also
CreateDevice

GetDeviceID

Description
Returns the device ID of the given device handle.

Syntax
long GetDeviceID(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 41


CHAPTER 2
XnsSdkDevice Get/Set Device Information

long GetDeviceStatus(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• XDEVICE_STATUS_DISCONNECTED(0): Disconnected.

• XDEVICE_STATUS_CONNECTED(1): Connected.

• ERR_NOT_EXIST_DEVICE(-1): Invalid hDevice.

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

[in] Device handle. This value is returned from CreateDevice().

Return Value
Vendor name. If hDevice is not valid, this will return "".

Example
[C++]

Samsung XNS ActiveX SDK | 42


CHAPTER 2
XnsSdkDevice Get/Set Device Information

CString strVendor = m_ctlXnsDevice.GetVendorName(m_hDevice);

See Also
SetConnectionInfo

GetModelName

Description
Returns the model name of the device.

Syntax
BSTR GetModelName(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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);

Samsung XNS ActiveX SDK | 43


CHAPTER 2
XnsSdkDevice Get/Set Device Information

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• XADDRESS_IP(1): Static IP.

• XADDRESS_URL(2): URL.

• XADDRESS_SSDDNS(3): Samsung DDNS.

• XADDRESS_S1DDNS(4): S1 DDNS.

• XADDRESS_IPOLISDDNS(5): IPolis DDNS.

Example

Samsung XNS ActiveX SDK | 44


CHAPTER 2
XnsSdkDevice Get/Set Device Information

[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

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 45


CHAPTER 2
XnsSdkDevice Get/Set Device Information

BSTR GetMac(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

[in] Device handle. This value is returned from CreateDevice().

Return Value
URL Address.

Example
[C++]
CString strURL = m_ctlXnsDevice.GetURL(m_hDevice);

Samsung XNS ActiveX SDK | 46


CHAPTER 2
XnsSdkDevice Get/Set Device Information

See Also
SetConnectionInfo

GetPort

Description
Returns the port number specified in the device.

Syntax
long GetPort(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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);

Samsung XNS ActiveX SDK | 47


CHAPTER 2
XnsSdkDevice Get/Set Device Information

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 48


CHAPTER 2
XnsSdkDevice Get/Set Device Information

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

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 49


CHAPTER 2
XnsSdkDevice Get/Set Device Information

hDevice

[in] Device handle. This value is returned from CreateDevice().

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

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 50


CHAPTER 2
XnsSdkDevice Get/Set Device Information

GetDeviceUTC

Description
Returns the UTC Time of DVR/NVR.

Syntax
long GetDeviceUTC(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

[in] Device handle. This value is returned from CreateDevice().

Return Value
Local Time of DVR/NVR.

Example

Samsung XNS ActiveX SDK | 51


CHAPTER 2
XnsSdkDevice Get/Set Device Information

[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

[in] Device handle. This value is returned from CreateDevice().

szCurrentPassword

[in] Password you are currently using. If false, returns ERR_PASSWORD_WRONG

szNewPassword

[in] New password.

szConfirmPassword

[in] Confirm Password. If mismatches between szCurrentPassword and szConfirmPassword,


returns ERR_PASSWORD_NOT_MATCH.

Example
[C++]
M_ctlXnsDevice.ChangeDeviceAdminPassword(m_hDevice, m_strCurrentPw, m_strNewPw,
m_strConfirmPw);

See Also
OnChangeDeviceAdminPassword

Samsung XNS ActiveX SDK | 52


CHAPTER 2
XnsSdkDevice Connect/Disconnect

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

[in] Device handle. This value is returned from CreateDevice().

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

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

Samsung XNS ActiveX SDK | 53


CHAPTER 2
XnsSdkDevice Connect/Disconnect

• ERR_NOT_SUPPORTED_DEVICE: Incompliant device.

• ERR_EXCEED_CONNECTION: Exceed the maximum allowed count of connections.

• ERR_NOT_CONNECT: Device not connected.

• ERR_MAC_CONFLICT: Conflict between MAC addresses.

• ERR_INVALID_VERSION: Invalid version.

• ERR_INVALID_MODEL: Invalid model.

• ERR_ALREADY_CONNECT: Already connected to the device.

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

Samsung XNS ActiveX SDK | 54


CHAPTER 2
XnsSdkDevice Connect/Disconnect

long ConnectNonBlock(
long hDevice,
BOOL bForced,
BOOL bReconnect
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

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

Samsung XNS ActiveX SDK | 55


CHAPTER 2
XnsSdkDevice Control Module Information

Description
Disconnects from the device.

Syntax
long Disconnect(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

Example
[C++]
long Res = m_ctlXnsDevice.Disconnect(m_hDevice);

See Also
Connect, ConnectNonBlock

Control Module Information

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.

Samsung XNS ActiveX SDK | 56


CHAPTER 2
XnsSdkDevice Control Module Information

Figure 2.1 Controllable Module Architecture of DVR (SRD-1670)

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 .

Samsung XNS ActiveX SDK | 57


CHAPTER 2
XnsSdkDevice Control Module Information

Figure 2.2 Controllable Module Architecture of DVR/NVR suppoting multi-profile

Samsung XNS ActiveX SDK | 58


CHAPTER 2
XnsSdkDevice Control Module Information

Figure 2.3 Controllable Module Architecture of Network Camera (SNB-5000)

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:

Table 2-3 Capabilities According to the Control Module Type

Type Value Description

XCTL_ALL 0xFF Support all types.

XCTL_DVR 0x01 DVR.

XCTL_NETCAM 0x02 Network Camera.

XCTL_ENCODER 0x04 Encoder Box (Video server)

XCTL_CAMERA 0x08 Camera channel of DVR.

XCTL_VIDEO 0x10 Possible video stream of network camera.

XCTL_ALARM 0x20 Alarm output device.

XCTL_SENSOR 0x40 Sensor input device. (Digital input, alarm input)

Samsung XNS ActiveX SDK | 59


CHAPTER 2
XnsSdkDevice Control Module Information

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

[in] Device handle. This value is returned from CreateDevice().

nType

[in] Type of control module (see Table 2-3).

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.

Samsung XNS ActiveX SDK | 60


CHAPTER 2
XnsSdkDevice Control Module Information

Syntax
long GetControlType(
long hDevice,
long nControlID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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);

for (int i=0; i<m_nControlCount; i++)


{
nType = m_ctlXnsDevice.GetControlType(m_hDevice, i);
}

See Also
GetControlCount, ControlID

GetControlNumber

Description
Returns the number of control modules corresponding to the control ID.

Syntax
long GetControlNumber(

Samsung XNS ActiveX SDK | 61


CHAPTER 2
XnsSdkDevice Control Module Information

long hDevice,
long nControlID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value
Number of control module.

Example
[C++]
long m_nNumber;
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);

for (int i=0; i<m_nControlCount; i++)


{
m_nNumber = m_ctlXnsDevice.GetControlNumber(m_hDevice, i);
}

See Also
GetControlCount, ControlID

GetControlDepth

Description
Returns the depth of control module corresponding to the control ID.

Syntax
long GetControlDepth(
long hDevice,
long nControlID
);

Samsung XNS ActiveX SDK | 62


CHAPTER 2
XnsSdkDevice Control Module Information

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value
Depth of the control module.

Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);

for (int i=0; i<m_nControlCount; i++)


{
m_nDepth[i] = m_ctlXnsDevice.GetControlDepth(m_hDevice, i);
}

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

Samsung XNS ActiveX SDK | 63


CHAPTER 2
XnsSdkDevice Control Module Information

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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

Samsung XNS ActiveX SDK | 64


CHAPTER 2
XnsSdkDevice Control Module Information

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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

[in] Device handle. This value is returned from CreateDevice().

Samsung XNS ActiveX SDK | 65


CHAPTER 2
XnsSdkDevice Control Module Information

nControlID

[in] Control ID.

nStatusID

[in] ID for each item of the status information (see Table 2-4).

Table 2-4 Status ID

Name ID Description

XCAMERA_STATUS 1 Displays On/Off of the camera.

XRECORDING_STATUS 2 Displays the recording status of the


device.

XLISTEN_STATUS 3 Displays the operation status of Listen.

XTALK_STATUS 4 Displays the operation status of Talk.

XALARM_STATUS 5 Displays the status of the alarm out port.

XLOCALREC_STATUS 6 Displays the recording status of the local


device.

Return Value
The returned value for each nStatusID using this function has the following meaning:

Table 2-5 Return Values of GetControlStatus()

Status ID Return Value

XCAMERA_STATUS XCAM_STATUS_ON (=0x00000001)

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

Samsung XNS ActiveX SDK | 66


CHAPTER 2
XnsSdkDevice Control Module Information

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:

Returned value Bit-wise ORing Meaning

16(0x10) XCAM_STATUS_ACTIVATED Connect, Video Off

17(0x11) XCAM_STATUS_ON | Connect, Video On, Media On /


XCAM_STATUS_ACTIVATED
Connect, Video On, VideoLoss

21(0x15) XCAM_STATUS_ON | Connect, Covert


XCAM_STATUS_COVERT1 |
XCAM_STATUS_ACTIVATED

Example
[C++]
long m_nControlCount = m_ctlXnsDevice.GetControlCount(m_hDevice, XCTL_ALL);

for (int i=0; i<m_nControlCount; i++)


{
nStatus = m_ctlXnsDevice.GetControlStatus(m_hDevice, i, XCAMERA_STATUS);
}

See Also
OnControlStatusChanged, ControlID

GetControlCapability

Description
Returns the capabilities of the control module.

Syntax

Samsung XNS ActiveX SDK | 67


CHAPTER 2
XnsSdkDevice Control Module Information

BOOL GetControlCapability(
long hDevice,
long nControlID,
long nCapabilityID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nCapabilityID

[in] Capability ID (see Table 2-6).

Table 2-6 Capability ID

Field Capability Description


ID

XCTL_CAP_NONE 0 Obsolete.

XCTL_CAP_SW_UPLOAD 1 Updates the device firmware remotely.

XCTL_CAP_CFG_IMPORT 2 Imports the configuration file of the


device.

XCTL_CAP_CFG_EXPORT 3 Exports the configuration file of the


device.

XCTL_CAP_CONN_FORCED 4 The admin account can forcibly log in.

XCTL_CAP_MEDIA_AUTHORITY 5 Gets the media authority.

XCTL_CAP_FSPEED1 6 Plays at x1.

XCTL_CAP_FSPEED2 7 Plays at x2.

XCTL_CAP_FSPEED4 8 Plays at x4.

XCTL_CAP_FSPEED8 9 Plays at x8.

XCTL_CAP_FSPEED16 10 Plays at x16.

XCTL_CAP_FSPEED32 11 Plays at x32.

XCTL_CAP_FSPEED64 12 Plays at x64.

XCTL_CAP_BSPEED1 13 Plays reversely at x1.

XCTL_CAP_BSPEED2 14 Plays reversely at x2.

Samsung XNS ActiveX SDK | 68


CHAPTER 2
XnsSdkDevice Control Module Information

XCTL_CAP_BSPEED4 15 Plays reversely at x4.

XCTL_CAP_BSPEED8 16 Plays reversely at x8

XCTL_CAP_BSPEED16 17 Plays reversely at x16.

XCTL_CAP_BSPEED32 18 Plays reversely at x32.

XCTL_CAP_BSPEED64 19 Plays reversely at x64.

XCTL_CAP_FSSPEED1 20 Plays at x1.

XCTL_CAP_FSSPEED2 21 Plays at 1/2.

XCTL_CAP_FSSPEED4 22 Plays at 1/4.

XCTL_CAP_FSSPEED8 23 Plays at 1/8.

XCTL_CAP_FSSPEED16 24 Plays at 1/16.

XCTL_CAP_FSSPEED32 25 Plays at 1/32.

XCTL_CAP_FSSPEED64 26 Plays at 1/64.

XCTL_CAP_BSSPEED1 27 Plays at x1.

XCTL_CAP_BSSPEED2 28 Plays reversely at 1/2.

XCTL_CAP_BSSPEED4 29 Plays reversely at 1/4.

XCTL_CAP_BSSPEED8 30 Plays reversely at 1/8.

XCTL_CAP_BSSPEED16 31 Plays reversely at 1/16.

XCTL_CAP_BSSPEED32 32 Plays reversely at 1/32.

XCTL_CAP_BSSPEED64 33 Plays reversely at 1/64.

XCTL_CAP_SEEK 34 Seek.

XCTL_CAP_FSTEP 35 Forward.

XCTL_CAP_BSTEP 36 Rewind.

XCTL_CAP_LIVE 37 Displays video in real time.

XCTL_CAP_PLAYBACK 38 Plays video.

XCTL_CAP_BACKUP 39 Video backup.

XCTL_CAP_SEARCH 40 Video search.

XCTL_CAP_LISTEN 41 Listen.

XCTL_CAP_TALK 42 Talk.

XCTL_CAP_CAM_MENU 43 Control the camera menus on the


screen.

XCTL_CAP_PTZ_PAN 44 Control the pan operation.

Samsung XNS ActiveX SDK | 69


CHAPTER 2
XnsSdkDevice Control Module Information

XCTL_CAP_PTZ_TILT 45 Control the tilt operation.

XCTL_CAP_PTZ_ZOOM 46 Control the zooming operation.

XCTL_CAP_PTZ_SPEED 47 Control PTZ according to the speed.

XCTL_CAP_PTZ_PRESET 48 Preset (HPTZ).

XCTL_CAP_PTZ_PRESET_SVR 49 Preset for SVR

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

XCTL_CAP_PTZ_POWER 55 Power PTZ (PPTZ).

XCTL_CAP_PTZ_FREE_MOVE 56 Control PTZ operations.

XCTL_CAP_PTZ_SPEED_ZOOM 57 move PTZ according to the speed.

XCTL_CAP_CAM_IRIS 58 Iris open/close.

XCTL_CAP_CAM_FOCUS 59 Focus in/out.

XCTL_CAP_CAM_BRIGHTNESS 60 Adjust the brightness.

XCTL_CAP_CAM_CONTRAST 61 Adjust the contrast.

XCTL_CAP_ALARM_ONOFF 62 Turn on/off the alarm out.

XCTL_CAP_DVR_EVENT_RESET 63 Event reset of DVR

XCTL_CAP_DVR_MANUAL_REC_CO 64 Manural recording of DVR


NTROL

XCTL_CAP_DVR_REC_STATUS 65 Recording status of DVR

XCTL_CAP_MOTION_SEARCH 66 Motion event search

XCTL_CAP_PTZ_AREA_ZOOM 67 Area Zoom function

XCTL_CAP_PTZ_GET_POS 68 Get absolute coordinate of camera

XCTL_CAP_PTZ_SET_POS 69 Set absolute coordinate of camera

XCTL_CAP_OVERLAP_TRACK_SEAR 70 Search time overlapped section


CH

XCTL_CAP_POS_SEARCH 71 Search POS

XCTL_CAP_PTZ_GET_POS_SPEED 72 Get speed for PTZ (abs coordinate)

XCTL_CAP_PTZ_SET_POS_SPEED 73 Set speed for PTZ(abs coordinate)

XCTL_CAP_POWER_RESTART 74 Restart device

Samsung XNS ActiveX SDK | 70


CHAPTER 2
XnsSdkDevice Control Module Information

Return Value
Informs if the device provides the capability corresponding to the capability ID.

• TRUE: The device provides the corresponding capability.

• FALSE: The device does not provide the corresponding capability.

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(

Samsung XNS ActiveX SDK | 71


CHAPTER 2
XnsSdkDevice Control Module Information

long hDevice,
long nControlID,
BSTR szName
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

szName

[in] New name. The maximum length allowed is 127-byte.

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
);

Samsung XNS ActiveX SDK | 72


CHAPTER 2
XnsSdkDevice Control Module Information

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nCameraIndex

[in] Number of Camera module.

nVideoIndex

[in] Number of Video module.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Samsung XNS ActiveX SDK | 73


CHAPTER 2
XnsSdkDevice Control Module Information

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

pnVideoWidth
[out] The width of the video resolution.

pnVideoHeight
[out] The height of the video resolution.

Return Value

• ERR_SUCCESS: Function successfully performed.

Samsung XNS ActiveX SDK | 74


CHAPTER 2
XnsSdkDevice Control Module Information

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value
Video frame rate of control module.

Example
[C++]
long nFrameRate = 0;
nFrameRate = m_ctlXnsDevice.GetVideoFrameRate(m_hDevice, m_nControlID);

See Also
ControlID

Samsung XNS ActiveX SDK | 75


CHAPTER 2
XnsSdkDevice Control Module Information

GetVideoQuality

Description
Ruterns the video quality of control module corresponding to the control ID.

Syntax
long GetVideoQuality(
long hDevice,
long nControlID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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

Samsung XNS ActiveX SDK | 76


CHAPTER 2
XnsSdkDevice Start/End to Play Media

BSTR GetVideoCodec(
long hDevice,
long nControlID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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

Start/End to Play Media

Samsung XNS ActiveX SDK | 77


CHAPTER 2
XnsSdkDevice Start/End to Play Media

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NOT_SUPPORTED_COMMAND: Command not supported.

• ERR_NO_PERMISSION: No permission granted.

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);

Samsung XNS ActiveX SDK | 78


CHAPTER 2
XnsSdkDevice Start/End to Play Media

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

Samsung XNS ActiveX SDK | 79


CHAPTER 2
XnsSdkDevice Start/End to Play Media

);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID of video control module.

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• 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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

• ERR_MEDIA_ALREADY_OPEND: Media already opened.

Example
[C++]
long m_pMediaLiveSource;
long ret;

ret = m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);

Samsung XNS ActiveX SDK | 80


CHAPTER 2
XnsSdkDevice Start/End to Play Media

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

- XMEDIA_LIVE (=1): Live

- XMEDIA_PLAYBACK (=2): Playback

- XMEDIA_BACKUP (=3): Backup replay (saves stream data to 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
Handle of media stream. Returns ‘0’ when failed.

Samsung XNS ActiveX SDK | 81


CHAPTER 2
XnsSdkDevice Start/End to Play Media

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

[in] Device handle. This value is returned from CreateDevice().

hMediaSource

[in] Media stream ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

Example
[C++]
long ret;
long m_pMediaLiveSource;
ret = m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);

Samsung XNS ActiveX SDK | 82


CHAPTER 2
XnsSdkDevice Start/End to Play Media

// Write your code


// ...

ret = m_ctlXnsDevice.CloseMedia(m_hDevice, 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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID of video control module.

nType

[in] Media type

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Samsung XNS ActiveX SDK | 83


CHAPTER 2
XnsSdkDevice Start/End to Play 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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

• ERR_MEDIA_ALREADY_OPEND: Media already opened.

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

[in] Device handle. This value is returned from CreateDevice().

Samsung XNS ActiveX SDK | 84


CHAPTER 2
XnsSdkDevice Start/End to Play Media

nControlID

[in] Control ID of video control module.

nType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

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

[in] Device handle. This value is returned from CreateDevice().

Samsung XNS ActiveX SDK | 85


CHAPTER 2
XnsSdkDevice Start/End to Play Media

nControlID

[in] Control ID of video control module.

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

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

[in] Device handle. This value is returned from CreateDevice().

nMediaType

Samsung XNS ActiveX SDK | 86


CHAPTER 2
XnsSdkDevice Start/End to Play Media

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID of video control module.

Samsung XNS ActiveX SDK | 87


CHAPTER 2
XnsSdkDevice Start/End to Play Media

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

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

[in] Device handle. This value is returned from CreateDevice().

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

Samsung XNS ActiveX SDK | 88


CHAPTER 2
XnsSdkDevice Start/End to Play Media

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

Return Value

• ERR_SUCCESS: Function successfully performed.

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• TRUE: The multimedia file is playing now.

• FALSE: The multimedia file is not playing now.

Example
[C++]
if (!m_ctlXnsDevice.IsPlaying(m_hDevice))
{
m_ctlXnsDevice.Play(m_hDevice, 2, 1.0);
}

Samsung XNS ActiveX SDK | 89


CHAPTER 2
XnsSdkDevice Start/End to Play Media

See Also
Play

HasAuthority

Description
Confirms if the application has the permission to play the multimedia file.

Syntax
BOOL HasAuthority(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• TRUE: Play permission obtained.

• FALSE: Play permission not obtained.

Example
[C++]
long ret;
ret = m_ctlXnsDevice.GetControlCapability(m_hDevice, 1, XCTL_CAP_MEDIA_AUTHORITY);

DisplayErrCode("Check cap of MEDIA_AUTHORITY ", ret);


if (ret)
{
ret = m_ctlXnsDevice.HasAuthority(m_hDevice);
DisplayErrCode("HasAuthority", ret);
if (ret)
{
ret = m_ctlXnsDevice.AcquireMediaAuthority(m_hDevice);
DisplayErrCode("AcquireMediaAuthority", ret);
}
}

Samsung XNS ActiveX SDK | 90


CHAPTER 2
XnsSdkDevice Start/End to Play Media

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID of video control module.

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

bFlag

[in] 1 means activation, 0 means deactivation

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

Samsung XNS ActiveX SDK | 91


CHAPTER 2
XnsSdkDevice PlayControl

• ERR_NOT_CONNECT: Device not connected.

Example
[C++]
long ret;

ret = m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);


ret = m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, TRUE);

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

Samsung XNS ActiveX SDK | 92


CHAPTER 2
XnsSdkDevice PlayControl

hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

dSpeed

[in] Play speed.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

Samsung XNS ActiveX SDK | 93


CHAPTER 2
XnsSdkDevice PlayControl

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

tPos

[in] Target time. Format: 4-byte time_t.

Samsung XNS ActiveX SDK | 94


CHAPTER 2
XnsSdkDevice PlayControl

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nDelta

[in] Number of frames to skip. If the value is less than 0, it will get the previous frame.

Return Value

Samsung XNS ActiveX SDK | 95


CHAPTER 2
XnsSdkDevice PlayControl

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

tStart

[in] First day of a specific month. Format: 4-byte time_t.

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.

Samsung XNS ActiveX SDK | 96


CHAPTER 2
XnsSdkDevice PlayControl

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

tStart

Samsung XNS ActiveX SDK | 97


CHAPTER 2
XnsSdkDevice PlayControl

[in] Search start time. Format: UTC time_t.

tEnd

[in] Search end time. Format: UTC time_t.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2012, 9, 04, 0, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2012, 9, 04, 23, 59, 59);

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tEnd);

long ret = m_ctlXnsDevice.SearchOverLap(m_hDevice, tUTCStart, tUTCEnd);

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,
);

Samsung XNS ActiveX SDK | 98


CHAPTER 2
XnsSdkDevice PlayControl

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

Example
[C++]
long ret = m_ctlXnsDevice.GetStartRecordingTime(m_hDevice);

DisplayErrCode("GetStartRecordingTime ", ret);

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

Samsung XNS ActiveX SDK | 99


CHAPTER 2
XnsSdkDevice PlayControl

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

Example
[C++]
long ret = m_ctlXnsDevice.GetEndRecordingTime(m_hDevice);

DisplayErrCode("GetEndRecordingTime ", ret);

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

tStart

[in] Play start time. Format: UTC time_t.

tEnd

Samsung XNS ActiveX SDK | 100


CHAPTER 2
XnsSdkDevice PlayControl

[in] Play end time. Format: UTC time_t.

nRecType

[in] Recording type.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long tStart = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 0, 0, 0);
long tEnd = m_ctlXnsDevice.DateToTimet(2010, 9, 06, 23, 59, 59);

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tEnd);

long ret = m_ctlXnsDevice.SearchDay(m_hDevice, 2, tUTCStart, tUTCEnd, REC_TYPE_ALL);

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,

Samsung XNS ActiveX SDK | 101


CHAPTER 2
XnsSdkDevice PlayControl

);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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,

Samsung XNS ActiveX SDK | 102


CHAPTER 2
XnsSdkDevice PlayControl

long nGridWidth,
long nGridHeight,
long pGridArray
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

tStart

[in] Search start time. Format: UTC time_t.

tEnd

[in] Search end time. Format: UTC time_t.

nGridWidth

[in] The number of Grid width(64 as maximum).

nGridHeight

[in] The number of Grid heigth(64 as maximum).

pGridArray

[in] The number of nGridWidth X nGridHeight equals to array value of 'char'(64 x 64 as


maximum). Marking ‘1’ If you want to search.

Ex) In case of pGridArray in 3 x 3, screen range of Grid is below as it is

[0][0] [0][1] [0][2]

[1][0] [1][1] [1][2]

[2][0] [2][1] [2][2]

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Samsung XNS ActiveX SDK | 103


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

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];

for(int i = 0; i < m_nGridHeight; i++)


{
for(int j = 0; j < m_nGridWidth; j++)
{
m_pGridArray[i][ j] = ‘1’;
}
}

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tEnd);

long ret = m_ctlXnsDevice.MotionSearch(m_hDevice, 2, tUTCStart, tUTCEnd, m_nGridWidth,


m_nGridHeight, (long)m_pGridArray);

DisplayErrCode("MotionSearch", ret);

See Also
OnMotionSearch, GetMotionGrid, OnGetMotionGrid, DateToTimet, SearchCalendar,

LocalTimeToDeviceUTC, ControlID

Control Audio and Alarm-out

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

Samsung XNS ActiveX SDK | 104


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

bState

[in] Talk is activated.

• 1: Start Talk (on)

• 0: End Talk (off)

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long ret = m_ctlXnsDevice.SetTalk(m_hDevice, 2, 1);

See Also
SetListen, SendAudioData, SendAudioData2, ControlID

SetListen

Samsung XNS ActiveX SDK | 105


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1) : Live.

• XMEDIA_PLAYBACK (=2) : Playback.

bState

[in] Listen is activated.

• 1: enable Listen icon

• 0: disable Listen icon

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example

Samsung XNS ActiveX SDK | 106


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

[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

[in] Device handle. This value is returned from CreateDevice().

hData

[in] Pointer to indicate the memory where the audio data is stored.

nDataSize

[in] Length of the audio data to transfer.

nTimeStamp

[in] Frame play time. (Unit: millisecond)

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Samsung XNS ActiveX SDK | 107


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long ret = m_ctlXnsDevice.SendAudioData2(m_hDevice, nControlID);

See Also

Samsung XNS ActiveX SDK | 108


CHAPTER 2
XnsSdkDevice Control Audio and Alarm-out

SetTalk, StopAudioData2

StopAudioData2

Description
Stops SendAudioData2 function.

Syntax
long StopAudioData2( long hDevice );

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

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

Samsung XNS ActiveX SDK | 109


CHAPTER 2
XnsSdkDevice Control PTZ

);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

bState

[in] Status of the alarm device.

• 1: Alarm-out device on.

• 0: Alarm-out device off.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long ret = m_ctlXnsDevice.SetAlarm(m_hDevice, 30, 1);

See Also
ControlID

Control PTZ

ControlPtz

Description

Samsung XNS ActiveX SDK | 110


CHAPTER 2
XnsSdkDevice Control PTZ

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nPtzCommand

[in] PTZ command (see Table 2-7).

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.

Table 2-7 PTZ Command

Command Value Description

XPTZ_UP 1 Tilt up

XPTZ_DOWN 2 Tilt down

XPTZ_LEFT 3 Pan left

XPTZ_RIGHT 4 Pan right

XPTZ_UPLEFT 5 Tilt up and pan left

XPTZ_UPRIGHT 6 Tilt up and pan right

XPTZ_DOWNLEFT 7 Tilt down and pan left

XPTZ_DOWNRIGHT 8 Tilt down and pan right

XPTZ_ZOOMIN 9 Zoom in

XPTZ_ZOOMOUT 10 Zoom out

Samsung XNS ActiveX SDK | 111


CHAPTER 2
XnsSdkDevice Control PTZ

XPTZ_STOP 11 Stop the PTZ moving

XPTZ_FOCUS_NEAR 12 Focus near

XPTZ_FOCUS_FAR 13 Focus far

XPTZ_FOCUS_STOP 14 Stop focus moving

XPTZ_IRIS_OPEN 15 Open iris

XPTZ_IRIS_CLOSE 16 Close iris

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict when in PTZ operation.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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,

Samsung XNS ActiveX SDK | 112


CHAPTER 2
XnsSdkDevice Control PTZ

long nControlID,
long nX,
long nY
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

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

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict when in PTZ operation.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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.

Samsung XNS ActiveX SDK | 113


CHAPTER 2
XnsSdkDevice Control PTZ

Syntax
long ControlPtzSpeedZoomIn(
long hDevice,
long nControlID,
long nSpeed
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nSpeed
[in] Zoom speed. Range of this parameter is from 1 to 100, which larger value means faster
speed.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict when in PTZ operation.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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.

Samsung XNS ActiveX SDK | 114


CHAPTER 2
XnsSdkDevice Control PTZ

Syntax
long ControlPtzSpeedZoomOut(
long hDevice,
long nControlID,
long nSpeed
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nSpeed

[in] Zooming speed. The value is between 1 and 4. The greater the value, the faster the speed.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict when in PTZ operation.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

Samsung XNS ActiveX SDK | 115


CHAPTER 2
XnsSdkDevice Control PTZ

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nX

[in] X-axis movement. The value is between 0 and 640.

nY

[in] Y-axis movement. The value is between 0 and 480.

nZ

[in] Zoom factor.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict when in PTZ operation.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example

Samsung XNS ActiveX SDK | 116


CHAPTER 2
XnsSdkDevice Control PTZ

[C++]
BOOL bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_PTZ_POWER);
DisplayLong("GetPtz XCTL_CAP_PTZ_POWER Cap", bIsCap);

long nErrCode = m_ctlXnsDevice.ControlPPtz(m_hDevice, 2, 50, 50, 2);


DisplayErrCode("OnPowerPtz", nErrCode);

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nMenuCommand

[in] Command to control the OSD menus (see Table 2-8).

Table 2-8 Menu Control Command

Command Value Description

XMENU_UP 1 Menu up.

XMENU_DOWN 2 Menu down.

Samsung XNS ActiveX SDK | 117


CHAPTER 2
XnsSdkDevice Control PTZ

XMENU_LEFT 3 Menu left or prev menu.

XMENU_RIGHT 4 Menu right or next menu.

XMENU_ENTER 5 Menu enter, select.

XMENU_ON 6 Menu on.

XMENU_OFF 7 Menu off.

XMENU_CANCEL 8 Cancel (Changes are not saved).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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);

long nErrCode = m_ctlXnsDevice.ControlMenu(m_hDevice, 2, XMENU_ENTER);


DisplayErrCode("OnPtzMenuEnter", nErrCode);

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

Samsung XNS ActiveX SDK | 118


CHAPTER 2
XnsSdkDevice Control PTZ

long ExecuteHPtz(
long hDevice,
long nControlID,
long nType,
long nNumber
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nType

[in] Camera operations.

• 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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
BOOL bIsCap = m_ctlXnsDevice.GetControlCapability(m_hDevice, 2, XCTL_CAP_PTZ_SCAN);

Samsung XNS ActiveX SDK | 119


CHAPTER 2
XnsSdkDevice Control PTZ

DisplayLong("GetPtz XCTL_CAP_PTZ_SCAN Cap", bIsCap);

long nErrCode = m_ctlXnsDevice.ExecuteHPtz(m_hDevice, 2, XHPTZ_SCAN, 1);


DisplayErrCode("OnScan", nErrCode);

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example

Samsung XNS ActiveX SDK | 120


CHAPTER 2
XnsSdkDevice Control PTZ

[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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nNumber

[in] Preset number to save (start with 1).

szName

[in] Preset name. The camera will save the name including the preset position (English only).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Samsung XNS ActiveX SDK | 121


CHAPTER 2
XnsSdkDevice Control PTZ

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

nNumber

[in] Preset number to delete (start with 0).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example

Samsung XNS ActiveX SDK | 122


CHAPTER 2
XnsSdkDevice Control PTZ

[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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long nErrCode = m_ctlXnsDevice.DeletePresetAll(m_hDevice, 2);

See Also

Samsung XNS ActiveX SDK | 123


CHAPTER 2
XnsSdkDevice Control PTZ

DeletePreset, DeletePresetAll, ControlID

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);

Samsung XNS ActiveX SDK | 124


CHAPTER 2
XnsSdkDevice Control PTZ

for(int i=0; i<nPresetCount; i++)


{
strPresetName = m_ctlXnsDevice.GetPreset(hPresetListList, i, &nNumber);
sprintf(str, "PresetName[%s], nPresetNumber[%d]\n", strPresetName,
nNumber);
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

[out] Preset index specified in XnsSdkDevice.

Return Value
Preset name specified in the camera.

Samsung XNS ActiveX SDK | 125


CHAPTER 2
XnsSdkDevice Control PTZ

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);

for(int i=0; i<nPresetCount; i++)


{
strPresetName = m_ctlXnsDevice.GetPreset(hPresetListList, i, &nNumber);
sprintf(str, "PresetName[%s], nPresetNumber[%d]\n", strPresetName,
nNumber);
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.

Samsung XNS ActiveX SDK | 126


CHAPTER 2
XnsSdkDevice Control PTZ

Syntax
long GetPtzPos(
long hDevice,
long nControlID
);

Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().

nControlID
[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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,

Samsung XNS ActiveX SDK | 127


CHAPTER 2
XnsSdkDevice Control PTZ

long nControlID,
long nPan,
long nTilt,
long nZoom
);

Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().

nControlID
[in] Control ID.

nPan

[in] absolute coordinate of Pan.

nTilt

[in] absolute coordinate of Tilt.

nZoom

[in] absolute coordinate of Zoom.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

Samsung XNS ActiveX SDK | 128


CHAPTER 2
XnsSdkDevice Control PTZ

OnGetPtzPos, GetPtzPos, ControlID

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

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
m_ctlXnsDevice.GetPtzPosNormalize(m_hDevice, 2);

See Also
OnGetPtzPosNormalize, SetPtzPosNormalize, ControlID

SetPtzPosNormalize

Samsung XNS ActiveX SDK | 129


CHAPTER 2
XnsSdkDevice Control PTZ

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

[in] coordinate of Pan.

fTilt

[in] coordinate of Tilt.

fZoom

[in] coordinate of Zoom.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Example
[C++]
long nRet = m_ctlXnsDevice.SetPtzPosNormalize(m_hDevice, 2, m_fPan, m_fTilt, m_fZoom);

Samsung XNS ActiveX SDK | 130


CHAPTER 2
XnsSdkDevice Control PTZ

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

[in] Start X-coordinate.

Samsung XNS ActiveX SDK | 131


CHAPTER 2
XnsSdkDevice Control PTZ

nStartY

[in] Start Y-coordinate.

nEndX

[in] End X-coordinate.

nEndY

[in] End Y-coordinate.

nWindowWidth

[in] Width of window control.

nWindowHeight

[in] Height of window control.

nImageWidth

[in] Width of playback image resolution.

nImageHeight

[in] Height of playback image resolution.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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;
}

void CMy01_LiveDlg::OnLButtonUpXnssdkwindowctrl(long nFlags, long nX, long nY)


{
long nImageWidth = m_ctlXnsWindow[0].GetImageWidth();

Samsung XNS ActiveX SDK | 132


CHAPTER 2
XnsSdkDevice Control PTZ

long nImageHeight = m_ctlXnsWindow[0].GetImageHeight();

CRect rt;
m_ctlXnsWindow[0].GetClientRect(rt);
long nWindowWidth = rt.Width();
long nWindowHeight = rt.Height();

m_nEndX = nX;
m_nEndY = nY;

WIN_LOG(_T("On LButtonUp XNSWindow1 flag=%d, x=%d, y=%d, imagew=%d,


imgaeh=%d, windoww=%d, windowh=%d"),
nFlags, nX, nY, nImageWidth, nImageHeight, nWindowWidth, nWindowHeight);

long nRet = m_ctlXnsDevice.AreaZoom(m_hDevice, 2, m_nStartX, m_nStartY,


m_nEndX, m_nEndY,
nWindowWidth, nWindowHeight,
nImageWidth, nImageHeight);

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,

Samsung XNS ActiveX SDK | 133


CHAPTER 2
XnsSdkDevice Timeline

long nControlID,
);

Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().

nControlID
[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_PTZ_CONFLICT: Conflict occurs during PTZ control.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

Samsung XNS ActiveX SDK | 134


CHAPTER 2
XnsSdkDevice Timeline

GetCameraCount

Description
Returns the number of cameras existing in the timeline.

Syntax
long GetCameraCount(long hTimeline);

Parameters
hTimeline

[in] Timeline handle obtained from the OnSearchDay event.

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

Samsung XNS ActiveX SDK | 135


CHAPTER 2
XnsSdkDevice Timeline

functions: GetStartTime(), GetEndTime(), GetRecordingType().

Syntax
long GetTimelineCount(
long hTimeline,
long nCameraIndex
);

Parameters
hTimeline

[in] Timeline handle obtained from the OnSearchDay event.

nCameraIndex

[in] Index of camera list obtained through calling GetCameraCount().

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;

OutputDebugString("<On UTC time>");


for(int i=0; i<TimelineCount; i++)

Samsung XNS ActiveX SDK | 136


CHAPTER 2
XnsSdkDevice Timeline

{
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);
// ...
}

OutputDebugString("<On Local time>");


for(i=0; i<TimelineCount; i++)
{
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,

Samsung XNS ActiveX SDK | 137


CHAPTER 2
XnsSdkDevice Timeline

long* ptEnd,
long* pnRecType,
long* pnRecID
);

Parameters
hTimeline

[in] Timeline handle obtained from the OnSearchDay event.

nCameraIndex

[in] Camera index (start with 0).

nTimelineIndex

[in] Timeline index (start with 0).

nType

[in] Time type.

• 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

[out] Start time of the timeline block.

ptEnd

[out] End time of the timeline block.

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.

Table 2-9 Recording Type

Name Value Description

REC_TYPE_NONE 0x00 Not displayed.

REC_TYPE_MOTION 0x01 Motion Event recording.

REC_TYPE_ALARM 0x02 Sensor Event recording.

REC_TYPE_VLOSS 0x04 Video loss event recording.

REC_TYPE_MANUAL 0x08 Manual recording.

Samsung XNS ActiveX SDK | 138


CHAPTER 2
XnsSdkDevice Timeline

REC_TYPE_CONTINOUS 0x10 Schedule recording.

REC_TYPE_ALL 0xFF All types.

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;

OutputDebugString("<On UTC time>");


for(int i=0; i<TimelineCount; i++)
{
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);
// ...
}

OutputDebugString("<On Local time>");


for(i=0; i<TimelineCount; i++)
{

Samsung XNS ActiveX SDK | 139


CHAPTER 2
XnsSdkDevice Recording

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, 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

[in] Device handle. This value is returned from CreateDevice().

nControlID

Samsung XNS ActiveX SDK | 140


CHAPTER 2
XnsSdkDevice Recording

[in] Control ID.

szFile

[in] File name of the recording data to save.

nFileType

[in] File format.

• SEC_WRITER (1): Video stream including a mini player.

• 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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_ALREADY_RUN: Already in process.

• ERR_FILE_ALREADY_OPEND: File already opened.

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

Samsung XNS ActiveX SDK | 141


CHAPTER 2
XnsSdkDevice Recording

);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Samsung XNS ActiveX SDK | 142


CHAPTER 2
XnsSdkDevice Recording

szFile

[in] File name of the recording data to save.

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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_ALREADY_RUN: Already in process.

• ERR_FILE_ALREADY_OPEND: File already opened.

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

Samsung XNS ActiveX SDK | 143


CHAPTER 2
XnsSdkDevice Recording

hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Samsung XNS ActiveX SDK | 144


CHAPTER 2
XnsSdkDevice Backup

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

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

szFile

[in] Backup file name.

nFileType

Samsung XNS ActiveX SDK | 145


CHAPTER 2
XnsSdkDevice Backup

[in] Format of backup file.

Value Description When to create

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

REC_WRITER = 2 SEC format. This type of Every 1 Hr


files could be played (When D1 and 30 fps video, data size is
back using Samsung 600MB after 1 Hr backup)
XNS ActiveX.

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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

• ERR_MEDIA_ALREADY_OPEND: Media already opened.

• ERR_FILE_ALREADY_OPEND: File already opened.

• ERR_ALREADY_RUN Already in process.

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);

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_pParent->m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_pParent->m_hDevice, tEnd);

Samsung XNS ActiveX SDK | 146


CHAPTER 2
XnsSdkDevice Backup

long errCode = m_ctlXnsDevice.StartBackup(m_hDevice, 2, strFile, REC_WRITER, tStart, tEnd);

See Also
StopBackup, , ControlID

StopBackup

Description
Stops backup.

Syntax
long StopBackup(long hDevice, long nControlID);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

Example
[C++]
long errCode = m_ctlXnsDevice.StopBackup(m_hDevice, 2);

See Also
StartBackup

StartAviBackup

Description
Starts Avi backup.

Samsung XNS ActiveX SDK | 147


CHAPTER 2
XnsSdkDevice Backup

Syntax
long StartAviBackup(
long hDevice,
long nControlID,
LPCTSTR szFile,
long tStart,
long tEnd
long nTrackID
);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Backup file name.

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

[in] Overlapped track ID.(default: : -1)

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

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

Samsung XNS ActiveX SDK | 148


CHAPTER 2
XnsSdkDevice Backup

• ERR_MEDIA_ALREADY_OPEND: Media already opened.

• ERR_FILE_ALREADY_OPEND: File already opened.

• ERR_ALREADY_RUN Already in process.

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);

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_hDevice, tEnd);

long errCode = m_ctlXnsDevice.StartAviBackup(m_hDevice, 2, strFile, tUTCStart, tUTCEnd, -1);

See Also
StopAviBackup, ControlID

StopAviBackup

Description
Stops Avi backup.

Syntax
long StopAviBackup(long hDevice, long nControlID);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

Return Value

• ERR_SUCCESS: Function successfully performed.

Samsung XNS ActiveX SDK | 149


CHAPTER 2
XnsSdkDevice Backup

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 );

Samsung XNS ActiveX SDK | 150


CHAPTER 2
XnsSdkDevice Backup

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

Samsung XNS ActiveX SDK | 151


CHAPTER 2
XnsSdkDevice Backup

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

Samsung XNS ActiveX SDK | 152


CHAPTER 2
XnsSdkDevice Backup

[in] Device handle. This value is returned from CreateDevice().

nControlID

[in] Control ID.

szFile

[in] Backup file name.

nFileType
[in] Format of backup file.

Value Description When to create

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

[in] Duplicate section ID(default : -1).

szPassword

[in] Password to play a backup file.

Note
The mini player will be saved in the same folder when the backup is finished.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_PARAMETER: Invalid parameter.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

• ERR_MEDIA_ALREADY_OPEND: Media already opened.

• ERR_FILE_ALREADY_OPEND: File already opened.

• ERR_ALREADY_RUN: Already in process.

Example

Samsung XNS ActiveX SDK | 153


CHAPTER 2
XnsSdkDevice Backup

[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);

long tUTCStart = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_pParent->m_hDevice, tStart);


long tUTCEnd = m_ctrlXnsSdkDevice.LocalTimeToDeviceUTC(m_pParent->m_hDevice, tEnd);

long errCode = m_ctlXnsDevice.StartSecBackup(m_hDevice, 2, strFile, REC_WRITER, tStart, tEnd,


-1, “password”);

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

[in] File name to play. The maximum length allowed is 260-byte.

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

Samsung XNS ActiveX SDK | 154


CHAPTER 2
XnsSdkDevice Backup

ReleaseFileReader, GetMediaSource, GetFileName, GetTimelineHandle, PlayReader, PauseReader

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

Samsung XNS ActiveX SDK | 155


CHAPTER 2
XnsSdkDevice Backup

Name and saving path of the file pointed by hReader.

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

Samsung XNS ActiveX SDK | 156


CHAPTER 2
XnsSdkDevice Backup

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().

Samsung XNS ActiveX SDK | 157


CHAPTER 2
XnsSdkDevice Backup

dSpeed

[in] Play speed.

Return Value

• ERR_SUCCESS: Function successfully performed.

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

• ERR_SUCCESS: Function successfully performed.

Example
[C++]
// m_hFileReader is returned from CreateFileReader().
long nErrCode = m_ctlXnsDevice.PauseReader(hFileReader);

See Also
CreateFileReader, PlayReader

Samsung XNS ActiveX SDK | 158


CHAPTER 2
XnsSdkDevice Backup

ConvertRec2Avi

Description
Creates the file reader. The file reader is used to play backup or recoding data.

Syntax
long ConvertRec2Avi(LPCTSTR szFile);

Parameters
szFile

[in] File name to convert. The maximum length allowed is 260-byte.

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 ().

Samsung XNS ActiveX SDK | 159


CHAPTER 2
XnsSdkDevice Update Firmware and Import/Export Configuration

Example
[C++]
// m_hFileHandle is returned from ConvertRec2Avi().
m_ctlXnsDevice.StopRec2Avi (hFileHandle);

See Also
ConvertRec2Avi

Update Firmware and Import/Export


Configuration

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

[in] Device handle. This value is returned from CreateDevice().

szFile

[in] Firmware file name. The maximum length allowed is 1024-byte.

Samsung XNS ActiveX SDK | 160


CHAPTER 2
XnsSdkDevice Update Firmware and Import/Export Configuration

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

szFile

[in] Name of configuration file to import.

Samsung XNS ActiveX SDK | 161


CHAPTER 2
XnsSdkDevice Update Firmware and Import/Export Configuration

bWithNetSetting

[in] Informs if the configuration file includes information on the network settings.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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

[in] Device handle. This value is returned from CreateDevice().

szFile

Samsung XNS ActiveX SDK | 162


CHAPTER 2
XnsSdkDevice Device Profile

[in] Name of the configuration file to export to the device.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_CONNECT: Device not connected.

• ERR_NO_PERMISSION: No permission granted.

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:

Table 2-10 Device Information in device.xml

Field Description

VENDORNAME String. Max 127 bytes.

MODELNAME String. Max 127 bytes.

ADDRESSTYPE Address type to connect to the device.

ADDRESS String. Max 255 bytes. Address to connect to the device.

PORT Port number to connect to the device.

Samsung XNS ActiveX SDK | 163


CHAPTER 2
XnsSdkDevice Device Profile

HTTPPORT Http port number to connect to the device.

USERID User ID to log-in to the device.

PASSWORD Password to log-in to the device.

LATESTUPDATE Latest update time. time_t format.

CONTROLNAME Control Names and Devices name.

Syntax
long LoadDeviceProfile(long hDevice);

Parameters
hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_CFG_FILE: Invalid Xns.xml file.

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

Samsung XNS ActiveX SDK | 164


CHAPTER 2
XnsSdkDevice Device Profile

hDevice

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_CFG_FILE: Invalid Xns.xml file.

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

[in] Device handle. This value is returned from CreateDevice().

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_INVALID_CFG_FILE: Invalid Xns.xml file.

Example
[C++]
// m_hDevice is returned from CreateDevice().

Samsung XNS ActiveX SDK | 165


CHAPTER 2
XnsSdkDevice XML File

long nErrCode = m_ctlXnsDevice.DeleteDeviceProfile(m_hDevice);


DisplayErrCode("DeleteDeviceProfile ", nErrCode);

See Also
CreateDevice, LoadDeviceProfile, SaveDeviceProfile

XML File

ReadConfigValue

Description
Reads a configuration value from config.xml.

Syntax
CString ReadConfigValue(LPCTSTR szKey);

Parameters
szKey

[in] Configuration item to read.

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

Samsung XNS ActiveX SDK | 166


CHAPTER 2
XnsSdkDevice XML File

WriteConfigValue

Description
Saves the configuration values in config.xml.

Syntax
BOOL WriteConfigValue(
LPCTSTR szKey,
LPCTSTR szValue
);

Parameters
szKey

[in] Configuration item.

szValue

[in] Configuration value corresponding to the configuration item.

Return Value
If performed successfully, it will return TRUE. Otherwise, it will return FALSE as below:

• If config.xml does not exist.

• If the XROOT item does not exist.

• If failed to add a key.

• If failed to set the value.

Example
[C++]
BOOL bSave = m_ctlXnsDevice.WriteConfigValue(“aspectratio”, “true”);

See Also
ReadConfigValue, DeleteConfigValue

DeleteConfigValue

Description

Samsung XNS ActiveX SDK | 167


CHAPTER 2
XnsSdkDevice XML File

Deletes a specific configuration item from config.xml.

Syntax
void DeleteConfigValue(LPCTSTR szKey);

Parameters
szKey

[in] Configuration item to delete.

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

[in] File name to copy (source file).

szKey1

[in] Configuration item to copy.

szFile2

Samsung XNS ActiveX SDK | 168


CHAPTER 2
XnsSdkDevice Miscellaneous

[in] File name copied (destination file).

szKey2

[in] Configuration item copied in szFile2.

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

[in] Configuration item to search. The maximum length allowed is 63-byte.

Return Value
Handler for the search result.

Example
[C++]
Long hFind = m_ctlXnsDevice.FindConfigChildeKeyList(“ROOT”);

Miscellaneous

Samsung XNS ActiveX SDK | 169


CHAPTER 2
XnsSdkDevice 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);

Samsung XNS ActiveX SDK | 170


CHAPTER 2
XnsSdkDevice Miscellaneous

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

[in] Data in time_t format to convert.

pnYear

[out] Year

pnMonth

[out] Month

pnDay

[out] Day

pnHour

[out] Hour

pnMinute

[out] Minute

pnSecond

[out] Second

Samsung XNS ActiveX SDK | 171


CHAPTER 2
XnsSdkDevice Miscellaneous

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;

for(int i=0; i<TimelineCount; i++)


{
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
DateToTimet

LocalTimeToDeviceUTC

Description
Covert local time to UTC time.

Syntax

Samsung XNS ActiveX SDK | 172


CHAPTER 2
XnsSdkDevice Miscellaneous

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,

Samsung XNS ActiveX SDK | 173


CHAPTER 2
XnsSdkDevice Miscellaneous

);

Parameters
hDevice
[in] Device handle. This value is returned from CreateDevice().

tUTC

[in] UTC time_t value.

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

[in] Duration of receiving the device information (Unit: second).

Samsung XNS ActiveX SDK | 174


CHAPTER 2
XnsSdkDevice Miscellaneous

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

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

[in] Vendor name. Fixed to 'Samsung'.

szModelName

[in] Model name. Obsolete.

Samsung XNS ActiveX SDK | 175


CHAPTER 2
XnsSdkDevice Miscellaneous

szIP

[in] IP address. The maximum length allowed is 256-byte.

szSubnetMask

[in] Subnet mask. The maximum length allowed is 256-byte.

szGateway

[in] Gateway. The maximum length allowed is 256-byte.

szMac

[in] MAC address. Fixed to 12 characters.

nPort

[in] Port number of device.

nHttpPort

[in] HTTP port number.

szPassword

[in] Password required for login as admin.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

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

Samsung XNS ActiveX SDK | 176


CHAPTER 2
XnsSdkDevice Miscellaneous

long IPInstallDhcp(
LPCTSTR szVendorName,
LPCTSTR szModelName,
LPCTSTR szMac,
long nPort,
long nHttpPort,
LPCTSTR szPassword
);

Parameters
szVendorName

[in] Vendor name. Fixed to 'Samsung'.

szModelName

[in] Model name. Obsolete.

szMac

[in] MAC address. Fixed to 12 characters.

nPort

[in] Port number of device.

nHttpPort

[in] HTTP port number.

szPassword

[in] Password required for login as admin.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

Example
[C++]
long nErrCode = m_ctlXnsDevice.IpInstallDhcp(“Samsung”, “SNB-5000”, “00166cabcdef”, 4520,
80, “4321”);

See Also
AutoScan, OnDeviceInstalled

Samsung XNS ActiveX SDK | 177


CHAPTER 2
XnsSdkDevice Miscellaneous

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

[in] Event type.

• EVENT_ALL (=0xff): Applied to all event types.

• EVENT_ALARM (=0x01): applied to the alarm event.

• EVENT_MOTION (=0x02): applied to the motion event.

• EVENT_VIDEOLOSS (=0x04): applied to the video loss event.

nDiscardTime

[in] Event discard time (Unit: second).

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

Example
[C++]
long nErrCode = m_ctlXnsDevice.SetEventDiscardTime(30);

GetErrorString

Description
Returns description about the error code.

Samsung XNS ActiveX SDK | 178


CHAPTER 2
XnsSdkDevice Miscellaneous

Syntax
BSTR GetErrorString(long nErrorCode);

Parameters
nErrorCode

[in] Error code.

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

[in] Error code.

Return Value
Description of the error code. For instance, if nErrCode is 0, the application can get the

Samsung XNS ActiveX SDK | 179


CHAPTER 2
XnsSdkDevice Events

"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
오류! 참조 원본을 찾을 수 없습니다.. 오류! 참조 원본을 찾을 수 없습니다..

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
);

Samsung XNS ActiveX SDK | 180


CHAPTER 2
XnsSdkDevice Events

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

Example
[C++]
void CTestSampleDlg::OnControlLocalNameChangedXnssdkdevicectrl(long nDeviceID, long
nControlID)
{
OutputDebugString("Event Local Name Changed\n");
char str[300];

int hDevice = m_ctlXnsDevice.GetDeviceHandle(nDeviceID);

// You can check the renamed control module using GetControlLocalName().


sprintf(str, "nDeviceID[%d], nControlID[%d], Changed Name[%s]\n",
nDeviceID, nControlID, m_ctlXnsDevice.GetControlLocalName(hDevice, nControlID));
OutputDebugString(str);
}

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,

Samsung XNS ActiveX SDK | 181


CHAPTER 2
XnsSdkDevice Events

BSTR szIP,
BSTR szSubnetMask,
BSTR szGateway,
BSTR szMac,
long nPort,
long nHttpPort,
BOOL bSupportIpInstall
);

Parameters
szVendorName

[in] Vendor name (i.e., SAMSUNG).

szModelName

[in] Model name (i.e., SHR-604X).

szDeviceName

[in] Device name (i.e., SHR-604X).

szIP

[in] IP address (i.e., 192.168.10.100).

szSubnetMask

[in] Subnet mask (i.e., 255.255.255.0).

szGateway

[in] Gateway (i.e., 192.168.10.1).

szMac

[in] MAC address (i.e., 000918D000A3).

nPort

[in] Port number of device (i.e., 554).

nHttpPort

[in] HTTP port number of device (i.e., 80).

bSupportIpInstall

[in] Informs if the device supports the "IP Install" capability.

• True (1): Supported.

• False (0): Not supported.

Example

Samsung XNS ActiveX SDK | 182


CHAPTER 2
XnsSdkDevice Events

[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
);

Samsung XNS ActiveX SDK | 183


CHAPTER 2
XnsSdkDevice Events

Parameters
szVendorName

[in] Vendor name (i.e., SAMSUNG).

szModelName

[in] Model name (i.e., SHR-604X).

szDeviceName

[in] Device name (i.e., SHR-604X).

szIP

[in] IP address (i.e., 192.168.10.100).

szSubnetMask

[in] Subnet mask (i.e., 255.255.255.0).

szGateway

[in] Gateway (i.e., 192.168.10.1).

szMac

[in] MAC address (i.e., 000918D000A3).

nPort

[in] Port number of device (i.e., 554).

nHttpPort

[in] HTTP port number of device (i.e., 80).

szModelType

[in] Model type (i.e., Samsung Network Camera/Encoder).

bSupportIpInstall

[in] Informs if the device supports the "IP Install" capability.

• True (1): Supported.

• False (0): Not supported.

nNetworkMode

[in] Informs the Network mode.

• True (1): DHCP mode.

• False (0): Static mode.

Example
[C++]
void CTestSampleDlg::OnDeviceDetected2Xnssdkdevicectrl(LPCTSTR szVendorName, LPCTSTR

Samsung XNS ActiveX SDK | 184


CHAPTER 2
XnsSdkDevice Events

szModelName, LPCTSTR szDeviceName, LPCTSTR szIP, LPCTSTR szSubnetMask, LPCTSTR


szGateway, LPCTSTR szMac, long nPort, long nHttpPort, LPCTSTR szModelType, BOOL
bSupportIpInstall, long nNetworkMode)
{
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]\n",
szVendorName, szModelName, szDeviceName, szIP, szSubnetMask, szGateway, szMac, nPort,
nHttpPort, szModelType, bSupportIpInstall, nNetworkMode);

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,

Samsung XNS ActiveX SDK | 185


CHAPTER 2
XnsSdkDevice Events

LPCTSTR szUUID
);

Parameters
szVendorName

[in] Vendor name (i.e., SAMSUNG).

szModelName

[in] Model name (i.e., SHR-604X).

szDeviceName

[in] Device name (i.e., SHR-604X).

szIP

[in] IP address (i.e., 192.168.10.100).

szSubnetMask

[in] Subnet mask (i.e., 255.255.255.0).

szGateway

[in] Gateway (i.e., 192.168.10.1).

szMac

[in] MAC address (i.e., 000918D000A3).

nPort

[in] Port number of device (i.e., 554).

nHttpPort

[in] HTTP port number of device (i.e., 80).

szModelType

[in] Model type (i.e., Samsung Network Camera/Encoder).

bSupportIpInstall

[in] Informs if the device supports the "IP Install" capability.

• True (1): Supported.

• False (0): Not supported.

nNetworkMode

[in] Informs the Network mode.

• True (1): DHCP mode.

• False (0): Static mode.

nbIsDhcpIPInstall

Samsung XNS ActiveX SDK | 186


CHAPTER 2
XnsSdkDevice Events

[in] Informs whether the device supports the changing IP using DHCP

• True (1): Supported.

• False (0): Not supported.

nDeviceProtocolType

[in] protocol type of device.

• XDEVICE_PROTOCOL_UNKNOWN (0): Unkwon.

• XDEVICE_PROTOCOL_SUNAPI (1): SUNAPI.

szUUID

[in] Not used.

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().

Samsung XNS ActiveX SDK | 187


CHAPTER 2
XnsSdkDevice Events

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

[in] Error code.

szVendorName

[in] Vendor name (i.e., SAMSUNG).

szModelName

[in] Model name (i.e., SHR-604X).

szDeviceName

[in] Device name (i.e., SHR-604X).

szIP

[in] IP address (i.e., 192.168.10.100).

szSubnetMask

[in] Subnet mask (i.e., 255.255.255.0).

szGateway

[in] Gateway (i.e., 192.168.10.1).

szMac

[in] MAC address (i.e., 000918D000A3).

nPort

[in] Port number of device (i.e., 554).

Samsung XNS ActiveX SDK | 188


CHAPTER 2
XnsSdkDevice Events

nHttpPort

[in] HTTP port number of device (i.e., 80).

szPassword

[in] Password required for login as admin.

nNetworkMode

[in] Informs the Network mode.

• True (1): DHCP mode.

• False (0): Static mode.

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

Samsung XNS ActiveX SDK | 189


CHAPTER 2
XnsSdkDevice Events

void OnConnectFailed(
long nDeviceID,
long nErrorCode
);

Parameters
nDeviceID

[in] Device ID.

nErrorCode

[in] Error code.

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
);

Samsung XNS ActiveX SDK | 190


CHAPTER 2
XnsSdkDevice Events

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

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);

long nBitFlag = 0x01;


CString strRec;

for (int i=0; i<31; i++)


{
if (nRecDay & nBitFlag)
strRec = " 1 ";
else
strRec = " 0 ";
OutputDebugString(strRec);
nBitFlag <<=1;
}
OutputDebugString("\n");
}

See Also

Samsung XNS ActiveX SDK | 191


CHAPTER 2
XnsSdkDevice Events

SearchCalendar, SearchDay, OnSearchDay, ControlID

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

[in] Device ID.

tStart

[in] Search start time. Format: UTC time_t.

tEnd

[in] Search end time. Format: UTC time_t.

nTrackNum

[in] The number of overlapped track.

nTrackValue

[in] The actual value of overlapped track.

Example
[C++]
void CTestSampleDlg::OnSearchOverLapXnssdkdevicectrl(long nDeviceID, long tStart, long tEnd,
long nTrackNum, long nTrackValue)
{
unsigned int* trackValue = (unsigned int*)nTrackValue;
m_nTrackNum = nTrackNum;

Samsung XNS ActiveX SDK | 192


CHAPTER 2
XnsSdkDevice Events

for(int i = 0; i < m_nTrackNum; i++)


{
m_nTrackValue[i] = trackValue[i];
}
m_nTrackValue[m_nTrackNum] = '\0';
}

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

[in] Device ID.

tRecUTC

[in] Recod start time. Format: UTC time_t.

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,

Samsung XNS ActiveX SDK | 193


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

tRecUTC

[in] Recod end time. Format: UTC time_t.

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

Samsung XNS ActiveX SDK | 194


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nControlID

[in] Control ID.

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;

Samsung XNS ActiveX SDK | 195


CHAPTER 2
XnsSdkDevice Events

OutputDebugString("<On UTC time>");

for(int i=0; i<TimelineCount; i++)


{
m_ctlXnsDevice.GetTimeline(hTimeline, 0, i, XTIME_UTC, &tStart, &tEnd,
&nRecType, &nRecId);

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);

strRecInfo.Format("index[%d], RecId[%d], RecType[%d], time[%04d-%02d-


%02d %02d:%02d:%02d ~ %04d-%02d-%02d %02d:%02d:%02d]\n", i, nRecId, nRecType,
StartYear, StartMon, StartDay, StartHour, StartMin, StartSec, EndYear, EndMon, EndDay, EndHour,
EndMin, EndSec);
OutputDebugString(strRecInfo);
}
}

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(

Samsung XNS ActiveX SDK | 196


CHAPTER 2
XnsSdkDevice Events

long nDeviceID,
long nControlID,
long nGridWidth,
long nGridHeight,
long pGridArray
);

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nGridWidth

[in] The number of Grid width(64 as maximum).

nGridHeight

[in] The number of Grid height(64 as maximum).

pGridArray

[in] the number of nGridWidth X nGridHeight equals to array value of 'char'(64 x 64 as


maximum). It is marked as '1' as you setup

Ex) In case of pGridArray in 3 x 3, screen range of Grid is below as it is

[0][0] [0][1] [0][2]

[1][0] [1][1] [1][2]

[2][0] [2][1] [2][2]

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;

Samsung XNS ActiveX SDK | 197


CHAPTER 2
XnsSdkDevice Events

memcpy(m_pGridArray, (char*)pGridArray, 64*64);


for(int i = 0; i < nGridHeight; i++)
{
m_pGridArray[i][m_nGridWidth] = ‘\0’;
}
m_pGridArray[m_nGridHeight][0] = '\0';

str.Format("Event OnGetMotionGrid.. nGridWidth[%d], nGridHeight[%d]\n", nGridWidth,


nGridHeight);
OutputDebugString(str);
}

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

[in] Device ID.

nControlID

[in] Control ID.

hTimeline

[in] Timeline handle. This value is used as an input parameter for timeline-related functions.

Samsung XNS ActiveX SDK | 198


CHAPTER 2
XnsSdkDevice Events

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;

OutputDebugString("<On UTC time>");

for(int i=0; i<TimelineCount; i++)


{
m_ctlXnsDevice.GetTimeline(hTimeline, 0, i, XTIME_UTC, &tStart, &tEnd,
&nRecType, &nRecId);

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);

strRecInfo.Format("index[%d], RecId[%d], RecType[%d], time[%04d-%02d-


%02d %02d:%02d:%02d ~ %04d-%02d-%02d %02d:%02d:%02d]\n", i, nRecId, nRecType,
StartYear, StartMon, StartDay, StartHour, StartMin, StartSec, EndYear, EndMon, EndDay, EndHour,
EndMin, EndSec);
OutputDebugString(strRecInfo);
}
}

Samsung XNS ActiveX SDK | 199


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nControlID

[in] Control ID.

hPresetListList

[in] Handle to indicate the preset list.

Example
[C++]
void CTestSampleDlg::OnGetPresetListXnssdkdevicectrl(long nDeviceID, long nControlID, long
hPresetListList)
{
CString str;
long nNumber;
long nPresetCount;
CString strPresetName;

Samsung XNS ActiveX SDK | 200


CHAPTER 2
XnsSdkDevice Events

nPresetCount = m_ctlXnsDevice.GetPresetCount(hPresetListList);
str.Format("Event OnGetPresetList.. nDevice[%d], nControlId[%d], PresetCount[%d]\n",
nDeviceID, nControlID, nPresetCount);

OutputDebugString(str);

for(int i=0; i<nPresetCount; i++)


{
strPresetName = m_ctlXnsDevice.GetPreset(hPresetListList, i, &nNumber);
str.Format("PresetName[%s], nPresetNumber[%d]\n", strPresetName, nNumber);
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

[in] Device ID.

nErrorCode

[in] Error code.

Samsung XNS ActiveX SDK | 201


CHAPTER 2
XnsSdkDevice Events

nProgress

[in] Progress (Unit: %).

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

[in] Device ID.

nErrorCode

[in] Error code.

Samsung XNS ActiveX SDK | 202


CHAPTER 2
XnsSdkDevice Events

nProgress

[in] Progress (Unit: %).

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

[in] Device ID.

nErrorCode

[in] Error code.

nProgress

Samsung XNS ActiveX SDK | 203


CHAPTER 2
XnsSdkDevice Events

[in] Progress (Unit: %).

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

[in] Device ID.

nErrorCode

Samsung XNS ActiveX SDK | 204


CHAPTER 2
XnsSdkDevice Events

[in] Error code.

nDeviceStatus

[in] Status of device.

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,

Samsung XNS ActiveX SDK | 205


CHAPTER 2
XnsSdkDevice Events

long nControlID,
long nErrorCode,
long nStatusMask
);

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nErrorCode

[in] Error code.

nStatusMask

[in] Informs which setting of the control module has changed (see Table 2-11).

Table 2-11 Control Module Status

Status Value Description

XCAMERA_STATUS_MASK 0x00000001 Camera status.

XRECORDING_STATUS_MASK 0x00000002 Recording status.

XLISTEN_STATUS_MASK 0x00000004 Operation status of Listen.

XTALK_STATUS_MASK 0x00000008 Operation status of Talk.

XALARM_STATUS_MASK 0x00000010 Alarming status

XLOCALREC_STATUS_MASK 0x00000020 Recording status in the local PC.

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);
}

Samsung XNS ActiveX SDK | 206


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nControlID

[in] Control ID.

nCapabilityMask

[in] Informs which capability of the control module has changed (see Table 2-12).

Table 2-12 Control Module Capability

Field Value Description

XCTL_CAP_SW_UPLOAD_MASK 0x000000001 Update the firmware remotely.

XCTL_CAP_CFG_IMPORT_MASK 0x000000002 Get config file from the device.

XCTL_CAP_CFG_EXPORT_MASK 0x000000004 Export config file to device.

XCTL_CAP_CONN_FORCED_MASK 0x000000008 Forced log in as admin.

XCTL_CAP_MEDIA_AUTHORITY_MASK 0x000000010 Get permission to play


multimedia file.

XCTL_CAP_PLAY_CONTROL_MASK 0x000000020 Control the playback.

XCTL_CAP_LIVE_MASK 0x000000040 Play video in real time.

Samsung XNS ActiveX SDK | 207


CHAPTER 2
XnsSdkDevice Events

XCTL_CAP_PLAYBACK_MASK 0x000000080 Plays video.

XCTL_CAP_BACKUP_MASK 0x000000100 Backups video.

XCTL_CAP_SEARCH_MASK 0x000000200 Searches video.

XCTL_CAP_LISTEN_MASK 0x000000400 Listen.

XCTL_CAP_TALK_MASK 0x000000800 Talk.

XCTL_CAP_PTZ_MASK 0x000001000 PTZ control.

XCTL_CAP_ALARM_ONOFF_MASK 0x000002000 Alarm-Out On/Off.

XCTL_CAP_DVR_EVENT_RESET_MASK 0x000004000 Cancel the display of event


information by DVR.

XCTL_CAP_DVR_MANUAL_REC_CONT 0x000008000 Control recording by DVR on a


ROL_MASK remote site.

XCTL_CAP_DVR_REC_STATUS_MASK 0x00010000 Check the recording status of


DVR.

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(

Samsung XNS ActiveX SDK | 208


CHAPTER 2
XnsSdkDevice Events

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 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(

Samsung XNS ActiveX SDK | 209


CHAPTER 2
XnsSdkDevice Events

long nDeviceID,
long nControlID,
long nSensorNumber,
long tEventUTC
);

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nSensorNumber

[in] Number of sensor that detects the event..

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

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.

Samsung XNS ActiveX SDK | 210


CHAPTER 2
XnsSdkDevice Events

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;

m_ctlXnsDevice.TimetToDate(tEventUTC, &year, &mon, &day, &hour, &min, &sec);


DBG_LOG(_T("$$IV Event Detected, device=%d, cid=%d, time=[%04d-%02d-
%02d %02d:%02d:%02d]\n"),
nDeviceID, nControlID, year, mon, day, hour, min, sec);
if(nIvType & XIV_TYPE_PASSING)
DBG_LOG(_T("$$IV TYPE : PASSING\n"));
if(nIvType & XIV_TYPE_ENTERING)
DBG_LOG(_T("$$IV TYPE : ENTERING\n"));
if(nIvType & XIV_TYPE_EXITING)
DBG_LOG(_T("$$IV TYPE : EXITING\n"));
if(nIvType & XIV_TYPE_APPEARING)
DBG_LOG(_T("$$IV TYPE : APPEARING\n"));
if(nIvType & XIV_TYPE_DISAPPERING)
DBG_LOG(_T("$$IV TYPE : DISAPPERING\n"));
if(nIvType & XIV_TYPE_SCENE_CHANGE)

Samsung XNS ActiveX SDK | 211


CHAPTER 2
XnsSdkDevice Events

DBG_LOG(_T("$$IV TYPE : SCENE_CHANGE\n"));


}

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

[in] Device ID.

nControlID

[in] Control ID.

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

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);

Samsung XNS ActiveX SDK | 212


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nHDDNumber

[in] HDD number.

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

Samsung XNS ActiveX SDK | 213


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nHDDNumber

[in] HDD number.

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

Samsung XNS ActiveX SDK | 214


CHAPTER 2
XnsSdkDevice Events

nDeviceID

[in] Device ID.

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

[in] Device ID.

szID

[in] New ID that has changed the password.

Example
[C++]
void CTestSampleDlg::OnPasswordChangedXnssdkdevicectrl(long nDeviceID, LPCTSTR szID)
{
char str[200];
sprintf(str, "PasswordChanged DeviceID[%d] szID[%s]\n", nDeviceID, szID);
OutputDebugString(str);

Samsung XNS ActiveX SDK | 215


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nControlID

[in] Control ID.

nErrorCode

[in] Error code.

nProgress

[in] Progress (Unit: %).

tStart

[in] Backup start time (Format: 4-byte time_t).

tEnd

[in] Backup end time (Format: 4-byte time_t).

Example
[C++]
void CTestSampleDlg::OnBackupProgressXnssdkdevicectrl(long nDeviceID, long nControlID, long

Samsung XNS ActiveX SDK | 216


CHAPTER 2
XnsSdkDevice Events

nErrorCode, long nProgress, long tStart, long tEnd)


{
CString str;
long StartYear, StartMon, StartDay, StartHour, StartMin, StartSec;
long EndYear, EndMon, EndDay, EndHour, EndMin, EndSec;

m_ctlXnsDevice.TimetToDate(tStart, &StartYear, &StartMon, &StartDay, &StartHour,


&StartMin, &StartSec);
m_ctlXnsDevice.TimetToDate(tEnd, &EndYear, &EndMon, &EndDay, &EndHour, &EndMin,
&EndSec);

str.Format("Backup Progress DeviceID[%d] ControlID[%d], nProgress[%d], StartTime[%d-


%d-%d %02d:%02d:%02d], EndTime[%d-%d-%d %02d:%02d:%02d], ErrorCode[%s]\n",
nDeviceID, nControlID, nProgress, StartYear, StartMon, StartDay, StartHour, StartMin, StartSec,
EndYear, EndMon, EndDay, EndHour, EndMin, EndSec,
m_ctlXnsDevice.GetErrorString(nErrorCode));
OutputDebugString(str);
}

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,

Samsung XNS ActiveX SDK | 217


CHAPTER 2
XnsSdkDevice Events

long nFrameSize,
long nTimeStamp
);

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nMediaType

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• 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

[in] Input type.

• XINPUT_VIDEO (=1): Video data.

• XINPUT_AUDIO (=2): Audio data.

• 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_IVOP (=1): Intra Video Object Plane.

• XFRAME_PVOP (=2): Predictive VOP.

• XFRAME_BVOP (=3): Bidirectional VOP.

• XFRAME_END (=4)

nFrameTime

[in] Frame creation time.

nFrameSize

[in] Frame size.

Samsung XNS ActiveX SDK | 218


CHAPTER 2
XnsSdkDevice Events

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;

/* video header information


typedef struct xns_video_header2_tag
{
char vendor_name[8]; //SVSSVH, SVSSMH, SVSSAH
unsigned long major_ver;
unsigned long minor_ver;
unsigned long header_size;
unsigned long media_type;
unsigned long camera_index;
unsigned long codec_type;
unsigned long replay_sequence;
unsigned long time_stamp;
unsigned long frame_size;
unsigned long frame_type;
unsigned char igroup_count;
unsigned char pgroup_count;
unsigned char exist_bframe;
unsigned char bSkip;

Samsung XNS ActiveX SDK | 219


CHAPTER 2
XnsSdkDevice Events

unsigned long frame_rate;


unsigned long is_audiosrc;
unsigned long is_videoloss;
unsigned long is_alarm;
unsigned long is_motion;
unsigned long is_motion_region;
unsigned long frame_width;
unsigned long frame_height;
TIME_ZONE_INFORMATION time_zone;
long rec_time;
unsigned long water_mark[4];
unsigned short is_ivevent
unsigned short reserveds;
unsigned long reserved[2];
unsigned long record_id;
unsigned long water_mark_type;
} XNS_VIDEO_HEADER2;
*/
/* audio header information
typedef struct xns_audio_header2_tag
{
char vendor_name[8];
unsigned long major_ver;
unsigned long minor_ver;
unsigned long header_size;
unsigned long media_type;
unsigned long mic_index;
unsigned long codec_type;
unsigned long time_stamp;
unsigned long frame_size;
TIME_ZONE_INFORMATION time_zone;
unsigned long channel : 2;
unsigned long sampling : 6;
unsigned long bits : 4; //AAC Codec
unsigned long m_cConsecutiveSeq : 8; //RTP header Extension (CSeq)
unsigned long reserved : 12;
} XNS_AUDIO_HEADER2;
*/
/* metadata header information

Samsung XNS ActiveX SDK | 220


CHAPTER 2
XnsSdkDevice Events

typedef struct xns_metadata_header_tag


{
char vendor_name[8]; //SVSSVH, SVSSMH, SVSSAH
unsigned long major_ver;
unsigned long minor_ver;
unsigned long header_size;
unsigned long media_type; //XNSE_MEDIA_TYPE //MEDIA_TYPE2
unsigned long time_stamp;
unsigned long camera_index;
unsigned long frame_size;
TIME_ZONE_INFORMATION time_zone;
unsigned long metadata_type;
unsigned char frame_type;
unsigned char reserved1[3];
unsigned long reserved2[2];
} XNS_METADATA_HEADER;
*/
}

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;

Samsung XNS ActiveX SDK | 221


CHAPTER 2
XnsSdkDevice Events

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,

Samsung XNS ActiveX SDK | 222


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

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.

Samsung XNS ActiveX SDK | 223


CHAPTER 2
XnsSdkDevice Events

Syntax
void OnFanStatusChanged(long nDeviceID, long tEventUTC, long nFanNo, long nStatus);

Parameters
nDeviceID

[in] Device ID.

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,

Samsung XNS ActiveX SDK | 224


CHAPTER 2
XnsSdkDevice Events

long nErrorCode
);

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nErrorCode

[in] Error code.

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
);

Samsung XNS ActiveX SDK | 225


CHAPTER 2
XnsSdkDevice Events

Parameters
nDeviceID

[in] Device ID.

nControlID

[in] Control ID.

nErrorCode

[in] Error code.

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

[in] Device ID.

Samsung XNS ActiveX SDK | 226


CHAPTER 2
XnsSdkDevice Events

nControlID

[in] Control ID.

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

Samsung XNS ActiveX SDK | 227


CHAPTER 2
XnsSdkDevice Events

[in] Control ID.

nErrorCode
[in] return value.

nPan
[in] Absolute value of Pan.

nTilt
[in] Absolute value of Tilt.

nZoom
[in] Absolute value of Zoom.

Example
[C++]

void CMy01_LiveDlg::OnGetPtzPosXnssdkdevicectrl(long nDeviceID, long nControlID, long


nErrorCode, long nPan, long nTilt, long nZoom)
{
TRACE(_T("Get Ptz Position pan=%d, tilt=%d, zoom=%d, ret=%d\n"),
nPan, nTilt, nZoom, nErrorCode);
}

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,

Samsung XNS ActiveX SDK | 228


CHAPTER 2
XnsSdkDevice Events

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++]

void CMy01_LiveDlg::OnGetPtzPosNormalizeXnssdkdevicectrl(long nDeviceID, long nControlID,


long nErrorCode, float fPan, float fTilt, float fZoom)
{
TRACE(_T("Get Ptz Position pan=%f, tilt=%f, zoom=%f, ret=%d\n"),
fPan, fTilt, fZoom, nErrorCode);
}

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.

Samsung XNS ActiveX SDK | 229


CHAPTER 2
XnsSdkDevice Events

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++]

void CMy01_LiveDlg::OnAreaZoomMovingXnssdkdevicectrl(long nDeviceID, long nControlID,


long nStatus, long nReserved)
{
if( bAreaZoom == True)
{
CString str;
str.Format("AreaZoomMoving Changed DeviceID[%d] ControlID[%d],
Status[%d]\n", nDeviceID, nControlID, nStatus);
OutputDebugString(str);
}
}

See Also
AreaZoom, ControlID

Samsung XNS ActiveX SDK | 230


CHAPTER 2
XnsSdkDevice Events

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

[in] Media type.

• XMEDIA_LIVE (=1): Live.

• XMEDIA_PLAYBACK (=2): Playback.

• XMEDIA_BACKUP (=3): Backup replay (saves stream data in the local PC).

nFps
[in] fps

nKbps
[in] Bitrate (Kbps)

nVideoWidth
[in] Video width

Samsung XNS ActiveX SDK | 231


CHAPTER 2
XnsSdkDevice Events

nVideoHeight
[in] Video height

nCodecType
[in] Video codec information

• XVCODEC_UNKNOWN (=0): Unknown

• XVCODEC_MJPEG (=1): MJPEG

• XVCODEC_MPEG4 (=2): MPEG4

• XVCODEC_H264 (=3): H264

Example
[C++]

void CMy01_LiveDlg::OnVideoFrameInfoReceivedXnssdkdevicectrl(long nDeviceID,


long nControlID,
long nMediaType,
long nFps,
long nKbps,
long nVideoWidth,
long nVideoHeight,
long nCodecType)
{
CString str;
str.Format("Video frame received DeviceID[%d] ControlID[%d], fps[%d], Kbps[%d]\n",
nDeviceID, nControlID, nFps, nKbps);
OutputDebugString(str);
}

See Also

SetVideoInfoReceived, ControlID

OnRecordingErrorEvent

Description
This event indicates that a recording error event occurs from the device.

Syntax

Samsung XNS ActiveX SDK | 232


CHAPTER 2
XnsSdkDevice Events

void OnRecordingErrorEvent(
long nDeviceID,
long tEventUTC
);

Parameters
nDeviceID

[in] Device ID.

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

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

Samsung XNS ActiveX SDK | 233


CHAPTER 2
XnsSdkDevice Events

[in] Device ID.

nErrorCode

[in] Error code.

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

[in] Event occurred time. Format: 4-byte time_t.

nControlID

[in] Control ID.

Samsung XNS ActiveX SDK | 234


CHAPTER 2
XnsSdkDevice Events

nStatus
[in] Recording Status.

• (1): Stop Recording.

• (0): Start Recording.

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,

Samsung XNS ActiveX SDK | 235


CHAPTER 2
XnsSdkDevice Events

LPCTSTR strParam
);

Parameters
nDeviceID
[in] Device ID.

nControlID
[in] Control ID.

nSubEvent

[in] Informs detail information of tracking event.

• XEVT_TRACKING_OCCUR (=1) : Tracking event occured

tEventUTC

[in] ] Event occurred time. Format: 4-byte time_t.

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-

Samsung XNS ActiveX SDK | 236


CHAPTER 2
XnsSdkDevice Events

%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

[in] Informs detail information of face detection event.

• XEVT_FACE_DETECTION_OCCUR (=4) : Face detection event occured

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

nParam1

Samsung XNS ActiveX SDK | 237


CHAPTER 2
XnsSdkDevice Events

[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,

Samsung XNS ActiveX SDK | 238


CHAPTER 2
XnsSdkDevice Events

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

[in] Informs detail information of audio detection event.

• XEVT_AUDIO_DETECTION_OCCUR (=7) : Audio detection event occured

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

nParam1
[in] Reserved.

nParam2
[in] Reserved.

nParam3
[in] Reserved.

nParam4
[in] Reserved.

description
[in] Reserved.

strParam
[in] Reserved.

Example
[C++]

Samsung XNS ActiveX SDK | 239


CHAPTER 2
XnsSdkDevice Events

void CTestSampleDlg::OnAudioDetectionEventChangedXnssdkdevicectrl1(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("$$Audio 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_AUDIO_DETECTION_OCCUR)
DBG_LOG(_T("$$SUBEVENT TYPE : OCCUR\n"));
}

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.

Samsung XNS ActiveX SDK | 240


CHAPTER 2
XnsSdkDevice Events

nControlID
[in] Control ID.

nSubEvent

[in] Informs detail information of AMD event. (see Table 2-12)

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

nParam1
[in] Reserved.

nParam2
[in] Reserved.

nParam3
[in] Reserved.

nParam4
[in] Reserved.

description
[in] Reserved.

strParam
[in] Reserved.

Table 2-13 AMD Subevent List

SubEvent Type Value Description

XEVT_AMD_ROI_MOTION_DETECTION_START 10 Motion detection started in the ROI


area.

XEVT_AMD_ROI_MOTION_DETECTION_STOP 11 Motion detection stoped in the ROI


area.

XEVT_AMD_LIB_LOAD_FAILED 12 AMD library load failed.

XEVT_AMD_LOW_FPS_START 13 Less than 10 fps.

XEVT_AMD_LOW_FPS_END 14 10 fps or more.

XEVT_AMD_DSP_DISPLAY_START 15 DSP(DM8167) Display 시작

XEVT_AMD_DSP_DISPLAY_FAIL 16 DSP(DM8167) Display 실패

XEVT_AMD_DSP_VA_START 17 DSP(DM8167) VA 시작

XEVT_AMD_DSP_VA_FAIL 18 DSP(DM8167) VA 실패

Example

Samsung XNS ActiveX SDK | 241


CHAPTER 2
XnsSdkDevice Events

[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.

Samsung XNS ActiveX SDK | 242


CHAPTER 2
XnsSdkDevice Events

nControlID
[in] Control ID.

nSubEvent

[in] Informs detail information of system event. (see Table 2-12)

tEventUTC

[in] Event occurred time. Format: 4-byte time_t.

nParam1
[in] Reserved.

nParam2
[in] Reserved.

nParam3
[in] Reserved.

nParam4
[in] Reserved.

description
[in] Reserved.

strParam
[in] Reserved.

Table 2-14 System Subevent List

SubEvent Type Value Description

XEVT_PROFILE_ADD 19 Profile added.

XEVT_PROFILE_CHANGED 20 Profile settings changed.

XEVT_PROFILE_REMOVED 21 Profile removed.

XEVT_BEING_UPDATED 22 NVR firmware is being updated. This


event occurs at the beginning of
updating.

XEVT_RECORD_FILTERING_START 23 (NVR)Frame skipping occurred


during recording.

XEVT_RECORD_FILTERING_STOP 24 (NVR)Frame skipping stopped


during recording.

XEVT_BATTERY_FAIL 25 (NVR)RTC(Real Time Clock) battery


discharged.

XEVT_NETWORK_TRAFFIC_STATUS_OVE 26 Amount of data received from the


RFLOW camera exceeded the NVR's

Samsung XNS ActiveX SDK | 243


CHAPTER 2
XnsSdkDevice Events

maximum.

XEVT_NETWORK_TRAFFIC_STATUS_REL 27 Amount of data received from the


EASE camera released the NVR's
maximum.

XEVT_UPGRADE_LOG 28 (NVR)New version of firmware is in


the update server.

XEVT_OVERWRITE_DECODING 29 (NVR)Overwrite occurred when


search being played.

XEVT_RAID_MODE_ENABLE 30 (NVR)Occurred when the RAID


mode changed,
• nParam1 : RAID Array Number(1 or
2).

XEVT_RAID_MODE_DISABLE 31 (NVR)RAID mode off.

XEVT_RAID_SETUP_CHANGE 32 (NVR)RAID setting changed.

XEVT_RAID_BUILD_CANCEL 33 (NVR)RAID build canceled.

XEVT_RAID_BUILD_FAIL 34 (NVR)Error occurred during a RAID


build.

XEVT_RAID_REBUILDING_START 35 (NVR)Recovery RAID device started


(Recovery in new device by replacing
the failed device).

XEVT_RAID_REBUILDING_END 36 (NVR)RAID device recovery ended.

XEVT_RAID_REBUILDING_FAIL 37 (NVR)RAID device recovery failed.

XEVT_RAID_DEGRADED 38 (NVR)Failure RAID device(not


recovered upon failure).

XEVT_RAID_FAIL 39 (NVR)Circumstances not available


RAID array.

XEVT_ISCSI_CONNECTED 40 (NVR)iSCIS equipment connected.

XEVT_ISCSI_DISCONNECTED 41 (NVR)iSCIS equipment disconnected.

XEVT_RECORDING_FRAME_DROP 42 (NVR)Video loss due to


performance issue.

XEVT_DUAL_SMPS_FAILURE 43 (NVR)Dual SMPS failure.

XEVT_DUAL_SMPS_RECOVERED 44 (NVR)Dual SMPS recovered.

XEVT_INTERNAL_HDD_CONNECTED 45 (NVR)Internal HDD added.

Samsung XNS ActiveX SDK | 244


CHAPTER 2
XnsSdkDevice Events

• nParam1 : HDD number

XEVT_INTERNAL_HDD_DISCONNECTED 46 (NVR)Internal HDD removed.


• nParam1 : HDD number

XEVT_USB_HDD_CONNECTED 47 (NVR)USB HDD added.

XEVT_USB_HDD_DISCONNECTED 48 (NVR)USB HDD removed.

XEVT_BACKUP_START 49 (NVR)Backup started.

XEVT_BACKUP_END 50 (NVR)Backup ended.

XEVT_ALARM_RESET 51 (NVR)Alarm marked on the


equipment was reset(Occurred when
alarm reset)

XEVT_RAID_DEVICE_ADD 52 (NVR)Hot Swap RAID added.

XEVT_RAID_DEVICE_ADD_FAIL 53 (NVR)Adding Hot Swap RAID failed.

XEVT_RAID_REC_RESTRICTION 54 (NVR)Recording limit occurred when


building RAID.

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);

if(nSubEvent & XEVT_PROFILE_ADD)

DBG_LOG(_T("$$SUBEVENT TYPE : PROFILE_ADD \n"));

if(nSubEvent & XEVT_PROFILE_CHANGED)

DBG_LOG(_T("$$SUBEVENT TYPE : PROFILE_CHANGED \n"));

OnChangeDeviceAdminPassword

Samsung XNS ActiveX SDK | 245


CHAPTER 2
XnsSdkDevice Events

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

[in] Device ID.

nErrorCode

[in] Error code.

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

Samsung XNS ActiveX SDK | 246


CHAPTER 3

XnsSdkWindow

XnsSdkWindow is a component that provides a media player window and enables


you to manage the display items on the screen.

Features included:

ㆍ Media information management

ㆍ Zoom control

ㆍ OSD menu

ㆍ Volume control

ㆍ Media play

ㆍ Buffer management

ㆍ On-screen item management

ㆍ Handling mouse and keyboard inputs

Contents
ㆍ Initialize the Control

ㆍ Start and Stop

ㆍ Get Device Information

ㆍ Control Zoom

ㆍ OSD Menu

ㆍ Control Volume

ㆍ Snapshot

ㆍ Control Playback

ㆍ Control Buffer

ㆍ Get Display Information

ㆍ Miscellaneous

ㆍ Events
CHAPTER 3
XnsSdkWindow Initialize the Control

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

• ERR_SUCCESS: Function successfully performed.

Example
[C++]
long ErrCode = m_ctlXnsWindow.Initialize(NULL, NULL);
char str[100];
sprintf(str, "ErrorCode[0x%x]\n", ErrCode);
OutputDebugString(str);

See Also

Samsung XNS ActiveX SDK | 248


CHAPTER 3
XnsSdkWindow Start and Stop

XnsSdkDevice::Initialize

Start and Stop

Start

Description
Adds the media source handle to XnsSdkWindow.

The media source handle is created by XnsSdkDevice. If the application calls


XnsSdkDevice::OpenMedia(), it will receive media stream from the device and return the Media
Source handle. The application uses Start() to forward the media source handle to
XnsSdkWindow so that XnsSdkWindow can obtain stream data.

Syntax
long Start(long hMediaSource);

Parameters
hMediaSource

[in] Media source handle. This value can be obtained using XnsSdkDevice::OpenMedia().

Note) Use 0 value for XnsSdkDeivce::OpenStream() function.

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized.

• ERR_ALREADY_RUN: Already in process.

Example
[C++]
m_ctlXnsDevice.OpenMedia(m_hDevice, 2, XMEDIA_LIVE, 0, 0, &m_pMediaLiveSource);
m_ctlXnsWindow.Start(m_pMediaLiveSource);

See Also

Samsung XNS ActiveX SDK | 249


CHAPTER 3
XnsSdkWindow Get Device Information

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

Get Device Information

GetDeviceID

Description
Returns the ID of the device that is connected to media source.

The device ID is defined by the application using XnsSdkDevice::CreateDevice().

Syntax

Samsung XNS ActiveX SDK | 250


CHAPTER 3
XnsSdkWindow Get Device Information

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

Samsung XNS ActiveX SDK | 251


CHAPTER 3
XnsSdkWindow Get Device Information

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

Samsung XNS ActiveX SDK | 252


CHAPTER 3
XnsSdkWindow Get Device Information

Check if stream source exists.

Syntax
long IsMedia(void);

Return Value
‘1’ will be returned in the following cases, otherwise ‘0’ will be returned.

• XnsSdkWindow initialized.

• hMediaSource is valid.

• Device of XnsSdkWindow setting is connected to the application with a transfer of stream


data.

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.

• MEDIA_TYPE_LIVE(1): Live streaming.

• MEDIA_TYPE_PLAYBACK(2): Play data in a remote site.

• MEDIA_TYPE_BACKUP(3): Play data in a local PC.

Example

Samsung XNS ActiveX SDK | 253


CHAPTER 3
XnsSdkWindow Control Zoom

[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

[in] X-axis coordinate set as center.

nY

[in] Y-axis coordinate set as center.

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.

Samsung XNS ActiveX SDK | 254


CHAPTER 3
XnsSdkWindow Control Zoom

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

[in] Use the zoom ratio to calculate the width.

lfHeight

[in] Use the zoom ratio to calculate the height.

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:

Samsung XNS ActiveX SDK | 255


CHAPTER 3
XnsSdkWindow Control Zoom

Figure 3.1 Example of Zoom Rectangle

• lfX = 100/640 = 0.15625

• lfY = 50/480 = 0.1041667

• lfWidth = 320/640 = 0.5

• lfHeight = 240/480 = 0.5

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,

Samsung XNS ActiveX SDK | 256


CHAPTER 3
XnsSdkWindow Control Zoom

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

[out] Use the zoom ratio to calculate the width.

plfHeight

[out] Use the zoom ratio to calculate the height.

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.

Samsung XNS ActiveX SDK | 257


CHAPTER 3
XnsSdkWindow Control Zoom

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

[in] X-axis coordinate of top left.

nY

[in] Y-axis coordinate of top left.

nWidth

[in] Width of the rectangle.

nHeight

[in] Height of the rectangle.

Example

Samsung XNS ActiveX SDK | 258


CHAPTER 3
XnsSdkWindow Control Zoom

[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,

Samsung XNS ActiveX SDK | 259


CHAPTER 3
XnsSdkWindow Control Zoom

long nHeight,
long nR,
long nG,
long nB,
long nThick
);

Parameters
nIndex

[in] Index of the rectangle. (a value between 1 and 10).

nType

[in] Command type.

• Draw (=1): Draw a rectangle.

• Erase (=-1): Erase a rectangle.

nX

[in] X-axis coordinate of top left.

nY

[in] Y-axis coordinate of top left.

nWidth

[in] Width of the rectangle.

nHeight

[in] Height of the rectangle.

nR

[in] Red value in RGB color codes.

nG

[in] Green value in RGB color codes.

nB

[in] Blue value in RGB color codes.

nThick

[in] Line thickness.

Example
[C++]
m_ctlXnsWindow.DrawShape(1, 1, 10, 10, 50, 50, 255, 0, 0, 10);

Samsung XNS ActiveX SDK | 260


CHAPTER 3
XnsSdkWindow OSD Menu

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

[in] OSD ID.

bOnOff

[in] On/Off flag of the menu.

• On (=1): turn on OSD menu.

• Off (=0): turn off OSD menu.

Table 3-1 OSD Type

Type Value Description

OSD_ALL 0xFFFF Display all OSD menus.

OSD_TIME1 0x0001 Time & Date. Display in the second


line (default).

OSD_TIME2 0x0002 Time & Date. Display in the first line.

Samsung XNS ActiveX SDK | 261


CHAPTER 3
XnsSdkWindow OSD Menu

Type Value Description

OSD_IPS 0x0004 Images per second.

OSD_CAMNAME 0x0008 Camera name.

OSD_SPEED 0x0010 Play Speed.

OSD_PTZ 0x0020 PTZ control menu.

OSD_LISTEN 0x0040 Control the Listen operation.

OSD_TALK 0x0080 Display the Talk status.

OSD_ALARM 0x0100 Sensor event.

OSD_MOTION 0x0200 Motion event.

OSD_RECORDING 0x0400 Record in the local PC.

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

[in] Time and date format.

• 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

Samsung XNS ActiveX SDK | 262


CHAPTER 3
XnsSdkWindow OSD Menu

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

[in] Custom OSD string.

nX

[in] X-axis coordinate of top left.

nY

[in] Y-axis coordinate of top left.

nR

[in] Red value in RGB color codes.

nG

[in] Green value in RGB color codes.

nB

Samsung XNS ActiveX SDK | 263


CHAPTER 3
XnsSdkWindow OSD Menu

[in] Blue value in RGB color codes.

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

[in] On/Off flag of the menu.

• On (=1): turn on custom OSD.

• Off (=0): turn off custom OSD.

Example
[C++]
m_ctlXnsWindow.SetCustomOSDOnOff(1);

See Also
SetCustomOSD

Samsung XNS ActiveX SDK | 264


CHAPTER 3
XnsSdkWindow Control Volume

Control Volume

SetSound

Description
Turns on or off the sound.

Syntax
void SetSound(BOOL bSound);

Parameters
bSound

[in] On/Off flag of sound.

• 1: On the sound

• 0: Off 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

Samsung XNS ActiveX SDK | 265


CHAPTER 3
XnsSdkWindow Video Raw Data

[in] Volume level of the sound (a value between 0 and 100).

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

Video Raw Data

SetVideoRawDataReceived

Samsung XNS ActiveX SDK | 266


CHAPTER 3
XnsSdkWindow Video Raw Data

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

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized..

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

Samsung XNS ActiveX SDK | 267


CHAPTER 3
XnsSdkWindow Snapshot

);

Parameters
hMediaSource
[in] Media source handle. This value can be obtained using XnsSdkDevice::OpenMedia()..

Return Value

• ERR_SUCCESS: Function successfully performed.

• ERR_NOT_INITIALIZE: Library not initialized..

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
);

Samsung XNS ActiveX SDK | 268


CHAPTER 3
XnsSdkWindow Snapshot

Parameters
szFile

[in] File name to save.

nFormat

[in] File format of image.

• 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
);

Samsung XNS ActiveX SDK | 269


CHAPTER 3
XnsSdkWindow Snapshot

Parameters
szFile

[in] File name to save.

nFormat

[in] File format of image.

• 0: BMP file

• 1: JPG file

bShowCameraName

[in] Flag to display camera name on screen.

• On (=1): display camera name

• Off (=0): no display camera name

bUseLocalName

[in] Flag to display local name on screen.

• On (=1): display local name

• Off (=0): no display local name

bShowDateTime

[in] Flag to display date and time.

• On (=1): display date and time

• Off (=0): no display date and time

szUserNote

[in] Display the string that user want.

bUseTempSavedImage

[in] Not used.

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

Samsung XNS ActiveX SDK | 270


CHAPTER 3
XnsSdkWindow Snapshot

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

[in] File name to save.

nFormat

[in] File format of image.

• 0: BMP file

• 1: JPG file

Return Value
If saving the snapshot is successful, it returns 1. If saving it fails, it returns 0.

Samsung XNS ActiveX SDK | 271


CHAPTER 3
XnsSdkWindow Snapshot

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;

m_ctrlXnsSdkWindow.SaveSnapshotWithData(pVideoData, nVideoSize, nWidth, nHeight,


_T("C:\\Temp\\Samsung2.jpg"), 1);
}

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

Samsung XNS ActiveX SDK | 272


CHAPTER 3
XnsSdkWindow Control Playback

Control Playback

PushMedia

Description
Transfers stream data to XnsSdkWindow so that the media stream will be displayed on the
window after decoded.

If XnsSdkDevice::OpenStream is called, the stream data will be transferred to the application


from the OnNewMedia event. Then, the application should use PushMedia to forward the
stream data to XnsSdkWindow for decoding so that the video is properly displayed on the
screen. This function is valid only within the event handler of the OnNewMedia event.

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

• ERR_SUCCESS: Function successfully performed.

• ERR_BUFFER_FULL: No free space in buffer.

• ERR_INVALID_SEQUENCE: Invalid sequence.

Remarks
Start() should be called before you can use this function.

Start() of the parameters, you must enter a zero.

Example
[C++]
// Start() should be called before you can use this function.
void CTestSampleDlg::PushMedia()
{

Samsung XNS ActiveX SDK | 273


CHAPTER 3
XnsSdkWindow Control Playback

m_pMediaSource = 0;
m_ctlXnsWindow.Start(m_pMediaSource);
m_bPushMedia = 1;
}

void CTestSampleDlg::OnOnNewMediaXnssdkdevicectrl1(long nDeviceID, long nControlID, long


nMediaType, long hMediaData, long nInputType, long nFrameType, long nFrameTime, long
nFrameSize, long nTimeStamp)
{
if (m_bPushMedia)
{
m_ctlXnsWindow.PushMedia(hMediaData);
}
}

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

[in] Play speed.

Example
[C++]

Samsung XNS ActiveX SDK | 274


CHAPTER 3
XnsSdkWindow Control Playback

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);

Samsung XNS ActiveX SDK | 275


CHAPTER 3
XnsSdkWindow Control Buffer

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

Samsung XNS ActiveX SDK | 276


CHAPTER 3
XnsSdkWindow Control Buffer

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;

Samsung XNS ActiveX SDK | 277


CHAPTER 3
XnsSdkWindow Control Buffer

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

[in] Buffer size.

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.

Samsung XNS ActiveX SDK | 278


CHAPTER 3
XnsSdkWindow Control Buffer

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

Samsung XNS ActiveX SDK | 279


CHAPTER 3
XnsSdkWindow Get Display Information

Get Display Information

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();

long Year, Mon, Day, Hour, Min, Sec;


CString str;

m_ctlXnsWindow.TimetToDate(tTime, &Year, &Mon, &Day, &Hour, &Min, &Sec);


str.Format("OnGetCurrentFrametime XnsWindow1 [%04d-%02d-%02d %02d:%02d:%02d\n",
Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);

See Also
OnFrameTimeChanged, GetFirstFrameTime

GetFirstFrameTime

Description
Gets the first frame time.

Samsung XNS ActiveX SDK | 280


CHAPTER 3
XnsSdkWindow Get Display Information

Syntax
long GetFirstFrameTime(void);

Return Value
Returns the first frame time in time_t format.

Example
[C++]
long tTime = m_ctlXnsWindow.GetFirstFrameTime();

long Year, Mon, Day, Hour, Min, Sec;


CString str;

m_ctlXnsWindow.TimetToDate(tTime, &Year, &Mon, &Day, &Hour, &Min, &Sec);


str.Format("GetFirstFrameTime XnsWindow1 [%04d-%02d-%02d %02d:%02d:%02d\n",
Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);

See Also
GetCurrentFrameTime

Not Used(deprecated) - GetInputType

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

[in] Media data.

Return Value

Samsung XNS ActiveX SDK | 281


CHAPTER 3
XnsSdkWindow Get Display Information

Media type.

• XINPUT_VIDEO(1): Video data.

• XINPUT_AUDIO(2): Audio data.

Example
[C++]
long nInputType = m_ctlXnsWindow.GetInputType(hMediaData);

See Also
OnNewMedia Event of XnsSdkDevice

Not Used(deprecated) - GetFrameType

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

[in] Media data.

Return Value
Frame type.

• XFRAME_IVOP(1): Intra Frame.

• XFRAME_PVOP(2): P-Frame(Predictive frame).

• XFRAME_BVOP(3): B-Frame(Bi-directional predictive frame).

• XFRAME_END(4): Last Frame (No further frame remains).

Example
[C++]

Samsung XNS ActiveX SDK | 282


CHAPTER 3
XnsSdkWindow Get Display Information

long nFrameType = m_ctlXnsWindow.GetFrameType(hMediaData);

See Also
GetFrameTime, GetFrameSize

Not Used(deprecated) - GetFrameTime

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

[in] Media data.

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

Not Used(deprecated) - GetFrameSize

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.

Samsung XNS ActiveX SDK | 283


CHAPTER 3
XnsSdkWindow Get Display Information

Syntax
long GetFrameSize(long hMediaData);

Parameters
hMediaData

[in] Media data.

Return Value
Returns the data size of the frame in bytes.

Example
[C++]
long nFrameSize = m_ctlXnsWindow.GetFrameSize(hMediaData);

See Also
GetFrameTime

Not Used(deprecated) - GetTimeStamp

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

[in] Media data.

Return Value
Time stamp.

Samsung XNS ActiveX SDK | 284


CHAPTER 3
XnsSdkWindow Get Display Information

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

[in] Value of brightness (a value between 0 and 100).

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

Samsung XNS ActiveX SDK | 285


CHAPTER 3
XnsSdkWindow Get Display Information

Current brightness 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

[in] Value of contrast (a value between 1 and 100).

Example
[C++]
m_ctlXnsWindow.SetContrast(20);

See Also
GetContrast, SetBrightness, GetBrightness

GetContrast

Description
Gets the specified value of contrast.

Syntax

Samsung XNS ActiveX SDK | 286


CHAPTER 3
XnsSdkWindow Get Display Information

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

[in] De-interlace mode.

• 1: turn on de-interlace mode.

• 0: turn off de-interlace mode.

Example
[C++]
m_ctlXnsWindow.SetDeinterlaceMode(1);

SetDefogMode

Description

Samsung XNS ActiveX SDK | 287


CHAPTER 3
XnsSdkWindow Get Display Information

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

• 1 : enable horizontal flip.

• 0 : disable horizontal flip.

bVFlip
[in] Vertical flip mode

• 1 : enable vertical flip.

• 0 : enable vertical flip.

Example

Samsung XNS ActiveX SDK | 288


CHAPTER 3
XnsSdkWindow Get Display Information

[C++]
m_ctlXnsWindow.SetImageFlip(1, 1);

GetVideoPixelFormat

Description
Gets information of current video pixel format.

Syntax
long GetVideoPixelFormat(void);

Return Value
Video Pixel format.

• XVIDEO_PIXEL_UNKNOWN (0x0000) : Unknown

• XVIDEO_PIXEL_R555 (0x0002) : 16Bit, R555

• XVIDEO_PIXEL_R565 (0x0003) : 16Bit, R565

• XVIDEO_PIXEL_BGR24 (0x0004) : 24Bit, RGB

• XVIDEO_PIXEL_BGR32 (0x0005) : 32Bit, Non Alpha Channel

• XVIDEO_PIXEL_BGRA (0x0006) : 32Bit, With Alpha Channel

• XVIDEO_PIXEL_YV12 (0x0101) : 12Bit, YV12

Example
[C++]
long pixel_format = m_ctlXnsWindow.GetVideoPixelFormat();

See Also
OnVideoRawDataReceived

SetAspectRatio

Description
Enable or disable to keep aspect ratio.

Syntax

Samsung XNS ActiveX SDK | 289


CHAPTER 3
XnsSdkWindow Miscellaneous

void SetAspectRatio(BOOL bOn);

Parameters
bMode
[in] Keep aspect ratio

• 1: enable to keep aspect ratio.

• 0: disable to 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

[in] Flag to instruct to display a message of “No Data”.

• 1: Display a message of “No Data” on the screen.

• 0: No display a message of “No Data” on the screen.

Example

Samsung XNS ActiveX SDK | 290


CHAPTER 3
XnsSdkWindow Miscellaneous

[C++]
m_ctlXnsWindow.DisplayNoData(1);

SetCursor

Description
Sets the cursor type.

Syntax
void SetCursor(long nCursorID);

Parameters
nCursorID

[in] Cursor type.

• 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

Samsung XNS ActiveX SDK | 291


CHAPTER 3
XnsSdkWindow Miscellaneous

Returns the recent error code.

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

Samsung XNS ActiveX SDK | 292


CHAPTER 3
XnsSdkWindow Miscellaneous

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

[in] Data in time_t format to convert.

pnYear

[out] Year

pnMonth

[out] Month

pnDay

[out] Day

Samsung XNS ActiveX SDK | 293


CHAPTER 3
XnsSdkWindow Events

pnHour

[out] Hour

pnMinute

[out] Minute

pnSecond

[out] Second

Example
[C++]
long tTime = m_ctlXnsWindow.GetCurrentFrameTime();

long Year, Mon, Day, Hour, Min, Sec;


CString str;

m_ctlXnsWindow.TimetToDate(tTime, &Year, &Mon, &Day, &Hour, &Min, &Sec);

str.Format("OnGetCurrentFrametime XnsWindow1 [%04d-%02d-%02d %02d:%02d:%02d\n",


Year, Mon, Day, Hour, Min, Sec);
OutputDebugString(str);

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

Samsung XNS ActiveX SDK | 294


CHAPTER 3
XnsSdkWindow Events

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

[in] New frame time. Format: 4-byte time_t.

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

Samsung XNS ActiveX SDK | 295


CHAPTER 3
XnsSdkWindow Events

nWidth

[in] Width of the new image.

nHeight

[in] Height of the new image.

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

Samsung XNS ActiveX SDK | 296


CHAPTER 3
XnsSdkWindow Events

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
);

Samsung XNS ActiveX SDK | 297


CHAPTER 3
XnsSdkWindow Events

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++]

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;

ZeroMemory( &m_bmiHeader, sizeof(BITMAPINFOHEADER) );


m_bmiHeader.biWidth = m_nWidth;
m_bmiHeader.biHeight = m_nHeight*-1;
m_bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
m_bmiHeader.biPlanes = 1;
m_bmiHeader.biBitCount = 24;
m_bmiHeader.biCompression = BI_RGB;
m_bmiHeader.biClrImportant = 0;
m_bmiHeader.biSizeImage = m_nWidth * m_nHeight * (m_bmiHeader.biBitCount / 8);

long pixel_format = m_ctrlXnsSdkWindow.GetVideoPixelFormat();


if (pixel_format == XVIDEO_PIXEL_BGRA)
{

Samsung XNS ActiveX SDK | 298


CHAPTER 3
XnsSdkWindow Events

// 32bit RGB -> 24bit RGB


for(int i = 0 ; i < nHeight*nWidth; i++)
{
memcpy(&m_pVideoBuf[i*3],&pVideo[i*4],3);
}
}
else if (pixel_format == XVIDEO_PIXEL_R565)
{
// 16bit RGB -> 24bit RGB
unsigned short *pVideo16 = (unsigned short *)pVideo;
int index = 0;
for(int i = 0 ; i < nHeight*nWidth; i++)
{
unsigned short rgb16 = pVideo16[i];
m_pVideoBuf[index++] = (rgb16 & 0x001f) << 3;
m_pVideoBuf[index++] = (rgb16 & 0x07e0) >> 3;
m_pVideoBuf[index++] = (rgb16 & 0xf800) >> 8;
}
}

// Call OnPaint
Invalidate(FALSE);
}

See Also

ControlID, SetVideoRawDataReceived, UnSetVideoRawDataReceived, SaveSnapshotWithData,


GetVideoPixelFormat

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(

Samsung XNS ActiveX SDK | 299


CHAPTER 3
XnsSdkWindow Events

long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] Same as the flag used in window message by WM_LBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle button on the mouse is pressed.

• MK_RBUTTON: Right button on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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

Samsung XNS ActiveX SDK | 300


CHAPTER 3
XnsSdkWindow Events

void OnLButtonUp(
long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] Same as the flag used in window message by WM_LBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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.

Samsung XNS ActiveX SDK | 301


CHAPTER 3
XnsSdkWindow Events

Syntax
void OnRButtonDown(
long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] Same as the flag used in window message by WM_RBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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.

Samsung XNS ActiveX SDK | 302


CHAPTER 3
XnsSdkWindow Events

Syntax
void OnRButtonUp (
long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] Same as the flag used in window message by WM_RBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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.

Samsung XNS ActiveX SDK | 303


CHAPTER 3
XnsSdkWindow Events

Syntax
void OnLButtonDblClk (
long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] Same as the flag used in window message by WM_LBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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

Samsung XNS ActiveX SDK | 304


CHAPTER 3
XnsSdkWindow Events

Null.

Syntax
void OnRButtonDblClk (
long nFlags,
long nX,
long nY
);

Parameters
nFlags

[in] ] Same as the flag used in window message by WM_RBUTTONDOWN.

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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

Samsung XNS ActiveX SDK | 305


CHAPTER 3
XnsSdkWindow Events

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

[in] Same as the flag used in window message by WM_MOUSEMOVE

• MK_CONTROL: [Ctrl] key is pressed.

• MK_MBUTTON: Middle buton on the mouse is pressed.

• MK_RBUTTON: Right buton on the mouse is pressed.

nX

[in] X coordinate of the mouse pointer.

nY

[in] Y coordinate of the mouse pointer.

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

Samsung XNS ActiveX SDK | 306


CHAPTER 3
XnsSdkWindow Events

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

Samsung XNS ActiveX SDK | 307


CHAPTER 3
XnsSdkWindow Events

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

Samsung XNS ActiveX SDK | 308


CHAPTER 3
XnsSdkWindow Events

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()

Samsung XNS ActiveX SDK | 309


CHAPTER 3
XnsSdkWindow Events

{
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

[in] Previous status of event.

nNewEventStatus

[in] New status of event.

The event status can be combined in bit-wise method, which has the following values.

Table 3-2 Event Status

Event Value

XEVENT_ALL 0x000000ff

XEVENT_SENSOR 0x00000001

XEVENT_MOTION 0x00000002

XEVENT_VIDEOLOSS 0x00000004

Example
[C++]

Samsung XNS ActiveX SDK | 310


CHAPTER 3
XnsSdkWindow Events

void CTestSampleDlg::OnOnEventStatusChangedXnssdkwindowctrl1(long nOldEventStatus, long


nNewEventStatus)
{
CString str;
str.Format("On EventStatusChanged XnsWindow1 nOldEventStatus[%d]
nNewEventStatus[%d]\n", nOldEventStatus, nNewEventStatus);
OutputDebugString(str);
}

OnKeyDown

Description
This event occurs if the non-system key is pressed.

Syntax
void OnKeyDown (
long nChar,
long nRepCnt,
long nFlags
);

Parameters
nChar

[in] Virtual key code.

nRepCnt

[in] Repetition count (Count of keystrokes by the user pressing the key repeatedly).

nFlags

[in] see Table 3-3.

Table 3-3 Description About nFlags Items for the OnKeyDown Event

Bit Description

0~7 Scan code. (differs depending on the manufacturer).

8 Extension key such as function button or numeric pad.

9~10 Obsolete.

11~12 Internally used by MS Windows.

Samsung XNS ActiveX SDK | 311


CHAPTER 3
XnsSdkWindow Events

13 It will be 1 if [Alt] is also pressed; otherwise, it will be 0.

14 Previous key status. 1 if the key is already pressed before sending a


message; 0 if pressed and released.

15 0 if the key is pressed; 1 if released.

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

[in] Virtual key code.

nRepCnt

[in] Repetition count. (Count of keystrokes by the user pressing the key repeatedly).

Samsung XNS ActiveX SDK | 312


CHAPTER 3
XnsSdkWindow Events

nFlags

[in] see Table 3-4.

Table 3-4 Description about nFlags Items for the OnKeyUp Event

Bit Description

0~7 Scan code. (differs depending on the manufacturer).

8 Extension key such as function button or numeric pad.

9~10 Obsolete.

11~12 Internally used by MS Windows.

13 It will be 1 if [Alt] is also pressed; otherwise, it will be 0.

14 Previous key status. 1 if the key is already pressed before sending a


message; 0 if pressed and released.

15 0 if the key is pressed; 1 if released.

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

Samsung XNS ActiveX SDK | 313


Trouble shooting DEP
problem
Data Execution Prevention (DEP) is a security feature included in modern operating systems. It
is known to be available in Linux, Mac OS X, and Microsoft Windows operating systems and is
intended to prevent an application or service from executing code from a non-executable
memory region. But due to the DEP feature set, SDK may not run correctly. In this case, you
can disable DEP feature like follows:

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)"

In case of Visual Basic

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)"

Samsung XNS ActiveX SDK | 315


APPENDIX A
Trouble shooting DEP problem

Samsung XNS ActiveX SDK | 316


Error Code

In this chapter, the description of error codes returned by XNS ActiveX library is
provided.

Field Value Description

ERR_SUCCESS 0x00000000 Function successfully performed.

ERR_UNKNOWN 0x00000001 Unknown error.

Initialize

ERR_INVALID_CFG_FILE 0x00000010 Invalid Config.xml file.

ERR_CFG_FILE_READ_ERROR 0x00000011 Failed to read Config.xml file.

ERR_ALREADY_INITIALIZE 0x00000012 Library already initialized.

ERR_NOT_INITIALIZE 0x00000013 Library not initialized.

ERR_INVALID_DEVICE_HANDLE 0x00000014 Invalid device handle value

ERR_ALREADY_EXIST_DEVICEID 0x00000015 Device ID is already exist.

Device Connection

ERR_NOT_SUPPORTED_DEVICE 0x00000020 Incompliant device.

ERR_EXCEED_CONNECTION 0x00000021 Exceed the maximum allowed count of


connections.

ERR_NOT_CONNECT 0x00000022 Device not connected.

ERR_MAC_CONFLICT 0x00000023 Conflict between MAC addresses.

ERR_INVALID_VERSION 0x00000024 Invalid version.

ERR_INVALID_MODEL 0x00000025 Invalid model.

ERR_ALREADY_CONNECT 0x00000026 Already connected to the device.

Device Disconnection

ERR_DISCONNECT_LOGOUT_BY_ADMIN 0x000000e0 Logout by admin.

ERR_DISCONNECT_TIME_CHANGE 0x000000e1 Time change.

ERR_DISCONNECT_HDD_ERASE 0x000000e2 HDD erase.


APPENDIX B
Error Code

ERR_DISCONNECT_HDD_UNMOUNT 0x000000e3 HDD unmount.

ERR_DISCONNECT_LOAD_FACTORY_DEFA 0x000000e4 Load factory default.


ULT

ERR_DISCONNECT_IMPORTED_CONFIG 0x000000e5 Imported config.

ERR_DISCONNECT_SYSTEM_SHUTDOWN 0x000000e6 System shutdown.

ERR_DISCONNECT_REBOOT_MANUALLY 0x000000e7 Manually reboot.

ERR_DISCONNECT_REBOOT_UPGRADE 0x000000e8 System upgrade.

ERR_DISCONNECT_NETWORK_CHANGE 0x000000e9 Network change.

Login Error

ERR_INVALID_USERID 0x00000030 Invalid user ID.

ERR_WRONG_PASSWORD 0x00000031 Password mismatches.

ERR_LOGIN 0x00000032 Failed to login.

ERR_ADMIN_CONFLICT 0x00000033 Other user has already logged in as


admin.

ERR_USER_FULL 0x00000034 Exceed the maximum number of


concurrent users.

Query Request

ERR_XNS_BUSY 0x00000040 Busy with other operation.

ERR_BAD_NETWORK 0x00000041 Unstable network connection.

ERR_REQUEST_TIME_OUT 0x00000042 No response to the user request for a


certain amount of time.

ERR_INVALID_PARAMETER 0x00000043 Invalid parameter.

ERR_NO_PERMISSION 0x00000044 No permission granted.

ERR_NOT_SUPPORTED_COMMAND 0x00000045 Command not supported.

File Transfer

ERR_INVALID_FILE 0x00000050 Invalid file.

ERR_UPLOAD_FAIL 0x00000051 Failed to upload the file.

ERR_IMPORT_FAIL 0x00000052 Failed to import the file.

ERR_EXPORT_FAIL 0x00000053 Failed to export the file.

ERR_FILE_TRANSFERRING 0x00000054 Failed to transfer the file.

Media Open

ERR_MEDIA_ALREADY_OPEND 0x00000060 Media already opened.

Samsung XNS ActiveX SDK Reference | 318


APPENDIX B
Error Code

PTZ Control

ERR_PTZ_CONFLICT 0x00000070 Conflict when in PTZ operation.

XnsWindow Error

ERR_INVALID_OBJID 0x00000080 Invalid object ID.

ERR_ALREADY_RUN 0x00000081 Already in process.

ERR_MEDIA_NOT_OPENED 0x00000082 Media not opened.

ERR_MEDIA_PAUSED 0x00000083 Media stopped playing temporarily.

ERR_MEDIA_PLAYED 0x00000084 Media currently playing.

ERR_MEDIA_DISCONNECTED 0x00000085 Media disconnected.

File Error

ERR_FILE_ALREADY_OPEND 0x00000090 File already opened.

ERR_FILE_NOT_OPEND 0x00000091 File not opened.

ERR_FILE_OPEN 0x00000092 Failed to open the file.

ERR_FILE_SEEK 0x00000093 Failed to seek the file.

ERR_FILE_READ 0x00000094 Failed to read the file.

ERR_FILE_WRITE 0x00000095 Failed to write the file.

ERR_INVALID_FRAME 0x00000096 Invalid frame.

ERR_WRITE_STOPPED 0x00000097 Writing stopped.

ERR_WRITE_LIMITED 0x00000098 Writing restricted.

ERR_WRITE_EMPTY 0x00000099 No data to be written so far.

ERR_DISK_FULL 0x0000009a No disk free space.

ERR_READ_END 0x0000009b Reading the file ended.

ERR_ALREADY_RECORDED 0x0000009c Already recorded.

ERR_BACKUP_DOING 0x0000009d Currently in backup process

OTHERS

ERR_INVALID_XML 0x000000b0 Invalid XML file.

ERR_OVERLAPPED 0x000000b1 Failed to OVERLAPPED IO operations.

ERR_LIMITED 0x000000b2 Use restricted.

ERR_BUFFER_FULL 0x000000c0 No free space in buffer.

ERR_INVALID_SEQUENCE 0x000000c1 Invalid sequence.

ERR_TALK_ALREADY_USE 0x000000c2 Talk function is already used by other

Samsung XNS ActiveX SDK Reference | 319


Glossary

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

Software Development Kit


Index

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

C DrawRect .................................................................... 186


DrawShape ................................................................ 187
ChangeControlLocalName....................................62
ExecuteHPtz ................................................................ 97
ClearDraw .................................................................. 187
ExportConfig ............................................................ 128
ClearMediaBuffer ................................................... 198
ClearZoom ................................................................ 185
CloseFind ......................................................................30
CloseMedia ..................................................................68
CloseStream ................................................................70
F
Connect .........................................................................44 file player ..................................................................... 19
ConnectNonBlock .....................................................46 FindConfigChildeKeyList ..................................... 135
control ID .....................................................................49 FindDevice ................................................................... 26
Controllable module ...............................................48 FindModel ................................................................... 25
ControlMenu ...............................................................95 FindVendor.................................................................. 24
ControlPPtz ..................................................................94 FrameAdvance ........................................................... 81
ControlPtz ....................................................................89
ControlPtzFreeMove ................................................90
ControlPtzSpeedZoomIn .......................................92
ControlPtzSpeedZoomOut ...................................93 G
CopyXml .................................................................... 134
GetAddressType ........................................................ 37
CreateDevice ...............................................................31
GetBrightness .......................................................... 207
CreateFileReader .................................................... 121
GetBufferSize ........................................................... 200
GetCameraCount ................................................... 111
GetConfigPath ........................................................... 23
GetContrast .............................................................. 208 GetPreset ................................................................... 103
GetControlCapability ...............................................58 GetPresetCount ....................................................... 102
GetControlCount .......................................................51 GetPresetList .............................................................. 98
GetControlDepth.......................................................53 GetPtzPos .................................................................. 105
GetControlID ............................................................ 179 GetRemainingBufferSize ..................................... 201
GetControlLocalName ............................................54 GetTimeline .............................................................. 113
GetControlNumber ..................................................52 GetTimelineCount .................................................. 111
GetControlRemoteName .......................................55 GetTimelineHandle ................................................ 124
GetControlStatus .......................................................56 GetTimeStamp ......................................................... 206
GetControlType ..........................................................51 GetURL .......................................................................... 39
GetCurrentFrameTime ......................................... 201 GetUserID .................................................................... 41
GetDeviceHandle ......................................................43 GetVendorName ....................................................... 36
GetDeviceID ..................................................... 34, 178 GetVersion ................................................................... 37
GetDeviceStatus ........................................................35 GetVolume ................................................................ 192
GetErrorString .......................................................... 143 GetZoomInfo ............................................................ 184
GetFileName ............................................................ 123
GetFindDouble ...........................................................29
GetFindLong ...............................................................28
GetFindSize ..................................................................26 H
GetFindString ..............................................................27
HasAuthority .............................................................. 76
GetFirstFrameTime ................................................ 202
GetFrameSize ........................................................... 205
GetFrameTime ......................................................... 204
GetFrameType ......................................................... 203
GetHttpPort .................................................................41
I
GetImageHeight ..................................................... 180 ImportConfig ........................................................... 127
GetImageWidth ...................................................... 179 Initialize .............................................................. 22, 176
GetInputType ........................................................... 203 IPInstall ....................................................................... 141
GetIP ...............................................................................38 IsBufferEmpty ........................................................... 199
GetLastError .............................................................. 211 IsBufferFull ................................................................ 198
GetLastestUpdateTime ...........................................43 IsMedia ....................................................................... 180
GetMac ..........................................................................39 IsPlaying ....................................................................... 76
GetMediaSource ..................................................... 123
GetMediaType ......................................................... 181
GetModelName .........................................................36
GetParentControlID ..................................................63 L
GetPassword ...............................................................42
LoadDeviceProfile .................................................. 129
GetPlaySpeed .......................................................... 196
LocalTimeToDeviceUTC ....................................... 139
GetPort ..........................................................................40
OnLButtonDown ..................................................... 217
M OnLButtonUp ........................................................... 218
MoveFrameAdvance ............................................. 197 OnMediaOff.............................................................. 216
OnMediaOn .............................................................. 216
OnMotionEvent ....................................................... 160
OnMouseHover....................................................... 224
OnMouseLeave ....................................................... 224

N OnMouseMove ....................................................... 223


OnNewMedia ........................................................... 168
Network Device .........................................................18
OnPasswordChanged ........................................... 166
OnPreBufferEmpty ................................................. 227
OnPreBufferFull ....................................................... 226
OnPtzControlFailed ............................................... 170
O OnRButtonDblClk ................................................... 222
OnAlarmOutControlFailed ................................. 171 OnRButtonDown .................................................... 219
OnBackupProgress ................................................ 167 OnRButtonUp .......................................................... 220
OnBufferEmpty ....................................................... 226 OnSearchCalendar ................................................. 148
OnBufferFull ............................................................. 225 OnSearchDay ........................................................... 150
OnConnectFailed.................................................... 147 OnSensorEvent ........................................................ 161
OnControlCapabilityChanged .......................... 158 OnUploadSoftwareProgress .............................. 153
OnControlLocalNameChanged ....................... 144 OnVideoLossEvent ................................................. 163
OnControlRemoteNameChanged .................. 172 OpenMedia .......................................................... 65, 67
OnControlStatusChaged ..................................... 157 OpenMediaEx ............................................................ 67
OnDeviceDetected ................................................ 146 OpenStream ............................................................... 69
OnDeviceStatusChanged .................................... 156
OnEventStatusChanged ...................................... 227
OnExportConfigProgress .................................... 155
OnFanBroken ........................................................... 170 P
OnFrameTimeChanged ....................................... 214
Pause ............................................................................. 79
OnGetPresetList ...................................................... 151
PauseReader ............................................................. 125
OnGetPtzPos ............................................................ 173
Play 78
OnHDDFailed ........................................................... 164
PlayReader ................................................................ 125
OnHDDFulled .......................................................... 165
PrintSnapshot .......................................................... 194
OnImageResolutionChanged ........................... 215
PushMedia ................................................................ 194
OnImportConfigProgress ................................... 154
OnIvOccurEvent ...................................................... 162
OnKeyDown ............................................................. 228
OnKeyUp ................................................................... 230
OnLButtonDblClk ................................................... 221
R
ReadConfigValue .................................................... 132 StopBackup ............................................................... 121
ReleaseDevice .............................................................31 StopLocalRecording .............................................. 117
ReleaseFileReader .................................................. 122 SuspendAllStream .................................................... 72
ReleaseMediaAuthority ..........................................64 SuspendStream ......................................................... 71
ResumeAllStream ......................................................74
ResumeStream ...........................................................73

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

or with modifications and/or translated into another required to print an announcement.)

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

addressed as "you". from the Program, and can be reasonably considered

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

that refer to this License and to the absence of any Program.

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

protection in exchange for a fee. of this License.

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

fitness for a particular purpose; order to qualify, an Indemnified Contributor must: a)


promptly notify the Commercial Contributor in writing of
such claim, and b) allow the Commercial Contributor to
control, and cooperate with the Commercial Contributor in,
the defense and any related settlement negotiations. The If any provision of this Agreement is invalid or
Indemnified Contributor may participate in any such claim unenforceable under applicable law, it shall not affect the
at its own expense. validity or enforceability of the remainder of the terms of
this Agreement, and without further action by the parties
For example, a Contributor might include the Program in a
hereto, such provision shall be reformed to the minimum
commercial product offering, Product X. That Contributor
extent necessary to make such provision valid and
is then a Commercial Contributor. If that Commercial
enforceable.
Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims If Recipient institutes patent litigation against a
and warranties are such Commercial Contributor's Contributor with respect to a patent applicable to software
responsibility alone. Under this section, the Commercial (including a cross-claim or counterclaim in a lawsuit), then
Contributor would have to defend claims against the other any patent licenses granted by that Contributor to such
Contributors related to those performance claims and Recipient under this Agreement shall terminate as of the
warranties, and if a court requires any other Contributor to date such litigation is filed. In addition, if Recipient
pay any damages as a result, the Commercial Contributor institutes patent litigation against any entity (including a
must pay those damages. cross-claim or counterclaim in a lawsuit) alleging that the
Program itself (excluding combinations of the Program
5. NO WARRANTY
with other software or hardware) infringes such Recipient's
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, patent(s), then such Recipient's rights granted under
THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, Section 2(b) shall terminate as of the date such litigation is
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, filed.
EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
All Recipient's rights under this Agreement shall terminate
LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
if it fails to comply with any of the material terms or
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR
conditions of this Agreement and does not cure such
A PARTICULAR PURPOSE. Each Recipient is solely
failure in a reasonable period of time after becoming
responsible for determining the appropriateness of using
aware of such noncompliance. If all Recipient's rights
and distributing the Program and assumes all risks
under this Agreement terminate, Recipient agrees to cease
associated with its exercise of rights under this Agreement,
use and distribution of the Program as soon as reasonably
including but not limited to the risks and costs of program
practicable. However, Recipient's obligations under this
errors, compliance with applicable laws, damage to or loss
Agreement and any licenses granted by Recipient relating
of data, programs or equipment, and unavailability or
to the Program shall continue and survive.
interruption of operations.
Everyone is permitted to copy and distribute copies of this
6. DISCLAIMER OF LIABILITY
Agreement, but in order to avoid inconsistency the
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, Agreement is copyrighted and may only be modified in
NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL the following manner. The Agreement Steward reserves
HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, the right to publish new versions (including revisions) of
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL this Agreement from time to time. No one other than the
DAMAGES (INCLUDING WITHOUT LIMITATION LOST Agreement Steward has the right to modify this
PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF Agreement. IBM is the initial Agreement Steward. IBM may
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR assign the responsibility to serve as the Agreement
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING Steward to a suitable separate entity. Each new version of
IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE the Agreement will be given a distinguishing version
PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED number. The Program (including Contributions) may always
HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF be distributed subject to the version of the Agreement
SUCH DAMAGES. under which it was received. In addition, after a new

7. GENERAL version of the Agreement is published, Contributor may


elect to distribute the Program (including its Contributions)
under the new version. Except as expressly stated in
Sections 2(a) and 2(b) above, Recipient receives no rights
or licenses to the intellectual property of any Contributor
under this Agreement, whether expressly, by implication,
estoppel or otherwise. All rights in the Program not
expressly granted under this Agreement are reserved.

This Agreement is governed by the laws of the State of


New York and the intellectual property laws of the United
States of America. No party to this Agreement will bring a
legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights
to a jury trial in any resulting litigation.

Special exception for LZMA compression


module
Igor Pavlov and Amir Szekely, the authors of the LZMA
compression module for NSIS, expressly permit you to
statically or dynamically link your code (or bind by name)
to the files from the LZMA compression module for NSIS
without subjecting your linked code to the terms of the
Common Public license version 1.0. Any modifications or
additions to files from the LZMA compression module for
NSIS, however, are subject to the terms of the Common
Public License version 1.0.

You might also like