๐Ÿ“– Protocol/Onvif

Onvif Event Handling

bell22 2021. 11. 19. 11:55

Onvif Event Handling์€ ๋‘ ๊ฐ€์ง€ ๋ฐฉ์‹์ด ์žˆ๋‹ค

 

์ฒซ ๋ฒˆ์งธ) Real-time Pull-Point Notification Interface

๋‘๋ฒˆ์งธ) Notification Streaming Interface

์„ธ๋ฒˆ์งธ) Basic Notification Interface

 

์ฒ˜์Œ ๊ณต๋ถ€ํ•  ๋•Œ ์ฝ๊ณ  ์ง€๊ธˆ ๋‹ค์‹œ๋ณด๋‹ˆ ๋†“์นœ ๋ถ€๋ถ„์ด ๋งŽ์ด ๋ณด์—ฌ์„œ,

๋Šฆ์€ ์ •๋ฆฌ๋ฅผ ํ•˜๋ ค๊ณ  ํ•œ๋‹ค

๊ทœ๊ฒฉ์€ Onvif Core์™€ WS-BaseNofitication, WS-Topics๋ฅผ ์ฐธ๊ณ ํ•˜์˜€๋‹ค

๊ทœ๊ฒฉ์„ ํ•ด์„ํ•˜๋ฉฐ ์ •๋ฆฌํ•œ๊ฑฐ๋ผ ๊ฐœ์ธ ์ƒ๊ฐ์ด ๋งŽ์ด ๋“ค์–ด๊ฐ€์žˆ์Œ์„ ์œ ์˜ํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค.

 


 

1. Event Handling์ด๋ž€

๊ทœ๊ฒฉ ๋‚ด์šฉ์„ ์ตœ๋Œ€ํ•œ ์ธ์šฉํ•˜๋ฉด์„œ ์ •๋ฆฌํ•˜๋ ค๊ณ  ํ•œ๋‹ค.

Onvif Core ๊ทœ๊ฒฉ์˜ 4์ ˆ์— ์ž ๊น, 9์ ˆ์— ๋ณธ๊ฒฉ์ ์œผ๋กœ ์„ค๋ช… ๋˜์–ด์žˆ๋‹ค

Event Handling์€ Device์—์„œ ๋ฐœ์ƒํ•˜๋Š” ์ด๋ฒคํŠธ๋“ค์„ ์–ด๋–ป๊ฒŒ ๋ฐ›์„๊ฑฐ๋ƒ?์— ๋Œ€ํ•œ ๋ช…์„ธ๋‹ค

์œ„์—์„œ ์ž ๊น ์–ธ๊ธ‰ํ•œ ๋ฐฉ์‹์œผ๋กœ ์ด๋ฒคํŠธ๋ฅผ ํ•ธ๋“ค๋งํ•  ์ˆ˜ ์žˆ๋‹ค

 

4.6 Event Handling
Firewall traversal, according to WS-BaseNotification, is handled through a PullPoint notification pattern. This

pattern, however, does not allow real-time notification. Hence, this specification defines an alternative PullPoint
communication pattern and service interface. The PullPoint pattern allows a client residing behind a firewall to
receive real-time notifications while utilizing the WS-BaseNotification framework.

 

WS-BaseNotification ๊ทœ๊ฒฉ์—์„œ๋Š” ์›๋ž˜ ๋ฐฉํ™”๋ฒฝ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด PullPoint ๋ฐฉ์‹์„ ๋‹ค๋ค˜๋Š”๋ฐ,

์ด๊ฒŒ ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋ฐ›์•„์˜ค๋Š”๊ฑด ์•„๋‹ˆ๋‹ค ๋ณด๋‹ˆ๊นŒ,

Onvif ๊ทœ๊ฒฉ์—์„œ๋Š” ์‹ค์‹œ๊ฐ„์œผ๋กœ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” ๋ฐฉ๋ฒ•์„ ์ถ”๊ฐ€ํ•œ ๋ชจ์–‘์ด๋‹ค.

 

์•„๋ฌดํŠผ, ์š” Event Handling์˜ ๋ชฉ์ ์€

ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋ฐฉํ™”๋ฒฝ ๋’ค์— ์žˆ์–ด๋„, Device์˜ ์ด๋ฒคํŠธ๋“ค์„ ์ž˜ ์•Œ๋ ค์ฃผ์ž๋กœ ์ƒ๊ฐ๋œ๋‹ค

 

