@@ -30,5 +30,110 @@ public IActionResult SetEstimatedAuths(List<Models.LoginUserModel> users)
30
30
_checkerService . SetLoginUsers ( users ) ;
31
31
return Ok ( ) ;
32
32
}
33
+
34
+ [ HttpPost ( "CheckDevicePTZSupport" ) ]
35
+ public async Task < IActionResult > CheckDevicePTZSupportAsync ( Models . LoginUserModel auth )
36
+ {
37
+ try
38
+ {
39
+ if ( auth . ip == null || auth . user == null || auth . pass == null )
40
+ return BadRequest ( "Required auth parameters are missing" ) ;
41
+
42
+ if ( await Helper . CheckDevicePTZSupportAsync ( auth . ip , auth . user , auth . pass ) )
43
+ return Ok ( ) ;
44
+ else
45
+ return NotFound ( ) ;
46
+ }
47
+ catch ( Exception ex )
48
+ {
49
+ return Problem ( ex . Message ) ;
50
+ }
51
+ }
52
+
53
+ [ HttpPost ( "ListDeviceOnvifProfiles" ) ]
54
+ public async Task < IActionResult > ListDeviceOnvifProfilesAsync ( Models . LoginUserModel auth )
55
+ {
56
+ try
57
+ {
58
+ if ( auth . ip == null || auth . user == null || auth . pass == null )
59
+ return BadRequest ( "Required auth parameters are missing" ) ;
60
+
61
+ var profiles = await Helper . GetOnvifProfilesAsync ( auth . ip , auth . user , auth . pass ) ;
62
+ if ( profiles != null )
63
+ return Ok ( profiles ) ;
64
+ else
65
+ return NotFound ( ) ;
66
+ }
67
+ catch ( Exception ex )
68
+ {
69
+ return Problem ( ex . Message ) ;
70
+ }
71
+ }
72
+
73
+ [ HttpPost ( "StartPTZContinuousMove" ) ]
74
+ public async Task < IActionResult > StartPTZContinuousMoveAsync ( Models . StartPTZModel model )
75
+ {
76
+ try
77
+ {
78
+ if ( model . auth == null || model . ptz == null || string . IsNullOrEmpty ( model . profileToken ) )
79
+ return BadRequest ( "Invalid parameters" ) ;
80
+
81
+ if ( model . auth . ip == null || model . auth . user == null || model . auth . pass == null )
82
+ return BadRequest ( "Required auth parameters are missing" ) ;
83
+
84
+ if ( await Helper . PTZContinuousMoveAsync ( model . auth . ip , model . auth . user , model . auth . pass , model . profileToken , model . ptz ) )
85
+ return Ok ( ) ;
86
+ else
87
+ return Problem ( "Cannot start PTZ continuous move" ) ;
88
+ }
89
+ catch ( Exception ex )
90
+ {
91
+ return Problem ( ex . Message ) ;
92
+ }
93
+ }
94
+
95
+ [ HttpPost ( "StopPTZContinuousMove" ) ]
96
+ public async Task < IActionResult > StopPTZContinuousMoveAsync ( Models . StopPTZModel model )
97
+ {
98
+ try
99
+ {
100
+ if ( model . auth == null || string . IsNullOrEmpty ( model . profileToken ) )
101
+ return BadRequest ( "Invalid parameters" ) ;
102
+
103
+ if ( model . auth . ip == null || model . auth . user == null || model . auth . pass == null )
104
+ return BadRequest ( "Required auth parameters are missing" ) ;
105
+
106
+ if ( await Helper . PTZStopAsync ( model . auth . ip , model . auth . user , model . auth . pass , model . profileToken ) )
107
+ return Ok ( ) ;
108
+ else
109
+ return Problem ( "Cannot stop PTZ continuous move" ) ;
110
+ }
111
+ catch ( Exception ex )
112
+ {
113
+ return Problem ( ex . Message ) ;
114
+ }
115
+ }
116
+
117
+ [ HttpPost ( "GoToHomePosition" ) ]
118
+ public async Task < IActionResult > GoToHomePositionAsync ( Models . GoToHomePTZModel model )
119
+ {
120
+ try
121
+ {
122
+ if ( model . auth == null || string . IsNullOrEmpty ( model . profileToken ) )
123
+ return BadRequest ( "Invalid parameters" ) ;
124
+
125
+ if ( model . auth . ip == null || model . auth . user == null || model . auth . pass == null )
126
+ return BadRequest ( "Required auth parameters are missing" ) ;
127
+
128
+ if ( await Helper . GoToPTZHomeAsync ( model . auth . ip , model . auth . user , model . auth . pass , model . profileToken ) )
129
+ return Ok ( ) ;
130
+ else
131
+ return Problem ( "Cannot go to home position" ) ;
132
+ }
133
+ catch ( Exception ex )
134
+ {
135
+ return Problem ( ex . Message ) ;
136
+ }
137
+ }
33
138
}
34
139
}
0 commit comments