diff --git a/cmd/gonvif/ptz/cmd.go b/cmd/gonvif/ptz/cmd.go index 2d60cb4..3aaa21d 100644 --- a/cmd/gonvif/ptz/cmd.go +++ b/cmd/gonvif/ptz/cmd.go @@ -20,6 +20,7 @@ func init() { getConfigurations, getNodes, getPresets, + getServiceCapabilities, ) } diff --git a/cmd/gonvif/ptz/get-service-capabilities.go b/cmd/gonvif/ptz/get-service-capabilities.go new file mode 100644 index 0000000..39a2360 --- /dev/null +++ b/cmd/gonvif/ptz/get-service-capabilities.go @@ -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) +}