๊ทธ๋Ÿฌ๋ฉด ์ด๋ฒคํŠธ 2๋ฒคํŠธํ•˜๋Š”๋ฐ ์ •ํ™•ํžˆ ๋ฌด์Šจ ์˜๋ฏธ์ผ๊นŒ

 

ํŒก- ํŒก-

 

9. Event Handling
An event is an action or occurrence detected by a device that a client can subscribe to.

 

Onvif์—์„œ ๋งํ•˜๋Š” ์ด๋ฒคํŠธ๋Š” ์–ด๋–ค action์ด๋‚˜ device์— ๊ฐ์ง€๋œ ๋ฐœ์ƒ ์ •๋ณด๋ฅผ ๋œปํ•œ๋‹ค

์š”์ฆ˜ ์นด๋ฉ”๋ผ ์ž์ฒด์— ์‚ฌ๋žŒ ๊ฐ์ง€ ์ด๋Ÿฐ ๊ธฐ๋Šฅ์ด ๋“ค์–ด๊ฐ€ ์žˆ๊ธฐ๋„ ํ•œ๋ฐ, ๊ทธ๋Ÿฐ ๊ฒƒ๋„ ํฌํ•จ ๊ฐ€๋Šฅํ•˜๋‹ค

 

์ •๋ฆฌํ•˜์ž๋ฉด, Device์— ๊ฐ์ง€๋œ ์ •๋ณด๋ฅผ ๋ฐฉํ™”๋ฒฝ์„ ๋šซ๊ณ  ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์ž˜ ์•Œ๋ ค์ฃผ์ž ใ…‹

์ด๊ฑฐ๋‹ค


 

2. ์ฒซ ๋ฒˆ์งธ) Real-Time Pull-Point Notification Interface

์œ„์—์„œ ์ž ๊น ์–ธ๊ธ‰ํ•œ Event Handling์˜ ์ฒซ ๋ฒˆ์งธ ๋ฐฉ์‹์ด๋‹ค

๋‹จ์–ด ์ž์ฒด๋กœ๋งŒ ๋ณด๋ฉด ์‹ค์‹œ๊ฐ„์œผ๋กœ Pull-Point Notification(์ดํ•˜ ์•Œ๋ฆผ) ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ •์˜ํ•œ ๋‚ด์šฉ์ด๋‹ค

 

 

์ด ๋ฐฉ์‹์€ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๋ฐฉ๋ฒ•์œผ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋‹ค

 

1) ํด๋ผ์ด์–ธํŠธ๊ฐ€ Device์—๊ฒŒ pull pont๋ฅผ ์š”์ฒญํ•œ๋‹ค

(CreatePullPointSubscriptionRequest ์ปค๋งจ๋“œ๋ฅผ ์‚ฌ์šฉ)

2) device๋Š” ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์š”์ฒญํ•œ ๋‚ด์šฉ์— ๋Œ€ํ•ด ์‘๋‹ต์„ ๋ณด๋‚ธ๋‹ค

3) ์š”์ฒญ์ด ์ˆ˜๋ฝ๋˜๋ฉด ์‘๋‹ต์ด ์˜ฌํ…๋ฐ, ์ธ์Šคํ„ด์Šคํ™” ๋œ pull point์˜ Endpoint๋ฅผ ํฌํ•จํ•œ๋‹ค

4) PullPoint ์ƒ์„ฑ ํ›„์—๋Š” Renew๋‚˜ Unsubscribe ์ปค๋งจ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์ƒํƒœ ๊ด€๋ฆฌ๋ฅผ ํ•  ์ˆ˜ ์žˆ๋‹ค

 

์ด ๋ฐฉ์‹์€ ํด๋ผ์ด์–ธํŠธ๊ฐ€ ๋จผ์ € Device์—๊ฒŒ ์š”์ฒญํ•˜๋ฉด,

๊ทธ ๋•Œ Device๊ฐ€ ์ฆ‰๊ฐ์ ์œผ๋กœ ๋ฐ”๋กœ ์‘๋‹ต์„ ๋ณด๋‚ด๋Š” ๋ฐฉ์‹์ด๋‹ค.

 

This may cause unnecessary load by e.g. activating multiple motion detectors and similar without need.

 

์‹ค์‹œ๊ฐ„์œผ๋กœ ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ณ  ์‹ถ๋‹ค๋ฉด ๋‹ค๋ฅธ ๋ฐฉ์‹ ์“ฐ๋Š”๊ฑธ ์ถ”์ฒœํ•œ๋‹ค


 

