17 #ifndef UNetExchange_H_ 18 #define UNetExchange_H_ 24 #include "UniSetObject.h" 27 #include "SMInterface.h" 28 #include "SharedMemory.h" 29 #include "ThreadCreator.h" 30 #include "UNetReceiver.h" 31 #include "UNetSender.h" 32 #include "LogServer.h" 33 #include "DebugStream.h" 34 #include "UNetLogSugar.h" 35 #include "LogAgregator.h" 39 #define vmonit( var ) vmon.add( #var, var ) 155 static std::shared_ptr<UNetExchange>
init_unetexchange(
int argc,
const char*
const argv[],
156 uniset::ObjectId shmID,
const std::shared_ptr<SharedMemory>& ic = 0,
const std::string& prefix =
"unet" );
159 static void help_print(
int argc,
const char* argv[] ) noexcept;
161 bool checkExistUNetHost(
const std::string& host,
int port ) noexcept;
163 inline std::shared_ptr<LogAgregator> getLogAggregator() noexcept
167 inline std::shared_ptr<DebugStream> log() noexcept
178 std::string s_fvalue;
180 std::shared_ptr<SMInterface> shm;
181 void step() noexcept;
186 void askSensors( UniversalIO::UIOCommand cmd );
188 void receiverEvent(
const std::shared_ptr<UNetReceiver>& r,
UNetReceiver::Event ev ) noexcept;
195 void termReceivers();
197 void initIterators() noexcept;
198 void startReceivers();
207 timeout_t initPause = { 0 };
212 timeout_t maxHeartBeat = { 10 };
213 IOController::IOStateList::iterator itHeartBeat;
216 timeout_t steptime = { 1000 };
218 std::atomic_bool activated = {
false };
219 std::atomic_bool cancelled = {
false };
220 timeout_t activateTimeout = { 20000 };
224 ReceiverInfo() noexcept: r1(
nullptr), r2(
nullptr),
226 respondInvert(
false),
231 ReceiverInfo(
const std::shared_ptr<UNetReceiver>& _r1,
const std::shared_ptr<UNetReceiver>& _r2 ) noexcept:
234 respondInvert(
false),
239 std::shared_ptr<UNetReceiver> r1;
240 std::shared_ptr<UNetReceiver> r2;
242 void step(
const std::shared_ptr<SMInterface>& shm,
const std::string& myname, std::shared_ptr<DebugStream>& log ) noexcept;
244 inline void setRespondID(
uniset::ObjectId id,
bool invert =
false ) noexcept
247 respondInvert = invert;
260 sidChannelSwitchCount = id;
263 inline void initIterators(
const std::shared_ptr<SMInterface>& shm ) noexcept
265 shm->initIterator(itLostPackets);
266 shm->initIterator(itRespond);
267 shm->initIterator(itChannelNum);
268 shm->initIterator(itChannelSwitchCount);
277 IOController::IOStateList::iterator itRespond;
278 bool respondInvert = {
false };
280 IOController::IOStateList::iterator itLostPackets;
282 IOController::IOStateList::iterator itChannelNum;
284 long channelSwitchCount = { 0 };
286 IOController::IOStateList::iterator itChannelSwitchCount;
289 typedef std::deque<ReceiverInfo> ReceiverList;
290 ReceiverList recvlist;
292 bool no_sender = {
false };
293 std::shared_ptr<UNetSender> sender;
294 std::shared_ptr<UNetSender> sender2;
296 std::shared_ptr<LogAgregator> loga;
297 std::shared_ptr<DebugStream> unetlog;
298 std::shared_ptr<LogServer> logserv;
299 std::string logserv_host = {
""};
300 int logserv_port = {0};
307 #endif // UNetExchange_H_ Пассивный таймер
Definition: PassiveTimer.h:92
static std::shared_ptr< UNetExchange > init_unetexchange(int argc, const char *const argv[], uniset::ObjectId shmID, const std::shared_ptr< SharedMemory > &ic=0, const std::string &prefix="unet")
Definition: unetexchange.cc:891
Definition: CommonEventLoop.h:14
Definition: UNetExchange.h:147
Definition: MessageType.h:170
Definition: UniSetObject.h:73
static void help_print(int argc, const char *argv[]) noexcept
Definition: unetexchange.cc:849
Definition: VMonitor.h:116
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:69
Event
Definition: UNetReceiver.h:154
virtual bool activateObject() override
Активизация объекта (переопределяется для необходимых действий после активизации)
Definition: unetexchange.cc:767
Definition: MessageType.h:126
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition: unetexchange.cc:783
Definition: MessageType.h:213
Definition: UniSetTypes_i.idl:64
long ObjectId
Definition: UniSetTypes_i.idl:30