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
...@@ -109,6 +109,7 @@ interface IOController_i : UniSetManager_i ...@@ -109,6 +109,7 @@ interface IOController_i : UniSetManager_i
unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */ unsigned long tv_nsec; /*!< время последнего изменения датчика, nanosec (clock_gettime(CLOCK_REALTIME) */
uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */ uniset::ObjectId supplier; /*!< идентификатор объекта изменившего состояние датчика */
boolean dbignore; /*!< не сохранять изменения в БД */ boolean dbignore; /*!< не сохранять изменения в БД */
uniset::ObjectId depend_sid; /*!< датчик от которого зависит данный (при blocked=true). DefaultObjectId если не зависит */
}; };
typedef sequence<SensorIOInfo> SensorInfoSeq; typedef sequence<SensorIOInfo> SensorInfoSeq;
......
...@@ -51,12 +51,14 @@ static struct option longopts[] = ...@@ -51,12 +51,14 @@ static struct option longopts[] =
{ "getCalibrate", required_argument, 0, 'y' }, { "getCalibrate", required_argument, 0, 'y' },
{ "getTimeChange", required_argument, 0, 't' }, { "getTimeChange", required_argument, 0, 't' },
{ "oinfo", required_argument, 0, 'p' }, { "oinfo", required_argument, 0, 'p' },
{ "sinfo", required_argument, 0, 'j' },
{ "apiRequest", required_argument, 0, 'a' }, { "apiRequest", required_argument, 0, 'a' },
{ "verbose", no_argument, 0, 'v' }, { "verbose", no_argument, 0, 'v' },
{ "quiet", no_argument, 0, 'q' }, { "quiet", no_argument, 0, 'q' },
{ "csv", required_argument, 0, 'z' }, { "csv", required_argument, 0, 'k' },
{ "sendText", required_argument, 0, 'm' }, { "sendText", required_argument, 0, 'm' },
{ "freezeValue", required_argument, 0, 'n' }, { "freeze", required_argument, 0, 'z' },
{ "unfreeze", required_argument, 0, 'n' },
{ NULL, 0, 0, 0 } { NULL, 0, 0, 0 }
}; };
...@@ -78,15 +80,16 @@ int getTimeChange( const string& args, UInterface& ui ); ...@@ -78,15 +80,16 @@ int getTimeChange( const string& args, UInterface& ui );
int getState( const string& args, UInterface& ui ); int getState( const string& args, UInterface& ui );
int getCalibrate( const string& args, UInterface& ui ); int getCalibrate( const string& args, UInterface& ui );
int oinfo(const string& args, UInterface& ui, const string& userparam ); int oinfo(const string& args, UInterface& ui, const string& userparam );
int sinfo(const string& args, UInterface& ui);
int apiRequest( const string& args, UInterface& ui, const string& query ); int apiRequest( const string& args, UInterface& ui, const string& query );
void sendText( const string& args, UInterface& ui, const string& txt, int mtype ); void sendText( const string& args, UInterface& ui, const string& txt, int mtype );
int freezeValue( const string& args, bool set, UInterface& ui ); int freezeValue( const string& args, bool set, UInterface& ui );
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
static void print_help(int width, const string& cmd, const string& help, const string& tab = " " ) static void print_help(int width, const string& cmd, const string& help, const string& tab = " ", const string& sep = " - " )
{ {
uniset::ios_fmt_restorer ifs(cout); uniset::ios_fmt_restorer ifs(cout);
cout.setf(ios::left, ios::adjustfield); cout.setf(ios::left, ios::adjustfield);
cout << tab << setw(width) << cmd << " - " << help; cout << tab << setw(width) << cmd << sep << help;
} }
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
static void short_usage() static void short_usage()
...@@ -98,6 +101,7 @@ static void short_usage() ...@@ -98,6 +101,7 @@ static void short_usage()
static void usage() static void usage()
{ {
cout << "\nUsage: \n\tuniset-admin [--confile configure.xml] --command [arg]\n"; cout << "\nUsage: \n\tuniset-admin [--confile configure.xml] --command [arg]\n";
cout << endl;
cout << "commands list:\n"; cout << "commands list:\n";
cout << "-----------------------------------------\n"; cout << "-----------------------------------------\n";
print_help(24, "-с|--confile file.xml ", "Используемый конфигурационный файл\n"); print_help(24, "-с|--confile file.xml ", "Используемый конфигурационный файл\n");
...@@ -112,8 +116,9 @@ static void usage() ...@@ -112,8 +116,9 @@ static void usage()
cout << endl; cout << endl;
print_help(36, "-r|--configure [FullObjName] ", "Посылка SystemMessage::ReConfiguration всем объектам (процессам) или заданному по имени (FullObjName).\n"); print_help(36, "-r|--configure [FullObjName] ", "Посылка SystemMessage::ReConfiguration всем объектам (процессам) или заданному по имени (FullObjName).\n");
print_help(36, "-l|--logrotate [FullObjName] ", "Посылка SystemMessage::LogRotate всем объектам (процессам) или заданному по имени (FullObjName).\n"); print_help(36, "-l|--logrotate [FullObjName] ", "Посылка SystemMessage::LogRotate всем объектам (процессам) или заданному по имени (FullObjName).\n");
print_help(36, "-p|--oinfo id1@node1,id2@node2,id3,... [userparam]", "Получить информацию об объектах (SimpleInfo). \n userparam - необязательный параметр передаваемый в getInfo() каждому объекту\n"); print_help(36, "-p|--oinfo id1@node1,id2@node2,id3,... [userparam]", "Получить информацию об объектах (SimpleInfo). \n");
print_help(36, "", "userparam - необязательный параметр передаваемый в getInfo() каждому объекту\n"); print_help(36, "", "userparam - необязательный параметр передаваемый в getInfo() каждому объекту\n");
print_help(36, "-j|--sinfo id1@node1,id2@node2,id3,...", "Получить информацию о датчиках.\n");
cout << endl; cout << endl;
print_help(36, "-a|--apiRequest id1@node1,id2@node2,id3,... query", "Вызов REST API для каждого объекта\n"); print_help(36, "-a|--apiRequest id1@node1,id2@node2,id3,... query", "Вызов REST API для каждого объекта\n");
print_help(36, "", "query - Запрос вида: /api/VERSION/query[?param1&param2...]\n"); print_help(36, "", "query - Запрос вида: /api/VERSION/query[?param1&param2...]\n");
...@@ -126,9 +131,15 @@ static void usage() ...@@ -126,9 +131,15 @@ static void usage()
print_help(36, "-t|--getTimeChange id1@node1,id2@node2,id3,.. ", "Получить время последнего изменения.\n"); print_help(36, "-t|--getTimeChange id1@node1,id2@node2,id3,.. ", "Получить время последнего изменения.\n");
print_help(36, "-v|--verbose", "Подробный вывод логов.\n"); print_help(36, "-v|--verbose", "Подробный вывод логов.\n");
print_help(36, "-q|--quiet", "Выводит только результат.\n"); print_help(36, "-q|--quiet", "Выводит только результат.\n");
print_help(36, "-z|--csv", "Вывести результат (getValue) в виде val1,val2,val3...\n"); print_help(36, "-k|--csv", "Вывести результат (getValue) в виде val1,val2,val3...\n");
print_help(36, "-m|--sendText id1@node1,id2@node2,id3,.. mtype text", "Послать объектам текстовое сообщение text типа mtype\n"); print_help(36, "-m|--sendText id1@node1,id2@node2,id3,.. mtype text", "Послать объектам текстовое сообщение text типа mtype\n");
print_help(36, "-n|--freezeValue id1@node1=val1,id2@node2=val2,id3=val3,.. set", "Выставить указанным датчикам соответствующие значения и заморозить их (set=true) или разморозить (set=false).\n"); print_help(36, "-z|--freeze id1@node1=val1,id2@node2=val2,id3=val3,...", "Заморозить указанные датчики и выставить соответствующие значения.\n");
print_help(36, "-n|--unfreeze id1@node1,id2@node2,id3,...", "Разаморозить указанные датчики.\n");
cout << endl;
cout << "Глобальные параметры, которые необходимо передавать через '--'" << endl;
cout << "-----------------------------------------\n";
cout << uniset::Configuration::help() << endl;
cout << "Example: uniset2-admin arg1 arg2 arg3 -- global_arg1 global_arg2 ..." << endl;
cout << endl; cout << endl;
} }
...@@ -154,7 +165,7 @@ int main(int argc, char** argv) ...@@ -154,7 +165,7 @@ int main(int argc, char** argv)
while(1) while(1)
{ {
opt = getopt_long(argc, argv, "hc:beosfur:l:i::x:g:w:y:p:vqz:a:m:", longopts, &optindex); opt = getopt_long(argc, argv, "hk:beosfur:l:i::x:g:w:y:p:vqz:a:m:n:z:j:", longopts, &optindex);
if( opt == -1 ) if( opt == -1 )
break; break;
...@@ -202,30 +213,30 @@ int main(int argc, char** argv) ...@@ -202,30 +213,30 @@ int main(int argc, char** argv)
} }
break; break;
case 'n': //--freezeValue case 'z': //--freeze
{
// смотрим второй параметр
if( checkArg(optind, argc, argv) == 0 )
{ {
if( !quiet ) std::string sensors(optarg);
cerr << "admin(freezeValue): Unknown 'set'. Use: id=v1,name=v2,name2@nodeX=v3 set" << endl; auto conf = uniset_init(argc, argv, conffile);
UInterface ui(conf);
return 1; ui.initBackId(uniset::AdminID);
return freezeValue(sensors, true, ui);
} }
break;
case 'n': //--unfreeze
{
std::string sensors(optarg); std::string sensors(optarg);
bool set = uni_atoi(argv[optind]);
auto conf = uniset_init(argc, argv, conffile); auto conf = uniset_init(argc, argv, conffile);
UInterface ui(conf); UInterface ui(conf);
ui.initBackId(uniset::AdminID); ui.initBackId(uniset::AdminID);
return freezeValue(sensors, set, ui); return freezeValue(sensors, false, ui);
} }
break; break;
case 'g': //--getValue case 'g': //--getValue
case 'z': //--csv case 'k': //--csv
{ {
if( opt == 'z' ) if( opt == 'k' )
csv = true; csv = true;
// cout<<"(main):received option --getValue='"<<optarg<<"'"<<endl; // cout<<"(main):received option --getValue='"<<optarg<<"'"<<endl;
...@@ -275,6 +286,15 @@ int main(int argc, char** argv) ...@@ -275,6 +286,15 @@ int main(int argc, char** argv)
} }
break; break;
case 'j': //--sinfo
{
auto conf = uniset_init(argc, argv, conffile);
UInterface ui(conf);
ui.initBackId(uniset::AdminID);
return sinfo(optarg, ui);
}
break;
case 'a': //--apiRequest case 'a': //--apiRequest
{ {
// смотрим второй параметр // смотрим второй параметр
...@@ -840,7 +860,7 @@ int freezeValue( const string& args, bool set, UInterface& ui ) ...@@ -840,7 +860,7 @@ int freezeValue( const string& args, bool set, UInterface& ui )
auto sl = uniset::getSInfoList(args, conf); auto sl = uniset::getSInfoList(args, conf);
if( verb ) if( verb )
cout << "====== freezeValue ======" << endl; cout << "====== " << (set ? "freeze" : "unfreeze") << " ======" << endl;
for( auto&& it : sl ) for( auto&& it : sl )
{ {
...@@ -850,7 +870,6 @@ int freezeValue( const string& args, bool set, UInterface& ui ) ...@@ -850,7 +870,6 @@ int freezeValue( const string& args, bool set, UInterface& ui )
if( verb ) if( verb )
{ {
cout << " set: " << set << endl;
cout << " value: " << it.val << endl; cout << " value: " << it.val << endl;
cout << " name: (" << it.si.id << ") " << it.fname << endl; cout << " name: (" << it.si.id << ") " << it.fname << endl;
cout << " iotype: " << t << endl; cout << " iotype: " << t << endl;
...@@ -880,14 +899,14 @@ int freezeValue( const string& args, bool set, UInterface& ui ) ...@@ -880,14 +899,14 @@ int freezeValue( const string& args, bool set, UInterface& ui )
catch( const uniset::Exception& ex ) catch( const uniset::Exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "(setValue): " << ex << endl;; cerr << (set ? "freeze: " : "unfreeze: ") << ex << endl;;
err = 1; err = 1;
} }
catch( const std::exception& ex ) catch( const std::exception& ex )
{ {
if( !quiet ) if( !quiet )
cerr << "std::exception: " << ex.what() << endl; cerr << (set ? "freeze: " : "unfreeze: ") << "std::exception: " << ex.what() << endl;
err = 1; err = 1;
} }
...@@ -1183,6 +1202,70 @@ int oinfo(const string& args, UInterface& ui, const string& userparam ) ...@@ -1183,6 +1202,70 @@ int oinfo(const string& args, UInterface& ui, const string& userparam )
return 0; return 0;
} }
// -------------------------------------------------------------------------------------- // --------------------------------------------------------------------------------------
int sinfo(const string& args, UInterface& ui )
{
int err = 0;
auto conf = uniset_conf();
auto sl = uniset::getSInfoList(args, conf);
for( auto&& it : sl )
{
try
{
// проверка есть ли такой датчик, т.к. тут будет выкинуто исключение
// если его нет
UniversalIO::IOType t = conf->getIOType(it.si.id);
if( it.si.node == DefaultObjectId )
it.si.node = conf->getLocalNode();
IOController_i::SensorIOInfo_var sinf = ui.getSensorIOInfo(it.si);
#if 0
UniversalIO::IOType type; /*!< тип */
long priority; /*!< приоритет уведомления */
long default_val; /*!< значение по умолчанию */
CalibrateInfo ci; /*!< калибровочные параметры */
#endif
const int w = 14;
print_help(w, "id", std::to_string(it.si.id) + "\n", " ", " : ");
print_help(w, "node", std::to_string(it.si.node) + "\n", " ", " : ");
print_help(w, "value", std::to_string(sinf->value) + "\n", " ", " : ");
print_help(w, "real_value", std::to_string(sinf->real_value) + "\n", " ", " : ");
print_help(w, "frozen", std::to_string(sinf->frozen) + "\n", " ", " : ");
print_help(w, "undefined", std::to_string(sinf->undefined) + "\n", " ", " : ");
print_help(w, "blocked", std::to_string(sinf->blocked) + "\n", " ", " : ");
if( sinf->depend_sid != DefaultObjectId )
print_help(w, "depend_sensor", "(" + to_string(sinf->depend_sid) + ")" + ORepHelpers::getShortName(conf->oind->getMapName(sinf->depend_sid)) + "\n", " ", " : ");
if( sinf->supplier == uniset::AdminID )
print_help(w, "supplier", "admin\n", " ", " : ");
else
print_help(w, "supplier", ORepHelpers::getShortName(conf->oind->getMapName(sinf->supplier)) + "\n", " ", " : ");
ostringstream ts;
ts << dateToString(sinf->tv_sec) << " " << timeToString(sinf->tv_sec) << "." << sinf->tv_nsec << "\n";
print_help(w, "changed", ts.str(), " ", " : ");
}
catch( const uniset::Exception& ex )
{
if( !quiet )
cerr << "(sinfo): " << ex << endl;;
err = 1;
}
catch( const std::exception& ex )
{
if( !quiet )
cerr << "(sinfo): std::exception: " << ex.what() << endl;
err = 1;
}
}
return err;
}
// --------------------------------------------------------------------------------------
int apiRequest( const string& args, UInterface& ui, const string& query ) int apiRequest( const string& args, UInterface& ui, const string& query )
{ {
auto conf = uniset_conf(); auto conf = uniset_conf();
......
...@@ -19,7 +19,9 @@ ln -s -f admin.sh help ...@@ -19,7 +19,9 @@ ln -s -f admin.sh help
ln -s -f admin.sh oinfo ln -s -f admin.sh oinfo
ln -s -f admin.sh apiRequest ln -s -f admin.sh apiRequest
ln -s -f admin.sh sendText 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-start.sh
ln -s -f ../../Utilities/scripts/uniset2-stop.sh stop.sh ln -s -f ../../Utilities/scripts/uniset2-stop.sh stop.sh
......
...@@ -8,13 +8,13 @@ using namespace uniset; ...@@ -8,13 +8,13 @@ using namespace uniset;
void help_print() void help_print()
{ {
cout << endl; cout << endl;
cout << "--confile configure.xml. По умолчанию: configure.xml." << endl;
cout << "--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)" << endl; cout << "--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)" << endl;
cout << endl; cout << endl;
cout << "--min val - Нижняя граница датчика. По умолчанию 0" << endl; cout << "--min val - Нижняя граница датчика. По умолчанию 0" << endl;
cout << "--max val - Верхняя граница датчика. По умолчанию 100 " << endl; cout << "--max val - Верхняя граница датчика. По умолчанию 100 " << endl;
cout << "--step val - Шаг датчика. По умолчанию 1" << endl; cout << "--step val - Шаг датчика. По умолчанию 1" << endl;
cout << "--pause msec - Пауза. По умолчанию 200 мсек" << endl << endl; cout << "--pause msec - Пауза. По умолчанию 200 мсек" << endl << endl;
cout << uniset::Configuration::help() << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
struct ExtInfo: struct ExtInfo:
......
...@@ -17,9 +17,9 @@ int main( int argc, const char** argv ) ...@@ -17,9 +17,9 @@ int main( int argc, const char** argv )
{ {
cout << "Usage: uniset-smonit [ args ] --sid id1@node1,Sensor2@node2,id2,sensorname3,... " << endl cout << "Usage: uniset-smonit [ args ] --sid id1@node1,Sensor2@node2,id2,sensorname3,... " << endl
<< "Args: " << 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" // << " --script scriptname \n"
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -9,6 +9,8 @@ using namespace std; ...@@ -9,6 +9,8 @@ using namespace std;
static void short_usage() static void short_usage()
{ {
cout << "Usage: uniset-sviewer-text [--fullname] [--polltime msec] [--confile uniset-confile]\n"; 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) int main(int argc, const char** argv)
...@@ -17,7 +19,7 @@ int main(int argc, const char** argv) ...@@ -17,7 +19,7 @@ int main(int argc, const char** argv)
try try
{ {
if( argc > 1 && !strcmp(argv[1], "--help") ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
short_usage(); short_usage();
return 0; return 0;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
%define oname uniset2 %define oname uniset2
Name: libuniset2 Name: libuniset2
Version: 2.9.1 Version: 2.9.2
Release: alt0.M90P.1 Release: alt0.M90P.1
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
...@@ -560,9 +560,14 @@ rm -f %buildroot%_docdir/%oname/html/*.md5 ...@@ -560,9 +560,14 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes # history of current unpublished changes
%changelog %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) - 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 * Fri Jan 08 2021 Pavel Vainerman <pv@altlinux.ru> 2.9.1-alt1
- supported http-resolver (when localIOR=1) - supported http-resolver (when localIOR=1)
......
...@@ -4,14 +4,18 @@ ...@@ -4,14 +4,18 @@
# AC_PREREQ(2.59) # AC_PREREQ(2.59)
<<<<<<< HEAD <<<<<<< HEAD
<<<<<<< HEAD
AC_INIT([uniset2], [2.8.1], pv@etersoft.ru) AC_INIT([uniset2], [2.8.1], pv@etersoft.ru)
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION) AM_INIT_AUTOMAKE(AC_PACKAGE_NAME,AC_PACKAGE_VERSION)
======= =======
AC_INIT([uniset2], [2.9.1], pv@etersoft.ru) 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 AM_INIT_AUTOMAKE
>>>>>>> 2.9.1-alt1 >>>>>>> 2.9.1-alt1
LIBVER=11:1:9 LIBVER=11:2:9
AC_SUBST(LIBVER) AC_SUBST(LIBVER)
# AC_CONFIG_MACRO_DIR([m4]) # AC_CONFIG_MACRO_DIR([m4])
......
...@@ -15,10 +15,14 @@ int main( int argc, const char** argv ) ...@@ -15,10 +15,14 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
BackendOpenTSDB::help_print(argc, argv); BackendOpenTSDB::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -14,8 +14,12 @@ int main(int argc, char** argv) ...@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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); DBServer_MySQL::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -14,8 +14,12 @@ int main(int argc, char** argv) ...@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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); DBServer_PostgreSQL::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -437,6 +437,7 @@ void DBServer_SQLite::help_print( int argc, const char* const* argv ) ...@@ -437,6 +437,7 @@ void DBServer_SQLite::help_print( int argc, const char* const* argv )
{ {
cout << "Default: prefix='sqlite'" << endl; cout << "Default: prefix='sqlite'" << endl;
cout << "--prefix-name objectID - ObjectID. Default: 'conf->getDBServer()'" << endl; cout << "--prefix-name objectID - ObjectID. Default: 'conf->getDBServer()'" << endl;
cout << endl;
cout << DBServer::help_print() << endl; cout << DBServer::help_print() << endl;
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
...@@ -14,8 +14,12 @@ int main(int argc, char** argv) ...@@ -14,8 +14,12 @@ int main(int argc, char** argv)
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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); DBServer_SQLite::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -12,7 +12,11 @@ int main(int argc, char** argv) ...@@ -12,7 +12,11 @@ int main(int argc, char** argv)
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl;
HttpResolver::help_print(); HttpResolver::help_print();
return 0; return 0;
} }
......
...@@ -29,11 +29,16 @@ int main(int argc, const char** argv) ...@@ -29,11 +29,16 @@ int main(int argc, const char** argv)
{ {
// std::ios::sync_with_stdio(false); // 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 << endl;
cout << "Usage: uniset2-iocontrol args1 args2" << endl;
cout << endl;
cout << "--io-confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl; cout << "--io-confile - Использовать указанный конф. файл. По умолчанию configure.xml" << endl;
cout << "--io-logfile fname - выводить логи в файл fname. По умолчанию iocontrol.log" << endl; cout << "--io-logfile fname - выводить логи в файл fname. По умолчанию iocontrol.log" << endl;
IOControl::help_print(argc, argv); IOControl::help_print(argc, argv);
cout << "Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -29,6 +29,18 @@ int main(int argc, const char** argv) ...@@ -29,6 +29,18 @@ int main(int argc, const char** argv)
try 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 ); auto conf = uniset_init( argc, argv );
string logfilename(conf->getArgParam("--logicproc-logfile")); string logfilename(conf->getArgParam("--logicproc-logfile"));
......
...@@ -31,11 +31,17 @@ int main(int argc, const char** argv) ...@@ -31,11 +31,17 @@ int main(int argc, const char** argv)
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
cout << endl;
cout << "Usage: uniset2-plogicproc args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl; cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl; cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << "--plproc-logfile filename - logfilename. Default: mbslave.log" << endl; cout << "--plproc-logfile filename - logfilename. Default: mbslave.log" << endl;
cout << endl; cout << endl;
PassiveLProcessor::help_print(argc, argv); PassiveLProcessor::help_print(argc, argv);
cout << endl;
cout << "Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -31,10 +31,14 @@ int main( int argc, const char** argv ) ...@@ -31,10 +31,14 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
MQTTPublisher::help_print(argc, argv); MQTTPublisher::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -15,10 +15,16 @@ int main( int argc, const char** argv ) ...@@ -15,10 +15,16 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl; cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
MBTCPMaster::help_print(argc, argv); MBTCPMaster::help_print(argc, argv);
cout << endl;
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -29,10 +29,16 @@ int main( int argc, const char** argv ) ...@@ -29,10 +29,16 @@ int main( int argc, const char** argv )
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: get from configure..." << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl; cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
MBTCPMultiMaster::help_print(argc, argv); MBTCPMultiMaster::help_print(argc, argv);
cout << endl;
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -33,10 +33,15 @@ int main(int argc, const char** argv) ...@@ -33,10 +33,15 @@ int main(int argc, const char** argv)
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl; cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
MBSlave::help_print(argc, argv); MBSlave::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -15,11 +15,15 @@ int main( int argc, const char** argv ) ...@@ -15,11 +15,15 @@ int main( int argc, const char** argv )
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) )
{ {
cout << endl;
cout << "Usage: uniset2-rrdserver args1 args2" << endl;
cout << endl;
cout << "--smemory-id objectName - SharedMemory objectID. Default: autodetect" << endl; 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 << "--rrdstorage-logfile filename - logfilename. Default: rrdstorage.log" << endl;
cout << endl; cout << endl;
RRDServer::help_print(argc, argv); RRDServer::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -13,8 +13,13 @@ int main( int argc, const char** argv ) ...@@ -13,8 +13,13 @@ int main( int argc, const char** argv )
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--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; return 0;
} }
......
...@@ -30,8 +30,11 @@ int main(int argc, const char** argv) ...@@ -30,8 +30,11 @@ int main(int argc, const char** argv)
if( argc > 1 && ( strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-h") == 0 ) ) 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); SharedMemory::help_print(argc, argv);
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -15,10 +15,14 @@ int main( int argc, const char** argv ) ...@@ -15,10 +15,14 @@ int main( int argc, const char** argv )
{ {
if( argc > 1 && (!strcmp(argv[1], "--help") || !strcmp(argv[1], "-h")) ) 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 << "--smemory-id objectName - SharedMemory objectID. Default: read from <SharedMemory>" << endl;
cout << "--confile filename - configuration file. Default: configure.xml" << endl;
cout << endl; cout << endl;
UNetExchange::help_print(argc, argv); UNetExchange::help_print(argc, argv);
cout << " Global options:" << endl;
cout << uniset::Configuration::help() << endl;
return 0; return 0;
} }
......
...@@ -274,3 +274,70 @@ TEST_CASE("UInterface::freezeValue", "[UInterface][freezeValue]") ...@@ -274,3 +274,70 @@ TEST_CASE("UInterface::freezeValue", "[UInterface][freezeValue]")
REQUIRE_NOTHROW( ui->setValue(aid, 200) ); REQUIRE_NOTHROW( ui->setValue(aid, 200) );
REQUIRE( ui->getValue(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 ...@@ -47,7 +47,7 @@ namespace uniset
public: public:
virtual ~Configuration(); virtual ~Configuration();
static std::ostream& help(std::ostream& os); static std::string help();
/*! конфигурирование xml-файлом ( предпочтительный способ ) */ /*! конфигурирование xml-файлом ( предпочтительный способ ) */
Configuration( int argc, const char* const* argv, const std::string& xmlfile = "" ); Configuration( int argc, const char* const* argv, const std::string& xmlfile = "" );
......
...@@ -230,7 +230,8 @@ namespace uniset ...@@ -230,7 +230,8 @@ namespace uniset
SensorIOInfo(long v, UniversalIO::IOType t, const IOController_i::SensorInfo& si, SensorIOInfo(long v, UniversalIO::IOType t, const IOController_i::SensorInfo& si,
uniset::Message::Priority p = uniset::Message::Medium, uniset::Message::Priority p = uniset::Message::Medium,
long defval = 0, IOController_i::CalibrateInfo* ci = 0, 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; IOController_i::SensorIOInfo ai;
ai.si = si; ai.si = si;
...@@ -241,6 +242,7 @@ namespace uniset ...@@ -241,6 +242,7 @@ namespace uniset
ai.real_value = v; ai.real_value = v;
ai.blocked = false; ai.blocked = false;
ai.supplier = sup_id; ai.supplier = sup_id;
ai.depend_sid = depend_sid;
if( ci != 0 ) if( ci != 0 )
ai.ci = *ci; ai.ci = *ci;
...@@ -337,7 +339,6 @@ namespace uniset ...@@ -337,7 +339,6 @@ namespace uniset
uniset::uniset_rwmutex undefMutex; uniset::uniset_rwmutex undefMutex;
ChangeUndefinedStateSignal sigUndefChange; ChangeUndefinedStateSignal sigUndefChange;
IOController_i::SensorInfo d_si = { uniset::DefaultObjectId, uniset::DefaultObjectId }; /*!< идентификатор датчика, от которого зависит данный */
long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */ long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */
long d_off_value = { 0 }; /*!< блокирующее значение */ long d_off_value = { 0 }; /*!< блокирующее значение */
std::shared_ptr<USensorInfo> d_usi; // shared_ptr на датчик от которого зависит этот. std::shared_ptr<USensorInfo> d_usi; // shared_ptr на датчик от которого зависит этот.
......
...@@ -79,6 +79,9 @@ namespace uniset ...@@ -79,6 +79,9 @@ namespace uniset
//! Получение состояния для списка указанных датчиков //! Получение состояния для списка указанных датчиков
IOController_i::SensorInfoSeq_var getSensorSeq( const uniset::IDList& lst ); IOController_i::SensorInfoSeq_var getSensorSeq( const uniset::IDList& lst );
//! Получение состояния информации о датчике
IOController_i::SensorIOInfo_var getSensorIOInfo( const IOController_i::SensorInfo& si );
/*! Изменения состояния списка входов/выходов /*! Изменения состояния списка входов/выходов
\return Возвращает список не найденных идентификаторов */ \return Возвращает список не найденных идентификаторов */
uniset::IDSeq_var setOutputSeq( const IOController_i::OutSeq& lst, uniset::ObjectId sup_id ); 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, ...@@ -53,23 +53,21 @@ static ostream& print_help( ostream& os, int width, const string& cmd,
return os << info.str(); return os << info.str();
} }
ostream& uniset::Configuration::help(ostream& os) std::string uniset::Configuration::help()
{ {
os << "\n UniSet Configure command: " << endl; ostringstream os;
print_help(os, 20, "--confile", "полный путь до файла конфигурации\n"); print_help(os, 25, "--confile", "Файл конфигурации. По умолчанию: configure.xml\n");
os << "\n Debug command:\n"; print_help(os, 25, "--uniport num", "использовать заданный порт (переопределяет 'port заданный в конф. файле в разделе <nodes><node.. port=''>)\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");
print_help(os, 25, "--localIOR {1,0}", "использовать локальные файлы для получения IOR (т.е. не использовать omniNames). Переопределяет параметр в конфигурационном файле.\n"); print_help(os, 25, "--localIOR {1,0}", "использовать локальные файлы для получения IOR (т.е. не использовать omniNames). Переопределяет параметр в конфигурационном файле.\n");
print_help(os, 25, "--transientIOR {1,0}", "использовать генерируемые IOR(не постоянные). Переопределяет параметр в конфигурационном файле. Default=1\n"); print_help(os, 25, "--transientIOR {1,0}", "использовать генерируемые IOR(не постоянные). Переопределяет параметр в конфигурационном файле. Default=0\n");
return os << "\nПример использования:\t myUniSetProgram " os << "\ndebug logs:\n";
<< "--ulog-add-levels level1,info,system,warn --ulog-logfile myprogrpam.log\n\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 namespace uniset
......
...@@ -2236,6 +2236,82 @@ 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 ) uniset::IDSeq_var UInterface::setOutputSeq( const IOController_i::OutSeq& lst, uniset::ObjectId sup_id )
{ {
if( lst.length() == 0 ) if( lst.length() == 0 )
......
...@@ -220,9 +220,9 @@ namespace uniset ...@@ -220,9 +220,9 @@ namespace uniset
if( !d_txt.empty() ) 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; ostringstream err;
err << "(IOConfig_XML::getSensorInfo): sensor='" err << "(IOConfig_XML::getSensorInfo): sensor='"
...@@ -233,8 +233,6 @@ namespace uniset ...@@ -233,8 +233,6 @@ namespace uniset
throw SystemError(err.str()); throw SystemError(err.str());
} }
inf->d_si.node = conf->getLocalNode();
// по умолчанию срабатывание на "1" // по умолчанию срабатывание на "1"
inf->d_value = it.getProp("depend_value").empty() ? 1 : it.getIntProp("depend_value"); inf->d_value = it.getProp("depend_value").empty() ? 1 : it.getIntProp("depend_value");
inf->d_off_value = it.getPIntProp("depend_off_value", 0); inf->d_off_value = it.getPIntProp("depend_off_value", 0);
...@@ -250,15 +248,15 @@ namespace uniset ...@@ -250,15 +248,15 @@ namespace uniset
// обновляем итераторы... // обновляем итераторы...
it.second->d_usi = it.second; it.second->d_usi = it.second;
if( it.second->d_si.id == DefaultObjectId ) if( it.second->depend_sid == DefaultObjectId )
continue; continue;
uinfo << "(IOConfig_XML::init_depends_signals): " uinfo << "(IOConfig_XML::init_depends_signals): "
<< " init depend: '" << conf->oind->getMapName(it.second->si.id) << "'" << " 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; << endl;
auto dit = lst.find(it.second->d_si.id); auto dit = lst.find(it.second->depend_sid);
if( dit != lst.end() ) if( dit != lst.end() )
{ {
......
...@@ -113,9 +113,9 @@ void IOController::activateInit() ...@@ -113,9 +113,9 @@ void IOController::activateInit()
auto s = io.second; 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() ) if( d_it != myioEnd() )
s->checkDepend( d_it->second, this); s->checkDepend( d_it->second, this);
...@@ -675,8 +675,7 @@ IOController::USensorInfo::operator=(IOController_i::SensorIOInfo& r) ...@@ -675,8 +675,7 @@ IOController::USensorInfo::operator=(IOController_i::SensorIOInfo& r)
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
IOController::USensorInfo::USensorInfo(): d_value(1), d_off_value(0) IOController::USensorInfo::USensorInfo(): d_value(1), d_off_value(0)
{ {
d_si.id = uniset::DefaultObjectId; depend_sid = uniset::DefaultObjectId;
d_si.node = uniset::DefaultObjectId;
default_val = 0; default_val = 0;
value = default_val; value = default_val;
real_value = default_val; real_value = default_val;
...@@ -1083,6 +1082,16 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr ...@@ -1083,6 +1082,16 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr
jsens->set("default_val", s->default_val); jsens->set("default_val", s->default_val);
jsens->set("dbignore", s->dbignore); jsens->set("dbignore", s->dbignore);
jsens->set("nchanges", s->nchanges); 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"); Poco::JSON::Object::Ptr calibr = uniset::json::make_child(jsens, "calibration");
calibr->set("cmin", s->ci.minCal); calibr->set("cmin", s->ci.minCal);
...@@ -1094,7 +1103,6 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr ...@@ -1094,7 +1103,6 @@ void IOController::getSensorInfo( Poco::JSON::Array::Ptr& jdata, std::shared_ptr
// ::CORBA::Boolean undefined; // ::CORBA::Boolean undefined;
// ::CORBA::Boolean blocked; // ::CORBA::Boolean blocked;
// ::CORBA::Long priority; // ::CORBA::Long priority;
// IOController_i::SensorInfo d_si = { uniset::DefaultObjectId, uniset::DefaultObjectId }; /*!< идентификатор датчика, от которого зависит данный */
// long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */ // long d_value = { 1 }; /*!< разрешающее работу значение датчика от которого зависит данный */
// long d_off_value = { 0 }; /*!< блокирующее значение */ // 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