constanteffectsettings.cpp
effectsettings.cpp
envelopesettings.cpp
- ffbconditioneffect.cpp
+ linuxffbconditioneffect.cpp
ffbconditioneffectparameters.cpp
- ffbconstanteffect.cpp
+ linuxffbconstanteffect.cpp
ffbconstanteffectparameters.cpp
ffbdevice.cpp
ffbeffect.cpp
- ffbeffectfactory.cpp
+ linuxffbeffect.cpp
+ linuxffbeffectfactory.cpp
ffbeffectparameters.cpp
ffbenvelopeparameters.cpp
ffbnulleffect.cpp
- ffbperiodiceffect.cpp
+ linuxffbperiodiceffect.cpp
ffbperiodiceffectparameters.cpp
- ffbrampeffect.cpp
+ linuxffbrampeffect.cpp
ffbrampeffectparameters.cpp
ffbrumbleeffect.cpp
ffbrumbleeffectparameters.cpp
#include "ffbdevice.h"
-#include "ffbeffectfactory.h"
const std::vector<ConditionSubtypes>& FFBDevice::availableConditionSubtypesList() const
{
#include "ffbeffect.h"
#include "globalsettings.h"
-#include <QtWidgets/QMessageBox>
FFBEffect::FFBEffect(FFBEffectTypes type)
{
- m_internalIdx = -1;
m_status = FFBEffectStatus::NOT_LOADED;
m_type = type;
}
-struct ff_effect* FFBEffect::createFFStruct(const std::shared_ptr<FFBEffectParameters> params)
-{
- struct ff_effect* eff = new struct ff_effect;
- memset(eff, 0, sizeof(struct ff_effect));
-
- eff->id = m_internalIdx;
- eff->direction = params->direction;
- eff->replay.delay = params->replayDelay;
- eff->replay.length = params->replayLength;
-
- return eff;
-}
-
-void FFBEffect::reportError(const QString& errorMsg) const
-{
- QMessageBox::warning(nullptr, "FFB effect error", errorMsg);
-}
-
-bool FFBEffect::checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params)
-{
- if (!GlobalSettings::GS()->doSanityChecks)
- return true;
-
- if (params->repeat < 1) {
- reportError("Effect must be played back at least once.");
- return false;
- }
-
- if (!checkBoundsInclusive(params->direction, 0, 0xFFFF)) {
- reportError("Direction out of bounds.");
- return false;
- }
-
- if (!checkBoundsInclusive(params->replayDelay, 0, 0x7FFF)) {
- reportError("Replay delay out of bounds.");
- return false;
- }
-
- if (!checkBoundsInclusive(params->replayLength, 0, 0x7FFF)) {
- reportError("Replay length out of bounds.");
- return false;
- }
-
- return true;
-}
-
bool FFBEffect::operator==(const FFBEffect& other) const
{
return this->type() == other.type();
#include "ffbeffectparameters.h"
#include "globals.h"
#include <memory>
-#include <linux/input.h>
class FFBEffect {
public:
enum class FFBEffectStatus { PLAYING, UPLOADED, NOT_LOADED };
explicit FFBEffect(FFBEffectTypes type);
- virtual struct ff_effect* createFFStruct() = 0;
- inline int internalIdx() const { return m_internalIdx; }
virtual const std::shared_ptr<FFBEffectParameters> parameters() const = 0;
- void reportError(const QString& errorMsg) const;
- inline void setInternalIdx(int idx) { m_internalIdx = idx; }
virtual bool setParameters(const std::shared_ptr<FFBEffectParameters> params) = 0;
inline void setStatus(FFBEffectStatus status) { m_status = status; }
inline FFBEffectStatus status() const { return m_status; }
virtual bool operator!=(const FFBEffect&) const;
protected:
- struct ff_effect* createFFStruct(const std::shared_ptr<FFBEffectParameters> params);
- bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params);
+ virtual bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params) = 0;
private:
- int m_internalIdx;
FFBEffectStatus m_status;
FFBEffectTypes m_type;
-signals:
-
-public slots:
-
};
#endif // FFBEFFECT_H
+++ /dev/null
-#include "ffbeffectfactory.h"
-
-FFBEffectFactory::FFBEffectFactory()
-{
-}
-
-std::shared_ptr<FFBEffect> FFBEffectFactory::createEffect(FFBEffectTypes type)
-{
- switch (type) {
- case FFBEffectTypes::NONE:
- return std::shared_ptr<FFBEffect>(new FFBNullEffect());
- case FFBEffectTypes::CONSTANT:
- return std::shared_ptr<FFBEffect>(new FFBConstantEffect());
- case FFBEffectTypes::PERIODIC:
- return std::shared_ptr<FFBEffect>(new FFBPeriodicEffect());
- case FFBEffectTypes::CONDITION:
- return std::shared_ptr<FFBEffect>(new FFBConditionEffect());
- case FFBEffectTypes::RAMP:
- return std::shared_ptr<FFBEffect>(new FFBRampEffect());
- case FFBEffectTypes::RUMBLE:
- return std::shared_ptr<FFBEffect>(new FFBRumbleEffect());
- default:
- return nullptr;
- }
-}
+++ /dev/null
-#ifndef FFBEFFECTFACTORY_H
-#define FFBEFFECTFACTORY_H
-
-#include "globals.h"
-#include "ffbconditioneffect.h"
-#include "ffbconstanteffect.h"
-#include "ffbnulleffect.h"
-#include "ffbperiodiceffect.h"
-#include "ffbrampeffect.h"
-#include "ffbrumbleeffect.h"
-
-class FFBEffectFactory
-{
-public:
- static std::shared_ptr<FFBEffect> createEffect(FFBEffectTypes type);
-
-private:
- FFBEffectFactory();
-
-};
-
-#endif // FFBEFFECTFACTORY_H
{
public:
explicit FFBNullEffect();
- inline struct ff_effect* createFFStruct() { return nullptr; }
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return nullptr; }
inline bool setParameters(const std::shared_ptr<FFBEffectParameters> params) { (void)(params); return false; }
+
+protected:
+ bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params) { Q_UNUSED(params); return false; }
};
#endif // FFBNULLEFFECT_H
-#include "ffbrumbleeffect.h"
+#include "linuxffbrumbleeffect.h"
-FFBRumbleEffect::FFBRumbleEffect() :
- FFBEffect(FFBEffectTypes::RUMBLE)
+LinuxFFBRumbleEffect::LinuxFFBRumbleEffect() :
+ LinuxFFBEffect(FFBEffectTypes::RUMBLE)
{
}
-struct ff_effect* FFBRumbleEffect::createFFStruct()
+struct ff_effect* LinuxFFBRumbleEffect::createFFStruct()
{
- struct ff_effect* eff = FFBEffect::createFFStruct(m_params);
+ struct ff_effect* eff = LinuxFFBEffect::createFFStruct(m_params);
eff->type = FF_RUMBLE;
return eff;
}
-bool FFBRumbleEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
+bool LinuxFFBRumbleEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
{
try {
return setParameters(std::dynamic_pointer_cast<FFBRumbleEffectParameters>(params));
}
}
-bool FFBRumbleEffect::setParameters(const std::shared_ptr<FFBRumbleEffectParameters> params)
+bool LinuxFFBRumbleEffect::setParameters(const std::shared_ptr<FFBRumbleEffectParameters> params)
{
if (!checkGenericParameters(params))
return false;
-#include "ffbconditioneffect.h"
+#include "linuxffbconditioneffect.h"
#include "globalsettings.h"
-FFBConditionEffect::FFBConditionEffect() :
- FFBEffect(FFBEffectTypes::CONDITION)
+LinuxFFBConditionEffect::LinuxFFBConditionEffect() :
+ LinuxFFBEffect(FFBEffectTypes::CONDITION)
{}
-struct ff_effect* FFBConditionEffect::createFFStruct()
+struct ff_effect* LinuxFFBConditionEffect::createFFStruct()
{
- struct ff_effect* eff = FFBEffect::createFFStruct(m_params);
+ struct ff_effect* eff = LinuxFFBEffect::createFFStruct(m_params);
eff->u.condition[0].center = m_params->center[FFBConditionEffectParameters::Axis::X];
eff->u.condition[0].deadband = m_params->deadband[FFBConditionEffectParameters::Axis::X];
return eff;
}
-bool FFBConditionEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
+bool LinuxFFBConditionEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
{
try {
return setParameters(std::dynamic_pointer_cast<FFBConditionEffectParameters>(params));
return false;
}
-bool FFBConditionEffect::setParameters(const std::shared_ptr<FFBConditionEffectParameters> params)
+bool LinuxFFBConditionEffect::setParameters(const std::shared_ptr<FFBConditionEffectParameters> params)
{
if (!checkGenericParameters(params))
return false;
return true;
}
-bool FFBConditionEffect::operator==(const FFBEffect& other) const
+bool LinuxFFBConditionEffect::operator==(const FFBEffect& other) const
{
if (this->type() != other.type())
return false;
else {
try {
- const FFBConditionEffect& cother = dynamic_cast<const FFBConditionEffect&>(other);
+ const LinuxFFBConditionEffect& cother = dynamic_cast<const LinuxFFBConditionEffect&>(other);
return this->m_params->subtype == cother.m_params->subtype;
} catch (std::bad_cast&) {
return false;
-#ifndef FFBCONDITIONEFFECT_H
-#define FFBCONDITIONEFFECT_H
+#ifndef LINUXFFBCONDITIONEFFECT_H
+#define LINUXFFBCONDITIONEFFECT_H
-#include "ffbeffect.h"
+#include "linuxffbeffect.h"
#include "ffbconditioneffectparameters.h"
-class FFBConditionEffect : public FFBEffect
+class LinuxFFBConditionEffect : public LinuxFFBEffect
{
public:
- explicit FFBConditionEffect();
+ explicit LinuxFFBConditionEffect();
struct ff_effect* createFFStruct();
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return m_params; }
bool setParameters(const std::shared_ptr<FFBEffectParameters> params);
std::shared_ptr<FFBConditionEffectParameters> m_params;
};
-#endif // FFBCONDITIONEFFECT_H
+#endif // FFBCONDITIONEFFECT_H
\ No newline at end of file
-#include "ffbconstanteffect.h"
+#include "linuxffbconstanteffect.h"
#include "globalsettings.h"
-FFBConstantEffect::FFBConstantEffect() :
- FFBEffect(FFBEffectTypes::CONSTANT)
-{
-}
+LinuxFFBConstantEffect::LinuxFFBConstantEffect() :
+ LinuxFFBEffect(FFBEffectTypes::CONSTANT)
+{}
-struct ff_effect* FFBConstantEffect::createFFStruct()
+struct ff_effect* LinuxFFBConstantEffect::createFFStruct()
{
/* Set up generic effect parameters */
- struct ff_effect* eff = FFBEffect::createFFStruct(m_params);
+ struct ff_effect* eff = LinuxFFBEffect::createFFStruct(m_params);
eff->type = FF_CONSTANT;
return eff;
}
-bool FFBConstantEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
+bool LinuxFFBConstantEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
{
try {
return setParameters(std::dynamic_pointer_cast<FFBConstantEffectParameters>(params));
return false;
}
-bool FFBConstantEffect::setParameters(const std::shared_ptr<FFBConstantEffectParameters> params)
+bool LinuxFFBConstantEffect::setParameters(const std::shared_ptr<FFBConstantEffectParameters> params)
{
if (!checkGenericParameters(params))
return false;
-#ifndef FFBCONSTANTEFFECT_H
-#define FFBCONSTANTEFFECT_H
+#ifndef LINUXFFBCONSTANTEFFECT_H
+#define LINUXFFBCONSTANTEFFECT_H
-#include "ffbeffect.h"
+#include "linuxffbeffect.h"
#include "ffbconstanteffectparameters.h"
-class FFBConstantEffect : public FFBEffect
+class LinuxFFBConstantEffect : public LinuxFFBEffect
{
public:
- explicit FFBConstantEffect();
+ explicit LinuxFFBConstantEffect();
struct ff_effect* createFFStruct();
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return m_params; }
bool setParameters(const std::shared_ptr<FFBEffectParameters> params);
std::shared_ptr<FFBConstantEffectParameters> m_params;
};
-#endif // FFBCONSTANTEFFECT_H
+#endif // LINUXFFBCONSTANTEFFECT_H
\ No newline at end of file
#include "linuxffbdevice.h"
-#include "ffbeffectfactory.h"
+#include "linuxffbeffectfactory.h"
#include <QtWidgets/QMessageBox>
#include <QDebug>
#include <fcntl.h>
c_path(path)
{
for (int i = 0; i < maxEffectCount; i++)
- m_effects.push_back(FFBEffectFactory::createEffect(FFBEffectTypes::NONE));
+ m_effects.push_back(LinuxFFBEffectFactory::createEffect(FFBEffectTypes::NONE));
}
void LinuxFFBDevice::close()
return true;
if (removeEffect(idx)) {
- m_effects[idx] = FFBEffectFactory::createEffect(FFBEffectTypes::NONE);
+ m_effects[idx] = LinuxFFBEffectFactory::createEffect(FFBEffectTypes::NONE);
if (m_effects[idx]->type() != FFBEffectTypes::NONE) {
qCritical("Unable to empty the effect slot.");
return false;
bool LinuxFFBDevice::removeEffect(const int idx)
{
+ std::shared_ptr<LinuxFFBEffect> linEff;
if (!stopEffect(idx))
return false;
- int internalIdx = m_effects[idx]->internalIdx();
+ if (m_effects[idx]->type() == FFBEffectTypes::NONE)
+ return true;
+
+ linEff = std::static_pointer_cast<LinuxFFBEffect>(m_effects[idx]);
+
+ int internalIdx = linEff->internalIdx();
int ret = ioctl(c_fd, EVIOCRMFF, internalIdx);
if (ret < 0)
return false;
bool LinuxFFBDevice::startEffect(const int idx, const FFBEffectTypes type, std::shared_ptr<FFBEffectParameters> parameters)
{
+ std::shared_ptr<LinuxFFBEffect> linEff;
int ret;
CHECK_EFFECT_IDX(idx);
if (m_effects[idx]->status() == FFBEffect::FFBEffectStatus::PLAYING)
return true;
+ linEff = std::static_pointer_cast<LinuxFFBEffect>(m_effects[idx]);
+
/* Start playback */
struct input_event evt;
evt.type = EV_FF;
- evt.code = m_effects[idx]->internalIdx();
- evt.value = m_effects[idx]->parameters()->repeat;
+ evt.code = linEff->internalIdx();
+ evt.value = linEff->parameters()->repeat;
ret = write(c_fd, &evt, sizeof(struct input_event));
if (ret != sizeof(struct input_event)) {
return false;
}
- m_effects[idx]->setStatus(FFBEffect::FFBEffectStatus::PLAYING);
+ linEff->setStatus(FFBEffect::FFBEffectStatus::PLAYING);
return true;
}
bool LinuxFFBDevice::stopEffect(const int idx)
{
+ std::shared_ptr<LinuxFFBEffect> linEff;
+
CHECK_EFFECT_IDX(idx);
if (m_effects[idx] == nullptr)
if (m_effects[idx]->status() != FFBEffect::FFBEffectStatus::PLAYING)
return true;
- int internalIdx = m_effects[idx]->internalIdx();
+ linEff = std::static_pointer_cast<LinuxFFBEffect>(m_effects[idx]);
+
+ int internalIdx = linEff->internalIdx();
struct input_event evt;
evt.type = EV_FF;
if (ret != sizeof(struct input_event))
return false;
- m_effects[idx]->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
+ linEff->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
return true;
}
bool LinuxFFBDevice::uploadEffect(const int idx, const FFBEffectTypes type, std::shared_ptr<FFBEffectParameters> parameters)
{
struct ff_effect* kernelEff = nullptr;
- std::shared_ptr<FFBEffect> effect = FFBEffectFactory::createEffect(type);
+ std::shared_ptr<FFBEffect> effect = LinuxFFBEffectFactory::createEffect(type);
+ std::shared_ptr<LinuxFFBEffect> linEff;
+
+ if (type != FFBEffectTypes::NONE)
+ linEff = std::static_pointer_cast<LinuxFFBEffect>(effect);
+ else
+ return false;
CHECK_EFFECT_IDX(idx);
- if (effect == nullptr) {
+ if (linEff == nullptr) {
qDebug() << "Unable to create effect";
return false;
}
- if (!effect->setParameters(parameters)) {
+ if (!linEff->setParameters(parameters)) {
qDebug() << "Unable to set effect parameters, some values are probably invalid.";
return false;
}
/* There is no effect in the selected slot */
if (m_effects[idx]->type() == FFBEffectTypes::NONE) {
- effect->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
+ linEff->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
qDebug() << "Creating new effect";
} else {
- if (*m_effects[idx] != *effect) {
+
+ if (*m_effects[idx] != *linEff) {
if (!removeEffect(idx)) {
QMessageBox::critical(nullptr, "FFB Device", "Unable to remove effect");
return false;
}
- effect->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
+ linEff->setStatus(FFBEffect::FFBEffectStatus::UPLOADED);
qDebug() << "Recreating effect" << idx;
} else {
- effect->setInternalIdx(m_effects[idx]->internalIdx());
- effect->setStatus(m_effects[idx]->status());
+ linEff->setInternalIdx(std::static_pointer_cast<LinuxFFBEffect>(m_effects[idx])->internalIdx());
+ linEff->setStatus(m_effects[idx]->status());
qDebug() << "Updating effect" << idx;
}
}
- kernelEff = effect->createFFStruct();
+ kernelEff = linEff->createFFStruct();
if (kernelEff == nullptr) {
QMessageBox::critical(nullptr, "FFB Device", "ff_effect struct could not have been created. Effect not uploaded.");
qDebug() << "struct ff_effect not created";
return false;
}
- qDebug() << kernelEff->u.condition[0].center << kernelEff->u.condition[0].deadband << kernelEff->u.condition[1].center << kernelEff->u.condition[1].deadband;
-
int ret = ioctl(c_fd, EVIOCSFF, kernelEff);
if (ret < 0) {
QMessageBox::critical(nullptr, "FFB Device", "Effect could not have been uploaded, error code: " + QString::number(ret));
return false;
}
- effect->setInternalIdx(kernelEff->id);
+ linEff->setInternalIdx(kernelEff->id);
delete kernelEff;
- m_effects[idx] = effect;
+ m_effects[idx] = linEff;
return true;
}
--- /dev/null
+#include "linuxffbeffect.h"
+#include "globalsettings.h"
+#include <QtWidgets/QMessageBox>
+
+LinuxFFBEffect::LinuxFFBEffect(FFBEffectTypes type) :
+ FFBEffect(type)
+{
+ m_internalIdx = -1;
+}
+
+struct ff_effect* LinuxFFBEffect::createFFStruct(const std::shared_ptr<FFBEffectParameters> params)
+{
+ struct ff_effect* eff = new struct ff_effect;
+ memset(eff, 0, sizeof(struct ff_effect));
+
+ eff->id = m_internalIdx;
+ eff->direction = params->direction;
+ eff->replay.delay = params->replayDelay;
+ eff->replay.length = params->replayLength;
+
+ return eff;
+}
+
+void LinuxFFBEffect::reportError(const QString& errorMsg) const
+{
+ QMessageBox::warning(nullptr, "FFB effect error", errorMsg);
+}
+
+bool LinuxFFBEffect::checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params)
+{
+ if (!GlobalSettings::GS()->doSanityChecks)
+ return true;
+
+ if (params->repeat < 1) {
+ reportError("Effect must be played back at least once.");
+ return false;
+ }
+
+ if (!checkBoundsInclusive(params->direction, 0, 0xFFFF)) {
+ reportError("Direction out of bounds.");
+ return false;
+ }
+
+ if (!checkBoundsInclusive(params->replayDelay, 0, 0x7FFF)) {
+ reportError("Replay delay out of bounds.");
+ return false;
+ }
+
+ if (!checkBoundsInclusive(params->replayLength, 0, 0x7FFF)) {
+ reportError("Replay length out of bounds.");
+ return false;
+ }
+
+ return true;
+}
\ No newline at end of file
--- /dev/null
+#ifndef LINUXFFBEFFECT_H
+#define LINUXFFBEFFECT_H
+
+#include "ffbeffect.h"
+#include <linux/input.h>
+
+class LinuxFFBEffect : public FFBEffect {
+public:
+ explicit LinuxFFBEffect(FFBEffectTypes type);
+ virtual struct ff_effect* createFFStruct() = 0;
+ inline int internalIdx() const { return m_internalIdx; }
+ inline void setInternalIdx(int idx) { m_internalIdx = idx; }
+
+protected:
+ struct ff_effect* createFFStruct(const std::shared_ptr<FFBEffectParameters> params);
+ bool checkGenericParameters(const std::shared_ptr<FFBEffectParameters> params);
+ void reportError(const QString& errorMsg) const;
+
+private:
+
+ int m_internalIdx;
+
+};
+
+#endif // LINUXFFBEFFECT_H
--- /dev/null
+#include "linuxffbeffectfactory.h"
+
+std::shared_ptr<FFBEffect> LinuxFFBEffectFactory::createEffect(FFBEffectTypes type)
+{
+ switch (type) {
+ case FFBEffectTypes::NONE:
+ return std::shared_ptr<FFBEffect>(new FFBNullEffect());
+ case FFBEffectTypes::CONSTANT:
+ return std::shared_ptr<LinuxFFBEffect>(new LinuxFFBConstantEffect());
+ case FFBEffectTypes::PERIODIC:
+ return std::shared_ptr<LinuxFFBEffect>(new LinuxFFBPeriodicEffect());
+ case FFBEffectTypes::CONDITION:
+ return std::shared_ptr<LinuxFFBEffect>(new LinuxFFBConditionEffect());
+ case FFBEffectTypes::RAMP:
+ return std::shared_ptr<LinuxFFBEffect>(new LinuxFFBRampEffect());
+ case FFBEffectTypes::RUMBLE:
+ return std::shared_ptr<LinuxFFBEffect>(new LinuxFFBRumbleEffect());
+ default:
+ return nullptr;
+ }
+}
--- /dev/null
+#ifndef LinuxFFBEFFECTFACTORY_H
+#define FFBEFFECTFACTORY_H
+
+#include "globals.h"
+#include "linuxffbconditioneffect.h"
+#include "linuxffbconstanteffect.h"
+#include "ffbnulleffect.h"
+#include "linuxffbperiodiceffect.h"
+#include "linuxffbrampeffect.h"
+#include "linuxffbrumbleeffect.h"
+
+class LinuxFFBEffectFactory
+{
+public:
+ static std::shared_ptr<FFBEffect> createEffect(FFBEffectTypes type);
+
+private:
+ LinuxFFBEffectFactory() {};
+
+};
+
+#endif // FFBEFFECTFACTORY_H
-#include "ffbperiodiceffect.h"
+#include "linuxffbperiodiceffect.h"
#include "globalsettings.h"
#include <QDebug>
-FFBPeriodicEffect::FFBPeriodicEffect() :
- FFBEffect(FFBEffectTypes::PERIODIC)
+LinuxFFBPeriodicEffect::LinuxFFBPeriodicEffect() :
+ LinuxFFBEffect(FFBEffectTypes::PERIODIC)
{}
-struct ff_effect* FFBPeriodicEffect::createFFStruct()
+struct ff_effect* LinuxFFBPeriodicEffect::createFFStruct()
{
- struct ff_effect* eff = FFBEffect::createFFStruct(m_params);
+ struct ff_effect* eff = LinuxFFBEffect::createFFStruct(m_params);
if (eff == nullptr)
return nullptr;
return eff;
}
-bool FFBPeriodicEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
+bool LinuxFFBPeriodicEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
{
try {
return setParameters(std::dynamic_pointer_cast<FFBPeriodicEffectParameters>(params));
}
}
-bool FFBPeriodicEffect::setParameters(const std::shared_ptr<FFBPeriodicEffectParameters> params)
+bool LinuxFFBPeriodicEffect::setParameters(const std::shared_ptr<FFBPeriodicEffectParameters> params)
{
if (!checkGenericParameters(params))
return false;
return true;
}
-bool FFBPeriodicEffect::operator==(const FFBEffect& other) const
+bool LinuxFFBPeriodicEffect::operator==(const FFBEffect& other) const
{
if (this->type() != other.type())
return false;
else {
try {
- const FFBPeriodicEffect& eff = dynamic_cast<const FFBPeriodicEffect&>(other);
+ const LinuxFFBPeriodicEffect& eff = dynamic_cast<const LinuxFFBPeriodicEffect&>(other);
return this->m_params->waveform == eff.m_params->waveform;
} catch(std::bad_cast&) {
return false;
}
}
-FFBPeriodicEffect::~FFBPeriodicEffect()
-{
-}
-#ifndef FFBPERIODICEFFECT_H
-#define FFBPERIODICEFFECT_H
+#ifndef LINUXFFBPERIODICEFFECT_H
+#define LINUXFFBPERIODICEFFECT_H
-#include "ffbeffect.h"
+#include "linuxffbeffect.h"
#include "ffbperiodiceffectparameters.h"
-class FFBPeriodicEffect : public FFBEffect
+class LinuxFFBPeriodicEffect : public LinuxFFBEffect
{
public:
- FFBPeriodicEffect();
- ~FFBPeriodicEffect();
+ LinuxFFBPeriodicEffect();
struct ff_effect* createFFStruct();
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return m_params; }
bool setParameters(const std::shared_ptr<FFBEffectParameters> params);
std::shared_ptr<FFBPeriodicEffectParameters> m_params;
};
-#endif // FFBPERIODICEFFECT_H
+#endif // LINUXFFBPERIODICEFFECT_H
-#include "ffbrampeffect.h"
+#include "linuxffbrampeffect.h"
#include "globalsettings.h"
-FFBRampEffect::FFBRampEffect() :
- FFBEffect(FFBEffectTypes::RAMP)
+LinuxFFBRampEffect::LinuxFFBRampEffect() :
+ LinuxFFBEffect(FFBEffectTypes::RAMP)
{
}
-struct ff_effect* FFBRampEffect::createFFStruct()
+struct ff_effect* LinuxFFBRampEffect::createFFStruct()
{
- struct ff_effect* eff = FFBEffect::createFFStruct(m_params);
+ struct ff_effect* eff = LinuxFFBEffect::createFFStruct(m_params);
if (eff == nullptr)
return nullptr;
}
-bool FFBRampEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
+bool LinuxFFBRampEffect::setParameters(const std::shared_ptr<FFBEffectParameters> params)
{
try {
return setParameters(std::dynamic_pointer_cast<FFBRampEffectParameters>(params));
}
}
-bool FFBRampEffect::setParameters(const std::shared_ptr<FFBRampEffectParameters> params)
+bool LinuxFFBRampEffect::setParameters(const std::shared_ptr<FFBRampEffectParameters> params)
{
if (!checkGenericParameters(params))
return false;
m_params = params;
return true;
}
-
-FFBRampEffect::~FFBRampEffect()
-{
-}
-#ifndef FFBRAMPEFFECT_H
-#define FFBRAMPEFFECT_H
+#ifndef LINUXFFBRAMPEFFECT_H
+#define LINUXFFBRAMPEFFECT_H
-#include "ffbeffect.h"
+#include "linuxffbeffect.h"
#include "ffbrampeffectparameters.h"
-class FFBRampEffect : public FFBEffect
+class LinuxFFBRampEffect : public LinuxFFBEffect
{
public:
- FFBRampEffect();
- ~FFBRampEffect();
+ LinuxFFBRampEffect();
struct ff_effect* createFFStruct();
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return m_params; }
bool setParameters(const std::shared_ptr<FFBEffectParameters> params);
-#ifndef FFBRUMBLEEFFECT_H
-#define FFBRUMBLEEFFECT_H
+#ifndef LINUXFFBRUMBLEEFFECT_H
+#define LINUXFFBRUMBLEEFFECT_H
-#include "ffbeffect.h"
+#include "linuxffbeffect.h"
#include "ffbrumbleeffectparameters.h"
-class FFBRumbleEffect : public FFBEffect
+class LinuxFFBRumbleEffect : public LinuxFFBEffect
{
public:
- FFBRumbleEffect();
+ LinuxFFBRumbleEffect();
struct ff_effect* createFFStruct();
inline const std::shared_ptr<FFBEffectParameters> parameters() const { return m_params; }
bool setParameters(const std::shared_ptr<FFBEffectParameters> params);