3
3
import net .twasi .obsremotejava .callbacks .Callback ;
4
4
import net .twasi .obsremotejava .callbacks .ErrorCallback ;
5
5
import net .twasi .obsremotejava .callbacks .StringCallback ;
6
+ import net .twasi .obsremotejava .callbacks .VoidCallback ;
7
+ import net .twasi .obsremotejava .events .responses .*;
6
8
import net .twasi .obsremotejava .objects .throwables .OBSResponseError ;
9
+ import net .twasi .obsremotejava .requests .GetCurrentProfile .GetCurrentProfileResponse ;
10
+ import net .twasi .obsremotejava .requests .GetCurrentScene .GetCurrentSceneResponse ;
11
+ import net .twasi .obsremotejava .requests .GetPreviewScene .GetPreviewSceneResponse ;
12
+ import net .twasi .obsremotejava .requests .GetSceneList .GetSceneListResponse ;
13
+ import net .twasi .obsremotejava .requests .GetSourceSettings .GetSourceSettingsResponse ;
14
+ import net .twasi .obsremotejava .requests .GetStreamingStatus .GetStreamingStatusResponse ;
15
+ import net .twasi .obsremotejava .requests .GetStudioModeEnabled .GetStudioModeEnabledResponse ;
16
+ import net .twasi .obsremotejava .requests .GetTransitionDuration .GetTransitionDurationResponse ;
17
+ import net .twasi .obsremotejava .requests .GetTransitionList .GetTransitionListResponse ;
18
+ import net .twasi .obsremotejava .requests .GetVersion .GetVersionResponse ;
19
+ import net .twasi .obsremotejava .requests .GetVolume .GetVolumeResponse ;
20
+ import net .twasi .obsremotejava .requests .ListProfiles .ListProfilesResponse ;
21
+ import net .twasi .obsremotejava .requests .SaveReplayBuffer .SaveReplayBufferResponse ;
22
+ import net .twasi .obsremotejava .requests .SetCurrentProfile .SetCurrentProfileResponse ;
23
+ import net .twasi .obsremotejava .requests .SetCurrentScene .SetCurrentSceneResponse ;
24
+ import net .twasi .obsremotejava .requests .SetCurrentTransition .SetCurrentTransitionResponse ;
25
+ import net .twasi .obsremotejava .requests .SetMute .SetMuteResponse ;
26
+ import net .twasi .obsremotejava .requests .SetPreviewScene .SetPreviewSceneResponse ;
27
+ import net .twasi .obsremotejava .requests .SetSceneItemProperties .SetSceneItemPropertiesResponse ;
28
+ import net .twasi .obsremotejava .requests .SetSourceSettings .SetSourceSettingsResponse ;
29
+ import net .twasi .obsremotejava .requests .SetStudioModeEnabled .SetStudioModeEnabledResponse ;
30
+ import net .twasi .obsremotejava .requests .SetTransitionDuration .SetTransitionDurationResponse ;
31
+ import net .twasi .obsremotejava .requests .SetVolume .SetVolumeResponse ;
32
+ import net .twasi .obsremotejava .requests .StartRecording .StartRecordingResponse ;
33
+ import net .twasi .obsremotejava .requests .StartReplayBuffer .StartReplayBufferResponse ;
34
+ import net .twasi .obsremotejava .requests .StartStreaming .StartStreamingResponse ;
35
+ import net .twasi .obsremotejava .requests .StopRecording .StopRecordingResponse ;
36
+ import net .twasi .obsremotejava .requests .StopReplayBuffer .StopReplayBufferResponse ;
37
+ import net .twasi .obsremotejava .requests .StopStreaming .StopStreamingResponse ;
38
+ import net .twasi .obsremotejava .requests .TransitionToProgram .TransitionToProgramResponse ;
7
39
import org .eclipse .jetty .websocket .api .Session ;
8
40
import org .eclipse .jetty .websocket .client .ClientUpgradeRequest ;
9
41
import org .eclipse .jetty .websocket .client .WebSocketClient ;
@@ -84,7 +116,7 @@ public void connect() {
84
116
public void disconnect () {
85
117
// wait for closed socket connection
86
118
try {
87
- if (debug ) {
119
+ if (debug ) {
88
120
log .debug ("Closing connection." );
89
121
}
90
122
communicator .awaitClose (1 , TimeUnit .SECONDS );
@@ -94,7 +126,7 @@ public void disconnect() {
94
126
95
127
if (!client .isStopped () && !client .isStopping ()) {
96
128
try {
97
- if (debug ) {
129
+ if (debug ) {
98
130
log .debug ("Stopping client." );
99
131
}
100
132
client .stop ();
@@ -108,7 +140,7 @@ public boolean isFailed() {
108
140
return failed ;
109
141
}
110
142
111
- public void getScenes (Callback callback ) {
143
+ public void getScenes (Callback < GetSceneListResponse > callback ) {
112
144
communicator .getScenes (callback );
113
145
}
114
146
@@ -117,11 +149,11 @@ public void registerOnError(ErrorCallback onError) {
117
149
communicator .registerOnError (onError );
118
150
}
119
151
120
- public void registerConnectCallback (Callback onConnect ) {
152
+ public void registerConnectCallback (Callback < GetVersionResponse > onConnect ) {
121
153
communicator .registerOnConnect (onConnect );
122
154
}
123
155
124
- public void registerDisconnectCallback (Callback onDisconnect ) {
156
+ public void registerDisconnectCallback (VoidCallback onDisconnect ) {
125
157
communicator .registerOnDisconnect (onDisconnect );
126
158
}
127
159
@@ -130,75 +162,75 @@ public void registerConnectionFailedCallback(StringCallback onConnectionFailed)
130
162
communicator .registerOnConnectionFailed (onConnectionFailed );
131
163
}
132
164
133
- public void registerRecordingStartedCallback (Callback onRecordingStarted ) {
165
+ public void registerRecordingStartedCallback (VoidCallback onRecordingStarted ) {
134
166
communicator .registerOnRecordingStarted (onRecordingStarted );
135
167
}
136
168
137
- public void registerRecordingStoppedCallback (Callback onRecordingStopped ) {
169
+ public void registerRecordingStoppedCallback (VoidCallback onRecordingStopped ) {
138
170
communicator .registerOnRecordingStopped (onRecordingStopped );
139
171
}
140
172
141
- public void registerReplayStartedCallback (Callback onReplayStarted ) {
173
+ public void registerReplayStartedCallback (VoidCallback onReplayStarted ) {
142
174
communicator .registerOnReplayStarted (onReplayStarted );
143
175
}
144
176
145
- public void registerReplayStartingCallback (Callback onReplayStarting ) {
177
+ public void registerReplayStartingCallback (VoidCallback onReplayStarting ) {
146
178
communicator .registerOnReplayStarting (onReplayStarting );
147
179
}
148
180
149
- public void registerReplayStoppedCallback (Callback onReplayStopped ) {
181
+ public void registerReplayStoppedCallback (VoidCallback onReplayStopped ) {
150
182
communicator .registerOnReplayStopped (onReplayStopped );
151
183
}
152
184
153
- public void registerReplayStoppingCallback (Callback onReplayStopping ) {
185
+ public void registerReplayStoppingCallback (VoidCallback onReplayStopping ) {
154
186
communicator .registerOnReplayStopping (onReplayStopping );
155
187
}
156
188
157
- public void registerStreamStartedCallback (Callback onRecordingStarted ) {
189
+ public void registerStreamStartedCallback (VoidCallback onRecordingStarted ) {
158
190
communicator .registerOnStreamStarted (onRecordingStarted );
159
191
}
160
192
161
- public void registerStreamStoppedCallback (Callback onRecordingStopped ) {
193
+ public void registerStreamStoppedCallback (VoidCallback onRecordingStopped ) {
162
194
communicator .registerOnStreamStopped (onRecordingStopped );
163
195
}
164
196
165
- public void registerSwitchScenesCallback (Callback onSwitchScenes ) {
197
+ public void registerSwitchScenesCallback (Callback < SwitchScenesResponse > onSwitchScenes ) {
166
198
communicator .registerOnSwitchScenes (onSwitchScenes );
167
199
}
168
200
169
- public void registerScenesChangedCallback (Callback onScenesChanged ) {
201
+ public void registerScenesChangedCallback (Callback < ScenesChangedResponse > onScenesChanged ) {
170
202
communicator .registerOnScenesChanged (onScenesChanged );
171
203
}
172
204
173
- public void registerSwitchTransitionCallback (Callback onSwitchTransition ) {
205
+ public void registerSwitchTransitionCallback (Callback < SwitchTransitionResponse > onSwitchTransition ) {
174
206
communicator .registerOnSwitchTransition (onSwitchTransition );
175
207
}
176
208
177
- public void registerTransitionListChangedCallback (Callback onTransitionListChanged ) {
209
+ public void registerTransitionListChangedCallback (Callback < TransitionListChangedResponse > onTransitionListChanged ) {
178
210
communicator .registerOnTransitionListChanged (onTransitionListChanged );
179
211
}
180
212
181
- public void registerTransitionBeginCallback (Callback onTransitionBegin ) {
213
+ public void registerTransitionBeginCallback (Callback < TransitionBeginResponse > onTransitionBegin ) {
182
214
communicator .registerOnTransitionBegin (onTransitionBegin );
183
215
}
184
216
185
- public void registerTransitionEndCallback (Callback onTransitionEnd ) {
217
+ public void registerTransitionEndCallback (Callback < TransitionEndResponse > onTransitionEnd ) {
186
218
communicator .registerOnTransitionEnd (onTransitionEnd );
187
219
}
188
220
189
221
public void await () throws InterruptedException {
190
222
communicator .await ();
191
223
}
192
224
193
- public void setCurrentScene (String szene , Callback callback ) {
194
- communicator .setCurrentScene (szene , callback );
225
+ public void setCurrentScene (String scene , Callback < SetCurrentSceneResponse > callback ) {
226
+ communicator .setCurrentScene (scene , callback );
195
227
}
196
228
197
- public void setCurrentTransition (String transition , Callback callback ) {
229
+ public void setCurrentTransition (String transition , Callback < SetCurrentTransitionResponse > callback ) {
198
230
communicator .setCurrentTransition (transition , callback );
199
231
}
200
232
201
- public void changeSceneWithTransition (final String scene , String transition , final Callback callback ) {
233
+ public void changeSceneWithTransition (final String scene , String transition , final Callback < SetCurrentSceneResponse > callback ) {
202
234
communicator .setCurrentTransition (transition , response -> {
203
235
if (!response .getStatus ().equals ("ok" )) {
204
236
log .error ("Failed to change transition. Pls fix." );
@@ -208,112 +240,112 @@ public void changeSceneWithTransition(final String scene, String transition, fin
208
240
});
209
241
}
210
242
211
- public void setSourceVisibility (String scene , String source , boolean visibility , Callback callback ) {
243
+ public void setSourceVisibility (String scene , String source , boolean visibility , Callback < SetSceneItemPropertiesResponse > callback ) {
212
244
communicator .setSourceVisiblity (scene , source , visibility , callback );
213
245
}
214
246
215
- public void getSceneItemProperties (String scene , String source , Callback callback ) {
247
+ public void getSceneItemProperties (String scene , String source , Callback < SetSceneItemPropertiesResponse > callback ) {
216
248
communicator .getSceneItemProperties (scene , source , callback );
217
249
}
218
250
219
- public void getTransitionList (Callback callback ) {
251
+ public void getTransitionList (Callback < GetTransitionListResponse > callback ) {
220
252
communicator .getTransitionList (callback );
221
253
}
222
254
223
- public void transitionToProgram (String transitionName , int duration , Callback callback ) {
255
+ public void transitionToProgram (String transitionName , int duration , Callback < TransitionToProgramResponse > callback ) {
224
256
communicator .transitionToProgram (transitionName , duration , callback );
225
257
}
226
258
227
- public void getSourceSettings (String sourceName , Callback callback ) {
259
+ public void getSourceSettings (String sourceName , Callback < GetSourceSettingsResponse > callback ) {
228
260
communicator .getSourceSettings (sourceName , callback );
229
261
}
230
262
231
- public void setSourceSettings (String sourceName , Map <String , Object > settings , Callback callback ) {
263
+ public void setSourceSettings (String sourceName , Map <String , Object > settings , Callback < SetSourceSettingsResponse > callback ) {
232
264
communicator .setSourceSettings (sourceName , settings , callback );
233
265
}
234
266
235
- public void getStreamingStatus (Callback callback ) {
267
+ public void getStreamingStatus (Callback < GetStreamingStatusResponse > callback ) {
236
268
communicator .getStreamingStatus (callback );
237
269
}
238
270
239
- public void startStreaming (Callback callback ) {
271
+ public void startStreaming (Callback < StartStreamingResponse > callback ) {
240
272
communicator .startStreaming (callback );
241
273
}
242
274
243
- public void stopStreaming (Callback callback ) {
275
+ public void stopStreaming (Callback < StopStreamingResponse > callback ) {
244
276
communicator .stopStreaming (callback );
245
277
}
246
278
247
- public void startRecording (Callback callback ) {
279
+ public void startRecording (Callback < StartRecordingResponse > callback ) {
248
280
communicator .startRecording (callback );
249
281
}
250
282
251
- public void stopRecording (Callback callback ) {
283
+ public void stopRecording (Callback < StopRecordingResponse > callback ) {
252
284
communicator .stopRecording (callback );
253
285
}
254
286
255
- public void listProfiles (Callback callback ) {
287
+ public void listProfiles (Callback < ListProfilesResponse > callback ) {
256
288
communicator .listProfiles (callback );
257
289
}
258
290
259
- public void getCurrentProfile (Callback callback ) {
291
+ public void getCurrentProfile (Callback < GetCurrentProfileResponse > callback ) {
260
292
communicator .getCurrentProfile (callback );
261
293
}
262
294
263
- public void setCurrentProfile (String profile , Callback callback ) {
295
+ public void setCurrentProfile (String profile , Callback < SetCurrentProfileResponse > callback ) {
264
296
communicator .setCurrentProfile (profile , callback );
265
297
}
266
298
267
- public void getCurrentScene (Callback callback ) {
299
+ public void getCurrentScene (Callback < GetCurrentSceneResponse > callback ) {
268
300
communicator .getCurrentScene (callback );
269
301
}
270
302
271
- public void getVolume (String source , Callback callback ) {
303
+ public void getVolume (String source , Callback < GetVolumeResponse > callback ) {
272
304
communicator .getVolume (source , callback );
273
305
}
274
306
275
- public void setVolume (String source , double volume , Callback callback ) {
307
+ public void setVolume (String source , double volume , Callback < SetVolumeResponse > callback ) {
276
308
communicator .setVolume (source , volume , callback );
277
309
}
278
310
279
- public void setMute (String source , boolean mute , Callback callback ) {
311
+ public void setMute (String source , boolean mute , Callback < SetMuteResponse > callback ) {
280
312
communicator .setMute (source , mute , callback );
281
313
}
282
314
283
- public void getPreviewScene (Callback callback ) {
315
+ public void getPreviewScene (Callback < GetPreviewSceneResponse > callback ) {
284
316
communicator .getPreviewScene (callback );
285
317
}
286
318
287
- public void setPreviewScene (String name , Callback callback ) {
319
+ public void setPreviewScene (String name , Callback < SetPreviewSceneResponse > callback ) {
288
320
communicator .setPreviewScene (name , callback );
289
321
}
290
322
291
- public void getTransitionDuration (Callback callback ) {
323
+ public void getTransitionDuration (Callback < GetTransitionDurationResponse > callback ) {
292
324
communicator .getTransitionDuration (callback );
293
325
}
294
326
295
- public void setTransitionDuration (int duration , Callback callback ) {
327
+ public void setTransitionDuration (int duration , Callback < SetTransitionDurationResponse > callback ) {
296
328
communicator .setTransitionDuration (duration , callback );
297
329
}
298
330
299
331
300
- public void getStudioModeEnabled (Callback callback ) {
332
+ public void getStudioModeEnabled (Callback < GetStudioModeEnabledResponse > callback ) {
301
333
communicator .getStudioModeEnabled (callback );
302
334
}
303
335
304
- public void setStudioModeEnabled (boolean enabled , Callback callback ) {
336
+ public void setStudioModeEnabled (boolean enabled , Callback < SetStudioModeEnabledResponse > callback ) {
305
337
communicator .setStudioModeEnabled (enabled , callback );
306
338
}
307
339
308
- public void startReplayBuffer (Callback callback ) {
340
+ public void startReplayBuffer (Callback < StartReplayBufferResponse > callback ) {
309
341
communicator .startReplayBuffer (callback );
310
342
}
311
343
312
- public void stopReplayBuffer (Callback callback ) {
344
+ public void stopReplayBuffer (Callback < StopReplayBufferResponse > callback ) {
313
345
communicator .stopReplayBuffer (callback );
314
346
}
315
347
316
- public void saveReplayBuffer (Callback callback ) {
348
+ public void saveReplayBuffer (Callback < SaveReplayBufferResponse > callback ) {
317
349
communicator .saveReplayBuffer (callback );
318
350
}
319
351
0 commit comments