You are on page 1of 21

HIKCGI Event Function Integrated Description

This document explains to how to use event functions with HIKCGI protocol. The topics include:

Alarm Input, Motion Detection, Video Tamper, Video Loss, etc. Please read HIKCGI Integration Guide in advance.

  • 1. The Definition of Event

An event is an action or occurrence detected by a device, or the device detects that a certain condition has been met. You can enable an event and configure the linkage action and attribution of the event.

  • 2. Network Entity Model

2.1 Alert Stream Mode

In this network mode, there are only two network physical entities: message source and message receiver.

Message source acts as a role that monitors all kinds of messages. You can customize an event and its attribution for the message source. Customizing an event refers to enabling a type of event, different types of events have different attributions. For example, for motion detection event, you need to set a motion detection area; for alarm input event, you need to designate a certain port to which the alarm can be input.

In this network mode, the requester is a message receiver. The connection established by the requester will stay open to deliver message notifications constantly.

If you choose alert stream mode, the steps are as follows: (1) Enable a certain Event

If you choose alert stream mode, the steps are as follows:

(1)

Enable a certain Event

You can use the command PUT/Event/triggers/ID to enable the event and set corresponding

action of the event.

If the event is special, for example, Motion Detection, you also need to set a motion detection area.

(2)

Set Arming Schedule

Only during the arming schedule will message source deliver these events, or the message

source will ignore these events. You can use the command PUT/Event/Schedule/ID to designate the arming schedule for a certain event.

(3)

Receive Event

If you use the command GET/Event/notification/alertStream to receive an event, the message source will deliver the event constantly to the requester who sends the command.

2.2 HTTP Host Mode

In this mode, you need designate an address of the alarm center in advance, and then message source will forwardly establish a connection and deliver message notifications to the alarm center when message source detects a certain event. Please note that the subscriber, who subscribes message event or enables message event, may be alarm center or not. Meanwhile, alarm center can also connect to other devices, and deliver the message to a Terminal user (for example, it can be a terminal display device).

4.Notify

consumer

4.Notify consumer C o n s e m e r A l a r m C
  • C o n s e m e r

4.Notify consumer C o n s e m e r A l a r m C

A l a r m C o n t r o l

  • C e n t e r

S o u r c e 2

4.Notify consumer C o n s e m e r A l a r m C
3 . P O S T E v e n t N o i f i
3 . P O S T E v e n t N o i f i c a t i o n
3 .P OS T E ve n t N oi fi ca t io n
1 . E n a b l e E v e n t
1 . E n a b l e E v e n t
D 2 e . t e E c v t e e n d t
4.Notify consumer C o n s e m e r A l a r m C
4.Notify consumer C o n s e m e r A l a r m C

N e t w o r k

3 . P O S T E v e n t

4.Notify consumer C o n s e m e r A l a r m C

N o i f i c a t i o n

S o u r c e 1

S u b s c r i b e r

If you choose HTTP host mode, the steps are as follows:

(1)

Enable a certain event

You can use the command PUT/Event/triggers/ID to enable the event and set corresponding

action of the event.

If the event is special, for example, Motion Detection, you need to set the motion detection area. (2) Set arming schedule Only during the arming schedule will the message source deliver these events, or the message

source will ignore these events. You can use the command PUT/Event/Schedule/ID to designate the arming schedule for a certain event.

(3)

Set the address of the alarm center and relevant information

You can use the command PUT/Event/notification/httpHost/ID to designate the corresponding information, such as the address of the Alarm Center, User Name, Password and URL path and so

on.

(4)

Receive Event

Message source can use HTTP POST method to send the event message to alarm center once an

event is detected. Alarm center should open right listening port if it went to receive event message.

3. Event Service (Event Mechanism)

In this chapter, the configuration of the event and the delivery of the message are explained in this section.

3.1 Event Configuration

