simple mod to github.com/use-go/onvif

This commit is contained in:
Edward
2020-04-29 10:53:49 +08:00
parent 331969745b
commit 928207d461
11 changed files with 371 additions and 418 deletions

View File

@@ -1,8 +1,8 @@
package analytics package analytics
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/xsd/onvif"
) )
type GetSupportedRules struct { type GetSupportedRules struct {

View File

@@ -1,4 +1,4 @@
package goonvif package onvif
import ( import (
"encoding/xml" "encoding/xml"
@@ -11,10 +11,10 @@ import (
"strings" "strings"
"github.com/beevik/etree" "github.com/beevik/etree"
"github.com/use-go/goonvif/device" "github.com/use-go/onvif/device"
"github.com/use-go/goonvif/networking" "github.com/use-go/onvif/gosoap"
"github.com/yakovlevdmv/WS-Discovery" "github.com/use-go/onvif/networking"
"github.com/yakovlevdmv/gosoap" wsdiscovery "github.com/use-go/onvif/ws-discovery"
) )
//Xlmns XML Scheam //Xlmns XML Scheam
@@ -99,9 +99,9 @@ func readResponse(resp *http.Response) string {
//GetAvailableDevicesAtSpecificEthernetInterface ... //GetAvailableDevicesAtSpecificEthernetInterface ...
func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) []Device { func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) []Device {
/* /*
Call an WS-Discovery Probe Message to Discover NVT type Devices Call an ws-discovery Probe Message to Discover NVT type Devices
*/ */
devices := WS_Discovery.SendProbe(interfaceName, nil, []string{"dn:" + NVT.String()}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"}) devices := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:" + NVT.String()}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
nvtDevices := make([]Device, 0) nvtDevices := make([]Device, 0)
////fmt.Println(devices) ////fmt.Println(devices)
for _, j := range devices { for _, j := range devices {
@@ -144,7 +144,7 @@ func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) []Devi
} }
func (dev *Device) getSupportedServices(resp *http.Response) { func (dev *Device) getSupportedServices(resp *http.Response) {
//resp, err := dev.CallMethod(Device.GetCapabilities{Category:"All"}) //resp, err := dev.CallMethod(device.GetCapabilities{Category:"All"})
//if err != nil { //if err != nil {
// log.Println(err.Error()) // log.Println(err.Error())
//return //return
@@ -195,7 +195,7 @@ func (dev *Device) addEndpoint(Key, Value string) {
dev.endpoints[lowCaseKey] = Value dev.endpoints[lowCaseKey] = Value
} }
//Authenticate function authenticate client in the ONVIF Device. //Authenticate function authenticate client in the ONVIF device.
//Function takes <username> and <password> params. //Function takes <username> and <password> params.
//You should use this function to allow authorized requests to the ONVIF Device //You should use this function to allow authorized requests to the ONVIF Device
//To change auth data call this function again. //To change auth data call this function again.
@@ -252,52 +252,15 @@ func (dev Device) CallMethod(method interface{}) (*http.Response, error) {
pkgPath := strings.Split(reflect.TypeOf(method).PkgPath(), "/") pkgPath := strings.Split(reflect.TypeOf(method).PkgPath(), "/")
pkg := strings.ToLower(pkgPath[len(pkgPath)-1]) pkg := strings.ToLower(pkgPath[len(pkgPath)-1])
if endpoint, err := dev.getEndpoint(pkg); err != nil { endpoint, err := dev.getEndpoint(pkg)
return nil, err
} else {
if dev.login != "" && dev.password != "" {
return dev.callAuthorizedMethod(endpoint, method)
} else {
return dev.callNonAuthorizedMethod(endpoint, method)
}
}
}
//CallNonAuthorizedMethod functions call an method, defined <method> struct without authentication data
func (dev Device) callNonAuthorizedMethod(endpoint string, method interface{}) (*http.Response, error) {
//TODO: Get endpoint automatically
/*
Converting <method> struct to xml string representation
*/
output, err := xml.MarshalIndent(method, " ", " ")
if err != nil { if err != nil {
//log.Printf("error: %v\n", err.Error())
return nil, err return nil, err
} }
return dev.callMethodDo(endpoint, method)
/*
Build an SOAP request with <method>
*/
soap, err := buildMethodSOAP(string(output))
if err != nil {
//log.Printf("error: %v\n", err)
return nil, err
}
/*
Adding namespaces
*/
soap.AddRootNamespaces(Xlmns)
/*
Sending request and returns the response
*/
return networking.SendSoap(endpoint, soap.String())
} }
//CallMethod functions call an method, defined <method> struct with authentication data //CallMethod functions call an method, defined <method> struct with authentication data
func (dev Device) callAuthorizedMethod(endpoint string, method interface{}) (*http.Response, error) { func (dev Device) callMethodDo(endpoint string, method interface{}) (*http.Response, error) {
/* /*
Converting <method> struct to xml string representation Converting <method> struct to xml string representation
*/ */
@@ -306,7 +269,7 @@ func (dev Device) callAuthorizedMethod(endpoint string, method interface{}) (*ht
//log.Printf("error: %v\n", err.Error()) //log.Printf("error: %v\n", err.Error())
return nil, err return nil, err
} }
//fmt.Println(gosoap.SoapMessage(string(output)).StringIndent())
/* /*
Build an SOAP request with <method> Build an SOAP request with <method>
*/ */
@@ -316,12 +279,21 @@ func (dev Device) callAuthorizedMethod(endpoint string, method interface{}) (*ht
return nil, err return nil, err
} }
//fmt.Println(soap.StringIndent())
/* /*
Adding namespaces and WS-Security headers Adding namespaces and WS-Security headers
*/ */
soap.AddRootNamespaces(Xlmns) soap.AddRootNamespaces(Xlmns)
soap.AddWSSecurity(dev.login, dev.password)
//fmt.Println(soap.StringIndent())
//Header handling
soap.AddAction()
//Auth Handling
if dev.login != "" && dev.password != "" {
soap.AddWSSecurity(dev.login, dev.password)
}
//fmt.Println(soap.StringIndent())
/* /*
Sending request and returns the response Sending request and returns the response
*/ */

View File

@@ -1,8 +1,8 @@
package device package device
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/xsd/onvif"
) )
type Service struct { type Service struct {

View File

@@ -1,21 +1,124 @@
package event package event
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
) )
type FilterType xsd.String //Address Alias
type Address xsd.String
//<xsd:union memberTypes="xsd:dateTime xsd:duration"/> //CurrentTime alias
type CurrentTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//TerminationTime alias
type TerminationTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//FixedTopicSet alias
type FixedTopicSet xsd.Boolean //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//Documentation alias
type Documentation xsd.AnyType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
//TopicExpressionDialect alias
type TopicExpressionDialect xsd.AnyURI
//Message alias
type Message xsd.AnyType
//ActionType for AttributedURIType
type ActionType AttributedURIType
//AttributedURIType in ws-addr
type AttributedURIType xsd.AnyURI //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//AbsoluteOrRelativeTimeType <xsd:union memberTypes="xsd:dateTime xsd:duration"/>
type AbsoluteOrRelativeTimeType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd type AbsoluteOrRelativeTimeType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
xsd.DateTime xsd.DateTime
xsd.Duration xsd.Duration
} }
type SubscriptionPolicy struct { //tev http://www.onvif.org/ver10/events/wsdl //EndpointReferenceType in ws-addr
ChangedOnly xsd.Boolean `xml:"ChangedOnly,attr"` type EndpointReferenceType struct { //wsa http://www.w3.org/2005/08/addressing/ws-addr.xsd
Address AttributedURIType `xml:"wsnt:Address"`
ReferenceParameters ReferenceParametersType `xml:"wsnt:ReferenceParameters"`
Metadata MetadataType `xml:"wsnt:Metadata"`
} }
// FilterType struct
type FilterType struct {
TopicExpression TopicExpressionType `xml:"wsnt:TopicExpression"`
MessageContent QueryExpressionType `xml:"wsnt:MessageContent"`
}
//EndpointReference alais
type EndpointReference EndpointReferenceType
//ReferenceParametersType in ws-addr
type ReferenceParametersType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//Here can be anyAttribute
}
//Metadata in ws-addr
type Metadata MetadataType //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//MetadataType in ws-addr
type MetadataType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//Here can be anyAttribute
}
//TopicSet alias
type TopicSet TopicSetType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
//TopicSetType alias
type TopicSetType struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd
ExtensibleDocumented
//here can be any element
}
//ExtensibleDocumented struct
type ExtensibleDocumented struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd
Documentation Documentation //к xsd-документе documentation с маленькой буквы начинается
//here can be anyAttribute
}
//ProducerReference Alias
type ProducerReference EndpointReferenceType
//SubscriptionReference Alias
type SubscriptionReference EndpointReferenceType
//NotificationMessageHolderType Alias
type NotificationMessageHolderType struct {
SubscriptionReference SubscriptionReference //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Topic Topic
ProducerReference ProducerReference
Message Message
}
//NotificationMessage Alias
type NotificationMessage NotificationMessageHolderType //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//QueryExpressionType struct for wsnt:MessageContent
type QueryExpressionType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Dialect xsd.AnyURI `xml:"Dialect,attr"`
MessageKind xsd.String `xml:",chardata"` // boolean(ncex:Producer="15")
}
//MessageContentType Alias
type MessageContentType QueryExpressionType
//QueryExpression Alias
type QueryExpression QueryExpressionType
//TopicExpressionType struct for wsnt:TopicExpression
type TopicExpressionType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Dialect xsd.AnyURI `xml:"Dialect,attr"`
TopicKinds xsd.String `xml:",chardata"`
}
//Topic Alias
type Topic TopicExpressionType
// Capabilities of event
type Capabilities struct { //tev type Capabilities struct { //tev
WSSubscriptionPolicySupport xsd.Boolean `xml:"WSSubscriptionPolicySupport,attr"` WSSubscriptionPolicySupport xsd.Boolean `xml:"WSSubscriptionPolicySupport,attr"`
WSPullPointSupport xsd.Boolean `xml:"WSPullPointSupport,attr"` WSPullPointSupport xsd.Boolean `xml:"WSPullPointSupport,attr"`
@@ -25,172 +128,50 @@ type Capabilities struct { //tev
PersistentNotificationStorage xsd.Boolean `xml:"PersistentNotificationStorage,attr"` PersistentNotificationStorage xsd.Boolean `xml:"PersistentNotificationStorage,attr"`
} }
type EndpointReferenceType struct { //wsa http://www.w3.org/2005/08/addressing/ws-addr.xsd //ResourceUnknownFault response type
Address AttributedURIType
ReferenceParameters ReferenceParametersType
Metadata // todo:разобраться с этим: понять, на какой тип ссылается
}
type AttributedURIType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
Any xsd.AnyURI //extension
//Here can be anyAttribute
}
type ReferenceParametersType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
Any string
//Here can be anyAttribute
}
type Metadata MetadataType //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
type MetadataType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
Any string
//Here can be anyAttribute
}
type CurrentTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
type TerminationTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
type FixedTopicSet xsd.Boolean //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
type TopicSet TopicSetType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
type TopicSetType struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd
ExtensibleDocumented
//here can be any element
}
type ExtensibleDocumented struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd
Documentation Documentation //к xsd-документе documentation с маленькой буквы начинается
//here can be anyAttribute
}
type Documentation xsd.AnyType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
type TopicExpressionDialect xsd.AnyURI
type NotificationMessage NotificationMessageHolderType //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
type NotificationMessageHolderType struct {
SubscriptionReference SubscriptionReference //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Topic Topic
ProducerReference ProducerReference
Message Message
}
type SubscriptionReference EndpointReferenceType
type Topic TopicExpressionType
type ProducerReference EndpointReferenceType
type Message xsd.AnyType
type TopicExpressionType struct { //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Dialect xsd.AnyURI `xml:"Dialect,attr"`
}
//Event main types
type GetServiceCapabilities struct {
XMLName string `xml:"tev:GetServiceCapabilities"`
}
type GetServiceCapabilitiesResponse struct {
Capabilities Capabilities
}
//BUG(r) Bad AbsoluteOrRelativeTimeType type
type CreatePullPointSubscription struct {
XMLName string `xml:"tev:CreatePullPointSubscription"`
Filter FilterType `xml:"tev:Filter"`
InitialTerminationTime AbsoluteOrRelativeTimeType `xml:"tev:InitialTerminationTime"`
SubscriptionPolicy SubscriptionPolicy `xml:"tev:SubscriptionPolicy"`
}
type CreatePullPointSubscriptionResponse struct {
SubscriptionReference EndpointReferenceType
CurrentTime CurrentTime
TerminationTime TerminationTime
}
type ResourceUnknownFault struct { type ResourceUnknownFault struct {
} }
//InvalidFilterFault response type
type InvalidFilterFault struct { type InvalidFilterFault struct {
} }
//TopicExpressionDialectUnknownFault response type
type TopicExpressionDialectUnknownFault struct { type TopicExpressionDialectUnknownFault struct {
} }
//InvalidTopicExpressionFault response type
type InvalidTopicExpressionFault struct { type InvalidTopicExpressionFault struct {
} }
//TopicNotSupportedFault response type
type TopicNotSupportedFault struct { type TopicNotSupportedFault struct {
} }
//InvalidProducerPropertiesExpressionFault response type
type InvalidProducerPropertiesExpressionFault struct { type InvalidProducerPropertiesExpressionFault struct {
} }
//InvalidMessageContentExpressionFault response type
type InvalidMessageContentExpressionFault struct { type InvalidMessageContentExpressionFault struct {
} }
//UnacceptableInitialTerminationTimeFault response type
type UnacceptableInitialTerminationTimeFault struct { type UnacceptableInitialTerminationTimeFault struct {
} }
//UnrecognizedPolicyRequestFault response type
type UnrecognizedPolicyRequestFault struct { type UnrecognizedPolicyRequestFault struct {
} }
//UnsupportedPolicyRequestFault response type
type UnsupportedPolicyRequestFault struct { type UnsupportedPolicyRequestFault struct {
} }
//NotifyMessageNotSupportedFault response type
type NotifyMessageNotSupportedFault struct { type NotifyMessageNotSupportedFault struct {
} }
//SubscribeCreationFailedFault response type
type SubscribeCreationFailedFault struct { type SubscribeCreationFailedFault struct {
} }
type GetEventProperties struct {
XMLName string `xml:"tev:GetEventProperties"`
}
type GetEventPropertiesResponse struct {
TopicNamespaceLocation xsd.AnyURI
FixedTopicSet FixedTopicSet
TopicSet TopicSet
TopicExpressionDialect TopicExpressionDialect
MessageContentFilterDialect xsd.AnyURI
ProducerPropertiesFilterDialect xsd.AnyURI
MessageContentSchemaLocation xsd.AnyURI
}
//Port type PullPointSubscription
type PullMessages struct {
XMLName string `xml:"tev:PullMessages"`
Timeout xsd.Duration `xml:"tev:Timeout"`
MessageLimit xsd.Int `xml:"tev:MessageLimit"`
}
type PullMessagesResponse struct {
CurrentTime CurrentTime
TerminationTime TerminationTime
NotificationMessage NotificationMessage
}
type PullMessagesFaultResponse struct {
MaxTimeout xsd.Duration
MaxMessageLimit xsd.Int
}
type Seek struct {
XMLName string `xml:"tev:Seek"`
UtcTime xsd.DateTime `xml:"tev:UtcTime"`
Reverse xsd.Boolean `xml:"tev:Reverse"`
}
type SeekResponse struct {
}
type SetSynchronizationPoint struct {
XMLName string `xml:"tev:SetSynchronizationPoint"`
}
type SetSynchronizationPointResponse struct {
}

