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:
ProtoTess
2025-12-01 00:49:36 +00:00
parent 856f49c82d
commit b4e4982876
37 changed files with 318 additions and 322 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ import (
func main() {
fmt.Println("Discovering ONVIF devices on the network...")
// Create a context with timeout
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
+3 -3
View File
@@ -100,15 +100,15 @@ func main() {
// Modify some settings
fmt.Println("\n\nModifying imaging settings...")
// Increase brightness
newBrightness := 60.0
settings.Brightness = &newBrightness
// Increase contrast
newContrast := 55.0
settings.Contrast = &newContrast
// Set to auto exposure
if settings.Exposure != nil {
settings.Exposure.Mode = "AUTO"
+1 -1
View File
@@ -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,
},
}
+3 -3
View File
@@ -73,7 +73,7 @@ func main() {
for i, profile := range profiles {
fmt.Printf("\n Profile %d: %s\n", i+1, profile.Name)
fmt.Printf(" Token: %s\n", profile.Token)
if profile.VideoEncoderConfiguration != nil {
fmt.Printf(" Video: %dx%d @ %s\n",
profile.VideoEncoderConfiguration.Resolution.Width,
@@ -98,7 +98,7 @@ func main() {
// Test PTZ if available
if profile.PTZConfiguration != nil {
fmt.Println(" PTZ: ✓ Enabled")
// Get PTZ status
status, err := client.GetStatus(ctx, profile.Token)
if err == nil {
@@ -121,7 +121,7 @@ func main() {
if len(profiles) > 0 && profiles[0].PTZConfiguration != nil {
fmt.Println("🎮 Test 5: Testing PTZ Control...")
profileToken := profiles[0].Token
// Absolute move to home position
fmt.Println(" Moving to home position...")
position := &onvif.PTZVector{