You can access to event configuration by sending the command /Event/triggers/ID, please refer to the section 3.1.1 about the designation of the event ID and section 3.1.2 about the definition of the event linkage

  • 3.1.1 The Designation of the Event ID

The event includes Alarm In, Motion Detection, Video Loss, and Tamper Proof. Each event will be allocated to an ID. If a device supports more than one IO port, the allocation rule is as follows:

(1)

ID of the first IO port is: 1. ID of the first (N-1) IO port is N-1. ID of the Nth IO port is: N.

(2) ID number of Motion Detection is: N+1 (3) ID number of Video Loss is:N+2 (4) ID number of Tamper Proof is:N+3

The number of the alarm input ports can be checked by sending the command GET/IO/inputs, the number of <IOinputport> is equal to the number of alarm inputs in the <IOInputportlist>. Please note that for the devices with no alarm input supported, the content of <IOputportlist> will be empty, and the ID number of Motion Detection is 1.

  • 3.1.2 Notification Method

Notification Method is the linkage method of an event. The methods in HIKCGI protocol include email, IO, record, HTTP, FTP and PTZ. Email: IPC will send an email to the email receiver when an event occurs. PUT/Event/notification/mailing is used to designate relevant information of an email, such as email address. IO: When the event occurs, it will trigger alarm output, the specific alarm output can be designated in the event configuration. Record: Enable recording when the event triggers. The prerequisite is that you have configured a storage device. HTTP: Deliver alarm information to a certain center when an event occurs, and the address of the center can be designated by user.

FTP: When an event happens, it triggers the device to capture and upload captured picture to FTP server, and the address of FTP server can be designated by user. PTZ: When an event happens, it triggers PTZ action.

3.1.3 Arming Schedule Configuration

The arming schedule of an event means that only during arming time is the event detected and handled; otherwise the event will be ignored. Some events are 24-hour effective by default, such as Motion detection. The command /Event/Schedule/ID is used to configure arming schedule, and ID means the event type, and the detailed definition of ID is as follows:

VMD: Motion detection IO_IN_Number: alarm input event, IO_IN_1 means the first IO input port; IO_IN_2 means the second IO input port. IO_OUT_number: alarm output event, IO_OUT_1 means the first IO output port; IO_OUT_2 means the second IO output port. Videoloss: Video Loss Event Shelteralarm: Tamper proof Event

3.2 Handling Event Notification

(1) Handling returned notification using GET/Event/notification/alertStream

It is used to get the event notification alert stream via HTTP or HTTPs. The message source will constantly return the event message by using this command, and each message is separated with “boundary”. In HTTP header field, the specific name of boundary will be confirmed. Please refer to the following example:

A Client sends a command to a device whose IP address is172.8.6.175 to get alert stream:

GET /Event/notification/alertStream HTTP/1.1

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml

Accept-Language: zh-cn

Host: 172.8.6.175

Authorization: Basic YWRtaW46MTIzNDU=

After authentication, the device replies to the client that the content type is multipart/mixedand each message starts with a boundary string. The name of boundary is hikboundary.

HTTP/1.1 200 OK

MIME-Version: 1.0

Content-Type: multipart/mixed; boundary=hikboundary

In this case, message will be delivered to client continuously. The Content length of the message wont be designated. The message doesnt stop delivering until the connection is disconnected.

Each piece of message starts with a “—hikboundary, is followed by content type and content length. The above contents combine a HTTP header field. An empty line (i.e., a line with nothing preceding the \r\n) indicates the end of header field. After the header field, that is message body and the outermost tag of message body is <EventNotificationAlert>. The total length of message body has been declared in the header field.

--hikboundary

Content-Type: application/xml; charset="UTF-8"

Content-Length: 479

<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">

<ipAddress>172.8.6.175</ipAddress>

<portNo>80</portNo>

<protocol>HTTP</protocol>

<macAddress>00:40:48:64:10:fa</macAddress>

<channelID>1</channelID>

<dateTime>2012-04-18T21:26:20+08:00</dateTime>