3.๋‘ ๋ฒˆ์งธ) Notification Streaming Interface

 

๋ง ๊ทธ๋Œ€๋กœ Streaming ์— ๊ด€๋ จ๋œ ์ธํ„ฐํŽ˜์ด์Šค๋‹ค

์šฐ๋ฆฌ๊ฐ€ ์•„๋Š” ์˜์ƒ ์ŠคํŠธ๋ฆฌ๋ฐ ๊ทธ๊ฑฐ ๋งž๋‹ค

 

RTP ํŒจํ‚ท๋“ค์„ ์ด๋ฒคํŠธ ์ „์†ก ํ˜•ํƒœ๋กœ ๋ฐ›์„ ์ˆ˜ ์žˆ๋Š”๋ฐ, ๋ฉ”์‹œ์ง€ payload๊ฐ€ ํฌํ•จ๋˜๋Š” ๊ฒƒ ๊ฐ™๋‹ค

์ž์„ธํ•œ ๋‚ด์šฉ์€ Onvif  Media ๊ทœ๊ฒฉ์„ ์ฐธ๊ณ ํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค

 


 

4. ์„ธ ๋ฒˆ์งธ) Basic Notification Interface

์‚ฌ์‹ค ์–˜๋•œ์— ์ •๋ฆฌํ•˜๊ธฐ๋กœ ๋งˆ์Œ ๋จน์—ˆ๋‹ค

๊ธฐ๋ณธ ์•Œ๋ฆผ ์ธํ„ฐํŽ˜์ด์Šค(?) ์ด ํ˜•์‹์€ ์•„๋ž˜ 3๊ฐ€์ง€ ์šฉ์–ด๋ฅผ ์•Œ๋ฉด ์ดํ•ดํ•˜๊ธฐ ์‰ฝ๋‹ค

 

Client

NotificationConsumer interface๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์ชฝ

NotificationConsumer : ์ด๋ฒคํŠธ๋ฅผ ๋ฐ›๊ณ  ์‹ถ์–ดํ•˜๋Š” ์ชฝ/Subscribe ์š”์ฒญ ๋ณด๋‚ด๋Š” ์ชฝ

 

Event Service

NotificationProducer interface๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์ชฝ

NotificationProducer :  Consumer๋กœ๋ถ€ํ„ฐ subscribe ์š”์ฒญ์„ ๋ฐ›๋Š” ์ชฝ

 

Subscription Manager

BaseSubscriptionManager interface๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์ชฝ

(Base)SubscriptionManager : Subscription ๋ฆฌ์†Œ์Šค๋“ค์„ ๊ด€๋ฆฌํ•˜๊ณ  ๋ฉ”์‹œ์ง€๋กœ ์ •์˜

 

๋‹จ์–ด๊ฐ€ ์ƒ์†Œํ•ด์„œ ์–ด๋ ต๊ฒ ์ง€๋งŒ WS-BaseNotification ๊ทœ๊ฒฉ์„ ์ฝ์–ด๋ณด๋ฉด ์•„~ ํ•˜๊ฒŒ ๋œ๋‹ค

 

๊ทธ๋ฆผ์œผ๋กœ ๋ณด๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

 

 Subscription ์ƒ์„ฑ ๊ณผ์ •

1) client๋Š” ์ด๋ฒคํŠธ ์„œ๋น„์Šค๋ฅผ ์œ„ํ•ด ์—ฐ๊ฒฐ์„ ๋งบ๋Š”๋‹ค (Subscribe ์š”์ฒญ์„ ๋ณด๋‚ธ๋‹ค)

2) Event Service๋Š” Subscribe ์š”์ฒญ์„ ๋ฐ›๊ณ , ์ด ์ •๋ณด๋ฅผ ์ธ์Šคํ„ด์Šคํ™”์—ฌ 

Subscription Manager๊ฐ€ ๊ธฐ์–ตํ•˜๋„๋ก ํ•œ๋‹ค

3) Subscribe ์‘๋‹ต์„ ์ค„ ๋•Œ, Endpoint Address๋ฅผ ํฌํ•จํ•˜์—ฌ ์ค€๋‹ค

 

 

Subscription ์ข…๋ฃŒ ๊ณผ์ •

