22 #ifndef IONotifyController_H_
23 #define IONotifyController_H_
26 #include <unordered_map>
30 #include "UniSetTypes.h"
31 #include "IOController_i.hh"
32 #include "IOController.h"
134 public POA_IONotifyController_i
138 IONotifyController(
const std::string& name,
const std::string& section, std::shared_ptr<IOConfig> ioconf =
nullptr );
154 CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Boolean invert,
155 UniversalIO::UIOCommand cmd )
override;
159 virtual IONotifyController_i::ThresholdsListSeq* getThresholdsList()
override;
166 #ifndef DISABLE_REST_API
168 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
169 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
178 UniSetObject_i_ptr ref = 0,
size_t maxAttemtps = 10 ):
180 ref(ref), attempt(maxAttemtps) {}
182 UniSetObject_i_var ref;
183 size_t attempt = { 10 };
184 size_t lostEvents = { 0 };
185 size_t smCount = { 0 };
193 typedef std::list<ConsumerInfoExt> ConsumerList;
208 typedef std::unordered_map<uniset::ObjectId, ConsumerListInfo>
AskMap;
212 typedef std::unordered_map<UThresholdInfo*, ConsumerListInfo> AskThresholdMap;
218 virtual void initItem( std::shared_ptr<USensorInfo>& usi,
IOController* ic );
233 std::shared_ptr<IOConfig> restorer;
235 void onChangeUndefinedState( std::shared_ptr<USensorInfo>& usi,
IOController* ic );
238 virtual long localSetValue( std::shared_ptr<USensorInfo>& usi,
241 #ifndef DISABLE_REST_API
243 Poco::JSON::Object::Ptr request_consumers(
const std::string& req,
const Poco::URI::QueryParameters& p );
244 Poco::JSON::Object::Ptr request_lost(
const std::string& req,
const Poco::URI::QueryParameters& p );
249 void showStatisticsForConsumer( std::ostringstream& inf,
const std::string& consumer );
250 void showStatisticsForLostConsumers( std::ostringstream& inf );
251 void showStatisticsForConsusmers( std::ostringstream& inf );
252 void showStatisticsForConsumersWithLostEvent( std::ostringstream& inf );
253 void showStatisticsForSensor( std::ostringstream& inf,
const std::string& name );
259 udataConsumerList = 0
264 friend class NCRestorer;
275 std::shared_ptr<UThresholdInfo> addThresholdIfNotExist( std::shared_ptr<USensorInfo>& usi, std::shared_ptr<UThresholdInfo>& ti );
276 bool addThresholdConsumer( std::shared_ptr<UThresholdInfo>& ti,
const uniset::ConsumerInfo& ci );
279 bool removeThresholdConsumer( std::shared_ptr<USensorInfo>& usi,
280 std::shared_ptr<UThresholdInfo>& ti,
284 AskThresholdMap askTMap;
291 sigc::connection conInit;
292 sigc::connection conUndef;
297 std::mutex lostConsumersMutex;
299 struct LostConsumerInfo
301 size_t count = { 0 };
302 bool lost = {
false };
310 std::unordered_map<uniset::ObjectId, LostConsumerInfo> lostConsumers;
Definition: IOController.h:50
Definition: IONotifyController.h:135
virtual void askSensor(const uniset::ObjectId sid, const uniset::ConsumerInfo &ci, UniversalIO::UIOCommand cmd) override
Definition: IONotifyController.cc:508
UserDataID
Definition: IONotifyController.h:258
virtual void checkThreshold(std::shared_ptr< USensorInfo > &usi, bool send=true)
проверка срабатывания пороговых датчиков
Definition: IONotifyController.cc:937
virtual void readConf()
Definition: IONotifyController.cc:763
virtual uniset::SimpleInfo * getInfo(const char *userparam=0) override
Definition: IONotifyController.cc:367
virtual void sensorsRegistration() override
Definition: IONotifyController.cc:755
virtual void send(ConsumerListInfo &lst, const uniset::SensorMessage &sm, const uniset::ConsumerInfo *ci=nullptr)
посылка информации об изменении состояния датчика (всем или указанному заказчику)
Definition: IONotifyController.cc:653
virtual bool activateObject() override
Definition: IONotifyController.cc:747
std::unordered_map< uniset::ObjectId, ConsumerListInfo > AskMap
Definition: IONotifyController.h:208
std::shared_ptr< UThresholdInfo > findThreshold(const uniset::ObjectId sid, const uniset::ThresholdId tid)
поиск информации о пороговом датчике
Definition: IONotifyController.cc:1023
Definition: MessageType.h:127
Definition: CommonEventLoop.h:15
string< SizeOfObjectType > ObjectType
Definition: UniSetTypes_i.idl:33
long ThresholdId
Definition: UniSetTypes_i.idl:31
sequence< ObjectId > IDSeq
Definition: UniSetTypes_i.idl:89
long ObjectId
Definition: UniSetTypes_i.idl:30
Definition: IOController_i.idl:210
Definition: IOController_i.idl:242
Definition: UniSetTypes_i.idl:75
Definition: IONotifyController.h:176
Definition: IONotifyController.h:196
Definition: UniSetTypes_i.idl:65