<activePostCount>0</activePostCount>

<eventType>videoloss</eventType>

<eventState>inactive</eventState>

<eventDescription>videoloss alarm</eventDescription>

</EventNotificationAlert>

--hikboundary

Content-Type: application/xml; charset="UTF-8"

Content-Length: 483

<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">

<ipAddress>172.8.6.175</ipAddress>

<portNo>80</portNo>

<protocol>HTTP</protocol>

<macAddress>00:40:48:64:10:fa</macAddress>

<channelID>1</channelID>

<dateTime>2012-04-18T21:26:20+08:00</dateTime>

<activePostCount>0</activePostCount>

<eventType>shelteralarm</eventType>

<eventState>active</eventState>

<eventDescription>shelteralarm alarm</eventDescription>

</EventNotificationAlert>

Note:

<eventType> refers to event type, <eventState> refers to whether the event occurs or not, Content-Length is the length of the message body. An empty line (i.e., a line with nothing preceding the \r\n) indicates the end of header field. The following is the message body, which starts from <EventNotificationAlert>.

Sometimes, there might be no event occurs for a long time. In a word, if the message only is delivered when an event happens, it might wait for a long time, thereby it will lead to timeout. Currently, we define videoloss which is an inactive event as heat beat.

(2) Handling message notification delivered to center

In this mode, message source will forwardly establish a connection and deliver message notification to alarm host when an event occurs. The method is to use HTTP POST method, please refer to the following example:

POST /EventAlarm HTTP/1.1

Host: 172.8.6.166

Authorization: Basic YWRtaW46MTIzNDU=

Content-Type: application/xml; charset="UTF-8"

Content-Length: 483

<EventNotificationAlert version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">

<ipAddress>172.8.6.175</ipAddress>

<portNo>80</portNo>

<protocol>HTTP</protocol>

<macAddress>00:40:48:64:10:fa</macAddress>

<channelID>1</channelID>

<dateTime>2012-04-18T21:26:20+08:00</dateTime>

<activePostCount>0</activePostCount>

<eventType>shelteralarm</eventType>

<eventState>active</eventState>

<eventDescription>shelteralarm alarm</eventDescription>

</EventNotificationAlert>

Note: The URL path /EventAlarmof POST method is based on the setting by PUT /Event/notification/httpHost/IDcommand. In this mode, message source is the side which will forwardly establish a connection, and only when an event occurs is message delivered.

4 Alarm Input Integration Solution Demonstration

This demonstration will show how to integrate alarm input event. Alert stream is used to get alarm info in this demonstration.

4.1 Enable Event

The command PUT/Event/triggers/ID is used to enable an event. ID allocation rule in the command is as follows: if a device supports more than one alarm input port, from1 to N, each port stands for its corresponding alarm input event ID. For example, the alarm input 1 corresponds with ID 1 and alarm input 3 corresponds with ID is 3 (Section 3.3 for reference). Of course, you can use the command GET /IO/inputs to get the number of alarm inputs/outputs of a device. The return value of a device is as follows:

HTTP/1.1 200 OK Content-Type: application/xml; charset="UTF-8" Content-Length: 419 <?xml version="1.0" encoding="UTF-8"?> <IOInputPortList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <IOInputPort> <id>1</id>
HTTP/1.1 200 OK
Content-Type: application/xml; charset="UTF-8"
Content-Length: 419
<?xml version="1.0" encoding="UTF-8"?>
<IOInputPortList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<IOInputPort>
<id>1</id>
<triggering>high</triggering>
</IOInputPort>
<IOInputPort>
<id>2</id>
<triggering>high</triggering>
</IOInputPort>
<IOInputPort>
<id>3</id>
<triggering>high</triggering>
</IOInputPort>
<IOInputPort>
<id>4</id>
<triggering>high</triggering>
</IOInputPort>
</IOInputPortList>

In the above response, camera returns an alarm input list <IOInputPortList>in which four alarm inputs are listed. It is worth to note that some devices don’t support alarm input, so the response from the device is as follows:

