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:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user