|
UniSet
2.2.1
|
00001 #ifndef PassiveLProcessor_H_ 00002 #define PassiveLProcessor_H_ 00003 // -------------------------------------------------------------------------- 00004 #include <map> 00005 #include <memory> 00006 #include "UniSetTypes.h" 00007 #include "UniSetObject.h" 00008 #include "Extensions.h" 00009 #include "SharedMemory.h" 00010 #include "UInterface.h" 00011 #include "SMInterface.h" 00012 #include "LProcessor.h" 00013 // -------------------------------------------------------------------------- 00015 class PassiveLProcessor: 00016 public UniSetObject, 00017 protected LProcessor 00018 { 00019 public: 00020 00021 PassiveLProcessor(UniSetTypes::ObjectId objId, 00022 UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, const std::string& prefix = "lproc" ); 00023 virtual ~PassiveLProcessor(); 00024 00025 enum Timers 00026 { 00027 tidStep 00028 }; 00029 00030 static void help_print( int argc, const char* const* argv ); 00031 00032 static std::shared_ptr<PassiveLProcessor> init_plproc( int argc, const char* const* argv, 00033 UniSetTypes::ObjectId shmID, const std::shared_ptr<SharedMemory>& ic = nullptr, 00034 const std::string& prefix = "plproc" ); 00035 00036 protected: 00037 PassiveLProcessor(): shm(0), maxHeartBeat(0) {}; 00038 00039 virtual void step(); 00040 virtual void getInputs(); 00041 virtual void setOuts(); 00042 00043 void sysCommand( const UniSetTypes::SystemMessage* msg ) override; 00044 void sensorInfo( const UniSetTypes::SensorMessage* sm ) override; 00045 void timerInfo( const UniSetTypes::TimerMessage* tm ) override; 00046 void askSensors( const UniversalIO::UIOCommand cmd ); 00047 // void initOutput(); 00048 00049 // действия при завершении работы 00050 virtual void sigterm( int signo ) override; 00051 void initIterators(); 00052 virtual bool activateObject() override; 00053 00054 std::shared_ptr<SMInterface> shm; 00055 00056 private: 00057 PassiveTimer ptHeartBeat; 00058 UniSetTypes::ObjectId sidHeartBeat = { UniSetTypes::DefaultObjectId }; 00059 int maxHeartBeat = { 10 }; 00060 IOController::IOStateList::iterator itHeartBeat; 00061 UniSetTypes::uniset_mutex mutex_start; 00062 }; 00063 // --------------------------------------------------------------------------- 00064 #endif
1.7.6.1