<?xml version="1.0" encoding="UTF-8"?>

 

<IOInputPortList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">

</IOInputPortList>

 

The above <IOinputportlist> is empty, it indicates that the device doesn’t support alarm input, and there is no way to use the alarm input service.

Here, we provide an example to set alarm input 1. The detailed setting is as follows:

The action of alarm input 1 event is to trigger alarm output 1 and send an email.

PUT /Event/triggers/1 HTTP/1.1

 

Authorization: Basic YWRtaW46MTIzNDU=

Host:172.8.6.175

 

Content-Type:text/xml

 

Content-Length: 789

 
<?xml version="1.0" encoding="UTF-8"?> <EventTrigger version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <id>1</id> <eventType>IO</eventType> <eventDescription>IO Event trigger Information</eventDescription> <inputIOPortID>1</inputIOPortID> <EventTriggerNotificationList version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<?xml version="1.0" encoding="UTF-8"?>
<EventTrigger version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>1</id>
<eventType>IO</eventType>
<eventDescription>IO Event trigger Information</eventDescription>
<inputIOPortID>1</inputIOPortID>
<EventTriggerNotificationList version="1.0"
xmlns="http://www.hikvision.com/ver10/XMLSchema">
<EventTriggerNotification>
<id>1</id>
<notificationMethod>IO</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
<outputIOPortID>1</outputIOPortID>
</EventTriggerNotification>
<EventTriggerNotification>
<id>2</id>
<notificationMethod>email</notificationMethod>
<notificationRecurrence>beginning</notificationRecurrence>
</EventTriggerNotification>
</EventTriggerNotificationList>
</EventTrigger>
</EventTrigger>

In the above command, the URL used is /Event/Trigger/1, the indicated event is alarm “input 1” and its <eventType> is IO. As for the alarm input event, you need to use <inputIOPortID> to designate the alarm input port. <EventtriggerNotificationList> is a list, it can include several <eventTriggerNotification>, and every <eventtriggernotification> define the action of an event. For the above example, alarm input 1 is linkage with two actions: trigger alarm output and send the email out. The first <eventtriggernotification> trigger the alarm output, the output port is 1 indicates by <OutputIOPortID>, the second <eventtriggernotification> defines the linkage of email.

4.2 Setting Arming Schedule of the Event

PUT /Event/Schedule/ID is used to set arming schedule of an event and the event is only detected during the arming schedule. Please pay attention to schedule ID. The naming method is as follows: IO_IN_Number. As for alarm input 1, its Schedule ID is IO_IN_1. Here, we set the arming schedule for alarm input event 1 from 9:00 a.m. to 17:00 p.m. on

Monday and from 12:00 a.m. to 18:00 p.m. on Tuesday. The command is as follows:

PUT /Event/Schedule/IO_IN_1 HTTP/1.1 Host:172.8.6.175 Authorization: Basic YWRtaW46MTIzNDU= Content-Type:text/xml Content-Length:502 <?xml version="1.0" encoding="UTF-8"?> <EventSchedule version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema"> <eventType>IO</eventType>
PUT /Event/Schedule/IO_IN_1 HTTP/1.1
Host:172.8.6.175
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type:text/xml
Content-Length:502
<?xml version="1.0" encoding="UTF-8"?>
<EventSchedule version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<eventType>IO</eventType>
<inputIOPortID>1</inputIOPortID>
<TimeBlockList>
<TimeBlock>
<dayOfWeek>1</dayOfWeek>
<TimeRange>
<beginTime>09:00</beginTime>
<endTime>18:00</endTime>
</TimeRange>
</TimeBlock>
<TimeBlock>
<dayOfWeek>2</dayOfWeek>
<TimeRange>
<beginTime>12:00</beginTime>
<endTime>18:00</endTime>
</TimeRange>
</TimeBlock>
</TimeBlockList>
</EventSchedule>

