23 #include <unordered_map> 24 #include "UniSetObject.h" 27 #include "SMInterface.h" 28 #include "SharedMemory.h" 29 #include "ThreadCreator.h" 31 #include "UDPPacket.h" 71 UNetSender(
const std::string& host,
const int port,
const std::shared_ptr<SMInterface>& smi,
bool nocheckConnection =
false,
72 const std::string& s_field =
"",
const std::string& s_fvalue =
"",
const std::string& prefix =
"unet",
73 size_t maxDCount = UniSetUDP::MaxDCount,
size_t maxACount = UniSetUDP::MaxACount );
77 typedef size_t sendfactor_t;
82 iotype(UniversalIO::UnknownIOType),
88 UniversalIO::IOType iotype;
90 IOController::IOStateList::iterator ioit;
93 sendfactor_t pack_sendfactor = { 0 };
94 friend std::ostream& operator<<( std::ostream& os,
UItem& p );
97 typedef std::unordered_map<uniset::ObjectId, UItem> UItemMap;
99 size_t getDataPackCount()
const;
104 void send() noexcept;
128 inline void setSendPause(
int msec )
132 inline void setPackSendPause(
int msec )
134 packsendpause = msec;
137 void setCheckConnectionPause(
int msec );
140 void askSensors( UniversalIO::UIOCommand cmd );
145 inline std::shared_ptr<DebugStream> getLog()
150 virtual const std::string getShortInfo()
const;
152 inline std::string getAddress()
const 156 inline int getPort()
const 161 inline size_t getADataSize()
const 165 inline size_t getDDataSize()
const 172 std::string s_field = {
"" };
173 std::string s_fvalue = {
"" };
174 std::string prefix = {
"" };
176 const std::shared_ptr<SMInterface> shm;
177 std::shared_ptr<DebugStream> unetlog;
180 bool readItem(
const std::shared_ptr<UniXML>& xml,
UniXML::iterator& it, xmlNode* sec );
182 void readConfiguration();
184 bool createConnection(
bool throwEx );
189 std::unique_ptr<UDPSocketU> udp;
192 std::string s_host = {
"" };
193 Poco::Net::SocketAddress saddr;
195 std::string myname = {
"" };
196 timeout_t sendpause = { 150 };
197 timeout_t packsendpause = { 5 };
198 timeout_t writeTimeout = { 1000 };
199 std::atomic_bool activated = {
false };
202 typedef std::unordered_map<sendfactor_t, std::vector<PackMessage>> Packs;
207 std::unordered_map<sendfactor_t, size_t> packs_anum;
208 std::unordered_map<sendfactor_t, size_t> packs_dnum;
210 size_t packetnum = { 1 };
211 uint16_t lastcrc = { 0 };
214 size_t maxAData = { UniSetUDP::MaxACount };
215 size_t maxDData = { UniSetUDP::MaxDCount };
217 std::unique_ptr< ThreadCreator<UNetSender> > s_thr;
219 size_t ncycle = { 0 };
225 #endif // UNetSender_H_ Пассивный таймер
Definition: PassiveTimer.h:92
Definition: CallbackTimer.h:29
Definition: UNetSender.h:79
Definition: UNetSender.h:68
void askSensors(UniversalIO::UIOCommand cmd)
Definition: UNetSender.cc:516
void updateSensor(uniset::ObjectId id, long value)
Definition: UNetSender.cc:160
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:69
Definition: UDPPacket.h:93
Definition: UDPPacket.h:83
void updateFromSM()
Definition: UNetSender.cc:150
Definition: UNetSender.h:106
void updateItem(UItem &it, long value)
Definition: UNetSender.cc:171
void initIterators()
Definition: UNetSender.cc:510
long ObjectId
Definition: UniSetTypes_i.idl:30