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
79 class PLAYERCC_EXPORT ClientProxy
81 friend class PlayerClient;
85 #ifdef HAVE_BOOST_SIGNALS
86 typedef boost::signals2::connection connection_t;
94 typedef boost::signals2::signal<void (
void)> read_signal_t;
97 typedef int connection_t;
101 typedef int read_signal_t;
110 ClientProxy(PlayerClient* aPc, uint32_t aIndex);
113 virtual ~ClientProxy();
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 IsValid()
const {
return 0!=GetVar(mInfo->
datatime); };
206 bool IsFresh()
const {
return GetVar(mFresh); };
221 std::string GetDriverName()
const {
return mInfo->
drivername; };
224 double GetDataTime()
const {
return GetVar(mInfo->
datatime); };
228 double GetElapsedTime()
const
235 PlayerClient * GetPlayerClient()
const {
return mPc;}
243 uint32_t GetIndex()
const {
return GetVar(mInfo->
addr.
index); };
251 uint32_t GetInterface()
const {
return GetVar(mInfo->
addr.
interf); };
258 std::string GetInterfaceStr()
const
259 {
return interf_to_str(GetVar(mInfo->
addr.
interf)); };
275 void SetReplaceRule(
bool aReplace,
287 int HasCapability(uint32_t aType, uint32_t aSubtype);
297 int GetBoolProp(
char *aProperty,
bool *aValue);
307 int SetBoolProp(
char *aProperty,
bool aValue);
317 int GetIntProp(
char *aProperty, int32_t *aValue);
327 int SetIntProp(
char *aProperty, int32_t aValue);
337 int GetDblProp(
char *aProperty,
double *aValue);
347 int SetDblProp(
char *aProperty,
double aValue);
357 int GetStrProp(
char *aProperty,
char **aValue);
367 int SetStrProp(
char *aProperty,
char *aValue);
376 connection_t ConnectReadSignal(T aSubscriber)
378 #ifdef HAVE_BOOST_SIGNALS
379 scoped_lock_t lock(mPc->mMutex);
380 return mReadSignal.connect(aSubscriber);
390 void DisconnectReadSignal(connection_t aSubscriber)
392 #ifdef HAVE_BOOST_SIGNALS
393 scoped_lock_t lock(mPc->mMutex);
394 aSubscriber.disconnect();
397 aSubscriber = aSubscriber;
char drivername[PLAYER_MAX_DRIVER_STRING_LEN]
The driver name.
Definition: playerc.h:875
double lasttime
Data timestamp from the previous data.
Definition: playerc.h:885
Common device info.
Definition: playerc.h:861
Definition: playerclient.h:94
player_devaddr_t addr
Device address.
Definition: playerc.h:872
Client object data.
Definition: playerc.h:504
double datatime
Data timestamp, i.e., the time at which the data was generated (s).
Definition: playerc.h:882
uint16_t index
Which device of that interface.
Definition: player.h:154
uint16_t interf
The interface provided by the device; must be one of PLAYER_*_CODE.
Definition: player.h:152