52 Commits

Author SHA1 Message Date
Cedric Verstraeten
bb5a87b253 Merge remote-tracking branch 'upstream/master' 2023-12-06 19:45:28 +01:00
Edward
217f1231c5 Merge pull request #38 from sunjirui/imaging-setting-change
The Parameters in ImagingSettings20 becomes optional
2023-09-21 14:52:22 +08:00
Cedric Verstraeten
7903bf2710 makes presets an array, we have more than a single preset 2023-08-30 11:01:24 +02:00
Cedric Verstraeten
c037b63bad Fix for ONVIF preset (json) 2023-08-24 12:36:15 +02:00
sunjirui
b424ee7bfe changed ImagingSettings20 2023-08-07 19:18:45 +08:00
Edward
88cd86f4fc Merge pull request #31 from stefan-kiss/ptz-profiles-fix
changed Preset field to slice in GetPresetsResponse
2023-05-02 02:11:51 +08:00
Edward
03ecb66210 Merge pull request #27 from tarancss/fix-memleak-and-events
Fix memory leak and events
2023-05-02 02:10:33 +08:00
Cédric Verstraeten
23e1c0b1bc Update onvif.go 2023-01-25 14:10:53 +01:00
Cedric Verstraeten
9d65ca2b49 add new types for independent zoom and pan tilt 2022-12-23 08:55:22 +01:00
Kiss Stefan
5c4360a924 changed Preset field to slice in GetPresetsResponse 2022-12-11 14:00:19 +02:00
tarancss
1a23395c53 remove debug logs 2022-09-17 01:24:52 +02:00
tarancss
8677b3be7e fix memory leak and events 2022-09-17 01:18:56 +02:00
tarancss
4f0536a933 fix subscribe response 2022-08-14 18:15:33 +02:00
Edward
bc3226e9ec Merge pull request #22 from jfsmig/fixes-ws-discovery-20220510
Misc. fixes in the WS discovery
2022-07-26 14:39:05 +08:00
Edward
d8d0fc383a Merge pull request #21 from spring-lab/master
fix ptz.types.SetPreset.PresetToken is optional
2022-07-26 14:31:40 +08:00
Jean-Francois Smigielski
9e25a0109e api: use juju/errors and zerolog 2022-05-11 10:05:57 +02:00
Jean-Francois Smigielski
47d91cba88 networking: use juju/errors and zerolog 2022-05-11 10:05:57 +02:00
Jean-Francois Smigielski
72a3540cc3 Let the example code use the generated SDK methods
Also introduces zerolog for pretty traces and juju/errors to annotate the errors
and track their origin.
2022-05-11 10:05:57 +02:00
Jean-Francois Smigielski
7d78e6b76e Provide a sdk package with 1 call per method
Modify the template in ./sdk/codegen/main.go

