Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
b161ad2b
Commit
b161ad2b
authored
Sep 06, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(SMViewer): добавил вывод информации о том, кто менял датчик
(admin): добавил AdminID в setValue (IOController): заложил простой тест для всяких функций
parent
b6692ee6
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
64 additions
and
10 deletions
+64
-10
admin.cc
Utilities/Admin/admin.cc
+1
-1
SViewer.h
include/SViewer.h
+1
-1
IOController.cc
src/Processes/IOController.cc
+1
-0
SViewer.cc
src/Various/SViewer.cc
+19
-7
Makefile.am
tests/Makefile.am
+2
-1
test_iocontroller_types.cc
tests/test_iocontroller_types.cc
+38
-0
test_utypes.cc
tests/test_utypes.cc
+1
-0
uniset2.files
uniset2.files
+1
-0
No files found.
Utilities/Admin/admin.cc
View file @
b161ad2b
...
...
@@ -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:
...
...
include/SViewer.h
View file @
b161ad2b
...
...
@@ -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
&
own
er
,
void
printInfo
(
UniSetTypes
::
ObjectId
id
,
const
std
::
string
&
sname
,
long
value
,
const
std
::
string
&
suppli
er
,
const
std
::
string
&
txtname
,
const
std
::
string
&
iotype
);
std
::
shared_ptr
<
UInterface
>
ui
;
...
...
src/Processes/IOController.cc
View file @
b161ad2b
...
...
@@ -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
;
...
...
src/Various/SViewer.cc
View file @
b161ad2b
...
...
@@ -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
,
own
er
,
txtname
,
(
amap
[
i
].
type
==
UniversalIO
::
AI
?
"AI"
:
"DI"
)
);
printInfo
(
amap
[
i
].
si
.
id
,
name
,
amap
[
i
].
value
,
suppli
er
,
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
,
own
er
,
txtname
,
(
amap
[
i
].
type
==
UniversalIO
::
AO
?
"AO"
:
"DO"
));
printInfo
(
amap
[
i
].
si
.
id
,
name
,
amap
[
i
].
value
,
suppli
er
,
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
&
own
er
,
void
SViewer
::
printInfo
(
UniSetTypes
::
ObjectId
id
,
const
string
&
sname
,
long
value
,
const
string
&
suppli
er
,
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;
}
// ---------------------------------------------------------------------------
tests/Makefile.am
View file @
b161ad2b
...
...
@@ -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
...
...
tests/test_iocontroller_types.cc
0 → 100644
View file @
b161ad2b
#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..."
);
}
// -----------------------------------------------------------------------------
tests/test_utypes.cc
View file @
b161ad2b
...
...
@@ -189,3 +189,4 @@ TEST_CASE("UniSetTypes: timespec comapre", "[utypes][timespec]" )
REQUIRE_FALSE
(
t3
!=
t4
);
REQUIRE
(
t3
==
t4
);
}
// -----------------------------------------------------------------------------
uniset2.files
View file @
b161ad2b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment