TcrSdk-Windows V1.0
tcr_session.h
Go to the documentation of this file.
1#ifndef TCRSDK_TCR_SESSION_H_
2#define TCRSDK_TCR_SESSION_H_
3
4#include <string>
5#include <stdint.h>
6#include <memory>
7
9#include "keyboard.h"
10#include "mouse.h"
11#include "gamepad.h"
12#include "tcr_logger.h"
14
15
19 class TcrSession {
20 public:
26 enum class Event {
46
61
128
187 };
188
196 class Observer {
197 public:
204 virtual void onEvent(Event event, const char* eventData) = 0;
205 };
206
207 TcrSession(std::shared_ptr<TcrSession::Observer> observer);
209
210 /*
211 * @brief Starts the session. This method should only be called once.
212 */
213 void Init();
214
222 bool Start(const char* serverSession);
223
228
233
244 void SetRemoteVideoProfile(int32_t fps, int32_t minBitrate, int32_t maxBitrate, std::shared_ptr<AsyncCallback> callback);
245
257 void SetRemoteDesktopResolution(int32_t width, int32_t height);
258
267 void SetVideoFrameObserver(std::shared_ptr<VideoFrameObserver> video_frame_observer);
268
273
282 void PasteText(const char* msg);
283
292 std::shared_ptr<CustomDataChannel> CreateCustomDataChannel(int32_t port, std::shared_ptr<CustomDataChannel::Observer>observer);
293
300
306 const Mouse* GetMouse();
307
314
315 private:
316 class TcrSessionImpl;
317 std::shared_ptr<TcrSessionImpl>impl_;
318};
319
320
321#endif
This interface is used to interact with the virtual Gamepad device on the server.
Definition gamepad.h:10
This interface is used to interact with the virtual Keyboard device on the server.
Definition keyboard.h:11
This interface is used to interact with the virtual Mouse device on the server.
Definition mouse.h:10
The Observer class is used to receive events from TcrSession.
Definition tcr_session.h:196
virtual void onEvent(Event event, const char *eventData)=0
This will be called when some event happened in the session.
This interface represents a session between the client and the TCR server.
Definition tcr_session.h:19
void Init()
void SetRemoteDesktopResolution(int32_t width, int32_t height)
Set the resolution of Cloud Desktop.
void RestartCloudApp()
Restart the cloud application process.
bool Start(const char *serverSession)
Starts the session.
void SetVideoFrameObserver(std::shared_ptr< VideoFrameObserver > video_frame_observer)
Set the callback of the video frame.
const Keyboard * GetKeyboard()
Return the interface to interact with the cloud keyboard in this session.
void PauseStreaming()
Resume the media stream.
Event
Session event definitions.
Definition tcr_session.h:26
@ CLIENT_STATS
This event indicates that the performance data is updated.
@ CURSOR_STATE_CHANGE
This event indicates that the showing status of cloud cursor is changed.
@ CURSOR_IMAGE_INFO
This event indicates that the remote cursor image information is updated.
@ ARCHIVE_LOAD_STATUS
This event indicates the status of the archive loading in the server.
@ SCREEN_CONFIG_CHANGE
This event indicates that the configuration of the cloud screen configuration has been changed.
@ GAME_START_COMPLETE
This event indicates that the status of the game process on the server has been changed.
@ ARCHIVE_SAVE_STATUS
This event indicates the status of the archive saving in the server.
@ STATE_INITED
This event indicates that the session has been initialized.
@ STATE_CLOSED
This event indicates that the session is closed, and thus it can not be used any more.
@ REMOTE_DESKTOP_INFO
This event indicates that the remote desktop information is updated.
@ STATE_CONNECTED
This event indicates that the session is connected.
@ INPUT_STATUS_CHANGED
This event indicates that the input status of the server has changed.
void SetRemoteVideoProfile(int32_t fps, int32_t minBitrate, int32_t maxBitrate, std::shared_ptr< AsyncCallback > callback)
Set the local video profile.
TcrSession(std::shared_ptr< TcrSession::Observer > observer)
void PasteText(const char *msg)
Copy the text to the input box in the cloud application.
void ResumeStreaming()
Resume the media stream.
const Mouse * GetMouse()
Return the interface to interact with the cloud Mouse in this session.
std::shared_ptr< CustomDataChannel > CreateCustomDataChannel(int32_t port, std::shared_ptr< CustomDataChannel::Observer >observer)
Creates a custom data channel.
const Gamepad * GetGamepad()
Return the interface to interact with the cloud Gamepad in this session.