├── Analytics └── types.go ├── Device.go ├── Device └── types.go ├── Event └── types.go ├── Imaging └── types.go ├── LICENSE ├── Media └── types.go ├── PTZ └── types.go ├── README.md ├── api ├── api.go └── get_structs.go ├── doc.go ├── examples └── DeviceService.go ├── img ├── GetServiceCapabilities.png ├── exmp_ContinuousMove.png ├── exmp_CreateUsers.png ├── exmp_GetCapabilities.png └── exmp_GetProfiles.png ├── networking └── networking.go ├── wsdl ├── accesscontrol.wsdl ├── accessrules.wsdl ├── actionengine.wsdl ├── advancedsecurity.wsdl ├── analytics.wsdl ├── analyticsdevice.wsdl ├── credential.wsdl ├── deviceio.wsdl ├── devicemgmt.wsdl ├── display.wsdl ├── doorcontrol.wsdl ├── event.wsdl ├── imaging.wsdl ├── media.wsdl ├── media2.wsdl ├── provisioning.wsdl ├── ptz.wsdl ├── receiver.wsdl ├── recording.wsdl ├── replay.wsdl ├── schedule.wsdl ├── search.wsdl └── thermal.wsdl └── xsd ├── built_in.go └── onvif └── onvif.go /Analytics/types.go: -------------------------------------------------------------------------------- 1 | package Analytics 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/xsd/onvif" 5 | "github.com/yakovlevdmv/goonvif/xsd" 6 | ) 7 | 8 | type GetSupportedRules struct { 9 | XMLName string `xml:"tan:GetSupportedRules"` 10 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 11 | } 12 | 13 | 14 | type CreateRules struct { 15 | XMLName string `xml:"tan:CreateRules"` 16 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 17 | Rule onvif.Config `xml:"tan:Rule"` 18 | 19 | } 20 | 21 | 22 | type DeleteRules struct { 23 | XMLName string `xml:"tan:DeleteRules"` 24 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 25 | RuleName xsd.String `xml:"tan:RuleName"` 26 | 27 | } 28 | 29 | 30 | type GetRules struct { 31 | XMLName string `xml:"tan:GetRules"` 32 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 33 | 34 | } 35 | 36 | 37 | type GetRuleOptions struct { 38 | XMLName string `xml:"tan:GetRuleOptions"` 39 | RuleType xsd.QName `xml:"tan:RuleType"` 40 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 41 | 42 | } 43 | 44 | 45 | type ModifyRules struct { 46 | XMLName string `xml:"tan:ModifyRules"` 47 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 48 | Rule onvif.Config `xml:"tan:Rule"` 49 | 50 | } 51 | 52 | 53 | type GetServiceCapabilities struct { 54 | XMLName string `xml:"tan:GetServiceCapabilities"` 55 | } 56 | 57 | 58 | type GetSupportedAnalyticsModules struct { 59 | XMLName string `xml:"tan:GetSupportedAnalyticsModules"` 60 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 61 | 62 | } 63 | 64 | 65 | type GetAnalyticsModuleOptions struct { 66 | XMLName string `xml:"tan:GetAnalyticsModuleOptions"` 67 | Type xsd.QName `xml:"tan:Type"` 68 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 69 | 70 | } 71 | 72 | 73 | type CreateAnalyticsModules struct { 74 | XMLName string `xml:"tev:CreateAnalyticsModules"` 75 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 76 | AnalyticsModule onvif.Config `xml:"tan:AnalyticsModule"` 77 | 78 | } 79 | 80 | 81 | type DeleteAnalyticsModules struct { 82 | XMLName string `xml:"tan:DeleteAnalyticsModules"` 83 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 84 | AnalyticsModuleName xsd.String `xml:"tan:AnalyticsModuleName"` 85 | 86 | } 87 | 88 | 89 | type GetAnalyticsModules struct { 90 | XMLName string `xml:"tan:GetAnalyticsModules"` 91 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 92 | 93 | } 94 | 95 | 96 | type ModifyAnalyticsModules struct { 97 | XMLName string `xml:"tan:ModifyAnalyticsModules"` 98 | ConfigurationToken onvif.ReferenceToken `xml:"tan:ConfigurationToken"` 99 | AnalyticsModule onvif.Config `xml:"tan:AnalyticsModule"` 100 | 101 | } 102 | -------------------------------------------------------------------------------- /Device.go: -------------------------------------------------------------------------------- 1 | package goonvif 2 | 3 | import ( 4 | "encoding/xml" 5 | "fmt" 6 | "github.com/beevik/etree" 7 | "github.com/yakovlevdmv/gosoap" 8 | "strconv" 9 | "net/http" 10 | "io/ioutil" 11 | "github.com/yakovlevdmv/WS-Discovery" 12 | "strings" 13 | "github.com/yakovlevdmv/goonvif/Device" 14 | "errors" 15 | "reflect" 16 | "github.com/yakovlevdmv/goonvif/networking" 17 | ) 18 | 19 | var Xlmns = map[string]string { 20 | "onvif":"http://www.onvif.org/ver10/schema", 21 | "tds":"http://www.onvif.org/ver10/device/wsdl", 22 | "trt":"http://www.onvif.org/ver10/media/wsdl", 23 | "tev":"http://www.onvif.org/ver10/events/wsdl", 24 | "tptz":"http://www.onvif.org/ver20/ptz/wsdl", 25 | "timg":"http://www.onvif.org/ver20/imaging/wsdl", 26 | "tan":"http://www.onvif.org/ver20/analytics/wsdl", 27 | "xmime":"http://www.w3.org/2005/05/xmlmime", 28 | "wsnt":"http://docs.oasis-open.org/wsn/b-2", 29 | "xop":"http://www.w3.org/2004/08/xop/include", 30 | "wsa":"http://www.w3.org/2005/08/addressing", 31 | "wstop":"http://docs.oasis-open.org/wsn/t-1", 32 | "wsntw":"http://docs.oasis-open.org/wsn/bw-2", 33 | "wsrf-rw":"http://docs.oasis-open.org/wsrf/rw-2", 34 | "wsaw":"http://www.w3.org/2006/05/addressing/wsdl", 35 | } 36 | 37 | type DeviceType int 38 | 39 | const ( 40 | NVD DeviceType = iota 41 | NVS 42 | NVA 43 | NVT 44 | ) 45 | 46 | func (devType DeviceType) String() string { 47 | stringRepresentation := []string { 48 | "NetworkVideoDisplay", 49 | "NetworkVideoStorage", 50 | "NetworkVideoAnalytics", 51 | "NetworkVideoTransmitter", 52 | } 53 | i := uint8(devType) 54 | switch { 55 | case i <= uint8(NVT): 56 | return stringRepresentation[i] 57 | default: 58 | return strconv.Itoa(int(i)) 59 | } 60 | } 61 | 62 | //deviceInfo struct contains general information about ONVIF device 63 | type deviceInfo struct { 64 | Manufacturer string 65 | Model string 66 | FirmwareVersion string 67 | SerialNumber string 68 | HardwareId string 69 | 70 | } 71 | 72 | //deviceInfo struct represents an abstract ONVIF device. 73 | //It contains methods, which helps to communicate with ONVIF device 74 | type device struct { 75 | 76 | xaddr string 77 | login string 78 | password string 79 | 80 | endpoints map[string]string 81 | info deviceInfo 82 | 83 | } 84 | 85 | func (dev *device)GetServices() map[string]string { 86 | return dev.endpoints 87 | } 88 | 89 | func readResponse(resp *http.Response) string { 90 | b, err := ioutil.ReadAll(resp.Body) 91 | if err != nil { 92 | panic(err) 93 | } 94 | return string(b) 95 | } 96 | 97 | func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) []device { 98 | /* 99 | Call an WS-Discovery Probe Message to Discover NVT type Devices 100 | */ 101 | devices := WS_Discovery.SendProbe(interfaceName, nil, []string{"dn:"+NVT.String()}, map[string]string{"dn":"http://www.onvif.org/ver10/network/wsdl"}) 102 | nvtDevices := make([]device, 0) 103 | ////fmt.Println(devices) 104 | for _, j := range devices { 105 | doc := etree.NewDocument() 106 | if err := doc.ReadFromString(j); err != nil { 107 | fmt.Errorf("%s", err.Error()) 108 | return nil 109 | } 110 | ////fmt.Println(j) 111 | endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs") 112 | for _, xaddr := range endpoints { 113 | //fmt.Println(xaddr.Tag,strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2] ) 114 | xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2] 115 | fmt.Println(xaddr) 116 | c := 0 117 | for c = 0; c < len(nvtDevices); c++ { 118 | if nvtDevices[c].xaddr == xaddr { 119 | fmt.Println(nvtDevices[c].xaddr, "==", xaddr) 120 | break 121 | } 122 | } 123 | if c < len(nvtDevices) { 124 | continue 125 | } 126 | dev, err := NewDevice(strings.Split(xaddr, " ")[0]) 127 | //fmt.Println(dev) 128 | if err != nil { 129 | fmt.Println("Error", xaddr) 130 | fmt.Println(err) 131 | continue 132 | } else { 133 | ////fmt.Println(dev) 134 | nvtDevices = append(nvtDevices, *dev) 135 | } 136 | } 137 | ////fmt.Println(j) 138 | //nvtDevices[i] = NewDevice() 139 | } 140 | return nvtDevices 141 | } 142 | 143 | func (dev *device) getSupportedServices(resp *http.Response) { 144 | //resp, err := dev.CallMethod(Device.GetCapabilities{Category:"All"}) 145 | //if err != nil { 146 | // log.Println(err.Error()) 147 | //return 148 | //} else { 149 | doc := etree.NewDocument() 150 | 151 | data, _ := ioutil.ReadAll(resp.Body) 152 | 153 | if err := doc.ReadFromBytes(data); err != nil { 154 | //log.Println(err.Error()) 155 | return 156 | } 157 | services := doc.FindElements("./Envelope/Body/GetCapabilitiesResponse/Capabilities/*/XAddr") 158 | for _, j := range services{ 159 | ////fmt.Println(j.Text()) 160 | ////fmt.Println(j.Parent().Tag) 161 | dev.addEndpoint(j.Parent().Tag, j.Text()) 162 | } 163 | //} 164 | } 165 | 166 | //NewDevice function construct a ONVIF Device entity 167 | func NewDevice(xaddr string) (*device, error) { 168 | dev := new(device) 169 | dev.xaddr = xaddr 170 | dev.endpoints = make(map[string]string) 171 | dev.addEndpoint("Device", "http://"+xaddr+"/onvif/device_service") 172 | 173 | getCapabilities := Device.GetCapabilities{Category: "All"} 174 | 175 | resp, err := dev.CallMethod(getCapabilities) 176 | //fmt.Println(resp.Request.Host) 177 | //fmt.Println(readResponse(resp)) 178 | if err != nil || resp.StatusCode != http.StatusOK { 179 | //panic(errors.New("camera is not available at " + xaddr + " or it does not support ONVIF services")) 180 | return nil, errors.New("camera is not available at " + xaddr + " or it does not support ONVIF services") 181 | } 182 | 183 | dev.getSupportedServices(resp) 184 | return dev, nil 185 | } 186 | 187 | func (dev *device)addEndpoint(Key, Value string) { 188 | dev.endpoints[Key]=Value 189 | } 190 | 191 | //Authenticate function authenticate client in the ONVIF Device. 192 | //Function takes and params. 193 | //You should use this function to allow authorized requests to the ONVIF Device 194 | //To change auth data call this function again. 195 | func (dev *device) Authenticate(username, password string) { 196 | dev.login = username 197 | dev.password = password 198 | } 199 | 200 | //GetEndpoint returns specific ONVIF service endpoint address 201 | func (dev *device) GetEndpoint(name string) string { 202 | return dev.endpoints[name] 203 | } 204 | 205 | 206 | func buildMethodSOAP(msg string) (gosoap.SoapMessage, error) { 207 | doc := etree.NewDocument() 208 | if err := doc.ReadFromString(msg); err != nil { 209 | //log.Println("Got error") 210 | 211 | return "", err 212 | } 213 | element := doc.Root() 214 | 215 | 216 | soap := gosoap.NewEmptySOAP() 217 | soap.AddBodyContent(element) 218 | //soap.AddRootNamespace("onvif", "http://www.onvif.org/ver10/device/wsdl") 219 | 220 | return soap, nil 221 | } 222 | 223 | 224 | 225 | //CallMethod functions call an method, defined struct. 226 | //You should use Authenticate method to call authorized requests. 227 | func (dev device) CallMethod(method interface{}) (*http.Response, error) { 228 | pkgPath := strings.Split(reflect.TypeOf(method).PkgPath(),"/") 229 | pkg := pkgPath[len(pkgPath)-1] 230 | 231 | var endpoint string 232 | switch pkg { 233 | case "Device": endpoint = dev.endpoints["Device"] 234 | case "Event": endpoint = dev.endpoints["Event"] 235 | case "Imaging": endpoint = dev.endpoints["Imaging"] 236 | case "Media": endpoint = dev.endpoints["Media"] 237 | case "PTZ": endpoint = dev.endpoints["PTZ"] 238 | } 239 | 240 | //TODO: Get endpoint automatically 241 | if dev.login != "" && dev.password != "" { 242 | return dev.callAuthorizedMethod(endpoint, method) 243 | } else { 244 | return dev.callNonAuthorizedMethod(endpoint, method) 245 | } 246 | } 247 | 248 | //CallNonAuthorizedMethod functions call an method, defined struct without authentication data 249 | func (dev device) callNonAuthorizedMethod(endpoint string, method interface{}) (*http.Response, error) { 250 | //TODO: Get endpoint automatically 251 | /* 252 | Converting struct to xml string representation 253 | */ 254 | output, err := xml.MarshalIndent(method, " ", " ") 255 | if err != nil { 256 | //log.Printf("error: %v\n", err.Error()) 257 | return nil, err 258 | } 259 | 260 | /* 261 | Build an SOAP request with 262 | */ 263 | soap, err := buildMethodSOAP(string(output)) 264 | if err != nil { 265 | //log.Printf("error: %v\n", err) 266 | return nil, err 267 | } 268 | 269 | /* 270 | Adding namespaces 271 | */ 272 | soap.AddRootNamespaces(Xlmns) 273 | 274 | /* 275 | Sending request and returns the response 276 | */ 277 | return networking.SendSoap(endpoint, soap.String()) 278 | } 279 | 280 | //CallMethod functions call an method, defined struct with authentication data 281 | func (dev device) callAuthorizedMethod(endpoint string, method interface{}) (*http.Response, error) { 282 | /* 283 | Converting struct to xml string representation 284 | */ 285 | output, err := xml.MarshalIndent(method, " ", " ") 286 | if err != nil { 287 | //log.Printf("error: %v\n", err.Error()) 288 | return nil, err 289 | } 290 | 291 | /* 292 | Build an SOAP request with 293 | */ 294 | soap, err := buildMethodSOAP(string(output)) 295 | if err != nil { 296 | //log.Printf("error: %v\n", err.Error()) 297 | return nil, err 298 | } 299 | 300 | /* 301 | Adding namespaces and WS-Security headers 302 | */ 303 | soap.AddRootNamespaces(Xlmns) 304 | soap.AddWSSecurity(dev.login, dev.password) 305 | 306 | 307 | /* 308 | Sending request and returns the response 309 | */ 310 | return networking.SendSoap(endpoint, soap.String()) 311 | } -------------------------------------------------------------------------------- /Event/types.go: -------------------------------------------------------------------------------- 1 | package Event 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/xsd" 5 | ) 6 | 7 | type FilterType xsd.String 8 | 9 | // 10 | type AbsoluteOrRelativeTimeType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 11 | xsd.DateTime 12 | xsd.Duration 13 | } 14 | 15 | type SubscriptionPolicy struct { //tev http://www.onvif.org/ver10/events/wsdl 16 | ChangedOnly xsd.Boolean `xml:"ChangedOnly,attr"` 17 | } 18 | 19 | type Capabilities struct { //tev 20 | WSSubscriptionPolicySupport xsd.Boolean `xml:"WSSubscriptionPolicySupport,attr"` 21 | WSPullPointSupport xsd.Boolean `xml:"WSPullPointSupport,attr"` 22 | WSPausableSubscriptionManagerInterfaceSupport xsd.Boolean `xml:"WSPausableSubscriptionManagerInterfaceSupport,attr"` 23 | MaxNotificationProducers xsd.Int `xml:"MaxNotificationProducers,attr"` 24 | MaxPullPoints xsd.Int `xml:"MaxPullPoints,attr"` 25 | PersistentNotificationStorage xsd.Boolean `xml:"PersistentNotificationStorage,attr"` 26 | } 27 | 28 | type EndpointReferenceType struct { //wsa http://www.w3.org/2005/08/addressing/ws-addr.xsd 29 | Address AttributedURIType 30 | ReferenceParameters ReferenceParametersType 31 | Metadata // todo:разобраться с этим: понять, на какой тип ссылается 32 | } 33 | 34 | type AttributedURIType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd 35 | Any xsd.AnyURI //extension 36 | //Here can be anyAttribute 37 | } 38 | 39 | type ReferenceParametersType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd 40 | Any string 41 | //Here can be anyAttribute 42 | } 43 | 44 | type Metadata MetadataType //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd 45 | 46 | type MetadataType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd 47 | Any string 48 | //Here can be anyAttribute 49 | } 50 | 51 | type CurrentTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 52 | type TerminationTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 53 | type FixedTopicSet xsd.Boolean //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 54 | 55 | type TopicSet TopicSetType //wstop http://docs.oasis-open.org/wsn/t-1.xsd 56 | 57 | type TopicSetType struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd 58 | ExtensibleDocumented 59 | //here can be any element 60 | } 61 | 62 | type ExtensibleDocumented struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd 63 | Documentation Documentation //к xsd-документе documentation с маленькой буквы начинается 64 | //here can be anyAttribute 65 | } 66 | 67 | type Documentation xsd.AnyType //wstop http://docs.oasis-open.org/wsn/t-1.xsd 68 | 69 | type TopicExpressionDialect xsd.AnyURI 70 | 71 | type NotificationMessage NotificationMessageHolderType //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 72 | 73 | type NotificationMessageHolderType struct { 74 | SubscriptionReference SubscriptionReference //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 75 | Topic Topic 76 | ProducerReference ProducerReference 77 | Message Message 78 | } 79 | 80 | type SubscriptionReference EndpointReferenceType 81 | type Topic TopicExpressionType 82 | type ProducerReference EndpointReferenceType 83 | type Message xsd.AnyType 84 | 85 | type TopicExpressionType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd 86 | Dialect xsd.AnyURI `xml:"Dialect,attr"` 87 | } 88 | 89 | 90 | //Event main types 91 | 92 | type GetServiceCapabilities struct { 93 | XMLName string `xml:"tev:GetServiceCapabilities"` 94 | } 95 | 96 | 97 | type GetServiceCapabilitiesResponse struct { 98 | Capabilities Capabilities 99 | 100 | } 101 | 102 | //BUG(r) Bad AbsoluteOrRelativeTimeType type 103 | type CreatePullPointSubscription struct { 104 | XMLName string `xml:"tev:CreatePullPointSubscription"` 105 | Filter FilterType `xml:"tev:Filter"` 106 | InitialTerminationTime AbsoluteOrRelativeTimeType `xml:"tev:InitialTerminationTime"` 107 | SubscriptionPolicy SubscriptionPolicy `xml:"tev:SubscriptionPolicy"` 108 | 109 | } 110 | 111 | 112 | type CreatePullPointSubscriptionResponse struct { 113 | SubscriptionReference EndpointReferenceType 114 | CurrentTime CurrentTime 115 | TerminationTime TerminationTime 116 | 117 | } 118 | 119 | type ResourceUnknownFault struct { 120 | 121 | } 122 | 123 | type InvalidFilterFault struct { 124 | 125 | } 126 | 127 | type TopicExpressionDialectUnknownFault struct { 128 | 129 | } 130 | 131 | type InvalidTopicExpressionFault struct { 132 | 133 | } 134 | 135 | type TopicNotSupportedFault struct { 136 | 137 | } 138 | 139 | type InvalidProducerPropertiesExpressionFault struct { 140 | 141 | } 142 | 143 | type InvalidMessageContentExpressionFault struct { 144 | 145 | } 146 | 147 | type UnacceptableInitialTerminationTimeFault struct { 148 | 149 | } 150 | 151 | type UnrecognizedPolicyRequestFault struct { 152 | 153 | } 154 | 155 | type UnsupportedPolicyRequestFault struct { 156 | 157 | } 158 | 159 | type NotifyMessageNotSupportedFault struct { 160 | 161 | } 162 | 163 | type SubscribeCreationFailedFault struct { 164 | 165 | } 166 | 167 | 168 | type GetEventProperties struct { 169 | XMLName string `xml:"tev:GetEventProperties"` 170 | } 171 | 172 | 173 | type GetEventPropertiesResponse struct { 174 | TopicNamespaceLocation xsd.AnyURI 175 | FixedTopicSet FixedTopicSet 176 | TopicSet TopicSet 177 | TopicExpressionDialect TopicExpressionDialect 178 | MessageContentFilterDialect xsd.AnyURI 179 | ProducerPropertiesFilterDialect xsd.AnyURI 180 | MessageContentSchemaLocation xsd.AnyURI 181 | 182 | } 183 | 184 | //Port type PullPointSubscription 185 | 186 | type PullMessages struct { 187 | XMLName string `xml:"tev:PullMessages"` 188 | Timeout xsd.Duration `xml:"tev:Timeout"` 189 | MessageLimit xsd.Int `xml:"tev:MessageLimit"` 190 | } 191 | 192 | type PullMessagesResponse struct { 193 | CurrentTime CurrentTime 194 | TerminationTime TerminationTime 195 | NotificationMessage NotificationMessage 196 | } 197 | 198 | type PullMessagesFaultResponse struct { 199 | MaxTimeout xsd.Duration 200 | MaxMessageLimit xsd.Int 201 | } 202 | 203 | type Seek struct { 204 | XMLName string `xml:"tev:Seek"` 205 | UtcTime xsd.DateTime `xml:"tev:UtcTime"` 206 | Reverse xsd.Boolean `xml:"tev:Reverse"` 207 | } 208 | 209 | type SeekResponse struct { 210 | 211 | } 212 | 213 | type SetSynchronizationPoint struct { 214 | XMLName string `xml:"tev:SetSynchronizationPoint"` 215 | } 216 | 217 | type SetSynchronizationPointResponse struct { 218 | 219 | } -------------------------------------------------------------------------------- /Imaging/types.go: -------------------------------------------------------------------------------- 1 | package Imaging 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/xsd/onvif" 5 | "github.com/yakovlevdmv/goonvif/xsd" 6 | ) 7 | 8 | type GetServiceCapabilities struct { 9 | XMLName string `xml:"timg:GetServiceCapabilities"` 10 | } 11 | 12 | 13 | type GetImagingSettings struct { 14 | XMLName string `xml:"timg:GetImagingSettings"` 15 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 16 | 17 | } 18 | 19 | 20 | type SetImagingSettings struct { 21 | XMLName string `xml:"timg:SetImagingSettings"` 22 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 23 | ImagingSettings onvif.ImagingSettings20 `xml:"timg:ImagingSettings"` 24 | ForcePersistence xsd.Boolean `xml:"timg:ForcePersistence"` 25 | 26 | } 27 | 28 | 29 | type GetOptions struct { 30 | XMLName string `xml:"timg:GetOptions"` 31 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 32 | 33 | } 34 | 35 | 36 | type Move struct { 37 | XMLName string `xml:"timg:Move"` 38 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 39 | Focus onvif.FocusMove `xml:"timg:Focus"` 40 | 41 | } 42 | 43 | 44 | type GetMoveOptions struct { 45 | XMLName string `xml:"timg:GetMoveOptions"` 46 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 47 | 48 | } 49 | 50 | 51 | type Stop struct { 52 | XMLName string `xml:"timg:Stop"` 53 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 54 | 55 | } 56 | 57 | 58 | type GetStatus struct { 59 | XMLName string `xml:"timg:GetStatus"` 60 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 61 | 62 | } 63 | 64 | 65 | type GetPresets struct { 66 | XMLName string `xml:"timg:GetPresets"` 67 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 68 | 69 | } 70 | 71 | 72 | type GetCurrentPreset struct { 73 | XMLName string `xml:"timg:GetCurrentPreset"` 74 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 75 | 76 | } 77 | 78 | 79 | type SetCurrentPreset struct { 80 | XMLName string `xml:"timg:SetCurrentPreset"` 81 | VideoSourceToken onvif.ReferenceToken `xml:"timg:VideoSourceToken"` 82 | PresetToken onvif.ReferenceToken `xml:"timg:PresetToken"` 83 | 84 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Yakovlev Dmitry, Zhorzh Palanjyan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Media/types.go: -------------------------------------------------------------------------------- 1 | package Media 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/xsd/onvif" 5 | "github.com/yakovlevdmv/goonvif/xsd" 6 | ) 7 | 8 | type Capabilities struct { 9 | SnapshotUri bool `xml:"SnapshotUri,attr"` 10 | Rotation bool `xml:"Rotation,attr"` 11 | VideoSourceMode bool `xml:"VideoSourceMode,attr"` 12 | OSD bool `xml:"OSD,attr"` 13 | TemporaryOSDText bool `xml:"TemporaryOSDText,attr"` 14 | EXICompression bool `xml:"EXICompression,attr"` 15 | ProfileCapabilities ProfileCapabilities 16 | StreamingCapabilities StreamingCapabilities 17 | } 18 | 19 | type ProfileCapabilities struct { 20 | MaximumNumberOfProfiles int `xml:"MaximumNumberOfProfiles,attr"` 21 | } 22 | 23 | type StreamingCapabilities struct { 24 | RTPMulticast bool `xml:"RTPMulticast,attr"` 25 | RTP_TCP bool `xml:"RTP_TCP,attr"` 26 | RTP_RTSP_TCP bool `xml:"RTP_RTSP_TCP,attr"` 27 | NonAggregateControl bool `xml:"NonAggregateControl,attr"` 28 | NoRTSPStreaming bool `xml:"NoRTSPStreaming,attr"` 29 | } 30 | 31 | //Media main types 32 | 33 | type GetServiceCapabilities struct { 34 | XMLName string `xml:"trt:GetServiceCapabilities"` 35 | } 36 | 37 | 38 | type GetServiceCapabilitiesResponse struct { 39 | Capabilities Capabilities 40 | 41 | } 42 | 43 | 44 | type GetVideoSources struct { 45 | XMLName string `xml:"trt:GetVideoSources"` 46 | } 47 | 48 | 49 | type GetVideoSourcesResponse struct { 50 | VideoSources onvif.VideoSource 51 | 52 | } 53 | 54 | 55 | type GetAudioSources struct { 56 | XMLName string `xml:"trt:GetAudioSources"` 57 | 58 | } 59 | 60 | 61 | type GetAudioSourcesResponse struct { 62 | AudioSources onvif.AudioSource 63 | 64 | } 65 | 66 | 67 | type GetAudioOutputs struct { 68 | XMLName string `xml:"trt:GetAudioOutputs"` 69 | } 70 | 71 | 72 | type GetAudioOutputsResponse struct { 73 | AudioOutputs onvif.AudioOutput 74 | 75 | } 76 | 77 | 78 | type CreateProfile struct { 79 | XMLName string `xml:"trt:CreateProfile"` 80 | Name onvif.Name `xml:"trt:Name"` 81 | Token onvif.ReferenceToken `xml:"trt:Token"` 82 | 83 | } 84 | 85 | 86 | type CreateProfileResponse struct { 87 | Profile onvif.Profile 88 | 89 | } 90 | 91 | 92 | type GetProfile struct { 93 | XMLName string `xml:"trt:GetProfile"` 94 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 95 | 96 | } 97 | 98 | 99 | type GetProfileResponse struct { 100 | Profile onvif.Profile 101 | 102 | } 103 | 104 | 105 | type GetProfiles struct { 106 | XMLName string `xml:"trt:GetProfiles"` 107 | } 108 | 109 | 110 | type GetProfilesResponse struct { 111 | Profiles onvif.Profile 112 | 113 | } 114 | 115 | 116 | type AddVideoEncoderConfiguration struct { 117 | XMLName string `xml:"trt:AddVideoEncoderConfiguration"` 118 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 119 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 120 | } 121 | 122 | 123 | type AddVideoEncoderConfigurationResponse struct { 124 | 125 | } 126 | 127 | 128 | type RemoveVideoEncoderConfiguration struct { 129 | XMLName string `xml:"trt:RemoveVideoEncoderConfiguration"` 130 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 131 | } 132 | 133 | 134 | type RemoveVideoEncoderConfigurationResponse struct { 135 | 136 | } 137 | 138 | 139 | type AddVideoSourceConfiguration struct { 140 | XMLName string `xml:"trt:AddVideoSourceConfiguration"` 141 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 142 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 143 | 144 | } 145 | 146 | 147 | type AddVideoSourceConfigurationResponse struct { 148 | 149 | } 150 | 151 | 152 | type RemoveVideoSourceConfiguration struct { 153 | XMLName string `xml:"trt:RemoveVideoSourceConfiguration"` 154 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 155 | } 156 | 157 | 158 | type RemoveVideoSourceConfigurationResponse struct { 159 | 160 | } 161 | 162 | 163 | type AddAudioEncoderConfiguration struct { 164 | XMLName string `xml:"trt:AddAudioEncoderConfiguration"` 165 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 166 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 167 | 168 | } 169 | 170 | 171 | type AddAudioEncoderConfigurationResponse struct { 172 | 173 | } 174 | 175 | 176 | type RemoveAudioEncoderConfiguration struct { 177 | XMLName string `xml:"trt:RemoveAudioEncoderConfiguration"` 178 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 179 | } 180 | 181 | 182 | type RemoveAudioEncoderConfigurationResponse struct { 183 | 184 | } 185 | 186 | 187 | type AddAudioSourceConfiguration struct { 188 | XMLName string `xml:"trt:AddAudioSourceConfiguration"` 189 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 190 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 191 | 192 | } 193 | 194 | 195 | type AddAudioSourceConfigurationResponse struct { 196 | 197 | } 198 | 199 | 200 | type RemoveAudioSourceConfiguration struct { 201 | XMLName string `xml:"trt:RemoveAudioSourceConfiguration"` 202 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 203 | } 204 | 205 | 206 | type RemoveAudioSourceConfigurationResponse struct { 207 | 208 | } 209 | 210 | 211 | type AddPTZConfiguration struct { 212 | XMLName string `xml:"trt:AddPTZConfiguration"` 213 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 214 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 215 | } 216 | 217 | 218 | type AddPTZConfigurationResponse struct { 219 | 220 | } 221 | 222 | 223 | type RemovePTZConfiguration struct { 224 | XMLName string `xml:"trt:RemovePTZConfiguration"` 225 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 226 | } 227 | 228 | 229 | type RemovePTZConfigurationResponse struct { 230 | 231 | } 232 | 233 | 234 | type AddVideoAnalyticsConfiguration struct { 235 | XMLName string `xml:"trt:AddVideoAnalyticsConfiguration"` 236 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 237 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 238 | 239 | } 240 | 241 | 242 | type AddVideoAnalyticsConfigurationResponse struct { 243 | 244 | } 245 | 246 | 247 | type RemoveVideoAnalyticsConfiguration struct { 248 | XMLName string `xml:"trt:RemoveVideoAnalyticsConfiguration"` 249 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 250 | } 251 | 252 | 253 | type RemoveVideoAnalyticsConfigurationResponse struct { 254 | 255 | } 256 | 257 | 258 | type AddMetadataConfiguration struct { 259 | XMLName string `xml:"trt:AddMetadataConfiguration"` 260 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 261 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 262 | } 263 | 264 | 265 | type AddMetadataConfigurationResponse struct { 266 | 267 | } 268 | 269 | 270 | type RemoveMetadataConfiguration struct { 271 | XMLName string `xml:"trt:RemoveMetadataConfiguration"` 272 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 273 | } 274 | 275 | 276 | type RemoveMetadataConfigurationResponse struct { 277 | 278 | } 279 | 280 | 281 | type AddAudioOutputConfiguration struct { 282 | XMLName string `xml:"trt:AddAudioOutputConfiguration"` 283 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 284 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 285 | 286 | } 287 | 288 | 289 | type AddAudioOutputConfigurationResponse struct { 290 | 291 | } 292 | 293 | 294 | type RemoveAudioOutputConfiguration struct { 295 | XMLName string `xml:"trt:RemoveAudioOutputConfiguration"` 296 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 297 | } 298 | 299 | 300 | type RemoveAudioOutputConfigurationResponse struct { 301 | 302 | } 303 | 304 | 305 | type AddAudioDecoderConfiguration struct { 306 | XMLName string `xml:"trt:AddAudioDecoderConfiguration"` 307 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 308 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 309 | 310 | } 311 | 312 | 313 | type AddAudioDecoderConfigurationResponse struct { 314 | 315 | } 316 | 317 | 318 | type RemoveAudioDecoderConfiguration struct { 319 | XMLName string `xml:"trt:RemoveAudioDecoderConfiguration"` 320 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 321 | } 322 | 323 | 324 | type RemoveAudioDecoderConfigurationResponse struct { 325 | 326 | } 327 | 328 | 329 | type DeleteProfile struct { 330 | XMLName string `xml:"trt:DeleteProfile"` 331 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 332 | 333 | } 334 | 335 | 336 | type DeleteProfileResponse struct { 337 | 338 | } 339 | 340 | 341 | type GetVideoSourceConfigurations struct { 342 | XMLName string `xml:"trt:GetVideoSourceConfigurations"` 343 | } 344 | 345 | 346 | type GetVideoSourceConfigurationsResponse struct { 347 | Configurations onvif.VideoSourceConfiguration 348 | 349 | } 350 | 351 | 352 | type GetVideoEncoderConfigurations struct { 353 | XMLName string `xml:"trt:GetVideoEncoderConfigurations"` 354 | } 355 | 356 | 357 | type GetVideoEncoderConfigurationsResponse struct { 358 | Configurations onvif.VideoEncoderConfiguration 359 | 360 | } 361 | 362 | 363 | type GetAudioSourceConfigurations struct { 364 | XMLName string `xml:"trt:GetAudioSourceConfigurations"` 365 | } 366 | 367 | 368 | type GetAudioSourceConfigurationsResponse struct { 369 | Configurations onvif.AudioSourceConfiguration 370 | 371 | } 372 | 373 | 374 | type GetAudioEncoderConfigurations struct { 375 | XMLName string `xml:"trt:GetAudioEncoderConfigurations"` 376 | 377 | } 378 | 379 | 380 | type GetAudioEncoderConfigurationsResponse struct { 381 | Configurations onvif.AudioEncoderConfiguration 382 | 383 | } 384 | 385 | 386 | type GetVideoAnalyticsConfigurations struct { 387 | XMLName string `xml:"trt:GetVideoAnalyticsConfigurations"` 388 | } 389 | 390 | 391 | type GetVideoAnalyticsConfigurationsResponse struct { 392 | Configurations onvif.VideoAnalyticsConfiguration 393 | 394 | } 395 | 396 | 397 | type GetMetadataConfigurations struct { 398 | XMLName string `xml:"trt:GetMetadataConfigurations"` 399 | } 400 | 401 | 402 | type GetMetadataConfigurationsResponse struct { 403 | Configurations onvif.MetadataConfiguration 404 | 405 | } 406 | 407 | 408 | type GetAudioOutputConfigurations struct { 409 | XMLName string `xml:"trt:GetAudioOutputConfigurations"` 410 | } 411 | 412 | 413 | type GetAudioOutputConfigurationsResponse struct { 414 | Configurations onvif.AudioOutputConfiguration 415 | 416 | } 417 | 418 | 419 | type GetAudioDecoderConfigurations struct { 420 | XMLName string `xml:"trt:GetAudioDecoderConfigurations"` 421 | } 422 | 423 | 424 | type GetAudioDecoderConfigurationsResponse struct { 425 | Configurations onvif.AudioDecoderConfiguration 426 | 427 | } 428 | 429 | 430 | type GetVideoSourceConfiguration struct { 431 | XMLName string `xml:"trt:GetVideoSourceConfiguration"` 432 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 433 | } 434 | 435 | 436 | type GetVideoSourceConfigurationResponse struct { 437 | Configuration onvif.VideoSourceConfiguration 438 | 439 | } 440 | 441 | 442 | type GetVideoEncoderConfiguration struct { 443 | XMLName string `xml:"trt:GetVideoEncoderConfiguration"` 444 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 445 | 446 | } 447 | 448 | 449 | type GetVideoEncoderConfigurationResponse struct { 450 | Configuration onvif.VideoEncoderConfiguration 451 | 452 | } 453 | 454 | 455 | type GetAudioSourceConfiguration struct { 456 | XMLName string `xml:"trt:GetAudioSourceConfiguration"` 457 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 458 | 459 | } 460 | 461 | 462 | type GetAudioSourceConfigurationResponse struct { 463 | Configuration onvif.AudioSourceConfiguration 464 | 465 | } 466 | 467 | 468 | type GetAudioEncoderConfiguration struct { 469 | XMLName string `xml:"trt:GetAudioEncoderConfiguration"` 470 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 471 | 472 | } 473 | 474 | 475 | type GetAudioEncoderConfigurationResponse struct { 476 | Configuration onvif.AudioEncoderConfiguration 477 | 478 | } 479 | 480 | 481 | type GetVideoAnalyticsConfiguration struct { 482 | XMLName string `xml:"trt:GetVideoAnalyticsConfiguration"` 483 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 484 | 485 | } 486 | 487 | 488 | type GetVideoAnalyticsConfigurationResponse struct { 489 | Configuration onvif.VideoAnalyticsConfiguration 490 | 491 | } 492 | 493 | 494 | type GetMetadataConfiguration struct { 495 | XMLName string `xml:"trt:GetMetadataConfiguration"` 496 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 497 | 498 | } 499 | 500 | 501 | type GetMetadataConfigurationResponse struct { 502 | Configuration onvif.MetadataConfiguration 503 | 504 | } 505 | 506 | 507 | type GetAudioOutputConfiguration struct { 508 | XMLName string `xml:"trt:GetAudioOutputConfiguration"` 509 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 510 | 511 | } 512 | 513 | 514 | type GetAudioOutputConfigurationResponse struct { 515 | Configuration onvif.AudioOutputConfiguration 516 | 517 | } 518 | 519 | 520 | type GetAudioDecoderConfiguration struct { 521 | XMLName string `xml:"trt:GetAudioDecoderConfiguration"` 522 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 523 | 524 | } 525 | 526 | 527 | type GetAudioDecoderConfigurationResponse struct { 528 | Configuration onvif.AudioDecoderConfiguration 529 | 530 | } 531 | 532 | 533 | type GetCompatibleVideoEncoderConfigurations struct { 534 | XMLName string `xml:"trt:GetCompatibleVideoEncoderConfigurations"` 535 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 536 | } 537 | 538 | 539 | type GetCompatibleVideoEncoderConfigurationsResponse struct { 540 | Configurations onvif.VideoEncoderConfiguration 541 | 542 | } 543 | 544 | 545 | type GetCompatibleVideoSourceConfigurations struct { 546 | XMLName string `xml:"trt:GetCompatibleVideoSourceConfigurations"` 547 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 548 | } 549 | 550 | 551 | type GetCompatibleVideoSourceConfigurationsResponse struct { 552 | Configurations onvif.VideoSourceConfiguration 553 | 554 | } 555 | 556 | 557 | type GetCompatibleAudioEncoderConfigurations struct { 558 | XMLName string `xml:"trt:GetCompatibleAudioEncoderConfigurations"` 559 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 560 | 561 | } 562 | 563 | 564 | type GetCompatibleAudioEncoderConfigurationsResponse struct { 565 | Configurations onvif.AudioEncoderConfiguration 566 | 567 | } 568 | 569 | 570 | type GetCompatibleAudioSourceConfigurations struct { 571 | XMLName string `xml:"trt:GetCompatibleAudioSourceConfigurations"` 572 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 573 | 574 | } 575 | 576 | 577 | type GetCompatibleAudioSourceConfigurationsResponse struct { 578 | Configurations onvif.AudioSourceConfiguration 579 | 580 | } 581 | 582 | 583 | type GetCompatibleVideoAnalyticsConfigurations struct { 584 | XMLName string `xml:"trt:GetCompatibleVideoAnalyticsConfigurations"` 585 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 586 | 587 | } 588 | 589 | 590 | type GetCompatibleVideoAnalyticsConfigurationsResponse struct { 591 | Configurations onvif.VideoAnalyticsConfiguration 592 | 593 | } 594 | 595 | 596 | type GetCompatibleMetadataConfigurations struct { 597 | XMLName string `xml:"trt:GetCompatibleMetadataConfigurations"` 598 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 599 | 600 | } 601 | 602 | 603 | type GetCompatibleMetadataConfigurationsResponse struct { 604 | Configurations onvif.MetadataConfiguration 605 | 606 | } 607 | 608 | 609 | type GetCompatibleAudioOutputConfigurations struct { 610 | XMLName string `xml:"trt:GetCompatibleAudioOutputConfigurations"` 611 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 612 | 613 | } 614 | 615 | 616 | type GetCompatibleAudioOutputConfigurationsResponse struct { 617 | Configurations onvif.AudioOutputConfiguration 618 | 619 | } 620 | 621 | 622 | type GetCompatibleAudioDecoderConfigurations struct { 623 | XMLName string `xml:"trt:GetCompatibleAudioDecoderConfigurations"` 624 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 625 | 626 | } 627 | 628 | 629 | type GetCompatibleAudioDecoderConfigurationsResponse struct { 630 | Configurations onvif.AudioDecoderConfiguration 631 | 632 | } 633 | 634 | 635 | type SetVideoSourceConfiguration struct { 636 | XMLName string `xml:"trt:SetVideoSourceConfiguration"` 637 | Configuration onvif.VideoSourceConfiguration `xml:"trt:Configuration"` 638 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 639 | 640 | } 641 | 642 | 643 | type SetVideoSourceConfigurationResponse struct { 644 | 645 | } 646 | 647 | 648 | type SetVideoEncoderConfiguration struct { 649 | XMLName string `xml:"trt:SetVideoEncoderConfiguration"` 650 | Configuration onvif.VideoEncoderConfiguration `xml:"trt:Configuration"` 651 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 652 | 653 | } 654 | 655 | 656 | type SetVideoEncoderConfigurationResponse struct { 657 | 658 | } 659 | 660 | 661 | type SetAudioSourceConfiguration struct { 662 | XMLName string `xml:"trt:SetAudioSourceConfiguration"` 663 | Configuration onvif.AudioSourceConfiguration `xml:"trt:Configuration"` 664 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 665 | 666 | } 667 | 668 | 669 | type SetAudioSourceConfigurationResponse struct { 670 | 671 | } 672 | 673 | 674 | type SetAudioEncoderConfiguration struct { 675 | XMLName string `xml:"trt:SetAudioEncoderConfiguration"` 676 | Configuration onvif.AudioEncoderConfiguration `xml:"trt:Configuration"` 677 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 678 | 679 | } 680 | 681 | 682 | type SetAudioEncoderConfigurationResponse struct { 683 | 684 | } 685 | 686 | 687 | type SetVideoAnalyticsConfiguration struct { 688 | XMLName string `xml:"trt:SetVideoAnalyticsConfiguration"` 689 | Configuration onvif.VideoAnalyticsConfiguration `xml:"trt:Configuration"` 690 | ForcePersistence bool `xml:"trt:ForcePersistence"` 691 | 692 | } 693 | 694 | 695 | type SetVideoAnalyticsConfigurationResponse struct { 696 | 697 | } 698 | 699 | 700 | type SetMetadataConfiguration struct { 701 | XMLName string `xml:"trt:GetDeviceInformation"` 702 | Configuration onvif.MetadataConfiguration `xml:"trt:Configuration"` 703 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 704 | 705 | } 706 | 707 | 708 | type SetMetadataConfigurationResponse struct { 709 | 710 | } 711 | 712 | 713 | type SetAudioOutputConfiguration struct { 714 | XMLName string `xml:"trt:SetAudioOutputConfiguration"` 715 | Configuration onvif.AudioOutputConfiguration `xml:"trt:Configuration"` 716 | ForcePersistence bool `xml:"trt:ForcePersistence"` 717 | 718 | } 719 | 720 | 721 | type SetAudioOutputConfigurationResponse struct { 722 | 723 | } 724 | 725 | 726 | type SetAudioDecoderConfiguration struct { 727 | XMLName string `xml:"trt:SetAudioDecoderConfiguration"` 728 | Configuration onvif.AudioDecoderConfiguration `xml:"trt:Configuration"` 729 | ForcePersistence xsd.Boolean `xml:"trt:ForcePersistence"` 730 | 731 | } 732 | 733 | 734 | type SetAudioDecoderConfigurationResponse struct { 735 | 736 | } 737 | 738 | 739 | type GetVideoSourceConfigurationOptions struct { 740 | XMLName string `xml:"trt:GetVideoSourceConfigurationOptions"` 741 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 742 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 743 | 744 | } 745 | 746 | 747 | type GetVideoSourceConfigurationOptionsResponse struct { 748 | Options onvif.VideoSourceConfigurationOptions 749 | 750 | } 751 | 752 | 753 | type GetVideoEncoderConfigurationOptions struct { 754 | XMLName string `xml:"trt:GetVideoEncoderConfigurationOptions"` 755 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 756 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 757 | 758 | } 759 | 760 | 761 | type GetVideoEncoderConfigurationOptionsResponse struct { 762 | Options onvif.VideoEncoderConfigurationOptions 763 | 764 | } 765 | 766 | 767 | type GetAudioSourceConfigurationOptions struct { 768 | XMLName string `xml:"trt:GetAudioSourceConfigurationOptions"` 769 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 770 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 771 | 772 | } 773 | 774 | 775 | type GetAudioSourceConfigurationOptionsResponse struct { 776 | Options onvif.AudioSourceConfigurationOptions 777 | 778 | } 779 | 780 | 781 | type GetAudioEncoderConfigurationOptions struct { 782 | XMLName string `xml:"trt:GetAudioEncoderConfigurationOptions"` 783 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 784 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 785 | } 786 | 787 | 788 | type GetAudioEncoderConfigurationOptionsResponse struct { 789 | Options onvif.AudioEncoderConfigurationOptions 790 | 791 | } 792 | 793 | 794 | type GetMetadataConfigurationOptions struct { 795 | XMLName string `xml:"trt:GetMetadataConfigurationOptions"` 796 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 797 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 798 | 799 | } 800 | 801 | 802 | type GetMetadataConfigurationOptionsResponse struct { 803 | Options onvif.MetadataConfigurationOptions 804 | 805 | } 806 | 807 | 808 | type GetAudioOutputConfigurationOptions struct { 809 | XMLName string `xml:"trt:GetAudioOutputConfigurationOptions"` 810 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 811 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 812 | 813 | } 814 | 815 | 816 | type GetAudioOutputConfigurationOptionsResponse struct { 817 | Options onvif.AudioOutputConfigurationOptions 818 | 819 | } 820 | 821 | 822 | type GetAudioDecoderConfigurationOptions struct { 823 | XMLName string `xml:"trt:GetAudioDecoderConfigurationOptions"` 824 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 825 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 826 | 827 | } 828 | 829 | 830 | type GetAudioDecoderConfigurationOptionsResponse struct { 831 | Options onvif.AudioDecoderConfigurationOptions 832 | 833 | } 834 | 835 | 836 | type GetGuaranteedNumberOfVideoEncoderInstances struct { 837 | XMLName string `xml:"trt:GetGuaranteedNumberOfVideoEncoderInstances"` 838 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 839 | 840 | } 841 | 842 | 843 | type GetGuaranteedNumberOfVideoEncoderInstancesResponse struct { 844 | TotalNumber int 845 | JPEG int 846 | H264 int 847 | MPEG4 int 848 | 849 | } 850 | 851 | 852 | type GetStreamUri struct { 853 | XMLName string `xml:"trt:GetStreamUri"` 854 | StreamSetup onvif.StreamSetup `xml:"trt:StreamSetup"` 855 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 856 | 857 | } 858 | 859 | 860 | type GetStreamUriResponse struct { 861 | MediaUri onvif.MediaUri 862 | 863 | } 864 | 865 | 866 | type StartMulticastStreaming struct { 867 | XMLName string `xml:"trt:StartMulticastStreaming"` 868 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 869 | } 870 | 871 | 872 | type StartMulticastStreamingResponse struct { 873 | 874 | } 875 | 876 | 877 | type StopMulticastStreaming struct { 878 | XMLName string `xml:"trt:StopMulticastStreaming"` 879 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 880 | } 881 | 882 | 883 | type StopMulticastStreamingResponse struct { 884 | 885 | } 886 | 887 | 888 | type SetSynchronizationPoint struct { 889 | XMLName string `xml:"trt:SetSynchronizationPoint"` 890 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 891 | } 892 | 893 | 894 | type SetSynchronizationPointResponse struct { 895 | 896 | } 897 | 898 | 899 | type GetSnapshotUri struct { 900 | XMLName string `xml:"trt:GetSnapshotUri"` 901 | ProfileToken onvif.ReferenceToken `xml:"trt:ProfileToken"` 902 | 903 | } 904 | 905 | 906 | type GetSnapshotUriResponse struct { 907 | MediaUri onvif.MediaUri 908 | 909 | } 910 | 911 | 912 | type GetVideoSourceModes struct { 913 | XMLName string `xml:"trt:GetVideoSourceModes"` 914 | VideoSourceToken onvif.ReferenceToken `xml:"trt:VideoSourceToken"` 915 | 916 | } 917 | 918 | 919 | type GetVideoSourceModesResponse struct { 920 | VideoSourceModes onvif.VideoSourceMode 921 | 922 | } 923 | 924 | 925 | type SetVideoSourceMode struct { 926 | XMLName string `xml:"trt:SetVideoSourceMode"` 927 | VideoSourceToken onvif.ReferenceToken `xml:"trt:VideoSourceToken"` 928 | VideoSourceModeToken onvif.ReferenceToken `xml:"trt:VideoSourceModeToken"` 929 | 930 | } 931 | 932 | 933 | type SetVideoSourceModeResponse struct { 934 | Reboot bool 935 | 936 | } 937 | 938 | 939 | type GetOSDs struct { 940 | XMLName string `xml:"trt:GetOSDs"` 941 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 942 | 943 | } 944 | 945 | 946 | type GetOSDsResponse struct { 947 | OSDs onvif.OSDConfiguration 948 | 949 | } 950 | 951 | 952 | type GetOSD struct { 953 | XMLName string `xml:"trt:GetOSD"` 954 | OSDToken onvif.ReferenceToken `xml:"trt:OSDToken"` 955 | 956 | } 957 | 958 | 959 | type GetOSDResponse struct { 960 | OSD onvif.OSDConfiguration 961 | 962 | } 963 | 964 | 965 | type GetOSDOptions struct { 966 | XMLName string `xml:"trt:GetOSDOptions"` 967 | ConfigurationToken onvif.ReferenceToken `xml:"trt:ConfigurationToken"` 968 | 969 | } 970 | 971 | 972 | type GetOSDOptionsResponse struct { 973 | OSDOptions onvif.OSDConfigurationOptions 974 | 975 | } 976 | 977 | 978 | type SetOSD struct { 979 | XMLName string `xml:"trt:SetOSD"` 980 | OSD onvif.OSDConfiguration `xml:"trt:OSD"` 981 | 982 | } 983 | 984 | 985 | type SetOSDResponse struct { 986 | 987 | } 988 | 989 | 990 | type CreateOSD struct { 991 | XMLName string `xml:"trt:CreateOSD"` 992 | OSD onvif.OSDConfiguration `xml:"trt:OSD"` 993 | 994 | } 995 | 996 | 997 | type CreateOSDResponse struct { 998 | OSDToken onvif.ReferenceToken 999 | 1000 | } 1001 | 1002 | 1003 | type DeleteOSD struct { 1004 | XMLName string `xml:"trt:DeleteOSD"` 1005 | OSDToken onvif.ReferenceToken `xml:"trt:OSDToken"` 1006 | 1007 | } 1008 | 1009 | 1010 | type DeleteOSDResponse struct { 1011 | 1012 | } -------------------------------------------------------------------------------- /PTZ/types.go: -------------------------------------------------------------------------------- 1 | package PTZ 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/xsd" 5 | "github.com/yakovlevdmv/goonvif/xsd/onvif" 6 | ) 7 | 8 | type Capabilities struct { 9 | EFlip xsd.Boolean `xml:"EFlip,attr"` 10 | Reverse xsd.Boolean `xml:"Reverse,attr"` 11 | GetCompatibleConfigurations xsd.Boolean `xml:"GetCompatibleConfigurations,attr"` 12 | MoveStatus xsd.Boolean `xml:"MoveStatus,attr"` 13 | StatusPosition xsd.Boolean `xml:"StatusPosition,attr"` 14 | } 15 | 16 | //PTZ main types 17 | 18 | type GetServiceCapabilities struct { 19 | XMLName string `xml:"tptz:GetServiceCapabilities"` 20 | } 21 | 22 | 23 | type GetServiceCapabilitiesResponse struct { 24 | Capabilities Capabilities 25 | 26 | } 27 | 28 | 29 | type GetNodes struct { 30 | XMLName string `xml:"tptz:GetNodes"` 31 | } 32 | 33 | 34 | type GetNodesResponse struct { 35 | PTZNode onvif.PTZNode 36 | 37 | } 38 | 39 | 40 | type GetNode struct { 41 | XMLName string `xml:"tptz:GetNode"` 42 | NodeToken onvif.ReferenceToken `xml:"tptz:NodeToken"` 43 | 44 | } 45 | 46 | 47 | type GetNodeResponse struct { 48 | PTZNode onvif.PTZNode 49 | 50 | } 51 | 52 | 53 | type GetConfiguration struct { 54 | XMLName string `xml:"tptz:GetConfiguration"` 55 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 56 | } 57 | 58 | 59 | type GetConfigurationResponse struct { 60 | PTZConfiguration onvif.PTZConfiguration 61 | 62 | } 63 | 64 | 65 | type GetConfigurations struct { 66 | XMLName string `xml:"tptz:GetConfigurations"` 67 | } 68 | 69 | 70 | type GetConfigurationsResponse struct { 71 | PTZConfiguration onvif.PTZConfiguration 72 | 73 | } 74 | 75 | 76 | type SetConfiguration struct { 77 | XMLName string `xml:"tptz:SetConfiguration"` 78 | PTZConfiguration onvif.PTZConfiguration `xml:"tptz:PTZConfiguration"` 79 | ForcePersistence xsd.Boolean `xml:"tptz:ForcePersistence"` 80 | 81 | } 82 | 83 | 84 | type SetConfigurationResponse struct { 85 | 86 | } 87 | 88 | 89 | type GetConfigurationOptions struct { 90 | XMLName string `xml:"tptz:GetConfigurationOptions"` 91 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 92 | 93 | } 94 | 95 | 96 | type GetConfigurationOptionsResponse struct { 97 | PTZConfigurationOptions onvif.PTZConfigurationOptions 98 | 99 | } 100 | 101 | 102 | type SendAuxiliaryCommand struct { 103 | XMLName string `xml:"tptz:SendAuxiliaryCommand"` 104 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 105 | AuxiliaryData onvif.AuxiliaryData `xml:"tptz:AuxiliaryData"` 106 | 107 | } 108 | 109 | 110 | type SendAuxiliaryCommandResponse struct { 111 | AuxiliaryResponse onvif.AuxiliaryData 112 | 113 | } 114 | 115 | 116 | type GetPresets struct { 117 | XMLName string `xml:"tptz:GetPresets"` 118 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 119 | } 120 | 121 | 122 | type GetPresetsResponse struct { 123 | Preset onvif.PTZPreset 124 | 125 | } 126 | 127 | 128 | type SetPreset struct { 129 | XMLName string `xml:"tptz:SetPreset"` 130 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 131 | PresetName xsd.String `xml:"tptz:PresetName"` 132 | PresetToken onvif.ReferenceToken `xml:"tptz:PresetToken"` 133 | } 134 | 135 | 136 | type SetPresetResponse struct { 137 | PresetToken onvif.ReferenceToken 138 | 139 | } 140 | 141 | 142 | type RemovePreset struct { 143 | XMLName string `xml:"tptz:RemovePreset"` 144 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 145 | PresetToken onvif.ReferenceToken `xml:"tptz:PresetToken"` 146 | 147 | } 148 | 149 | 150 | type RemovePresetResponse struct { 151 | 152 | } 153 | 154 | 155 | type GotoPreset struct { 156 | XMLName string `xml:"tptz:GotoPreset"` 157 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 158 | PresetToken onvif.ReferenceToken `xml:"tptz:PresetToken"` 159 | Speed onvif.PTZSpeed `xml:"tptz:Speed"` 160 | 161 | } 162 | 163 | 164 | type GotoPresetResponse struct { 165 | 166 | } 167 | 168 | 169 | type GotoHomePosition struct { 170 | XMLName string `xml:"tptz:GotoHomePosition"` 171 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 172 | Speed onvif.PTZSpeed `xml:"tptz:Speed"` 173 | 174 | } 175 | 176 | 177 | type GotoHomePositionResponse struct { 178 | 179 | } 180 | 181 | 182 | type SetHomePosition struct { 183 | XMLName string `xml:"tptz:SetHomePosition"` 184 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 185 | } 186 | 187 | 188 | type SetHomePositionResponse struct { 189 | 190 | } 191 | 192 | 193 | type ContinuousMove struct { 194 | XMLName string `xml:"tptz:ContinuousMove"` 195 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 196 | Velocity onvif.PTZSpeed `xml:"tptz:Velocity"` 197 | Timeout xsd.Duration `xml:"tptz:Timeout"` 198 | 199 | } 200 | 201 | 202 | type ContinuousMoveResponse struct { 203 | 204 | } 205 | 206 | 207 | type RelativeMove struct { 208 | XMLName string `xml:"tptz:RelativeMove"` 209 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 210 | Translation onvif.PTZVector `xml:"tptz:Translation"` 211 | Speed onvif.PTZSpeed `xml:"tptz:Speed"` 212 | 213 | } 214 | 215 | 216 | type RelativeMoveResponse struct { 217 | 218 | } 219 | 220 | 221 | type GetStatus struct { 222 | XMLName string `xml:"tptz:GetStatus"` 223 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 224 | } 225 | 226 | 227 | type GetStatusResponse struct { 228 | PTZStatus onvif.PTZStatus 229 | 230 | } 231 | 232 | 233 | type AbsoluteMove struct { 234 | XMLName string `xml:"tptz:AbsoluteMove"` 235 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 236 | Position onvif.PTZVector `xml:"tptz:Position"` 237 | Speed onvif.PTZSpeed `xml:"tptz:Speed"` 238 | 239 | } 240 | 241 | 242 | type AbsoluteMoveResponse struct { 243 | 244 | } 245 | 246 | 247 | type GeoMove struct { 248 | XMLName string `xml:"tptz:GeoMove"` 249 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 250 | Target onvif.GeoLocation `xml:"tptz:Target"` 251 | Speed onvif.PTZSpeed `xml:"tptz:Speed"` 252 | AreaHeight xsd.Float `xml:"tptz:AreaHeight"` 253 | AreaWidth xsd.Float `xml:"tptz:AreaWidth"` 254 | 255 | } 256 | 257 | 258 | type GeoMoveResponse struct { 259 | 260 | } 261 | 262 | 263 | type Stop struct { 264 | XMLName string `xml:"tptz:Stop"` 265 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 266 | PanTilt xsd.Boolean `xml:"tptz:PanTilt"` 267 | Zoom xsd.Boolean `xml:"tptz:Zoom"` 268 | 269 | } 270 | 271 | 272 | type StopResponse struct { 273 | 274 | } 275 | 276 | 277 | type GetPresetTours struct { 278 | XMLName string `xml:"tptz:GetPresetTours"` 279 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 280 | } 281 | 282 | 283 | type GetPresetToursResponse struct { 284 | PresetTour onvif.PresetTour 285 | 286 | } 287 | 288 | 289 | type GetPresetTour struct { 290 | XMLName string `xml:"tptz:GetPresetTour"` 291 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 292 | PresetTourToken onvif.ReferenceToken `xml:"tptz:PresetTourToken"` 293 | 294 | } 295 | 296 | 297 | type GetPresetTourResponse struct { 298 | PresetTour onvif.PresetTour 299 | 300 | } 301 | 302 | 303 | type GetPresetTourOptions struct { 304 | XMLName string `xml:"tptz:GetPresetTourOptions"` 305 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 306 | PresetTourToken onvif.ReferenceToken `xml:"tptz:PresetTourToken"` 307 | 308 | } 309 | 310 | 311 | type GetPresetTourOptionsResponse struct { 312 | Options onvif.PTZPresetTourOptions 313 | 314 | } 315 | 316 | 317 | type CreatePresetTour struct { 318 | XMLName string `xml:"tptz:CreatePresetTour"` 319 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 320 | 321 | } 322 | 323 | 324 | type CreatePresetTourResponse struct { 325 | PresetTourToken onvif.ReferenceToken 326 | 327 | } 328 | 329 | 330 | type ModifyPresetTour struct { 331 | XMLName string `xml:"tptz:ModifyPresetTour"` 332 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 333 | PresetTour onvif.PresetTour `xml:"tptz:PresetTour"` 334 | 335 | } 336 | 337 | 338 | type ModifyPresetTourResponse struct { 339 | 340 | } 341 | 342 | 343 | type OperatePresetTour struct { 344 | XMLName string `xml:"tptz:OperatePresetTour"` 345 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 346 | PresetTourToken onvif.ReferenceToken `xml:"onvif:PresetTourToken"` 347 | Operation onvif.PTZPresetTourOperation `xml:"onvif:Operation"` 348 | 349 | } 350 | 351 | 352 | type OperatePresetTourResponse struct { 353 | 354 | } 355 | 356 | 357 | type RemovePresetTour struct { 358 | XMLName string `xml:"tptz:RemovePresetTour"` 359 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 360 | PresetTourToken onvif.ReferenceToken `xml:"tptz:PresetTourToken"` 361 | 362 | } 363 | 364 | 365 | type RemovePresetTourResponse struct { 366 | 367 | } 368 | 369 | 370 | type GetCompatibleConfigurations struct { 371 | XMLName string `xml:"tptz:GetCompatibleConfigurations"` 372 | ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"` 373 | 374 | } 375 | 376 | 377 | type GetCompatibleConfigurationsResponse struct { 378 | PTZConfiguration onvif.PTZConfiguration 379 | 380 | } 381 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Goonvif 2 | Простое управление IP-устройствами, включая камерами. Goonvif - это реализация протокола ONVIF для управления IP-устройствами. Целью создания данной библиотеки является удобное и легкое управление IP-камерами и другими устройствами, поддерживающими стандарт ONVIF. 3 | 4 | ## Установка 5 | Для установки библиотеки необходимо воспользоваться утилитой go get: 6 | ``` 7 | go get github.com/yakovlevdmv/goonvif 8 | ``` 9 | ## Поддерживаемые сервисы 10 | Следующие сервисы полностью реализованы: 11 | - Device 12 | - Media 13 | - PTZ 14 | - Imaging 15 | 16 | ## Использование 17 | 18 | ### Общая концепция 19 | 1) Подключение к устройству 20 | 2) Аутентификация (если необходима) 21 | 3) Определение типов данных 22 | 4) Выполнение необходимого метода 23 | 24 | #### Подключение к устройству 25 | Если в сети находится устройство по адресу *192.168.13.42*, а ее ONVIF сервисы используют порт *1234*, тогда подключиться к устройству можно следующим способом: 26 | ``` 27 | dev, err := goonvif.NewDevice("192.168.13.42:1234") 28 | ``` 29 | 30 | *ONVIF порт может отличаться в зависимости от устройства и, чтобы узнать, какой порт использовать, можно зайти в веб-интерфейс устройства. **Обычно это 80 порт.*** 31 | 32 | #### Аутентификация 33 | Если какая-либо функция одного из сервисов ONVIF требует аутентификацию, необходимо использовать метод `Authenticate`. 34 | ``` 35 | device := onvif.NewDevice("192.168.13.42:1234") 36 | device.Authenticate("username", "password") 37 | ``` 38 | 39 | #### Определение типов данных 40 | Каждому сервису ONVIF в этой библиотеке соответствует свой пакет, в котором определены все типы данных этого сервиса, причем название пакета идентично названию сервиса и начинается с заглавной буквы. 41 | В Goonvif определены структуры для каждой функции каждого поддерживаемого этой библиотекой сервиса ONVIF. 42 | Определим тип данных функции `GetCapabilities` сервиса `Device`. Это делается следующим образом: 43 | ``` 44 | capabilities := Device.GetCapabilities{Category:"All"} 45 | ``` 46 | Почему у структуры GetCapabilities поле Category и почему значение этого поля All? 47 | 48 | На рисунке ниже показана документация функции [GetCapabilities](https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl). Видно, что функция принимает один пареметр Category и его значение должно быть одно из следующих: `'All', 'Analytics', 'Device', 'Events', 'Imaging', 'Media' или 'PTZ'`. 49 | 50 | ![Device GetCapabilities](img/exmp_GetCapabilities.png) 51 | 52 | Пример определения типа данных функции GetServiceCapabilities сервиса [PTZ](https://www.onvif.org/ver20/ptz/wsdl/ptz.wsdl): 53 | ``` 54 | ptzCapabilities := PTZ.GetServiceCapabilities{} 55 | ``` 56 | На рисунке ниже видно, что GetServiceCapabilities не принимает никаких аргументов. 57 | 58 | ![PTZ GetServiceCapabilities](img/GetServiceCapabilities.png) 59 | 60 | *Общие типы данных находятся в пакете xsd/onvif. Типы данных (структуры), которые могут быть общими для всех сервисов определены в пакете onvif.* 61 | 62 | Пример оределения типа данных функции CreateUsers сервиса [Device](https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl): 63 | ``` 64 | createUsers := Device.CreateUsers{User: onvif.User{Username:"admin", Password:"qwerty", UserLevel:"User"}} 65 | ``` 66 | 67 | По рисунку ниже видно, что в данном примере полем структуры CreateUsers должен быть User, типом данных которого является структура User, содержащая поля Username, Password, UserLevel и необязательный Extension. Структура User находится в пакете onvif. 68 | 69 | ![Device CreateUsers](img/exmp_CreateUsers.png) 70 | 71 | #### Выполнение необходимого метода 72 | Для выполнения какой-либо функции одного из сервисов ONVIF, структура которой была определена, необходимо использовать `CallMethod` объекта device. 73 | ``` 74 | createUsers := Device.CreateUsers{User: onvif.User{Username:"admin", Password:"qwerty", UserLevel:"User"}} 75 | device := onvif.NewDevice("192.168.13.42:1234") 76 | device.Authenticate("username", "password") 77 | resp, err := dev.CallMethod(createUsers) 78 | ``` 79 | -------------------------------------------------------------------------------- /api/api.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "fmt" 5 | "reflect" 6 | "regexp" 7 | "errors" 8 | "strings" 9 | "github.com/beevik/etree" 10 | "github.com/gin-gonic/gin" 11 | "github.com/yakovlevdmv/gosoap" 12 | "github.com/yakovlevdmv/goonvif" 13 | "github.com/yakovlevdmv/goonvif/networking" 14 | "net/http" 15 | "io/ioutil" 16 | "github.com/yakovlevdmv/WS-Discovery" 17 | "path" 18 | ) 19 | 20 | func RunApi () { 21 | router := gin.Default() 22 | 23 | router.POST("/:service/:method", func(c *gin.Context) { 24 | c.Header("Access-Control-Allow-Origin", "*") 25 | //c.Header("Access-Control-Allow-Headers", "access-control-allow-origin, access-control-allow-headers") 26 | 27 | serviceName := c.Param("service") 28 | methodName := c.Param("method") 29 | username := c.GetHeader("username") 30 | pass := c.GetHeader("password") 31 | xaddr := c.GetHeader("xaddr") 32 | acceptedData, err := c.GetRawData() 33 | if err != nil { 34 | fmt.Println(err) 35 | } 36 | 37 | message, err := callNecessaryMethod(serviceName, methodName, string(acceptedData), username, pass, xaddr) 38 | if err != nil { 39 | c.XML(http.StatusBadRequest, err.Error()) 40 | } else { 41 | c.String(http.StatusOK, message) 42 | } 43 | }) 44 | 45 | router.GET("/discovery", func(context *gin.Context) { 46 | context.Header("Access-Control-Allow-Origin", "*") 47 | context.Header("Access-Control-Allow-Headers", "access-control-allow-origin, access-control-allow-headers") 48 | 49 | interfaceName := context.GetHeader("interface") 50 | 51 | var response = "[" 52 | devices := WS_Discovery.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn":"http://www.onvif.org/ver10/network/wsdl"}) 53 | for _, j := range devices { 54 | doc := etree.NewDocument() 55 | if err := doc.ReadFromString(j); err != nil { 56 | context.XML(http.StatusBadRequest, err.Error()) 57 | } else { 58 | 59 | endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs") 60 | scopes := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/Scopes") 61 | 62 | flag := false 63 | 64 | for _, xaddr := range endpoints { 65 | xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2] 66 | if strings.Contains(response, xaddr) { 67 | flag = true 68 | break 69 | } 70 | response += "{" 71 | response += `"url":"` + xaddr + `",` 72 | } 73 | if flag { 74 | break 75 | } 76 | for _, scope := range scopes { 77 | re := regexp.MustCompile(`onvif:\/\/www\.onvif\.org\/name\/[A-Za-z0-9-]+`) 78 | match := re.FindStringSubmatch(scope.Text()) 79 | response += `"name":"` + path.Base(match[0]) + `"` 80 | } 81 | response += "}," 82 | 83 | } 84 | 85 | } 86 | response = strings.TrimRight(response, ",") 87 | response += "]" 88 | if response != "" { 89 | context.String(http.StatusOK, response) 90 | } 91 | }) 92 | 93 | router.Run() 94 | } 95 | 96 | 97 | //func soapHandling(tp interface{}, tags* map[string]string) { 98 | // ifaceValue := reflect.ValueOf(tp).Elem() 99 | // typeOfStruct := ifaceValue.Type() 100 | // if ifaceValue.Kind() != reflect.Struct { 101 | // return 102 | // } 103 | // for i := 0; i < ifaceValue.NumField(); i++ { 104 | // field := ifaceValue.Field(i) 105 | // tg, err := typeOfStruct.FieldByName(typeOfStruct.Field(i).Name) 106 | // if err == false { 107 | // fmt.Println(err) 108 | // } 109 | // (*tags)[typeOfStruct.Field(i).Name] = string(tg.Tag) 110 | // 111 | // subStruct := reflect.New(reflect.TypeOf( field.Interface() )) 112 | // soapHandling(subStruct.Interface(), tags) 113 | // } 114 | //} 115 | 116 | 117 | func callNecessaryMethod(serviceName, methodName, acceptedData, username, password, xaddr string) (string, error) { 118 | var methodStruct interface{} 119 | var err error 120 | 121 | switch strings.ToLower(serviceName) { 122 | case "device": 123 | methodStruct, err = getDeviceStructByName(methodName) 124 | case "ptz": 125 | methodStruct, err = getPTZStructByName(methodName) 126 | case "media": 127 | methodStruct, err = getMediaStructByName(methodName) 128 | default: 129 | return "", errors.New("there is no such service") 130 | } 131 | if err != nil { //done 132 | return "", err 133 | } 134 | 135 | resp, err := xmlAnalize(methodStruct, &acceptedData) 136 | if err != nil { 137 | return "", err 138 | } 139 | 140 | endpoint, err := getEndpoint(serviceName, xaddr) 141 | if err != nil { 142 | return "", err 143 | } 144 | 145 | soap := gosoap.NewEmptySOAP() 146 | soap.AddStringBodyContent(*resp) 147 | soap.AddRootNamespaces(goonvif.Xlmns) 148 | soap.AddWSSecurity(username, password) 149 | 150 | servResp, err := networking.SendSoap(endpoint, soap.String()) 151 | if err != nil { 152 | return "", err 153 | } 154 | 155 | rsp, err := ioutil.ReadAll(servResp.Body) 156 | if err != nil { 157 | return "", err 158 | } 159 | 160 | return string(rsp), nil 161 | } 162 | 163 | func getEndpoint(service, xaddr string) (string, error) { 164 | dev, err := goonvif.NewDevice(xaddr) 165 | if err != nil { 166 | return "", err 167 | } 168 | pkg := strings.ToLower(service) 169 | 170 | var endpoint string 171 | switch pkg { 172 | case "device": endpoint = dev.GetEndpoint("Device") 173 | case "event": endpoint = dev.GetEndpoint("Event") 174 | case "imaging": endpoint = dev.GetEndpoint("Imaging") 175 | case "media": endpoint = dev.GetEndpoint("Media") 176 | case "ptz": endpoint = dev.GetEndpoint("PTZ") 177 | } 178 | return endpoint, nil 179 | } 180 | 181 | func xmlAnalize(methodStruct interface{}, acceptedData* string) (*string, error) { 182 | test := make([]map[string]string, 0) //tags 183 | testunMarshal := make([][]interface{}, 0) //data 184 | var mas []string //idnt 185 | 186 | soapHandling(methodStruct, &test) 187 | test = mapProcessing(test) 188 | 189 | doc := etree.NewDocument() 190 | if err := doc.ReadFromString(*acceptedData); err != nil { 191 | return nil, err 192 | } 193 | etr := doc.FindElements("./*") 194 | xmlUnmarshal(etr, &testunMarshal, &mas) 195 | ident(&mas) 196 | 197 | document:= etree.NewDocument() 198 | var el *etree.Element 199 | var idntIndex = 0 200 | 201 | for lstIndex := 0; lstIndex < len(testunMarshal); { 202 | lst := (testunMarshal)[lstIndex] 203 | elemName, attr, value, err := xmlMaker(&lst, &test, lstIndex) 204 | if err != nil { 205 | return nil, err 206 | } 207 | 208 | if mas[lstIndex] == "Push" && lstIndex == 0 { //done 209 | el = document.CreateElement(elemName) 210 | el.SetText(value) 211 | if len(attr) != 0 { 212 | for key, value := range attr { 213 | el.CreateAttr(key, value) 214 | } 215 | } 216 | } else if mas[idntIndex] == "Push" { 217 | pushTmp := etree.NewElement(elemName) 218 | pushTmp.SetText(value) 219 | if len(attr) != 0 { 220 | for key, value := range attr { 221 | pushTmp.CreateAttr(key, value) 222 | } 223 | } 224 | el.AddChild(pushTmp) 225 | el = pushTmp 226 | } else if mas[idntIndex] == "PushPop" { 227 | popTmp := etree.NewElement(elemName) 228 | popTmp.SetText(value) 229 | if len(attr) != 0 { 230 | for key, value := range attr { 231 | popTmp.CreateAttr(key, value) 232 | } 233 | } 234 | if el == nil { 235 | document.AddChild(popTmp) 236 | } else { 237 | el.AddChild(popTmp) 238 | } 239 | } else if mas[idntIndex] == "Pop" { 240 | el = el.Parent() 241 | lstIndex -= 1 242 | } 243 | idntIndex += 1 244 | lstIndex += 1 245 | } 246 | 247 | resp, err := document.WriteToString() 248 | if err != nil { 249 | return nil, err 250 | } 251 | 252 | return &resp, err 253 | } 254 | 255 | func xmlMaker(lst* []interface{}, tags* []map[string]string, lstIndex int) (string, map[string]string, string, error) { 256 | var elemName, value string 257 | attr := make(map[string]string) 258 | for tgIndx, tg := range *tags { 259 | if tgIndx == lstIndex { 260 | for index, elem := range *lst { 261 | if reflect.TypeOf(elem).String() == "[]etree.Attr" { 262 | conversion := elem.([]etree.Attr) 263 | for _, i := range conversion { 264 | attr[i.Key] = i.Value 265 | } 266 | } else { 267 | conversion := elem.(string) 268 | if index == 0 && lstIndex == 0 { 269 | res, err := xmlProcessing(tg["XMLName"]) 270 | if err != nil { 271 | return "", nil, "", err 272 | } 273 | elemName = res 274 | } else if index == 0 { 275 | res, err := xmlProcessing(tg[conversion]) 276 | if err != nil { 277 | return "", nil, "", err 278 | } 279 | elemName = res 280 | } else { 281 | value = conversion 282 | } 283 | } 284 | } 285 | } 286 | } 287 | return elemName, attr, value, nil 288 | } 289 | 290 | func xmlProcessing (tg string) (string, error) { 291 | r, _ := regexp.Compile(`"(.*?)"`) 292 | str := r.FindStringSubmatch(tg) 293 | if len(str) == 0 { 294 | return "", errors.New("out of range") 295 | } 296 | attr := strings.Index(str[1], ",attr") 297 | omit := strings.Index(str[1], ",omitempty") 298 | attrOmit := strings.Index(str[1], ",attr,omitempty") 299 | omitAttr := strings.Index(str[1], ",omitempty,attr") 300 | 301 | if attr > -1 && attrOmit == -1 && omitAttr == -1 { 302 | return str[1][0:attr], nil 303 | } else if omit > -1 && attrOmit == -1 && omitAttr == -1 { 304 | return str[1][0:omit], nil 305 | } else if attr == -1 && omit == -1 { 306 | return str[1], nil 307 | } else if attrOmit > -1 { 308 | return str[1][0:attrOmit], nil 309 | } else { 310 | return str[1][0:omitAttr], nil 311 | } 312 | 313 | return "", errors.New("something went wrong") 314 | } 315 | 316 | func mapProcessing(mapVar []map[string]string) []map[string]string { 317 | for indx := 0; indx < len(mapVar); indx++ { 318 | element := mapVar[indx] 319 | for _, value := range element { 320 | if value == "" { 321 | mapVar = append(mapVar[:indx], mapVar[indx+1:]...) 322 | indx-- 323 | } 324 | if strings.Index(value, ",attr") != -1 { 325 | mapVar = append(mapVar[:indx], mapVar[indx+1:]...) 326 | indx-- 327 | } 328 | } 329 | } 330 | return mapVar 331 | } 332 | 333 | func soapHandling(tp interface{}, tags* []map[string]string) { 334 | s := reflect.ValueOf(tp).Elem() 335 | typeOfT := s.Type() 336 | if s.Kind() != reflect.Struct { 337 | return 338 | } 339 | for i := 0; i < s.NumField(); i++ { 340 | f := s.Field(i) 341 | tmp, err := typeOfT.FieldByName(typeOfT.Field(i).Name) 342 | if err == false { 343 | fmt.Println(err) 344 | } 345 | *tags = append(*tags, map[string]string{typeOfT.Field(i).Name : string(tmp.Tag)}) 346 | subStruct := reflect.New(reflect.TypeOf( f.Interface() )) 347 | soapHandling(subStruct.Interface(), tags) 348 | } 349 | } 350 | 351 | 352 | func xmlUnmarshal(elems []*etree.Element, data* [][]interface{}, mas* []string) { 353 | for _, elem := range elems { 354 | *data = append(*data, []interface{}{elem.Tag,elem.Attr,elem.Text()}) 355 | *mas = append(*mas, "Push") 356 | xmlUnmarshal(elem.FindElements("./*"), data, mas) 357 | *mas = append(*mas, "Pop") 358 | } 359 | } 360 | 361 | func ident(mas* []string) { 362 | var buffer string 363 | for _, j := range *mas { 364 | buffer += j + " " 365 | } 366 | buffer = strings.Replace(buffer, "Push Pop ", "PushPop ", -1) 367 | buffer = strings.TrimSpace(buffer) 368 | *mas = strings.Split(buffer, " ") 369 | } -------------------------------------------------------------------------------- /api/get_structs.go: -------------------------------------------------------------------------------- 1 | package api 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif/PTZ" 5 | "errors" 6 | "github.com/yakovlevdmv/goonvif/Device" 7 | "github.com/yakovlevdmv/goonvif/Media" 8 | ) 9 | 10 | func getPTZStructByName(name string) (interface{}, error) { 11 | switch name { 12 | case "GetServiceCapabilities": 13 | return &PTZ.GetServiceCapabilities{}, nil 14 | case "GetNodes": 15 | return &PTZ.GetNodes{}, nil 16 | case "GetNode": 17 | return &PTZ.GetNode{}, nil 18 | case "GetConfiguration": 19 | return &PTZ.GetConfiguration{}, nil 20 | case "GetConfigurations": 21 | return &PTZ.GetConfigurations{}, nil 22 | case "SetConfiguration": 23 | return &PTZ.SetConfiguration{}, nil 24 | case "GetConfigurationOptions": 25 | return &PTZ.GetConfigurationOptions{}, nil 26 | case "SendAuxiliaryCommand": 27 | return &PTZ.SendAuxiliaryCommand{}, nil 28 | case "GetPresets": 29 | return &PTZ.GetPresets{}, nil 30 | case "SetPreset": 31 | return &PTZ.SetPreset{}, nil 32 | case "RemovePreset": 33 | return &PTZ.RemovePreset{}, nil 34 | case "GotoPreset": 35 | return &PTZ.GotoPreset{}, nil 36 | case "GotoHomePosition": 37 | return &PTZ.GotoHomePosition{}, nil 38 | case "SetHomePosition": 39 | return &PTZ.SetHomePosition{}, nil 40 | case "ContinuousMove": 41 | return &PTZ.ContinuousMove{}, nil 42 | case "RelativeMove": 43 | return &PTZ.RelativeMove{}, nil 44 | case "GetStatus": 45 | return &PTZ.GetStatus{}, nil 46 | case "AbsoluteMove": 47 | return &PTZ.AbsoluteMove{}, nil 48 | case "GeoMove": 49 | return &PTZ.GeoMove{}, nil 50 | case "Stop": 51 | return &PTZ.Stop{}, nil 52 | case "GetPresetTours": 53 | return &PTZ.GetPresetTours{}, nil 54 | case "GetPresetTour": 55 | return &PTZ.GetPresetTour{}, nil 56 | case "GetPresetTourOptions": 57 | return &PTZ.GetPresetTourOptions{}, nil 58 | case "CreatePresetTour": 59 | return &PTZ.CreatePresetTour{}, nil 60 | case "ModifyPresetTour": 61 | return &PTZ.ModifyPresetTour{}, nil 62 | case "OperatePresetTour": 63 | return &PTZ.OperatePresetTour{}, nil 64 | case "RemovePresetTour": 65 | return &PTZ.RemovePresetTour{}, nil 66 | case "GetCompatibleConfigurations": 67 | return &PTZ.GetCompatibleConfigurations{}, nil 68 | default: 69 | return nil, errors.New("there is no such method in the PTZ service") 70 | } 71 | } 72 | 73 | func getDeviceStructByName(name string) (interface{}, error) { 74 | switch name { 75 | case "GetServices": 76 | return &Device.GetServices{}, nil 77 | case "GetServiceCapabilities": 78 | return &Device.GetServiceCapabilities{}, nil 79 | case "GetDeviceInformation": 80 | return &Device.GetDeviceInformation{}, nil 81 | case "SetSystemDateAndTime": 82 | return &Device.SetSystemDateAndTime{}, nil 83 | case "GetSystemDateAndTime": 84 | return &Device.GetSystemDateAndTime{}, nil 85 | case "SetSystemFactoryDefault": 86 | return &Device.SetSystemFactoryDefault{}, nil 87 | case "UpgradeSystemFirmware": 88 | return &Device.UpgradeSystemFirmware{}, nil 89 | case "SystemReboot": 90 | return &Device.SystemReboot{}, nil 91 | case "RestoreSystem": 92 | return &Device.RestoreSystem{}, nil 93 | case "GetSystemBackup": 94 | return &Device.GetSystemBackup{}, nil 95 | case "GetSystemLog": 96 | return &Device.GetSystemLog{}, nil 97 | case "GetSystemSupportInformation": 98 | return &Device.GetSystemSupportInformation{}, nil 99 | case "GetScopes": 100 | return &Device.GetScopes{}, nil 101 | case "SetScopes": 102 | return &Device.SetScopes{}, nil 103 | case "AddScopes": 104 | return &Device.AddScopes{}, nil 105 | case "RemoveScopes": 106 | return &Device.RemoveScopes{}, nil 107 | case "GetDiscoveryMode": 108 | return &Device.GetDiscoveryMode{}, nil 109 | case "SetDiscoveryMode": 110 | return &Device.SetDiscoveryMode{}, nil 111 | case "GetRemoteDiscoveryMode": 112 | return &Device.GetRemoteDiscoveryMode{}, nil 113 | case "SetRemoteDiscoveryMode": 114 | return &Device.SetRemoteDiscoveryMode{}, nil 115 | case "GetDPAddresses": 116 | return &Device.GetDPAddresses{}, nil 117 | case "SetDPAddresses": 118 | return &Device.SetDPAddresses{}, nil 119 | case "GetEndpointReference": 120 | return &Device.GetEndpointReference{}, nil 121 | case "GetRemoteUser": 122 | return &Device.GetRemoteUser{}, nil 123 | case "SetRemoteUser": 124 | return &Device.SetRemoteUser{}, nil 125 | case "GetUsers": 126 | return &Device.GetUsers{}, nil 127 | case "CreateUsers": 128 | return &Device.CreateUsers{}, nil 129 | case "DeleteUsers": 130 | return &Device.DeleteUsers{}, nil 131 | case "SetUser": 132 | return &Device.SetUser{}, nil 133 | case "GetWsdlUrl": 134 | return &Device.GetWsdlUrl{}, nil 135 | case "GetCapabilities": 136 | return &Device.GetCapabilities{}, nil 137 | case "GetHostname": 138 | return &Device.GetHostname{}, nil 139 | case "SetHostname": 140 | return &Device.SetHostname{}, nil 141 | case "SetHostnameFromDHCP": 142 | return &Device.SetHostnameFromDHCP{}, nil 143 | case "GetDNS": 144 | return &Device.GetDNS{}, nil 145 | case "SetDNS": 146 | return &Device.SetDNS{}, nil 147 | case "GetNTP": 148 | return &Device.GetNTP{}, nil 149 | case "SetNTP": 150 | return &Device.SetNTP{}, nil 151 | case "GetDynamicDNS": 152 | return &Device.GetDynamicDNS{}, nil 153 | case "SetDynamicDNS": 154 | return &Device.SetDynamicDNS{}, nil 155 | case "GetNetworkInterfaces": 156 | return &Device.GetNetworkInterfaces{}, nil 157 | case "SetNetworkInterfaces": 158 | return &Device.SetNetworkInterfaces{}, nil 159 | case "GetNetworkProtocols": 160 | return &Device.GetNetworkProtocols{}, nil 161 | case "SetNetworkProtocols": 162 | return &Device.SetNetworkProtocols{}, nil 163 | case "GetNetworkDefaultGateway": 164 | return &Device.GetNetworkDefaultGateway{}, nil 165 | case "SetNetworkDefaultGateway": 166 | return &Device.SetNetworkDefaultGateway{}, nil 167 | case "GetZeroConfiguration": 168 | return &Device.GetZeroConfiguration{}, nil 169 | case "SetZeroConfiguration": 170 | return &Device.SetZeroConfiguration{}, nil 171 | case "GetIPAddressFilter": 172 | return &Device.GetIPAddressFilter{}, nil 173 | case "SetIPAddressFilter": 174 | return &Device.SetIPAddressFilter{}, nil 175 | case "AddIPAddressFilter": 176 | return &Device.AddIPAddressFilter{}, nil 177 | case "RemoveIPAddressFilter": 178 | return &Device.RemoveIPAddressFilter{}, nil 179 | case "GetAccessPolicy": 180 | return &Device.GetAccessPolicy{}, nil 181 | case "SetAccessPolicy": 182 | return &Device.SetAccessPolicy{}, nil 183 | case "CreateCertificate": 184 | return &Device.CreateCertificate{}, nil 185 | case "GetCertificates": 186 | return &Device.GetCertificates{}, nil 187 | case "GetCertificatesStatus": 188 | return &Device.GetCertificatesStatus{}, nil 189 | case "SetCertificatesStatus": 190 | return &Device.SetCertificatesStatus{}, nil 191 | case "DeleteCertificates": 192 | return &Device.DeleteCertificates{}, nil 193 | case "GetPkcs10Request": 194 | return &Device.GetPkcs10Request{}, nil 195 | case "LoadCertificates": 196 | return &Device.LoadCertificates{}, nil 197 | case "GetClientCertificateMode": 198 | return &Device.GetClientCertificateMode{}, nil 199 | case "SetClientCertificateMode": 200 | return &Device.SetClientCertificateMode{}, nil 201 | case "GetRelayOutputs": 202 | return &Device.GetRelayOutputs{}, nil 203 | case "SetRelayOutputSettings": 204 | return &Device.SetRelayOutputSettings{}, nil 205 | case "SetRelayOutputState": 206 | return &Device.SetRelayOutputState{}, nil 207 | case "SendAuxiliaryCommand": 208 | return &Device.SendAuxiliaryCommand{}, nil 209 | case "GetCACertificates": 210 | return &Device.GetCACertificates{}, nil 211 | case "LoadCertificateWithPrivateKey": 212 | return &Device.LoadCertificateWithPrivateKey{}, nil 213 | case "GetCertificateInformation": 214 | return &Device.GetCertificateInformation{}, nil 215 | case "LoadCACertificates": 216 | return &Device.LoadCACertificates{}, nil 217 | case "CreateDot1XConfiguration": 218 | return &Device.CreateDot1XConfiguration{}, nil 219 | case "SetDot1XConfiguration": 220 | return &Device.SetDot1XConfiguration{}, nil 221 | case "GetDot1XConfiguration": 222 | return &Device.GetDot1XConfiguration{}, nil 223 | case "GetDot1XConfigurations": 224 | return &Device.GetDot1XConfigurations{}, nil 225 | case "DeleteDot1XConfiguration": 226 | return &Device.DeleteDot1XConfiguration{}, nil 227 | case "GetDot11Capabilities": 228 | return &Device.GetDot11Capabilities{}, nil 229 | case "GetDot11Status": 230 | return &Device.GetDot11Status{}, nil 231 | case "ScanAvailableDot11Networks": 232 | return &Device.ScanAvailableDot11Networks{}, nil 233 | case "GetSystemUris": 234 | return &Device.GetSystemUris{}, nil 235 | case "StartFirmwareUpgrade": 236 | return &Device.StartFirmwareUpgrade{}, nil 237 | case "StartSystemRestore": 238 | return &Device.StartSystemRestore{}, nil 239 | case "GetStorageConfigurations": 240 | return &Device.GetStorageConfigurations{}, nil 241 | case "CreateStorageConfiguration": 242 | return &Device.CreateStorageConfiguration{}, nil 243 | case "GetStorageConfiguration": 244 | return &Device.GetStorageConfiguration{}, nil 245 | case "SetStorageConfiguration": 246 | return &Device.SetStorageConfiguration{}, nil 247 | case "DeleteStorageConfiguration": 248 | return &Device.DeleteStorageConfiguration{}, nil 249 | case "GetGeoLocation": 250 | return &Device.GetGeoLocation{}, nil 251 | case "SetGeoLocation": 252 | return &Device.SetGeoLocation{}, nil 253 | case "DeleteGeoLocation": 254 | return &Device.DeleteGeoLocation{}, nil 255 | default: 256 | return nil, errors.New("there is no such method in the Device service") 257 | } 258 | } 259 | 260 | 261 | 262 | func getMediaStructByName(name string) (interface{}, error) { 263 | switch name { 264 | case "GetServiceCapabilities": 265 | return &Media.GetServiceCapabilities{}, nil 266 | case "GetVideoSources": 267 | return &Media.GetVideoSources{}, nil 268 | case "GetAudioSources": 269 | return &Media.GetAudioSources{}, nil 270 | case "GetAudioOutputs": 271 | return &Media.GetAudioOutputs{}, nil 272 | case "CreateProfile": 273 | return &Media.CreateProfile{}, nil 274 | case "GetProfile": 275 | return &Media.GetProfile{}, nil 276 | case "GetProfiles": 277 | return &Media.GetProfiles{}, nil 278 | case "AddVideoEncoderConfiguration": 279 | return &Media.AddVideoEncoderConfiguration{}, nil 280 | case "RemoveVideoEncoderConfiguration": 281 | return &Media.RemoveVideoEncoderConfiguration{}, nil 282 | case "AddVideoSourceConfiguration": 283 | return &Media.AddVideoSourceConfiguration{}, nil 284 | case "RemoveVideoSourceConfiguration": 285 | return &Media.RemoveVideoSourceConfiguration{}, nil 286 | case "AddAudioEncoderConfiguration": 287 | return &Media.AddAudioEncoderConfiguration{}, nil 288 | case "RemoveAudioEncoderConfiguration": 289 | return &Media.RemoveAudioEncoderConfiguration{}, nil 290 | case "AddAudioSourceConfiguration": 291 | return &Media.AddAudioSourceConfiguration{}, nil 292 | case "RemoveAudioSourceConfiguration": 293 | return &Media.RemoveAudioSourceConfiguration{}, nil 294 | case "AddPTZConfiguration": 295 | return &Media.AddPTZConfiguration{}, nil 296 | case "RemovePTZConfiguration": 297 | return &Media.RemovePTZConfiguration{}, nil 298 | case "AddVideoAnalyticsConfiguration": 299 | return &Media.AddVideoAnalyticsConfiguration{}, nil 300 | case "RemoveVideoAnalyticsConfiguration": 301 | return &Media.RemoveVideoAnalyticsConfiguration{}, nil 302 | case "AddMetadataConfiguration": 303 | return &Media.AddMetadataConfiguration{}, nil 304 | case "RemoveMetadataConfiguration": 305 | return &Media.RemoveMetadataConfiguration{}, nil 306 | case "AddAudioOutputConfiguration": 307 | return &Media.AddAudioOutputConfiguration{}, nil 308 | case "RemoveAudioOutputConfiguration": 309 | return &Media.RemoveAudioOutputConfiguration{}, nil 310 | case "AddAudioDecoderConfiguration": 311 | return &Media.AddAudioDecoderConfiguration{}, nil 312 | case "RemoveAudioDecoderConfiguration": 313 | return &Media.RemoveAudioDecoderConfiguration{}, nil 314 | case "DeleteProfile": 315 | return &Media.DeleteProfile{}, nil 316 | case "GetVideoSourceConfigurations": 317 | return &Media.GetVideoSourceConfigurations{}, nil 318 | case "GetVideoEncoderConfigurations": 319 | return &Media.GetVideoEncoderConfigurations{}, nil 320 | case "GetAudioSourceConfigurations": 321 | return &Media.GetAudioSourceConfigurations{}, nil 322 | case "GetAudioEncoderConfigurations": 323 | return &Media.GetAudioEncoderConfigurations{}, nil 324 | case "GetVideoAnalyticsConfigurations": 325 | return &Media.GetVideoAnalyticsConfigurations{}, nil 326 | case "GetMetadataConfigurations": 327 | return &Media.GetMetadataConfigurations{}, nil 328 | case "GetAudioOutputConfigurations": 329 | return &Media.GetAudioOutputConfigurations{}, nil 330 | case "GetAudioDecoderConfigurations": 331 | return &Media.GetAudioDecoderConfigurations{}, nil 332 | case "GetVideoSourceConfiguration": 333 | return &Media.GetVideoSourceConfiguration{}, nil 334 | case "GetVideoEncoderConfiguration": 335 | return &Media.GetVideoEncoderConfiguration{}, nil 336 | case "GetAudioSourceConfiguration": 337 | return &Media.GetAudioSourceConfiguration{}, nil 338 | case "GetAudioEncoderConfiguration": 339 | return &Media.GetAudioEncoderConfiguration{}, nil 340 | case "GetVideoAnalyticsConfiguration": 341 | return &Media.GetVideoAnalyticsConfiguration{}, nil 342 | case "GetMetadataConfiguration": 343 | return &Media.GetMetadataConfiguration{}, nil 344 | case "GetAudioOutputConfiguration": 345 | return &Media.GetAudioOutputConfiguration{},nil 346 | case "GetAudioDecoderConfiguration": 347 | return &Media.GetAudioDecoderConfiguration{}, nil 348 | case "GetCompatibleVideoEncoderConfigurations": 349 | return &Media.GetCompatibleVideoEncoderConfigurations{}, nil 350 | case "GetCompatibleVideoSourceConfigurations": 351 | return &Media.GetCompatibleVideoSourceConfigurations{}, nil 352 | case "GetCompatibleAudioEncoderConfigurations": 353 | return &Media.GetCompatibleAudioEncoderConfigurations{}, nil 354 | case "GetCompatibleAudioSourceConfigurations": 355 | return &Media.GetCompatibleAudioSourceConfigurations{}, nil 356 | case "GetCompatibleVideoAnalyticsConfigurations": 357 | return &Media.GetCompatibleVideoAnalyticsConfigurations{}, nil 358 | case "GetCompatibleMetadataConfigurations": 359 | return &Media.GetCompatibleMetadataConfigurations{}, nil 360 | case "GetCompatibleAudioOutputConfigurations": 361 | return &Media.GetCompatibleAudioOutputConfigurations{}, nil 362 | case "GetCompatibleAudioDecoderConfigurations": 363 | return &Media.GetCompatibleAudioDecoderConfigurations{}, nil 364 | case "SetVideoSourceConfiguration": 365 | return &Media.SetVideoSourceConfiguration{}, nil 366 | case "SetVideoEncoderConfiguration": 367 | return &Media.SetVideoEncoderConfiguration{}, nil 368 | case "SetAudioSourceConfiguration": 369 | return &Media.SetAudioSourceConfiguration{}, nil 370 | case "SetAudioEncoderConfiguration": 371 | return &Media.SetAudioEncoderConfiguration{}, nil 372 | case "SetVideoAnalyticsConfiguration": 373 | return &Media.SetVideoAnalyticsConfiguration{}, nil 374 | case "SetMetadataConfiguration": 375 | return &Media.SetMetadataConfiguration{}, nil 376 | case "SetAudioOutputConfiguration": 377 | return &Media.SetAudioOutputConfiguration{}, nil 378 | case "SetAudioDecoderConfiguration": 379 | return &Media.SetAudioDecoderConfiguration{}, nil 380 | case "GetVideoSourceConfigurationOptions": 381 | return &Media.GetVideoSourceConfigurationOptions{}, nil 382 | case "GetVideoEncoderConfigurationOptions": 383 | return &Media.GetVideoEncoderConfigurationOptions{}, nil 384 | case "GetAudioSourceConfigurationOptions": 385 | return &Media.GetAudioSourceConfigurationOptions{}, nil 386 | case "GetAudioEncoderConfigurationOptions": 387 | return &Media.GetAudioEncoderConfigurationOptions{}, nil 388 | case "GetMetadataConfigurationOptions": 389 | return &Media.GetMetadataConfigurationOptions{}, nil 390 | case "GetAudioOutputConfigurationOptions": 391 | return &Media.GetAudioOutputConfigurationOptions{}, nil 392 | case "GetAudioDecoderConfigurationOptions": 393 | return &Media.GetAudioDecoderConfigurationOptions{}, nil 394 | case "GetGuaranteedNumberOfVideoEncoderInstances": 395 | return &Media.GetGuaranteedNumberOfVideoEncoderInstances{}, nil 396 | case "GetStreamUri": 397 | return &Media.GetStreamUri{}, nil 398 | case "StartMulticastStreaming": 399 | return &Media.StartMulticastStreaming{}, nil 400 | case "StopMulticastStreaming": 401 | return &Media.StopMulticastStreaming{}, nil 402 | case "SetSynchronizationPoint": 403 | return &Media.SetSynchronizationPoint{}, nil 404 | case "GetSnapshotUri": 405 | return &Media.GetSnapshotUri{}, nil 406 | case "GetVideoSourceModes": 407 | return &Media.GetVideoSourceModes{}, nil 408 | case "SetVideoSourceMode": 409 | return &Media.SetVideoSourceMode{}, nil 410 | case "GetOSDs": 411 | return &Media.GetOSDs{}, nil 412 | case "GetOSD": 413 | return &Media.GetOSD{}, nil 414 | case "GetOSDOptions": 415 | return &Media.GetOSDOptions{}, nil 416 | case "SetOSD": 417 | return &Media.SetOSD{}, nil 418 | case "CreateOSD": 419 | return &Media.CreateOSD{}, nil 420 | case "DeleteOSD": 421 | return &Media.DeleteOSD{}, nil 422 | default: 423 | return nil, errors.New("there is no such method in the Media service") 424 | } 425 | 426 | } -------------------------------------------------------------------------------- /doc.go: -------------------------------------------------------------------------------- 1 | //package goonvif is developed to provide an ONVIF client implementation on Go programming language 2 | package goonvif 3 | -------------------------------------------------------------------------------- /examples/DeviceService.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/yakovlevdmv/goonvif" 5 | "net/http" 6 | "io/ioutil" 7 | "github.com/yakovlevdmv/goonvif/Device" 8 | "github.com/yakovlevdmv/goonvif/xsd/onvif" 9 | "fmt" 10 | "log" 11 | "github.com/yakovlevdmv/gosoap" 12 | ) 13 | 14 | const ( 15 | login = "admin" 16 | password = "Supervisor" 17 | ) 18 | 19 | func readResponse(resp *http.Response) string { 20 | b, err := ioutil.ReadAll(resp.Body) 21 | if err != nil { 22 | panic(err) 23 | } 24 | return string(b) 25 | } 26 | 27 | func main() { 28 | //Getting an camera instance 29 | dev, err := goonvif.NewDevice("192.168.13.14:80") 30 | if err != nil { 31 | panic(err) 32 | } 33 | //Authorization 34 | dev.Authenticate(login, password) 35 | 36 | //Preparing commands 37 | systemDateAndTyme := Device.GetSystemDateAndTime{} 38 | getCapabilities := Device.GetCapabilities{Category:"All"} 39 | createUser := Device.CreateUsers{User: 40 | onvif.User{ 41 | Username: "TestUser", 42 | Password: "TestPassword", 43 | UserLevel: "User", 44 | }, 45 | } 46 | 47 | //Commands execution 48 | systemDateAndTymeResponse, err := dev.CallMethod(systemDateAndTyme) 49 | if err != nil { 50 | log.Println(err) 51 | } else { 52 | fmt.Println(readResponse(systemDateAndTymeResponse)) 53 | } 54 | getCapabilitiesResponse, err := dev.CallMethod(getCapabilities) 55 | if err != nil { 56 | log.Println(err) 57 | } else { 58 | fmt.Println(readResponse(getCapabilitiesResponse)) 59 | } 60 | createUserResponse, err := dev.CallMethod(createUser) 61 | if err != nil { 62 | log.Println(err) 63 | } else { 64 | /* 65 | You could use https://github.com/yakovlevdmv/gosoap for pretty printing response 66 | */ 67 | fmt.Println(gosoap.SoapMessage(readResponse(createUserResponse)).StringIndent()) 68 | } 69 | 70 | 71 | 72 | } 73 | -------------------------------------------------------------------------------- /img/GetServiceCapabilities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yakovlevdmv/goonvif/8181eb3ef2fb34d0b887168faeb0e26e7eec9e5d/img/GetServiceCapabilities.png -------------------------------------------------------------------------------- /img/exmp_ContinuousMove.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yakovlevdmv/goonvif/8181eb3ef2fb34d0b887168faeb0e26e7eec9e5d/img/exmp_ContinuousMove.png -------------------------------------------------------------------------------- /img/exmp_CreateUsers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yakovlevdmv/goonvif/8181eb3ef2fb34d0b887168faeb0e26e7eec9e5d/img/exmp_CreateUsers.png -------------------------------------------------------------------------------- /img/exmp_GetCapabilities.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yakovlevdmv/goonvif/8181eb3ef2fb34d0b887168faeb0e26e7eec9e5d/img/exmp_GetCapabilities.png -------------------------------------------------------------------------------- /img/exmp_GetProfiles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yakovlevdmv/goonvif/8181eb3ef2fb34d0b887168faeb0e26e7eec9e5d/img/exmp_GetProfiles.png -------------------------------------------------------------------------------- /networking/networking.go: -------------------------------------------------------------------------------- 1 | package networking 2 | 3 | import ( 4 | "net/http" 5 | "bytes" 6 | ) 7 | 8 | func SendSoap(endpoint, message string) (*http.Response, error) { 9 | httpClient := new(http.Client) 10 | 11 | resp, err := httpClient.Post(endpoint, "application/soap+xml; charset=utf-8", bytes.NewBufferString(message)) 12 | if err != nil { 13 | return resp, err 14 | } 15 | 16 | return resp,nil 17 | } -------------------------------------------------------------------------------- /wsdl/display.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | The capabilities for the display service is returned in the Capabilities element. 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | Indication that the SetLayout command supports only predefined layouts. 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | Token of the Video Output whose Layout is requested 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Current layout of the video output. 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | Token of the Video Output whose Layout shall be changed. 74 | 75 | 76 | 77 | 78 | Layout to be set 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | Token of the Video Output whose options are requested 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | The LayoutOptions describe the fixed and predefined layouts of a device. If the device does 113 | not offer fixed layouts and allows setting the layout free this element is empty. 114 | 115 | 116 | 117 | 118 | decoding and encoding capabilities of the device 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | Reference Token of the Video Output whose Pane Configurations are requested 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | Contains a list of defined Panes of the specified VideoOutput. Each VideoOutput has at least one PaneConfiguration. 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Reference Token of the Video Output the requested pane belongs to 157 | 158 | 159 | 160 | 161 | Reference Token of the Pane whose Configuration is requested 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | returns the configuration of the requested pane. 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | Token of the video output whose panes to set. 188 | 189 | 190 | 191 | 192 | Pane Configuration to be set. 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | Token of the video output whose panes to set. 213 | 214 | 215 | 216 | 217 | Pane Configuration to be set. 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | Token of the video output where the pane shall be created. 239 | 240 | 241 | 242 | 243 | Configuration of the pane to be created. 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | Token of the new pane configuration. 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | Token of the video output where the pane shall be deleted. 270 | 271 | 272 | 273 | 274 | Token of the pane to be deleted. 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 | Returns the capabilities of the display service. The result is returned in a typed answer. 354 | 355 | 356 | 357 | 358 | Return the current layout of a video output. The Layout assigns a pane configuration to a certain area of the display. The layout settings 359 | directly affect a specific video output. The layout consists of a list of PaneConfigurations and 360 | their associated display areas. 361 | 362 | 363 | 364 | 365 | Change the layout of a display (e.g. change from 366 | single view to split screen view).The Layout assigns a pane configuration to a certain area of the display. The layout settings 367 | directly affect a specific video output. The layout consists of a list of PaneConfigurations and 368 | their associated display areas.
369 | A device implementation shall be tolerant against rounding errors when matching a layout against its fixed set of layouts by accepting differences of at least one percent. 370 |
371 | 372 | 373 |
374 | 375 | The Display Options contain the supported layouts (LayoutOptions) and the decoding and 376 | encoding capabilities (CodingCapabilities) of the device. The GetDisplayOptions command 377 | returns both, Layout and Coding Capabilities, of a VideoOutput. 378 | 379 | 380 | 381 | 382 | List all currently defined panes of a device for a specified video output 383 | (regardless if this pane is visible at a moment). A Pane is a display area on the monitor that is attached to a video output. A pane has a 384 | PaneConfiguration that describes which entities are associated with the pane. A client has to configure the pane according to the connection to be established by setting the 385 | AudioOutput and/or AudioSourceToken. If a Token is not set, the corresponding session will 386 | not be established. 387 | 388 | 389 | 390 | 391 | Retrieve the pane configuration for a pane token. 392 | 393 | 394 | 395 | 396 | Modify one or more configurations of the specified video output. 397 | This method will only modify the provided configurations and leave the others unchanged. 398 | Use DeletePaneConfiguration to remove pane configurations. 399 | 400 | 401 | 402 | 403 | This command changes the configuration of the specified pane (tbd) 404 | 405 | 406 | 407 | 408 | Create a new pane configuration describing the streaming and coding settings for a display area.
409 | This optional method is only supported by devices that signal support of dynamic pane creation via their capabilities.
410 | The content of the Token field may be ignored by the device. 411 |
412 | 413 | 414 |
415 | 416 | Delete a pane configuration. A service must respond with an error if the pane configuration 417 | is in use by the current layout.
418 | This optional method is only supported by devices that signal support of dynamic pane creation via their capabilities. 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 | -------------------------------------------------------------------------------- /wsdl/imaging.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | The capabilities for the imaging service is returned in the Capabilities element. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Indicates whether or not Image Stabilization feature is supported. 41 | 42 | 43 | 44 | 45 | Indicates whether or not Imaging Presets feature is supported. 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | Reference token to the VideoSource for which the ImagingSettings. 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | ImagingSettings for the VideoSource that was requested. 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 | Reference token to the VideoSource for which the imaging parameter options are requested. 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | Valid ranges for the imaging parameters that are categorized as device specific. 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | Reference to the VideoSource for the requested move (focus) operation. 126 | 127 | 128 | 129 | 130 | 131 | 132 | Content of the requested move (focus) operation. 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | Reference token to the VideoSource for the requested move options. 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | Valid ranges for the focus lens move options. 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | Reference token to the VideoSource where the focus movement should be stopped. 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | Reference token to the VideoSource where the imaging status should be requested. 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | Requested imaging status. 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | Describes standard Imaging Preset types, used to facilitate Multi-language support and client display. 222 | "Custom" Type shall be used when Imaging Preset Name does not match any of the types included in the standard classification. 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 | Type describing the Imaging Preset settings. 255 | 256 | 257 | 258 | 259 | Human readable name of the Imaging Preset. 260 | 261 | 262 | 263 | 264 | 265 | Unique identifier of this Imaging Preset. 266 | 267 | 268 | 269 | 270 | Indicates Imaging Preset Type. Use timg:ImagingPresetType. 271 | Used for multi-language support and display. 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | A reference to the VideoSource where the operation should take place. 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | List of Imaging Presets which are available for the requested VideoSource. 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | Reference token to the VideoSource where the current Imaging Preset should be requested. 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | Current Imaging Preset in use for the specified Video Source. 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | Reference token to the VideoSource to which the specified Imaging Preset should be applied. 334 | 335 | 336 | 337 | 338 | 339 | Reference token to the Imaging Preset to be applied to the specified Video Source. 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 | Returns the capabilities of the imaging service. The result is returned in a typed answer. 422 | 423 | 424 | 425 | 426 | Get the ImagingConfiguration for the requested VideoSource. 427 | 428 | 429 | 430 | 431 | Set the ImagingConfiguration for the requested VideoSource. 432 | 433 | 434 | 435 | 436 | This operation gets the valid ranges for the imaging parameters that have device specific ranges. 437 | This command is mandatory for all device implementing the imaging service. The command returns all supported parameters and their ranges 438 | such that these can be applied to the SetImagingSettings command.
439 | For read-only parameters which cannot be modified via the SetImagingSettings command only a single option or identical Min and Max values 440 | is provided.
441 | 442 | 443 |
444 | 445 | The Move command moves the focus lens in an absolute, a relative or in a continuous manner from its current position. 446 | The speed argument is optional for absolute and relative control, but required for continuous. If no speed argument is used, the default speed is used. 447 | Focus adjustments through this operation will turn off the autofocus. A device with support for remote focus control should support absolute, 448 | relative or continuous control through the Move operation. The supported MoveOpions are signalled via the GetMoveOptions command. 449 | At least one focus control capability is required for this operation to be functional.
450 | The move operation contains the following commands:
451 | Absolute – Requires position parameter and optionally takes a speed argument. A unitless type is used by default for focus positioning and speed. Optionally, if supported, the position may be requested in m-1 units.
452 | Relative – Requires distance parameter and optionally takes a speed argument. Negative distance means negative direction. 453 | Continuous – Requires a speed argument. Negative speed argument means negative direction. 454 |
455 | 456 | 457 |
458 | 459 | Imaging move operation options supported for the Video source. 460 | 461 | 462 | 463 | 464 | The Stop command stops all ongoing focus movements of the lense. A device with support for remote focus control as signalled via 465 | the GetMoveOptions supports this command.
The operation will not affect ongoing autofocus operation.
466 | 467 | 468 |
469 | 470 | Via this command the current status of the Move operation can be requested. Supported for this command is available if the support for the Move operation is signalled via GetMoveOptions. 471 | 472 | 473 | 474 | 475 | Via this command the list of available Imaging Presets can be requested. 476 | 477 | 478 | 479 | 480 | Via this command the last Imaging Preset applied can be requested. 481 | If the camera configuration does not match any of the existing Imaging Presets, the output of GetCurrentPreset shall be Empty. 482 | GetCurrentPreset shall return 0 if Imaging Presets are not supported by the Video Source. 483 | 484 | 485 | 486 | 487 | The SetCurrentPreset command shall request a given Imaging Preset to be applied to the specified Video Source. 488 | SetCurrentPreset shall only be available for Video Sources with Imaging Presets Capability. 489 | Imaging Presets are defined by the Manufacturer, and offered as a tool to simplify Imaging Settings adjustments for specific scene content. 490 | When the new Imaging Preset is applied by SetCurrentPreset, the Device shall adjust the Video Source settings to match those defined by the specified Imaging Preset. 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 | -------------------------------------------------------------------------------- /wsdl/provisioning.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | The direction for PanMove to move the device. 21 | 22 | 23 | 24 | 25 | Move left in relation to the video source image. 26 | 27 | 28 | 29 | 30 | Move right in relation to the video source image. 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | The direction for TiltMove to move the device. 39 | 40 | 41 | 42 | 43 | Move up in relation to the video source image. 44 | 45 | 46 | 47 | 48 | Move down in relation to the video source image. 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | The direction for ZoomMove to change the focal length in relation to the video source. 57 | 58 | 59 | 60 | 61 | Move video source lens toward a wider field of view. 62 | 63 | 64 | 65 | 66 | Move video source lens toward a narrower field of view. 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | The direction for RollMove to move the device. 75 | 76 | 77 | 78 | 79 | Move clockwise in relation to the video source image. 80 | 81 | 82 | 83 | 84 | Move counterclockwise in relation to the video source image. 85 | 86 | 87 | 88 | 89 | Automatically level the device in relation to the video source image. 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | The direction for FocusMove to move the focal plane in relation to the video source. 98 | 99 | 100 | 101 | 102 | Move to focus on close objects. 103 | 104 | 105 | 106 | 107 | Move to focus on distant objects. 108 | 109 | 110 | 111 | 112 | Automatically focus for the sharpest video source image. 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | The quantity of movement events that have occured over the lifetime of the device. 121 | 122 | 123 | 124 | 125 | The quantity of pan movement events over the life of the device. 126 | 127 | 128 | 129 | 130 | The quantity of tilt movement events over the life of the device. 131 | 132 | 133 | 134 | 135 | The quantity of zoom movement events over the life of the device. 136 | 137 | 138 | 139 | 140 | The quantity of roll movement events over the life of the device. 141 | 142 | 143 | 144 | 145 | The quantity of focus movement events over the life of the device. 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | The provisioning capabilities of a video source on the device. 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | Unique identifier of a video source. 165 | 166 | 167 | 168 | 169 | Lifetime limit of pan moves for this video source. Presence of this attribute indicates support of pan move. 170 | 171 | 172 | 173 | 174 | Lifetime limit of tilt moves for this video source. Presence of this attribute indicates support of tilt move. 175 | 176 | 177 | 178 | 179 | Lifetime limit of zoom moves for this video source. Presence of this attribute indicates support of zoom move. 180 | 181 | 182 | 183 | 184 | Lifetime limit of roll moves for this video source. Presence of this attribute indicates support of roll move. 185 | 186 | 187 | 188 | 189 | Indicates "auto" as a valid enum for Direction in RollMove. 190 | 191 | 192 | 193 | 194 | Lifetime limit of focus moves for this video source. Presence of this attribute indicates support of focus move. 195 | 196 | 197 | 198 | 199 | Indicates "auto" as a valid enum for Direction in FocusMove. 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | The capabilities of Provisioning Service on the device. 208 | 209 | 210 | 211 | 212 | Maximum time before stopping movement after a move operation. 213 | 214 | 215 | 216 | 217 | Capabilities per video source. 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | The capabilities for the provisioning service on this device. 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | The video source associated with the provisioning. 251 | 252 | 253 | 254 | 255 | "left" or "right". 256 | 257 | 258 | 259 | 260 | "Operation timeout, if less than default timeout. 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | The video source associated with the provisioning. 278 | 279 | 280 | 281 | 282 | "up" or "down". 283 | 284 | 285 | 286 | 287 | "Operation timeout, if less than default timeout. 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | The video source associated with the provisioning. 305 | 306 | 307 | 308 | 309 | "wide" or "telephoto". 310 | 311 | 312 | 313 | 314 | "Operation timeout, if less than default timeout. 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | The video source associated with the provisioning. 332 | 333 | 334 | 335 | 336 | "clockwise", "counterclockwise", or "auto". 337 | 338 | 339 | 340 | 341 | "Operation timeout, if less than default timeout. 342 | 343 | 344 | 345 | 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | The video source associated with the provisioning. 359 | 360 | 361 | 362 | 363 | "near", "far", or "auto". 364 | 365 | 366 | 367 | 368 | "Operation timeout, if less than default timeout. 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 380 | 381 | 382 | 383 | 384 | 385 | The video source associated with the provisioning. 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 402 | The video source associated with the provisioning. 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | The set of lifetime usage values for the provisioning associated with the video source. 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 | Functionality for all provisioning service operations. 471 | 472 | Returns the capabilities of the provisioning service. 473 | 474 | 475 | 476 | 477 | Moves device on the pan axis. 478 | 479 | 480 | 481 | 482 | Moves device on the tilt axis. 483 | 484 | 485 | 486 | 487 | Moves device on the zoom axis. 488 | 489 | 490 | 491 | 492 | Moves device on the roll axis. 493 | 494 | 495 | 496 | 497 | Moves device on the focus axis. 498 | 499 | 500 | 501 | 502 | Stops device motion on all axes. 503 | 504 | 505 | 506 | 507 | Returns the lifetime move counts. 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 | -------------------------------------------------------------------------------- /wsdl/receiver.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | The capabilities for the receiver service is returned in the Capabilities element. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Indicates that the device can receive RTP multicast streams. 41 | 42 | 43 | 44 | 45 | Indicates that the device can receive RTP/TCP streams 46 | 47 | 48 | 49 | 50 | Indicates that the device can receive RTP/RTSP/TCP streams. 51 | 52 | 53 | 54 | 55 | The maximum number of receivers supported by the device. 56 | 57 | 58 | 59 | 60 | The maximum allowed length for RTSP URIs (Minimum and default value is 128 octet). 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | A list of all receivers that currently exist on the device. 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | The token of the receiver to be retrieved. 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | The details of the receiver. 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | The initial configuration for the new receiver. 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | The details of the receiver that was created. 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | The token of the receiver to be deleted. 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | The token of the receiver to be configured. 151 | 152 | 153 | 154 | 155 | The new configuration for the receiver. 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | The token of the receiver to be changed. 173 | 174 | 175 | 176 | 177 | The new receiver mode. Options available are: 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | The token of the receiver to be queried. 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | Description of the current receiver state. 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 | Returns the capabilities of the receiver service. The result is returned in a typed answer. 264 | 265 | 266 | 267 | 268 | 269 | Lists all receivers currently present on a device. This operation is mandatory. 270 | 271 | 272 | 273 | 274 | 275 | 276 | Retrieves the details of a specific receiver. This operation is mandatory. 277 | 278 | 279 | 280 | 281 | 282 | 283 | Creates a new receiver. This operation is mandatory, although the service may 284 | raise a fault if the receiver cannot be created. 285 | 286 | 287 | 288 | 289 | 290 | 291 | Deletes an existing receiver. A receiver may be deleted only if it is not 292 | currently in use; otherwise a fault shall be raised. 293 | This operation is mandatory. 294 | 295 | 296 | 297 | 298 | 299 | 300 | Configures an existing receiver. This operation is mandatory. 301 | 302 | 303 | 304 | 305 | 306 | 307 | Sets the mode of the receiver without affecting the rest of its configuration. 308 | This operation is mandatory. 309 | 310 | 311 | 312 | 313 | 314 | 315 | Determines whether the receiver is currently disconnected, connected or 316 | attempting to connect. 317 | This operation is mandatory. 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 | -------------------------------------------------------------------------------- /wsdl/replay.wsdl: -------------------------------------------------------------------------------- 1 | 2 | 3 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | The capabilities for the replay service is returned in the Capabilities element. 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | Indicator that the Device supports reverse playback as defined in the ONVIF Streaming Specification. 41 | 42 | 43 | 44 | 45 | The list contains two elements defining the minimum and maximum valid values supported as session timeout in seconds. 46 | 47 | 48 | 49 | 50 | Indicates support for RTP/RTSP/TCP. 51 | 52 | 53 | 54 | 55 | If playback streaming over websocket supported, websocket URI is provided. The scheme and IP part shall match the one used in the request (e.g. the GetServices request). 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | Specifies the connection parameters to be used for the stream. The URI that is returned may depend on these parameters. 68 | 69 | 70 | 71 | 72 | The identifier of the recording to be streamed. 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | The URI to which the client should connect in order to stream the recording. 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | Description of the new replay configuration parameters. 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | The current replay configuration parameters. 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 | Returns the capabilities of the replay service. The result is returned in a typed answer. 152 | 153 | 154 | 155 | 156 | 157 | Requests a URI that can be used to initiate playback of a recorded stream 158 | using RTSP as the control protocol. The URI is valid only as it is 159 | specified in the response. 160 | This operation is mandatory. 161 | 162 | 163 | 164 | 165 | 166 | 167 | Returns the current configuration of the replay service. 168 | This operation is mandatory. 169 | 170 | 171 | 172 | 173 | 174 | 175 | Changes the current configuration of the replay service. 176 | This operation is mandatory. 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 | -------------------------------------------------------------------------------- /xsd/built_in.go: -------------------------------------------------------------------------------- 1 | package xsd 2 | 3 | import ( 4 | "time" 5 | iso8601 "github.com/yakovlevdmv/Golang-iso8601-duration" 6 | "log" 7 | "fmt" 8 | "encoding/hex" 9 | "encoding/base64" 10 | "net/url" 11 | "strings" 12 | "regexp" 13 | "errors" 14 | ) 15 | 16 | /* 17 | TODO: XML SOURCE: https://www.w3.org/2001/05/datatypes.xsd 18 | */ 19 | 20 | type AnyType string; 21 | 22 | type AnySimpleType string 23 | 24 | /*********************************************************** 25 | Non-derived types 26 | ***********************************************************/ 27 | 28 | 29 | /* 30 | The string datatype represents character strings in XML. 31 | The ·value space· of string is the set of finite-length sequences of characters. 32 | String has the following constraining facets: 33 | • length 34 | • minLength 35 | • maxLength 36 | • pattern 37 | • enumeration 38 | • whiteSpace 39 | 40 | More info: https://www.w3.org/TR/xmlschema-2/#string 41 | 42 | //TODO: valid/invalid character declaration and process restrictions 43 | */ 44 | type String string 45 | 46 | /* 47 | Construct an instance of xsd String type 48 | */ 49 | func (tp String) NewString(data string) String { 50 | return String(data) 51 | } 52 | 53 | /* 54 | Boolean has the ·value space· required to support the mathematical concept of binary-valued logic: {true, false}. 55 | Boolean has the following ·constraining facets·: 56 | • pattern 57 | • whiteSpace 58 | 59 | More info: https://www.w3.org/TR/xmlschema-2/#boolean 60 | 61 | //TODO: process restrictions 62 | */ 63 | type Boolean bool 64 | 65 | /* 66 | Construct an instance of xsd Boolean type 67 | */ 68 | func (tp Boolean) NewBool(data bool) Boolean { 69 | return Boolean(data) 70 | } 71 | 72 | /* 73 | Float is patterned after the IEEE single-precision 32-bit floating point type 74 | Float has the following ·constraining facets·: 75 | • pattern 76 | • enumeration 77 | • whiteSpace 78 | • maxInclusive 79 | • maxExclusive 80 | • minInclusive 81 | • minExclusive 82 | 83 | More info: https://www.w3.org/TR/xmlschema-2/#float 84 | 85 | //TODO: process restrictions 86 | */ 87 | type Float float32 88 | 89 | /* 90 | Construct an instance of xsd Float type 91 | */ 92 | func (tp Float) NewFloat(data float32) Float { 93 | return Float(data) 94 | } 95 | 96 | /* 97 | The double datatype is patterned after the IEEE double-precision 64-bit floating point type 98 | Double has the following ·constraining facets·: 99 | • pattern 100 | • enumeration 101 | • whiteSpace 102 | • maxInclusive 103 | • maxExclusive 104 | • minInclusive 105 | • minExclusive 106 | 107 | More info: https://www.w3.org/TR/xmlschema-2/#double 108 | 109 | //TODO: process restrictions 110 | */ 111 | type Double float64 112 | 113 | /* 114 | Construct an instance of xsd Double type 115 | */ 116 | func (tp Double) NewDouble(data float64) Double { 117 | return Double(data) 118 | } 119 | 120 | /* 121 | The type decimal represents a decimal number of arbitrary precision. 122 | Schema processors vary in the number of significant digits they support, 123 | but a conforming processor must support a minimum of 18 significant digits. 124 | The format of xsd:decimal is a sequence of digits optionally preceded by a sign ("+" or "-") 125 | and optionally containing a period. The value may start or end with a period. 126 | If the fractional part is 0 then the period and trailing zeros may be omitted. 127 | Leading and trailing zeros are permitted, but they are not considered significant. 128 | That is, the decimal values 3.0 and 3.0000 are considered equal. 129 | 130 | Source: http://www.datypic.com/sc/xsd/t-xsd_decimal.html 131 | 132 | Decimal has the following ·constraining facets·: 133 | • totalDigits 134 | • fractionDigits 135 | • pattern 136 | • whiteSpace 137 | • enumeration 138 | • maxInclusive 139 | • maxExclusive 140 | • minInclusive 141 | • minExclusive 142 | 143 | More info: https://www.w3.org/TR/xmlschema-2/#decimal 144 | 145 | //TODO: process restrictions, valid/invalid characters(commas are not permitted; the decimal separator must be a period) 146 | 147 | */ 148 | type Decimal string 149 | 150 | /* 151 | Construct an instance of xsd Decimal type 152 | */ 153 | func (tp Decimal) NewDecimal(data string) Decimal { 154 | return Decimal(data) 155 | } 156 | 157 | /* 158 | Duration is the [ISO 8601] extended format PnYn MnDTnH nMnS, 159 | where nY represents the number of years, nM the number of months, 160 | nD the number of days, 'T' is the date/time separator, 161 | nH the number of hours, nM the number of minutes and nS the number of seconds. 162 | The number of seconds can include decimal digits to arbitrary precision. 163 | PnYnMnDTnHnMnS 164 | 165 | Duration has the following ·constraining facets·: 166 | 167 | • pattern 168 | • enumeration 169 | • whiteSpace 170 | • maxInclusive 171 | • maxExclusive 172 | • minInclusive 173 | • minExclusive 174 | 175 | More info: https://www.w3.org/TR/xmlschema-2/#duration 176 | 177 | TODO: process restrictions 178 | TODO: Look at time.Duration go type 179 | */ 180 | 181 | type Duration AnySimpleType 182 | 183 | /* 184 | Construct an instance of xsd duration type 185 | */ 186 | func (tp Duration) NewDateTime(years, months, days, hours, minutes, seconds string) Duration { 187 | i, err := iso8601.NewDuration( 188 | years, 189 | months, 190 | days, 191 | hours, 192 | minutes, 193 | seconds, 194 | ) 195 | 196 | if err != nil { 197 | log.Fatalln(err) 198 | } 199 | 200 | //fmt.Println(i.ISO8601Duration()) 201 | 202 | return Duration(i.ISO8601Duration()) 203 | } 204 | /* 205 | DateTime values may be viewed as objects with integer-valued year, month, day, hour 206 | and minute properties, a decimal-valued second property, and a boolean timezoned property. 207 | 208 | 209 | The ·lexical space· of dateTime consists of finite-length sequences of characters of the form: 210 | '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)?, 211 | 212 | 213 | DateTime has the following ·constraining facets·: 214 | 215 | • pattern 216 | • enumeration 217 | • whiteSpace 218 | • maxInclusive 219 | • maxExclusive 220 | • minInclusive 221 | • minExclusive 222 | 223 | More info: https://www.w3.org/TR/xmlschema-2/#dateTime 224 | 225 | TODO: decide good type for time with proper format 226 | TODO: process restrictions 227 | */ 228 | type DateTime AnySimpleType 229 | 230 | /* 231 | Construct an instance of xsd dateTime type 232 | */ 233 | func (tp DateTime) NewDateTime(time time.Time) DateTime { 234 | return DateTime(time.Format("2002-10-10T12:00:00-05:00")) 235 | } 236 | 237 | /* 238 | Time represents an instant of time that recurs every day. 239 | The ·value space· of time is the space of time of day values 240 | as defined in § 5.3 of [ISO 8601]. Specifically, it is a set 241 | of zero-duration daily time instances. 242 | 243 | Time has the following ·constraining facets·: 244 | 245 | • pattern 246 | • enumeration 247 | • whiteSpace 248 | • maxInclusive 249 | • maxExclusive 250 | • minInclusive 251 | • minExclusive 252 | 253 | More info: https://www.w3.org/TR/xmlschema-2/#time 254 | 255 | TODO: process restrictions 256 | */ 257 | type Time AnySimpleType 258 | 259 | /* 260 | Construct an instance of xsd time type 261 | */ 262 | func (tp DateTime) NewTime(time time.Time) DateTime { 263 | return DateTime(time.Format("15:04:05")) 264 | } 265 | 266 | /* 267 | The ·value space· of date consists of top-open intervals of 268 | exactly one day in length on the timelines of dateTime, beginning 269 | on the beginning moment of each day (in each timezone), 270 | i.e. '00:00:00', up to but not including '24:00:00' 271 | (which is identical with '00:00:00' of the next day). 272 | For nontimezoned values, the top-open intervals disjointly 273 | cover the nontimezoned timeline, one per day. For timezoned 274 | values, the intervals begin at every minute and therefore overlap. 275 | */ 276 | type Date AnySimpleType 277 | 278 | /* 279 | Construct an instance of xsd date type 280 | */ 281 | func (tp Date) NewDate(time time.Time) Date { 282 | return Date(time.Format("2004-04-12-05:00")) 283 | } 284 | 285 | /* 286 | The type xsd:gYearMonth represents a specific month of a specific 287 | year. The letter g signifies "Gregorian." The format of 288 | xsd:gYearMonth is CCYY-MM. No left truncation is allowed on 289 | either part. To represents years later than 9999, additional 290 | digits can be added to the left of the year value. 291 | To represent years before 0001, a preceding minus sign ("-") 292 | is permitted. 293 | 294 | Source: http://www.datypic.com/sc/xsd/t-xsd_gYearMonth.html 295 | 296 | More info: https://www.w3.org/TR/xmlschema-2/#gYearMonth 297 | */ 298 | type GYearMonth AnySimpleType 299 | 300 | /* 301 | Construct an instance of xsd GYearMonth type 302 | */ 303 | func (tp GYearMonth) NewGYearMonth(time time.Time) GYearMonth { 304 | return GYearMonth(fmt.Sprintf("", time.Year(),"-",time.Month())) 305 | //return GYearMonth(time.Format("2004-04-05:00")) 306 | } 307 | 308 | /* 309 | The type xsd:gYear represents a specific calendar year. 310 | The letter g signifies "Gregorian." The format of xsd:gYear 311 | is CCYY. No left truncation is allowed. To represent years 312 | later than 9999, additional digits can be added to the left 313 | of the year value. To represent years before 0001, a preceding 314 | minus sign ("-") is allowed. 315 | 316 | Source: http://www.datypic.com/sc/xsd/t-xsd_gYear.html 317 | 318 | More info: https://www.w3.org/TR/xmlschema-2/#gYear 319 | */ 320 | type GYear AnySimpleType 321 | 322 | /* 323 | Construct an instance of xsd GYear type 324 | */ 325 | func (tp GYear) NewGYear(time time.Time) GYear { 326 | return GYear(fmt.Sprintf("", time.Year())) 327 | //return GYearMonth(time.Format("2004-04-05:00")) 328 | } 329 | 330 | /* 331 | The type xsd:gMonthDay represents a specific day that recurs 332 | every year. The letter g signifies "Gregorian." xsd:gMonthDay 333 | can be used to say, for example, that your birthday is on the 334 | 14th of April every year. The format of xsd:gMonthDay is --MM-DD. 335 | 336 | Source: http://www.datypic.com/sc/xsd/t-xsd_gMonthDay.html 337 | 338 | More info: https://www.w3.org/TR/xmlschema-2/#gMonthDay 339 | */ 340 | type GMonthDay AnySimpleType 341 | 342 | /* 343 | Construct an instance of xsd GMonthDay type 344 | */ 345 | func (tp GMonthDay) NewGMonthDay(time time.Time) GMonthDay { 346 | return GMonthDay(fmt.Sprintf("--", time.Month(),"-",time.Day())) 347 | } 348 | 349 | /* 350 | The type xsd:gDay represents a day that recurs every month. 351 | The letter g signifies "Gregorian." xsd:gDay can be used to say, 352 | for example, that checks are paid on the 5th of each month. 353 | To represent a duration of days, use the duration type instead. 354 | The format of gDay is ---DD. 355 | 356 | Source: http://www.datypic.com/sc/xsd/t-xsd_gDay.html 357 | 358 | More info: https://www.w3.org/TR/xmlschema-2/#gDay 359 | */ 360 | type GDay AnySimpleType 361 | 362 | /* 363 | Construct an instance of xsd GDay type 364 | */ 365 | func (tp GDay) NewGDay(time time.Time) GDay { 366 | return GDay(fmt.Sprintf("---", time.Day())) 367 | } 368 | 369 | /* 370 | The type xsd:gMonth represents a specific month that recurs 371 | every year. The letter g signifies "Gregorian." xsd:gMonth 372 | can be used to indicate, for example, that fiscal year-end 373 | processing occurs in September of every year. To represent 374 | a duration of months, use the duration type instead. The format 375 | of xsd:gMonth is --MM. 376 | 377 | Source: http://www.datypic.com/sc/xsd/t-xsd_gMonth.html 378 | 379 | More info: https://www.w3.org/TR/xmlschema-2/#gMonth 380 | */ 381 | type GMonth AnySimpleType 382 | 383 | func (tp GMonth) NewGMonth(time time.Time) GMonth { 384 | return GMonth(fmt.Sprintf("--", time.Month())) 385 | } 386 | 387 | /* 388 | The xsd:hexBinary type represents binary data as a sequence 389 | of binary octets. It uses hexadecimal encoding, where each 390 | binary octet is a two-character hexadecimal number. 391 | Lowercase and uppercase letters A through F are permitted. 392 | For example, 0FB8 and 0fb8 are two equal xsd:hexBinary 393 | representations consisting of two octets. 394 | 395 | Source: http://www.datypic.com/sc/xsd/t-xsd_hexBinary.html 396 | 397 | More info: https://www.w3.org/TR/xmlschema-2/#hexBinary 398 | */ 399 | type HexBinary AnySimpleType 400 | 401 | func (tp HexBinary) NewHexBinary(data []byte) HexBinary { 402 | return HexBinary(hex.EncodeToString(data)) 403 | } 404 | /* 405 | base64Binary represents Base64-encoded arbitrary binary data. 406 | The ·value space· of base64Binary is the set of finite-length sequences of binary octets. 407 | For base64Binary data the entire binary stream is encoded using the Base64 Alphabet in [RFC 2045]. 408 | 409 | base64Binary has the following ·constraining facets·: 410 | • length 411 | • minLength 412 | • maxLength 413 | • pattern 414 | • enumeration 415 | • whiteSpace 416 | 417 | More info: https://www.w3.org/TR/xmlschema-2/#base64Binary 418 | */ 419 | type Base64Binary AnySimpleType 420 | 421 | func (tp Base64Binary) NewBase64Binary(data []byte) Base64Binary { 422 | return Base64Binary(base64.StdEncoding.EncodeToString(data)) 423 | } 424 | 425 | /* 426 | anyURI represents a Uniform Resource Identifier Reference (URI). 427 | An anyURI value can be absolute or relative, and may have an optional 428 | fragment identifier (i.e., it may be a URI Reference). 429 | This type should be used to specify the intention that the 430 | value fulfills the role of a URI as defined by [RFC 2396], as amended by [RFC 2732]. 431 | 432 | anyURI has the following ·constraining facets·: 433 | • length 434 | • minLength 435 | • maxLength 436 | • pattern 437 | • enumeration 438 | • whiteSpace 439 | 440 | More info: https://www.w3.org/TR/xmlschema-2/#anyURI 441 | */ 442 | type AnyURI AnySimpleType 443 | 444 | func (tp AnyURI) NewAnyURI(data url.URL) AnyURI { 445 | return AnyURI(data.String()) 446 | } 447 | 448 | /* 449 | QName represents XML qualified names. The ·value space· of QName is the set of tuples 450 | {namespace name, local part}, where namespace name is an anyURI and local part is an NCName. 451 | The ·lexical space· of QName is the set of strings that ·match· the QName production of [Namespaces in XML]. 452 | 453 | QName has the following ·constraining facets·: 454 | • length 455 | • minLength 456 | • maxLength 457 | • pattern 458 | • enumeration 459 | • whiteSpace 460 | 461 | More info: https://www.w3.org/TR/xmlschema-2/#QName 462 | */ 463 | type QName AnySimpleType 464 | 465 | func (tp QName) NewQName(prefix, local string) QName { 466 | var result string 467 | if len(prefix) == 0 { 468 | result += local 469 | } else { 470 | result = prefix + ":" + local 471 | } 472 | return QName(result) 473 | } 474 | 475 | //TODO: NOTATION datatype 476 | //type NOTATION AnySimpleType 477 | 478 | /* 479 | Derived types 480 | */ 481 | 482 | type NormalizedString String 483 | 484 | //TODO: check normalization 485 | func (tp NormalizedString) NewNormalizedString(data string) (NormalizedString, error) { 486 | if strings.ContainsAny(data, "\r\n\t<>&") { 487 | return NormalizedString(""), errors.New("String " + data + " contains forbidden symbols") 488 | } 489 | return NormalizedString(data), nil 490 | } 491 | 492 | type Token NormalizedString 493 | 494 | func (tp Token) NewToken(data NormalizedString) (Token, error) { 495 | trailing_leading_whitespaces := regexp.MustCompile(`^[\s\p{Zs}]+|[\s\p{Zs}]+$`) 496 | multiple_whitespaces := regexp.MustCompile(`[\s\p{Zs}]{2,}`) 497 | //Removing trailing and leading whitespaces and multiple spaces 498 | /*final := re_leadclose_whtsp.ReplaceAllString(data, "") 499 | final = re_inside_whtsp.ReplaceAllString(final, " ")*/ 500 | if strings.ContainsAny(string(data), "\r\n\t<>&") || trailing_leading_whitespaces.MatchString(string(data)) || multiple_whitespaces.MatchString(string(data)) { 501 | return Token(""), errors.New("String " + string(data) + " contains forbidden symbols or whitespaces") 502 | } 503 | 504 | return Token(data), nil 505 | } 506 | 507 | type Language Token 508 | 509 | func (tp Language) NewLanguage(data Token) (Language, error) { 510 | //Pattern was given from https://www.w3.org/2001/05/datatypes.xsd 511 | rgxp := regexp.MustCompile(`([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*`) 512 | if rgxp.MatchString(string(data)) { 513 | return Language(""), errors.New("String does not match pattern ([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*") 514 | } 515 | return Language(data), nil 516 | } 517 | 518 | type NMTOKEN Token 519 | 520 | //TODO: check for valid symbols: https://www.w3.org/TR/xml/#NT-Nmtoken 521 | func (tp NMTOKEN) NewNMTOKEN(data string) NMTOKEN { 522 | return NMTOKEN(data) 523 | } 524 | 525 | type NMTOKENS []NMTOKEN 526 | 527 | func (tp NMTOKENS) NewNMTOKENS(data []NMTOKEN) NMTOKENS { 528 | result := make(NMTOKENS, len(data)) 529 | for i, j := range data { 530 | result[i] = j 531 | } 532 | return result 533 | } 534 | 535 | type Name Token 536 | 537 | //TODO: implements https://www.w3.org/TR/xml/#NT-Name 538 | func (tp Name) NewName(data Token) Name { 539 | return Name(data) 540 | } 541 | 542 | type NCName Name 543 | 544 | //TODO: https://www.w3.org/TR/REC-xml/#NT-Name and https://www.w3.org/TR/xml-names/#NT-NCName 545 | func (tp NCName) NewNCName(data Name) NCName { 546 | return NCName(data) 547 | } 548 | 549 | //TODO: improve next types to correspond to XMLSchema 550 | type ID NCName 551 | 552 | func (tp ID) NewID(data NCName) ID { 553 | return ID(data) 554 | } 555 | 556 | type IDREF NCName 557 | 558 | func (tp IDREF) NewIDREF(data NCName) IDREF { 559 | return IDREF(data) 560 | } 561 | 562 | type IDREFS []IDREF 563 | 564 | func (tp IDREFS) NewIDREFS(data []IDREF) IDREFS { 565 | result := make(IDREFS, len(data)) 566 | for i, j := range data { 567 | result[i] = j 568 | } 569 | return result 570 | } 571 | 572 | type ENTITY NCName 573 | 574 | func (tp ENTITY) NewENTITY(data NCName) ENTITY { 575 | return ENTITY(data) 576 | } 577 | 578 | type ENTITIES []ENTITY 579 | 580 | func (tp ENTITIES) NewENTITIES(data []ENTITY) ENTITIES { 581 | result := make(ENTITIES, len(data)) 582 | for i, j := range data { 583 | result[i] = j 584 | } 585 | return result 586 | } 587 | 588 | type Integer int64 589 | 590 | func (tp Integer) NewInteger(data int64) Integer { 591 | return Integer(data) 592 | } 593 | 594 | type NonPositiveInteger int64 595 | 596 | func (tp NonPositiveInteger) NewNonPositiveInteger(data int64) (NonPositiveInteger, error) { 597 | if data > 0 { 598 | return 0, errors.New("Value must be less or equal to 0") 599 | } 600 | return NonPositiveInteger(data), nil 601 | } 602 | 603 | type NegativeInteger int64 604 | 605 | func (tp NegativeInteger) NewNegativeInteger(data int64) (NegativeInteger, error) { 606 | if data >= 0 { 607 | return 0, errors.New("Value must be less than 0") 608 | } 609 | return NegativeInteger(data), nil 610 | } 611 | 612 | type Long int64 613 | 614 | func (tp Long) NewLong(data int64) Long { 615 | return Long(data) 616 | } 617 | 618 | type Int int32 619 | 620 | func (tp Int) NewInt(data int32) Int { 621 | return Int(data) 622 | } 623 | 624 | type Short int16 625 | 626 | func (tp Short) NewShort(data int16) Short { 627 | return Short(data) 628 | } 629 | 630 | type Byte int8 631 | 632 | func (tp Byte) NewByte(data int8) Byte { 633 | return Byte(data) 634 | } 635 | 636 | type NonNegativeInteger int64 637 | 638 | func (tp NonNegativeInteger) NewNonNegativeInteger(data int64) (NonNegativeInteger, error) { 639 | if data > 0 { 640 | return 0, errors.New("Value must be more or equal to 0") 641 | } 642 | return NonNegativeInteger(data), nil 643 | } 644 | 645 | type UnsignedLong uint64 646 | 647 | func (tp UnsignedLong) NewUnsignedLong(data uint64) UnsignedLong { 648 | return UnsignedLong(data) 649 | } 650 | 651 | type UnsignedInt uint32 652 | 653 | func (tp UnsignedInt) NewUnsignedInt(data uint32) UnsignedInt { 654 | return UnsignedInt(data) 655 | } 656 | 657 | type UnsignedShort uint16 658 | 659 | func (tp UnsignedShort) NewUnsignedShort(data uint16) UnsignedShort { 660 | return UnsignedShort(data) 661 | } 662 | 663 | type UnsignedByte uint8 664 | 665 | func (tp UnsignedByte) NewUnsignedByte(data uint8) UnsignedByte { 666 | return UnsignedByte(data) 667 | } 668 | 669 | type PositiveInteger int64 670 | 671 | func (tp PositiveInteger) NewPositiveInteger(data int64) (PositiveInteger, error) { 672 | if data >= 0 { 673 | return 0, errors.New("Value must be more than 0") 674 | } 675 | return PositiveInteger(data), nil 676 | } --------------------------------------------------------------------------------