UniSet
1.4.0
|
00001 // ----------------------------------------------------------------------------- 00002 #ifndef IOBase_H_ 00003 #define IOBase_H_ 00004 // ----------------------------------------------------------------------------- 00005 #include <string> 00006 #include "PassiveTimer.h" 00007 #include "Trigger.h" 00008 #include "Mutex.h" 00009 #include "DigitalFilter.h" 00010 #include "Calibration.h" 00011 #include "IOController.h" 00012 #include "SMInterface.h" 00013 // ----------------------------------------------------------------------------- 00014 static const int DefaultSubdev = -1; 00015 static const int DefaultChannel = -1; 00016 static const int NoSafety = -1; 00017 // ----------------------------------------------------------------------------- 00019 struct IOBase 00020 { 00021 IOBase(): 00022 cdiagram(0), 00023 breaklim(0), 00024 value(0), 00025 craw(0), 00026 safety(0), 00027 defval(0), 00028 df(1), 00029 nofilter(false), 00030 f_median(false), 00031 f_ls(false), 00032 f_filter_iir(false), 00033 ignore(false), 00034 invert(false), 00035 noprecision(false), 00036 jar_state(false), 00037 ondelay_state(false), 00038 offdelay_state(false), 00039 t_ai(UniSetTypes::DefaultObjectId) 00040 {} 00041 00042 00043 bool check_channel_break( long val ); 00045 bool check_jar( bool val ); 00046 bool check_on_delay( bool val ); 00047 bool check_off_delay( bool val ); 00049 IOController_i::SensorInfo si; 00050 UniversalIO::IOTypes stype; 00051 IOController_i::CalibrateInfo cal; 00052 Calibration* cdiagram; 00054 long breaklim; 00055 long value; 00056 long craw; 00057 long cprev; 00058 long safety; 00059 long defval; 00061 DigitalFilter df; 00062 bool nofilter; 00063 bool f_median; 00064 bool f_ls; 00065 bool f_filter_iir; 00067 bool ignore; 00068 bool invert; 00069 bool noprecision; 00070 00071 PassiveTimer ptJar; 00072 PassiveTimer ptOnDelay; 00073 PassiveTimer ptOffDelay; 00075 bool jar_pause; 00076 Trigger trOnDelay; 00077 Trigger trOffDelay; 00078 Trigger trJar; 00079 00080 bool jar_state; 00081 bool ondelay_state; 00082 bool offdelay_state; 00086 // Порог 00087 UniSetTypes::ObjectId t_ai; 00091 IONotifyController_i::ThresholdInfo ti; 00092 00093 00094 IOController::AIOStateList::iterator ait; 00095 IOController::DIOStateList::iterator dit; 00096 UniSetTypes::uniset_spin_mutex val_lock; 00098 friend std::ostream& operator<<(std::ostream& os, IOBase& inf ); 00099 00100 static void processingFasAI( IOBase* it, float new_val, SMInterface* shm, bool force ); 00101 static void processingAsAI( IOBase* it, long new_val, SMInterface* shm, bool force ); 00102 static void processingAsDI( IOBase* it, bool new_set, SMInterface* shm, bool force ); 00103 static long processingAsAO( IOBase* it, SMInterface* shm, bool force ); 00104 static float processingFasAO( IOBase* it, SMInterface* shm, bool force ); 00105 static bool processingAsDO( IOBase* it, SMInterface* shm, bool force ); 00106 static void processingThreshold( IOBase* it, SMInterface* shm, bool force ); 00107 static bool initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm, 00108 DebugStream* dlog=0, std::string myname="", 00109 int def_filtersize=0, float def_filterT=0.0, 00110 float def_lsparam=0.2, float def_iir_coeff_prev=0.5, 00111 float def_iir_coeff_new=0.5 ); 00112 }; 00113 00114 00115 00116 // ----------------------------------------------------------------------------- 00117 #endif // IOBase_H_ 00118 // -----------------------------------------------------------------------------