Commit a2213d77 authored by Pavel Vainerman's avatar Pavel Vainerman

backported to p9 as 2.9.2-alt0.M90P.1 (with rpmbph script)

parents 754a7b5e a71da3b9
......@@ -105,10 +105,11 @@ interface IOController_i : UniSetManager_i
IOController_i::SensorInfo si;
long default_val; /*!< значение по умолчанию */
CalibrateInfo ci; /*!< калибровочные параметры */
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
unsigned long tv_sec; /*!< время последнего изменения датчика, секунды (clock_gettime(CLOCK_REALTIME) */
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
boolean dbignore; /*!< не сохранять изменения в БД */
uniset::ObjectId depend_sid; /*!< датчик от которого зависит данный (при blocked=true). DefaultObjectId если не зависит */
};
typedef sequence<SensorIOInfo> SensorInfoSeq;
......
......@@ -19,7 +19,9 @@ ln -s -f admin.sh help
ln -s -f admin.sh oinfo
ln -s -f admin.sh apiRequest
ln -s -f admin.sh sendText
ln -s -f admin.sh freezeValue
ln -s -f admin.sh freeze
ln -s -f admin.sh unfreeze
ln -s -f admin.sh sinfo
ln -s -f ../../Utilities/scripts/uniset2-start.sh
ln -s -f ../../Utilities/scripts/uniset2-stop.sh stop.sh
......
......@@ -8,13 +8,13 @@ using namespace uniset;
void help_print()
{
cout << endl;
cout << "--confile configure.xml. По умолчанию: configure.xml." << endl;
cout << "--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)" << endl;
cout << endl;
cout << "--min val - Нижняя граница датчика. По умолчанию 0" << endl;
cout << "--max val - Верхняя граница датчика. По умолчанию 100 " << endl;
cout << "--step val - Шаг датчика. По умолчанию 1" << endl;
cout << "--pause msec - Пауза. По умолчанию 200 мсек" << endl << endl;
cout << uniset::Configuration::help() << endl;
}
// -----------------------------------------------------------------------------
struct ExtInfo:
......
......@@ -17,9 +17,9 @@ int main( int argc, const char** argv )
{
cout << "Usage: uniset-smonit [ args ] --sid id1@node1,Sensor2@node2,id2,sensorname3,... " << endl
<< "Args: " << endl
<< " --confile confilename - Default: configure.xml" << endl
<< " --name XXX - name for smonit. Default: TestProc" << endl;
<< "--name XXX - name for smonit. Default: TestProc" << endl;
// << " --script scriptname \n"
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -9,6 +9,8 @@ using namespace std;
static void short_usage()
{
cout << "Usage: uniset-sviewer-text [--fullname] [--polltime msec] [--confile uniset-confile]\n";
cout << endl;
cout << uniset::Configuration::help() << endl;
}
// --------------------------------------------------------------------------
int main(int argc, const char** argv)
......@@ -17,7 +19,7 @@ int main(int argc, const char** argv)
try
{
if( argc > 1 && !strcmp(argv[1], "--help") )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
short_usage();
return 0;
......
......@@ -26,7 +26,7 @@
%define oname uniset2
Name: libuniset2
Version: 2.9.1
Version: 2.9.2
Release: alt0.M90P.1
Summary: UniSet - library for building distributed industrial control systems
......@@ -560,9 +560,14 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes
%changelog
* Fri Jan 08 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.1-alt0.M90P.1
* Sat Jan 09 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.2-alt0.M90P.1
- backport to ALTLinux p9 (by rpmbph script)
* Sat Jan 09 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.2-alt1
- admin: added 'sinfo' function
- admin: freezeValue -> freeze/unfreeze
- globally updated help
* Fri Jan 08 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.1-alt1
- supported http-resolver (when localIOR=1)
......
......@@ -4,14 +4,18 @@
# AC_PREREQ(2.59)
<<<<<<< HEAD
<<<<<<< HEAD
AC_INIT([uniset2], [2.8.1], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
=======
AC_INIT([uniset2], [2.9.1], pv@etersoft.ru)
=======
AC_INIT([uniset2], [2.9.2], pv@etersoft.ru)
>>>>>>> 2.9.2-alt1
AM_INIT_AUTOMAKE
>>>>>>> 2.9.1-alt1
LIBVER=11:1:9
LIBVER=11:2:9
AC_SUBST(LIBVER)
# AC_CONFIG_MACRO_DIR([m4])
......
......@@ -15,10 +15,14 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-opentsdb-dbserver --confile configure.xml args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
BackendOpenTSDB::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
cout << "Usage: uniset2-mysql-dbserver --confile configure.xml args1 args2" << endl;
cout << endl;
DBServer_MySQL::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
cout << "Usage: uniset2-pgsql-dbserver --confile configure.xml args1 args2" << endl;
cout << endl;
DBServer_PostgreSQL::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -437,6 +437,7 @@ void DBServer_SQLite::help_print( int argc, const char* const* argv )
{
cout << "Default: prefix='sqlite'" << endl;
cout << "--prefix-name objectID - ObjectID. Default: 'conf->getDBServer()'" << endl;
cout << endl;
cout << DBServer::help_print() << endl;
}
// -----------------------------------------------------------------------------
......
......@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
cout << "Usage: uniset2-sqlite-dbserver --confile configure.xml args1 args2" << endl;
cout << endl;
DBServer_SQLite::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -12,7 +12,11 @@ int main(int argc, char** argv)
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-httpresolver args1 args2" << endl;
cout << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
HttpResolver::help_print();
return 0;
}
......
......@@ -29,11 +29,16 @@ int main(int argc, const char** argv)
{
// std::ios::sync_with_stdio(false);
if( argc > 1 && strcmp(argv[1], "--help") == 0 )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--io-confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
cout << "--io-logfile fname - выводить логи в файл fname. По умолчанию iocontrol.log" << endl;
cout << endl;
cout << "Usage: uniset2-iocontrol args1 args2" << endl;
cout << endl;
cout << "--io-confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
cout << "--io-logfile fname - выводить логи в файл fname. По умолчанию iocontrol.log" << endl;
IOControl::help_print(argc, argv);
cout << "Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -12,7 +12,7 @@ int main(int argc, char** argv)
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
LogDB::help_print();
return 0;
}
......
......@@ -29,6 +29,18 @@ int main(int argc, const char** argv)
try
{
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
cout << endl;
cout << "Usage: uniset2-logicproc args1 args2" << endl;
cout << endl;
cout << "--sleepTime msec - Время между шагам рассчёта. По умолчанию: 200 милисек" << endl;
cout << "--sm-ready-timeout msec - Максимальное время ожидания готовности SharedMemory к работе, перед началом работы. По умолчанию: 2 минуты" << endl;
cout << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
auto conf = uniset_init( argc, argv );
string logfilename(conf->getArgParam("--logicproc-logfile"));
......
......@@ -31,11 +31,17 @@ 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 << "--plproc-logfile filename - logfilename. Default: mbslave.log" << endl;
cout << endl;
cout << "Usage: uniset2-plogicproc args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--plproc-logfile filename - logfilename. Default: mbslave.log" << endl;
cout << endl;
PassiveLProcessor::help_print(argc, argv);
cout << endl;
cout << "Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -31,10 +31,14 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-mqttpulisher --confile configure.xml args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
MQTTPublisher::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -15,10 +15,16 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-mbtcpmaster args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
MBTCPMaster::help_print(argc, argv);
cout << endl;
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -29,10 +29,16 @@ int main( int argc, const char** argv )
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-mbtcpmultimaster args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: get from configure..." << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
MBTCPMultiMaster::help_print(argc, argv);
cout << endl;
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -33,10 +33,15 @@ int main(int argc, const char** argv)
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-mbslave args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
MBSlave::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -15,11 +15,15 @@ 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 << "--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log" << endl;
cout << endl;
cout << "Usage: uniset2-rrdserver args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log" << endl;
cout << endl;
RRDServer::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -13,8 +13,13 @@ int main( int argc, const char** argv )
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-smviewer --confile configure.xml args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: read from <SharedMemory>" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
cout << "Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -30,8 +30,11 @@ int main(int argc, const char** argv)
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) )
{
cout << "--confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
cout << endl;
cout << "Usage: uniset2-smemory args1 args2" << endl;
cout << endl;
SharedMemory::help_print(argc, argv);
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -15,10 +15,14 @@ int main( int argc, const char** argv )
{
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{
cout << endl;
cout << "Usage: uniset2-unetexchange --confile configure.xml args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: read from <SharedMemory>" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
UNetExchange::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0;
}
......
......@@ -274,3 +274,70 @@ TEST_CASE("UInterface::freezeValue", "[UInterface][freezeValue]")
REQUIRE_NOTHROW( ui->setValue(aid, 200) );
REQUIRE( ui->getValue(aid) == 200 );
}
// -----------------------------------------------------------------------------
TEST_CASE("UInterface::getSensorIOInfo", "[UInterface][getSensorIOInfo]")
{
init();
auto conf = uniset_conf();
IOController_i::SensorInfo si;
si.id = aid;
si.node = conf->getLocalNode();
REQUIRE_NOTHROW( ui->setValue(si, 200, testOID) );
REQUIRE( ui->getValue(aid) == 200 );
REQUIRE_NOTHROW( ui->getSensorIOInfo(si) );
auto inf = ui->getSensorIOInfo(si);
REQUIRE( inf->supplier == testOID );
REQUIRE( inf->value == 200 );
REQUIRE( inf->real_value == 200 );
REQUIRE( inf->blocked == false );
REQUIRE( inf->frozen == false );
REQUIRE( inf->undefined == false );
REQUIRE( inf->tv_sec > 0 );
REQUIRE( inf->dbignore == false );
REQUIRE( inf->depend_sid == DefaultObjectId );
// freeze/unfreeze
REQUIRE_NOTHROW( ui->freezeValue(si, true, 10, testOID) );
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->frozen == true );
REQUIRE( inf->supplier == testOID );
REQUIRE_NOTHROW( ui->freezeValue(si, false, 10, testOID) );
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->frozen == false );
REQUIRE( inf->supplier == testOID );
// undef
REQUIRE_NOTHROW( ui->setUndefinedState( si, true, testOID ));
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->undefined == true );
REQUIRE( inf->supplier == testOID );
REQUIRE_NOTHROW( ui->setUndefinedState( si, false, testOID ));
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->undefined == false );
REQUIRE( inf->supplier == testOID );
// depend
si.id = 100;
REQUIRE_NOTHROW( ui->setValue(si, 0, testOID) );
si.id = 101;
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->blocked == true );
REQUIRE( inf->depend_sid == 100 );
si.id = 100;
REQUIRE_NOTHROW( ui->setValue(si, 10, testOID) );
si.id = 101;
inf = ui->getSensorIOInfo(si);
REQUIRE( inf->blocked == false );
REQUIRE( inf->depend_sid == 100 );
}
......@@ -47,7 +47,7 @@ namespace uniset
public:
virtual ~Configuration();
static std::ostream& help(std::ostream& os);
static std::string help();
/*! конфигурирование xml-файлом ( предпочтительный способ ) */
Configuration( int argc, const char* const* argv, const std::string& xmlfile = "" );
......
......@@ -230,7 +230,8 @@ namespace uniset
SensorIOInfo(long v, UniversalIO::IOType t, const IOController_i::SensorInfo& si,
uniset::Message::Priority p = uniset::Message::Medium,
long defval = 0, IOController_i::CalibrateInfo* ci = 0,
uniset::ObjectId sup_id = uniset::DefaultObjectId )
uniset::ObjectId sup_id = uniset::DefaultObjectId,
uniset::ObjectId depend_sid = uniset::DefaultObjectId )
{
IOController_i::SensorIOInfo ai;
ai.si = si;
......@@ -241,6 +242,7 @@ namespace uniset
ai.real_value = v;
ai.blocked = false;
ai.supplier = sup_id;
ai.depend_sid = depend_sid;
if( ci != 0 )
ai.ci = *ci;
......@@ -337,7 +339,6 @@ namespace uniset
uniset::uniset_rwmutex undefMutex;
ChangeUndefinedStateSignal sigUndefChange;
IOController_i::SensorInfo d_si = { uniset::DefaultObjectId, uniset::DefaultObjectId }; /*!< идентификатор датчика, от которого зависит данный */
long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value = { 0 }; /*!< блокирующее значение */
std::shared_ptr<USensorInfo> d_usi; // shared_ptr на датчик от которого зависит этот.
......
......@@ -79,6 +79,9 @@ namespace uniset
//! Получение состояния для списка указанных датчиков
IOController_i::SensorInfoSeq_var getSensorSeq( const uniset::IDList& lst );
//! Получение состояния информации о датчике
IOController_i::SensorIOInfo_var getSensorIOInfo( const IOController_i::SensorInfo& si );
/*! Изменения состояния списка входов/выходов
\return Возвращает список не найденных идентификаторов */
uniset::IDSeq_var setOutputSeq( const IOController_i::OutSeq& lst, uniset::ObjectId sup_id );
......
......@@ -53,23 +53,21 @@ static ostream& print_help( ostream& os, int width, const string& cmd,
return os << info.str();
}
ostream& uniset::Configuration::help(ostream& os)
std::string uniset::Configuration::help()
{
os << "\n UniSet Configure command: " << endl;
print_help(os, 20, "--confile", "полный путь до файла конфигурации\n");
os << "\n Debug command:\n";
print_help(os, 25, " [debname]", "имя DebugStream указанное в конфигурационном файле\n");
print_help(os, 25, "--[debname]-no-debug", "отключение логов\n");
print_help(os, 25, "--[debname]-logfile", "перенаправление лога в файл\n");
print_help(os, 25, "--[debname]-add-levels", "добавить уровень вывода логов\n");
print_help(os, 25, "--[debname]-del-levels", "удалить уровень вывода логов\n");
print_help(os, 25, "--[debname]-show-microseconds", "Выводить время с микросекундами\n");
print_help(os, 25, "--[debname]-show-milliseconds", "Выводить время с миллисекундами\n");
print_help(os, 25, "--uniport num", "использовать заданный порт (переопределяет 'defaultport', заданный в конф. файле в разделе <nodes>)\n");
ostringstream os;
print_help(os, 25, "--confile", "Файл конфигурации. По умолчанию: configure.xml\n");
print_help(os, 25, "--uniport num", "использовать заданный порт (переопределяет 'port заданный в конф. файле в разделе <nodes><node.. port=''>)\n");
print_help(os, 25, "--localIOR {1,0}", "использовать локальные файлы для получения IOR (т.е. не использовать omniNames). Переопределяет параметр в конфигурационном файле.\n");
print_help(os, 25, "--transientIOR {1,0}", "использовать генерируемые IOR(не постоянные). Переопределяет параметр в конфигурационном файле. Default=1\n");
return os << "\nПример использования:\t myUniSetProgram "
<< "--ulog-add-levels level1,info,system,warn --ulog-logfile myprogrpam.log\n\n";
print_help(os, 25, "--transientIOR {1,0}", "использовать генерируемые IOR(не постоянные). Переопределяет параметр в конфигурационном файле. Default=0\n");
os << "\ndebug logs:\n";
print_help(os, 25, "--ulog-add-levels", "добавить уровень вывода логов\n");
print_help(os, 25, "--ulog-del-levels", "удалить уровень вывода логов\n");
print_help(os, 25, "--ulog-show-microseconds", "Выводить время с микросекундами\n");
print_help(os, 25, "--ulog-show-milliseconds", "Выводить время с миллисекундами\n");
print_help(os, 25, "--ulog-no-debug", "отключение логов\n");
print_help(os, 25, "--ulog-logfile", "перенаправление лога в файл\n");
return os.str();
}
// -------------------------------------------------------------------------
namespace uniset
......
......@@ -2236,6 +2236,82 @@ namespace uniset
}
// --------------------------------------------------------------------------------------------
IOController_i::SensorIOInfo_var UInterface::getSensorIOInfo( const IOController_i::SensorInfo& si )
{
if ( si.id == uniset::DefaultObjectId )
throw uniset::ORepFailed("UI(getSensorIOInfo): error node=uniset::DefaultObjectId");
if ( si.node == uniset::DefaultObjectId )
throw uniset::ORepFailed("UI(getSensorIOInfo): попытка обратиться к объекту с id=uniset::DefaultObjectId");
try
{
CORBA::Object_var oref;
try
{
oref = rcache.resolve(si.id, si.node);
}
catch( const uniset::NameNotFound& ) {}
for( size_t i = 0; i < uconf->getRepeatCount(); i++)
{
try
{
if( CORBA::is_nil(oref) )
oref = resolve(si.id, si.node);
IOController_i_var iom = IOController_i::_narrow(oref);
return iom->getSensorIOInfo(si.id);
}
catch( const CORBA::TRANSIENT& ) {}
catch( const CORBA::OBJECT_NOT_EXIST& ) {}
catch( const CORBA::SystemException& ex ) {}
msleep(uconf->getRepeatTimeout());
oref = CORBA::Object::_nil();
}
}
catch( const uniset::TimeOut& ) {}
catch(const IOController_i::NameNotFound& ex)
{
rcache.erase(si.id, si.node);
throw uniset::NameNotFound("UI(getSensorIOInfo): " + string(ex.err));
}
catch(const IOController_i::IOBadParam& ex)
{
rcache.erase(si.id, si.node);
throw uniset::IOBadParam("UI(getSensorIOInfo): " + string(ex.err));
}
catch(const uniset::ORepFailed& )
{
rcache.erase(si.id, si.node);
// не смогли получить ссылку на объект
throw uniset::IOBadParam(set_err("UI(getSensorIOInfo): resolve failed ", si.id, si.node));
}
catch(const CORBA::NO_IMPLEMENT& )
{
rcache.erase(si.id, si.node);
throw uniset::IOBadParam(set_err("UI(getSensorIOInfo): method no implement", si.id, si.node));
}
catch( const CORBA::OBJECT_NOT_EXIST& )
{
rcache.erase(si.id, si.node);
throw uniset::IOBadParam(set_err("UI(getSensorIOInfo): object not exist", si.id, si.node));
}
catch( const CORBA::COMM_FAILURE& ex )
{
// ошибка системы коммуникации
}
catch( const CORBA::SystemException& ex )
{
// ошибка системы коммуникации
}
rcache.erase(si.id, si.node);
throw uniset::TimeOut(set_err("UI(getSensorIOInfo): Timeout", si.id, si.node));
}
// --------------------------------------------------------------------------------------------
uniset::IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, uniset::ObjectId sup_id )
{
if( lst.length() == 0 )
......
......@@ -220,9 +220,9 @@ namespace uniset
if( !d_txt.empty() )
{
inf->d_si.id = conf->getSensorID(d_txt);
inf->depend_sid = conf->getSensorID(d_txt);
if( inf->d_si.id == uniset::DefaultObjectId )
if( inf->depend_sid == uniset::DefaultObjectId )
{
ostringstream err;
err << "(IOConfig_XML::getSensorInfo): sensor='"
......@@ -233,8 +233,6 @@ namespace uniset
throw SystemError(err.str());
}
inf->d_si.node = conf->getLocalNode();
// по умолчанию срабатывание на "1"
inf->d_value = it.getProp("depend_value").empty() ? 1 : it.getIntProp("depend_value");
inf->d_off_value = it.getPIntProp("depend_off_value", 0);
......@@ -250,15 +248,15 @@ namespace uniset
// обновляем итераторы...
it.second->d_usi = it.second;
if( it.second->d_si.id == DefaultObjectId )
if( it.second->depend_sid == DefaultObjectId )
continue;
uinfo << "(IOConfig_XML::init_depends_signals): "
<< " init depend: '" << conf->oind->getMapName(it.second->si.id) << "'"
<< " dep_name=(" << it.second->d_si.id << ")'" << conf->oind->getMapName(it.second->d_si.id) << "'"
<< " depend_sensor=(" << it.second->depend_sid << ")'" << conf->oind->getMapName(it.second->depend_sid) << "'"
<< endl;
auto dit = lst.find(it.second->d_si.id);
auto dit = lst.find(it.second->depend_sid);
if( dit != lst.end() )
{
......
......@@ -113,9 +113,9 @@ void IOController::activateInit()
auto s = io.second;
// Проверка зависимостей
if( s->d_si.id != DefaultObjectId )
if( s->depend_sid != DefaultObjectId )
{
auto d_it = myiofind(s->d_si.id);
auto d_it = myiofind(s->depend_sid);
if( d_it != myioEnd() )
s->checkDepend( d_it->second, this);
......@@ -675,8 +675,7 @@ IOController::USensorInfo::operator=(IOController_i::SensorIOInfo& r)
// ----------------------------------------------------------------------------------------
IOController::USensorInfo::USensorInfo(): d_value(1), d_off_value(0)
{
d_si.id = uniset::DefaultObjectId;
d_si.node = uniset::DefaultObjectId;
depend_sid = uniset::DefaultObjectId;
default_val = 0;
value = default_val;
real_value = default_val;
......@@ -1083,6 +1082,16 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr
jsens->set("default_val", s->default_val);
jsens->set("dbignore", s->dbignore);
jsens->set("nchanges", s->nchanges);
jsens->set("undefined", s->undefined);
jsens->set("frozen", s->frozen);
jsens->set("blocked", s->blocked);
if( s->depend_sid != DefaultObjectId )
{
jsens->set("depend_sensor", ORepHelpers::getShortName(uniset_conf()->oind->getMapName(s->depend_sid)));
jsens->set("depend_sensor_id", s->depend_sid);
jsens->set("depend_value", s->d_value);
jsens->set("depend_off_value", s->d_off_value);
}
Poco::JSON::Object::Ptr calibr = uniset::json::make_child(jsens, "calibration");
calibr->set("cmin", s->ci.minCal);
......@@ -1094,7 +1103,6 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr
// ::CORBA::Boolean undefined;
// ::CORBA::Boolean blocked;
// ::CORBA::Long priority;
// IOController_i::SensorInfo d_si = { uniset::DefaultObjectId, uniset::DefaultObjectId }; /*!< идентификатор датчика, от которого зависит данный */
// long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */
// long d_off_value = { 0 }; /*!< блокирующее значение */
}
......
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