Commit 180c78b0 authored by Pavel Vaynerman's avatar Pavel Vaynerman

fixed bug in admin --saveValue

parent 9dff12fc
...@@ -824,10 +824,10 @@ int saveValue(string args, UniversalInterface &ui) ...@@ -824,10 +824,10 @@ int saveValue(string args, UniversalInterface &ui)
{ {
if( isdigit( arg[0] ) ) if( isdigit( arg[0] ) )
{ {
if( sscanf( arg.c_str(),"%ld:%ld=%ld",&sid,&node,&val ) < 2 ) if( sscanf( arg.c_str(),"%ld=%ld",&sid,&val ) < 2 )
{ {
cout << i <<"\t------------------------"<< endl; cout << i <<"\t------------------------"<< endl;
cerr << "!!!!!!!!! SensorId=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl; cerr << "(digit): !!! SensorId=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl;
err=1; err=1;
continue; continue;
} }
...@@ -835,16 +835,16 @@ int saveValue(string args, UniversalInterface &ui) ...@@ -835,16 +835,16 @@ int saveValue(string args, UniversalInterface &ui)
else else
{ {
int ind; int ind;
string name,strval; string strval;
ind = arg.find_first_of("="); ind = arg.find_first_of("=");
name = conf->getSensorsSection()+"/"+arg.substr(0,ind); string name(arg.substr(0,ind));
strval = arg.substr( ind + 1, arg.length() ); strval = arg.substr( ind + 1, arg.length() );
sid = conf->oind->getIdByName(name); sid = conf->getSensorID(name);
if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&val ) < 1) ) if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&val ) < 1) )
{ {
cout << i <<"\t------------------------"<< endl; cout << i <<"\t------------------------"<< endl;
cerr << "!!!!!!!!! SensorName=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl; cerr << "(name): !!! SensorName=Value #"<<i<<" '"<<arg<<"' !!!!!!\n"<< endl;
err=1; err=1;
continue; continue;
} }
...@@ -896,11 +896,11 @@ int saveState(string args, UniversalInterface &ui) ...@@ -896,11 +896,11 @@ int saveState(string args, UniversalInterface &ui)
else else
{ {
int ind; int ind;
string name,strval; string strval;
ind = arg.find_first_of("="); ind = arg.find_first_of("=");
name = conf->getSensorsSection()+"/"+arg.substr(0,ind); string name(arg.substr(0,ind));
strval = arg.substr( ind + 1, arg.length() ); strval = arg.substr( ind + 1, arg.length() );
sid = conf->oind->getIdByName(name); sid = conf->getSensorID(name);
if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&inval ) < 1) ) if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&inval ) < 1) )
{ {
...@@ -965,11 +965,11 @@ int setValue(string args, UniversalInterface &ui) ...@@ -965,11 +965,11 @@ int setValue(string args, UniversalInterface &ui)
else else
{ {
int ind; int ind;
string name,strval; string strval;
ind = arg.find_first_of("="); ind = arg.find_first_of("=");
name = conf->getSensorsSection()+"/"+arg.substr(0,ind); string name(arg.substr(0,ind));
strval = arg.substr( ind + 1, arg.length() ); strval = arg.substr( ind + 1, arg.length() );
sid = conf->oind->getIdByName(name); sid = conf->getSensorID(name);
if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&val ) < 1) ) if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&val ) < 1) )
{ {
...@@ -1025,11 +1025,11 @@ int setState(string args, UniversalInterface &ui) ...@@ -1025,11 +1025,11 @@ int setState(string args, UniversalInterface &ui)
else else
{ {
int ind; int ind;
string name,strval; string strval;
ind = arg.find_first_of("="); ind = arg.find_first_of("=");
name = conf->getSensorsSection()+"/"+arg.substr(0,ind); string name(arg.substr(0,ind));
strval = arg.substr( ind + 1, arg.length() ); strval = arg.substr( ind + 1, arg.length() );
sid = conf->oind->getIdByName(name); sid = conf->getSensorID(name);
if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&inval ) < 1) ) if( sid == UniSetTypes::DefaultObjectId || (sscanf( strval.c_str(),"%ld",&inval ) < 1) )
{ {
...@@ -1097,9 +1097,7 @@ int getState(string args, UniversalInterface &ui) ...@@ -1097,9 +1097,7 @@ int getState(string args, UniversalInterface &ui)
} }
else else
{ {
string name; sid = conf->getSensorID(arg);
name = conf->getSensorsSection()+"/"+arg;
sid = conf->oind->getIdByName(name);
if( sid == UniSetTypes::DefaultObjectId ) if( sid == UniSetTypes::DefaultObjectId )
{ {
...@@ -1161,9 +1159,7 @@ int getValue(string args, UniversalInterface &ui ) ...@@ -1161,9 +1159,7 @@ int getValue(string args, UniversalInterface &ui )
} }
else else
{ {
string name; sid = conf->getSensorID(arg);
name = conf->getSensorsSection()+"/"+arg;
sid = conf->oind->getIdByName(name);
if( sid == UniSetTypes::DefaultObjectId ) if( sid == UniSetTypes::DefaultObjectId )
{ {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Name: libuniset Name: libuniset
Version: 0.96 Version: 0.96
Release: eter60 Release: eter61
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++
...@@ -179,6 +179,9 @@ rm -f %buildroot%_libdir/*.la ...@@ -179,6 +179,9 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc %exclude %_pkgconfigdir/libUniSet.pc
%changelog %changelog
* Thu Sep 10 2009 Pavel Vainerman <pv@etersoft.ru> 0.96-eter60
- rebuild for eterbook
* Thu Sep 10 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter59 * Thu Sep 10 2009 Pavel Vainerman <pv@altlinux.ru> 0.96-eter59
- UniNetwork debugging - UniNetwork debugging
......
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