vrpntext.h 1.38 KB
// Jonathann Jacobs : 12/06/2013
#ifndef VRPNTEXT_H
#define VRPNTEXT_H

#include "vrpncommon.h"
#include "vrpn_Text.h"

class VrpnText : public VrpnCommon
{   Q_OBJECT
    /// Constructor__________________________________________________
        public:
        explicit VrpnText(QString name = "Text0", QString host = "localhost" , QObject *parent = 0);

    /// Signals______________________________________________________
        signals:
        void sendLevel   (int);
        void sendTime    (double);
        void sendType    (int);
        void sendMessage (const char*);

    /// Slots________________________________________________________
        public slots:
        inline void refresh() {device->mainloop();}    // Update data from the server then activate signals
        inline void setName(QString newName = "Text0")    {m_name = newName; reset();}
        inline void setHost(QString newHost = "localhost"){m_host = newHost; reset();}

    /// Attributes___________________________________________________
        protected :
        vrpn_Text_Receiver* device;                   // Vrpn client object for recovering data from the vrpn server

    /// Methods______________________________________________________
        void reset();
        static void VRPN_CALLBACK callback(void* userData, const vrpn_TEXTCB cb );  // Used by the device->mainloop for returning data
};

#endif // VRPNTEXT_H