Commit c6d644a4 authored by Pavel Vainerman's avatar Pavel Vainerman

Удалил DEPRECATED компоненты: SharedMemoryPlus и SMDBServer

parent 15fb7938
......@@ -424,7 +424,6 @@ rm -f %buildroot%_libdir/*.la
%_bindir/%oname-smviewer
%_bindir/%oname-network
%_bindir/%oname-unet*
#%_bindir/%oname-smdbserver
%_libdir/libUniSet2Extensions.so.*
%_libdir/libUniSet2MB*.so.*
......@@ -432,7 +431,6 @@ rm -f %buildroot%_libdir/*.la
%_libdir/libUniSet2Shared*.so.*
%_libdir/libUniSet2Network*.so.*
%_libdir/libUniSet2UNetUDP*.so.*
#%_libdir/libUniSet2SMDBServer*.so.*
%files extension-smplus
%_bindir/%oname-smemory-plus
......@@ -493,7 +491,6 @@ rm -f %buildroot%_libdir/*.la
%_libdir/libUniSet2Shared*.so
%_libdir/libUniSet2Network.so
%_libdir/libUniSet2UNetUDP.so
#%_libdir/libUniSet2SMDBServer.so
%_pkgconfigdir/libUniSet2Extensions.pc
%_pkgconfigdir/libUniSet2MB*.pc
%_pkgconfigdir/libUniSet2RT*.pc
......@@ -501,11 +498,14 @@ rm -f %buildroot%_libdir/*.la
%_pkgconfigdir/libUniSet2Network*.pc
%_pkgconfigdir/libUniSet2UNet*.pc
#%_pkgconfigdir/libUniSet2SMDBServer.pc
#%_pkgconfigdir/libUniSet2*.pc
%exclude %_pkgconfigdir/libUniSet2.pc
# history of current unpublished changes
# - change directory structure
# - shared_ptr --> unique_ptr
# - minor refactoring
# - remote deprecated components
%changelog
* Sun Nov 12 2017 Alexei Takaseev <taf@altlinux.org> 2.6-alt41.1
......
......@@ -490,7 +490,6 @@ AC_CONFIG_FILES([Makefile
extensions/SharedMemory/Makefile
extensions/SharedMemory/tests/Makefile
extensions/SharedMemory/libUniSet2SharedMemory.pc
extensions/SharedMemoryPlus/Makefile
extensions/RRDServer/Makefile
extensions/RRDServer/libUniSet2RRDServer.pc
extensions/MQTTPublisher/Makefile
......@@ -508,7 +507,3 @@ AC_CONFIG_FILES([Makefile
AC_OUTPUT
# extensions/SMDBServer/Makefile
# extensions/SMDBServer/libUniSet2SMDBServer.pc
......@@ -6,10 +6,7 @@ if HAVE_EXTENTIONS
SUBDIRS = lib include SharedMemory SharedMemory/tests IOControl LogicProcessor LogicProcessor/tests \
ModbusMaster ModbusSlave SMViewer UniNetwork UNetUDP UNetUDP/tests \
DBServer-MySQL DBServer-SQLite DBServer-PostgreSQL MQTTPublisher \
RRDServer SharedMemoryPlus tests ModbusMaster/tests ModbusSlave/tests
#SMDBServer
#SharedMemoryPlus
RRDServer tests ModbusMaster/tests ModbusSlave/tests
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSet2Extensions.pc
......
bin_PROGRAMS = @PACKAGE@-smdbserver
USMDB_VER=@LIBVER@
lib_LTLIBRARIES = libUniSet2SMDBServer.la
libUniSet2SMDBServer_la_LDFLAGS = -version-info $(USMDB_VER)
libUniSet2SMDBServer_la_LIBADD = $(top_builddir)/lib/libUniSet2.la \
$(top_builddir)/extensions/SharedMemory/libUniSet2SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet2Extensions.la \
$(top_builddir)/Utilities/DBServer-MySQL/libUniSet2-mysql.la \
$(SIGC_LIBS)
libUniSet2SMDBServer_la_CXXFLAGS = -I$(top_builddir)/extensions/include \
-I$(top_builddir)/extensions/SharedMemory \
-I$(top_builddir)/Utilities/DBServer-MySQL \
$(SIGC_CFLAGS)
libUniSet2SMDBServer_la_SOURCES = SMDBServer.cc
@PACKAGE@_smdbserver_SOURCES = main.cc
@PACKAGE@_smdbserver_LDADD = libUniSet2SMDBServer.la $(top_builddir)/lib/libUniSet2.la \
$(top_builddir)/extensions/SharedMemory/libUniSet2SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet2Extensions.la \
$(top_builddir)/Utilities/DBServer-MySQL/libUniSet2-mysql.la \
$(SIGC_LIBS)
@PACKAGE@_smdbserver_CXXFLAGS = -I$(top_builddir)/extensions/include \
-I$(top_builddir)/extensions/SharedMemory \
-I$(top_builddir)/Utilities/DBServer-MySQL \
$(SIGC_CFLAGS)
# install
devel_include_HEADERS = *.h
devel_includedir = $(pkgincludedir)/extensions
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libUniSet2SMDBServer.pc
#all-local:
# ln -sf ../SMDBServer/$(devel_include_HEADERS) ../include
include $(top_builddir)/include.mk
/*
* Copyright (c) 2015 Pavel Vainerman.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// -------------------------------------------------------------------------
#include <cmath>
#include <sstream>
#include <Exceptions.h>
#include <extensions/Extensions.h>
#include "SMDBServer.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
SMDBServer::SMDBServer( uniset::ObjectId objId, uniset::ObjectId shmId, SharedMemory* ic,
const string& prefix ):
DBServer_MySQL(objId),
aiignore(false),
prefix(prefix)
{
if( objId == DefaultObjectId )
throw uniset::SystemError("(SMDBServer): objId=-1?!! Use --" + prefix + "-name" );
// xmlNode* cnode = conf->getNode(myname);
// if( cnode == NULL )
// throw uniset::SystemError("(SMDBServer): Not found conf-node for " + myname );
xmlNode* cnode = conf->getNode("LocalDBServer");
if( !cnode )
throw NameNotFound(string(myname + "(init): <LocalDBServer> not found.."));
shm = new SMInterface(shmId, &ui, objId, ic);
UniXML::iterator it(cnode);
db_locale = conf->getArgParam("--" + prefix + "-locale", it.getProp("locale"));
if( db_locale.empty() )
db_locale = "utf8";
// ********** HEARTBEAT *************
string heart = conf->getArgParam("--" + prefix + "-heartbeat-id", it.getProp("heartbeat_id"));
if( !heart.empty() )
{
sidHeartBeat = conf->getSensorID(heart);
if( sidHeartBeat == DefaultObjectId )
{
ostringstream err;
err << myname << ": ID not found ('HeartBeat') for " << heart;
dcrit << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
int heartbeatTime = getHeartBeatTime();
if( heartbeatTime )
ptHeartBeat.setTiming(heartbeatTime);
else
ptHeartBeat.setTiming(UniSetTimer::WaitUpTime);
maxHeartBeat = conf->getArgPInt("--" + prefix + "-heartbeat-max", it.getProp("heartbeat_max"), 10);
test_id = sidHeartBeat;
}
else
{
test_id = conf->getSensorID("TestMode_S");
if( test_id == DefaultObjectId )
{
ostringstream err;
err << myname << "(init): test_id unknown. 'TestMode_S' not found...";
dcrit << myname << "(init): " << err.str() << endl;
throw SystemError(err.str());
}
}
dinfo << myname << "(init): test_id=" << test_id << endl;
}
// -----------------------------------------------------------------------------
SMDBServer::~SMDBServer()
{
delete shm;
}
// -----------------------------------------------------------------------------
void SMDBServer::waitSMReady()
{
// waiting for SM is ready...
int ready_timeout = conf->getArgInt("--" + prefix + "-sm-ready-timeout", "120000");
if( ready_timeout == 0 )
ready_timeout = 120000;
else if( ready_timeout < 0 )
ready_timeout = UniSetTimer::WaitUpTime;
if( !shm->waitSMready(ready_timeout, 50) )
{
ostringstream err;
err << myname << "(waitSMReady): Wait SharedMemory failed. [ " << ready_timeout << " msec ]";
dcrit << err.str() << endl;
//throw SystemError(err.str());
std::terminate();
}
}
// -----------------------------------------------------------------------------
void SMDBServer::step()
{
// DBServer_MySQL::step();
if( sidHeartBeat != DefaultObjectId && ptHeartBeat.checkTime() )
{
try
{
shm->localSaveValue(aitHeartBeat, sidHeartBeat, maxHeartBeat, getId());
ptHeartBeat.reset();
}
catch( const uniset::Exception& ex )
{
dcrit << myname << "(step): (hb) " << ex << std::endl;
}
}
}
//--------------------------------------------------------------------------------
void SMDBServer::initDB( DBInterface* db )
{
{
std::ostringstream q;
q << "SET NAMES " << db_locale;
db->query(q.str());
}
{
std::ostringstream q;
q << "SET CHARACTER SET " << db_locale;
db->query(q.str());
}
try
{
xmlNode* snode = conf->getXMLSensorsSection();
if(!snode)
{
dcrit << myname << ": section <sensors> not found.." << endl;
return;
}
UniXML::iterator it(snode);
if( !it.goChildren() )
{
dcrit << myname << ": section <sensors> empty?!.." << endl;
return;
}
for(; it.getCurrent(); it.goNext() )
{
// ??. DBTABLE ObjectsMap
std::ostringstream data;
data << " VALUES('"; // ???? ???????
data << it.getProp("textname") << "','"; // name
data << it.getProp("name") << "','"; // rep_name
data << it.getProp("id") << "','"; // id (sensorid)
data << it.getIntProp("msg") << "')"; // msg [0:1]
if( !writeToBase("INSERT IGNORE INTO ObjectsMap(name,rep_name,id,msg)" + data.str()) )
{
dcrit << myname << "(insert) ObjectsMap msg error: " << db->error() << std::endl;
db->freeResult();
}
}
}
catch( const uniset::Exception& ex )
{
dcrit << myname << "(filling ObjectsMap): " << ex << std::endl;
}
catch( ... )
{
dcrit << myname << "(filling ObjectsMap): catch ..." << std::endl;
}
}
//--------------------------------------------------------------------------------
void SMDBServer::help_print( int argc, const char* const* argv )
{
cout << "--dbserver-name - ID for dbserver. Default: SMDBServer1. " << endl;
cout << "--dbserver-locale name - DB locale. Default: koi8-r. " << endl;
cout << "--dbserver-heartbeat-id name - ID for heartbeat sensor." << endl;
cout << "--dbserver-heartbeat-max val - max value for heartbeat sensor." << endl;
}
// -----------------------------------------------------------------------------
SMDBServer* SMDBServer::init_smdbserver( int argc, const char* const* argv,
uniset::ObjectId icID, SharedMemory* ic,
const std::string& prefix )
{
string name = conf->getArgParam("--" + prefix + "-name", "DBServer");
if( name.empty() )
{
cerr << "(SMDBServer): Unknown name'" << endl;
return 0;
}
ObjectId ID = conf->getServiceID(name);
if( ID == uniset::DefaultObjectId )
{
cerr << "(SMDBServer): Not found ID for '" << name
<< " in '" << conf->getServicesSection() << "' section" << endl;
return 0;
}
dinfo << "(SMDBServer): name = " << name << "(" << ID << ")" << endl;
return new SMDBServer(ID, icID, ic, prefix);
}
// -----------------------------------------------------------------------------
#ifndef _SMDBServer_H_
#define _SMDBServer_H_
// -----------------------------------------------------------------------------
#include "DBServer_MySQL.h"
#include "SMInterface.h"
#include "SharedMemory.h"
// -----------------------------------------------------------------------------
/*!
*/
class SMDBServer:
public DBServer_MySQL
{
public:
SMDBServer( uniset::ObjectId objId, uniset::ObjectId shmID, SharedMemory* ic = 0,
const std::string& prefix = "dbserver" );
virtual ~SMDBServer();
/*! глобальная функция для инициализации объекта */
static SMDBServer* init_smdbserver( int argc, const char* const* argv,
uniset::ObjectId shmID, SharedMemory* ic = 0,
const std::string& prefix = "dbserver" );
/*! глобальная функция для вывода help-а */
static void help_print( int argc, const char* const* argv );
protected:
SMDBServer();
virtual void initDB(DBInterface* db);
void waitSMReady();
void step();
SMInterface* shm;
private:
bool aiignore;
PassiveTimer ptHeartBeat;
uniset::ObjectId sidHeartBeat;
int maxHeartBeat;
IOController::IOStateList::iterator aitHeartBeat;
uniset::ObjectId test_id;
std::string db_locale;
std::string prefix;
};
// -----------------------------------------------------------------------------
#endif // _SMDBServer_H_
// -----------------------------------------------------------------------------
#!/bin/sh
ln -s -f ../../Utilities/scripts/uniset2-start.sh
ln -s -f ../../Utilities/scripts/uniset2-stop.sh stop.sh
ln -s -f ../../Utilities/scripts/uniset2-functions.sh
ln -s -f ../../conf/test.xml test.xml
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libUniSet2SMDBServer
Description: Support library for UniSetSMDBServer
Requires: libUniSet2Extensions
Version: @VERSION@
Libs: -L${libdir} -lUniSet2SMDBServer
Cflags: -I${includedir}/@PACKAGE@
#include <sstream>
#include "SMDBServer.h"
#include "Configuration.h"
#include "Debug.h"
#include "UniSetActivator.h"
#include "Extensions.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace uniset;
using namespace uniset::extensions;
// -----------------------------------------------------------------------------
int main( int argc, const char** argv )
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--smdbserver-logfile filename - logfilename. Default: smdbserver.log" << endl;
cout << endl;
SMDBServer::help_print(argc, argv);
return 0;
}
try
{
auto conf = uniset_init( argc, argv, confile );
string logfilename(conf->getArgParam("--smdbserver-logfile"));
if( logfilename.empty() )
logfilename = "smdbserver.log";
std::ostringstream logname;
string dir(conf->getLogDir());
logname << dir << logfilename;
ulog.logFile( logname.str() );
dlog.logFile( logname.str() );
ObjectId shmID = DefaultObjectId;
string sID = conf->getArgParam("--smemory-id");
if( !sID.empty() )
shmID = conf->getControllerID(sID);
else
shmID = getSharedMemoryID();
if( shmID == DefaultObjectId )
{
cerr << sID << "? SharedMemoryID not found in " << conf->getControllersSection() << " section" << endl;
return 1;
}
auto db = SMDBServer::init_smdbserver(argc, argv, shmID);
if( !db )
{
dcrit << "(smdbserver): init не прошёл..." << endl;
return 1;
}
auto act = UniSetActivator::Instance();
act->add(db);
SystemMessage sm(SystemMessage::StartUp);
act->broadcast( sm.transport_msg() );
ulog << "\n\n\n";
ulog << "(main): -------------- SMDBServer START -------------------------\n\n";
dlog << "\n\n\n";
dlog << "(main): -------------- SMDBServer START -------------------------\n\n";
act->run(false);
return 0;
}
catch( const uniset::Exception& ex )
{
dcrit << "(smdbserver): " << ex << std::endl;
}
catch(...)
{
dcrit << "(smdbserver): catch ..." << std::endl;
}
return 1;
}
#!/bin/sh
uniset2-start.sh -f ./uniset2-smdbserver --confile test.xml \
--dbserver-name DBServer \
--dlog-add-levels info,crit,warn
if ENABLE_IO
IO_LIBS=$(top_builddir)/extensions/IOControl/libUniSet2IOControl.la
IO_CFLAGS=-I$(top_builddir)/extensions/IOControl -DUNISET_ENABLE_IO
else
IO_LIBS=
IO_CFLAGS=
endif
bin_PROGRAMS = @PACKAGE@-smemory-plus
@PACKAGE@_smemory_plus_LDADD = $(top_builddir)/lib/libUniSet2.la \
$(top_builddir)/extensions/UNetUDP/libUniSet2UNetUDP.la \
$(top_builddir)/extensions/ModbusMaster/libUniSet2MBTCPMaster.la \
$(top_builddir)/extensions/ModbusMaster/libUniSet2RTU.la \
$(top_builddir)/extensions/ModbusSlave/libUniSet2MBSlave.la \
$(top_builddir)/extensions/SharedMemory/libUniSet2SharedMemory.la \
$(top_builddir)/extensions/lib/libUniSet2Extensions.la \
$(IO_LIBS) \
$(SIGC_LIBS) $(POCO_LIBS)
@PACKAGE@_smemory_plus_CXXFLAGS = \
-I$(top_builddir)/extensions/UNetUDP \
-I$(top_builddir)/extensions/ModbusMaster \
-I$(top_builddir)/extensions/ModbusSlave \
-I$(top_builddir)/extensions/SharedMemory \
-I$(top_builddir)/extensions/include \
$(IO_CFLAGS) \
$(SIGC_CFLAGS) $(POCO_CFLAGS)
@PACKAGE@_smemory_plus_SOURCES = smemory-plus.cc
include $(top_builddir)/include.mk
/*
* Copyright (c) 2015 Pavel Vainerman.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// -------------------------------------------------------------------------
#include <string>
#include <error.h>
#include <errno.h>
#include <memory>
#include <Debug.h>
#include <UniSetActivator.h>
#include <ThreadCreator.h>
#include "Extensions.h"
#include "RTUExchange.h"
#include "MBSlave.h"
#include "MBTCPMaster.h"
#include "SharedMemory.h"
//#include "UniExchange.h"
#include "UNetExchange.h"
#include "Configuration.h"
#ifdef UNISET_ENABLE_IO
#include "IOControl.h"
#endif
#include "LogAgregator.h"
#include "LogServer.h"
// --------------------------------------------------------------------------
using namespace std;
using namespace uniset;
using namespace uniset::extensions;
// --------------------------------------------------------------------------
const unsigned int MaxAddNum = 10;
// --------------------------------------------------------------------------
static void help_print( int argc, const char* argv[] );
#ifdef UNISET_ENABLE_IO
std::list< ThreadCreator<IOControl>* > lst_iothr;
#endif
// --------------------------------------------------------------------------
int main( int argc, const char** argv )
{
// std::ios::sync_with_stdio(false);
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
help_print( argc, argv );
return 0;
}
try
{
auto conf = uniset_init(argc, argv);
auto act = UniSetActivator::Instance();
//act->signal_terminate_event().connect( &activator_terminate );
// ------------ SharedMemory ----------------
auto shm = SharedMemory::init_smemory(argc, argv);
if( !shm )
return 1;
act->add(shm);
#ifdef UNISET_ENABLE_IO
// ------------ IOControl ----------------
// std::list< ThreadCreator<IOControl>* > lst_iothr;
for( unsigned int i = 0; i < MaxAddNum; i++ )
{
stringstream s;
s << "--add-io";
if( i > 0 ) s << i;
bool add_io = findArgParam(s.str(), argc, argv) != -1;
if( add_io )
{
stringstream p;
p << "io";
if( i > 0 ) p << i;
dinfo << "(smemory-plus): add IOControl(" << p.str() << ")" << endl;
auto ic = IOControl::init_iocontrol(argc, argv, shm->getId(), shm, p.str());
if( !ic )
return 1;
act->add(ic);
}
}
#endif
// ------------- RTU Exchange --------------
for( unsigned int i = 0; i < MaxAddNum; i++ )
{
stringstream s;
s << "--add-rtu";
if( i > 0 ) s << i;
bool add_rtu = findArgParam(s.str(), argc, argv) != -1;
if( add_rtu )
{
stringstream p;
p << "rtu";
if( i > 0 ) p << i;
dinfo << "(smemory-plus): add RTUExchange(" << p.str() << ")" << endl;
auto rtu = RTUExchange::init_rtuexchange(argc, argv, shm->getId(), shm, p.str());
if( !rtu )
return 1;
act->add(rtu);
}
}
// ------------- MBSlave --------------
for( unsigned int i = 0; i < MaxAddNum; i++ )
{
stringstream s;
s << "--add-mbslave";
if( i > 0 ) s << i;
bool add_mbslave = findArgParam(s.str(), argc, argv) != -1;
if( add_mbslave )
{
stringstream p;
p << "mbs";
if( i > 0 ) p << i;
dinfo << "(smemory-plus): add MBSlave(" << p.str() << ")" << endl;
auto mbs = MBSlave::init_mbslave(argc, argv, shm->getId(), shm, p.str());
if( !mbs )
return 1;
act->add(mbs);
}
}
// ------------- MBTCPMaster --------------
for( unsigned int i = 0; i < MaxAddNum; i++ )
{
stringstream s;
s << "--add-mbmaster";
if( i > 0 ) s << i;
bool add_mbmaster = findArgParam(s.str(), argc, argv) != -1;
if( add_mbmaster )
{
stringstream p;
p << "mbtcp";
if( i > 0 ) p << i;
dinfo << "(smemory-plus): add MBTCPMaster(" << p.str() << ")" << endl;
auto mbm1 = MBTCPMaster::init_mbmaster(argc, argv, shm->getId(), shm, p.str());
if( !mbm1 )
return 1;
act->add(mbm1);
}
}
// ------------- UNetUDP --------------
bool add_unet = findArgParam("--add-unet", argc, argv) != -1;
if( add_unet )
{
auto unet = UNetExchange::init_unetexchange(argc, argv, shm->getId(), shm);
if( unet == NULL )
return 1;
dinfo << "(smemory-plus): add UNetExchnage.." << endl;
act->add(unet);
}
// ---------------------------------------
// попытка решить вопрос с "зомби" процессами
signal( SIGCHLD, on_sigchild );
// ---------------------------------------
SystemMessage sm(SystemMessage::StartUp);
act->broadcast( sm.transport_msg() );
#ifdef UNISET_IO_ENABLE
for( auto& i : lst_iothr )
i->start();
#endif
act->run(false);
on_sigchild(SIGTERM);
return 0;
}
catch( const uniset::Exception& ex )
{
dcrit << "(smemory-plus): " << ex << endl;
}
catch( const CORBA::SystemException& ex )
{
dcrit << "(smemory-plus): " << ex.NP_minorString() << endl;
}
catch(...)
{
dcrit << "(smemory-plus): catch(...)" << endl;
}
on_sigchild(SIGTERM);
return 1;
}
// --------------------------------------------------------------------------
void help_print( int argc, const char* argv[] )
{
const int mnum = MaxAddNum - 1;
cout << "--add-io[1..." << mnum << "] - Start IOControl" << endl;
cout << "--add-rtu[1..." << mnum << "] - Start RTUExchange (rtu master)" << endl;
cout << "--add-mbslave[1..." << mnum << "] - Start ModbusSlave (RTU or TCP)" << endl;
cout << "--add-mbmaster[1..." << mnum << "] - Start MBTCPMaster" << endl;
cout << "--add-unet - Start UNetExchange (UNetUDP)" << endl;
cout << endl << "###### SM options ######" << endl;
SharedMemory::help_print(argc, argv);
#ifdef UNISET_IO_ENABLE
cout << endl << "###### IO options ###### (prefix: --ioX)" << endl;
IOControl::help_print(argc, argv);
#endif
cout << endl << "###### RTU options ###### (prefix: --rtuX)" << endl;
RTUExchange::help_print(argc, argv);
cout << endl << "###### ModbusSlave options (prefix: --mbsX) ######" << endl;
MBSlave::help_print(argc, argv);
cout << endl << "###### ModbusTCP Master options (prefix: --mbtcpX) ######" << endl;
MBTCPMaster::help_print(argc, argv);
cout << endl << "###### UNetExchange options ######" << endl;
UNetExchange::help_print(argc, argv);
cout << endl << "###### Common options ######" << endl;
cout << "--confile - Use confile. Default: configure.xml" << endl;
cout << "--logfile - Use logfile. Default: smemory-plus.log" << endl;
}
// -----------------------------------------------------------------------------
#!/bin/sh
ulimit -Sc 10000000
START=uniset2-start.sh
MBMS=""
for n in `seq 1 10`; do
p=`echo "2050+$n" | bc`
MBMS="$MBMS --add-mbmultislave$n --mbms$n-name MBMultiSlave$n --mbms$n-confnode MBMultiSlave1 --mbms$n-type TCP --mbms$n-inet-addr 127.0.0.1 --mbms$n-inet-port $p --mbms$n-reg-from-id 1 --mbms$n-my-addr 0x01"
done
MBS=""
for n in `seq 1 5`; do
p=`echo "2090+$n" | bc`
MBS="$MBS --add-mbslave$n --mbs$n-name MBSlave$n --mbs$n-confnode MBMultiSlave1 --mbs$n-type TCP --mbs$n-inet-addr 127.0.0.1 --mbs$n-inet-port $p --mbs$n-reg-from-id 1 --mbs$n-my-addr 0x01"
done
${START} -f ./uniset2-smemory-plus --smemory-id SharedMemory --confile test.xml \
--io-name IOControl \
--io-polltime 100 \
--io-s-filter-field io \
--io-s-filter-value 1 \
--iodev1 /dev/null \
--iodev2 /dev/null \
--io-test-lamp RS_Test9_S \
--io-heartbeat-id AI_AS \
--io-sm-ready-test-sid RS_Test9_S \
--add-mbmaster \
--mbtcp-name MBMaster1 \
--mbtcp-filter-field rs \
--mbtcp-filter-value 1 \
--mbtcp-gateway-iaddr localhost \
--mbtcp-gateway-port 2048 \
--mbtcp-recv-timeout 200 \
--mbtcp-force-out 1 \
--add-mbmaster2 \
--mbtcp2-name MBMaster2 \
--mbtcp2-confnode MBMaster1 \
--mbtcp2-filter-field rs \
--mbtcp2-filter-value 1 \
--mbtcp2-gateway-iaddr localhost \
--mbtcp2-gateway-port 2049 \
--mbtcp2-recv-timeout 200 \
--mbtcp2-force-out 1 \
$MBMS \
$MBS \
--ulog-add-levels system \
--add-unet \
--unet-name UNetExchange --unet-run-logserver \
--unet-filter-field rs --unet-filter-value 2 --unet-maxdifferense 40 --unet-sendpause 1000 \
$*
# --add-rtu \
# --rs-dev /dev/cbsideA1 \
# --rs-id RTUExchange \
# --add-mbslave \
../../Utilities/scripts/uniset2-stop.sh
\ No newline at end of file
../../conf/test.xml
\ No newline at end of file
......@@ -175,14 +175,6 @@ extensions/SharedMemory/tests/TestObject.cc
extensions/SharedMemory/tests/TestObject.h
extensions/SharedMemory/tests/testobject.src.xml
extensions/SharedMemory/tests/sm-configure.xml
extensions/SharedMemoryPlus/Makefile.am
extensions/SharedMemoryPlus/smemory-plus.cc
extensions/SharedMemoryPlus/test.xml
extensions/SMDBServer/libUniSet2SMDBServer.pc.in
extensions/SMDBServer/main.cc
extensions/SMDBServer/Makefile.am
extensions/SMDBServer/SMDBServer.cc
extensions/SMDBServer/SMDBServer.h
extensions/SMViewer/main.cc
extensions/SMViewer/Makefile.am
extensions/SMViewer/SMViewer.cc
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment