Refactor XML response handling in device extended and security tests
- Adjusted formatting in XML response strings for consistency in device_extended_test.go and device_security_test.go. - Improved readability by aligning XML declaration and body content. - Updated mock server responses to ensure proper handling of various ONVIF operations. Enhance device security and storage handling - Refactored struct field declarations in device_security.go and device_storage_test.go for improved clarity. - Ensured consistent formatting across struct definitions and XML tags. Standardize whitespace and formatting across multiple files - Removed unnecessary blank lines and adjusted indentation in discovery, imaging, media, and PTZ server files. - Improved overall code readability and maintainability by ensuring consistent formatting. Update example applications for better readability - Cleaned up whitespace in example applications to enhance code clarity. - Ensured consistent formatting in main.go files across various examples. Refactor server and SOAP handler code for consistency - Standardized struct field declarations and XML tag formatting in server and SOAP handler files. - Improved readability by aligning struct fields and ensuring consistent use of whitespace. General code cleanup and formatting adjustments - Applied consistent formatting across various files, including types.go and test files. - Enhanced readability by aligning struct fields and removing unnecessary blank lines.
This commit is contained in:
+18
-18
@@ -18,15 +18,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
|
||||
@@ -45,7 +45,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@v4
|
||||
uses: golangci/golangci-lint-action@3cfe3a4ac716397848d91e4042119f51a40b6aaf # v4.0.0
|
||||
with:
|
||||
version: latest
|
||||
args: --timeout=5m --fix=false
|
||||
@@ -58,15 +58,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }}
|
||||
@@ -83,7 +83,7 @@ jobs:
|
||||
run: go tool cover -html=coverage.out -o coverage.html
|
||||
|
||||
- name: Upload coverage to Codecov
|
||||
uses: codecov/codecov-action@v4
|
||||
uses: codecov/codecov-action@8a4b2d1c64a2a31fb92d9fa9f1e2b02e35d2db1a # v4.0.1
|
||||
with:
|
||||
token: ${{ secrets.CODECOV_TOKEN }}
|
||||
files: ./coverage.out
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
|
||||
- name: Archive coverage
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@89ef406dd8d8a50a2f1e5e903c0e970c27a27de8 # v4.3.5
|
||||
with:
|
||||
name: coverage-report
|
||||
path: |
|
||||
@@ -119,15 +119,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
@@ -151,17 +151,17 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download coverage from test job
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
||||
with:
|
||||
name: coverage-report
|
||||
|
||||
- name: SonarCloud Scan
|
||||
uses: SonarSource/sonarcloud-github-action@master
|
||||
uses: SonarSource/sonarcloud-github-action@3b335e14ab49358d133eef17b8c1590fe7c21c0e # v2.2.0
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -179,15 +179,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: '1.23'
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-1.23-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
@@ -15,10 +15,10 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
||||
with:
|
||||
name: coverage-report
|
||||
|
||||
|
||||
@@ -39,12 +39,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: '1.21'
|
||||
|
||||
@@ -142,12 +142,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
||||
with:
|
||||
path: all-releases
|
||||
pattern: release-*
|
||||
@@ -177,7 +177,7 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Create Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
|
||||
with:
|
||||
files: all-releases/*
|
||||
draft: true
|
||||
@@ -228,23 +228,23 @@ jobs:
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
uses: docker/setup-qemu-action@49b3bc8e6f341ff684fb5300544cda1ff1a290d5 # v3.2.0
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
uses: docker/setup-buildx-action@4fd812986e6c8ec69f87869bf8f84174f3426a6d # v3.4.0
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1b4ee7e33440 # v3.3.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
continue-on-error: true
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1b4ee7e33440 # v3.3.0
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
@@ -255,7 +255,7 @@ jobs:
|
||||
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
uses: docker/build-push-action@5f63d2b5a0f13e6fe58a2658b1cf779280e04def # v6.2.0
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||
|
||||
@@ -18,15 +18,15 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@d632cb752374ac6c22015e4b4bef1d19db85d69f # v4.2.0
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
uses: actions/setup-go@0a12ed9d6470c3512128ab8f076f97fbbff3da52 # v5.0.1
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Cache Go modules
|
||||
uses: actions/cache@v4
|
||||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
||||
with:
|
||||
path: ~/go/pkg/mod
|
||||
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
|
||||
|
||||
@@ -497,4 +497,3 @@ func generateNonce() string {
|
||||
// Generate a simple nonce
|
||||
return fmt.Sprintf("%d", time.Now().UnixNano())
|
||||
}
|
||||
|
||||
|
||||
+4
-4
@@ -643,10 +643,10 @@ func ExampleClient_GetDeviceInformation() {
|
||||
|
||||
func TestFixLocalhostURL(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
clientURL string
|
||||
serviceURL string
|
||||
expectedURL string
|
||||
name string
|
||||
clientURL string
|
||||
serviceURL string
|
||||
expectedURL string
|
||||
}{
|
||||
{
|
||||
name: "localhost hostname",
|
||||
|
||||
@@ -11,10 +11,10 @@ import (
|
||||
|
||||
// ASCIIConfig controls ASCII art generation parameters
|
||||
type ASCIIConfig struct {
|
||||
Width int // Output width in characters
|
||||
Height int // Output height in characters
|
||||
Invert bool // Invert brightness
|
||||
Quality string // "high", "medium", "low"
|
||||
Width int // Output width in characters
|
||||
Height int // Output height in characters
|
||||
Invert bool // Invert brightness
|
||||
Quality string // "high", "medium", "low"
|
||||
}
|
||||
|
||||
// DefaultASCIIConfig returns a sensible default configuration
|
||||
|
||||
@@ -150,7 +150,6 @@ func listNetworkInterfaces() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func connectAndShowInfo() {
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
||||
|
||||
@@ -1092,4 +1092,3 @@ func (c *Client) SetNetworkDefaultGateway(ctx context.Context, gateway *NetworkG
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ func (c *Client) GetDPAddresses(ctx context.Context) ([]NetworkHost, error) {
|
||||
}
|
||||
|
||||
type GetDPAddressesResponse struct {
|
||||
XMLName xml.Name `xml:"GetDPAddressesResponse"`
|
||||
DPAddress []NetworkHost `xml:"DPAddress"`
|
||||
XMLName xml.Name `xml:"GetDPAddressesResponse"`
|
||||
DPAddress []NetworkHost `xml:"DPAddress"`
|
||||
}
|
||||
|
||||
request := GetDPAddressesBody{
|
||||
@@ -171,8 +171,8 @@ func (c *Client) GetAccessPolicy(ctx context.Context) (*AccessPolicy, error) {
|
||||
}
|
||||
|
||||
type GetAccessPolicyResponse struct {
|
||||
XMLName xml.Name `xml:"GetAccessPolicyResponse"`
|
||||
PolicyFile *BinaryData `xml:"PolicyFile"`
|
||||
XMLName xml.Name `xml:"GetAccessPolicyResponse"`
|
||||
PolicyFile *BinaryData `xml:"PolicyFile"`
|
||||
}
|
||||
|
||||
request := GetAccessPolicyBody{
|
||||
|
||||
@@ -54,7 +54,7 @@ func newMockDeviceAdditionalServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetDPAddresses"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetDPAddressesResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -71,7 +71,7 @@ func newMockDeviceAdditionalServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetDPAddresses"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetDPAddressesResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -79,7 +79,7 @@ func newMockDeviceAdditionalServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetAccessPolicy"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetAccessPolicyResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -92,7 +92,7 @@ func newMockDeviceAdditionalServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetAccessPolicy"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetAccessPolicyResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -100,7 +100,7 @@ func newMockDeviceAdditionalServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetWsdlUrl"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetWsdlUrlResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
|
||||
@@ -140,7 +140,7 @@ func (c *Client) CreateCertificate(ctx context.Context, certificateID, subject s
|
||||
}
|
||||
|
||||
type CreateCertificateResponse struct {
|
||||
XMLName xml.Name `xml:"CreateCertificateResponse"`
|
||||
XMLName xml.Name `xml:"CreateCertificateResponse"`
|
||||
Certificate *Certificate `xml:"Certificate"`
|
||||
}
|
||||
|
||||
@@ -204,7 +204,7 @@ func (c *Client) GetCertificateInformation(ctx context.Context, certificateID st
|
||||
}
|
||||
|
||||
type GetCertificateInformationResponse struct {
|
||||
XMLName xml.Name `xml:"GetCertificateInformationResponse"`
|
||||
XMLName xml.Name `xml:"GetCertificateInformationResponse"`
|
||||
CertificateInformation *CertificateInformation `xml:"CertificateInformation"`
|
||||
}
|
||||
|
||||
@@ -296,8 +296,8 @@ func (c *Client) GetPkcs10Request(ctx context.Context, certificateID, subject st
|
||||
}
|
||||
|
||||
type GetPkcs10RequestResponse struct {
|
||||
XMLName xml.Name `xml:"GetPkcs10RequestResponse"`
|
||||
Pkcs10Request *BinaryData `xml:"Pkcs10Request"`
|
||||
XMLName xml.Name `xml:"GetPkcs10RequestResponse"`
|
||||
Pkcs10Request *BinaryData `xml:"Pkcs10Request"`
|
||||
}
|
||||
|
||||
request := GetPkcs10RequestBody{
|
||||
@@ -323,8 +323,8 @@ func (c *Client) GetPkcs10Request(ctx context.Context, certificateID, subject st
|
||||
// ONVIF Specification: LoadCertificateWithPrivateKey operation
|
||||
func (c *Client) LoadCertificateWithPrivateKey(ctx context.Context, certificates []*Certificate, privateKey []*BinaryData, certificateIDs []string) error {
|
||||
type LoadCertificateWithPrivateKeyBody struct {
|
||||
XMLName xml.Name `xml:"tds:LoadCertificateWithPrivateKey"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
XMLName xml.Name `xml:"tds:LoadCertificateWithPrivateKey"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
CertificateWithPrivateKey []struct {
|
||||
CertificateID string `xml:"CertificateID"`
|
||||
Certificate *Certificate `xml:"Certificate"`
|
||||
|
||||
@@ -14,8 +14,8 @@ func newMockDeviceCertificatesServer() *httptest.Server {
|
||||
w.Header().Set("Content-Type", "application/soap+xml")
|
||||
|
||||
// Parse request to determine which operation
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
requestBody := string(buf)
|
||||
|
||||
var response string
|
||||
|
||||
+12
-12
@@ -131,7 +131,7 @@ func (c *Client) FixedGetSystemDateAndTime(ctx context.Context) (*SystemDateTime
|
||||
}
|
||||
|
||||
type GetSystemDateAndTimeResponse struct {
|
||||
XMLName xml.Name `xml:"GetSystemDateAndTimeResponse"`
|
||||
XMLName xml.Name `xml:"GetSystemDateAndTimeResponse"`
|
||||
SystemDateAndTime struct {
|
||||
DateTimeType string `xml:"DateTimeType"`
|
||||
DaylightSavings bool `xml:"DaylightSavings"`
|
||||
@@ -406,10 +406,10 @@ func (c *Client) GetRelayOutputs(ctx context.Context) ([]*RelayOutput, error) {
|
||||
// SetRelayOutputSettings sets the settings of a relay output
|
||||
func (c *Client) SetRelayOutputSettings(ctx context.Context, token string, settings *RelayOutputSettings) error {
|
||||
type SetRelayOutputSettings struct {
|
||||
XMLName xml.Name `xml:"tds:SetRelayOutputSettings"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
XMLName xml.Name `xml:"tds:SetRelayOutputSettings"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
RelayOutputToken string `xml:"tds:RelayOutputToken"`
|
||||
Properties struct {
|
||||
Properties struct {
|
||||
Mode string `xml:"tt:Mode"`
|
||||
DelayTime string `xml:"tt:DelayTime"`
|
||||
IdleState string `xml:"tt:IdleState"`
|
||||
@@ -417,7 +417,7 @@ func (c *Client) SetRelayOutputSettings(ctx context.Context, token string, setti
|
||||
}
|
||||
|
||||
req := SetRelayOutputSettings{
|
||||
Xmlns: deviceNamespace,
|
||||
Xmlns: deviceNamespace,
|
||||
RelayOutputToken: token,
|
||||
}
|
||||
req.Properties.Mode = string(settings.Mode)
|
||||
@@ -437,16 +437,16 @@ func (c *Client) SetRelayOutputSettings(ctx context.Context, token string, setti
|
||||
// SetRelayOutputState sets the state of a relay output
|
||||
func (c *Client) SetRelayOutputState(ctx context.Context, token string, state RelayLogicalState) error {
|
||||
type SetRelayOutputState struct {
|
||||
XMLName xml.Name `xml:"tds:SetRelayOutputState"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
XMLName xml.Name `xml:"tds:SetRelayOutputState"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
RelayOutputToken string `xml:"tds:RelayOutputToken"`
|
||||
LogicalState RelayLogicalState `xml:"tds:LogicalState"`
|
||||
LogicalState RelayLogicalState `xml:"tds:LogicalState"`
|
||||
}
|
||||
|
||||
req := SetRelayOutputState{
|
||||
Xmlns: deviceNamespace,
|
||||
Xmlns: deviceNamespace,
|
||||
RelayOutputToken: token,
|
||||
LogicalState: state,
|
||||
LogicalState: state,
|
||||
}
|
||||
|
||||
username, password := c.GetCredentials()
|
||||
@@ -628,8 +628,8 @@ func (c *Client) GetSystemUris(ctx context.Context) (*SystemLogUriList, string,
|
||||
}
|
||||
|
||||
type GetSystemUrisResponse struct {
|
||||
XMLName xml.Name `xml:"GetSystemUrisResponse"`
|
||||
SystemLogUris *struct {
|
||||
XMLName xml.Name `xml:"GetSystemUrisResponse"`
|
||||
SystemLogUris *struct {
|
||||
SystemLog []struct {
|
||||
Type string `xml:"Type"`
|
||||
Uri string `xml:"Uri"`
|
||||
|
||||
+10
-10
@@ -24,7 +24,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
|
||||
switch {
|
||||
case strings.Contains(bodyContent, "AddScopes"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:AddScopesResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -32,7 +32,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "RemoveScopes"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:RemoveScopesResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -42,7 +42,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetScopes"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetScopesResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -50,7 +50,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetRelayOutputs"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetRelayOutputsResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -66,7 +66,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetRelayOutputSettings"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetRelayOutputSettingsResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -74,7 +74,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetRelayOutputState"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetRelayOutputStateResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -82,7 +82,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SendAuxiliaryCommand"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SendAuxiliaryCommandResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -92,7 +92,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetSystemLog"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetSystemLogResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -104,7 +104,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetSystemFactoryDefault"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetSystemFactoryDefaultResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -112,7 +112,7 @@ func newMockDeviceExtendedServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "StartFirmwareUpgrade"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:StartFirmwareUpgradeResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
|
||||
+8
-8
@@ -370,7 +370,7 @@ func (c *Client) GetDynamicDNS(ctx context.Context) (*DynamicDNSInformation, err
|
||||
}
|
||||
|
||||
type GetDynamicDNSResponse struct {
|
||||
XMLName xml.Name `xml:"GetDynamicDNSResponse"`
|
||||
XMLName xml.Name `xml:"GetDynamicDNSResponse"`
|
||||
DynamicDNSInformation struct {
|
||||
Type string `xml:"Type"`
|
||||
Name string `xml:"Name"`
|
||||
@@ -431,13 +431,13 @@ func (c *Client) GetPasswordComplexityConfiguration(ctx context.Context) (*Passw
|
||||
}
|
||||
|
||||
type GetPasswordComplexityConfigurationResponse struct {
|
||||
XMLName xml.Name `xml:"GetPasswordComplexityConfigurationResponse"`
|
||||
MinLen int `xml:"MinLen"`
|
||||
Uppercase int `xml:"Uppercase"`
|
||||
Number int `xml:"Number"`
|
||||
SpecialChars int `xml:"SpecialChars"`
|
||||
BlockUsernameOccurrence bool `xml:"BlockUsernameOccurrence"`
|
||||
PolicyConfigurationLocked bool `xml:"PolicyConfigurationLocked"`
|
||||
XMLName xml.Name `xml:"GetPasswordComplexityConfigurationResponse"`
|
||||
MinLen int `xml:"MinLen"`
|
||||
Uppercase int `xml:"Uppercase"`
|
||||
Number int `xml:"Number"`
|
||||
SpecialChars int `xml:"SpecialChars"`
|
||||
BlockUsernameOccurrence bool `xml:"BlockUsernameOccurrence"`
|
||||
PolicyConfigurationLocked bool `xml:"PolicyConfigurationLocked"`
|
||||
}
|
||||
|
||||
req := GetPasswordComplexityConfiguration{
|
||||
|
||||
+14
-14
@@ -24,7 +24,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
|
||||
switch {
|
||||
case strings.Contains(bodyContent, "GetRemoteUser"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetRemoteUserResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -38,7 +38,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetRemoteUser"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetRemoteUserResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -46,7 +46,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetIPAddressFilter"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetIPAddressFilterResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -62,9 +62,9 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetIPAddressFilter"),
|
||||
strings.Contains(bodyContent, "AddIPAddressFilter"),
|
||||
strings.Contains(bodyContent, "RemoveIPAddressFilter"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
strings.Contains(bodyContent, "AddIPAddressFilter"),
|
||||
strings.Contains(bodyContent, "RemoveIPAddressFilter"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetIPAddressFilterResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -72,7 +72,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetZeroConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetZeroConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -86,7 +86,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetZeroConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetZeroConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -94,7 +94,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetPasswordComplexityConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetPasswordComplexityConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -109,7 +109,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetPasswordComplexityConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetPasswordComplexityConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -117,7 +117,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetPasswordHistoryConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetPasswordHistoryConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -128,7 +128,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetPasswordHistoryConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetPasswordHistoryConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
@@ -136,7 +136,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "GetAuthFailureWarningConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:GetAuthFailureWarningConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl">
|
||||
@@ -148,7 +148,7 @@ func newMockDeviceSecurityServer() *httptest.Server {
|
||||
</s:Envelope>`))
|
||||
|
||||
case strings.Contains(bodyContent, "SetAuthFailureWarningConfiguration"):
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
_, _ = w.Write([]byte(`<?xml version="1.0" encoding="UTF-8"?>
|
||||
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">
|
||||
<s:Body>
|
||||
<tds:SetAuthFailureWarningConfigurationResponse xmlns:tds="http://www.onvif.org/ver10/device/wsdl"/>
|
||||
|
||||
@@ -13,8 +13,8 @@ func newMockDeviceStorageServer() *httptest.Server {
|
||||
w.Header().Set("Content-Type", "application/soap+xml")
|
||||
|
||||
// Parse request to determine which operation
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
requestBody := string(buf)
|
||||
|
||||
var response string
|
||||
|
||||
+11
-11
@@ -18,7 +18,7 @@ func (c *Client) GetDot11Capabilities(ctx context.Context) (*Dot11Capabilities,
|
||||
}
|
||||
|
||||
type GetDot11CapabilitiesResponse struct {
|
||||
XMLName xml.Name `xml:"GetDot11CapabilitiesResponse"`
|
||||
XMLName xml.Name `xml:"GetDot11CapabilitiesResponse"`
|
||||
Capabilities *Dot11Capabilities `xml:"Capabilities"`
|
||||
}
|
||||
|
||||
@@ -73,14 +73,14 @@ func (c *Client) GetDot11Status(ctx context.Context, interfaceToken string) (*Do
|
||||
// ONVIF Specification: GetDot1XConfiguration operation
|
||||
func (c *Client) GetDot1XConfiguration(ctx context.Context, configToken string) (*Dot1XConfiguration, error) {
|
||||
type GetDot1XConfigurationBody struct {
|
||||
XMLName xml.Name `xml:"tds:GetDot1XConfiguration"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
Dot1XConfigurationToken string `xml:"tds:Dot1XConfigurationToken"`
|
||||
XMLName xml.Name `xml:"tds:GetDot1XConfiguration"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
Dot1XConfigurationToken string `xml:"tds:Dot1XConfigurationToken"`
|
||||
}
|
||||
|
||||
type GetDot1XConfigurationResponse struct {
|
||||
XMLName xml.Name `xml:"GetDot1XConfigurationResponse"`
|
||||
Dot1XConfiguration *Dot1XConfiguration `xml:"Dot1XConfiguration"`
|
||||
XMLName xml.Name `xml:"GetDot1XConfigurationResponse"`
|
||||
Dot1XConfiguration *Dot1XConfiguration `xml:"Dot1XConfiguration"`
|
||||
}
|
||||
|
||||
request := GetDot1XConfigurationBody{
|
||||
@@ -109,8 +109,8 @@ func (c *Client) GetDot1XConfigurations(ctx context.Context) ([]*Dot1XConfigurat
|
||||
}
|
||||
|
||||
type GetDot1XConfigurationsResponse struct {
|
||||
XMLName xml.Name `xml:"GetDot1XConfigurationsResponse"`
|
||||
Dot1XConfiguration []*Dot1XConfiguration `xml:"Dot1XConfiguration"`
|
||||
XMLName xml.Name `xml:"GetDot1XConfigurationsResponse"`
|
||||
Dot1XConfiguration []*Dot1XConfiguration `xml:"Dot1XConfiguration"`
|
||||
}
|
||||
|
||||
request := GetDot1XConfigurationsBody{
|
||||
@@ -193,9 +193,9 @@ func (c *Client) CreateDot1XConfiguration(ctx context.Context, config *Dot1XConf
|
||||
// ONVIF Specification: DeleteDot1XConfiguration operation
|
||||
func (c *Client) DeleteDot1XConfiguration(ctx context.Context, configToken string) error {
|
||||
type DeleteDot1XConfigurationBody struct {
|
||||
XMLName xml.Name `xml:"tds:DeleteDot1XConfiguration"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
Dot1XConfigurationToken string `xml:"tds:Dot1XConfigurationToken"`
|
||||
XMLName xml.Name `xml:"tds:DeleteDot1XConfiguration"`
|
||||
Xmlns string `xml:"xmlns:tds,attr"`
|
||||
Dot1XConfigurationToken string `xml:"tds:Dot1XConfigurationToken"`
|
||||
}
|
||||
|
||||
type DeleteDot1XConfigurationResponse struct {
|
||||
|
||||
+2
-2
@@ -13,8 +13,8 @@ func newMockDeviceWiFiServer() *httptest.Server {
|
||||
w.Header().Set("Content-Type", "application/soap+xml")
|
||||
|
||||
// Parse request to determine which operation
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
buf := make([]byte, r.ContentLength)
|
||||
_, _ = r.Body.Read(buf)
|
||||
requestBody := string(buf)
|
||||
|
||||
var response string
|
||||
|
||||
@@ -62,8 +62,8 @@ type ProbeMatch struct {
|
||||
|
||||
// ProbeMatches represents WS-Discovery probe matches
|
||||
type ProbeMatches struct {
|
||||
XMLName xml.Name `xml:"ProbeMatches"`
|
||||
ProbeMatch []ProbeMatch `xml:"ProbeMatch"`
|
||||
XMLName xml.Name `xml:"ProbeMatches"`
|
||||
ProbeMatch []ProbeMatch `xml:"ProbeMatch"`
|
||||
}
|
||||
|
||||
// DiscoverOptions contains options for device discovery
|
||||
|
||||
@@ -89,7 +89,7 @@ func demonstratePTZ(ctx context.Context, client *onvif.Client, profileToken stri
|
||||
fmt.Println("Moving camera right...")
|
||||
velocity := &onvif.PTZSpeed{
|
||||
PanTilt: &onvif.Vector2D{
|
||||
X: 0.5, // Move right
|
||||
X: 0.5, // Move right
|
||||
Y: 0.0,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -63,18 +63,18 @@ func TestBuildEnvelope(t *testing.T) {
|
||||
wantErr bool
|
||||
}{
|
||||
{
|
||||
name: "with authentication",
|
||||
body: &testRequest{Value: "test"},
|
||||
name: "with authentication",
|
||||
body: &testRequest{Value: "test"},
|
||||
username: "admin",
|
||||
password: "password",
|
||||
wantErr: false,
|
||||
wantErr: false,
|
||||
},
|
||||
{
|
||||
name: "without authentication",
|
||||
body: &testRequest{Value: "test"},
|
||||
name: "without authentication",
|
||||
body: &testRequest{Value: "test"},
|
||||
username: "",
|
||||
password: "",
|
||||
wantErr: false,
|
||||
wantErr: false,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
+12
-12
@@ -45,10 +45,10 @@ type AnalyticsCapabilities struct {
|
||||
|
||||
// DeviceCapabilities represents device service capabilities
|
||||
type DeviceCapabilities struct {
|
||||
XAddr string `xml:"XAddr"`
|
||||
Network *NetworkCapabilities `xml:"Network,omitempty"`
|
||||
System *SystemCapabilities `xml:"System,omitempty"`
|
||||
IO *IOCapabilities `xml:"IO,omitempty"`
|
||||
XAddr string `xml:"XAddr"`
|
||||
Network *NetworkCapabilities `xml:"Network,omitempty"`
|
||||
System *SystemCapabilities `xml:"System,omitempty"`
|
||||
IO *IOCapabilities `xml:"IO,omitempty"`
|
||||
Security *SecurityCapabilities `xml:"Security,omitempty"`
|
||||
}
|
||||
|
||||
@@ -62,12 +62,12 @@ type NetworkCapabilities struct {
|
||||
|
||||
// SystemCapabilities represents system capabilities
|
||||
type SystemCapabilities struct {
|
||||
DiscoveryResolve bool `xml:"DiscoveryResolve,attr"`
|
||||
DiscoveryBye bool `xml:"DiscoveryBye,attr"`
|
||||
RemoteDiscovery bool `xml:"RemoteDiscovery,attr"`
|
||||
SystemBackup bool `xml:"SystemBackup,attr"`
|
||||
SystemLogging bool `xml:"SystemLogging,attr"`
|
||||
FirmwareUpgrade bool `xml:"FirmwareUpgrade,attr"`
|
||||
DiscoveryResolve bool `xml:"DiscoveryResolve,attr"`
|
||||
DiscoveryBye bool `xml:"DiscoveryBye,attr"`
|
||||
RemoteDiscovery bool `xml:"RemoteDiscovery,attr"`
|
||||
SystemBackup bool `xml:"SystemBackup,attr"`
|
||||
SystemLogging bool `xml:"SystemLogging,attr"`
|
||||
FirmwareUpgrade bool `xml:"FirmwareUpgrade,attr"`
|
||||
}
|
||||
|
||||
// IOCapabilities represents I/O capabilities
|
||||
@@ -127,8 +127,8 @@ type GetServicesResponse struct {
|
||||
|
||||
// Service represents a service
|
||||
type Service struct {
|
||||
Namespace string `xml:"Namespace"`
|
||||
XAddr string `xml:"XAddr"`
|
||||
Namespace string `xml:"Namespace"`
|
||||
XAddr string `xml:"XAddr"`
|
||||
Version Version `xml:"Version"`
|
||||
}
|
||||
|
||||
|
||||
+20
-20
@@ -42,18 +42,18 @@ type BacklightCompensationSettings struct {
|
||||
|
||||
// ExposureSettings20 represents exposure settings for ONVIF 2.0
|
||||
type ExposureSettings20 struct {
|
||||
Mode string `xml:"Mode"`
|
||||
Priority *string `xml:"Priority,omitempty"`
|
||||
Mode string `xml:"Mode"`
|
||||
Priority *string `xml:"Priority,omitempty"`
|
||||
Window *Rectangle `xml:"Window,omitempty"`
|
||||
MinExposureTime *float64 `xml:"MinExposureTime,omitempty"`
|
||||
MaxExposureTime *float64 `xml:"MaxExposureTime,omitempty"`
|
||||
MinGain *float64 `xml:"MinGain,omitempty"`
|
||||
MaxGain *float64 `xml:"MaxGain,omitempty"`
|
||||
MinIris *float64 `xml:"MinIris,omitempty"`
|
||||
MaxIris *float64 `xml:"MaxIris,omitempty"`
|
||||
ExposureTime *float64 `xml:"ExposureTime,omitempty"`
|
||||
Gain *float64 `xml:"Gain,omitempty"`
|
||||
Iris *float64 `xml:"Iris,omitempty"`
|
||||
MinExposureTime *float64 `xml:"MinExposureTime,omitempty"`
|
||||
MaxExposureTime *float64 `xml:"MaxExposureTime,omitempty"`
|
||||
MinGain *float64 `xml:"MinGain,omitempty"`
|
||||
MaxGain *float64 `xml:"MaxGain,omitempty"`
|
||||
MinIris *float64 `xml:"MinIris,omitempty"`
|
||||
MaxIris *float64 `xml:"MaxIris,omitempty"`
|
||||
ExposureTime *float64 `xml:"ExposureTime,omitempty"`
|
||||
Gain *float64 `xml:"Gain,omitempty"`
|
||||
Iris *float64 `xml:"Iris,omitempty"`
|
||||
}
|
||||
|
||||
// FocusConfiguration20 represents focus configuration for ONVIF 2.0
|
||||
@@ -168,15 +168,15 @@ type WhiteBalanceOptions struct {
|
||||
|
||||
// MoveRequest represents Move (focus) request
|
||||
type MoveRequest struct {
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/imaging/wsdl Move"`
|
||||
VideoSourceToken string `xml:"VideoSourceToken"`
|
||||
Focus *FocusMove `xml:"Focus"`
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/imaging/wsdl Move"`
|
||||
VideoSourceToken string `xml:"VideoSourceToken"`
|
||||
Focus *FocusMove `xml:"Focus"`
|
||||
}
|
||||
|
||||
// FocusMove represents focus move parameters
|
||||
type FocusMove struct {
|
||||
Absolute *AbsoluteFocus `xml:"Absolute,omitempty"`
|
||||
Relative *RelativeFocus `xml:"Relative,omitempty"`
|
||||
Absolute *AbsoluteFocus `xml:"Absolute,omitempty"`
|
||||
Relative *RelativeFocus `xml:"Relative,omitempty"`
|
||||
Continuous *ContinuousFocus `xml:"Continuous,omitempty"`
|
||||
}
|
||||
|
||||
@@ -342,10 +342,10 @@ func (s *Server) HandleSetImagingSettings(body interface{}) (interface{}, error)
|
||||
func (s *Server) HandleGetOptions(body interface{}) (interface{}, error) {
|
||||
// Return available imaging options/capabilities
|
||||
options := &ImagingOptions{
|
||||
Brightness: &FloatRange{Min: 0, Max: 100},
|
||||
ColorSaturation: &FloatRange{Min: 0, Max: 100},
|
||||
Contrast: &FloatRange{Min: 0, Max: 100},
|
||||
Sharpness: &FloatRange{Min: 0, Max: 100},
|
||||
Brightness: &FloatRange{Min: 0, Max: 100},
|
||||
ColorSaturation: &FloatRange{Min: 0, Max: 100},
|
||||
Contrast: &FloatRange{Min: 0, Max: 100},
|
||||
Sharpness: &FloatRange{Min: 0, Max: 100},
|
||||
IrCutFilterModes: []string{"ON", "OFF", "AUTO"},
|
||||
BacklightCompensation: &BacklightCompensationOptions{
|
||||
Mode: []string{"OFF", "ON"},
|
||||
|
||||
+11
-11
@@ -9,7 +9,7 @@ import (
|
||||
|
||||
// GetProfilesResponse represents GetProfiles response
|
||||
type GetProfilesResponse struct {
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver10/media/wsdl GetProfilesResponse"`
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver10/media/wsdl GetProfilesResponse"`
|
||||
Profiles []MediaProfile `xml:"Profiles"`
|
||||
}
|
||||
|
||||
@@ -46,16 +46,16 @@ type AudioSourceConfiguration struct {
|
||||
|
||||
// VideoEncoderConfiguration represents video encoder configuration
|
||||
type VideoEncoderConfiguration struct {
|
||||
Token string `xml:"token,attr"`
|
||||
Name string `xml:"Name"`
|
||||
UseCount int `xml:"UseCount"`
|
||||
Encoding string `xml:"Encoding"`
|
||||
Resolution VideoResolution `xml:"Resolution"`
|
||||
Quality float64 `xml:"Quality"`
|
||||
RateControl *VideoRateControl `xml:"RateControl,omitempty"`
|
||||
H264 *H264Configuration `xml:"H264,omitempty"`
|
||||
Token string `xml:"token,attr"`
|
||||
Name string `xml:"Name"`
|
||||
UseCount int `xml:"UseCount"`
|
||||
Encoding string `xml:"Encoding"`
|
||||
Resolution VideoResolution `xml:"Resolution"`
|
||||
Quality float64 `xml:"Quality"`
|
||||
RateControl *VideoRateControl `xml:"RateControl,omitempty"`
|
||||
H264 *H264Configuration `xml:"H264,omitempty"`
|
||||
Multicast *MulticastConfiguration `xml:"Multicast,omitempty"`
|
||||
SessionTimeout string `xml:"SessionTimeout"`
|
||||
SessionTimeout string `xml:"SessionTimeout"`
|
||||
}
|
||||
|
||||
// AudioEncoderConfiguration represents audio encoder configuration
|
||||
@@ -130,7 +130,7 @@ type MulticastConfiguration struct {
|
||||
|
||||
// IPAddress represents an IP address
|
||||
type IPAddress struct {
|
||||
Type string `xml:"Type"`
|
||||
Type string `xml:"Type"`
|
||||
IPv4Address string `xml:"IPv4Address,omitempty"`
|
||||
IPv6Address string `xml:"IPv6Address,omitempty"`
|
||||
}
|
||||
|
||||
+9
-9
@@ -75,9 +75,9 @@ type GetStatusResponse struct {
|
||||
|
||||
// PTZStatus represents PTZ status
|
||||
type PTZStatus struct {
|
||||
Position PTZVector `xml:"Position"`
|
||||
MoveStatus PTZMoveStatus `xml:"MoveStatus"`
|
||||
UTCTime string `xml:"UtcTime"`
|
||||
Position PTZVector `xml:"Position"`
|
||||
MoveStatus PTZMoveStatus `xml:"MoveStatus"`
|
||||
UTCTime string `xml:"UtcTime"`
|
||||
}
|
||||
|
||||
// PTZMoveStatus represents PTZ movement status
|
||||
@@ -113,7 +113,7 @@ type GetPresetsRequest struct {
|
||||
|
||||
// GetPresetsResponse represents GetPresets response
|
||||
type GetPresetsResponse struct {
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/ptz/wsdl GetPresetsResponse"`
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/ptz/wsdl GetPresetsResponse"`
|
||||
Preset []PTZPreset `xml:"Preset"`
|
||||
}
|
||||
|
||||
@@ -153,16 +153,16 @@ type SetPresetResponse struct {
|
||||
|
||||
// GetConfigurationsResponse represents GetConfigurations response
|
||||
type GetConfigurationsResponse struct {
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/ptz/wsdl GetConfigurationsResponse"`
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver20/ptz/wsdl GetConfigurationsResponse"`
|
||||
PTZConfiguration []PTZConfigurationExt `xml:"PTZConfiguration"`
|
||||
}
|
||||
|
||||
// PTZConfigurationExt represents PTZ configuration with extensions
|
||||
type PTZConfigurationExt struct {
|
||||
Token string `xml:"token,attr"`
|
||||
Name string `xml:"Name"`
|
||||
UseCount int `xml:"UseCount"`
|
||||
NodeToken string `xml:"NodeToken"`
|
||||
Token string `xml:"token,attr"`
|
||||
Name string `xml:"Name"`
|
||||
UseCount int `xml:"UseCount"`
|
||||
NodeToken string `xml:"NodeToken"`
|
||||
PanTiltLimits *PanTiltLimits `xml:"PanTiltLimits,omitempty"`
|
||||
ZoomLimits *ZoomLimits `xml:"ZoomLimits,omitempty"`
|
||||
}
|
||||
|
||||
@@ -241,17 +241,17 @@ type GetSystemDateAndTimeRequest struct {
|
||||
|
||||
// GetSystemDateAndTimeResponse represents GetSystemDateAndTime response
|
||||
type GetSystemDateAndTimeResponse struct {
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver10/device/wsdl GetSystemDateAndTimeResponse"`
|
||||
XMLName xml.Name `xml:"http://www.onvif.org/ver10/device/wsdl GetSystemDateAndTimeResponse"`
|
||||
SystemDateAndTime SystemDateAndTime `xml:"SystemDateAndTime"`
|
||||
}
|
||||
|
||||
// SystemDateAndTime represents system date and time
|
||||
type SystemDateAndTime struct {
|
||||
DateTimeType string `xml:"DateTimeType"`
|
||||
DaylightSavings bool `xml:"DaylightSavings"`
|
||||
TimeZone TimeZone `xml:"TimeZone,omitempty"`
|
||||
UTCDateTime DateTime `xml:"UTCDateTime,omitempty"`
|
||||
LocalDateTime DateTime `xml:"LocalDateTime,omitempty"`
|
||||
DateTimeType string `xml:"DateTimeType"`
|
||||
DaylightSavings bool `xml:"DaylightSavings"`
|
||||
TimeZone TimeZone `xml:"TimeZone,omitempty"`
|
||||
UTCDateTime DateTime `xml:"UTCDateTime,omitempty"`
|
||||
LocalDateTime DateTime `xml:"LocalDateTime,omitempty"`
|
||||
}
|
||||
|
||||
// TimeZone represents timezone information
|
||||
|
||||
+10
-10
@@ -88,15 +88,15 @@ type AudioEncoderConfig struct {
|
||||
|
||||
// PTZConfig represents PTZ configuration
|
||||
type PTZConfig struct {
|
||||
NodeToken string // PTZ node token
|
||||
PanRange Range // Pan range in degrees
|
||||
TiltRange Range // Tilt range in degrees
|
||||
ZoomRange Range // Zoom range
|
||||
DefaultSpeed PTZSpeed // Default speed
|
||||
NodeToken string // PTZ node token
|
||||
PanRange Range // Pan range in degrees
|
||||
TiltRange Range // Tilt range in degrees
|
||||
ZoomRange Range // Zoom range
|
||||
DefaultSpeed PTZSpeed // Default speed
|
||||
SupportsContinuous bool // Supports continuous move
|
||||
SupportsAbsolute bool // Supports absolute move
|
||||
SupportsRelative bool // Supports relative move
|
||||
Presets []Preset // Predefined presets
|
||||
Presets []Preset // Predefined presets
|
||||
}
|
||||
|
||||
// SnapshotConfig represents snapshot configuration
|
||||
@@ -195,8 +195,8 @@ type BacklightCompensation struct {
|
||||
|
||||
// ExposureSettings represents exposure settings
|
||||
type ExposureSettings struct {
|
||||
Mode string // AUTO, MANUAL
|
||||
Priority string // LowNoise, FrameRate
|
||||
Mode string // AUTO, MANUAL
|
||||
Priority string // LowNoise, FrameRate
|
||||
MinExposure float64
|
||||
MaxExposure float64
|
||||
MinGain float64
|
||||
@@ -207,7 +207,7 @@ type ExposureSettings struct {
|
||||
|
||||
// FocusSettings represents focus settings
|
||||
type FocusSettings struct {
|
||||
AutoFocusMode string // AUTO, MANUAL
|
||||
AutoFocusMode string // AUTO, MANUAL
|
||||
DefaultSpeed float64
|
||||
NearLimit float64
|
||||
FarLimit float64
|
||||
@@ -216,7 +216,7 @@ type FocusSettings struct {
|
||||
|
||||
// WhiteBalanceSettings represents white balance settings
|
||||
type WhiteBalanceSettings struct {
|
||||
Mode string // AUTO, MANUAL
|
||||
Mode string // AUTO, MANUAL
|
||||
CrGain float64
|
||||
CbGain float64
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
package onvif
|
||||
package captures
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
@@ -872,9 +872,9 @@ const (
|
||||
|
||||
// RemoteUser represents remote user configuration
|
||||
type RemoteUser struct {
|
||||
Username string
|
||||
Password string
|
||||
UseDerivedPassword bool
|
||||
Username string
|
||||
Password string
|
||||
UseDerivedPassword bool
|
||||
}
|
||||
|
||||
// Certificate represents a certificate
|
||||
@@ -917,17 +917,17 @@ type CertificateUsage struct {
|
||||
|
||||
// DateTimeRange represents date/time range
|
||||
type DateTimeRange struct {
|
||||
From time.Time
|
||||
From time.Time
|
||||
Until time.Time
|
||||
}
|
||||
|
||||
// Dot11Capabilities represents 802.11 capabilities
|
||||
type Dot11Capabilities struct {
|
||||
TKIP bool
|
||||
ScanAvailableNetworks bool
|
||||
MultipleConfiguration bool
|
||||
AdHocStationMode bool
|
||||
WEP bool
|
||||
TKIP bool
|
||||
ScanAvailableNetworks bool
|
||||
MultipleConfiguration bool
|
||||
AdHocStationMode bool
|
||||
WEP bool
|
||||
}
|
||||
|
||||
// Dot11Status represents 802.11 status
|
||||
@@ -985,12 +985,12 @@ type TLSConfiguration struct {
|
||||
|
||||
// Dot11AvailableNetworks represents available 802.11 networks
|
||||
type Dot11AvailableNetworks struct {
|
||||
SSID string
|
||||
BSSID string
|
||||
AuthAndMangementSuite []Dot11AuthAndMangementSuite
|
||||
PairCipher []Dot11Cipher
|
||||
GroupCipher []Dot11Cipher
|
||||
SignalStrength Dot11SignalStrength
|
||||
SSID string
|
||||
BSSID string
|
||||
AuthAndMangementSuite []Dot11AuthAndMangementSuite
|
||||
PairCipher []Dot11Cipher
|
||||
GroupCipher []Dot11Cipher
|
||||
SignalStrength Dot11SignalStrength
|
||||
}
|
||||
|
||||
// Dot11AuthAndMangementSuite represents auth suite
|
||||
@@ -1011,18 +1011,18 @@ type StorageConfiguration struct {
|
||||
|
||||
// StorageConfigurationData represents storage configuration data
|
||||
type StorageConfigurationData struct {
|
||||
Type string
|
||||
LocalPath string
|
||||
StorageUri string
|
||||
User *UserCredential
|
||||
CertPathValidationPolicyID string
|
||||
Type string
|
||||
LocalPath string
|
||||
StorageUri string
|
||||
User *UserCredential
|
||||
CertPathValidationPolicyID string
|
||||
}
|
||||
|
||||
// UserCredential represents user credentials
|
||||
type UserCredential struct {
|
||||
UserName string
|
||||
Password string
|
||||
Token string
|
||||
UserName string
|
||||
Password string
|
||||
Token string
|
||||
}
|
||||
|
||||
// LocationEntity represents geo location
|
||||
@@ -1049,12 +1049,12 @@ type AccessPolicy struct {
|
||||
|
||||
// PasswordComplexityConfiguration represents password complexity config
|
||||
type PasswordComplexityConfiguration struct {
|
||||
MinLen int
|
||||
Uppercase int
|
||||
Number int
|
||||
SpecialChars int
|
||||
BlockUsernameOccurrence bool
|
||||
PolicyConfigurationLocked bool
|
||||
MinLen int
|
||||
Uppercase int
|
||||
Number int
|
||||
SpecialChars int
|
||||
BlockUsernameOccurrence bool
|
||||
PolicyConfigurationLocked bool
|
||||
}
|
||||
|
||||
// PasswordHistoryConfiguration represents password history config
|
||||
|
||||
Reference in New Issue
Block a user