forked from quocson95/go-onvif
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodel.go
801 lines (687 loc) · 16.8 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
package onvif
// Device contains data of ONVIF camera
type Device struct {
ID string
Name string
XAddr string
User string
Password string
}
// DeviceInformation contains information of ONVIF camera
type DeviceInformation struct {
FirmwareVersion string
HardwareID string
Manufacturer string
Model string
SerialNumber string
}
// NetworkCapabilities contains networking capabilities of ONVIF camera
type NetworkCapabilities struct {
DynDNS bool
IPFilter bool
IPVersion6 bool
ZeroConfig bool
}
// MediaCapabilities contains media capabilities of ONVIF camera
type MediaCapabilities struct {
XAddr string
}
type PTZCapabilities struct {
XAddr string
}
type EventsCapabilities struct {
Events map[string]bool
XAddr string
}
type ExtensionCapabilities struct {
XAddr string
}
// DeviceCapabilities contains capabilities of an ONVIF camera
type DeviceCapabilities struct {
Network NetworkCapabilities
Media MediaCapabilities
Recording ExtensionCapabilities
SearchRecording ExtensionCapabilities
Replay ExtensionCapabilities
Ptz PTZCapabilities
EventsCap EventsCapabilities
Streaming map[string]bool
}
// HostnameInformation contains hostname info of an ONVIF camera
type HostnameInformation struct {
Name string
FromDHCP bool
}
// MediaBounds contains resolution of a video media
type MediaBounds struct {
Height int
Width int
}
// MediaSourceConfig contains configuration of a media source
type MediaSourceConfig struct {
Name string
Token string
SourceToken string
Bounds MediaBounds
}
// VideoRateControl contains rate control of a video
type VideoRateControl struct {
BitrateLimit int
EncodingInterval int
FrameRateLimit int
}
// VideoEncoderConfig contains configuration of a video encoder
type H264Configuration struct {
GovLength int
H264Profile string //'Baseline', 'Main', 'Extended', 'High'
}
type VideoEncoderConfig struct {
Name string
Token string
Encoding string
Quality float64
RateControl VideoRateControl
Resolution MediaBounds
SessionTimeout string
H264 H264Configuration
Multicast Multicast
GuaranteedFrameRate bool
UseCount int
}
// AudioEncoderConfig contains configuration of an audio encoder
type AudioEncoderConfig struct {
Name string
Token string
Encoding string
Bitrate int
SampleRate int
SessionTimeout string
}
// PTZConfig contains configuration of a PTZ control in camera
type PTZConfig struct {
Name string
Token string
NodeToken string
}
// MediaProfile contains media profile of an ONVIF camera
type MediaProfile struct {
Name string
Token string
VideoSourceConfig MediaSourceConfig
VideoEncoderConfig VideoEncoderConfig
AudioSourceConfig MediaSourceConfig
AudioEncoderConfig AudioEncoderConfig
PTZConfig PTZConfig
}
// MediaURI contains streaming URI of an ONVIF camera
type MediaURI struct {
URI string
Timeout string
InvalidAfterConnect bool
InvalidAfterReboot bool
}
// System Date And Time
type Time struct {
Hour int
Minute int
Second int
}
type Date struct {
Year int
Month int
Day int
}
type UTCDateTime struct {
Time
Date
}
type TimeZone struct {
TZ string
}
type SystemDateAndTime struct {
DateTimeType string
DaylightSavings bool
TimeZone
UTCDateTime
}
//NTP information struct
type NetworkHost struct {
Type string
IPv4Address string
DNSname string
}
type NTPInformation struct {
FromDHCP bool
NTPNetworkHost []NetworkHost // NetworkHost of NTPFromDHCP if FromDHCP is true, else of NTPManual
}
// DNS Information struct
type IPAddress struct {
Type string
IPv4Address string
}
type DNSInformation struct {
FromDHCP bool
SearchDomain string
DNSAddress []IPAddress // IPAddress of DNSFromDHCP if FromDHCP is true, else of DNSManual
}
// DynamicDNSInformation
type DynamicDNSInformation struct {
Type string // 'NoUpdate', 'ClientUpdates', 'ServerUpdates'
Name string
TTL string
}
// NetWork Interface
type NetworkInterfaceInfo struct {
Name string
HwAddress string
MTU int
}
type NetworkInterfaceConnectionSetting struct {
AutoNegotiation bool
Speed int
Duplex string // "Full" || "Half"
}
type NetworkInterfaceLink struct {
AdminSettings NetworkInterfaceConnectionSetting
OperSettings NetworkInterfaceConnectionSetting
InterfaceType string
}
type PrefixedIPAdress struct {
Address string
PrefixLength int
}
type IPv4Configuration struct {
Manual PrefixedIPAdress
LinkLocal PrefixedIPAdress
FromDHCP PrefixedIPAdress
DHCP bool
}
type IPv4NetworkInterface struct {
Enabled bool
Config IPv4Configuration
}
type NetworkInterface struct {
Token string
Enabled bool
Info NetworkInterfaceInfo
Link NetworkInterfaceLink
IPv4 IPv4NetworkInterface
}
// NetWork Protocols
type NetworkProtocol struct {
Name string // 'HTTP' 'HTTPS' 'RTSP'
Enabled bool
Port int
}
// Scope
type Scope struct {
ScopeDes string // 'Fixed' 'Configurabale'
ScopeItem string
}
// Network GateWay
type NetworkGateway struct {
IPv4Address string
}
// User
type User struct {
Username string
Password string
UserLevel string // 'Administrator', 'Operator', 'User', 'Anonymous', 'Extended'
}
// RelayOutput
type RelayOutputSettings struct {
Mode string // 'Bistable', 'Monostable'
DelayTime string
IdleState string // 'closed', 'open'
}
type RelayOutput struct {
Token string
Properties RelayOutputSettings
}
//NetworkZeroConfiguration
type NetworkZeroConfiguration struct {
InterfaceToken string
Enabled bool
Addresses []string
}
// Service Device
type DeviceSecurityCapabilitiesService struct {
RemoteUserHandling bool
Dot1X bool
AccesssPolicyConfig bool
OnboardKeyGeneration bool
HttpDigest bool
X509Token bool
DefaultAccessPolicy bool
RELToken bool
KerberosToken bool
TLS12 bool
TLS11 bool
TLS10 bool
UsernameToken bool
SAMLToken bool
}
type DeviceSystemCapabilitiesService struct {
DiscoveryBye bool
DiscoveryResolve bool
FirmwareUpgrade bool
SystemLogging bool
SystemBackup bool
RemoteDiscovery bool
}
type DeviceNetworkCapabilitiesService struct {
NTP int
DynDNS bool
IPVersion6 bool
ZeroConfiguration bool
IPFilter bool
}
type DeviceCapabilitiesService struct {
Security DeviceSecurityCapabilitiesService
System DeviceSystemCapabilitiesService
Network DeviceNetworkCapabilitiesService
}
// Service Media
type MediaProfileCapabilitiesService struct {
MaximumNumberOfProfiles int
}
type MediaStreamingCapabilitiesService struct {
RTP_RTSP_TCP bool
RTP_TCP bool
RTPMulticast bool
NoRTSPStreaming bool
NonAggregateControl bool
}
type MediaCapabilitiesService struct {
OSD bool
VideoSourceMode bool
Rotation bool
SnapshotUri bool
ProfileCapabilities MediaProfileCapabilitiesService
StreamingCapabilities MediaStreamingCapabilitiesService
}
// Service Events
type EventsCapabilitiesService struct {
MaxNotificationProducers int
WSPausableSubscriptionManagerInterfaceSupport bool
WSPullPointSupport bool
WSSubscriptionPolicySupport bool
PersistentNotificationStorage bool
MaxPullPoints int
}
// Service Imaging
type ImagingCapabilitiesService struct {
ImageStabilization bool
}
// Service PTZ
type PTZCapabilitiesService struct {
GetCompatibleConfigurations bool
Reverse bool
EFlip bool
}
type OnvifVersion struct {
Major int
Minor int
}
type CapabilitiesService struct {
Name string // PTZ, media, device, imaging, events
Capabilities interface{}
}
type Service struct {
Namespace string
XAddr string
Capabilities CapabilitiesService
Version OnvifVersion
}
// VideoEncoderConfigurationOptions
type IntRange struct {
Min int
Max int
}
type H264Options struct {
ResolutionsAvailable []MediaBounds
GovLengthRange IntRange
FrameRateRange IntRange
EncodingIntervalRange IntRange
BitrateRange IntRange
H264ProfilesSupported []string // 'Baseline', 'Main', 'Extended', 'High'
}
type VideoEncoderConfigurationOptions struct {
QualityRange IntRange
H264 H264Options
}
// GuaranteedNumberOfVideoEncoderInstances
type GuaranteedNumberOfVideoEncoderInstances struct {
TotalNumber int
H264 int
}
// VideoSource
type VideoSource struct {
Token string
Framerate float64
Resolution MediaBounds
Imaging ImagingSettings
}
type ImagingSettings struct {
BacklightCompensation BacklightCompensation
Brightness float64
ColorSaturation float64
Contrast float64
Exposure Exposure
Focus FocusConfiguration
IrCutFilter string // 'ON', 'OFF', 'AUTO'
Sharpness float64
WideDynamicRange WideDynamicRange
WhiteBalance WhiteBalance
}
type BacklightCompensation struct {
Mode string // 'ON' 'OFF'
Level float64
}
type Exposure struct {
Mode string // 'AUTO', 'MANUAL'
Priority string // 'LowNoise', 'FrameRate'
Window Rectangle
MinExposureTime float64
MaxExposureTime float64
MinGain float64
MaxGain float64
MinIris float64
MaxIris float64
ExposureTime float64
Gain float64
Iris float64
}
type Rectangle struct {
Top int
Bottom int
Left int
Right int
}
type FocusConfiguration struct {
AutoFocusMode string // 'AUTO', 'MANUAL'
DefaultSpeed float64
NearLimit float64
FarLimit float64
}
type WideDynamicRange struct {
Mode string // 'OFF', 'ON'
Level float64
}
type WhiteBalance struct {
Mode string // 'AUTO', 'MANUAL'
CrGain float64
CbGain float64
}
// Video Source Configuration
type VideoSourceConfiguration struct {
Token string
Name string
SourceToken string
Bounds IntRectangle
}
type IntRectangle struct {
X int
Y int
Width int
Height int
}
type IntRectangleRange struct {
XRange IntRange
YRange IntRange
WidthRange IntRange
HeightRange IntRange
}
type VideoSourceConfigurationOption struct {
MaximumNumberOfProfiles int
BoundsRange IntRectangleRange
VideoSourceTokensAvailable string
}
type Multicast struct {
Address IPAddress
Port int
TTL int
AutoStart bool
}
type MetadataConfiguration struct {
Token string
Name string
SessionTimeout string
Multicast Multicast
}
type PTZStatusFilterOptions struct {
PanTiltStatusSupported bool
ZoomStatusSupported bool
PanTiltPositionSupported bool
ZoomPositionSupported bool
}
type MetadataConfigurationOptions struct {
GeoLocation bool
PTZStatusFilterOptions PTZStatusFilterOptions
}
type AudioSource struct {
Token string
Channels int //1: mono, 2: stereo
}
type AudioSourceConfiguration struct {
Token string
Name string
SourceToken string
}
type AudioEncoderConfigurationOption struct {
Encoding string // 'G711', 'G726', 'AAC'
BitrateList int
SampleRateList int
}
type FloatRange struct {
Min float64
Max float64
}
type Space1DDescription struct {
URI string
XRange FloatRange
}
type Space2DDescription struct {
URI string
XRange FloatRange
YRange FloatRange
}
type PTZSpaces struct {
AbsolutePanTiltPositionSpace Space2DDescription
AbsoluteZoomPositionSpace Space1DDescription
RelativePanTiltTranslationSpace Space2DDescription
RelativeZoomTranslationSpace Space1DDescription
ContinuousPanTiltVelocitySpace Space2DDescription
ContinuousZoomVelocitySpace Space1DDescription
PanTiltSpeedSpace Space1DDescription
ZoomSpeedSpace Space1DDescription
}
type PTZNode struct {
Token string
FixedHomePosition bool
GeoMove bool
Name string
SupportedPTZSpaces PTZSpaces
MaximumNumberOfPresets int
HomeSupported bool
}
type Vector2D struct {
Space string
X float64
Y float64
}
type Vector1D struct {
Space string
X float64
}
type PTZVector struct {
PanTilt Vector2D
Zoom Vector1D
}
type PanTiltLimits struct {
Range Space2DDescription
}
type ZoomLimits struct {
Range Space1DDescription
}
type PTZConfiguration struct {
Token string
Name string
MoveRamp int
PresetRamp int
PresetTourRamp int
NodeToken string
DefaultAbsolutePantTiltPositionSpace string
DefaultAbsoluteZoomPositionSpace string
DefaultRelativePanTiltTranslationSpace string
DefaultRelativeZoomTranslationSpace string
DefaultContinuousPanTiltVelocitySpace string
DefaultContinuousZoomVelocitySpace string
DefaultPTZSpeed PTZVector
DefaultPTZTimeout string
PanTiltLimits PanTiltLimits
ZoomLimits ZoomLimits
}
type Options struct {
Mode string
}
type PTControlDirection struct {
EFlip Options // 'OFF', 'ON', 'Extended'
Reverse Options // 'OFF', 'ON', 'AUTO', 'Extended'
}
type DurationRange struct {
Min string
Max string
}
type PTZConfigurationOptions struct {
Spaces PTZSpaces
PTZTimeout DurationRange
PTControlDirection PTControlDirection
}
type MoveStatus struct {
PanTilt string
Zoom string
}
type PTZStatus struct {
Position PTZVector
MoveStatus MoveStatus
UtcTime string
}
type PTZPreset struct {
Token string
Name string
PTZPosition PTZVector
}
type SubscriptionReference struct {
Address string
}
type CreatePullPointSubscriptionResponse struct {
SubscriptionReference SubscriptionReference
CurrentTime string
TerminationTime string
}
type MessageData struct {
Name string
Value string
}
type NotificationMessage struct {
Topic string
UtcTime string
Data []MessageData
Source []MessageData
}
type Point struct {
X int
Y int
}
type Mask struct {
Token string
ConfigurationToken string
Polygon []Point
Type string
Enabled bool
}
type CameraDevice struct {
Name string `json:"name"`
Manufacturer string `json:"manufacturer"`
Model string `json:"model"`
Serial string `json:"serial"`
Mac string `json:"mac"`
HardwareID string `json:"hardwareId"`
XAddr string `json:"xadd"`
User string `json:"user"`
Password string `json:"password"`
Proto string `json:"proto"`
}
type Resolution struct {
Height int `json:"height"`
Width int `json:"width"`
}
type RateControl struct {
BitRate int `json:"bitrate"`
Fps int `json:"fps"`
EncodingInterval int `json:"encodinginterval"`
}
type Bound struct {
Min int `json:"min"`
Max int `json:"max"`
}
type ProfileSupport struct {
ResolutionsAvailable []Resolution `json:"resolutionsAvailable"`
FpsRange Bound `json:"fpsRange"`
GovLength Bound `json:"govLength"`
}
type Stream struct {
ProfileToken string `json:"profileToken"`
VideoEncToken string `json:"videoEncToken"`
VideoCodec string `json:"videoCodec"`
StreamURI string `json:"streamUri"`
Resolution Resolution `json:"resolution"`
RateControl RateControl `json:"rateControl"`
ProfileSupport ProfileSupport `json:"profileSupport"`
SnapshotURI string `json:"snapshotUri"`
VideoSourceToken string `json:"videoSourceToken"`
}
type CameraProfile struct {
CameraDevice
Authorize bool `json:"authorize"`
Streams []Stream `json:"streams"`
LastError string `json:"lastError"`
}
type CameraProfileCommandResponse struct {
Result string `json:"result"`
Data CameraProfile `json:"data"`
}
type OnvifXAddress struct {
MediaXAddress string
PtzXAddress string
EventXAddress string
}
type RecordingSummary struct {
DataFrom string
DataUntil string
NumberRecordings int
}
type MediaAttributes struct {
RecordingToken string
From string
Until string
}
type Track struct {
TrackToken string
TrackType string
Description string
DataFrom string
DataTo string
}
type RecordingInformation struct {
RecordingToken string
EarliestRecording string
LatestRecording string
Track []Track
RecordingStatus string
}
type ResultList struct {
SearchState string
RecordingInformation []RecordingInformation
}