Genius Vision SDK Documentation
GvClientX Control: Example Page
GvClientX Control: Example Page in Preview Browser
Insert an OBJECT tag for GvClientX control
Insert an OBJECT tag for GvLiveX control
Single-Sign-On Example with PHP
How to use SDK to receive and query events
Establishing Control Connection
How to open multiple live view windows (and from multiple NVR servers)
Switching between multi-channel 2x2 layout and 3x3 layout
How to query live alarm information and receive notification
How to control remote PTZ camera
Copyright and Preface
Licensing Prerequisites
You are required to sign the "SDK Licensing Terms" document (a separate legal document, available upon request) and acquire the rights to use the SDK, before you can proceed with reading and using any materials specified in this document. If you have not yet signed the "SDK Licensing Terms", then you are not authorized to use this SDK/API or any information in it. In this case, You should not retain any copies of related materials as well.
Purpose
The GvLiveX SDK is for ActiveX/Web based integration and allows third-party to write simple programs to manipulate the Genius Vision NVR client-side functions externally.
Target audience
You need to have basic understanding of HTML and web client-side (JavaScript) scripting in order to understand this section.
Copyright Notice & Disclaimer
The "Software" or "SDK" are proprietary properties of "Genius Vision Inc." It is a violation of international copyright law to redistribute or reverse-engineer the software without explicit permission from Genius Vision Inc. We reserve all rights to the software except for the online evaluation demonstration purpose.
Following is the no warranty disclaimer to give forward warning to users that are about to use the "Software", given by Genius Vision Inc. as a commercial software developer in good will:
Genius Vision Inc. develops commercial software in the hope that it will be useful. However all commercial software vendors, including Genius Vision Inc., cannot and will not guarantee the "Software" itself is free of defects or vulnerabilities. We exclude the implied warranty of (1) fitness for a particular purpose (2)merchantability (3) non-infringement. We WILL ALSO NOT be held liable in any damages that may be caused by non-malicious intentions. Therefore before you put the "Software" into serious use, it is your sole responsibility to evaluate and ensure its fitness.
In the situation of SDK interface, we do not guarantee that (1) the interface do not change (2) give notification upon notification.
If bugs or defects are found, we are willing to fix them with or without fees in the commercially reasonable terms.
Getting Started
Overview
There are two main ActiveX control in GvClientX SDK. Their usage scenario and characteristics are compared as follows:
Aspect |
GvClientX Control |
GvLiveX Control |
Code size |
Larger |
Smaller |
Functions |
Full client functions. |
Very limited functions, mainly: play live video. |
See also:
GvClientX Control: Example Page
<HTML> |
GvClientX Control: Example Page in Preview Browser
The HTML code illustrated above looks like the following picture when viewed in browser. Provided the GvClientX Control is properly installed.
Insert an OBJECT tag for GvClientX control
To insert an ActiveX control, use following HTML syntax:
<OBJECT ID="GvActiveXHost" CLASSID="CLSID:D42DC89F-7570-42E0-87B3-43D7437DC28C" |
The "CODEBASE" is optional if you wish to do over-the-web install mechanism, by which you have to put the .cab file into the correct path of the web server. The above is only an example. One should replace "146" (two occurrences) into proper version numbers.
Insert an OBJECT tag for GvLiveX control
Similar to the example above, the GvLiveX Control is inserted in following OBJECT syntax:
<OBJECT ID="GvActiveXHost" CLASSID="CLSID:bf863957-f6a7-4a3b-bd23-523b1fc47d35" |
The above is only an example. One should replace "234" into proper version numbers.
Single-Sign-On Example with PHP
Following example demonstrate how to use PHP to generate a remote-client web page that by-passes Genius Vision NVR password-login.
<?php |
Note you need to change <correct_auth_key_value> to correct value. You need to contact software vendor to do that.
GvClientX Control References
This document is part of GvClientX SDK. Read "SDK Licensing Terms" before use.
Control Summary Information
Class ID |
D42DC89F-7570-42E0-87B3-43D7437DC28C |
Licensing Term |
|
Availability |
<NVR_Program_Installation_Dir>\Redist\GvClientX<Version>.CAB |
Introduction |
Provides full-function Genius Vision NVR remote client. Features:
|
Function OpenSimpleConsole()
Synopsis
This function opens a console window. Other client-based function is not available to use before this function is called.
Syntax
GvActiveXHost.OpenSimpleConsole(<RemoteHost>, <Port>, <UserName>, <Password>, <Channel>, <Options>);
Parameters
Parameters |
Data Type |
Description |
RemoteHost |
String |
Identifies the remote host, in IP address. |
Port |
Integer |
TCP/IP port. Default port of Genius Vision NVR service is 3557. |
UserName |
String |
The user name. |
Password |
String |
The password, in plain text. |
Channel |
String |
The channel name identifier. |
Options |
String |
Additional options. See "Options" sections for details. |
Options
Some options can be specified together. To specify two or more options, simply concatenating the option strings into the final string value.
Option |
Description |
:embed: |
Specify this option if you want the control to be embedded in the web page |
:resolve: |
Resolve "RemoteHost" through DNS. If one don't specify this option, RemoteHost can only be IP address, not host names. |
:audio: |
Initialize the console with audio rendering default enabled. |
:low_speed: |
Specify this option to skip the initial GOV to be dispatched. This may, however, introduce certain initial video delay. May be used when network bandwidth is a under consideration. |
:min_menu: |
Minimal player menu. |
:no_menu: |
Display player menu. |
:no_snapshot: |
Disable snapshot function. |
:no_export: |
Disable export footage function. |
Function TakeJPEGSnapshot()
Synopsis
This function captures a single JPEG frame from the console player window and store in a specified file path.
Syntax
GvActiveXHost.TakeJPEGSnapshot(<FilePath>, <Options>);
Parameters
Parameters |
Data Type |
Description |
FilePath |
String |
Specifies the file path of the JPEG file to be captured. |
Options |
String |
Reserved for future use. Should be an empty string ("") for current version. |
Function OpenFullConsole()
Synopsis
This function opens a remote full console window. This function cannot be used with other SDK client controls (since the full console has taken full control). To use other client-based control function, use OpenSimpleConsole() instead.
Syntax
GvActiveXHost.OpenFullConsole(<RemoteHost>, <Port>, <Options>);
Parameters
Parameters |
Data Type |
Description |
RemoteHost |
String |
Identifies the remote host, in IP address. |
Port |
Integer |
TCP/IP port. Default port of Genius Vision NVR service is 3557. |
Options |
String |
Reserved for future use. Should be an empty string ("") for current version. |
Remarks
Depending on actual licensing scheme, this function may NOT be available.
Function OpenFullConsole2()
Synopsis
Extended version of OpenFullConsole().
Syntax
GvActiveXHost.OpenFullConsole2(<RemoteHost>, <Port>, <UserName>, <Password>, <SsoKey>, <Options>);
Parameters
Parameters |
Data Type |
Description |
RemoteHost |
String |
Identifies the remote host, in IP address. |
Port |
Integer |
TCP/IP port. Default port of Genius Vision NVR service is 3557. |
UserName |
String |
User name |
Password |
String |
Password |
SsoKey |
String |
Single-Sign-On key. Refer to GvServerComm.SetSingleSignOn() for more information. |
Options |
String |
Reserved for future use. Should be an empty string ("") for current version. |
Remarks
Depending on actual licensing scheme, this function may NOT be available.
See also
Function SetLanguage()
Synopsis
Changes active language for GUI.
Syntax
GvActiveXHost.SetLanguage(<Language>);
Parameters
Parameters |
Data Type |
Description |
Language |
String |
Current valid values are
|
Remarks
The change only take effect in client side, not in server side.
Function ParseScalarTime()
Synopsis
Converts Year/Month/Day/Hour/Minute/Second into a Scalar Time value.
Syntax
<ScalarTime> = GvActiveXHost.ParseScalarTime(<Year>, <Month>, <Day>, <Hour>, <Minute>, <Second>);
Parameters
Parameters |
Data Type |
Description |
Year/Month/Day |
Integer |
Year, month, and day in integer. |
Hour/Minute/Second |
Integer |
Hour, minute, and second in integer. |
Return Value
Scalar Time, which is floating-point (double) typed value.
Function PlaySeek()
Synopsis
Seek to a specified time to playback.
Syntax
GvActiveXHost.PlaySeek(<Time>, <Options>);
Parameters
Parameters |
Data Type |
Description |
Time |
Double |
Time represented in Scalar Time. Please use ParseScalarTime(). |
Options |
String |
Not currently used. Must be empty string. |
GvLiveX Control References
This document is part of GvClientX SDK. Read "SDK Licensing Terms" before use.
Control Summary Information
Class ID |
bf863957-f6a7-4a3b-bd23-523b1fc47d35 |
Licensing Term |
|
Availability |
<NVR_Program_Installation_Dir>\Redist\GvLiveX.CAB |
Introduction |
Provides embedded live viewing of remote Genius Vision NVR. |
Function OpenSimpleConsole()
Synopsis
This function opens a console window, or embed a window inside the control. This function can be called repeatedly. A call to this function will reset effect of previous call.
Syntax
GvActiveXHost.OpenSimpleConsole(<RemoteHost>, <Port>, <UserName>, <Password>, <Channel>, <Options>);
Parameters
Parameters |
Data Type |
Description |
RemoteHost |
String |
Identifies the remote host, in IP address. If you wish to specify domain name, you need to add ":resolve:" option to "Options" parameter. |
Port |
Integer |
TCP/IP port. Default port of Genius Vision NVR service is 3557. |
UserName |
String |
The user name. |
Password |
String |
The password, in plain text. |
Channel |
String |
The channel name identifier. |
Options |
String |
Additional options. See "Options" sections for details. |
Options
Some options can be specified together. To specify two or more options, simply concatenating the option strings into the final string value.
Option |
Description |
:embed: |
Specify this option if you want the control to be embedded in the web page |
:resolve: |
Resolve "RemoteHost" through DNS. If one does not specify this option, RemoteHost can only be IP address, not host names. |
:stretch: |
Strech video to window size. Without this option, video is displayed as the original video size. |
Function SetLanguage()
Synopsis
Changes active language for GUI.
Syntax
GvActiveXHost.SetLanguage(<Language>);
Parameters
Parameters |
Description |
Language |
Current valid values are
|
Remarks
The change only take effect in client side, not in server side.
Function OpenControl()
Synopsis
Creates a control connection toward the Genius Vision NVR server.
Syntax
GvActiveXHost.OpenControl(<Control>, <RemoteHost>, <Port>, <UserName>, <Password>, <Options>, <CallbackFunc>, <EventOptions>);
Parameters
Parameters |
Data Type |
Description |
Control |
String |
Object name of this control connection. |
RemoteHost |
String |
Identifies the remote host, in IP address. If you wish to specify domain name, you need to add ":resolve:" option to "Options" parameter. |
Port |
Integer |
TCP/IP port. Default port of Genius Vision NVR service is 3557. |
UserName |
String |
The user name. |
Password |
String |
The password, in plain text. |
Options |
String |
Additional options. See "Options" sections for details. |
CallbackFunc |
String |
Callback script function name. |
EventOptions |
String |
Options to specify event subscription. See "EventOptions" sections for details. |
Options
Option |
Description |
:resolve: |
Resolve "RemoteHost" through DNS. If one don't specify this option, RemoteHost can only be IP address, not host names. |
EventOptions
Option |
Description |
:conn: |
Connection events. Including "Connecting", "Connected", "Disconnected", "ConnectFailed". |
:auth: |
Authorization events. Including "UserAuthorized", "AccessDenied". |
:chind=<channel>: |
Channel indication events. Delivered by "SetDeviceInfo" and "ClearDeviceInfo" |
:userlog: |
Receive Userlog (such as alarm) update events. |
:query: |
Query all Userlog items at start. Must be used in conjunction with ":userlog:" |
Function OpenLivePlayer()
Synopsis
Open a new live video player.
Syntax
GvActiveXHost.OpenLivePlayer(<Control>, <Player>, <Channel>, <x>, <y>, <width>, <height>, <Options>);
Parameters
Parameters |
Data Type |
Description |
Control |
String |
Name of the control connection. |
Player |
String |
Name of the player. |
x, y, width, height |
Integer |
Location of the newly opened player. |
Options |
String |
Additional options. See "Options" sections for details. |
Options
Some options can be specified together. To specify two or more options, simply concatenating the option strings into the final string vaue.
Option |
Description |
:embed: |
Specify this option if you want the control to be embedded in the web page |
:fast: |
Use DirectX to render instead of GDI, which will be faster. |
:stretch: |
Stretch video to window size. Without this option, video is displayed as the original video size. |
:auto_fit: |
Automatically fit window to parent window size. |
Function PtzControl()
Synopsis
執行PTZ控制操作。
Syntax
GvActiveXHost.PtzControl(<Control>, <Channel>, <Command>, <Value>, <dx>, <dy>);
Parameters
Parameters |
Description |
Control |
Name of the control connection. |
Channel |
Name of the channel. |
Command |
PTZ command, please refer to next table. |
Value |
A parameter that might be required by the PTZ command. |
dx, dy |
Not used for now, must be zeroes. |
PTZ Commands
Command |
Description |
Mv:Dir:<Num> |
Move by direction. <Num> specify direction number. If the PTZ camera is a 8-direction one, then <Num> ranges from 0 to 7, if 4-direction one, <Num> ranges from 0 to 3. |
Stop |
Stop all PTZ commands. |
Mv:ZI |
Zoom-in. |
Mv:ZO |
Zoom-out. |
Mv:Wheel |
Zoom-in or out, depending on the sign (positive or negative) of the Value. |
Pset:Set |
Preset set, Value specifies preset number. |
Pset:Recall |
Preset recall, Value specifies preset nubmer. |
Function ParseScalarTime()
Synopsis
Converts year/month/day/hour/minute/second to Scalar Time.
Syntax
<ScalarTime> = GvActiveXHost.ParseScalarTime(<Year>, <Month>, <Day>, <Hour>, <Minute>, <Second>);
Parameters
Parameters |
Data Type |
Description |
Year/Month/Day |
Integer |
年/月/日 |
Hour/Minute/Second |
Integer |
時/分/秒 |
Return Value
Scalar Time,其為浮點數double型態。
Function FormatScalarTime()
Synopsis
Convert Scalar Time to string format.
Syntax
<FormattedDateTime> = GvActiveXHost.FormatScalarTime(<ScalarTime>);
Parameters
Parameters |
Data Type |
Description |
ScalarTime |
Double |
Scalar Time, which is a floating point (double) typed scalar date/time value. |
Return Value
String will be formatted in this manner: YYYY-MM-DD HH:NN:SS
“NN” means minutes.
Function OpenQueryQueue()
Synopsis
Open query queue.
Commands issued to a particular queue will be executed in first-in-first-out order. You can also open different queues for concurrent operations.
Syntax
GvActiveXHost.OpenQueryQueue(<Control>, <Query>, <CallbackFunc>, <Options>);
Parameters
Parameters |
Data Type |
Description |
Control |
String |
Name of the control connection. The reference object must be pre-existing. |
Query |
String |
Name of the query queue object to be created. |
CallbackFunc |
String |
The callback function name. |
Options |
String |
Extra options. |
Function QueryEvent()
Synopsis
Query archived events.
Syntax
GvActiveXHost.QueryEvent(<Query>, <Cookie>, <Channel>, <StartTime>, <EndTime>);
Parameters
Parameters |
Data Type |
Description |
Query |
String |
Name of the query queue object. The referenced object must be pre-existing. |
Cookie |
String |
The cookie of current query. This value will be passed to CallbackFunc for reference. |
Channel |
String |
Name of the target channel. |
StartTime |
Double |
Start time. Type is of “Scalar Time” |
EndTime |
Double |
End time. Type is of “Scalar Time” |
Event Object Reference
Field |
Description |
Availability |
Type |
Data type, can be one of the following
|
Always available. |
Event |
Event type, when Type=Event, this value can be one of the following values:
Event type, when Type=Query, this value can be one of the following values:
|
Type=Event|Query |
Tag1 |
When Event=SetDeviceInfo, this value is the channel name of the SetDeviceInfo directive. When Event=ClearDeviceInfo時, this value is the channel name of the ClearDeviceInfo directive. |
Type=Event , Event=SetDeviceInfo|ClearDeviceInfo |
Tag2 |
When Event=SetDeviceInfo, this value specify the parameter name to set. When Event=ClearDeviceInfo, this value specify the parameter name prefix to be cleared (deleted). |
Type=Event , Event=SetDeviceInfo|ClearDeviceInfo |
Tag3 |
When Event=SetDeviceInfo, this value is the desired value to be set into the parameter. |
Type=Event , Event=SetDeviceInfo |
EntryType |
Type of an DataEntry, can be one of following value:
|
Type=DataEntry |
Key |
The primary key of DataEntry. |
Type=DataEntry |
UserlogType |
Type of Userlog, can be one of the following:
|
Type=DataEntry, EntryType=GV_Userlog |
Time |
Creation time of the Userlog record. |
Type=DataEntry, EntryType=GV_Userlog |
MessageRid |
Message resource identifier of an Userlog. |
Type=DataEntry, EntryType=GV_Userlog |
s_chname |
Channel name associated with a Userlog record, if any. |
Type=DataEntry, EntryType=GV_Userlog |
s_user |
User name associated with a Userlog record, if any. |
Type=DataEntry, EntryType=GV_Userlog |
AlarmTypes |
Types of alarm included in in alarm instance. It could be any combination of following strings, delimited by semicolon:
|
Type=DataEntry, EntryType=GV_Userlog, UserlogType=Alarm |
AlarmState |
State of an alarm record, can be one of the following value:
|
Type=DataEntry, EntryType=GV_Userlog, UserlogType=Alarm |
EventType |
Type of event:
|
Type=Query, Event=Query.Event |
StartTime |
Start time of an event. |
Type=Query, Event=Query.Event |
EndTime |
End time of an event. |
Type=Query, Event=Query.Event |
F1 |
Data field 1 of an event
|
Type=Query, Event=Query.Event |
F2 |
Data field 2 of an event
|
Type=Query, Event=Query.Event |
F3 |
Data field 3 of an event, currently unused. |
Type=Query, Event=Query.Event |
DeviceInfo Reference
DeviceInfo |
Meaning |
Possible values |
cind.rec |
Recording indication. |
0, 1 |
cind.alarm |
Channel alarm indication. |
0, 1, 2 |
cind.disabled |
Channel disable indication. |
0, 1 |
cind.vloss |
Channel video loss indication. |
0, 1 |
ptz.enabled |
PTZ support indication. |
0, 1 |
ptz.direction |
PTZ number of directions. |
4, 8 |
ptz.levels |
PTZ number of speed levels. |
(Positive integer) |
dev.model |
Device model (if any) |
(String description) |
dev.ioport.<num>.id |
IO port identifier |
(String description) |
dev.ioport.<num>.dir |
IO port type (in or out) |
in, out |
dev.ioport.<num>.state |
IO port state |
0, 1 |
How to use SDK to receive and query events
This document is part of GvClientX SDK. Read "SDK Licensing Terms" before use.
Note: Some parts of this section is not yet translated to English. If you need the English translation urgently, please contact us.
Introduction
Newer version of GvLiveX component provides methods to support event notification and query. This article will demonstrate how to use it.
See also:
Establishing Control Connection
Following example is copied from sdk_samples/event_test1.htm
<HTML> |
Please note that:
- "Control" means the control connection object name. You will need this name in other context to reference the control connection.
- "eventFunc" is the name of the callback function. Please note this function should only have one parameter eventObj, which points to an event object containing all details of the event. If you are not sure about the event detail you can use Dump() method of the event object, it will return a text representation of the event object.
- ":auth:" part is to select which kinds of event to subscribe. (Please refer to EventOptions)
After the execution of the above page, following result may appear:
This tells us inside eventFunc, we can access eventObj in the following way:
- eventObj.Type (the value is “Event”)
- eventObj.Event (the value is “UserAuthorized”)
- eventObj.Tag1 (the value is an empty string)
- eventObj.Tag2 (the value is an empty string)
- eventObj.Tag3 (the value is an empty string)
See also: GvLiveX.OpenControl()
Getting Channel Events
Following code is from sample code sdk_samples/event_test2.htm
<HTML> |
In the example above, please note that we added ":chind=AAA:" to EventOptions. “AAA” is a channel name and this writing means you are interested to subscribe event notification about this particular channel. (for example, is there an alarm? is the channel is recording? or other kinds of detailed status information)
You will get results similar to the following after executing the example above:
With some additional other SetDeviceInfo alert pop-ups.
DeviceInfo Overview
This section will describe the meaning of DeviceInfo.
DeviceInfo is an important information transmission path throughout the Genius Vision NVR system. It mainly reflects device status and is generated according to the device (camera) characteristics. There are two major notification directives: SetDeviceInfo and ClearDeviceInfo.
- SetDeviceInfo: To set a DeviceInfo value. Tag1 is the channel. Tag2 is the name of the value to set. Tag3 is the value.
- ClearDeviceInfo: To clear a range of DeviceInfo values. Tag1 is the channel. Tag2 is the prefix of the range to be cleared. (For example if Tag2 is "cind.", then all DeviceInfo entries with name starting with "cind." will be cleared (deleted).
The meaning of DeviceInfo please refer to DeviceInfo Definitions.
Please note that there could be new DeviceInfo definition as the software is updating to newer versions. Thus developer should ignore unrecognized DeviceInfo directives.
How to open multiple live view windows (and from multiple NVR servers)
Following code is from sample code sdk_samples/event_test3.htm
<HTML> |
以上範例建立兩個控制連線:Control及Control2,並建立四個LivePlayer:
- Player1連到Control的AAA頻道。
- Player2連到Control的R2頻道。
- Player3連到Control2的C1008頻道。
- Player4連到Control2的C1009頻道。
因此結果如下:
See also: GvLiveX.OpenControl(), GvLiveX.OpenLivePlayer()
Switching between multi-channel 2x2 layout and 3x3 layout
Please refer to sample code sdk_samples/event_test3a.htm
How to query archived events
Following code is from sample code sdk_samples/event_test4.htm
<HTML> |
以上範例執行結果約如下(若有資料):
The above window will pop repeatedly for a number of times, depending on actual number of records returned.
本節重點整理如下:
- 查詢歷史事件,係使用OpenQueryQueue()及QueryEvent()等API
- 當收到開始查詢結果之初,將先收到"Event: BeginQuery",接著收到結果"Event: Query.Event",查詢結果之末,將收到"Event: EndQuery"
- 內部時間為Scalar Time表示法,其係以一浮點數表示,轉換時須使用ParseScalarTime()以及FormatScalarTime()等API,例如GvLiveX.ParseScalarTime(2010, 10, 5, 22, 0, 0),將產生一Scalar Time為本地時間2010-10-05 22:00:00,若將該值調入FormatScalarTime()取值,將得到字串"2010-10-05 22:00:00"。
查詢結果各欄位說明如下:(請參閱事件物件定義表)
- Cookie: 為當初輸入QueryEvent()之Cookie值,用以判別不同次的查詢。
- BeginTime: 事件開始時間。
- EndTime: 事件結束時間。
- EventType: 事件類型ULG為使用者登入、MD為位移偵測、SysOff1為系統關機、SysOff2為系統不正常關機、VL為失去視訊、SR為預約錄影、PZ為PTZ攝影機遭移動、MR為手動錄影、UR為錄影(任何有錄影之區間)。
- F1, F2, F3為相關資料欄位,依不同Type具不同意義。
- Id: 為頻道名稱,若為"/Sys"則為系統相關。
How to query live alarm information and receive notification
Following code is from sample code sdk_samples/event_test5.htm
<HTML> |
The "query alarm" operation actually queries "userlog" entries from NVR "System Briefcase", and also receives notification when the entry changes in real time. System briefcase is located in the highlighted area in the following picture:
以上程式執行後,若有警報狀態更新,或新警報產生,將會得到以下訊息:
本節重點整理如下:
- 欲即時接收警報更新或產生,在OpenControl()之EventOptions中加入":userlog:"
- 欲接收所有警報資訊,在OpenControl()之EventOptions中再加入":query:" (仍須配合":userlog:"使用之)
事件物件(eventObj)欄位說明如下:(請參閱事件物件定義表)
- Type: Fixed value of “DataEntry”
- UserlogType: Value “Alarm” indicates an alarm.
- AlarmTypes: 警報類型,若為Vloss則為失去視訊。
- AlarmState: 若為警報,則此表警報狀態,可能為0, 1, 2
- MessageRid: 該條目之訊息。
- Key: 該紀錄之唯一序號(鍵值)。
How to control remote PTZ camera
See also: GvLiveX.PtzControl()
Page of