22#ifndef IOController_H_
23#define IOController_H_
25#include <unordered_map>
28#include <sigc++/sigc++.h>
29#include "IOController_i.hh"
30#include "UniSetTypes.h"
31#include "UniSetManager.h"
32#include "Configuration.h"
49 public POA_IOController_i
53 IOController(
const std::string& name,
const std::string& section );
57 void setDBServer(
const std::shared_ptr<uniset::DBServer>& dbserver );
75 CORBA::Boolean undefined,
83 virtual IOController_i::SensorInfoSeq* getSensorSeq(
const uniset::IDSeq& lst )
override;
89 virtual IOController_i::SensorInfoSeq* getSensorsMap()
override;
112 virtual IOController_i::ShortMapSeq* getSensors()
override;
114#ifndef DISABLE_REST_API
116 virtual Poco::JSON::Object::Ptr httpHelp(
const Poco::URI::QueryParameters& p )
override;
117 virtual Poco::JSON::Object::Ptr httpRequest(
const std::string& req,
const Poco::URI::QueryParameters& p )
override;
124 typedef std::unordered_map<uniset::ObjectId, std::shared_ptr<USensorInfo>> IOStateList;
126 static const long not_specified_value = { std::numeric_limits<long>::max() };
135 typedef sigc::signal<void, std::shared_ptr<USensorInfo>&,
IOController*> ChangeUndefinedStateSignal;
144 ChangeUndefinedStateSignal signal_change_undefined_state(
uniset::ObjectId sid );
145 ChangeUndefinedStateSignal signal_change_undefined_state();
151 inline IOStateList::iterator ioBegin()
153 return ioList.begin();
155 inline IOStateList::iterator ioEnd()
161 return ioList.find(k);
164 inline int ioCount() const noexcept
166 return ioList.size();
173 virtual long localSetValueIt( IOStateList::iterator& it,
const uniset::ObjectId sid,
176 virtual long localGetValue( IOStateList::iterator& it,
const uniset::ObjectId sid );
185 virtual void localFreezeValueIt( IOController::IOStateList::iterator& li,
191 virtual void localFreezeValue( std::shared_ptr<USensorInfo>& usi,
198 virtual long localSetValue( std::shared_ptr<USensorInfo>& usi, CORBA::Long value,
uniset::ObjectId sup_id );
199 long localGetValue( std::shared_ptr<USensorInfo>& usi) ;
201#ifndef DISABLE_REST_API
203 virtual Poco::JSON::Object::Ptr request_get(
const std::string& req,
const Poco::URI::QueryParameters& p );
204 virtual Poco::JSON::Object::Ptr request_sensors(
const std::string& req,
const Poco::URI::QueryParameters& p );
205 void getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr<USensorInfo>& s,
bool shortInfo =
false );
220 typedef sigc::signal<void, std::shared_ptr<USensorInfo>&,
IOController*> InitSignal;
223 InitSignal signal_init();
234 uniset::Message::Priority p = uniset::Message::Medium,
244 ai.default_val = defval;
247 ai.supplier = sup_id;
248 ai.depend_sid = depend_sid;
273 IOStateList::iterator myioBegin();
274 IOStateList::iterator myioEnd();
277 void initIOList(
const IOStateList&& l );
279 typedef std::function<void(std::shared_ptr<USensorInfo>&)> UFunction;
281 void for_iolist( UFunction f );
284 friend class NCRestorer;
285 friend class SMInterface;
287 std::mutex siganyMutex;
290 std::mutex siganyundefMutex;
299 std::shared_ptr<uniset::DBServer> dbserver = {
nullptr };
301 std::mutex loggingMutex;
305 struct UThresholdInfo;
306 typedef std::list<std::shared_ptr<UThresholdInfo>> ThresholdExtList;
331 static const size_t MaxUserData = 4;
332 void*
userdata[MaxUserData] = {
nullptr,
nullptr,
nullptr,
nullptr };
335 void* getUserData(
size_t index );
336 void setUserData(
size_t index,
void* data );
344 ChangeUndefinedStateSignal sigUndefChange;
348 std::shared_ptr<USensorInfo> d_usi;
352 ThresholdExtList thresholds;
354 size_t nchanges = { 0 };
356 long undef_value = { not_specified_value };
357 long frozen_value = { 0 };
359 bool readonly = {
false };
362 void checkDepend( std::shared_ptr<USensorInfo>& d_usi, IOController* );
378 sm.sensor_type =
type;
379 sm.priority = (uniset::Message::Priority)
priority;
425 IOController::IOStateList::iterator
sit;
430 inline bool operator== (
const ThresholdInfo& r )
const
432 return ((
id == r.id) &&
Definition IOController.h:50
virtual void dumpToDB()
сохранение состояния всех датчиков в БД
Definition IOController.cc:563
virtual void sensorsUnregistration()
Definition IOController.cc:86
virtual void activateInit()
Definition IOController.cc:107
virtual bool deactivateObject() override
Definition IOController.cc:80
virtual void sensorsRegistration()
Definition IOController.h:216
virtual bool activateObject() override
Definition IOController.cc:69
void ioUnRegistration(const uniset::ObjectId sid)
Definition IOController.cc:517
virtual void localSetUndefinedState(IOStateList::iterator &it, bool undefined, const uniset::ObjectId sid)
Definition IOController.cc:190
void ioRegistration(std::shared_ptr< USensorInfo > &usi)
Definition IOController.cc:479
sigc::signal< void, std::shared_ptr< USensorInfo > &, IOController * > ChangeSignal
Definition IOController.h:134
virtual void logging(uniset::SensorMessage &sm)
сохранение информации об изменении состояния датчика
Definition IOController.cc:527
Definition MessageType.h:127
Definition UniSetManager.h:60
@ NormalThreshold
Definition IOController_i.idl:205
Definition Calibration.h:27
string< SizeOfObjectType > ObjectType
Definition UniSetTypes_i.idl:33
long ThresholdId
Definition UniSetTypes_i.idl:31
sequence< ObjectId > IDSeq
Definition UniSetTypes_i.idl:89
const ObjectId DefaultObjectId
Definition UniSetTypes.h:71
std::shared_ptr< Configuration > uniset_conf() noexcept
Definition Configuration.cc:90
long ObjectId
Definition UniSetTypes_i.idl:30
Definition IOController_i.idl:83
Definition IOController_i.idl:97
uniset::ObjectId supplier
Definition IOController_i.idl:110
unsigned long tv_sec
Definition IOController_i.idl:108
boolean undefined
Definition IOController_i.idl:99
CalibrateInfo ci
Definition IOController_i.idl:107
UniversalIO::IOType type
Definition IOController_i.idl:103
long priority
Definition IOController_i.idl:104
unsigned long tv_nsec
Definition IOController_i.idl:109
long value
Definition IOController_i.idl:98
Definition IOController_i.idl:58
uniset::ObjectId node
Definition IOController_i.idl:60
uniset::ObjectId id
Definition IOController_i.idl:59
Definition IOController_i.idl:144
Definition IOController_i.idl:210
long lowlimit
Definition IOController_i.idl:213
long hilimit
Definition IOController_i.idl:212
Definition IOController.h:310
void * userdata[MaxUserData]
Definition IOController.h:332
uniset::uniset_rwmutex userdata_lock
Definition IOController.h:333
long d_off_value
Definition IOController.h:347
long d_value
Definition IOController.h:346
uniset::uniset_rwmutex val_lock
Definition IOController.h:328
Definition IOController.h:409
IOController::IOStateList::iterator sit
Definition IOController.h:425
uniset::ObjectId sid
Definition IOController.h:422
bool invert
Definition IOController.h:428
Definition UniSetTypes_i.idl:65