Stellarium  0.16.1
List of all members | Public Member Functions
RemoteControlServiceInterface Class Referenceabstract

Interface for all Remote Control Plug-in services. More...

#include <RemoteControlServiceInterface.hpp>

+ Inheritance diagram for RemoteControlServiceInterface:

Public Member Functions

virtual QLatin1String getPath () const =0
 Returns the desired path mapping If there is a conflict, only the first object is mapped. More...
 
virtual bool isThreadSafe () const =0
 Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread. More...
 
virtual void get (const QByteArray &operation, const APIParameters &parameters, APIServiceResponse &response)=0
 Implement this to define reactions to HTTP GET requests. More...
 
virtual void post (const QByteArray &operation, const APIParameters &parameters, const QByteArray &data, APIServiceResponse &response)=0
 Implement this to define reactions to HTTP POST requests. More...
 
virtual void update (double deltaTime)=0
 Called in the main thread each frame. More...
 

Detailed Description

Interface for all Remote Control Plug-in services.

Each implementation is mapped to a separate HTTP request path. The get() or post() method is called to handle each request. Instances of this class which are provided through the StelModuleMgr's extension mechanism (by adding it into the list returned by StelPluginInterface::getExtensionList()) are automatically discovered and registered with the APIController.

Definition at line 179 of file RemoteControlServiceInterface.hpp.

Member Function Documentation

virtual void RemoteControlServiceInterface::get ( const QByteArray &  operation,
const APIParameters parameters,
APIServiceResponse response 
)
pure virtual

Implement this to define reactions to HTTP GET requests.

GET requests generally should only query data or program state, and not change it. If there is an error with the request, use APIServiceResponse::writeRequestError to notify the client.

Parameters
operationThe operation string of the request (i.e. the part of the request URL after the service name, without parameters)
parametersThe extracted service parameters (extracted from the URL)
responseThe response object, write your response into this
Note
The thread this is called in depends on the supportThreadedOperation() return value

Implemented in MainService, AbstractAPIService, LocationSearchService, ObjectService, SimbadService, LocationService, StelActionService, ViewService, StelPropertyService, Scenery3dRemoteControlService, and ScriptService.

virtual QLatin1String RemoteControlServiceInterface::getPath ( ) const
pure virtual

Returns the desired path mapping If there is a conflict, only the first object is mapped.

Implemented in MainService, LocationSearchService, ObjectService, SimbadService, LocationService, StelActionService, ViewService, Scenery3dRemoteControlService, StelPropertyService, and ScriptService.

virtual bool RemoteControlServiceInterface::isThreadSafe ( ) const
pure virtual

Return true if the service's get() and post() methods can safely be run in the HTTP handler thread, instead of having to queue it into the Stellarium main thread.

This can result in better performance if done correctly. Unless you are sure, return false here.

Implemented in AbstractAPIService, LocationSearchService, SimbadService, and Scenery3dRemoteControlService.

virtual void RemoteControlServiceInterface::post ( const QByteArray &  operation,
const APIParameters parameters,
const QByteArray &  data,
APIServiceResponse response 
)
pure virtual

Implement this to define reactions to HTTP POST requests.

POST requests generally should change data or perform some action. If there is an error with the request, use APIServiceResponse::writeRequestError to notify the client.

Parameters
operationThe operation string of the request (i.e. the part of the request URL after the service name, without parameters)
parametersThe extracted service parameters (extracted from the URL, and form data, if applicable)
dataThe unmodified data as sent from the client
responseThe response object, write your response into this
Note
The thread this is called in depends on the supportThreadedOperation() return value

Implemented in MainService, AbstractAPIService, LocationService, StelActionService, StelPropertyService, ScriptService, and Scenery3dRemoteControlService.

virtual void RemoteControlServiceInterface::update ( double  deltaTime)
pure virtual

Called in the main thread each frame.

Can be used for ongoing actions, for example movement control.

Implemented in MainService, AbstractAPIService, and Scenery3dRemoteControlService.


The documentation for this class was generated from the following file: