| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package main
- import (
- "fmt"
- "log"
- "time"
- "github.com/kr/pretty"
- "lc/common/onvif/discovery"
- "lc/common/onvif/profiles/devicemgmt"
- "lc/common/onvif/profiles/media"
- "lc/common/onvif/soap"
- )
- func main() {
- // discovery devices
- devices, err := discovery.StartDiscovery(5 * time.Second)
- if err != nil {
- return
- }
- if len(devices) == 0 {
- fmt.Printf("No devices descovered\n")
- return
- }
- // Create soap client
- client := soap.NewClient(
- soap.WithTimeout(time.Second * 5),
- )
- client.AddHeader(soap.NewWSSSecurityHeader("video", "123456qwe"))
- for _, d := range devices {
- dev := devicemgmt.NewDevice(client, d.XAddr)
- {
- dev.GetDeviceInformation(&devicemgmt.GetDeviceInformation{})
- }
- {
- dev.GetServices(&devicemgmt.GetServices{})
- }
- {
- dev.GetCapabilities(&devicemgmt.GetCapabilities{})
- }
- m := media.NewMedia(client, d.XAddr)
- {
- m.GetStreamUri(&media.GetStreamUri{})
- }
- }
- }
|