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"
133 public POA_IONotifyController_i
137 IONotifyController(
const std::string& name,
const std::string& section, std::shared_ptr<NCRestorer> dumper =
nullptr );
153 CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Boolean invert,
154 UniversalIO::UIOCommand cmd )
override;
158 virtual IONotifyController_i::ThresholdsListSeq* getThresholdsList()
override;
165 #ifndef DISABLE_REST_API
167 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
168 virtual Poco::JSON::Object::Ptr httpRequest(
const string& req,
const Poco::URI::QueryParameters& p )
override;
177 UniSetObject_i_ptr ref = 0,
size_t maxAttemtps = 10 ):
179 ref(ref), attempt(maxAttemtps) {}
181 UniSetObject_i_var ref;
183 size_t lostEvents = { 0 };
184 size_t smCount = { 0 };
192 typedef std::list<ConsumerInfoExt> ConsumerList;
207 typedef std::unordered_map<uniset::ObjectId, ConsumerListInfo>
AskMap;
230 IOController::IOStateList::iterator
sit;
235 inline bool operator== (
const ThresholdInfo& r )
const
237 return ((
id == r.id) &&
240 (invert == r.invert) );
256 ThresholdInfoExt(
const ThresholdInfoExt& ) =
delete;
257 ThresholdInfoExt& operator=(
const ThresholdInfoExt& ) =
delete;
258 ThresholdInfoExt( ThresholdInfoExt&& ) =
default;
259 ThresholdInfoExt& operator=(ThresholdInfoExt&& ) =
default;
269 UniversalIO::IOType t = UniversalIO::AI ):
270 si(si), type(t),
list( std::move(
list) ) {}
275 std::shared_ptr<USensorInfo> usi;
276 UniversalIO::IOType type = { UniversalIO::AI };
286 virtual void initItem(std::shared_ptr<USensorInfo>& usi,
IOController* ic );
311 std::shared_ptr<NCRestorer> restorer;
316 virtual long localSetValue( std::shared_ptr<USensorInfo>& usi,
323 udataConsumerList = 0,
324 udataThresholdList = 1
327 #ifndef DISABLE_REST_API
329 Poco::JSON::Object::Ptr request_consumers(
const std::string& req,
const Poco::URI::QueryParameters& p );
330 Poco::JSON::Object::Ptr request_lost(
const string& req,
const Poco::URI::QueryParameters& p );
331 Poco::JSON::Object::Ptr getConsumers(
uniset::ObjectId sid, ConsumerListInfo& clist,
bool ifNotEmpty =
true );
346 bool addThreshold(ThresholdExtList& lst, ThresholdInfoExt&& ti,
const uniset::ConsumerInfo& ci);
348 bool removeThreshold(ThresholdExtList& lst, ThresholdInfoExt& ti,
const uniset::ConsumerInfo& ci);
351 AskThresholdMap askTMap;
358 sigc::connection conInit;
359 sigc::connection conUndef;
364 std::mutex lostConsumersMutex;
366 struct LostConsumerInfo
368 size_t count = { 0 };
369 bool lost = {
false };
379 std::unordered_map<uniset::ObjectId, LostConsumerInfo> lostConsumers;
Definition: IONotifyController.h:194
unsigned long tv_nsec
Definition: IOController_i.idl:210
UserDataID
Definition: IONotifyController.h:321
ThresholdExtList::iterator findThreshold(const uniset::ObjectId sid, const uniset::ThresholdId tid)
поиск информации о пороговом датчике
Definition: IONotifyController.cc:962
Definition: CallbackTimer.h:29
virtual bool activateObject() override
Definition: IONotifyController.cc:584
virtual IONotifyController_i::ThresholdInfo getThresholdInfo(const uniset::ObjectId sid, uniset::ThresholdId tid) override
Definition: IONotifyController.cc:983
Definition: IOController_i.idl:235
unsigned long tv_sec
Definition: IOController_i.idl:209
Definition: IOController_i.idl:203
long ThresholdId
Definition: UniSetTypes_i.idl:31
std::unordered_map< uniset::ObjectId, ThresholdsListInfo > AskThresholdMap
Definition: IONotifyController.h:281
Definition: IONotifyController.h:210
virtual void dumpOrdersList(const uniset::ObjectId sid, const IONotifyController::ConsumerListInfo &lst)
Definition: IONotifyController.cc:616
Definition: UniSetTypes_i.idl:74
sequence< ObjectId > IDSeq
Definition: UniSetTypes_i.idl:82
virtual void readDump()
Definition: IONotifyController.cc:592
Definition: IONotifyController.h:265
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:56
Definition: IONotifyController.h:131
uniset::ObjectId sid
Definition: IONotifyController.h:227
virtual void checkThreshold(std::shared_ptr< USensorInfo > &usi, bool send=true)
проверка срабатывания пороговых датчиков
virtual long localSetValue(std::shared_ptr< USensorInfo > &usi, CORBA::Long value, uniset::ObjectId sup_id) override
Definition: IONotifyController.cc:424
Definition: IONotifyController.h:173
Definition: MessageType.h:122
long lowlimit
Definition: IOController_i.idl:207
bool invert
Definition: IONotifyController.h:233
ThresholdExtList list
Definition: IONotifyController.h:277
std::list< ThresholdInfoExt > ThresholdExtList
Definition: IONotifyController.h:263
virtual void dumpThresholdList(const uniset::ObjectId sid, const IONotifyController::ThresholdExtList &lst)
Definition: IONotifyController.cc:637
virtual uniset::SimpleInfo * getInfo(const char *userparam=0) override
Definition: IONotifyController.cc:79
long hilimit
Definition: IOController_i.idl:206
std::unordered_map< uniset::ObjectId, ConsumerListInfo > AskMap
Definition: IONotifyController.h:207
virtual void send(ConsumerListInfo &lst, const uniset::SensorMessage &sm)
посылка информации об изменении состояния датчика
Definition: IONotifyController.cc:496
IOController::IOStateList::iterator sit
Definition: IONotifyController.h:230
Definition: IOController_i.idl:56
Definition: IOController.h:37
ConsumerListInfo clst
Definition: IONotifyController.h:224
Definition: IOController_i.idl:199
string< SizeOfObjectType > ObjectType
Definition: UniSetTypes_i.idl:33
boolean invert
Definition: IOController_i.idl:211
Definition: UniSetTypes_i.idl:64
virtual void askSensor(const uniset::ObjectId sid, const uniset::ConsumerInfo &ci, UniversalIO::UIOCommand cmd) override
Definition: IONotifyController.cc:273
Definition: NCRestorer.h:41
void onChangeUndefinedState(std::shared_ptr< USensorInfo > &usi, IOController *ic)
Definition: IONotifyController.cc:1131
long ObjectId
Definition: UniSetTypes_i.idl:30
virtual void askThreshold(const uniset::ObjectId sid, const uniset::ConsumerInfo &ci, uniset::ThresholdId tid, CORBA::Long lowLimit, CORBA::Long hiLimit, CORBA::Boolean invert, UniversalIO::UIOCommand cmd) override
Definition: IONotifyController.cc:655