Commit d4039801 authored by Pavel Vainerman's avatar Pavel Vainerman

Сделал у uniset-smonitor новый формат задаваемого списка датчиков

(как у admin) --sid s1@node1,id2@node2,..
parent 12cfee59
...@@ -13,7 +13,7 @@ int main( int argc, const char **argv ) ...@@ -13,7 +13,7 @@ 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 << "Usage: uniset-smonit [ args ] --sid id1,id2,id2,... " cout << "Usage: uniset-smonit [ args ] --sid id1@node1,Sensor2@node2,id2,sensorname3,... "
// << " --script scriptname \n" // << " --script scriptname \n"
<< " --confile configure.xml \n"; << " --confile configure.xml \n";
return 0; return 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Name: libuniset Name: libuniset
Version: 0.99 Version: 0.99
Release: eter21 Release: eter22
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
License: GPL License: GPL
Group: Development/C++ Group: Development/C++
...@@ -14,8 +14,8 @@ Packager: Pavel Vainerman <pv@altlinux.ru> ...@@ -14,8 +14,8 @@ Packager: Pavel Vainerman <pv@altlinux.ru>
Source: /var/ftp/pvt/Etersoft/Ourside/unstable/sources/tarball/%name-%version.tar Source: /var/ftp/pvt/Etersoft/Ourside/unstable/sources/tarball/%name-%version.tar
# manually removed: glibc-devel-static # manually removed: glibc-devel-static
# Automatically added by buildreq on Tue Jul 14 2009 # Automatically added by buildreq on Fri Nov 26 2010
BuildRequires: glibc-devel libMySQL-devel libcomedi-devel libcommoncpp2-devel libomniORB-devel libsigc++2.0-devel python-modules xsltproc BuildRequires: glibc-devel-static libcomedi-devel libcommoncpp2-devel libmysqlclient-devel libomniORB-devel libsigc++2.0-devel python-modules xsltproc
%set_verify_elf_method textrel=strict,rpath=strict,unresolved=strict %set_verify_elf_method textrel=strict,rpath=strict,unresolved=strict
...@@ -184,6 +184,9 @@ rm -f %buildroot%_libdir/*.la ...@@ -184,6 +184,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc %exclude %_pkgconfigdir/libUniSet.pc
%changelog %changelog
* Mon Nov 29 2010 Pavel Vainerman <pv@altlinux.ru> 0.99-eter22
- smonitor new format (id@node)
* Tue Nov 23 2010 Pavel Vainerman <pv@altlinux.ru> 0.99-eter20 * Tue Nov 23 2010 Pavel Vainerman <pv@altlinux.ru> 0.99-eter20
- new build - new build
......
...@@ -26,7 +26,8 @@ class SMonitor: ...@@ -26,7 +26,8 @@ class SMonitor:
SMonitor(); SMonitor();
private: private:
UniSetTypes::IDList lst; typedef std::list<UniSetTypes::ParamSInfo> MyIDList;
MyIDList lst;
std::string script; std::string script;
}; };
......
...@@ -19,7 +19,8 @@ SMonitor::SMonitor(ObjectId id): ...@@ -19,7 +19,8 @@ SMonitor::SMonitor(ObjectId id):
script("") script("")
{ {
string sid(conf->getArgParam("--sid")); string sid(conf->getArgParam("--sid"));
lst = UniSetTypes::explode(sid);
lst = UniSetTypes::getSInfoList(sid,UniSetTypes::conf);
if( lst.empty() ) if( lst.empty() )
throw SystemError("Не задан список датчиков (--sid)"); throw SystemError("Не задан список датчиков (--sid)");
...@@ -89,13 +90,15 @@ void SMonitor::sysCommand( SystemMessage *sm ) ...@@ -89,13 +90,15 @@ void SMonitor::sysCommand( SystemMessage *sm )
{ {
case SystemMessage::StartUp: case SystemMessage::StartUp:
{ {
std::list<ObjectId> l = lst.getList(); for( MyIDList::iterator it=lst.begin(); it!=lst.end(); it++ )
for( std::list<ObjectId>::iterator it=l.begin(); it!=l.end(); ++it ) {
{ if( it->si.node == DefaultObjectId )
it->si.node = conf->getLocalNode();
try try
{ {
if( (*it) != DefaultObjectId ) if( it->si.id != DefaultObjectId )
ui.askSensor((*it),UniversalIO::UIONotify); ui.askRemoteSensor(it->si.id,UniversalIO::UIONotify,it->si.node);
} }
catch(Exception& ex) catch(Exception& ex)
{ {
...@@ -108,30 +111,6 @@ void SMonitor::sysCommand( SystemMessage *sm ) ...@@ -108,30 +111,6 @@ void SMonitor::sysCommand( SystemMessage *sm )
raise(SIGTERM); raise(SIGTERM);
} }
} }
/*
try
{
UniSetTypes::IDSeq_var badlst = ui.askSensorsSeq(lst,UniversalIO::UIONotify);
int sz = badlst->length();
if( sz > 0 )
{
cerr << myname << "(askSensrosSeq): ******** НЕ УДАЛОСЬ ЗАКАЗАТЬ: ";
for( int i=0; i<sz; i++ )
cerr << badlst[i] << " ";
cerr << endl;
}
}
catch(Exception& ex)
{
cerr << myname << ":(askSensor): " << ex << endl;
raise(SIGTERM);
}
catch(...)
{
cerr << myname << ": НЕ СМОГ ЗАКАЗТЬ датчики "<< endl;
raise(SIGTERM);
}
*/
} }
break; break;
......
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