00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _OSC_QUEUE_H_
00022 #define _OSC_QUEUE_H_
00023
00024 #include "OSCMessage.h"
00025
00026 #include "base/RingBuffer.h"
00027
00028 #include <QObject>
00029
00030 #ifdef HAVE_LIBLO
00031 #include <lo/lo.h>
00032 #endif
00033
00034 class OSCQueue : public QObject
00035 {
00036 Q_OBJECT
00037
00038 public:
00039 OSCQueue();
00040 virtual ~OSCQueue();
00041
00042 bool isOK() const;
00043
00044 bool isEmpty() const { return getMessagesAvailable() == 0; }
00045 size_t getMessagesAvailable() const;
00046 OSCMessage readMessage();
00047
00048 QString getOSCURL() const;
00049
00050 signals:
00051 void messagesAvailable();
00052
00053 protected:
00054 #ifdef HAVE_LIBLO
00055 lo_server_thread m_thread;
00056
00057 static void oscError(int, const char *, const char *);
00058 static int oscMessageHandler(const char *, const char *, lo_arg **,
00059 int, lo_message, void *);
00060 #endif
00061
00062 void postMessage(OSCMessage);
00063 bool parseOSCPath(QString path, int &target, int &targetData, QString &method);
00064
00065 RingBuffer<OSCMessage *> m_buffer;
00066 };
00067
00068 #endif
00069