Skip to content

Commit

Permalink
Add ptz get-service-capabilities command.
Browse files Browse the repository at this point in the history
  • Loading branch information
osery committed Oct 13, 2022
1 parent ea755a0 commit 823a6bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/gonvif/ptz/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ func init() {
getConfigurations,
getNodes,
getPresets,
getServiceCapabilities,
)
}

Expand Down
29 changes: 29 additions & 0 deletions cmd/gonvif/ptz/get-service-capabilities.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ptz

import (
"github.com/spf13/cobra"

"github.com/eyetowers/gonvif/cmd/gonvif/root"
"github.com/eyetowers/gonvif/pkg/generated/onvif/www_onvif_org/ver20/ptz/wsdl"
)

var getServiceCapabilities = &cobra.Command{
Use: "get-service-capabilities",
Short: "Show Onvif device PTZ capabilities",
Args: cobra.NoArgs,
RunE: func(cmd *cobra.Command, args []string) error {
client, err := ServiceClient(root.URL, root.Username, root.Password, root.Verbose)
if err != nil {
return err
}
return runGetServiceCapabilities(client)
},
}

func runGetServiceCapabilities(client wsdl.PTZ) error {
resp, err := client.GetServiceCapabilities(&wsdl.GetServiceCapabilities{})
if err != nil {
return err
}
return root.OutputJSON(resp)
}

0 comments on commit 823a6bd

Please sign in to comment.