Skip to content

Commit cc3d777

Browse files
committed
Add device system-reboot command.
1 parent a5f49b5 commit cc3d777

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

cmd/gonvif/device/cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func init() {
1919
cmd.AddCommand(
2020
getDeviceInformation,
2121
getServices,
22+
systemReboot,
2223
)
2324
}
2425

cmd/gonvif/device/system-reboot.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package media
2+
3+
import (
4+
"github.com/spf13/cobra"
5+
6+
"github.com/eyetowers/gonvif/cmd/gonvif/root"
7+
"github.com/eyetowers/gonvif/pkg/generated/onvif/www_onvif_org/ver10/device/wsdl"
8+
)
9+
10+
var systemReboot = &cobra.Command{
11+
Use: "system-reboot",
12+
Short: "Reboot Onvif device",
13+
Args: cobra.NoArgs,
14+
RunE: func(cmd *cobra.Command, args []string) error {
15+
client, err := ServiceClient(root.URL, root.Username, root.Password, root.Verbose)
16+
if err != nil {
17+
return err
18+
}
19+
return runSystemReboot(client)
20+
},
21+
}
22+
23+
func runSystemReboot(client wsdl.Device) error {
24+
resp, err := client.SystemReboot(&wsdl.SystemReboot{})
25+
if err != nil {
26+
return err
27+
}
28+
return root.OutputJSON(resp)
29+
}

0 commit comments

Comments
 (0)