/* * Copyright (C) EdgeTX * * Based on code named * opentx - https://github.com/opentx/opentx * th9x - http://code.google.com/p/th9x * er9x - http://code.google.com/p/er9x * gruvin9x - http://code.google.com/p/gruvin9x * * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * 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 General Public License for more details. */ #ifndef LOGICALSWITCHDATA_H #define LOGICALSWITCHDATA_H #include class RadioDataConversionState; enum CSFunction { LS_FN_OFF, LS_FN_VPOS, LS_FN_VNEG, LS_FN_APOS, LS_FN_ANEG, LS_FN_AND, LS_FN_OR, LS_FN_XOR, LS_FN_EQUAL, LS_FN_NEQUAL, LS_FN_GREATER, LS_FN_LESS, LS_FN_EGREATER, LS_FN_ELESS, LS_FN_DPOS, LS_FN_DAPOS, LS_FN_VEQUAL, // added at the end to avoid everything renumbered LS_FN_VALMOSTEQUAL, LS_FN_TIMER, LS_FN_STICKY, LS_FN_EDGE, // later ... LS_FN_RANGE, LS_FN_MAX }; enum CSFunctionFamily { LS_FAMILY_VOFS, LS_FAMILY_VBOOL, LS_FAMILY_VCOMP, LS_FAMILY_TIMER, LS_FAMILY_STICKY, LS_FAMILY_EDGE, }; class LogicalSwitchData { Q_DECLARE_TR_FUNCTIONS(LogicalSwitchData) public: LogicalSwitchData(unsigned int func=0) { clear(); this->func = func; } unsigned int func; int val1; int val2; int val3; unsigned int delay; unsigned int duration; int andsw; bool lsState; bool lsPersist; void clear() { memset(this, 0, sizeof(LogicalSwitchData)); } bool isEmpty() const; CSFunctionFamily getFunctionFamily() const; unsigned int getRangeFlags() const; QString funcToString() const; QString nameToString(int index) const; void convert(RadioDataConversionState & cstate); }; #endif // LOGICALSWITCHDATA_H