The requested schedule ID is IO_IN_1, <eventshedule> indicates that the <eventType> is “IO”. As for the type of alarming, <inputIOportID> means the alarming for the alarm input, and the alarm port can be decided by the value of <InputIOPortID>. And <outputIOPortID> indicates the alarming for the alarm output. Alarm input/output port is determined by <outputIOPortID>. In the above example, we set how to arm alarm input 1. All of time blocks are included in the <Timeblocklist>, each <timeblock> in the list refers to an time block. Each time block should label <dayOfweek> and <TimeRange> .There are two time blocks in this example, one is 9:00 a.m. -17:00 p.m. on Monday, and the other is 12:00 a.m. -18:00 p.m. on Tuesday.

4.3 Triggering the Alarm Input

As for triggering the alarm input, you should know the hardware structure of the alarm input. You need to pay attention to the status of the alarm input is N.O or N.C. Generally, the status of the device is N.O by default, so when you connect the alarm input 1 and grounding with a wire, it can trigger the alarm input. Contrarily, if the wire is disconnected, nothing happens

4.3 Triggering the Alarm Input As for triggering the alarm input, you should know the hardware

This is the rear panel of DS-2CD864FWD-E. The interfaces marked as 13 are alarm input interface. The “G” besides the alarm input interface means ground. If the alarm input is set to be normal open (NO), to short circuit the alarm input interface with ground will trigger an alarm input event; else if the alarm input is set to be normal closed (NC), disconnecting the alarm input interface with ground will trigger an alarm input event.

4.4 Getting Alert Stream

After using the command GET/Event/notification/alertStream (Section 3.3 for reference), the response from the device is as follows:

--hikboundary Content-Type: application/xml; charset="UTF-8" Content-Length: 477 <EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema"> <ipAddress>172.8.6.175</ipAddress> <portNo>80</portNo> <protocol>HTTP</protocol>
--hikboundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 477
<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<ipAddress>172.8.6.175</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>00:40:48:64:10:fa</macAddress> <channelID>1</channelID> <dateTime>2012-04-19T22:22:33+08:00</dateTime> <activePostCount>0</activePostCount> <eventType>videoloss</eventType> <eventState>inactive</eventState> <eventDescription>videoloss alarm</eventDescription> </EventNotificationAlert> --hikboundary Content-Type: application/xml; charset="UTF-8" Content-Length: 495
<macAddress>00:40:48:64:10:fa</macAddress>
<channelID>1</channelID>
<dateTime>2012-04-19T22:22:33+08:00</dateTime>
<activePostCount>0</activePostCount>
<eventType>videoloss</eventType>
<eventState>inactive</eventState>
<eventDescription>videoloss alarm</eventDescription>
</EventNotificationAlert>
--hikboundary
Content-Type: application/xml; charset="UTF-8"
Content-Length: 495
<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema"> <ipAddress>172.8.6.175</ipAddress> <portNo>80</portNo> <protocol>HTTP</protocol> <macAddress>00:40:48:64:10:fa</macAddress> <channelID>1</channelID> <dateTime>2012-04-19T22:22:33+08:00</dateTime> <activePostCount>1</activePostCount> <eventType>IO</eventType> <eventState>active</eventState> <eventDescription>IO alarm</eventDescription> <inputIOPortID>1</inputIOPortID> </EventNotificationAlert>
<EventNotificationAlert version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<ipAddress>172.8.6.175</ipAddress>
<portNo>80</portNo>
<protocol>HTTP</protocol>
<macAddress>00:40:48:64:10:fa</macAddress>
<channelID>1</channelID>
<dateTime>2012-04-19T22:22:33+08:00</dateTime>
<activePostCount>1</activePostCount>
<eventType>IO</eventType>
<eventState>active</eventState>
<eventDescription>IO alarm</eventDescription>
<inputIOPortID>1</inputIOPortID>
</EventNotificationAlert>

