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 ) 148 static std::shared_ptr<UNetExchange>
init_unetexchange(
int argc,
const char*
const argv[],
149 uniset::ObjectId shmID,
const std::shared_ptr<SharedMemory>& ic = 0,
const std::string& prefix =
"unet" );
152 static void help_print(
int argc,
const char* argv[] ) noexcept;
154 bool checkExistUNetHost(
const std::string& host,
int port ) noexcept;
156 inline std::shared_ptr<LogAgregator> getLogAggregator() noexcept
160 inline std::shared_ptr<DebugStream> log() noexcept
171 std::string s_fvalue;
173 std::shared_ptr<SMInterface> shm;
174 void step() noexcept;
179 void askSensors( UniversalIO::UIOCommand cmd );
181 void receiverEvent(
const std::shared_ptr<UNetReceiver>& r,
UNetReceiver::Event ev ) noexcept;
188 void termReceivers();
190 void initIterators() noexcept;
191 void startReceivers();
200 timeout_t initPause = { 0 };
205 timeout_t maxHeartBeat = { 10 };
206 IOController::IOStateList::iterator itHeartBeat;
209 timeout_t steptime = { 1000 };
211 std::atomic_bool activated = {
false };
212 std::atomic_bool cancelled = {
false };
213 timeout_t activateTimeout = { 20000 };
217 ReceiverInfo() noexcept: r1(
nullptr), r2(
nullptr),
219 respondInvert(
false),
224 ReceiverInfo(
const std::shared_ptr<UNetReceiver>& _r1,
const std::shared_ptr<UNetReceiver>& _r2 ) noexcept:
227 respondInvert(
false),
232 std::shared_ptr<UNetReceiver> r1;
233 std::shared_ptr<UNetReceiver> r2;
235 void step(
const std::shared_ptr<SMInterface>& shm,
const std::string& myname, std::shared_ptr<DebugStream>& log ) noexcept;
237 inline void setRespondID(
uniset::ObjectId id,
bool invert =
false ) noexcept
240 respondInvert = invert;
253 sidChannelSwitchCount = id;
256 inline void initIterators(
const std::shared_ptr<SMInterface>& shm ) noexcept
258 shm->initIterator(itLostPackets);
259 shm->initIterator(itRespond);
260 shm->initIterator(itChannelNum);
261 shm->initIterator(itChannelSwitchCount);
270 IOController::IOStateList::iterator itRespond;
271 bool respondInvert = {
false };
273 IOController::IOStateList::iterator itLostPackets;
275 IOController::IOStateList::iterator itChannelNum;
277 long channelSwitchCount = { 0 };
279 IOController::IOStateList::iterator itChannelSwitchCount;
282 typedef std::deque<ReceiverInfo> ReceiverList;
283 ReceiverList recvlist;
285 bool no_sender = {
false };
286 std::shared_ptr<UNetSender> sender;
287 std::shared_ptr<UNetSender> sender2;
289 std::shared_ptr<LogAgregator> loga;
290 std::shared_ptr<DebugStream> unetlog;
291 std::shared_ptr<LogServer> logserv;
292 std::string logserv_host = {
""};
293 int logserv_port = {0};
300 #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:887
Definition: CommonEventLoop.h:14
Definition: UNetExchange.h:140
Definition: MessageType.h:170
Definition: UniSetObject.h:73
static void help_print(int argc, const char *argv[]) noexcept
Definition: unetexchange.cc:845
Definition: VMonitor.h:116
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:69
Event
Definition: UNetReceiver.h:154
virtual bool activateObject() override
Активизация объекта (переопределяется для необходимых действий после активизации)
Definition: unetexchange.cc:763
Definition: MessageType.h:126
virtual bool deactivateObject() override
Деактивация объекта (переопределяется для необходимых действий при завершении работы)
Definition: unetexchange.cc:779
Definition: MessageType.h:213
Definition: UniSetTypes_i.idl:64
long ObjectId
Definition: UniSetTypes_i.idl:30