์ข…๋ฃŒ๋Š” ์•„๋ž˜ ๋‘ ๊ฐ€์ง€ ํ˜•์‹์œผ๋กœ ํ•  ์ˆ˜ ์žˆ๋‹ค

1) Unsubscribe ๋ฉ”์‹œ์ง€๋ฅผ ํ†ตํ•˜์—ฌ ํ•ด์ง€ํ•˜๋Š” ๋ฐฉ๋ฒ•

2) Client๊ฐ€ ์„ค์ •ํ•œ ๋งŒ๋ฃŒ์‹œ๊ฐ„์— ๋”ฐ๋ผ ์ž๋™์ ์œผ๋กœ Subscription Manager๊ฐ€ destroy ํ•ด์ฃผ๋Š” ๋ฐฉ๋ฒ•

 

 

 Event ๋ฐ›๋Š” ๋ฐฉ๋ฒ• 

Event Service๋Š” Client์—๊ฒŒ ์ด๋ฒคํŠธ ์ •๋ณด๋ฅผ Notify ๋ฉ”์‹œ์ง€๋ฅผ ํ†ตํ•ด ์ „๋‹ฌํ•œ๋‹ค (one-way๋ฐฉ์‹)

 

 

Subscription์„ ๊ฐฑ์‹ ํ•˜๋Š” ๊ณผ์ •

์œ„์—์„œ ์ข…๋ฃŒ ๊ณผ์ • ์„ค๋ช…์‹œ ๋งŒ๋ฃŒ ์‹œ๊ฐ„์ด ์žˆ๋‹ค๊ณ  ์–ธ๊ธ‰์„ ํ–ˆ๋Š”๋ฐ,

๊ทธ๋ ‡๋‹ค๋ฉด ๊ณ„์† Subscription์„ ์œ ์ง€ํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ๊ฐฑ์‹ ๋„ ํ•ด์ค˜์•ผ ํ•œ๋‹ค๋Š” ๊ฑฐ๋‹ค

The SubscriptionManager is automatically destroyed when the termination time is reached. RenewRequests can be initiated by the client in order to postpone the termination time. The client can also explicitly terminate the SubscriptionManager by sending an UnsubscribeRequest.

๊ฐฑ์‹ ์€ Renew ์š”์ฒญ์„ ํ†ตํ•ด ํ•  ์ˆ˜ ์žˆ๋‹น

 


 

5. Notification Information

 

๊ทธ๋Ÿผ ์ด๋ ‡๊ฒŒ Event ์ •๋ณด๋ฅผ ๋ฐ›์œผ๋ฉด ์—ฌ๊ธฐ์—” ๋ฌด์Šจ ์ •๋ณด๊ฐ€ ์žˆ๋Š”์ง€๊ฐ€ ์Šฌ์Šฌ ๊ถ๊ธˆํ•ด์ง„๋‹ค

 

์–ธ์ œ ๋ฐœ์ƒํ•œ๊ฑด์ง€?(when?)

๋ˆ„๊ฐ€ ์ด๋ฒคํŠธ๋ฅผ ๋งŒ๋“ค์—ˆ๋Š”์ง€? (who?)

๋ฌด์Šจ ์ด๋ฒคํŠธ์ธ์ง€? (what?)

๋“ฑ๋“ฑ...

 

์ด ์ •๋ณด๋“ค์€ ์ด๋ฒคํŠธ ๋ฐœ์ƒ ์‹œ Event Serivce๊ฐ€ ๋ณด๋‚ด์ค€ Notify ๋ฉ”์‹œ์ง€์— ๋‹ค ๋‹ด๊ฒจ์žˆ๋‹ค.

 

NotificationMessage Format

 

"when"

์ด๊ฑด ์•„๋ž˜์— ์ฒจ๋ถ€ํ•œ ๊ทธ๋ฆผ์—์„œ ๋ณผ ์ˆ˜ ์žˆ๊ฒ ์ง€๋งŒ, time ์„ ํฌํ•จํ•˜๋Š” element์— ํฌํ•จ๋œ๋‹ค

UTC ์‹œ๊ฐ„ ๋ฐฉ์‹์„ ์‚ฌ์šฉํ•˜๋Š”๋“ฏ

 

"who"

who๋Š” ๋‘ ๋ถ€๋ถ„์œผ๋กœ ๋‚˜๋‰œ๋‹ค

1) ProducerReference element์— ํฌํ•จ

