refactor: streamline media operations and enhance PTZ XML serialization

- Refactored media operations to consistently use the `getMediaEndpoint` method for endpoint retrieval, improving code clarity and reducing redundancy.
- Simplified the `ContinuousMove`, `AbsoluteMove`, and `RelativeMove` methods by introducing shared XML serialization types for PTZ commands, enhancing maintainability.
- Updated the `generateUUID` function to improve UUID generation efficiency by reducing redundant calls to `time.Now()`.
- Replaced manual struct definitions with dedicated XML types for better readability and organization in PTZ operations.
This commit is contained in:
0x524a
2025-12-03 10:37:35 -05:00
parent 21646af4ca
commit 6603084ccd
5 changed files with 184 additions and 710 deletions
+2 -24
View File
@@ -5,6 +5,7 @@ import (
"encoding/xml"
"errors"
"fmt"
"strings"
"time"
"github.com/0x524a/onvif-go/internal/soap"
@@ -751,28 +752,5 @@ func splitSpaceSeparated(s string) []string {
return nil
}
var result []string
start := 0
inWord := false
for i, r := range s {
if r == ' ' || r == '\t' {
if inWord {
result = append(result, s[start:i])
inWord = false
}
} else {
if !inWord {
start = i
inWord = true
}
}
}
if inWord {
result = append(result, s[start:])
}
return result
return strings.Fields(s)
}