24 #include <unordered_map>
25 #include "UniSetObject.h"
28 #include "SMInterface.h"
29 #include "SharedMemory.h"
30 #include "ThreadCreator.h"
31 #include "UDPPacket.h"
32 #include "UNetTransport.h"
66 UNetSender( std::unique_ptr<UNetSendTransport>&& transport,
const std::shared_ptr<SMInterface>& smi
67 ,
bool nocheckConnection =
false
68 ,
const std::string& s_field =
""
69 ,
const std::string& s_fvalue =
""
70 ,
const std::string& prop_prefix =
"unet"
71 ,
const std::string& prefix =
"unet"
72 ,
size_t maxDCount = UniSetUDP::MaxDCount
73 ,
size_t maxACount = UniSetUDP::MaxACount );
77 typedef size_t sendfactor_t;
79 static const long not_specified_value = { std::numeric_limits<long>::max() };
84 iotype(UniversalIO::UnknownIOType),
90 UniversalIO::IOType iotype;
92 IOController::IOStateList::iterator ioit;
95 sendfactor_t pack_sendfactor = { 0 };
96 long undefined_value = { not_specified_value };
97 friend std::ostream& operator<<( std::ostream& os,
UItem& p );
100 typedef std::unordered_map<uniset::ObjectId, UItem> UItemMap;
102 size_t getDataPackCount() const noexcept;
107 void send() noexcept;
131 inline void setSendPause(
int msec ) noexcept
135 inline void setPackSendPause(
int msec ) noexcept
137 packsendpause = msec;
139 inline void setPackSendPauseFactor(
int factor ) noexcept
141 packsendpauseFactor = factor;
144 void setCheckConnectionPause(
int msec ) noexcept;
147 void askSensors( UniversalIO::UIOCommand cmd );
152 inline std::shared_ptr<
DebugStream> getLog() noexcept
157 std::string getShortInfo() const noexcept;
159 inline
size_t getADataSize() const noexcept
163 inline size_t getDDataSize() const noexcept
170 std::string s_field = {
"" };
171 std::string s_fvalue = {
"" };
172 std::string prop_prefix = {
"" };
174 const std::shared_ptr<SMInterface> shm;
175 std::shared_ptr<DebugStream> unetlog;
177 bool initItem( UniXML::iterator& it );
178 bool readItem(
const std::shared_ptr<UniXML>& xml, UniXML::iterator& it, xmlNode* sec );
180 void readConfiguration();
182 bool createConnection(
bool throwEx );
187 std::unique_ptr<UNetSendTransport> transport;
189 std::string myname = {
"" };
190 timeout_t sendpause = { 150 };
191 timeout_t packsendpause = { 5 };
192 int packsendpauseFactor = { 1 };
193 timeout_t writeTimeout = { 1000 };
194 std::atomic_bool activated = {
false };
195 PassiveTimer ptCheckConnection;
197 typedef std::unordered_map<sendfactor_t, std::vector<PackMessage>> Packs;
203 std::unordered_map<sendfactor_t, size_t> packs_anum;
204 std::unordered_map<sendfactor_t, size_t> packs_dnum;
206 size_t packetnum = { 1 };
208 size_t maxAData = { UniSetUDP::MaxACount };
209 size_t maxDData = { UniSetUDP::MaxDCount };
211 std::unique_ptr< ThreadCreator<UNetSender> > s_thr;
213 size_t ncycle = { 0 };
Definition: DebugStream.h:62
Definition: UNetSender.h:64
void initIterators() noexcept
Definition: UNetSender.cc:514
void updateSensor(uniset::ObjectId id, long value)
Definition: UNetSender.cc:160
void updateFromSM()
Definition: UNetSender.cc:133
void updateItem(const UItem &it, long value)
Definition: UNetSender.cc:171
void askSensors(UniversalIO::UIOCommand cmd)
Definition: UNetSender.cc:520
Definition: CommonEventLoop.h:15
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:70
long ObjectId
Definition: UniSetTypes_i.idl:30
Definition: UNetSender.h:110
Definition: UNetSender.h:82
Definition: UDPPacket.h:88