Add ONVIF types and structures for device capabilities and configurations
- Introduced comprehensive data structures for ONVIF device information, capabilities, media profiles, and configurations. - Added types for device services, network settings, imaging options, audio/video configurations, and user management. - Implemented structures for handling various ONVIF features including PTZ control, event subscriptions, and analytics configurations. - Enhanced support for network protocols, security settings, and system logging.
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/0x524a/onvif-go/discovery"
|
||||
)
|
||||
|
||||
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()
|
||||
|
||||
// Discover devices
|
||||
devices, err := discovery.Discover(ctx, 5*time.Second)
|
||||
if err != nil {
|
||||
log.Fatalf("Discovery failed: %v", err)
|
||||
}
|
||||
|
||||
if len(devices) == 0 {
|
||||
fmt.Println("No ONVIF devices found on the network")
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("\nFound %d device(s):\n\n", len(devices))
|
||||
|
||||
for i, device := range devices {
|
||||
fmt.Printf("Device #%d:\n", i+1)
|
||||
fmt.Printf(" Endpoint: %s\n", device.GetDeviceEndpoint())
|
||||
fmt.Printf(" Name: %s\n", device.GetName())
|
||||
fmt.Printf(" Location: %s\n", device.GetLocation())
|
||||
fmt.Printf(" Types: %v\n", device.Types)
|
||||
fmt.Printf(" Scopes: %v\n", device.Scopes)
|
||||
fmt.Printf(" XAddrs: %v\n", device.XAddrs)
|
||||
fmt.Println()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user