refactor: improve code readability and maintainability across multiple files
- Reformatted function signatures for better clarity in media.go and onvif-quick/main.go. - Replaced hardcoded values with constants in ascii.go and server/imaging.go for improved maintainability. - Enhanced error handling and logging consistency in onvif-diagnostics/main.go and server/server.go. - Updated comments to clarify functionality and ensure adherence to ONVIF specifications across various files.
This commit is contained in:
@@ -196,7 +196,7 @@ func connectAndShowInfo() {
|
||||
client, err := onvif.NewClient(
|
||||
endpoint,
|
||||
onvif.WithCredentials(username, password),
|
||||
onvif.WithTimeout(30*time.Second),
|
||||
onvif.WithTimeout(ptzTimeout*time.Second),
|
||||
)
|
||||
if err != nil {
|
||||
fmt.Printf("❌ Error: %v\n", err)
|
||||
@@ -311,7 +311,7 @@ func ptzDemo() {
|
||||
|
||||
switch choice {
|
||||
case "1":
|
||||
velocity = &onvif.PTZSpeed{PanTilt: &onvif.Vector2D{X: 0.5, Y: 0.0}}
|
||||
velocity = &onvif.PTZSpeed{PanTilt: &onvif.Vector2D{X: ptzSpeed, Y: 0.0}}
|
||||
case "2":
|
||||
velocity = &onvif.PTZSpeed{PanTilt: &onvif.Vector2D{X: -ptzSpeed, Y: 0.0}}
|
||||
case "3":
|
||||
@@ -335,7 +335,7 @@ func ptzDemo() {
|
||||
return
|
||||
}
|
||||
fmt.Println("✅ Moving for 2 seconds...")
|
||||
time.Sleep(2 * time.Second)
|
||||
time.Sleep(ptzStepSize * time.Second)
|
||||
//nolint:errcheck // Stop error is not critical for demo
|
||||
_ = client.Stop(ctx, profileToken, true, false)
|
||||
} else if position != nil {
|
||||
|
||||
Reference in New Issue
Block a user