syndilights/open-lighting-architecture/ola-0.8.4/plugins/opendmx/OpenDmxThread.h

57 lines
1.5 KiB
C
Raw Normal View History

2010-10-31 17:32:25 +01:00
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* OpenDmxThread.h
* Thread for the open dmx device
* Copyright (C) 2005-2009 Simon Newton
*/
#ifndef PLUGINS_OPENDMX_OPENDMXTHREAD_H_
#define PLUGINS_OPENDMX_OPENDMXTHREAD_H_
#include <pthread.h>
#include <string>
#include "ola/DmxBuffer.h"
namespace ola {
namespace plugin {
namespace opendmx {
class OpenDmxThread {
public:
OpenDmxThread();
~OpenDmxThread();
int Start(const std::string &path);
int Stop();
bool WriteDmx(const DmxBuffer &buffer);
void *Run(const std::string &path);
private:
int DoWrite(uint8_t *buf, int length);
int m_fd;
DmxBuffer m_buffer;
pthread_mutex_t m_mutex;
bool m_term;
pthread_mutex_t m_term_mutex;
pthread_cond_t m_term_cond;
pthread_t m_tid;
};
} // opendmx
} // plugin
} // ola
#endif // PLUGINS_OPENDMX_OPENDMXTHREAD_H_