git-svn-id: svn://db.shs.com.ru/libs@97 a8b55f48-bf90-11e4-a774-851b48703e85

This commit is contained in:
2016-07-12 22:13:15 +00:00
parent 91718711c9
commit f14a58cf19
6 changed files with 163 additions and 46 deletions

70
cd_utils/cdutils_core.cpp Normal file
View File

@@ -0,0 +1,70 @@
#include "cdutils_core.h"
using namespace CDUtils;
static const char connection_config[] =
"include = ip.conf\n\
[connection]\n\
device.c = eth://UDP:127.0.0.1:36102:127.0.0.1:36101 #s\n\
device.c.disconnectTimeout = 3.00000000 #f\n\
device.k = eth://UDP:127.0.0.1:26102:127.0.0.1:26101 #s\n\
device.k.disconnectTimeout = 3.00000000 #f\n\
device.x = eth://UDP:127.0.0.1:16102:127.0.0.1:16101 #s\n\
device.x.disconnectTimeout = 3.00000000 #f\n\
device.c_eth = eth://UDP:${ip_kx}:36102:${ip_kxpult}:36101 #s\n\
device.c_eth.disconnectTimeout = 3.00000000 #f\n\
device.k_eth = eth://UDP:${ip_kx}:26102:${ip_kxpult}:26101 #s\n\
device.k_eth.disconnectTimeout = 3.00000000 #f\n\
device.x_eth = eth://UDP:${ip_kx}:16102:${ip_kxpult}:16101 #s\n\
device.x_eth.disconnectTimeout = 3.00000000 #f\n\
channel.0.from = c_eth #s\n\
channel.0.to = c #s\n\
channel.1.from = k_eth #s\n\
channel.1.to = k #s\n\
channel.2.from = x_eth #s\n\
channel.2.to = x #s\n\
[]\n\
connectionmodel = AAAWNHja7ZbfShtBFMa/Xf9UrYLSXnqhErxrdSNYKBRXEMQbEVGhBBRJgob4J6SxSZBC38ELb32UBR/AV/ARfAP9MjmzyQ7TGGkaGzeznMycmTNnZn/zLRkAH5HGOc74ZNkqIac8YBhwLlk7tEHUi1trP7KwHqCN+AhLLeYHpqC7HEeFqbLygJal3XHfPjxE2/kX69UxYK32en62vnqwIXvJwOr7m1JLvPZZ3tGmBR0ErSNYXY20gbuPvxl/eSaKuxxY/RC/xPfxdwb/3u8o7u+w+iF+ie/j7wj+IBXFH+zD6mvcOr7L+PXW3xz+nIH7KLD6If4c+urvIP6qgb96Y/VD/NW/xa/W5rj7SeImg2Jg5nRlji7M4dwJk1U9jzaOAz4lVFHgHUuOsjEHo9IXnrceXJe+cbXQGQ5xak3wgTYG9ZPnSlmudWykuo7sJ8OYn7zppa3pDnS6PUn1FQt8dnkYW2wncMmpBYblUcEv9iSxDA+LrM3RAi5wwhzNUZ6xtW+Rtzzl9TPTGtOAkSAlCeZpc5yc48cQvdPusK+G7pzbKVlST6gT90ciX9Rgk8TnZdIYyigyWUntEGrHRbYPkWkIq0k0CfSCaCqvIRqvLdF48RONX7jvBdGkX0M0S22JZik2opk1RaP/Ev8gmttOimalTdG816fsElE0xdULxJLSabatYvEoii/4zGOvm2fIpdV4jISi7zH/uVDy3RVK8hmhJGMolAR6QSiV7grFe0YoMbivPAGq7YwD"
;
int __Core_Initializer__::count_(0);
Core * __Core_Initializer__::__instance__(0);
__Core_Initializer__::__Core_Initializer__() {
count_++;
if (count_ > 1) return;
//piCout << "create PIInit";
__instance__ = new Core();
}
__Core_Initializer__::~__Core_Initializer__() {
count_--;
if (count_ > 1) return;
//piCout << "delete PIInit";
if (__instance__ != 0) {
delete __instance__;
__instance__ = 0;
}
}
Core::Core() {
CONNECTU(&connection, dataReceivedEvent, this, dataReceived);
PIString s(connection_config);
connection.configureFromString(&s);
connection.start();
}
void CDUtils::Core::dataReceived(const PIString & from, const PIByteArray & data) {
piCout << from << data;
}
void Core::K_Send() {
}