C++ API Library Reference  4.3.2-74-ge1d4cca
Classes | Public Functions | List of all members
ViewManager Class Referenceabstract

The ViewManager class manages the views streamed from the service application. Most calls may only be made in the UI thread unless otherwise specified.

About View Registration
Many methods in ViewManager expect the view's name as a parameter. This name is assigned to the view when you first register it with ViewManager using RegisterView, the first method to call when adding a new view. Once a view is registered, its name acts as a unique ID, and both the service and the client must use that exact name when referring to it.

About the Timing of View Updates
Your application needs to know when to stream a new image to a view. To do this, you add either the RenderViewImmediate or RenderViewDeferred method to an event handler. As their name indicates, the main difference between the two methods is timing. In one case, the call to RenderView is immediate, in the other instance, it is deferred. Using the deferred method is the most common, as it is less resource-intensive: the service does not need to spend time churning image bits that may not be needed by the client right away.

About View Interactivity Modes
The purpose of the view interactivity modes is to make it possible to send images of lower quality when the end user is interacting with a view, and to restore full quality when interaction stops. This way, the size of the view updates during interaction can be smaller. The interactivity mode is set using the SetViewInteracting method. Once this is in place, you can configure the image quality values for the interactive and non-interactive modes using the client-side APIs.

Public Functions

virtual EncoderConfiguration DefaultEncoderConfiguration () const
 
virtual Collections::List< ResponseInfo > GetNextResponses (Guid sessionId)=0
 
virtual void Initialize (StateManager *pStateManager)
 
virtual void RefreshViews ()
 
virtual void RegisterView (String const &viewName, IRenderedView *pView)
 
virtual void RenderViewDeferred (String const &viewName)
 
virtual void RenderViewImmediate (String const &viewName)
 
virtual void SessionConnected (Guid sessionId, Typeless const &command)=0
 
virtual void SessionDisconnected (Guid sessionId, Typeless const &command)=0
 
virtual void SetDefaultEncoderConfiguration (EncoderConfiguration const &value)
 
virtual void SetViewImageFormat (String const &viewName, CSI::PureWeb::Server::ViewImageFormat const &format)
 
virtual void SetViewInteracting (String const &viewName, bool isInteracting)
 
virtual void Uninitialize ()
 
virtual bool UnregisterView (String const &viewName)
 
virtual CSI::PureWeb::Server::ViewImageFormat ViewImageFormat (String const &viewName) const
 
Constructors and Destructors
 ViewManager ()
 
 ~ViewManager ()
 
Deprecated
virtual int MaxImageQuality () const
 
virtual void SetMaxImageQuality (int value)
 
virtual int MinImageQuality () const
 
virtual void SetMinImageQuality (int value)
 
virtual int FullImageQuality () const
 
virtual void SetFullImageQuality (int value)
 
virtual int InteractiveImageQuality () const
 
virtual void SetInteractiveImageQuality (int value)
 
Events
 DEFINE_EVENT (EncoderConfigurationChanged, IViewManager &, EncoderConfigurationChangedEventArgs &)
 
 DEFINE_EVENT (ImageEncoding, IViewManager &, ImageCompressionEventArgs &)
 
 DEFINE_EVENT (ViewRendered, IViewManager &, ViewRenderedEventArgs &)
 

Usage Description

EncoderConfiguration DefaultEncoderConfiguration ( ) const
virtual

Returns the encoder configuration currently set as the default. This default is set by the client-side API when the client first connects.

Implements IViewManager.

DEFINE_EVENT ( EncoderConfigurationChanged  ,
IViewManager ,
EncoderConfigurationChangedEventArgs  
)

This event fires when the encoder configuration changes. Although you can register for this event, its main purpose is to manage views under the hood.

DEFINE_EVENT ( ImageEncoding  ,
IViewManager ,
ImageCompressionEventArgs  
)

This event fires when an image is about to be encoded. Although you can register for this event, its main purpose is to manage views under the hood.

DEFINE_EVENT ( ViewRendered  ,
IViewManager ,
ViewRenderedEventArgs  
)

This event fires when a view is rendered. Although you can register for this event, its main purpose is to manage views under the hood.

int FullImageQuality ( ) const
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Returns the value currently set as the full (non-interactive) image quality. Can be accessed from any thread.

Implements IViewManager.

virtual Collections::List<ResponseInfo> GetNextResponses ( Guid  sessionId)
pure virtualinherited

Gets the next responses for the specified session.

Parameters
sessionIDThe session's unique identifer.
void Initialize ( StateManager pStateManager)
virtual

