-
Notifications
You must be signed in to change notification settings - Fork 1
/
linuxffbdevice.h
43 lines (31 loc) · 1.33 KB
/
linuxffbdevice.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef LINUXFFBDEVICE_H
#define LINUXFFBDEVICE_H
#include "ffbdevice.h"
class LinuxFFBDevice : public FFBDevice
{
public:
explicit LinuxFFBDevice(const int fd, const int maxEffectCount, const QString path);
const QString& path() const { return c_path; }
/* Overriden virtual functions */
void close();
bool queryDeviceCapabilities();
bool removeAndEraseEffect(const int idx);
bool setAutocentering(const int strength);
bool setGain(const int gain);
bool startEffect(const int idx, const FFBEffectTypes type, std::shared_ptr<FFBEffectParameters> parameters);
bool stopEffect(const int idx);
bool uploadEffect(const int idx, const FFBEffectTypes type, std::shared_ptr<FFBEffectParameters> parameters);
inline PeriodicWaveforms waveformByIdx(const int idx) const { return m_availablePeriodicWaveforms[idx]; }
private:
bool removeEffect(const int idx);
const int c_fd;
const QString c_path;
static inline unsigned long longIdx(unsigned long bit) { return bit / BITS_PER_LONG; }
static inline unsigned long offset(unsigned long bit) { return bit % BITS_PER_LONG; }
static inline bool testBit(unsigned long bit, unsigned long* array) { return (array[longIdx(bit)] >> offset(bit)) & 1; }
static const quint8 BITS_PER_LONG;
static const QString LNXDEV_ERR_CAPTION;
signals:
public slots:
};
#endif // LINUXFFBDEVICE_H