View File

@@ -1,8 +1,8 @@
package imaging package imaging
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/xsd/onvif"
) )
type GetServiceCapabilities struct { type GetServiceCapabilities struct {

View File

@@ -1,8 +1,8 @@
package media package media
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/xsd/onvif"
) )
type Capabilities struct { type Capabilities struct {
@@ -86,7 +86,7 @@ type GetProfiles struct {
} }
type GetProfilesResponse struct { type GetProfilesResponse struct {
Profiles onvif.Profile Profiles []onvif.Profile
} }
type AddVideoEncoderConfiguration struct { type AddVideoEncoderConfiguration struct {

View File

@@ -1,8 +1,8 @@
package ptz package ptz
import ( import (
"github.com/use-go/goonvif/xsd" "github.com/use-go/onvif/xsd"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/xsd/onvif"
) )
type Capabilities struct { type Capabilities struct {

View File

@@ -12,10 +12,10 @@ import (
"github.com/beevik/etree" "github.com/beevik/etree"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/yakovlevdmv/WS-Discovery" "github.com/use-go/onvif"
"github.com/use-go/goonvif" "github.com/use-go/onvif/gosoap"
"github.com/use-go/goonvif/networking" "github.com/use-go/onvif/networking"
"github.com/yakovlevdmv/gosoap" wsdiscovery "github.com/use-go/onvif/ws-discovery"
) )
func RunApi() { func RunApi() {
@@ -50,7 +50,8 @@ func RunApi() {
interfaceName := context.GetHeader("interface") interfaceName := context.GetHeader("interface")
var response = "[" var response = "["
devices := WS_Discovery.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"}) devices := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
for _, j := range devices { for _, j := range devices {
doc := etree.NewDocument() doc := etree.NewDocument()
if err := doc.ReadFromString(j); err != nil { if err := doc.ReadFromString(j); err != nil {
@@ -143,7 +144,7 @@ func callNecessaryMethod(serviceName, methodName, acceptedData, username, passwo
soap := gosoap.NewEmptySOAP() soap := gosoap.NewEmptySOAP()
soap.AddStringBodyContent(*resp) soap.AddStringBodyContent(*resp)
soap.AddRootNamespaces(goonvif.Xlmns) soap.AddRootNamespaces(onvif.Xlmns)
soap.AddWSSecurity(username, password) soap.AddWSSecurity(username, password)
servResp, err := networking.SendSoap(endpoint, soap.String()) servResp, err := networking.SendSoap(endpoint, soap.String())
@@ -160,7 +161,7 @@ func callNecessaryMethod(serviceName, methodName, acceptedData, username, passwo
} }
func getEndpoint(service, xaddr string) (string, error) { func getEndpoint(service, xaddr string) (string, error) {
dev, err := goonvif.NewDevice(xaddr) dev, err := onvif.NewDevice(xaddr)
if err != nil { if err != nil {
return "", err return "", err
} }

View File

@@ -1,70 +1,71 @@
package api package api
import ( import (
"github.com/use-go/goonvif/ptz"
"errors" "errors"
"github.com/use-go/goonvif/device"
"github.com/use-go/goonvif/Media" "github.com/use-go/onvif/device"
"github.com/use-go/onvif/media"
"github.com/use-go/onvif/ptz"
) )
func getPTZStructByName(name string) (interface{}, error) { func getPTZStructByName(name string) (interface{}, error) {
switch name { switch name {
case "GetServiceCapabilities": case "GetServiceCapabilities":
return &PTZ.GetServiceCapabilities{}, nil return &ptz.GetServiceCapabilities{}, nil
case "GetNodes": case "GetNodes":
return &PTZ.GetNodes{}, nil return &ptz.GetNodes{}, nil
case "GetNode": case "GetNode":
return &PTZ.GetNode{}, nil return &ptz.GetNode{}, nil
case "GetConfiguration": case "GetConfiguration":
return &PTZ.GetConfiguration{}, nil return &ptz.GetConfiguration{}, nil
case "GetConfigurations": case "GetConfigurations":
return &PTZ.GetConfigurations{}, nil return &ptz.GetConfigurations{}, nil
case "SetConfiguration": case "SetConfiguration":
return &PTZ.SetConfiguration{}, nil return &ptz.SetConfiguration{}, nil
case "GetConfigurationOptions": case "GetConfigurationOptions":
return &PTZ.GetConfigurationOptions{}, nil return &ptz.GetConfigurationOptions{}, nil
case "SendAuxiliaryCommand": case "SendAuxiliaryCommand":
return &PTZ.SendAuxiliaryCommand{}, nil return &ptz.SendAuxiliaryCommand{}, nil
case "GetPresets": case "GetPresets":
return &PTZ.GetPresets{}, nil return &ptz.GetPresets{}, nil
case "SetPreset": case "SetPreset":
return &PTZ.SetPreset{}, nil return &ptz.SetPreset{}, nil
case "RemovePreset": case "RemovePreset":
return &PTZ.RemovePreset{}, nil return &ptz.RemovePreset{}, nil
case "GotoPreset": case "GotoPreset":
return &PTZ.GotoPreset{}, nil return &ptz.GotoPreset{}, nil
case "GotoHomePosition": case "GotoHomePosition":
return &PTZ.GotoHomePosition{}, nil return &ptz.GotoHomePosition{}, nil
case "SetHomePosition": case "SetHomePosition":
return &PTZ.SetHomePosition{}, nil return &ptz.SetHomePosition{}, nil
case "ContinuousMove": case "ContinuousMove":
return &PTZ.ContinuousMove{}, nil return &ptz.ContinuousMove{}, nil
case "RelativeMove": case "RelativeMove":
return &PTZ.RelativeMove{}, nil return &ptz.RelativeMove{}, nil
case "GetStatus": case "GetStatus":
return &PTZ.GetStatus{}, nil return &ptz.GetStatus{}, nil
case "AbsoluteMove": case "AbsoluteMove":
return &PTZ.AbsoluteMove{}, nil return &ptz.AbsoluteMove{}, nil
case "GeoMove": case "GeoMove":
return &PTZ.GeoMove{}, nil return &ptz.GeoMove{}, nil
case "Stop": case "Stop":
return &PTZ.Stop{}, nil return &ptz.Stop{}, nil
case "GetPresetTours": case "GetPresetTours":
return &PTZ.GetPresetTours{}, nil return &ptz.GetPresetTours{}, nil
case "GetPresetTour": case "GetPresetTour":
return &PTZ.GetPresetTour{}, nil return &ptz.GetPresetTour{}, nil
case "GetPresetTourOptions": case "GetPresetTourOptions":
return &PTZ.GetPresetTourOptions{}, nil return &ptz.GetPresetTourOptions{}, nil
case "CreatePresetTour": case "CreatePresetTour":
return &PTZ.CreatePresetTour{}, nil return &ptz.CreatePresetTour{}, nil
case "ModifyPresetTour": case "ModifyPresetTour":
return &PTZ.ModifyPresetTour{}, nil return &ptz.ModifyPresetTour{}, nil
case "OperatePresetTour": case "OperatePresetTour":
return &PTZ.OperatePresetTour{}, nil return &ptz.OperatePresetTour{}, nil
case "RemovePresetTour": case "RemovePresetTour":
return &PTZ.RemovePresetTour{}, nil return &ptz.RemovePresetTour{}, nil
case "GetCompatibleConfigurations": case "GetCompatibleConfigurations":
return &PTZ.GetCompatibleConfigurations{}, nil return &ptz.GetCompatibleConfigurations{}, nil
default: default:
return nil, errors.New("there is no such method in the PTZ service") return nil, errors.New("there is no such method in the PTZ service")
} }
@@ -73,354 +74,352 @@ func getPTZStructByName(name string) (interface{}, error) {
func getDeviceStructByName(name string) (interface{}, error) { func getDeviceStructByName(name string) (interface{}, error) {
switch name { switch name {
case "GetServices": case "GetServices":
return &Device.GetServices{}, nil return &device.GetServices{}, nil
case "GetServiceCapabilities": case "GetServiceCapabilities":
return &Device.GetServiceCapabilities{}, nil return &device.GetServiceCapabilities{}, nil
case "GetDeviceInformation": case "GetDeviceInformation":
return &Device.GetDeviceInformation{}, nil return &device.GetDeviceInformation{}, nil
case "SetSystemDateAndTime": case "SetSystemDateAndTime":
return &Device.SetSystemDateAndTime{}, nil return &device.SetSystemDateAndTime{}, nil
case "GetSystemDateAndTime": case "GetSystemDateAndTime":
return &Device.GetSystemDateAndTime{}, nil return &device.GetSystemDateAndTime{}, nil
case "SetSystemFactoryDefault": case "SetSystemFactoryDefault":
return &Device.SetSystemFactoryDefault{}, nil return &device.SetSystemFactoryDefault{}, nil
case "UpgradeSystemFirmware": case "UpgradeSystemFirmware":
return &Device.UpgradeSystemFirmware{}, nil return &device.UpgradeSystemFirmware{}, nil
case "SystemReboot": case "SystemReboot":
return &Device.SystemReboot{}, nil return &device.SystemReboot{}, nil
case "RestoreSystem": case "RestoreSystem":
return &Device.RestoreSystem{}, nil return &device.RestoreSystem{}, nil
case "GetSystemBackup": case "GetSystemBackup":
return &Device.GetSystemBackup{}, nil return &device.GetSystemBackup{}, nil
case "GetSystemLog": case "GetSystemLog":
return &Device.GetSystemLog{}, nil return &device.GetSystemLog{}, nil
case "GetSystemSupportInformation": case "GetSystemSupportInformation":
return &Device.GetSystemSupportInformation{}, nil return &device.GetSystemSupportInformation{}, nil
case "GetScopes": case "GetScopes":
return &Device.GetScopes{}, nil return &device.GetScopes{}, nil
case "SetScopes": case "SetScopes":
return &Device.SetScopes{}, nil return &device.SetScopes{}, nil
case "AddScopes": case "AddScopes":
return &Device.AddScopes{}, nil return &device.AddScopes{}, nil
case "RemoveScopes": case "RemoveScopes":
return &Device.RemoveScopes{}, nil return &device.RemoveScopes{}, nil
case "GetDiscoveryMode": case "GetDiscoveryMode":
return &Device.GetDiscoveryMode{}, nil return &device.GetDiscoveryMode{}, nil
case "SetDiscoveryMode": case "SetDiscoveryMode":
return &Device.SetDiscoveryMode{}, nil return &device.SetDiscoveryMode{}, nil
case "GetRemoteDiscoveryMode": case "GetRemoteDiscoveryMode":
return &Device.GetRemoteDiscoveryMode{}, nil return &device.GetRemoteDiscoveryMode{}, nil
case "SetRemoteDiscoveryMode": case "SetRemoteDiscoveryMode":
return &Device.SetRemoteDiscoveryMode{}, nil return &device.SetRemoteDiscoveryMode{}, nil
case "GetDPAddresses": case "GetDPAddresses":
return &Device.GetDPAddresses{}, nil return &device.GetDPAddresses{}, nil
case "SetDPAddresses": case "SetDPAddresses":
return &Device.SetDPAddresses{}, nil return &device.SetDPAddresses{}, nil
case "GetEndpointReference": case "GetEndpointReference":
return &Device.GetEndpointReference{}, nil return &device.GetEndpointReference{}, nil
case "GetRemoteUser": case "GetRemoteUser":
return &Device.GetRemoteUser{}, nil return &device.GetRemoteUser{}, nil
case "SetRemoteUser": case "SetRemoteUser":
return &Device.SetRemoteUser{}, nil return &device.SetRemoteUser{}, nil
case "GetUsers": case "GetUsers":
return &Device.GetUsers{}, nil return &device.GetUsers{}, nil
case "CreateUsers": case "CreateUsers":
return &Device.CreateUsers{}, nil return &device.CreateUsers{}, nil
case "DeleteUsers": case "DeleteUsers":
return &Device.DeleteUsers{}, nil return &device.DeleteUsers{}, nil
case "SetUser": case "SetUser":
return &Device.SetUser{}, nil return &device.SetUser{}, nil
case "GetWsdlUrl": case "GetWsdlUrl":
return &Device.GetWsdlUrl{}, nil return &device.GetWsdlUrl{}, nil
case "GetCapabilities": case "GetCapabilities":
return &Device.GetCapabilities{}, nil return &device.GetCapabilities{}, nil
case "GetHostname": case "GetHostname":
return &Device.GetHostname{}, nil return &device.GetHostname{}, nil
case "SetHostname": case "SetHostname":
return &Device.SetHostname{}, nil return &device.SetHostname{}, nil
case "SetHostnameFromDHCP": case "SetHostnameFromDHCP":
return &Device.SetHostnameFromDHCP{}, nil return &device.SetHostnameFromDHCP{}, nil
case "GetDNS": case "GetDNS":
return &Device.GetDNS{}, nil return &device.GetDNS{}, nil
case "SetDNS": case "SetDNS":
return &Device.SetDNS{}, nil return &device.SetDNS{}, nil
case "GetNTP": case "GetNTP":
return &Device.GetNTP{}, nil return &device.GetNTP{}, nil
case "SetNTP": case "SetNTP":
return &Device.SetNTP{}, nil return &device.SetNTP{}, nil
case "GetDynamicDNS": case "GetDynamicDNS":
return &Device.GetDynamicDNS{}, nil return &device.GetDynamicDNS{}, nil
case "SetDynamicDNS": case "SetDynamicDNS":
return &Device.SetDynamicDNS{}, nil return &device.SetDynamicDNS{}, nil
case "GetNetworkInterfaces": case "GetNetworkInterfaces":
return &Device.GetNetworkInterfaces{}, nil return &device.GetNetworkInterfaces{}, nil
case "SetNetworkInterfaces": case "SetNetworkInterfaces":
return &Device.SetNetworkInterfaces{}, nil return &device.SetNetworkInterfaces{}, nil
case "GetNetworkProtocols": case "GetNetworkProtocols":
return &Device.GetNetworkProtocols{}, nil return &device.GetNetworkProtocols{}, nil
case "SetNetworkProtocols": case "SetNetworkProtocols":
return &Device.SetNetworkProtocols{}, nil return &device.SetNetworkProtocols{}, nil
case "GetNetworkDefaultGateway": case "GetNetworkDefaultGateway":
return &Device.GetNetworkDefaultGateway{}, nil return &device.GetNetworkDefaultGateway{}, nil
case "SetNetworkDefaultGateway": case "SetNetworkDefaultGateway":
return &Device.SetNetworkDefaultGateway{}, nil return &device.SetNetworkDefaultGateway{}, nil
case "GetZeroConfiguration": case "GetZeroConfiguration":
return &Device.GetZeroConfiguration{}, nil return &device.GetZeroConfiguration{}, nil
case "SetZeroConfiguration": case "SetZeroConfiguration":
return &Device.SetZeroConfiguration{}, nil return &device.SetZeroConfiguration{}, nil
case "GetIPAddressFilter": case "GetIPAddressFilter":
return &Device.GetIPAddressFilter{}, nil return &device.GetIPAddressFilter{}, nil
case "SetIPAddressFilter": case "SetIPAddressFilter":
return &Device.SetIPAddressFilter{}, nil return &device.SetIPAddressFilter{}, nil
case "AddIPAddressFilter": case "AddIPAddressFilter":
return &Device.AddIPAddressFilter{}, nil return &device.AddIPAddressFilter{}, nil
case "RemoveIPAddressFilter": case "RemoveIPAddressFilter":
return &Device.RemoveIPAddressFilter{}, nil return &device.RemoveIPAddressFilter{}, nil
case "GetAccessPolicy": case "GetAccessPolicy":
return &Device.GetAccessPolicy{}, nil return &device.GetAccessPolicy{}, nil
case "SetAccessPolicy": case "SetAccessPolicy":
return &Device.SetAccessPolicy{}, nil return &device.SetAccessPolicy{}, nil
case "CreateCertificate": case "CreateCertificate":
return &Device.CreateCertificate{}, nil return &device.CreateCertificate{}, nil
case "GetCertificates": case "GetCertificates":
return &Device.GetCertificates{}, nil return &device.GetCertificates{}, nil
case "GetCertificatesStatus": case "GetCertificatesStatus":
return &Device.GetCertificatesStatus{}, nil return &device.GetCertificatesStatus{}, nil
case "SetCertificatesStatus": case "SetCertificatesStatus":
return &Device.SetCertificatesStatus{}, nil return &device.SetCertificatesStatus{}, nil
case "DeleteCertificates": case "DeleteCertificates":
return &Device.DeleteCertificates{}, nil return &device.DeleteCertificates{}, nil
case "GetPkcs10Request": case "GetPkcs10Request":
return &Device.GetPkcs10Request{}, nil return &device.GetPkcs10Request{}, nil
case "LoadCertificates": case "LoadCertificates":
return &Device.LoadCertificates{}, nil return &device.LoadCertificates{}, nil
case "GetClientCertificateMode": case "GetClientCertificateMode":
return &Device.GetClientCertificateMode{}, nil return &device.GetClientCertificateMode{}, nil
case "SetClientCertificateMode": case "SetClientCertificateMode":
return &Device.SetClientCertificateMode{}, nil return &device.SetClientCertificateMode{}, nil
case "GetRelayOutputs": case "GetRelayOutputs":
return &Device.GetRelayOutputs{}, nil return &device.GetRelayOutputs{}, nil
case "SetRelayOutputSettings": case "SetRelayOutputSettings":
return &Device.SetRelayOutputSettings{}, nil return &device.SetRelayOutputSettings{}, nil
case "SetRelayOutputState": case "SetRelayOutputState":
return &Device.SetRelayOutputState{}, nil return &device.SetRelayOutputState{}, nil
case "SendAuxiliaryCommand": case "SendAuxiliaryCommand":
return &Device.SendAuxiliaryCommand{}, nil return &device.SendAuxiliaryCommand{}, nil
case "GetCACertificates": case "GetCACertificates":
return &Device.GetCACertificates{}, nil return &device.GetCACertificates{}, nil
case "LoadCertificateWithPrivateKey": case "LoadCertificateWithPrivateKey":
return &Device.LoadCertificateWithPrivateKey{}, nil return &device.LoadCertificateWithPrivateKey{}, nil
case "GetCertificateInformation": case "GetCertificateInformation":
return &Device.GetCertificateInformation{}, nil return &device.GetCertificateInformation{}, nil
case "LoadCACertificates": case "LoadCACertificates":
return &Device.LoadCACertificates{}, nil return &device.LoadCACertificates{}, nil
case "CreateDot1XConfiguration": case "CreateDot1XConfiguration":
return &Device.CreateDot1XConfiguration{}, nil return &device.CreateDot1XConfiguration{}, nil
case "SetDot1XConfiguration": case "SetDot1XConfiguration":
return &Device.SetDot1XConfiguration{}, nil return &device.SetDot1XConfiguration{}, nil
case "GetDot1XConfiguration": case "GetDot1XConfiguration":
return &Device.GetDot1XConfiguration{}, nil return &device.GetDot1XConfiguration{}, nil
case "GetDot1XConfigurations": case "GetDot1XConfigurations":
return &Device.GetDot1XConfigurations{}, nil return &device.GetDot1XConfigurations{}, nil
case "DeleteDot1XConfiguration": case "DeleteDot1XConfiguration":
return &Device.DeleteDot1XConfiguration{}, nil return &device.DeleteDot1XConfiguration{}, nil
case "GetDot11Capabilities": case "GetDot11Capabilities":
return &Device.GetDot11Capabilities{}, nil return &device.GetDot11Capabilities{}, nil
case "GetDot11Status": case "GetDot11Status":
return &Device.GetDot11Status{}, nil return &device.GetDot11Status{}, nil
case "ScanAvailableDot11Networks": case "ScanAvailableDot11Networks":
return &Device.ScanAvailableDot11Networks{}, nil return &device.ScanAvailableDot11Networks{}, nil
case "GetSystemUris": case "GetSystemUris":
return &Device.GetSystemUris{}, nil return &device.GetSystemUris{}, nil
case "StartFirmwareUpgrade": case "StartFirmwareUpgrade":
return &Device.StartFirmwareUpgrade{}, nil return &device.StartFirmwareUpgrade{}, nil
case "StartSystemRestore": case "StartSystemRestore":
return &Device.StartSystemRestore{}, nil return &device.StartSystemRestore{}, nil
case "GetStorageConfigurations": case "GetStorageConfigurations":
return &Device.GetStorageConfigurations{}, nil return &device.GetStorageConfigurations{}, nil
case "CreateStorageConfiguration": case "CreateStorageConfiguration":
return &Device.CreateStorageConfiguration{}, nil return &device.CreateStorageConfiguration{}, nil
case "GetStorageConfiguration": case "GetStorageConfiguration":
return &Device.GetStorageConfiguration{}, nil return &device.GetStorageConfiguration{}, nil
case "SetStorageConfiguration": case "SetStorageConfiguration":
return &Device.SetStorageConfiguration{}, nil return &device.SetStorageConfiguration{}, nil
case "DeleteStorageConfiguration": case "DeleteStorageConfiguration":
return &Device.DeleteStorageConfiguration{}, nil return &device.DeleteStorageConfiguration{}, nil
case "GetGeoLocation": case "GetGeoLocation":
return &Device.GetGeoLocation{}, nil return &device.GetGeoLocation{}, nil
case "SetGeoLocation": case "SetGeoLocation":
return &Device.SetGeoLocation{}, nil return &device.SetGeoLocation{}, nil
case "DeleteGeoLocation": case "DeleteGeoLocation":
return &Device.DeleteGeoLocation{}, nil return &device.DeleteGeoLocation{}, nil
default: default:
return nil, errors.New("there is no such method in the Device service") return nil, errors.New("there is no such method in the Device service")
} }
} }
func getMediaStructByName(name string) (interface{}, error) { func getMediaStructByName(name string) (interface{}, error) {
switch name { switch name {
case "GetServiceCapabilities": case "GetServiceCapabilities":
return &Media.GetServiceCapabilities{}, nil return &media.GetServiceCapabilities{}, nil
case "GetVideoSources": case "GetVideoSources":
return &Media.GetVideoSources{}, nil return &media.GetVideoSources{}, nil
case "GetAudioSources": case "GetAudioSources":
return &Media.GetAudioSources{}, nil return &media.GetAudioSources{}, nil
case "GetAudioOutputs": case "GetAudioOutputs":
return &Media.GetAudioOutputs{}, nil return &media.GetAudioOutputs{}, nil
case "CreateProfile": case "CreateProfile":
return &Media.CreateProfile{}, nil return &media.CreateProfile{}, nil
case "GetProfile": case "GetProfile":
return &Media.GetProfile{}, nil return &media.GetProfile{}, nil
case "GetProfiles": case "GetProfiles":
return &Media.GetProfiles{}, nil return &media.GetProfiles{}, nil
case "AddVideoEncoderConfiguration": case "AddVideoEncoderConfiguration":
return &Media.AddVideoEncoderConfiguration{}, nil return &media.AddVideoEncoderConfiguration{}, nil
case "RemoveVideoEncoderConfiguration": case "RemoveVideoEncoderConfiguration":
return &Media.RemoveVideoEncoderConfiguration{}, nil return &media.RemoveVideoEncoderConfiguration{}, nil
case "AddVideoSourceConfiguration": case "AddVideoSourceConfiguration":
return &Media.AddVideoSourceConfiguration{}, nil return &media.AddVideoSourceConfiguration{}, nil
case "RemoveVideoSourceConfiguration": case "RemoveVideoSourceConfiguration":
return &Media.RemoveVideoSourceConfiguration{}, nil return &media.RemoveVideoSourceConfiguration{}, nil
case "AddAudioEncoderConfiguration": case "AddAudioEncoderConfiguration":
return &Media.AddAudioEncoderConfiguration{}, nil return &media.AddAudioEncoderConfiguration{}, nil
case "RemoveAudioEncoderConfiguration": case "RemoveAudioEncoderConfiguration":
return &Media.RemoveAudioEncoderConfiguration{}, nil return &media.RemoveAudioEncoderConfiguration{}, nil
case "AddAudioSourceConfiguration": case "AddAudioSourceConfiguration":
return &Media.AddAudioSourceConfiguration{}, nil return &media.AddAudioSourceConfiguration{}, nil
case "RemoveAudioSourceConfiguration": case "RemoveAudioSourceConfiguration":
return &Media.RemoveAudioSourceConfiguration{}, nil return &media.RemoveAudioSourceConfiguration{}, nil
case "AddPTZConfiguration": case "AddPTZConfiguration":
return &Media.AddPTZConfiguration{}, nil return &media.AddPTZConfiguration{}, nil
case "RemovePTZConfiguration": case "RemovePTZConfiguration":
return &Media.RemovePTZConfiguration{}, nil return &media.RemovePTZConfiguration{}, nil
case "AddVideoAnalyticsConfiguration": case "AddVideoAnalyticsConfiguration":
return &Media.AddVideoAnalyticsConfiguration{}, nil return &media.AddVideoAnalyticsConfiguration{}, nil
case "RemoveVideoAnalyticsConfiguration": case "RemoveVideoAnalyticsConfiguration":
return &Media.RemoveVideoAnalyticsConfiguration{}, nil return &media.RemoveVideoAnalyticsConfiguration{}, nil
case "AddMetadataConfiguration": case "AddMetadataConfiguration":
return &Media.AddMetadataConfiguration{}, nil return &media.AddMetadataConfiguration{}, nil
case "RemoveMetadataConfiguration": case "RemoveMetadataConfiguration":
return &Media.RemoveMetadataConfiguration{}, nil return &media.RemoveMetadataConfiguration{}, nil
case "AddAudioOutputConfiguration": case "AddAudioOutputConfiguration":
return &Media.AddAudioOutputConfiguration{}, nil return &media.AddAudioOutputConfiguration{}, nil
case "RemoveAudioOutputConfiguration": case "RemoveAudioOutputConfiguration":
return &Media.RemoveAudioOutputConfiguration{}, nil return &media.RemoveAudioOutputConfiguration{}, nil
case "AddAudioDecoderConfiguration": case "AddAudioDecoderConfiguration":
return &Media.AddAudioDecoderConfiguration{}, nil return &media.AddAudioDecoderConfiguration{}, nil
case "RemoveAudioDecoderConfiguration": case "RemoveAudioDecoderConfiguration":
return &Media.RemoveAudioDecoderConfiguration{}, nil return &media.RemoveAudioDecoderConfiguration{}, nil
case "DeleteProfile": case "DeleteProfile":
return &Media.DeleteProfile{}, nil return &media.DeleteProfile{}, nil
case "GetVideoSourceConfigurations": case "GetVideoSourceConfigurations":
return &Media.GetVideoSourceConfigurations{}, nil return &media.GetVideoSourceConfigurations{}, nil
case "GetVideoEncoderConfigurations": case "GetVideoEncoderConfigurations":
return &Media.GetVideoEncoderConfigurations{}, nil return &media.GetVideoEncoderConfigurations{}, nil
case "GetAudioSourceConfigurations": case "GetAudioSourceConfigurations":
return &Media.GetAudioSourceConfigurations{}, nil return &media.GetAudioSourceConfigurations{}, nil
case "GetAudioEncoderConfigurations": case "GetAudioEncoderConfigurations":
return &Media.GetAudioEncoderConfigurations{}, nil return &media.GetAudioEncoderConfigurations{}, nil
case "GetVideoAnalyticsConfigurations": case "GetVideoAnalyticsConfigurations":
return &Media.GetVideoAnalyticsConfigurations{}, nil return &media.GetVideoAnalyticsConfigurations{}, nil
case "GetMetadataConfigurations": case "GetMetadataConfigurations":
return &Media.GetMetadataConfigurations{}, nil return &media.GetMetadataConfigurations{}, nil
case "GetAudioOutputConfigurations": case "GetAudioOutputConfigurations":
return &Media.GetAudioOutputConfigurations{}, nil return &media.GetAudioOutputConfigurations{}, nil
case "GetAudioDecoderConfigurations": case "GetAudioDecoderConfigurations":
return &Media.GetAudioDecoderConfigurations{}, nil return &media.GetAudioDecoderConfigurations{}, nil
case "GetVideoSourceConfiguration": case "GetVideoSourceConfiguration":
return &Media.GetVideoSourceConfiguration{}, nil return &media.GetVideoSourceConfiguration{}, nil
case "GetVideoEncoderConfiguration": case "GetVideoEncoderConfiguration":
return &Media.GetVideoEncoderConfiguration{}, nil return &media.GetVideoEncoderConfiguration{}, nil
case "GetAudioSourceConfiguration": case "GetAudioSourceConfiguration":
return &Media.GetAudioSourceConfiguration{}, nil return &media.GetAudioSourceConfiguration{}, nil
case "GetAudioEncoderConfiguration": case "GetAudioEncoderConfiguration":
return &Media.GetAudioEncoderConfiguration{}, nil return &media.GetAudioEncoderConfiguration{}, nil
case "GetVideoAnalyticsConfiguration": case "GetVideoAnalyticsConfiguration":
return &Media.GetVideoAnalyticsConfiguration{}, nil return &media.GetVideoAnalyticsConfiguration{}, nil
case "GetMetadataConfiguration": case "GetMetadataConfiguration":
return &Media.GetMetadataConfiguration{}, nil return &media.GetMetadataConfiguration{}, nil
case "GetAudioOutputConfiguration": case "GetAudioOutputConfiguration":
return &Media.GetAudioOutputConfiguration{},nil return &media.GetAudioOutputConfiguration{}, nil
case "GetAudioDecoderConfiguration": case "GetAudioDecoderConfiguration":
return &Media.GetAudioDecoderConfiguration{}, nil return &media.GetAudioDecoderConfiguration{}, nil
case "GetCompatibleVideoEncoderConfigurations": case "GetCompatibleVideoEncoderConfigurations":
return &Media.GetCompatibleVideoEncoderConfigurations{}, nil return &media.GetCompatibleVideoEncoderConfigurations{}, nil
case "GetCompatibleVideoSourceConfigurations": case "GetCompatibleVideoSourceConfigurations":
return &Media.GetCompatibleVideoSourceConfigurations{}, nil return &media.GetCompatibleVideoSourceConfigurations{}, nil
case "GetCompatibleAudioEncoderConfigurations": case "GetCompatibleAudioEncoderConfigurations":
return &Media.GetCompatibleAudioEncoderConfigurations{}, nil return &media.GetCompatibleAudioEncoderConfigurations{}, nil
case "GetCompatibleAudioSourceConfigurations": case "GetCompatibleAudioSourceConfigurations":
return &Media.GetCompatibleAudioSourceConfigurations{}, nil return &media.GetCompatibleAudioSourceConfigurations{}, nil
case "GetCompatibleVideoAnalyticsConfigurations": case "GetCompatibleVideoAnalyticsConfigurations":
return &Media.GetCompatibleVideoAnalyticsConfigurations{}, nil return &media.GetCompatibleVideoAnalyticsConfigurations{}, nil
case "GetCompatibleMetadataConfigurations": case "GetCompatibleMetadataConfigurations":
return &Media.GetCompatibleMetadataConfigurations{}, nil return &media.GetCompatibleMetadataConfigurations{}, nil
case "GetCompatibleAudioOutputConfigurations": case "GetCompatibleAudioOutputConfigurations":
return &Media.GetCompatibleAudioOutputConfigurations{}, nil return &media.GetCompatibleAudioOutputConfigurations{}, nil
case "GetCompatibleAudioDecoderConfigurations": case "GetCompatibleAudioDecoderConfigurations":
return &Media.GetCompatibleAudioDecoderConfigurations{}, nil return &media.GetCompatibleAudioDecoderConfigurations{}, nil
case "SetVideoSourceConfiguration": case "SetVideoSourceConfiguration":
return &Media.SetVideoSourceConfiguration{}, nil return &media.SetVideoSourceConfiguration{}, nil
case "SetVideoEncoderConfiguration": case "SetVideoEncoderConfiguration":
return &Media.SetVideoEncoderConfiguration{}, nil return &media.SetVideoEncoderConfiguration{}, nil
case "SetAudioSourceConfiguration": case "SetAudioSourceConfiguration":
return &Media.SetAudioSourceConfiguration{}, nil return &media.SetAudioSourceConfiguration{}, nil
case "SetAudioEncoderConfiguration": case "SetAudioEncoderConfiguration":
return &Media.SetAudioEncoderConfiguration{}, nil return &media.SetAudioEncoderConfiguration{}, nil
case "SetVideoAnalyticsConfiguration": case "SetVideoAnalyticsConfiguration":
return &Media.SetVideoAnalyticsConfiguration{}, nil return &media.SetVideoAnalyticsConfiguration{}, nil
case "SetMetadataConfiguration": case "SetMetadataConfiguration":
return &Media.SetMetadataConfiguration{}, nil return &media.SetMetadataConfiguration{}, nil
case "SetAudioOutputConfiguration": case "SetAudioOutputConfiguration":
return &Media.SetAudioOutputConfiguration{}, nil return &media.SetAudioOutputConfiguration{}, nil
case "SetAudioDecoderConfiguration": case "SetAudioDecoderConfiguration":
return &Media.SetAudioDecoderConfiguration{}, nil return &media.SetAudioDecoderConfiguration{}, nil
case "GetVideoSourceConfigurationOptions": case "GetVideoSourceConfigurationOptions":
return &Media.GetVideoSourceConfigurationOptions{}, nil return &media.GetVideoSourceConfigurationOptions{}, nil
case "GetVideoEncoderConfigurationOptions": case "GetVideoEncoderConfigurationOptions":
return &Media.GetVideoEncoderConfigurationOptions{}, nil return &media.GetVideoEncoderConfigurationOptions{}, nil
case "GetAudioSourceConfigurationOptions": case "GetAudioSourceConfigurationOptions":
return &Media.GetAudioSourceConfigurationOptions{}, nil return &media.GetAudioSourceConfigurationOptions{}, nil
case "GetAudioEncoderConfigurationOptions": case "GetAudioEncoderConfigurationOptions":
return &Media.GetAudioEncoderConfigurationOptions{}, nil return &media.GetAudioEncoderConfigurationOptions{}, nil
case "GetMetadataConfigurationOptions": case "GetMetadataConfigurationOptions":
return &Media.GetMetadataConfigurationOptions{}, nil return &media.GetMetadataConfigurationOptions{}, nil
case "GetAudioOutputConfigurationOptions": case "GetAudioOutputConfigurationOptions":
return &Media.GetAudioOutputConfigurationOptions{}, nil return &media.GetAudioOutputConfigurationOptions{}, nil
case "GetAudioDecoderConfigurationOptions": case "GetAudioDecoderConfigurationOptions":
return &Media.GetAudioDecoderConfigurationOptions{}, nil return &media.GetAudioDecoderConfigurationOptions{}, nil
case "GetGuaranteedNumberOfVideoEncoderInstances": case "GetGuaranteedNumberOfVideoEncoderInstances":
return &Media.GetGuaranteedNumberOfVideoEncoderInstances{}, nil return &media.GetGuaranteedNumberOfVideoEncoderInstances{}, nil
case "GetStreamUri": case "GetStreamUri":
return &Media.GetStreamUri{}, nil return &media.GetStreamUri{}, nil
case "StartMulticastStreaming": case "StartMulticastStreaming":
return &Media.StartMulticastStreaming{}, nil return &media.StartMulticastStreaming{}, nil
case "StopMulticastStreaming": case "StopMulticastStreaming":
return &Media.StopMulticastStreaming{}, nil return &media.StopMulticastStreaming{}, nil
case "SetSynchronizationPoint": case "SetSynchronizationPoint":
return &Media.SetSynchronizationPoint{}, nil return &media.SetSynchronizationPoint{}, nil
case "GetSnapshotUri": case "GetSnapshotUri":
return &Media.GetSnapshotUri{}, nil return &media.GetSnapshotUri{}, nil
case "GetVideoSourceModes": case "GetVideoSourceModes":
return &Media.GetVideoSourceModes{}, nil return &media.GetVideoSourceModes{}, nil
case "SetVideoSourceMode": case "SetVideoSourceMode":
return &Media.SetVideoSourceMode{}, nil return &media.SetVideoSourceMode{}, nil
case "GetOSDs": case "GetOSDs":
return &Media.GetOSDs{}, nil return &media.GetOSDs{}, nil
case "GetOSD": case "GetOSD":
return &Media.GetOSD{}, nil return &media.GetOSD{}, nil
case "GetOSDOptions": case "GetOSDOptions":
return &Media.GetOSDOptions{}, nil return &media.GetOSDOptions{}, nil
case "SetOSD": case "SetOSD":
return &Media.SetOSD{}, nil return &media.SetOSD{}, nil
case "CreateOSD": case "CreateOSD":
return &Media.CreateOSD{}, nil return &media.CreateOSD{}, nil
case "DeleteOSD": case "DeleteOSD":
return &Media.DeleteOSD{}, nil return &media.DeleteOSD{}, nil
default: default:
return nil, errors.New("there is no such method in the Media service") return nil, errors.New("there is no such method in the Media service")
} }
} }

4
doc.go
View File

@@ -1,2 +1,2 @@
//package goonvif is developed to provide an ONVIF client implementation on Go programming language //Package onvif is developed to provide an ONVIF client implementation on Go programming language
package goonvif package onvif

View File

@@ -6,10 +6,10 @@ import (
"log" "log"
"net/http" "net/http"
"github.com/use-go/goonvif" goonvif "github.com/use-go/onvif"
"github.com/use-go/goonvif/device" "github.com/use-go/onvif/device"
"github.com/use-go/goonvif/xsd/onvif" "github.com/use-go/onvif/gosoap"
"github.com/yakovlevdmv/gosoap" "github.com/use-go/onvif/xsd/onvif"
) )
const ( const (
@@ -62,7 +62,7 @@ func main() {
log.Println(err) log.Println(err)
} else { } else {
/* /*
You could use https://github.com/yakovlevdmv/gosoap for pretty printing response You could use https://github.com/use-go/onvif/gosoap for pretty printing response
*/ */
fmt.Println(gosoap.SoapMessage(readResponse(createUserResponse)).StringIndent()) fmt.Println(gosoap.SoapMessage(readResponse(createUserResponse)).StringIndent())
} }