There is an alarm input after the empty event, the input port is 1(the value of the <inputIOPortID> is 1). Empty event is an invalid event; it indicates the event is not triggered. As the first <eventnotificationalert> in the above example, its event type is video loss, and its status is inactive, which means the event is not triggered. Empty event usually is used for heartbeat to avoid the disconnection because of not receiving any messages for a long time. Note: this example only shows part of the alert stream. In practice, on IPC Type C after firmware V4.0.1, the events will be received continuously unless the client cut off the connection.

5. Motion Detection Integration Demonstration

This demonstration will introduce how to integrate motion detection, and we will explain how to use HTTP Host Mode to deliver message notification.

5.1 Motion Detection Coordinate System Introduction

(1) The original point of the coordinate system is designated to be the lower left corner of the screen. (2) The screen is divided by the grid, please refer to figure below

5.1 Motion Detection Coordinate System Introduction (1) The original point of the coordinate system is designated

(3) The whole screen is divided into the width of 22 grids, the height of 15 grids under NSTC, and width of 22 grids, height of 18 grids under PAL. The region information is normalized, and it is not related to the resolution.

The command GET /MotionDetection/1 (“1” stands for channel number) is used to get detailed specification.

5.1 Motion Detection Coordinate System Introduction (1) The original point of the coordinate system is designated

In the returned information, <Grid> gives the specification of motion detection coordinate area, the above pic displays the current screen has been divided into 22*18 grids. (4) Area information of motion detection Currently, our IPC supports 16 motion detection areas, each area must be a standard rectangle. The rectangle is fixed with four coordinate points. IPC can recognize array of coordinate points in any order. As long as the four coordinate points included in the command which can construct a standard rectangle, our IPC can handle it correctly. When getting a motion detection area, the order of the four coordinate points is as below: the first one is at the lower left corner, and the other three coordinate points are arranged clockwise. For example, an existing motion detection area (4*4) is as follows:

In the returned information, <Grid> gives the specification of motion detection coordinate area, the above pic

Using the command of GET/Motiondetection/1, the returned message from the network camera is as follows:

Notes: the first point (0, 0) is located at the lower left corner, and (0, 4)
Notes:
the first
point
(0,
0)
is
located at
the lower left
corner,
and (0,
4)
(4,
4)
(4,
0)
are

arranged clockwise.

5.2 Configuring Motion Detection Area

(1) Command description Using PUT/MotionDetection/ID to set the motion detection area, the ID refers to channel number. As for the network camera, it only supports 1 channel currently, so the ID is 1. The command is PUT /MotionDetection/1 A complete command should include: enabled, sensitivity level, motion detection region. It is allowed to have several motion detection areas, which are included in the motion detection region list, each region is defined with <MotionDetectionRegion>. (2) Example There are two motion detection regions in the above example, the first one is (0,0)(0,4)(4,4)(4,0), the second region is (17,13)(17,18)(22,18)(22,13). The sensitivity level is 2. According to the above requirement, the command is as below:

PUT /MotionDetection/1 HTTP/1.1

 

Authorization: Basic YWRtaW46MTIzNDU=

Content-Type:text/xml

 
Content-Length:1647 <?xml version="1.0" encoding="UTF-8"?> <MotionDetection version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <id>1</id> <enabled>false</enabled> <regionType>grid</regionType> <Grid> <rowGranularity>18</rowGranularity> <columnGranularity>22</columnGranularity> </Grid> <MotionDetectionRegionList> <sensitivityLevel>2</sensitivityLevel>
Content-Length:1647
<?xml version="1.0" encoding="UTF-8"?>
<MotionDetection version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>1</id>
<enabled>false</enabled>
<regionType>grid</regionType>
<Grid>
<rowGranularity>18</rowGranularity>
<columnGranularity>22</columnGranularity>
</Grid>
<MotionDetectionRegionList>
<sensitivityLevel>2</sensitivityLevel>
<MotionDetectionRegion version="1.0"
xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>1</id>
<enabled>true</enabled>
<maskEnabled>false</maskEnabled>
<RegionCoordinatesList>
<RegionCoordinates>
<positionX>0</positionX>
<positionY>0</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>0</positionX>
<positionY>4</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>4</positionX>
<positionY>4</positionY>
</RegionCoordinates>
<RegionCoordinates>
<positionX>4</positionX>
<positionY>0</positionY>
</RegionCoordinates>
</RegionCoordinatesList>
</MotionDetectionRegion>
<MotionDetectionRegion version="1.0"
xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>2</id>
<enabled>true</enabled>
<maskEnabled>false</maskEnabled>