Use "go generate" from ./sdk/{ptz,media,device} to regenerate the files.
2022-05-11 10:05:57 +02:00
Jean-Francois Smigielski
6f1154fc4d ws-discovery: Return an error instead of printing & ignoring 2022-05-10 13:21:27 +02:00
Jean-Francois Smigielski
9b5df9ac2c Avoid non-error debug on stdout 2022-05-09 09:13:30 +02:00
Jean-Francois Smigielski
2569cf83bf Use a random ssource port in ws-discovery 2022-05-09 00:58:06 +02:00
Spring
be3347f029 fix ptz.types.SetPreset.PresetToken is optional 2022-04-24 09:53:18 +08:00
Edward
d42cc336c6 Merge pull request #19 from use-go/dependabot/go_modules/github.com/gin-gonic/gin-1.7.0
Bump github.com/gin-gonic/gin from 1.6.2 to 1.7.0
2022-03-23 12:44:13 +08:00
dependabot[bot]
9bf3bd8446 Bump github.com/gin-gonic/gin from 1.6.2 to 1.7.0
Bumps [github.com/gin-gonic/gin](https://github.com/gin-gonic/gin) from 1.6.2 to 1.7.0.
- [Release notes](https://github.com/gin-gonic/gin/releases)
- [Changelog](https://github.com/gin-gonic/gin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gin-gonic/gin/compare/v1.6.2...v1.7.0)

---
updated-dependencies:
- dependency-name: github.com/gin-gonic/gin
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-23 04:42:17 +00:00
Edward
33a083305c Merge pull request #18 from yjkhtddx/master
more services
2022-03-23 12:40:56 +08:00
Edward
2c358f683b Merge pull request #11 from GreenLightning/fix
Fix panic during SendProbe
2022-03-23 12:40:15 +08:00
刘跃龙
1bfeb9b57d fix:get Extension services 2021-10-25 10:59:11 +08:00
刘跃龙
c5e512ad1a fix:get Extension services 2021-10-25 10:55:46 +08:00
Green Lightning
07eeae0187 Fix panic during SendProbe
If ListenPacket returns an error, c is nil and the deferred call to
c.Close() will panic.

Fix this by returning early from the method.
2021-07-26 14:22:05 +02:00
cedricve
37d8a71395 rename imports 2021-06-04 21:51:49 +02:00
Edward
af24622015 Merge pull request #8 from kikimor/http_custom
External httpClient support
2021-04-24 11:15:02 +08:00
kikimor
2fb044d81c endpoint nat support 2021-03-06 23:56:46 +05:00
kikimor
51ae55e8a0 External httpClient support 2021-02-24 21:58:44 +05:00
eamon
6a2c796805 fix case 2021-01-31 16:12:54 +08:00
Edward
48daf5acb5 Rename license to LICENSE 2021-01-31 16:01:46 +08:00
Edward
d85a0742b9 Create license 2021-01-31 16:00:28 +08:00
Edward
24a85afc84 Merge pull request #4 from GreenLightning/master
Do not log "i/o timeout" errors
2021-01-29 19:37:38 +08:00
Green Lightning
c8ac58ebd7 Require Go 1.15 2020-10-23 11:51:21 +02:00
Green Lightning
4ec21b20e0 Do not log "i/o timeout" errors 2020-10-21 00:09:00 +02:00
Edward
4e696ec65a Merge pull request #3 from GreenLightning/fix-auth
Fix authentication
2020-08-17 18:39:23 +08:00
Green Lightning
e1345d5e6b Fix authentication
Because time.Now() is called twice, it may return different results on a
slow machine, causing an invalid authentication header to be generated.
2020-08-16 17:31:35 +02:00
Edward
918ce541d2 Update README.md 2020-05-26 10:39:28 +08:00
Edward
15e268c1b7 Update README.md 2020-05-09 16:06:23 +08:00
Edward
dce0d0faad add an example by testing 2020-05-01 22:58:49 +08:00
Edward
be84cab1fe add SendSoapWithTimeout 2020-05-01 22:58:33 +08:00
Edward
c10b8ca105 update mod 2020-05-01 22:42:53 +08:00
Edward
e6593ad04f introduce iso8601_duration directly 2020-05-01 22:42:40 +08:00
Edward
702fded39b Update README.md 2020-05-01 22:35:50 +08:00
Edward
298c2dabb9 Update README.md 2020-04-29 11:09:08 +08:00
Edward
bedd8886e4 Update README.md 2020-04-29 11:08:05 +08:00
Edward
ddb7588318 Update README.md 2020-04-29 11:07:53 +08:00
233 changed files with 7058 additions and 432 deletions

8
.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/onvif.iml" filepath="$PROJECT_DIR$/.idea/onvif.iml" />
</modules>
</component>
</project>

9
.idea/onvif.iml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

188
Device.go
View File

@@ -3,18 +3,18 @@ package onvif
import (
"encoding/xml"
"errors"
"fmt"
"io/ioutil"
"net/http"
"net/url"
"reflect"
"strconv"
"strings"
"github.com/beevik/etree"
"github.com/use-go/onvif/device"
"github.com/use-go/onvif/gosoap"
"github.com/use-go/onvif/networking"
wsdiscovery "github.com/use-go/onvif/ws-discovery"
"github.com/kerberos-io/onvif/device"
"github.com/kerberos-io/onvif/gosoap"
"github.com/kerberos-io/onvif/networking"
wsdiscovery "github.com/kerberos-io/onvif/ws-discovery"
)
//Xlmns XML Scheam
@@ -63,8 +63,8 @@ func (devType DeviceType) String() string {
}
}
//deviceInfo struct contains general information about ONVIF device
type deviceInfo struct {
//DeviceInfo struct contains general information about ONVIF device
type DeviceInfo struct {
Manufacturer string
Model string
FirmwareVersion string
@@ -72,15 +72,20 @@ type deviceInfo struct {
HardwareId string
}
//Device for a new device of onvif and deviceInfo
//Device for a new device of onvif and DeviceInfo
//struct represents an abstract ONVIF device.
//It contains methods, which helps to communicate with ONVIF device
type Device struct {
xaddr string
login string
password string
params DeviceParams
endpoints map[string]string
info deviceInfo
info DeviceInfo
}
type DeviceParams struct {
Xaddr string
Username string
Password string
HttpClient *http.Client
}
//GetServices return available endpoints
@@ -88,6 +93,11 @@ func (dev *Device) GetServices() map[string]string {
return dev.endpoints
}
//GetServices return available endpoints
func (dev *Device) GetDeviceInfo() DeviceInfo {
return dev.info
}
func readResponse(resp *http.Response) string {
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
@@ -97,111 +107,106 @@ func readResponse(resp *http.Response) string {
}
//GetAvailableDevicesAtSpecificEthernetInterface ...
func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) []Device {
/*
Call an ws-discovery Probe Message to Discover NVT type Devices
*/
devices := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:" + NVT.String()}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
func GetAvailableDevicesAtSpecificEthernetInterface(interfaceName string) ([]Device, error) {
// Call a ws-discovery Probe Message to Discover NVT type Devices
devices, err := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:" + NVT.String()}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
if err != nil {
return nil, err
}
nvtDevicesSeen := make(map[string]bool)
nvtDevices := make([]Device, 0)
////fmt.Println(devices)
for _, j := range devices {
doc := etree.NewDocument()
if err := doc.ReadFromString(j); err != nil {
fmt.Errorf("%s", err.Error())
return nil
return nil, err
}
////fmt.Println(j)
endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs")
for _, xaddr := range endpoints {
//fmt.Println(xaddr.Tag,strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2] )
for _, xaddr := range doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs") {
xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2]
fmt.Println(xaddr)
c := 0
for c = 0; c < len(nvtDevices); c++ {
if nvtDevices[c].xaddr == xaddr {
fmt.Println(nvtDevices[c].xaddr, "==", xaddr)
break
if !nvtDevicesSeen[xaddr] {
dev, err := NewDevice(DeviceParams{Xaddr: strings.Split(xaddr, " ")[0]})
if err != nil {
// TODO(jfsmig) print a warning
} else {
nvtDevicesSeen[xaddr] = true
nvtDevices = append(nvtDevices, *dev)
}
}
if c < len(nvtDevices) {
continue
}
dev, err := NewDevice(strings.Split(xaddr, " ")[0])
//fmt.Println(dev)
if err != nil {
fmt.Println("Error", xaddr)
fmt.Println(err)
continue
} else {
////fmt.Println(dev)
nvtDevices = append(nvtDevices, *dev)
}
}
////fmt.Println(j)
//nvtDevices[i] = NewDevice()
}
return nvtDevices
return nvtDevices, nil
}
func (dev *Device) getSupportedServices(resp *http.Response) {
//resp, err := dev.CallMethod(device.GetCapabilities{Category:"All"})
//if err != nil {
// log.Println(err.Error())
//return
//} else {
func (dev *Device) getSupportedServices(resp *http.Response) error {
doc := etree.NewDocument()
data, _ := ioutil.ReadAll(resp.Body)
data, err := ioutil.ReadAll(resp.Body)
if err != nil {
return err
}
resp.Body.Close()
if err := doc.ReadFromBytes(data); err != nil {
//log.Println(err.Error())
return
return err
}
services := doc.FindElements("./Envelope/Body/GetCapabilitiesResponse/Capabilities/*/XAddr")
for _, j := range services {
////fmt.Println(j.Text())
////fmt.Println(j.Parent().Tag)
dev.addEndpoint(j.Parent().Tag, j.Text())
}
//}
extension_services := doc.FindElements("./Envelope/Body/GetCapabilitiesResponse/Capabilities/Extension/*/XAddr")
for _, j := range extension_services {
dev.addEndpoint(j.Parent().Tag, j.Text())
}
return nil
}
//NewDevice function construct a ONVIF Device entity
func NewDevice(xaddr string) (*Device, error) {
func NewDevice(params DeviceParams) (*Device, error) {
dev := new(Device)
dev.xaddr = xaddr
dev.params = params
dev.endpoints = make(map[string]string)
dev.addEndpoint("Device", "http://"+xaddr+"/onvif/device_service")
dev.addEndpoint("Device", "http://"+dev.params.Xaddr+"/onvif/device_service")
if dev.params.HttpClient == nil {
dev.params.HttpClient = new(http.Client)
}
getCapabilities := device.GetCapabilities{Category: "All"}
resp, err := dev.CallMethod(getCapabilities)
//fmt.Println(resp.Request.Host)
//fmt.Println(readResponse(resp))
if err != nil || resp.StatusCode != http.StatusOK {
//panic(errors.New("camera is not available at " + xaddr + " or it does not support ONVIF services"))
return nil, errors.New("camera is not available at " + xaddr + " or it does not support ONVIF services")
return nil, errors.New("camera is not available at " + dev.params.Xaddr + " or it does not support ONVIF services")
}
err = dev.getSupportedServices(resp)
if err != nil {
return nil, err
}
dev.getSupportedServices(resp)
return dev, nil
}
func (dev *Device) addEndpoint(Key, Value string) {
//use lowCaseKey
//make key having ability to handle Mixed Case for Different vendor devcie (e.g. Events EVENTS, events)
lowCaseKey := strings.ToLower(Key)
dev.endpoints[lowCaseKey] = Value
}
//Authenticate function authenticate client in the ONVIF device.
//Function takes <username> and <password> params.
//You should use this function to allow authorized requests to the ONVIF Device
//To change auth data call this function again.
func (dev *Device) Authenticate(username, password string) {
dev.login = username
dev.password = password
// Replace host with host from device params.
if u, err := url.Parse(Value); err == nil {
u.Host = dev.params.Xaddr
Value = u.String()
}
dev.endpoints[lowCaseKey] = Value
}
//GetEndpoint returns specific ONVIF service endpoint address
@@ -209,7 +214,7 @@ func (dev *Device) GetEndpoint(name string) string {
return dev.endpoints[name]
}
func buildMethodSOAP(msg string) (gosoap.SoapMessage, error) {
func (dev Device) buildMethodSOAP(msg string) (gosoap.SoapMessage, error) {
doc := etree.NewDocument()
if err := doc.ReadFromString(msg); err != nil {
//log.Println("Got error")
@@ -220,7 +225,6 @@ func buildMethodSOAP(msg string) (gosoap.SoapMessage, error) {
soap := gosoap.NewEmptySOAP()
soap.AddBodyContent(element)
//soap.AddRootNamespace("onvif", "http://www.onvif.org/ver10/device/wsdl")
return soap, nil
}
@@ -261,41 +265,23 @@ func (dev Device) CallMethod(method interface{}) (*http.Response, error) {
//CallMethod functions call an method, defined <method> struct with authentication data
func (dev Device) callMethodDo(endpoint string, method interface{}) (*http.Response, error) {
/*
Converting <method> struct to xml string representation
*/
output, err := xml.MarshalIndent(method, " ", " ")
if err != nil {
//log.Printf("error: %v\n", err.Error())
return nil, err
}
//fmt.Println(gosoap.SoapMessage(string(output)).StringIndent())
/*
Build an SOAP request with <method>
*/
soap, err := buildMethodSOAP(string(output))
soap, err := dev.buildMethodSOAP(string(output))
if err != nil {
//log.Printf("error: %v\n", err.Error())
return nil, err
}
//fmt.Println(soap.StringIndent())
/*
Adding namespaces and WS-Security headers
*/
soap.AddRootNamespaces(Xlmns)
//fmt.Println(soap.StringIndent())
//Header handling
soap.AddAction()
//Auth Handling
if dev.login != "" && dev.password != "" {
soap.AddWSSecurity(dev.login, dev.password)
if dev.params.Username != "" && dev.params.Password != "" {
soap.AddWSSecurity(dev.params.Username, dev.params.Password)
}
//fmt.Println(soap.StringIndent())
/*
Sending request and returns the response
*/
return networking.SendSoap(endpoint, soap.String())
return networking.SendSoap(dev.params.HttpClient, endpoint, soap.String())
}

View File

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

21
LICENSE Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Yakovlev Dmitry, Zhorzh Palanjyan,Crazybber
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,52 +1,54 @@
# onvif[golang]
# ONVIF protocol
Simple management of onvif IP-devices cameras. onvif is an implementation of ONVIF protocol for managing onvif IP devices. The purpose of this library is convenient and easy management of IP cameras and other devices that support ONVIF standard.
Simple management of onvif IP-devices cameras. onvif is an implementation of ONVIF protocol for managing onvif IP devices. The purpose of this library is convenient and easy management of IP cameras and other devices that support ONVIF standard.
## Installation
To install the library, use **go get**:
To install the library, use **go get**:
```go
go get github.com/use-go/onvif
go get github.com/kerberos-io/onvif
```
## Supported services
The following services are fully implemented:
The following services are implemented:
- Device
- Media
- PTZ
- Imaging
- Event
- Discovery
- Auth(More Options)
- Soap
## Using
### General concept
1) Connecting to the device
2) Authentication (if necessary)
3) Defining Data Types
4) Carrying out the required method
1. Connecting to the device
2. Authentication (if necessary)
3. Defining Data Types
4. Carrying out the required method
#### Connecting to the device
If there is a device on the network at the address *192.168.13.42*, and its ONVIF services use the *1234* port, then you can connect to the device in the following way:
If there is a device on the network at the address _192.168.13.42_, and its ONVIF services use the _1234_ port, then you can connect to the device in the following way:
```go
dev, err := onvif.NewDevice("192.168.13.42:1234")
dev, err := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234"})
```
*The ONVIF port may differ depending on the device , to find out which port to use, you can go to the web interface of the device. **Usually this is 80 port.***
\*The ONVIF port may differ depending on the device , to find out which port to use, you can go to the web interface of the device. **Usually this is 80 port.\***
#### Authentication
If any function of the ONVIF services requires authentication, you must use the `Authenticate` method.
```go
device := onvif.NewDevice("192.168.13.42:1234")
device.Authenticate("username", "password")
device := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234", Username: "username", Password: password})
```
#### Defining Data Types
@@ -73,7 +75,7 @@ The figure below shows that `GetServiceCapabilities` does not accept any argumen
![PTZ GetServiceCapabilities](docs/img/GetServiceCapabilities.png)
*Common data types are in the xsd/onvif package. The types of data (structures) that can be shared by all services are defined in the onvif package.*
_Common data types are in the xsd/onvif package. The types of data (structures) that can be shared by all services are defined in the onvif package._
An example of how to define the data type of the CreateUsers function in [Devicemgmt](https://www.onvif.org/ver10/device/wsdl/devicemgmt.wsdl):
@@ -91,11 +93,11 @@ To perform any function of one of the ONVIF services whose structure has been de
```go
createUsers := device.CreateUsers{User: onvif.User{Username:"admin", Password:"qwerty", UserLevel:"User"}}
device := onvif.NewDevice("192.168.13.42:1234")
device := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.13.42:1234", Username: "username", Password: password})
device.Authenticate("username", "password")
resp, err := dev.CallMethod(createUsers)
```
## Great Thanks
Modified from: [goonvif](https://github.com/yakovlevdmv/goonvif)
Enhanced and Improved from: [goonvif](https://github.com/yakovlevdmv/goonvif)

View File

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

View File

@@ -1,21 +1,36 @@
package api
import (
"errors"
"fmt"
"io/ioutil"
"net/http"
"os"
"path"
"reflect"
"regexp"
"strings"
"time"
"github.com/juju/errors"
"github.com/rs/zerolog"
"github.com/beevik/etree"
"github.com/gin-gonic/gin"
"github.com/use-go/onvif"
"github.com/use-go/onvif/gosoap"
"github.com/use-go/onvif/networking"
wsdiscovery "github.com/use-go/onvif/ws-discovery"
"github.com/kerberos-io/onvif"
"github.com/kerberos-io/onvif/gosoap"
"github.com/kerberos-io/onvif/networking"
wsdiscovery "github.com/kerberos-io/onvif/ws-discovery"
)
var (
// LoggerContext is the builder of a zerolog.Logger that is exposed to the application so that
// options at the CLI might alter the formatting and the output of the logs.
LoggerContext = zerolog.
New(zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.RFC3339}).
With().Timestamp()
// Logger is a zerolog logger, that can be safely used from any part of the application.
// It gathers the format and the output.
Logger = LoggerContext.Logger()
)
func RunApi() {
@@ -32,7 +47,7 @@ func RunApi() {
xaddr := c.GetHeader("xaddr")
acceptedData, err := c.GetRawData()
if err != nil {
fmt.Println(err)
Logger.Debug().Err(err).Msg("Failed to get rawx data")
}
message, err := callNecessaryMethod(serviceName, methodName, string(acceptedData), username, pass, xaddr)
@@ -49,45 +64,45 @@ func RunApi() {
interfaceName := context.GetHeader("interface")
var response = "["
devices := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
devices, err := wsdiscovery.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
if err != nil {
context.String(http.StatusInternalServerError, "error")
} else {
response := "["
for _, j := range devices {
doc := etree.NewDocument()
if err := doc.ReadFromString(j); err != nil {
context.XML(http.StatusBadRequest, err.Error())
} else {
for _, j := range devices {
doc := etree.NewDocument()
if err := doc.ReadFromString(j); err != nil {
context.XML(http.StatusBadRequest, err.Error())
} else {
endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs")
scopes := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/Scopes")
endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs")
scopes := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/Scopes")
flag := false
flag := false
for _, xaddr := range endpoints {
xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2]
if strings.Contains(response, xaddr) {
flag = true
for _, xaddr := range endpoints {
xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2]
if strings.Contains(response, xaddr) {
flag = true
break
}
response += "{"
response += `"url":"` + xaddr + `",`
}
if flag {
break
}
response += "{"
response += `"url":"` + xaddr + `",`
for _, scope := range scopes {
re := regexp.MustCompile(`onvif:\/\/www\.onvif\.org\/name\/[A-Za-z0-9-]+`)
match := re.FindStringSubmatch(scope.Text())
response += `"name":"` + path.Base(match[0]) + `"`
}
response += "},"
}
if flag {
break
}
for _, scope := range scopes {
re := regexp.MustCompile(`onvif:\/\/www\.onvif\.org\/name\/[A-Za-z0-9-]+`)
match := re.FindStringSubmatch(scope.Text())
response += `"name":"` + path.Base(match[0]) + `"`
}
response += "},"
}
}
response = strings.TrimRight(response, ",")
response += "]"
if response != "" {
response = strings.TrimRight(response, ",")
response += "]"
context.String(http.StatusOK, response)
}
})
@@ -95,25 +110,6 @@ func RunApi() {
router.Run()
}
//func soapHandling(tp interface{}, tags* map[string]string) {
// ifaceValue := reflect.ValueOf(tp).Elem()
// typeOfStruct := ifaceValue.Type()
// if ifaceValue.Kind() != reflect.Struct {
// return
// }
// for i := 0; i < ifaceValue.NumField(); i++ {
// field := ifaceValue.Field(i)
// tg, err := typeOfStruct.FieldByName(typeOfStruct.Field(i).Name)
// if err == false {
// fmt.Println(err)
// }
// (*tags)[typeOfStruct.Field(i).Name] = string(tg.Tag)
//
// subStruct := reflect.New(reflect.TypeOf( field.Interface() ))
// soapHandling(subStruct.Interface(), tags)
// }
//}
func callNecessaryMethod(serviceName, methodName, acceptedData, username, password, xaddr string) (string, error) {
var methodStruct interface{}
var err error
@@ -129,17 +125,17 @@ func callNecessaryMethod(serviceName, methodName, acceptedData, username, passwo
return "", errors.New("there is no such service")
}
if err != nil { //done
return "", err
return "", errors.Annotate(err, "getStructByName")
}
resp, err := xmlAnalize(methodStruct, &acceptedData)
if err != nil {
return "", err
return "", errors.Annotate(err, "xmlAnalize")
}
endpoint, err := getEndpoint(serviceName, xaddr)
if err != nil {
return "", err
return "", errors.Annotate(err, "getEndpoint")
}
soap := gosoap.NewEmptySOAP()
@@ -147,23 +143,25 @@ func callNecessaryMethod(serviceName, methodName, acceptedData, username, passwo
soap.AddRootNamespaces(onvif.Xlmns)
soap.AddWSSecurity(username, password)
servResp, err := networking.SendSoap(endpoint, soap.String())
servResp, err := networking.SendSoap(new(http.Client), endpoint, soap.String())
if err != nil {
return "", err
return "", errors.Annotate(err, "SendSoap")
}
rsp, err := ioutil.ReadAll(servResp.Body)
if err != nil {
return "", err
return "", errors.Annotate(err, "ReadAll")
}
servResp.Body.Close()
return string(rsp), nil
}
func getEndpoint(service, xaddr string) (string, error) {
dev, err := onvif.NewDevice(xaddr)
dev, err := onvif.NewDevice(onvif.DeviceParams{Xaddr: xaddr})
if err != nil {
return "", err
return "", errors.Annotate(err, "NewDevice")
}
pkg := strings.ToLower(service)
@@ -193,7 +191,7 @@ func xmlAnalize(methodStruct interface{}, acceptedData *string) (*string, error)
doc := etree.NewDocument()
if err := doc.ReadFromString(*acceptedData); err != nil {
return nil, err
return nil, errors.Annotate(err, "readFromString")
}
etr := doc.FindElements("./*")
xmlUnmarshal(etr, &testunMarshal, &mas)
@@ -207,7 +205,7 @@ func xmlAnalize(methodStruct interface{}, acceptedData *string) (*string, error)
lst := (testunMarshal)[lstIndex]
elemName, attr, value, err := xmlMaker(&lst, &test, lstIndex)
if err != nil {
return nil, err
return nil, errors.Annotate(err, "xmlMarker")
}
if mas[lstIndex] == "Push" && lstIndex == 0 { //done
@@ -251,10 +249,10 @@ func xmlAnalize(methodStruct interface{}, acceptedData *string) (*string, error)
resp, err := document.WriteToString()
if err != nil {
return nil, err
return nil, errors.Annotate(err, "writeToString")
}
return &resp, err
return &resp, nil
}
func xmlMaker(lst *[]interface{}, tags *[]map[string]string, lstIndex int) (string, map[string]string, string, error) {
@@ -273,13 +271,13 @@ func xmlMaker(lst *[]interface{}, tags *[]map[string]string, lstIndex int) (stri
if index == 0 && lstIndex == 0 {
res, err := xmlProcessing(tg["XMLName"])
if err != nil {
return "", nil, "", err
return "", nil, "", errors.Annotate(err, "xmlProcessing")
}
elemName = res
} else if index == 0 {
res, err := xmlProcessing(tg[conversion])
if err != nil {
return "", nil, "", err
return "", nil, "", errors.Annotate(err, "xmlProcessing")
}
elemName = res
} else {
@@ -314,8 +312,6 @@ func xmlProcessing(tg string) (string, error) {
} else {
return str[1][0:omitAttr], nil
}
return "", errors.New("something went wrong")
}
func mapProcessing(mapVar []map[string]string) []map[string]string {
@@ -343,9 +339,9 @@ func soapHandling(tp interface{}, tags *[]map[string]string) {
}
for i := 0; i < s.NumField(); i++ {
f := s.Field(i)
tmp, err := typeOfT.FieldByName(typeOfT.Field(i).Name)
if err == false {
fmt.Println(err)
tmp, ok := typeOfT.FieldByName(typeOfT.Field(i).Name)
if !ok {
Logger.Debug().Str("field", typeOfT.Field(i).Name).Msg("reflection failed")
}
*tags = append(*tags, map[string]string{typeOfT.Field(i).Name: string(tmp.Tag)})
subStruct := reflect.New(reflect.TypeOf(f.Interface()))

View File

@@ -3,9 +3,9 @@ package api
import (
"errors"
"github.com/use-go/onvif/device"
"github.com/use-go/onvif/media"
"github.com/use-go/onvif/ptz"
"github.com/kerberos-io/onvif/device"
"github.com/kerberos-io/onvif/media"
"github.com/kerberos-io/onvif/ptz"
)
func getPTZStructByName(name string) (interface{}, error) {

View File

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

View File

@@ -1,7 +1,7 @@
package event
import (
"github.com/use-go/onvif/xsd"
"github.com/kerberos-io/onvif/xsd"
)
//GetServiceCapabilities action
@@ -21,18 +21,18 @@ type SubscriptionPolicy struct { //tev http://www.onvif.org/ver10/events/wsdl
//Subscribe action for subscribe event topic
type Subscribe struct { //http://docs.oasis-open.org/wsn/b-2.xsd
XMLName struct{} `xml:"wsnt:Subscribe"`
ConsumerReference EndpointReferenceType `xml:"wsnt:ConsumerReference"`
Filter FilterType `xml:"wsnt:Filter"`
SubscriptionPolicy SubscriptionPolicy `xml:"wsnt:SubscriptionPolicy"`
InitialTerminationTime TerminationTime `xml:"wsnt:InitialTerminationTime"`
XMLName struct{} `xml:"wsnt:Subscribe"`
ConsumerReference EndpointReferenceType `xml:"wsnt:ConsumerReference"`
Filter FilterType `xml:"wsnt:Filter"`
SubscriptionPolicy SubscriptionPolicy `xml:"wsnt:SubscriptionPolicy"`
InitialTerminationTime AbsoluteOrRelativeTimeType `xml:"wsnt:InitialTerminationTime"`
}
//SubscribeResponse message for subscribe event topic
type SubscribeResponse struct { //http://docs.oasis-open.org/wsn/b-2.xsd
ConsumerReference EndpointReferenceType `xml:"wsnt:ConsumerReference"`
CurrentTime CurrentTime `xml:"wsnt:CurrentTime"`
TerminationTime TerminationTime `xml:"wsnt:TerminationTime"`
SubscriptionReference EndpointReferenceType
CurrentTime CurrentTime
TerminationTime TerminationTime
}
//Renew action for refresh event topic subscription
@@ -57,7 +57,6 @@ type UnsubscribeResponse struct { //http://docs.oasis-open.org/wsn/b-2.xsd
}
//CreatePullPointSubscription action
//BUG(r) Bad AbsoluteOrRelativeTimeType type
type CreatePullPointSubscription struct {
XMLName string `xml:"tev:CreatePullPointSubscription"`
Filter FilterType `xml:"tev:Filter"`

View File

@@ -1,45 +1,57 @@
package event
import (
"github.com/use-go/onvif/xsd"
"github.com/kerberos-io/onvif/xsd"
"github.com/kerberos-io/onvif/xsd/onvif"
)
//Address Alias
// Address Alias
type Address xsd.String
//CurrentTime alias
// CurrentTime alias
type CurrentTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//TerminationTime alias
// TerminationTime alias
type TerminationTime xsd.DateTime //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//FixedTopicSet alias
// FixedTopicSet alias
type FixedTopicSet xsd.Boolean //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//Documentation alias
// Documentation alias
type Documentation xsd.AnyType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
//TopicExpressionDialect alias
// TopicExpressionDialect alias
type TopicExpressionDialect xsd.AnyURI
//Message alias
// 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
xsd.DateTime
xsd.Duration
// MessageNotification alias
type MessageNotification struct {
Message MessageNotificationHolderType
}
//EndpointReferenceType in ws-addr
type MessageNotificationHolderType struct {
UtcTime xsd.DateTime `xml:",attr"`
PropertyOperation xsd.String `xml:",attr"`
Source onvif.SimpleItem `xml:"Source>SimpleItem"`
Data onvif.SimpleItem `xml:"Data>SimpleItem"`
}
// 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 xsd.AnySimpleType //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
// EndpointReferenceType in ws-addr
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"`
Address AttributedURIType
ReferenceParameters ReferenceParametersType
Metadata MetadataType
}
// FilterType struct
@@ -48,74 +60,74 @@ type FilterType struct {
MessageContent QueryExpressionType `xml:"wsnt:MessageContent"`
}
//EndpointReference alais
// EndpointReference alais
type EndpointReference EndpointReferenceType
//ReferenceParametersType in ws-addr
// 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
// Metadata in ws-addr
type Metadata MetadataType //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//MetadataType in ws-addr
// MetadataType in ws-addr
type MetadataType struct { //wsa https://www.w3.org/2005/08/addressing/ws-addr.xsd
//Here can be anyAttribute
}
//TopicSet alias
// TopicSet alias
type TopicSet TopicSetType //wstop http://docs.oasis-open.org/wsn/t-1.xsd
//TopicSetType alias
// TopicSetType alias
type TopicSetType struct { //wstop http://docs.oasis-open.org/wsn/t-1.xsd
ExtensibleDocumented
//here can be any element
}
//ExtensibleDocumented struct
// 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
// ProducerReference Alias
type ProducerReference EndpointReferenceType
//SubscriptionReference Alias
// SubscriptionReference Alias
type SubscriptionReference EndpointReferenceType
//NotificationMessageHolderType Alias
// NotificationMessageHolderType Alias
type NotificationMessageHolderType struct {
SubscriptionReference SubscriptionReference //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
Topic Topic
ProducerReference ProducerReference
Message Message
Message MessageNotification
}
//NotificationMessage Alias
// NotificationMessage Alias
type NotificationMessage NotificationMessageHolderType //wsnt http://docs.oasis-open.org/wsn/b-2.xsd
//QueryExpressionType struct for wsnt:MessageContent
// 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
// MessageContentType Alias
type MessageContentType QueryExpressionType
//QueryExpression Alias
// QueryExpression Alias
type QueryExpression QueryExpressionType
//TopicExpressionType struct for wsnt:TopicExpression
// 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
// Topic Alias
type Topic TopicExpressionType
// Capabilities of event
@@ -128,50 +140,50 @@ type Capabilities struct { //tev
PersistentNotificationStorage xsd.Boolean `xml:"PersistentNotificationStorage,attr"`
}
//ResourceUnknownFault response type
// ResourceUnknownFault response type
type ResourceUnknownFault struct {
}
//InvalidFilterFault response type
// InvalidFilterFault response type
type InvalidFilterFault struct {
}
//TopicExpressionDialectUnknownFault response type
// TopicExpressionDialectUnknownFault response type
type TopicExpressionDialectUnknownFault struct {
}
//InvalidTopicExpressionFault response type
// InvalidTopicExpressionFault response type
type InvalidTopicExpressionFault struct {
}
//TopicNotSupportedFault response type
// TopicNotSupportedFault response type
type TopicNotSupportedFault struct {
}
//InvalidProducerPropertiesExpressionFault response type
// InvalidProducerPropertiesExpressionFault response type
type InvalidProducerPropertiesExpressionFault struct {
}
//InvalidMessageContentExpressionFault response type
// InvalidMessageContentExpressionFault response type
type InvalidMessageContentExpressionFault struct {
}
//UnacceptableInitialTerminationTimeFault response type
// UnacceptableInitialTerminationTimeFault response type
type UnacceptableInitialTerminationTimeFault struct {
}
//UnrecognizedPolicyRequestFault response type
// UnrecognizedPolicyRequestFault response type
type UnrecognizedPolicyRequestFault struct {
}
//UnsupportedPolicyRequestFault response type
// UnsupportedPolicyRequestFault response type
type UnsupportedPolicyRequestFault struct {
}
//NotifyMessageNotSupportedFault response type
// NotifyMessageNotSupportedFault response type
type NotifyMessageNotSupportedFault struct {
}
//SubscribeCreationFailedFault response type
// SubscribeCreationFailedFault response type
type SubscribeCreationFailedFault struct {
}

View File

@@ -1,14 +1,14 @@
package main
import (
"context"
"fmt"
"io/ioutil"
"log"
"net/http"
goonvif "github.com/use-go/onvif"
"github.com/use-go/onvif/device"
"github.com/use-go/onvif/gosoap"
sdk "github.com/use-go/onvif/sdk/device"
"github.com/use-go/onvif/xsd/onvif"
)
@@ -17,54 +17,51 @@ const (
password = "Supervisor"
)
func readResponse(resp *http.Response) string {
b, err := ioutil.ReadAll(resp.Body)
if err != nil {
panic(err)
}
return string(b)
}
func main() {
ctx := context.Background()
//Getting an camera instance
dev, err := goonvif.NewDevice("192.168.13.14:80")
dev, err := goonvif.NewDevice(goonvif.DeviceParams{
Xaddr: "192.168.13.14:80",
Username: login,
Password: password,
HttpClient: new(http.Client),
})
if err != nil {
panic(err)
}
//Authorization
dev.Authenticate(login, password)
//Preparing commands
systemDateAndTyme := device.GetSystemDateAndTime{}
getCapabilities := device.GetCapabilities{Category: "All"}
createUser := device.CreateUsers{User: onvif.User{
Username: "TestUser",
Password: "TestPassword",
UserLevel: "User",
},
createUser := device.CreateUsers{
User: onvif.User{
Username: "TestUser",
Password: "TestPassword",
UserLevel: "User",
},
}
//Commands execution
systemDateAndTymeResponse, err := dev.CallMethod(systemDateAndTyme)
systemDateAndTymeResponse, err := sdk.Call_GetSystemDateAndTime(ctx, dev, systemDateAndTyme)
if err != nil {
log.Println(err)
} else {
fmt.Println(readResponse(systemDateAndTymeResponse))
fmt.Println(systemDateAndTymeResponse)
}
getCapabilitiesResponse, err := dev.CallMethod(getCapabilities)
getCapabilitiesResponse, err := sdk.Call_GetCapabilities(ctx, dev, getCapabilities)
if err != nil {
log.Println(err)
} else {
fmt.Println(readResponse(getCapabilitiesResponse))
fmt.Println(getCapabilitiesResponse)
}
createUserResponse, err := dev.CallMethod(createUser)
createUserResponse, err := sdk.Call_CreateUsers(ctx, dev, createUser)
if err != nil {
log.Println(err)
} else {
/*
You could use https://github.com/use-go/onvif/gosoap for pretty printing response
*/
fmt.Println(gosoap.SoapMessage(readResponse(createUserResponse)).StringIndent())
// You could use https://github.com/use-go/onvif/gosoap for pretty printing response
fmt.Println(createUserResponse)
}
}

View File

@@ -0,0 +1,83 @@
package main
import (
"encoding/json"
"io/ioutil"
"log"
"path"
"regexp"
"strings"
"testing"
"github.com/beevik/etree"
"github.com/kerberos-io/onvif"
"github.com/kerberos-io/onvif/device"
discover "github.com/kerberos-io/onvif/ws-discovery"
)
func TestGetAvailableDevicesAtSpecificEthernetInterface(t *testing.T) {
s, err := onvif.GetAvailableDevicesAtSpecificEthernetInterface("en0")
log.Printf("%v %v", err, s)
}
func client() {
dev, err := onvif.NewDevice(onvif.DeviceParams{Xaddr: "192.168.3.10", Username: "admin", Password: "zsyy12345"})
if err != nil {
panic(err)
}
log.Printf("output %+v", dev.GetServices())
res, err := dev.CallMethod(device.GetUsers{})
bs, _ := ioutil.ReadAll(res.Body)
log.Printf("output %+v %s", res.StatusCode, bs)
}
// Host host
type Host struct {
URL string `json:"url"`
Name string `json:"name"`
}
func runDiscovery(interfaceName string) {
var hosts []*Host
devices, err := discover.SendProbe(interfaceName, nil, []string{"dn:NetworkVideoTransmitter"}, map[string]string{"dn": "http://www.onvif.org/ver10/network/wsdl"})
if err != nil {
log.Printf("error %s", err)
return
}
for _, j := range devices {
doc := etree.NewDocument()
if err := doc.ReadFromString(j); err != nil {
log.Printf("error %s", err)
} else {
endpoints := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/XAddrs")
scopes := doc.Root().FindElements("./Body/ProbeMatches/ProbeMatch/Scopes")
flag := false
host := &Host{}
for _, xaddr := range endpoints {
xaddr := strings.Split(strings.Split(xaddr.Text(), " ")[0], "/")[2]
host.URL = xaddr
}
if flag {
break
}
for _, scope := range scopes {
re := regexp.MustCompile(`onvif:\/\/www\.onvif\.org\/name\/[A-Za-z0-9-]+`)
match := re.FindStringSubmatch(scope.Text())
host.Name = path.Base(match[0])
}
hosts = append(hosts, host)
}
}
bys, _ := json.Marshal(hosts)
log.Printf("done %s", bys)
}

11
go.mod
View File

@@ -1,12 +1,13 @@
module github.com/use-go/onvif
module github.com/kerberos-io/onvif
go 1.14
go 1.15
require (
github.com/beevik/etree v1.1.0
github.com/elgs/gostrgen v0.0.0-20161222160715-9d61ae07eeae
github.com/gin-gonic/gin v1.6.2
github.com/gin-gonic/gin v1.7.0
github.com/gofrs/uuid v3.2.0+incompatible
github.com/yakovlevdmv/Golang-iso8601-duration v0.0.0-20180403125811-e5db0413b903
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0
github.com/juju/errors v0.0.0-20220331221717-b38fca44723b
github.com/rs/zerolog v1.26.1
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d
)

58
go.sum
View File

@@ -1,5 +1,7 @@
github.com/beevik/etree v1.1.0 h1:T0xke/WvNtMoCqgzPhkX2r4rjY3GDZFi+FjpRZY2Jbs=
github.com/beevik/etree v1.1.0/go.mod h1:r8Aw8JqVegEf0w2fDnATrX9VpkMcyFeM0FhwO62wh+A=
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -7,16 +9,17 @@ github.com/elgs/gostrgen v0.0.0-20161222160715-9d61ae07eeae h1:3KvK2DmA7TxQ6PZ2f
github.com/elgs/gostrgen v0.0.0-20161222160715-9d61ae07eeae/go.mod h1:wruC5r2gHdr/JIUs5Rr1V45YtsAzKXZxAnn/5rPC97g=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
github.com/gin-gonic/gin v1.6.2 h1:88crIK23zO6TqlQBt+f9FrPJNKm9ZEr7qjp9vl/d5TM=
github.com/gin-gonic/gin v1.6.2/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
github.com/gin-gonic/gin v1.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU=
github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY=
github.com/go-playground/assert/v2 v2.0.1 h1:MsBgLAaY856+nPRTKrp3/OZK38U/wa0CcBYNjji3q3A=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no=
github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA=
github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY=
github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI=
github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE=
github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gofrs/uuid v3.2.0+incompatible h1:y12jRkkFxsd7GpqdSZ+/KCs/fJbqpEXSGd4+jfEaewE=
github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/golang/protobuf v1.3.3 h1:gyjaxf+svBWX08ZjK86iN9geUJF0H6gp2IRKX6Nf6/I=
@@ -24,6 +27,14 @@ github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaW
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/juju/errors v0.0.0-20220331221717-b38fca44723b h1:AxFeSQJfcm2O3ov1wqAkTKYFsnMw2g1B4PkYujfAdkY=
github.com/juju/errors v0.0.0-20220331221717-b38fca44723b/go.mod h1:jMGj9DWF/qbo91ODcfJq6z/RYc3FX3taCBZMCcpI4Ls=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
@@ -32,8 +43,12 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OH
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg=
github.com/rs/zerolog v1.26.1 h1:/ihwxqH+4z8UxyI70wM1z9yCvkWcfz/a3mj48k/Zngc=
github.com/rs/zerolog v1.26.1/go.mod h1:/wSSJWX7lVrsOwlbyTRSOJvqRlc+WjWlfes+CiJ+tmc=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
@@ -42,20 +57,41 @@ github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
github.com/yakovlevdmv/Golang-iso8601-duration v0.0.0-20180403125811-e5db0413b903 h1:W1Y09qPuFslSd+3famnSJpy4c3My7Gp1cgk5x4ZlbfU=
github.com/yakovlevdmv/Golang-iso8601-duration v0.0.0-20180403125811-e5db0413b903/go.mod h1:9o96byDMk+osDZqiIS2a7E7y0cWmg4rRTjQRWVHpFWE=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0 h1:Jcxah/M+oLZ/R4/z5RzfPzGbPXnVDPkEDtf2JnuxN+U=
golang.org/x/net v0.0.0-20200425230154-ff2c4b7c35a0/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e h1:1SzTfNOXwIS2oWiMF+6qu0OUDKb0dauo6MoDUQyu+yU=
golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d h1:20cMwl2fHAzkJMEA+8J4JgqBQcQGzbisXo31MIeenXI=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e h1:WUoyKPm6nCo1BnNUvPGnFG3T5DUVem42yDJZZ4CNxMA=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@@ -62,18 +62,19 @@ func NewSecurity(username, passwd string) Security {
charSet := gostrgen.Lower | gostrgen.Digit
nonceSeq, _ := gostrgen.RandGen(charsToGenerate, charSet, "", "")
created := time.Now().UTC().Format(time.RFC3339Nano)
auth := Security{
Auth: wsAuth{
Username: username,
Password: password{
Type: passwordType,
Password: generateToken(username, nonceSeq, time.Now().UTC(), passwd),
Password: generateToken(username, nonceSeq, created, passwd),
},
Nonce: nonce{
Type: encodingType,
Nonce: nonceSeq,
},
Created: time.Now().UTC().Format(time.RFC3339Nano),
Created: created,
},
}
@@ -81,13 +82,11 @@ func NewSecurity(username, passwd string) Security {
}
//Digest = B64ENCODE( SHA1( B64DECODE( Nonce ) + Date + Password ) )
func generateToken(Username string, Nonce string, Created time.Time, Password string) string {
func generateToken(Username string, Nonce string, Created string, Password string) string {
sDec, _ := base64.StdEncoding.DecodeString(Nonce)
hasher := sha1.New()
//hasher.Write([]byte((base64.StdEncoding.EncodeToString([]byte(Nonce)) + Created.Format(time.RFC3339) + Password)))
hasher.Write([]byte(string(sDec) + Created.Format(time.RFC3339Nano) + Password))
hasher.Write([]byte(string(sDec) + Created + Password))
return base64.StdEncoding.EncodeToString(hasher.Sum(nil))
}

View File

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

View File

@@ -1,17 +1,18 @@
package networking
import (
"net/http"
"bytes"
"net/http"
"github.com/juju/errors"
)
func SendSoap(endpoint, message string) (*http.Response, error) {
httpClient := new(http.Client)
// SendSoap send soap message
func SendSoap(httpClient *http.Client, endpoint, message string) (*http.Response, error) {
resp, err := httpClient.Post(endpoint, "application/soap+xml; charset=utf-8", bytes.NewBufferString(message))
if err != nil {
return resp, err
return resp, errors.Annotate(err, "Post")
}
return resp,nil
}
return resp, nil
}

View File

@@ -1,8 +1,8 @@
package ptz
import (
"github.com/use-go/onvif/xsd"
"github.com/use-go/onvif/xsd/onvif"
"github.com/kerberos-io/onvif/xsd"
"github.com/kerberos-io/onvif/xsd/onvif"
)
type Capabilities struct {
@@ -91,14 +91,14 @@ type GetPresets struct {
}
type GetPresetsResponse struct {
Preset onvif.PTZPreset
Preset []onvif.PTZPreset
}
type SetPreset struct {
XMLName string `xml:"tptz:SetPreset"`
ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"`
PresetName xsd.String `xml:"tptz:PresetName"`
PresetToken onvif.ReferenceToken `xml:"tptz:PresetToken"`
PresetToken onvif.ReferenceToken `xml:"tptz:PresetToken,omitempty"`
}
type SetPresetResponse struct {
@@ -145,17 +145,17 @@ type ContinuousMove struct {
XMLName string `xml:"tptz:ContinuousMove"`
ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"`
Velocity onvif.PTZSpeed `xml:"tptz:Velocity"`
Timeout xsd.Duration `xml:"tptz:Timeout"`
//Timeout xsd.Duration `xml:"tptz:Timeout"`
}
type ContinuousMoveResponse struct {
}
type RelativeMove struct {
XMLName string `xml:"tptz:RelativeMove"`
ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken"`
Translation onvif.PTZVector `xml:"tptz:Translation"`
Speed onvif.PTZSpeed `xml:"tptz:Speed"`
XMLName string `xml:"tptz:RelativeMove,omitempty"`
ProfileToken onvif.ReferenceToken `xml:"tptz:ProfileToken,omitempty"`
Translation onvif.PTZVector `xml:"tptz:Translation,omitempty"`
Speed onvif.PTZSpeed `xml:"tptz:Speed,omitempty"`
}
type RelativeMoveResponse struct {

78
sdk/codegen/main.go Normal file
View File

@@ -0,0 +1,78 @@
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package main
import (
"flag"
"log"
"os"
"text/template"
)
var mainTemplate = `// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package {{.Package}}
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/{{.StructPackage}}"
)
// Call_{{.TypeRequest}} forwards the call to dev.CallMethod() then parses the payload of the reply as a {{.TypeReply}}.
func Call_{{.TypeRequest}}(ctx context.Context, dev *onvif.Device, request {{.StructPackage}}.{{.TypeRequest}}) ({{.StructPackage}}.{{.TypeReply}}, error) {
type Envelope struct {
Header struct{}
Body struct {
{{.TypeReply}} {{.StructPackage}}.{{.TypeReply}}
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.{{.TypeReply}}, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "{{.TypeRequest}}")
return reply.Body.{{.TypeReply}}, errors.Annotate(err, "reply")
}
}
`
type parserEnv struct {
Package string
StructPackage string
TypeReply string
TypeRequest string
}
func main() {
flag.Parse()
env := parserEnv{
Package: flag.Arg(0),
StructPackage: flag.Arg(1),
TypeRequest: flag.Arg(2),
TypeReply: flag.Arg(2) + "Response",
}
log.Println(env)
body, err := template.New("body").Parse(mainTemplate)
if err != nil {
log.Fatalln(err)
}
fout, err := os.Create(env.TypeRequest + "_auto.go")
if err != nil {
log.Fatalln(err)
}
defer fout.Close()
err = body.Execute(fout, &env)
if err != nil {
log.Fatalln(err)
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_AddIPAddressFilter forwards the call to dev.CallMethod() then parses the payload of the reply as a AddIPAddressFilterResponse.
func Call_AddIPAddressFilter(ctx context.Context, dev *onvif.Device, request device.AddIPAddressFilter) (device.AddIPAddressFilterResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
AddIPAddressFilterResponse device.AddIPAddressFilterResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.AddIPAddressFilterResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "AddIPAddressFilter")
return reply.Body.AddIPAddressFilterResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_AddScopes forwards the call to dev.CallMethod() then parses the payload of the reply as a AddScopesResponse.
func Call_AddScopes(ctx context.Context, dev *onvif.Device, request device.AddScopes) (device.AddScopesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
AddScopesResponse device.AddScopesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.AddScopesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "AddScopes")
return reply.Body.AddScopesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_CreateCertificate forwards the call to dev.CallMethod() then parses the payload of the reply as a CreateCertificateResponse.
func Call_CreateCertificate(ctx context.Context, dev *onvif.Device, request device.CreateCertificate) (device.CreateCertificateResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
CreateCertificateResponse device.CreateCertificateResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.CreateCertificateResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "CreateCertificate")
return reply.Body.CreateCertificateResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_CreateDot1XConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a CreateDot1XConfigurationResponse.
func Call_CreateDot1XConfiguration(ctx context.Context, dev *onvif.Device, request device.CreateDot1XConfiguration) (device.CreateDot1XConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
CreateDot1XConfigurationResponse device.CreateDot1XConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.CreateDot1XConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "CreateDot1XConfiguration")
return reply.Body.CreateDot1XConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_CreateStorageConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a CreateStorageConfigurationResponse.
func Call_CreateStorageConfiguration(ctx context.Context, dev *onvif.Device, request device.CreateStorageConfiguration) (device.CreateStorageConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
CreateStorageConfigurationResponse device.CreateStorageConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.CreateStorageConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "CreateStorageConfiguration")
return reply.Body.CreateStorageConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_CreateUsers forwards the call to dev.CallMethod() then parses the payload of the reply as a CreateUsersResponse.
func Call_CreateUsers(ctx context.Context, dev *onvif.Device, request device.CreateUsers) (device.CreateUsersResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
CreateUsersResponse device.CreateUsersResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.CreateUsersResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "CreateUsers")
return reply.Body.CreateUsersResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_DeleteCertificates forwards the call to dev.CallMethod() then parses the payload of the reply as a DeleteCertificatesResponse.
func Call_DeleteCertificates(ctx context.Context, dev *onvif.Device, request device.DeleteCertificates) (device.DeleteCertificatesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
DeleteCertificatesResponse device.DeleteCertificatesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.DeleteCertificatesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "DeleteCertificates")
return reply.Body.DeleteCertificatesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_DeleteDot1XConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a DeleteDot1XConfigurationResponse.
func Call_DeleteDot1XConfiguration(ctx context.Context, dev *onvif.Device, request device.DeleteDot1XConfiguration) (device.DeleteDot1XConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
DeleteDot1XConfigurationResponse device.DeleteDot1XConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.DeleteDot1XConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "DeleteDot1XConfiguration")
return reply.Body.DeleteDot1XConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_DeleteGeoLocation forwards the call to dev.CallMethod() then parses the payload of the reply as a DeleteGeoLocationResponse.
func Call_DeleteGeoLocation(ctx context.Context, dev *onvif.Device, request device.DeleteGeoLocation) (device.DeleteGeoLocationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
DeleteGeoLocationResponse device.DeleteGeoLocationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.DeleteGeoLocationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "DeleteGeoLocation")
return reply.Body.DeleteGeoLocationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_DeleteStorageConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a DeleteStorageConfigurationResponse.
func Call_DeleteStorageConfiguration(ctx context.Context, dev *onvif.Device, request device.DeleteStorageConfiguration) (device.DeleteStorageConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
DeleteStorageConfigurationResponse device.DeleteStorageConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.DeleteStorageConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "DeleteStorageConfiguration")
return reply.Body.DeleteStorageConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_DeleteUsers forwards the call to dev.CallMethod() then parses the payload of the reply as a DeleteUsersResponse.
func Call_DeleteUsers(ctx context.Context, dev *onvif.Device, request device.DeleteUsers) (device.DeleteUsersResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
DeleteUsersResponse device.DeleteUsersResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.DeleteUsersResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "DeleteUsers")
return reply.Body.DeleteUsersResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetAccessPolicy forwards the call to dev.CallMethod() then parses the payload of the reply as a GetAccessPolicyResponse.
func Call_GetAccessPolicy(ctx context.Context, dev *onvif.Device, request device.GetAccessPolicy) (device.GetAccessPolicyResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetAccessPolicyResponse device.GetAccessPolicyResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetAccessPolicyResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetAccessPolicy")
return reply.Body.GetAccessPolicyResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetCACertificates forwards the call to dev.CallMethod() then parses the payload of the reply as a GetCACertificatesResponse.
func Call_GetCACertificates(ctx context.Context, dev *onvif.Device, request device.GetCACertificates) (device.GetCACertificatesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetCACertificatesResponse device.GetCACertificatesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetCACertificatesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetCACertificates")
return reply.Body.GetCACertificatesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetCapabilities forwards the call to dev.CallMethod() then parses the payload of the reply as a GetCapabilitiesResponse.
func Call_GetCapabilities(ctx context.Context, dev *onvif.Device, request device.GetCapabilities) (device.GetCapabilitiesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetCapabilitiesResponse device.GetCapabilitiesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetCapabilitiesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetCapabilities")
return reply.Body.GetCapabilitiesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetCertificateInformation forwards the call to dev.CallMethod() then parses the payload of the reply as a GetCertificateInformationResponse.
func Call_GetCertificateInformation(ctx context.Context, dev *onvif.Device, request device.GetCertificateInformation) (device.GetCertificateInformationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetCertificateInformationResponse device.GetCertificateInformationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetCertificateInformationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetCertificateInformation")
return reply.Body.GetCertificateInformationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetCertificatesStatus forwards the call to dev.CallMethod() then parses the payload of the reply as a GetCertificatesStatusResponse.
func Call_GetCertificatesStatus(ctx context.Context, dev *onvif.Device, request device.GetCertificatesStatus) (device.GetCertificatesStatusResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetCertificatesStatusResponse device.GetCertificatesStatusResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetCertificatesStatusResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetCertificatesStatus")
return reply.Body.GetCertificatesStatusResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetCertificates forwards the call to dev.CallMethod() then parses the payload of the reply as a GetCertificatesResponse.
func Call_GetCertificates(ctx context.Context, dev *onvif.Device, request device.GetCertificates) (device.GetCertificatesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetCertificatesResponse device.GetCertificatesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetCertificatesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetCertificates")
return reply.Body.GetCertificatesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetClientCertificateMode forwards the call to dev.CallMethod() then parses the payload of the reply as a GetClientCertificateModeResponse.
func Call_GetClientCertificateMode(ctx context.Context, dev *onvif.Device, request device.GetClientCertificateMode) (device.GetClientCertificateModeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetClientCertificateModeResponse device.GetClientCertificateModeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetClientCertificateModeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetClientCertificateMode")
return reply.Body.GetClientCertificateModeResponse, errors.Annotate(err, "reply")
}
}

30
sdk/device/GetDNS_auto.go Normal file
View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDNS forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDNSResponse.
func Call_GetDNS(ctx context.Context, dev *onvif.Device, request device.GetDNS) (device.GetDNSResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDNSResponse device.GetDNSResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDNSResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDNS")
return reply.Body.GetDNSResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDPAddresses forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDPAddressesResponse.
func Call_GetDPAddresses(ctx context.Context, dev *onvif.Device, request device.GetDPAddresses) (device.GetDPAddressesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDPAddressesResponse device.GetDPAddressesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDPAddressesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDPAddresses")
return reply.Body.GetDPAddressesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDeviceInformation forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDeviceInformationResponse.
func Call_GetDeviceInformation(ctx context.Context, dev *onvif.Device, request device.GetDeviceInformation) (device.GetDeviceInformationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDeviceInformationResponse device.GetDeviceInformationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDeviceInformationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDeviceInformation")
return reply.Body.GetDeviceInformationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDiscoveryMode forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDiscoveryModeResponse.
func Call_GetDiscoveryMode(ctx context.Context, dev *onvif.Device, request device.GetDiscoveryMode) (device.GetDiscoveryModeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDiscoveryModeResponse device.GetDiscoveryModeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDiscoveryModeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDiscoveryMode")
return reply.Body.GetDiscoveryModeResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDot11Capabilities forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDot11CapabilitiesResponse.
func Call_GetDot11Capabilities(ctx context.Context, dev *onvif.Device, request device.GetDot11Capabilities) (device.GetDot11CapabilitiesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDot11CapabilitiesResponse device.GetDot11CapabilitiesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDot11CapabilitiesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDot11Capabilities")
return reply.Body.GetDot11CapabilitiesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDot11Status forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDot11StatusResponse.
func Call_GetDot11Status(ctx context.Context, dev *onvif.Device, request device.GetDot11Status) (device.GetDot11StatusResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDot11StatusResponse device.GetDot11StatusResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDot11StatusResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDot11Status")
return reply.Body.GetDot11StatusResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDot1XConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDot1XConfigurationResponse.
func Call_GetDot1XConfiguration(ctx context.Context, dev *onvif.Device, request device.GetDot1XConfiguration) (device.GetDot1XConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDot1XConfigurationResponse device.GetDot1XConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDot1XConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDot1XConfiguration")
return reply.Body.GetDot1XConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDot1XConfigurations forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDot1XConfigurationsResponse.
func Call_GetDot1XConfigurations(ctx context.Context, dev *onvif.Device, request device.GetDot1XConfigurations) (device.GetDot1XConfigurationsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDot1XConfigurationsResponse device.GetDot1XConfigurationsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDot1XConfigurationsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDot1XConfigurations")
return reply.Body.GetDot1XConfigurationsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetDynamicDNS forwards the call to dev.CallMethod() then parses the payload of the reply as a GetDynamicDNSResponse.
func Call_GetDynamicDNS(ctx context.Context, dev *onvif.Device, request device.GetDynamicDNS) (device.GetDynamicDNSResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetDynamicDNSResponse device.GetDynamicDNSResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetDynamicDNSResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetDynamicDNS")
return reply.Body.GetDynamicDNSResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetEndpointReference forwards the call to dev.CallMethod() then parses the payload of the reply as a GetEndpointReferenceResponse.
func Call_GetEndpointReference(ctx context.Context, dev *onvif.Device, request device.GetEndpointReference) (device.GetEndpointReferenceResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetEndpointReferenceResponse device.GetEndpointReferenceResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetEndpointReferenceResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetEndpointReference")
return reply.Body.GetEndpointReferenceResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetGeoLocation forwards the call to dev.CallMethod() then parses the payload of the reply as a GetGeoLocationResponse.
func Call_GetGeoLocation(ctx context.Context, dev *onvif.Device, request device.GetGeoLocation) (device.GetGeoLocationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetGeoLocationResponse device.GetGeoLocationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetGeoLocationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetGeoLocation")
return reply.Body.GetGeoLocationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetHostname forwards the call to dev.CallMethod() then parses the payload of the reply as a GetHostnameResponse.
func Call_GetHostname(ctx context.Context, dev *onvif.Device, request device.GetHostname) (device.GetHostnameResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetHostnameResponse device.GetHostnameResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetHostnameResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetHostname")
return reply.Body.GetHostnameResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetIPAddressFilter forwards the call to dev.CallMethod() then parses the payload of the reply as a GetIPAddressFilterResponse.
func Call_GetIPAddressFilter(ctx context.Context, dev *onvif.Device, request device.GetIPAddressFilter) (device.GetIPAddressFilterResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetIPAddressFilterResponse device.GetIPAddressFilterResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetIPAddressFilterResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetIPAddressFilter")
return reply.Body.GetIPAddressFilterResponse, errors.Annotate(err, "reply")
}
}

30
sdk/device/GetNTP_auto.go Normal file
View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetNTP forwards the call to dev.CallMethod() then parses the payload of the reply as a GetNTPResponse.
func Call_GetNTP(ctx context.Context, dev *onvif.Device, request device.GetNTP) (device.GetNTPResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetNTPResponse device.GetNTPResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetNTPResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetNTP")
return reply.Body.GetNTPResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetNetworkDefaultGateway forwards the call to dev.CallMethod() then parses the payload of the reply as a GetNetworkDefaultGatewayResponse.
func Call_GetNetworkDefaultGateway(ctx context.Context, dev *onvif.Device, request device.GetNetworkDefaultGateway) (device.GetNetworkDefaultGatewayResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetNetworkDefaultGatewayResponse device.GetNetworkDefaultGatewayResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetNetworkDefaultGatewayResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetNetworkDefaultGateway")
return reply.Body.GetNetworkDefaultGatewayResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetNetworkInterfaces forwards the call to dev.CallMethod() then parses the payload of the reply as a GetNetworkInterfacesResponse.
func Call_GetNetworkInterfaces(ctx context.Context, dev *onvif.Device, request device.GetNetworkInterfaces) (device.GetNetworkInterfacesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetNetworkInterfacesResponse device.GetNetworkInterfacesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetNetworkInterfacesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetNetworkInterfaces")
return reply.Body.GetNetworkInterfacesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetNetworkProtocols forwards the call to dev.CallMethod() then parses the payload of the reply as a GetNetworkProtocolsResponse.
func Call_GetNetworkProtocols(ctx context.Context, dev *onvif.Device, request device.GetNetworkProtocols) (device.GetNetworkProtocolsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetNetworkProtocolsResponse device.GetNetworkProtocolsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetNetworkProtocolsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetNetworkProtocols")
return reply.Body.GetNetworkProtocolsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetPkcs10Request forwards the call to dev.CallMethod() then parses the payload of the reply as a GetPkcs10RequestResponse.
func Call_GetPkcs10Request(ctx context.Context, dev *onvif.Device, request device.GetPkcs10Request) (device.GetPkcs10RequestResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetPkcs10RequestResponse device.GetPkcs10RequestResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetPkcs10RequestResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetPkcs10Request")
return reply.Body.GetPkcs10RequestResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetRelayOutputs forwards the call to dev.CallMethod() then parses the payload of the reply as a GetRelayOutputsResponse.
func Call_GetRelayOutputs(ctx context.Context, dev *onvif.Device, request device.GetRelayOutputs) (device.GetRelayOutputsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetRelayOutputsResponse device.GetRelayOutputsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetRelayOutputsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetRelayOutputs")
return reply.Body.GetRelayOutputsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetRemoteDiscoveryMode forwards the call to dev.CallMethod() then parses the payload of the reply as a GetRemoteDiscoveryModeResponse.
func Call_GetRemoteDiscoveryMode(ctx context.Context, dev *onvif.Device, request device.GetRemoteDiscoveryMode) (device.GetRemoteDiscoveryModeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetRemoteDiscoveryModeResponse device.GetRemoteDiscoveryModeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetRemoteDiscoveryModeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetRemoteDiscoveryMode")
return reply.Body.GetRemoteDiscoveryModeResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetRemoteUser forwards the call to dev.CallMethod() then parses the payload of the reply as a GetRemoteUserResponse.
func Call_GetRemoteUser(ctx context.Context, dev *onvif.Device, request device.GetRemoteUser) (device.GetRemoteUserResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetRemoteUserResponse device.GetRemoteUserResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetRemoteUserResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetRemoteUser")
return reply.Body.GetRemoteUserResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetScopes forwards the call to dev.CallMethod() then parses the payload of the reply as a GetScopesResponse.
func Call_GetScopes(ctx context.Context, dev *onvif.Device, request device.GetScopes) (device.GetScopesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetScopesResponse device.GetScopesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetScopesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetScopes")
return reply.Body.GetScopesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetServiceCapabilities forwards the call to dev.CallMethod() then parses the payload of the reply as a GetServiceCapabilitiesResponse.
func Call_GetServiceCapabilities(ctx context.Context, dev *onvif.Device, request device.GetServiceCapabilities) (device.GetServiceCapabilitiesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetServiceCapabilitiesResponse device.GetServiceCapabilitiesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetServiceCapabilitiesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetServiceCapabilities")
return reply.Body.GetServiceCapabilitiesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetServices forwards the call to dev.CallMethod() then parses the payload of the reply as a GetServicesResponse.
func Call_GetServices(ctx context.Context, dev *onvif.Device, request device.GetServices) (device.GetServicesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetServicesResponse device.GetServicesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetServicesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetServices")
return reply.Body.GetServicesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetStorageConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a GetStorageConfigurationResponse.
func Call_GetStorageConfiguration(ctx context.Context, dev *onvif.Device, request device.GetStorageConfiguration) (device.GetStorageConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetStorageConfigurationResponse device.GetStorageConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetStorageConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetStorageConfiguration")
return reply.Body.GetStorageConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetStorageConfigurations forwards the call to dev.CallMethod() then parses the payload of the reply as a GetStorageConfigurationsResponse.
func Call_GetStorageConfigurations(ctx context.Context, dev *onvif.Device, request device.GetStorageConfigurations) (device.GetStorageConfigurationsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetStorageConfigurationsResponse device.GetStorageConfigurationsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetStorageConfigurationsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetStorageConfigurations")
return reply.Body.GetStorageConfigurationsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetSystemBackup forwards the call to dev.CallMethod() then parses the payload of the reply as a GetSystemBackupResponse.
func Call_GetSystemBackup(ctx context.Context, dev *onvif.Device, request device.GetSystemBackup) (device.GetSystemBackupResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetSystemBackupResponse device.GetSystemBackupResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetSystemBackupResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetSystemBackup")
return reply.Body.GetSystemBackupResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetSystemDateAndTime forwards the call to dev.CallMethod() then parses the payload of the reply as a GetSystemDateAndTimeResponse.
func Call_GetSystemDateAndTime(ctx context.Context, dev *onvif.Device, request device.GetSystemDateAndTime) (device.GetSystemDateAndTimeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetSystemDateAndTimeResponse device.GetSystemDateAndTimeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetSystemDateAndTimeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetSystemDateAndTime")
return reply.Body.GetSystemDateAndTimeResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetSystemLog forwards the call to dev.CallMethod() then parses the payload of the reply as a GetSystemLogResponse.
func Call_GetSystemLog(ctx context.Context, dev *onvif.Device, request device.GetSystemLog) (device.GetSystemLogResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetSystemLogResponse device.GetSystemLogResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetSystemLogResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetSystemLog")
return reply.Body.GetSystemLogResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetSystemSupportInformation forwards the call to dev.CallMethod() then parses the payload of the reply as a GetSystemSupportInformationResponse.
func Call_GetSystemSupportInformation(ctx context.Context, dev *onvif.Device, request device.GetSystemSupportInformation) (device.GetSystemSupportInformationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetSystemSupportInformationResponse device.GetSystemSupportInformationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetSystemSupportInformationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetSystemSupportInformation")
return reply.Body.GetSystemSupportInformationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetSystemUris forwards the call to dev.CallMethod() then parses the payload of the reply as a GetSystemUrisResponse.
func Call_GetSystemUris(ctx context.Context, dev *onvif.Device, request device.GetSystemUris) (device.GetSystemUrisResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetSystemUrisResponse device.GetSystemUrisResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetSystemUrisResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetSystemUris")
return reply.Body.GetSystemUrisResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetUsers forwards the call to dev.CallMethod() then parses the payload of the reply as a GetUsersResponse.
func Call_GetUsers(ctx context.Context, dev *onvif.Device, request device.GetUsers) (device.GetUsersResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetUsersResponse device.GetUsersResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetUsersResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetUsers")
return reply.Body.GetUsersResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetWsdlUrl forwards the call to dev.CallMethod() then parses the payload of the reply as a GetWsdlUrlResponse.
func Call_GetWsdlUrl(ctx context.Context, dev *onvif.Device, request device.GetWsdlUrl) (device.GetWsdlUrlResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetWsdlUrlResponse device.GetWsdlUrlResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetWsdlUrlResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetWsdlUrl")
return reply.Body.GetWsdlUrlResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_GetZeroConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a GetZeroConfigurationResponse.
func Call_GetZeroConfiguration(ctx context.Context, dev *onvif.Device, request device.GetZeroConfiguration) (device.GetZeroConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
GetZeroConfigurationResponse device.GetZeroConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.GetZeroConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "GetZeroConfiguration")
return reply.Body.GetZeroConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_LoadCACertificates forwards the call to dev.CallMethod() then parses the payload of the reply as a LoadCACertificatesResponse.
func Call_LoadCACertificates(ctx context.Context, dev *onvif.Device, request device.LoadCACertificates) (device.LoadCACertificatesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
LoadCACertificatesResponse device.LoadCACertificatesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.LoadCACertificatesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "LoadCACertificates")
return reply.Body.LoadCACertificatesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_LoadCertificateWithPrivateKey forwards the call to dev.CallMethod() then parses the payload of the reply as a LoadCertificateWithPrivateKeyResponse.
func Call_LoadCertificateWithPrivateKey(ctx context.Context, dev *onvif.Device, request device.LoadCertificateWithPrivateKey) (device.LoadCertificateWithPrivateKeyResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
LoadCertificateWithPrivateKeyResponse device.LoadCertificateWithPrivateKeyResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.LoadCertificateWithPrivateKeyResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "LoadCertificateWithPrivateKey")
return reply.Body.LoadCertificateWithPrivateKeyResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_LoadCertificates forwards the call to dev.CallMethod() then parses the payload of the reply as a LoadCertificatesResponse.
func Call_LoadCertificates(ctx context.Context, dev *onvif.Device, request device.LoadCertificates) (device.LoadCertificatesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
LoadCertificatesResponse device.LoadCertificatesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.LoadCertificatesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "LoadCertificates")
return reply.Body.LoadCertificatesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_RemoveIPAddressFilter forwards the call to dev.CallMethod() then parses the payload of the reply as a RemoveIPAddressFilterResponse.
func Call_RemoveIPAddressFilter(ctx context.Context, dev *onvif.Device, request device.RemoveIPAddressFilter) (device.RemoveIPAddressFilterResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
RemoveIPAddressFilterResponse device.RemoveIPAddressFilterResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.RemoveIPAddressFilterResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "RemoveIPAddressFilter")
return reply.Body.RemoveIPAddressFilterResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_RemoveScopes forwards the call to dev.CallMethod() then parses the payload of the reply as a RemoveScopesResponse.
func Call_RemoveScopes(ctx context.Context, dev *onvif.Device, request device.RemoveScopes) (device.RemoveScopesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
RemoveScopesResponse device.RemoveScopesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.RemoveScopesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "RemoveScopes")
return reply.Body.RemoveScopesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_RestoreSystem forwards the call to dev.CallMethod() then parses the payload of the reply as a RestoreSystemResponse.
func Call_RestoreSystem(ctx context.Context, dev *onvif.Device, request device.RestoreSystem) (device.RestoreSystemResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
RestoreSystemResponse device.RestoreSystemResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.RestoreSystemResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "RestoreSystem")
return reply.Body.RestoreSystemResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_ScanAvailableDot11Networks forwards the call to dev.CallMethod() then parses the payload of the reply as a ScanAvailableDot11NetworksResponse.
func Call_ScanAvailableDot11Networks(ctx context.Context, dev *onvif.Device, request device.ScanAvailableDot11Networks) (device.ScanAvailableDot11NetworksResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
ScanAvailableDot11NetworksResponse device.ScanAvailableDot11NetworksResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.ScanAvailableDot11NetworksResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "ScanAvailableDot11Networks")
return reply.Body.ScanAvailableDot11NetworksResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SendAuxiliaryCommand forwards the call to dev.CallMethod() then parses the payload of the reply as a SendAuxiliaryCommandResponse.
func Call_SendAuxiliaryCommand(ctx context.Context, dev *onvif.Device, request device.SendAuxiliaryCommand) (device.SendAuxiliaryCommandResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SendAuxiliaryCommandResponse device.SendAuxiliaryCommandResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SendAuxiliaryCommandResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SendAuxiliaryCommand")
return reply.Body.SendAuxiliaryCommandResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetAccessPolicy forwards the call to dev.CallMethod() then parses the payload of the reply as a SetAccessPolicyResponse.
func Call_SetAccessPolicy(ctx context.Context, dev *onvif.Device, request device.SetAccessPolicy) (device.SetAccessPolicyResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetAccessPolicyResponse device.SetAccessPolicyResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetAccessPolicyResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetAccessPolicy")
return reply.Body.SetAccessPolicyResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetCertificatesStatus forwards the call to dev.CallMethod() then parses the payload of the reply as a SetCertificatesStatusResponse.
func Call_SetCertificatesStatus(ctx context.Context, dev *onvif.Device, request device.SetCertificatesStatus) (device.SetCertificatesStatusResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetCertificatesStatusResponse device.SetCertificatesStatusResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetCertificatesStatusResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetCertificatesStatus")
return reply.Body.SetCertificatesStatusResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetClientCertificateMode forwards the call to dev.CallMethod() then parses the payload of the reply as a SetClientCertificateModeResponse.
func Call_SetClientCertificateMode(ctx context.Context, dev *onvif.Device, request device.SetClientCertificateMode) (device.SetClientCertificateModeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetClientCertificateModeResponse device.SetClientCertificateModeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetClientCertificateModeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetClientCertificateMode")
return reply.Body.SetClientCertificateModeResponse, errors.Annotate(err, "reply")
}
}

30
sdk/device/SetDNS_auto.go Normal file
View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetDNS forwards the call to dev.CallMethod() then parses the payload of the reply as a SetDNSResponse.
func Call_SetDNS(ctx context.Context, dev *onvif.Device, request device.SetDNS) (device.SetDNSResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetDNSResponse device.SetDNSResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetDNSResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetDNS")
return reply.Body.SetDNSResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetDiscoveryMode forwards the call to dev.CallMethod() then parses the payload of the reply as a SetDiscoveryModeResponse.
func Call_SetDiscoveryMode(ctx context.Context, dev *onvif.Device, request device.SetDiscoveryMode) (device.SetDiscoveryModeResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetDiscoveryModeResponse device.SetDiscoveryModeResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetDiscoveryModeResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetDiscoveryMode")
return reply.Body.SetDiscoveryModeResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetDot1XConfiguration forwards the call to dev.CallMethod() then parses the payload of the reply as a SetDot1XConfigurationResponse.
func Call_SetDot1XConfiguration(ctx context.Context, dev *onvif.Device, request device.SetDot1XConfiguration) (device.SetDot1XConfigurationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetDot1XConfigurationResponse device.SetDot1XConfigurationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetDot1XConfigurationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetDot1XConfiguration")
return reply.Body.SetDot1XConfigurationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetDynamicDNS forwards the call to dev.CallMethod() then parses the payload of the reply as a SetDynamicDNSResponse.
func Call_SetDynamicDNS(ctx context.Context, dev *onvif.Device, request device.SetDynamicDNS) (device.SetDynamicDNSResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetDynamicDNSResponse device.SetDynamicDNSResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetDynamicDNSResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetDynamicDNS")
return reply.Body.SetDynamicDNSResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetGeoLocation forwards the call to dev.CallMethod() then parses the payload of the reply as a SetGeoLocationResponse.
func Call_SetGeoLocation(ctx context.Context, dev *onvif.Device, request device.SetGeoLocation) (device.SetGeoLocationResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetGeoLocationResponse device.SetGeoLocationResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetGeoLocationResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetGeoLocation")
return reply.Body.SetGeoLocationResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetHostnameFromDHCP forwards the call to dev.CallMethod() then parses the payload of the reply as a SetHostnameFromDHCPResponse.
func Call_SetHostnameFromDHCP(ctx context.Context, dev *onvif.Device, request device.SetHostnameFromDHCP) (device.SetHostnameFromDHCPResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetHostnameFromDHCPResponse device.SetHostnameFromDHCPResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetHostnameFromDHCPResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetHostnameFromDHCP")
return reply.Body.SetHostnameFromDHCPResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetHostname forwards the call to dev.CallMethod() then parses the payload of the reply as a SetHostnameResponse.
func Call_SetHostname(ctx context.Context, dev *onvif.Device, request device.SetHostname) (device.SetHostnameResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetHostnameResponse device.SetHostnameResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetHostnameResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetHostname")
return reply.Body.SetHostnameResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetIPAddressFilter forwards the call to dev.CallMethod() then parses the payload of the reply as a SetIPAddressFilterResponse.
func Call_SetIPAddressFilter(ctx context.Context, dev *onvif.Device, request device.SetIPAddressFilter) (device.SetIPAddressFilterResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetIPAddressFilterResponse device.SetIPAddressFilterResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetIPAddressFilterResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetIPAddressFilter")
return reply.Body.SetIPAddressFilterResponse, errors.Annotate(err, "reply")
}
}

30
sdk/device/SetNTP_auto.go Normal file
View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetNTP forwards the call to dev.CallMethod() then parses the payload of the reply as a SetNTPResponse.
func Call_SetNTP(ctx context.Context, dev *onvif.Device, request device.SetNTP) (device.SetNTPResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetNTPResponse device.SetNTPResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetNTPResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetNTP")
return reply.Body.SetNTPResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetNetworkDefaultGateway forwards the call to dev.CallMethod() then parses the payload of the reply as a SetNetworkDefaultGatewayResponse.
func Call_SetNetworkDefaultGateway(ctx context.Context, dev *onvif.Device, request device.SetNetworkDefaultGateway) (device.SetNetworkDefaultGatewayResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetNetworkDefaultGatewayResponse device.SetNetworkDefaultGatewayResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetNetworkDefaultGatewayResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetNetworkDefaultGateway")
return reply.Body.SetNetworkDefaultGatewayResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetNetworkInterfaces forwards the call to dev.CallMethod() then parses the payload of the reply as a SetNetworkInterfacesResponse.
func Call_SetNetworkInterfaces(ctx context.Context, dev *onvif.Device, request device.SetNetworkInterfaces) (device.SetNetworkInterfacesResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetNetworkInterfacesResponse device.SetNetworkInterfacesResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetNetworkInterfacesResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetNetworkInterfaces")
return reply.Body.SetNetworkInterfacesResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetNetworkProtocols forwards the call to dev.CallMethod() then parses the payload of the reply as a SetNetworkProtocolsResponse.
func Call_SetNetworkProtocols(ctx context.Context, dev *onvif.Device, request device.SetNetworkProtocols) (device.SetNetworkProtocolsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetNetworkProtocolsResponse device.SetNetworkProtocolsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetNetworkProtocolsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetNetworkProtocols")
return reply.Body.SetNetworkProtocolsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetRelayOutputSettings forwards the call to dev.CallMethod() then parses the payload of the reply as a SetRelayOutputSettingsResponse.
func Call_SetRelayOutputSettings(ctx context.Context, dev *onvif.Device, request device.SetRelayOutputSettings) (device.SetRelayOutputSettingsResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetRelayOutputSettingsResponse device.SetRelayOutputSettingsResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetRelayOutputSettingsResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetRelayOutputSettings")
return reply.Body.SetRelayOutputSettingsResponse, errors.Annotate(err, "reply")
}
}

View File

@@ -0,0 +1,30 @@
// Code generated : DO NOT EDIT.
// Copyright (c) 2022 Jean-Francois SMIGIELSKI
// Distributed under the MIT License
package device
import (
"context"
"github.com/juju/errors"
"github.com/use-go/onvif"
"github.com/use-go/onvif/sdk"
"github.com/use-go/onvif/device"
)
// Call_SetRelayOutputState forwards the call to dev.CallMethod() then parses the payload of the reply as a SetRelayOutputStateResponse.
func Call_SetRelayOutputState(ctx context.Context, dev *onvif.Device, request device.SetRelayOutputState) (device.SetRelayOutputStateResponse, error) {
type Envelope struct {
Header struct{}
Body struct {
SetRelayOutputStateResponse device.SetRelayOutputStateResponse
}
}
var reply Envelope
if httpReply, err := dev.CallMethod(request); err != nil {
return reply.Body.SetRelayOutputStateResponse, errors.Annotate(err, "call")
} else {
err = sdk.ReadAndParse(ctx, httpReply, &reply, "SetRelayOutputState")
return reply.Body.SetRelayOutputStateResponse, errors.Annotate(err, "reply")
}
}

Some files were not shown because too many files have changed in this diff Show More