53 lines
774 B
C++
53 lines
774 B
C++
#ifndef STHREADWATCHPORT_H
|
|
#define STHREADWATCHPORT_H
|
|
|
|
#include "qsthread.h"
|
|
|
|
#include "common.h"
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <errno.h>
|
|
#include <sys/types.h>
|
|
#include <sys/inotify.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
#define EVENT_SIZE ( sizeof(struct inotify_event))
|
|
#define INOTIFY_BUF_LEN ( 1024 * (EVENT_SIZE+16))
|
|
|
|
class SThreadWatchPort : public QSThread
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit SThreadWatchPort();
|
|
|
|
virtual ~SThreadWatchPort();
|
|
|
|
virtual void InnerRun();
|
|
|
|
virtual void Init();
|
|
|
|
virtual void ExitThread();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
int m_nWatchGPIO271;
|
|
int m_nINotifyWatch;
|
|
|
|
int m_nValue;
|
|
int m_nValuePrev;
|
|
|
|
char m_pNotifyBuffer[INOTIFY_BUF_LEN];
|
|
|
|
|
|
|
|
signals:
|
|
void CaptureHandSwitch();
|
|
};
|
|
|
|
#endif // STHREADWATCHPORT_H
|