49 #ifndef PLAYERCC_CLIENTPROXY_H
50 #define PLAYERCC_CLIENTPROXY_H
53 #if defined (PLAYER_STATIC)
54 #define PLAYERCC_EXPORT
55 #elif defined (playerc___EXPORTS)
56 #define PLAYERCC_EXPORT __declspec (dllexport)
58 #define PLAYERCC_EXPORT __declspec (dllimport)
61 #define PLAYERCC_EXPORT
85 #ifdef HAVE_BOOST_SIGNALS
86 typedef boost::signals::connection connection_t;
94 typedef boost::signal<void (void)> read_signal_t;
97 typedef int connection_t;
101 typedef int read_signal_t;
121 virtual void Subscribe(uint32_t ) {};
125 virtual void Unsubscribe() {};
143 T GetVar(
const T &aV)
const
145 scoped_lock_t lock(mPc->
mMutex);
157 void GetVarByRef(
const T aBegin,
const T aEnd, T aDest)
const
159 scoped_lock_t lock(mPc->
mMutex);
160 std::copy(aBegin, aEnd, aDest);
184 read_signal_t mReadSignal;
197 bool IsFresh()
const {
return GetVar(mFresh); };
223 {
return interf_to_str(GetVar(mInfo->
addr.
interf)); };
238 void SetReplaceRule(
bool aReplace,
246 int HasCapability(uint32_t aType, uint32_t aSubtype);
249 int GetBoolProp(
char *aProperty,
bool *aValue);
252 int SetBoolProp(
char *aProperty,
bool aValue);
255 int GetIntProp(
char *aProperty, int32_t *aValue);
258 int SetIntProp(
char *aProperty, int32_t aValue);
261 int GetDblProp(
char *aProperty,
double *aValue);
264 int SetDblProp(
char *aProperty,
double aValue);
267 int GetStrProp(
char *aProperty,
char **aValue);
270 int SetStrProp(
char *aProperty,
char *aValue);
277 #ifdef HAVE_BOOST_SIGNALS
278 scoped_lock_t lock(mPc->
mMutex);
279 return mReadSignal.connect(aSubscriber);
288 #ifdef HAVE_BOOST_SIGNALS
289 scoped_lock_t lock(mPc->
mMutex);
290 aSubscriber.disconnect();
293 aSubscriber = aSubscriber;
std::string GetDriverName() const
Returns the driver name.
Definition: clientproxy.h:204
bool IsFresh() const
Fresh is set to true on each new read.
Definition: clientproxy.h:197
uint16_t interf
The interface provided by the device; must be one of PLAYER_*_CODE.
Definition: player.h:149
double GetElapsedTime() const
Returns the received timestamp [s].
Definition: clientproxy.h:210
Common device info.
Definition: playerc.h:814
double GetDataTime() const
Returns the received timestamp [s].
Definition: clientproxy.h:207
mutex_t mMutex
A mutex for handling synchronization.
Definition: playerclient.h:173
uint32_t GetInterface() const
Returns device interface.
Definition: clientproxy.h:219
void DisconnectReadSignal(connection_t aSubscriber)
Disconnect a signal to this proxy.
Definition: clientproxy.h:286
The PlayerClient is used for communicating with the player server.
Definition: playerclient.h:115
double lasttime
Data timestamp from the previous data.
Definition: playerc.h:838
The client proxy base class.
Definition: clientproxy.h:79
double datatime
Data timestamp, i.e., the time at which the data was generated (s).
Definition: playerc.h:835
Definition: playerclient.h:90
connection_t ConnectReadSignal(T aSubscriber)
Connect a signal to this proxy For more information check out Signals & multithreading.
Definition: clientproxy.h:275
Client object data.
Definition: playerc.h:460
uint32_t GetIndex() const
Returns device index.
Definition: clientproxy.h:216
char drivername[PLAYER_MAX_DRIVER_STRING_LEN]
The driver name.
Definition: playerc.h:828
Definition: playerclient.h:99
player_devaddr_t addr
Device address.
Definition: playerc.h:825
std::string GetInterfaceStr() const
Returns device interface.
Definition: clientproxy.h:222
bool IsValid() const
Returns true if we have received any data from the device.
Definition: clientproxy.h:192
PlayerClient * GetPlayerClient() const
Returns a pointer to the Player Client.
Definition: clientproxy.h:214
uint16_t index
Which device of that interface.
Definition: player.h:151