<RegionCoordinatesList>

 

<RegionCoordinates>

 

<positionX>17</positionX>

 

<positionY>13</positionY>

</RegionCoordinates>

 

<RegionCoordinates>

<positionX>17</positionX>

 

<positionY>18</positionY>

</RegionCoordinates>

 

<RegionCoordinates>

<positionX>22</positionX>

 

<positionY>18</positionY>

</RegionCoordinates>

 

<RegionCoordinates>

<positionX>22</positionX>

 

<positionY>13</positionY>

</RegionCoordinates>

 

</RegionCoordinatesList>

 

</MotionDetectionRegion>

 

</MotionDetectionRegionList>

</MotionDetection>

5.3 Configuring Motion Detection Event

The ID designation of the motion detection please refers to section 3.3 for details. Here we will take 864FWD as an example. This device has 1-ch alarm input and 1-ch alarm output, ID of motion detection is 2. The linkage method of motion detection is deliver alarm information to a certain center, <notificationmethod> should be HTTP. The command is as follows:

PUT /Event/triggers/2 HTTP/1.1 Authorization: Basic YWRtaW46MTIzNDU= Content-Type:text/xml Content-Length:548 <?xml version="1.0" encoding="UTF-8"?> <EventTrigger version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema"> <id>2</id> <eventType>VMD</eventType>
PUT /Event/triggers/2 HTTP/1.1
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type:text/xml
Content-Length:548
<?xml version="1.0" encoding="UTF-8"?>
<EventTrigger version="1.0" xmlns="http://www.hikvision.com/ver10/XMLSchema">
<id>2</id>
<eventType>VMD</eventType>
<EventTriggerNotificationList version="1.0"
xmlns="http://www.hikvision.com/ver10/XMLSchema">
<EventTriggerNotification>

<id>4</id>

 

<notificationMethod>HTTP</notificationMethod>

 

<notificationRecurrence>beginning</notificationRecurrence>

</EventTriggerNotification>

 

</EventTriggerNotificationList>

 

</EventTrigger>

 

5.4 Configuring Arming Schedule

The command to set motion detection arming schedule is PUT /Event/Schedule/VMD, you can use it as it mentioned in section 4.2. Here we just make an example. The arming schedule is 9:00 a.m.-17:00 p.m. on Monday and 12:00 a.m. -18:00 p.m. on Tuesday. The command is as follows:

PUT /Event/Schedule/VMD HTTP/1.1 Host:172.8.6.175 Authorization: Basic YWRtaW46MTIzNDU= Content-Type:text/xml Content-Length:502 <?xml version="1.0" encoding="UTF-8"?> <EventSchedule version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema"> <eventType>IO</eventType>
PUT /Event/Schedule/VMD HTTP/1.1
Host:172.8.6.175
Authorization: Basic YWRtaW46MTIzNDU=
Content-Type:text/xml
Content-Length:502
<?xml version="1.0" encoding="UTF-8"?>
<EventSchedule version="1.0" xmlns="http://www.std-cgi.com/ver10/XMLSchema">
<eventType>IO</eventType>
<inputIOPortID>1</inputIOPortID>
<TimeBlockList>
<TimeBlock>
<dayOfWeek>1</dayOfWeek>
<TimeRange>
<beginTime>09:00</beginTime>
<endTime>18:00</endTime>
</TimeRange>
</TimeBlock>
<TimeBlock>
<dayOfWeek>2</dayOfWeek>
<TimeRange>
<beginTime>12:00</beginTime>
<endTime>18:00</endTime>
</TimeRange>
</TimeBlock>
</TimeBlockList>

