The client proxy base class. More...
#include <clientproxy.h>
Public Types | |
typedef int | connection_t |
typedef boost::mutex::scoped_lock | scoped_lock_t |
typedef int | read_signal_t |
Public Member Functions | |
bool | IsValid () const |
Returns true if we have received any data from the device. | |
bool | IsFresh () const |
Fresh is set to true on each new read. | |
void | NotFresh () |
This states that the data in a client is currently not Fresh. | |
std::string | GetDriverName () const |
Returns the driver name. | |
double | GetDataTime () const |
Returns the received timestamp [s]. | |
double | GetElapsedTime () const |
Returns the received timestamp [s]. | |
PlayerClient * | GetPlayerClient () const |
Returns a pointer to the Player Client. | |
uint32_t | GetIndex () const |
Returns device index. | |
uint32_t | GetInterface () const |
Returns device interface. | |
std::string | GetInterfaceStr () const |
Returns device interface. | |
void | SetReplaceRule (bool aReplace, int aType=-1, int aSubtype=-1) |
Set a replace rule for this proxy on the server. | |
int | HasCapability (uint32_t aType, uint32_t aSubtype) |
Request capabilities of device. | |
int | GetBoolProp (char *aProperty, bool *aValue) |
Request a boolean property. | |
int | SetBoolProp (char *aProperty, bool aValue) |
Set a boolean property. | |
int | GetIntProp (char *aProperty, int32_t *aValue) |
Request an integer property. | |
int | SetIntProp (char *aProperty, int32_t aValue) |
Set an integer property. | |
int | GetDblProp (char *aProperty, double *aValue) |
Request a double property. | |
int | SetDblProp (char *aProperty, double aValue) |
Set a double property. | |
int | GetStrProp (char *aProperty, char **aValue) |
Request a string property. | |
int | SetStrProp (char *aProperty, char *aValue) |
Set a string property. | |
template<typename T > | |
connection_t | ConnectReadSignal (T aSubscriber) |
Connect a signal to this proxy For more information check out Signals & multithreading. | |
void | DisconnectReadSignal (connection_t aSubscriber) |
Disconnect a signal to this proxy. | |
Protected Member Functions | |
ClientProxy (PlayerClient *aPc, uint32_t aIndex) | |
virtual void | Subscribe (uint32_t) |
virtual void | Unsubscribe () |
template<typename T > | |
T | GetVar (const T &aV) const |
template<typename T > | |
void | GetVarByRef (const T aBegin, const T aEnd, T aDest) const |
Protected Attributes | |
PlayerClient * | mPc |
playerc_client_t * | mClient |
playerc_device_t * | mInfo |
bool | mFresh |
Private Member Functions | |
void | ReadSignal () |
Private Attributes | |
double | mLastTime |
read_signal_t | mReadSignal |
Detailed Description
The client proxy base class.
Base class for all proxy devices. Access to a device is provided by a device-specific proxy class. These classes all inherit from the ClientProxy
class which defines an interface for device proxies. As such, a few methods are common to all devices and we explain them here.
Since the ConnectReadSignal() and DisconnectReadSignal() member functions are based on the Boost signals library, they are conditionally available depending on Boost's presence in the system. See the configure script for more information.
Member Function Documentation
std::string PlayerCc::ClientProxy::GetDriverName | ( | ) | const [inline] |
Returns the driver name.
- Todo:
- GetDriverName isn't guarded by locks yet
int PlayerCc::ClientProxy::HasCapability | ( | uint32_t | aType, |
uint32_t | aSubtype | ||
) |
Request capabilities of device.
Send a message asking if the device supports the given message type and subtype. If it does, the return value will be 1, and 0 otherwise.
bool PlayerCc::ClientProxy::IsFresh | ( | ) | const [inline] |
Fresh is set to true on each new read.
It is up to the user to set it to false if the data has already been read. This is most useful when used in conjunction with the PlayerMultiClient
void PlayerCc::ClientProxy::SetReplaceRule | ( | bool | aReplace, |
int | aType = -1 , |
||
int | aSubtype = -1 |
||
) |
Set a replace rule for this proxy on the server.
If a rule with the same pattern already exists, it will be replaced with the new rule (i.e., its setting to replace will be updated).
- Parameters:
-
aReplace Should we replace these messages aType The type to set replace rule for (-1 for wildcard), see Message types. aSubtype Message subtype to set replace rule for (-1 for wildcard). This is dependent on the Interface specifications.
- Exceptions:
-
throws PlayerError if unsuccessfull
The documentation for this class was generated from the following file: