Commit b161ad2b authored by Pavel Vainerman's avatar Pavel Vainerman

(SMViewer): добавил вывод информации о том, кто менял датчик

(admin): добавил AdminID в setValue (IOController): заложил простой тест для всяких функций
parent b6692ee6
......@@ -600,7 +600,7 @@ int setValue( const string& args, UInterface& ui )
case UniversalIO::DO:
case UniversalIO::AI:
case UniversalIO::AO:
ui.setValue(it.si.id, it.val, it.si.node);
ui.setValue(it.si.id, it.val, it.si.node, AdminID);
break;
default:
......
......@@ -47,7 +47,7 @@ class SViewer
virtual void updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tlst, UniSetTypes::ObjectId oid );
const std::string csec;
void printInfo(UniSetTypes::ObjectId id, const std::string& sname, long value, const std::string& owner,
void printInfo(UniSetTypes::ObjectId id, const std::string& sname, long value, const std::string& supplier,
const std::string& txtname, const std::string& iotype);
std::shared_ptr<UInterface> ui;
......
......@@ -305,6 +305,7 @@ long IOController::localSetValue( std::shared_ptr<USensorInfo>& usi,
<< " value=" << usi->value
<< " blocked=" << usi->blocked
<< " real_value=" << usi->real_value
<< " supplier=" << sup_id
<< endl;
usi->real_value = value;
......
......@@ -201,9 +201,11 @@ void SViewer::getInfo( ObjectId id )
void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetTypes::ObjectId oid )
{
string owner = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(oid));
cout << "\n======================================================\n" << owner;
cout << "\t Датчики";
cout << "\n------------------------------------------------------" << endl;
cout << "\n======================================================\n"
<< ORepHelpers::getShortName(uniset_conf()->oind->getMapName(oid))
<< "\t Датчики"
<< "\n------------------------------------------------------"
<< endl;
int size = amap->length();
for(int i = 0; i < size; i++)
......@@ -215,8 +217,12 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
if( isShortName )
name = ORepHelpers::getShortName(name);
string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier));
if( amap[i].supplier == UniSetTypes::AdminID )
supplier = "uniset-admin";
string txtname( uniset_conf()->oind->getTextName(amap[i].si.id) );
printInfo( amap[i].si.id, name, amap[i].value, owner, txtname, (amap[i].type == UniversalIO::AI ? "AI" : "DI") );
printInfo( amap[i].si.id, name, amap[i].value, supplier, txtname, (amap[i].type == UniversalIO::AI ? "AI" : "DI") );
}
}
......@@ -235,8 +241,12 @@ void SViewer::updateSensors( IOController_i::SensorInfoSeq_var& amap, UniSetType
if( isShortName )
name = ORepHelpers::getShortName(name);
string supplier = ORepHelpers::getShortName(uniset_conf()->oind->getMapName(amap[i].supplier));
if( amap[i].supplier == UniSetTypes::AdminID )
supplier = "uniset-admin";
string txtname( uniset_conf()->oind->getTextName(amap[i].si.id) );
printInfo( amap[i].si.id, name, amap[i].value, owner, txtname, (amap[i].type == UniversalIO::AO ? "AO" : "DO"));
printInfo( amap[i].si.id, name, amap[i].value, supplier, txtname, (amap[i].type == UniversalIO::AO ? "AO" : "DO"));
}
}
......@@ -291,9 +301,11 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
}
// ---------------------------------------------------------------------------
void SViewer::printInfo(UniSetTypes::ObjectId id, const string& sname, long value, const string& owner,
void SViewer::printInfo(UniSetTypes::ObjectId id, const string& sname, long value, const string& supplier,
const string& txtname, const string& iotype)
{
cout << "(" << setw(5) << id << ")" << " | " << setw(2) << iotype << " | " << setw(60) << sname << " | " << setw(5) << value << endl; // << "\t | " << setw(40) << owner << "\t | " << txtname << endl;
cout << "(" << setw(5) << id << ")" << " | " << setw(2) << iotype << " | " << setw(60) << sname
<< " | " << setw(5) << value << "\t | "
<< setw(40) << left << supplier << endl; // "\t | " << txtname << endl;
}
// ---------------------------------------------------------------------------
......@@ -27,7 +27,8 @@ test_modbustypes.cc \
test_mutex.cc \
test_logserver.cc \
test_tcpcheck.cc \
test_utcpsocket.cc
test_utcpsocket.cc \
test_iocontroller_types.cc
tests_with_conf_LDADD = $(top_builddir)/lib/libUniSet2.la
tests_with_conf_CPPFLAGS = -I$(top_builddir)/include
......
#include <catch.hpp>
// -----------------------------------------------------------------------------
#include <sstream>
#include <limits>
#include "Configuration.h"
#include "UniSetTypes.h"
#include "IOController.h"
// -----------------------------------------------------------------------------
using namespace std;
using namespace UniSetTypes;
// -----------------------------------------------------------------------------
//! \todo test_iocontroller_types: Дописать больше тестов
// -----------------------------------------------------------------------------
TEST_CASE("IOController: USensorInfo", "[ioc][usi]" )
{
IOController::USensorInfo usi;
usi.supplier = 100;
usi.blocked = true;
usi.value = 9;
SECTION( "makeSensorIOInfo" )
{
IOController_i::SensorIOInfo si( usi.makeSensorIOInfo() );
REQUIRE( si.supplier == 100 );
REQUIRE( si.blocked == true );
REQUIRE( si.value == 9 );
}
SECTION( "makeSensorMessage" )
{
UniSetTypes::SensorMessage sm( usi.makeSensorMessage() );
REQUIRE( sm.supplier == 100 );
REQUIRE( sm.value == 9 );
}
WARN("Tests for 'UniSetTypes' incomplete...");
}
// -----------------------------------------------------------------------------
......@@ -189,3 +189,4 @@ TEST_CASE("UniSetTypes: timespec comapre", "[utypes][timespec]" )
REQUIRE_FALSE( t3 != t4 );
REQUIRE( t3 == t4 );
}
// -----------------------------------------------------------------------------
......@@ -464,6 +464,7 @@ tests/test_tcpcheck.cc
tests/test_mqueue.cc
tests/test_uobject.cc
tests/test_utcpsocket.cc
tests/test_iocontroller_types.cc
tests/TestUObject.h
tests/tests-junit.xml
tests/tests.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