</EventSchedule>

  • 5.5 Configuring the Alarm Center Information

(1) Command description If the linkage method of the event is defined as notify the alarm center, and then you

need to configure related info about HTTP Host mode”, such as the address of the host, the port number of monitoring. The event message will be delivered by HTTP POST command, which means you need to designate the HTTP URL as well. What’s more, you may need to configure the username and password to pass the host authentication. /Event/notification/httphost/ID to configure the alarm host. ID means the alarm host number, usually the device only support one.

(2) Example:

In this example, the alarm host is 172.8.6.133, the monitor port is 80, URL is

/Alarm/receiver, username is client, password is 12345,

and

the

authenticated

information will be encrypted by base 64. The command comes out as below:

PUT /Event/notification/httphost/1 HTTP/1.1

Host:172.8.6.175

 

Authorization: Basic YWRtaW46MTIzNDU=

 

Content-Type:text/xml

 

Content-Length:490

 
<?xml version="1.0" encoding="UTF-8"?> <HttpHostNotification version="1.0" xmlns="urn:psialliance-org"> <id>1</id> <url>/Alarm/receiver</url> <protocolType>HTTP</protocolType> <parameterFormatType>XML</parameterFormatType> <addressingFormatType>ipaddress</addressingFormatType> <ipAddress>172.8.6.133</ipAddress> <portNo>80</portNo> <userName>client</userName> <password>12345</password> <httpAuthenticationMethod>base64</httpAuthenticationMethod>
<?xml version="1.0" encoding="UTF-8"?>
<HttpHostNotification version="1.0" xmlns="urn:psialliance-org">
<id>1</id>
<url>/Alarm/receiver</url>
<protocolType>HTTP</protocolType>
<parameterFormatType>XML</parameterFormatType>
<addressingFormatType>ipaddress</addressingFormatType>
<ipAddress>172.8.6.133</ipAddress>
<portNo>80</portNo>
<userName>client</userName>
<password>12345</password>
<httpAuthenticationMethod>base64</httpAuthenticationMethod>
</HttpHostNotification>
  • 5.6 Receiving Alarm Information from Alarm Center

If you trigger motion detection of the camera (such as wave your hands in front of the lens), then you will receive the information as follows:

POST /Alarm/receiver HTTP/1.1 Authorization: Basic Y2xpZW50OjEyMzQ Content-Type: application/xml; charset="UTF-8" Content-Length:479 <?xml version="1.0" encoding="UTF-8"?> <EventNotificationAlert version="1.0" xmlns="urn:psialliance-org">
POST /Alarm/receiver HTTP/1.1
Authorization: Basic Y2xpZW50OjEyMzQ
Content-Type: application/xml; charset="UTF-8"
Content-Length:479
<?xml version="1.0" encoding="UTF-8"?>
<EventNotificationAlert version="1.0" xmlns="urn:psialliance-org">
<ipAddress>172.8.6.175</ipAddress>
<protocolType>HTTP</protocolType>
<macAddress>00:40:48:64:10:fa</macAddress>
<channelID>1</channelID>
<dateTime>2012-05-27T16:58:33</dateTime>
<activePostCount>29</activePostCount>
<EventType>VMD</EventType>
<eventState>active</eventState>
<eventDescription>motion detection alarm</eventDescription>
</EventNotificationAlert>

The method of uploading the alarm center is HTTP POST, you can designate the URL, and the address is the one mentioned in section 5.4, the authentication will be encrypted with base64, and y2xpzw50ojeymzq1 stands for ”client: 12345” after encryption. In the event message, the local IP address of the network camera is 172.8.6.175. The event starts from 2012-05-27T 16:58:33. The event type is VMD.