RTAI + QT Designer examples?

Malte Witt malte.witt at sieb-meyer.de
Tue Aug 15 07:46:41 CEST 2006


Hi,

I wrote some wrapper-class for the RTAI-API to be used in my Qt-C++ apps. 
Works great! But you always have to know exactly what you are doing and 
how things work in Qt (Be careful with implicit sharing). 

Regards,
Malte

A piece of code that might help you:


class CRtThread : public QThread
{
    Q_OBJECT
 
    public:
        CRtThread(const QString & arcName, QObject * apParent = NULL, int 
aPriority = RT_SCHED_MID_PRIORITY) : QThread(apParent) 
        {
            mName = arcName;
            mTerminateFlag = false;
            mPriority = aPriority;
        }

[...]
        static void rtSleepNs(qint64 aNanoSec)  { 
rt_sleep(nano2count(aNanoSec)); }
        static void rtSleepUs(qint64 aMicroSec) { 
rt_sleep(nano2count(aMicroSec * 1000LL)); }
        static void rtSleepMs(qint64 aMilliSec) { 
rt_sleep(nano2count(aMilliSec * 1000LL * 1000LL)); }
        static void rtSetHardRealtime(bool aHard);
        static qint64 rtGetTimeNs() { return rt_get_time_ns(); }
[...]
 
    protected:
        virtual void rtRun() = 0;
        virtual quint32 rtNameToId(const QString & arcName) const { return 
nam2num(arcName.toAscii()); }
        virtual QString rtIdToName(quint32 aId) const;
        virtual int rtChangePriority(int aPriority) { return 
rt_change_prio(rt_buddy(), aPriority); }

 
    private:
        QString  mName;
        int mPriority;
        volatile bool mTerminateFlag;

        virtual void run();
};

rtai-admin at rtai.org schrieb am 14.08.2006 18:56:41:

> Is there a chance to someone post some basic examples on how to 
> integrate RTAI features within QT Designer's apps?
> 
> Thanks in advance.




More information about the Rtai mailing list