Initializes the ViewManager plugin with the specified StateManager.

Implements IStateManagerPlugin.

int InteractiveImageQuality ( ) const
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Returns the value currently set as the interactive image quality. Can be accessed from any thread.

Implements IViewManager.

int MaxImageQuality ( ) const
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Returns the value currently set as the maximum image quality.

Implements IViewManager.

int MinImageQuality ( ) const
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Returns the value currently set as the minimum image quality.

Implements IViewManager.

void RefreshViews ( )
virtual

Causes all views to be re-rendered. This method is called automatically when a client calls refresh on a view.

Implements IViewManager.

void RegisterView ( String const &  viewName,
IRenderedView pView 
)
virtual

Registers the specified view with StateManager.

Parameters
viewNameThe name that you want to give to the view. This name will act as a unique ID, and both the service and the client must use this name when referring to the view.
pViewThe view that you are registering.

Implements IViewManager.

void RenderViewDeferred ( String const &  viewName)
virtual

Notifies StateManager that the image in the specified view has been updated and needs to be rendered. The view image bits will be acquired later via the view's IRenderedView interface (the timing of the call to RenderView is not configurable; this is handled automatically by PureWeb).

Implements IRemoteRenderer.

void RenderViewImmediate ( String const &  viewName)
virtual

Notifies StateManager that the image in the specified view has been updated needs to be rendered. The view image bits will be acquired immediately via the view's IRenderedView interface. This must be called on the UI thread.

Implements IRemoteRenderer.

virtual void SessionConnected ( Guid  sessionId,
Typeless const &  command 
)
pure virtualinherited

Indicates that the specified session is connected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that was received causing the session to connect.
virtual void SessionDisconnected ( Guid  sessionId,
Typeless const &  command 
)
pure virtualinherited

Indicates that the specified session is disconnected.

Parameters
sessionIdThe session's unique identifier.
commandThe command that was received causing the session to disconnect.
void SetDefaultEncoderConfiguration ( EncoderConfiguration const &  encoder)
virtual

Sets the default encoder configuration; this is called automatically when a client initializes a view.

Parameters
encoderThe encoder configuration that you want clients to receive as default when they first connect.

Implements IViewManager.

void SetFullImageQuality ( int  value)
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Sets the value for the full image quality. This represents the quality of the images that the service will send to the clients when the end user is not interacting with the images

Implements IViewManager.

void SetInteractiveImageQuality ( int  value)
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Sets the value for the interactive image quality. This represents the quality of the images that the service will send to the clients when the end user is interacting with the images.

Implements IViewManager.

void SetMaxImageQuality ( int  value)
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Sets the value for the maximum image quality. Changing this value will automatically adjust dependent properties FullImageQuality and InteractiveImageQuality if necessary.

Implements IViewManager.

void SetMinImageQuality ( int  value)
virtual
Note
This method is deprecated, as image encoding and quality is now set using the client-side APIs.

Sets the value for the minimum image quality. Changing this value will automatically adjust dependent properties FullImageQuality and InteractiveImageQuality if necessary.

Implements IViewManager.

void SetViewImageFormat ( String const &  viewName,
CSI::PureWeb::Server::ViewImageFormat const &  format 
)
virtual

Sets the view image format (pixel format, scan line order and alignment) for the specified view.

The main purpose of this method is to overwrite framework defaults when needed. For example, the default pixel format of images in a PureWeb C++ service is BGR 24, but the default pixel format of a QImage in Qt is RGB 24. When using the PureWeb C++ API in Qt, therefore, you would use SetViewImageFormat to overwrite the default C++ image format to that expected by Qt. You would call this method before using RenderView to stream the image.

Implements IRemoteRenderer.

void SetViewInteracting ( String const &  viewName,
bool  isInteracting 
)
virtual

Sets the interactive mode for the specified view to either true or false.

The SetViewInteracting method is used to notify StateManager when user interaction begins and when it stops. For example, you could set the interactive mode to true on a mouse down event, and set it back to false on a mouse up event. Once this is in place, you can configure the image quality values for the interactive and non-interactive modes using the client-side APIs.

Implements IRemoteRenderer.

void Uninitialize ( )
virtual

Uninitializes the ViewManager plugin.

Implements IStateManagerPlugin.

bool UnregisterView ( String const &  viewName)
virtual

Unregisters the specified view.

Implements IViewManager.

CSI::PureWeb::Server::ViewImageFormat ViewImageFormat ( String const &  viewName) const
virtual

Returns the current view image format (pixel format, scan line order and alignment) for the specified view.

Implements IRemoteRenderer.