: WS-Endpoint์—๋Š” device๋‚˜ service์— ๋Œ€ํ•œ ๋‚ด์šฉ์ด ์žˆ๋Š”๋ฐ,

์ด element๋ฅผ ํ†ตํ•ด ๋ˆ„๊ฐ€ ๋ณด๋‚ธ๊ฑด์ง€ ๋ช…์‹œ๋ฅผ ํ•ด์•ผํ•œ๋‹ค๊ณ  ํ•œ๋‹ค

 

2) Souce element์— ํฌํ•จ

: WS-Endpoint ๋‚ด์— ํฌํ•จ๋˜๋Š” ๊ฒƒ์€ ๊ฐ™์€๋ฐ, Source๋ผ๋Š” element๋กœ ํฌํ•จํ•˜์—ฌ

ํ•œ๊ฐœ ๋˜๋Š” ์—ฌ๋Ÿฌ๊ฐœ๋กœ ํ‘œ๊ธฐํ•  ์ˆ˜ ์žˆ๋‹ค๊ณ  ํ•œ๋‹ค

 

"what"

์–˜๋Š” ์•„๋ž˜ ๋‘ ๊ฐ€์ง€ element๊ฐ€ ์‚ฌ์šฉ๋œ๋‹ค (๊ฐ™์ด)

1) Topic element

: Topic element๋Š” Event์˜ ์นดํ…Œ๊ณ ๋ฆฌ ๊ฐ™์€ ๊ฑธ ํ‘œ๊ธฐํ•  ์ˆ˜ ์žˆ๋‹ค

 

2) Data element

: Data element๋Š” Event์˜ ์ƒ์„ธํ•œ ๋‚ด์šฉ์„ ์„ค๋ช… ํ•  ์ˆ˜ ์žˆ๋‹ค

 

• UtcTime represents the time when the event described by the message occurred.
• Topic and Source items uniquely identify the source of an event
• Data contains one or more values describing the event
• An optional Key item may extend the Source identifier

 

์ธ์šฉ ๋ฌธ๊ตฌ๋ฅผ ์ฐธ๊ณ ํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค.

 

์˜ˆ์‹œ

 

์ด๊ฑด ์˜ˆ์‹œ ๊ทธ๋ฆผ์ธ๋ฐ,

Topic์„ ๋ณด์•„ํ•˜๋‹ˆ PTZ ์ด๋ฒคํŠธ๋ฅผ ํด๋ผ์ด์–ธํŠธ๊ฐ€ Subscribe๋ฅผ ํ•œ ๋ชจ์–‘์ด๋‹ค

ํ•ด๋‹น ์ด๋ฒคํŠธ๋Š” PTZ Preset์— ๋๊นŒ์ง€ ๋„๋‹ฌํ•ด์„œ ์˜จ ์•Œ๋ฆผ์ผ ๊ฒƒ์ด๊ณ ,

๋ฐœ์ƒ ์‹œ๊ฐ„์€ UtcTime ํŒŒ๋ผ๋ฏธํ„ฐ์— ํฌํ•จ๋œ๋‹ค

๋˜ํ•œ Source์™€ Data Element๋กœ ์ƒ์„ธํ•œ ํ•ญ๋ชฉ์„ ํ™•์ธ ๊ฐ€๋Šฅํ•œ ๊ฒƒ๊นŒ์ง€ ๋ณผ ์ˆ˜ ์žˆ๋‹ค

 

 


 

์ •๋ง ์˜ค๋žœ๋งŒ์— ์“ด ๊ธ€์ธ๋ฐ... ์š”์ฆ˜ ์ผ์ด ๋„ˆ๋ฌด ๋ฐ”๋น ์„œ

ํ‹ˆํ‹ˆ์ด ์ž‘์„ฑํ•˜๋‹ค๋ณด๋‹ˆ ๊ธ€์˜ ํ๋ฆ„์ด ์ž๊พธ ๋Š๊ธด๋‹คใ…œใ…œ

 Onvif ๊ทœ๊ฒฉ์„ ์ฒ˜์Œ๋ถ€ํ„ฐ ๋๊นŒ์ง€ ๋‹ค ์ฝ์–ด๋ณด๊ณ  ์‹ถ์—ˆ๋Š”๋ฐ, ์˜ฌํ•ด์•ˆ์— ํ•  ์ˆ˜ ์žˆ์„์ง€ ์˜๋ฌธ์ด๋‹ค