hyperion.ng/libsrc/effectengine/Effect.h
Johan c82954d82a Added checking for timeout of effect
Former-commit-id: 7768368d1a386447714610c28c50e3658b6037c5
2013-11-28 14:29:31 +01:00

50 lines
921 B
C++

#pragma once
// Qt includes
#include <QThread>
// Python includes
#include <Python.h>
class Effect : public QThread
{
Q_OBJECT
public:
Effect(int priority, int timeout);
virtual ~Effect();
virtual void run();
int getPriority() const;
public slots:
void abort();
signals:
void effectFinished(Effect * effect);
private slots:
void effectFinished();
private:
// Wrapper methods for Python interpreter extra buildin methods
static PyMethodDef effectMethods[];
static PyObject* wrapSetColor(PyObject *self, PyObject *args);
static PyObject* wrapSetImage(PyObject *self, PyObject *args);
static PyObject* wrapGetLedCount(PyObject *self, PyObject *args);
static PyObject* wrapAbort(PyObject *self, PyObject *args);
static Effect * getEffect(PyObject *self);
private:
const int _priority;
const int _timeout;
int64_t _endTime;
PyThreadState * _interpreterThreadState;
bool _abortRequested;
};