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,67 +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 registerTransitionBeginCallback (Callback onTransitionBegin ) {
205
+ public void registerSwitchTransitionCallback (Callback <SwitchTransitionResponse > onSwitchTransition ) {
206
+ communicator .registerOnSwitchTransition (onSwitchTransition );
207
+ }
208
+
209
+ public void registerTransitionListChangedCallback (Callback <TransitionListChangedResponse > onTransitionListChanged ) {
210
+ communicator .registerOnTransitionListChanged (onTransitionListChanged );
211
+ }
212
+
213
+ public void registerTransitionBeginCallback (Callback <TransitionBeginResponse > onTransitionBegin ) {
174
214
communicator .registerOnTransitionBegin (onTransitionBegin );
175
215
}
176
216
177
- public void registerTransitionEndCallback (Callback onTransitionEnd ) {
217
+ public void registerTransitionEndCallback (Callback < TransitionEndResponse > onTransitionEnd ) {
178
218
communicator .registerOnTransitionEnd (onTransitionEnd );
179
219
}
180
220
181
221
public void await () throws InterruptedException {
182
222
communicator .await ();
183
223
}
184
224
185
- public void setCurrentScene (String szene , Callback callback ) {
186
- communicator .setCurrentScene (szene , callback );
225
+ public void setCurrentScene (String scene , Callback < SetCurrentSceneResponse > callback ) {
226
+ communicator .setCurrentScene (scene , callback );
187
227
}
188
228
189
- public void setCurrentTransition (String transition , Callback callback ) {
229
+ public void setCurrentTransition (String transition , Callback < SetCurrentTransitionResponse > callback ) {
190
230
communicator .setCurrentTransition (transition , callback );
191
231
}
192
232
193
- public void changeSceneWithTransition (final String scene , String transition , final Callback callback ) {
233
+ public void changeSceneWithTransition (final String scene , String transition , final Callback < SetCurrentSceneResponse > callback ) {
194
234
communicator .setCurrentTransition (transition , response -> {
195
235
if (!response .getStatus ().equals ("ok" )) {
196
236
log .error ("Failed to change transition. Pls fix." );
@@ -200,112 +240,112 @@ public void changeSceneWithTransition(final String scene, String transition, fin
200
240
});
201
241
}
202
242
203
- public void setSourceVisibility (String scene , String source , boolean visibility , Callback callback ) {
243
+ public void setSourceVisibility (String scene , String source , boolean visibility , Callback < SetSceneItemPropertiesResponse > callback ) {
204
244
communicator .setSourceVisiblity (scene , source , visibility , callback );
205
245
}
206
246
207
- public void getSceneItemProperties (String scene , String source , Callback callback ) {
247
+ public void getSceneItemProperties (String scene , String source , Callback < SetSceneItemPropertiesResponse > callback ) {
208
248
communicator .getSceneItemProperties (scene , source , callback );
209
249
}
210
250
211
- public void getTransitionList (Callback callback ) {
251
+ public void getTransitionList (Callback < GetTransitionListResponse > callback ) {
212
252
communicator .getTransitionList (callback );
213
253
}
214
254
215
- public void transitionToProgram (String transitionName , int duration , Callback callback ) {
255
+ public void transitionToProgram (String transitionName , int duration , Callback < TransitionToProgramResponse > callback ) {
216
256
communicator .transitionToProgram (transitionName , duration , callback );
217
257
}
218
258
219
- public void getSourceSettings (String sourceName , Callback callback ) {
259
+ public void getSourceSettings (String sourceName , Callback < GetSourceSettingsResponse > callback ) {
220
260
communicator .getSourceSettings (sourceName , callback );
221
261
}
222
262
223
- public void setSourceSettings (String sourceName , Map <String , Object > settings , Callback callback ) {
263
+ public void setSourceSettings (String sourceName , Map <String , Object > settings , Callback < SetSourceSettingsResponse > callback ) {
224
264
communicator .setSourceSettings (sourceName , settings , callback );
225
265
}
226
266
227
- public void getStreamingStatus (Callback callback ) {
267
+ public void getStreamingStatus (Callback < GetStreamingStatusResponse > callback ) {
228
268
communicator .getStreamingStatus (callback );
229
269
}
230
270
231
- public void startStreaming (Callback callback ) {
271
+ public void startStreaming (Callback < StartStreamingResponse > callback ) {
232
272
communicator .startStreaming (callback );
233
273
}
234
274
235
- public void stopStreaming (Callback callback ) {
275
+ public void stopStreaming (Callback < StopStreamingResponse > callback ) {
236
276
communicator .stopStreaming (callback );
237
277
}
238
278
239
- public void startRecording (Callback callback ) {
279
+ public void startRecording (Callback < StartRecordingResponse > callback ) {
240
280
communicator .startRecording (callback );
241
281
}
242
282
243
- public void stopRecording (Callback callback ) {
283
+ public void stopRecording (Callback < StopRecordingResponse > callback ) {
244
284
communicator .stopRecording (callback );
245
285
}
246
286
247
- public void listProfiles (Callback callback ) {
287
+ public void listProfiles (Callback < ListProfilesResponse > callback ) {
248
288
communicator .listProfiles (callback );
249
289
}
250
290
251
- public void getCurrentProfile (Callback callback ) {
291
+ public void getCurrentProfile (Callback < GetCurrentProfileResponse > callback ) {
252
292
communicator .getCurrentProfile (callback );
253
293
}
254
294
255
- public void setCurrentProfile (String profile , Callback callback ) {
295
+ public void setCurrentProfile (String profile , Callback < SetCurrentProfileResponse > callback ) {
256
296
communicator .setCurrentProfile (profile , callback );
257
297
}
258
298
259
- public void getCurrentScene (Callback callback ) {
299
+ public void getCurrentScene (Callback < GetCurrentSceneResponse > callback ) {
260
300
communicator .getCurrentScene (callback );
261
301
}
262
302
263
- public void getVolume (String source , Callback callback ) {
303
+ public void getVolume (String source , Callback < GetVolumeResponse > callback ) {
264
304
communicator .getVolume (source , callback );
265
305
}
266
306
267
- public void setVolume (String source , double volume , Callback callback ) {
307
+ public void setVolume (String source , double volume , Callback < SetVolumeResponse > callback ) {
268
308
communicator .setVolume (source , volume , callback );
269
309
}
270
310
271
- public void setMute (String source , boolean mute , Callback callback ) {
311
+ public void setMute (String source , boolean mute , Callback < SetMuteResponse > callback ) {
272
312
communicator .setMute (source , mute , callback );
273
313
}
274
314
275
- public void getPreviewScene (Callback callback ) {
315
+ public void getPreviewScene (Callback < GetPreviewSceneResponse > callback ) {
276
316
communicator .getPreviewScene (callback );
277
317
}
278
318
279
- public void setPreviewScene (String name , Callback callback ) {
319
+ public void setPreviewScene (String name , Callback < SetPreviewSceneResponse > callback ) {
280
320
communicator .setPreviewScene (name , callback );
281
321
}
282
322
283
- public void getTransitionDuration (Callback callback ) {
323
+ public void getTransitionDuration (Callback < GetTransitionDurationResponse > callback ) {
284
324
communicator .getTransitionDuration (callback );
285
325
}
286
326
287
- public void setTransitionDuration (int duration , Callback callback ) {
327
+ public void setTransitionDuration (int duration , Callback < SetTransitionDurationResponse > callback ) {
288
328
communicator .setTransitionDuration (duration , callback );
289
329
}
290
330
291
331
292
- public void getStudioModeEnabled (Callback callback ) {
332
+ public void getStudioModeEnabled (Callback < GetStudioModeEnabledResponse > callback ) {
293
333
communicator .getStudioModeEnabled (callback );
294
334
}
295
335
296
- public void setStudioModeEnabled (boolean enabled , Callback callback ) {
336
+ public void setStudioModeEnabled (boolean enabled , Callback < SetStudioModeEnabledResponse > callback ) {
297
337
communicator .setStudioModeEnabled (enabled , callback );
298
338
}
299
339
300
- public void startReplayBuffer (Callback callback ) {
340
+ public void startReplayBuffer (Callback < StartReplayBufferResponse > callback ) {
301
341
communicator .startReplayBuffer (callback );
302
342
}
303
343
304
- public void stopReplayBuffer (Callback callback ) {
344
+ public void stopReplayBuffer (Callback < StopReplayBufferResponse > callback ) {
305
345
communicator .stopReplayBuffer (callback );
306
346
}
307
347
308
- public void saveReplayBuffer (Callback callback ) {
348
+ public void saveReplayBuffer (Callback < SaveReplayBufferResponse > callback ) {
309
349
communicator .saveReplayBuffer (callback );
310
350
}
311
351
0 commit comments