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
ecd5516e
Commit
ecd5516e
authored
Feb 18, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(IONotifyController): подправил вылавливание исключений в getThresholdsList,
а также инициализацию списка порогов.
parent
e4ae89b3
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
54 additions
and
8 deletions
+54
-8
libuniset2.spec
conf/libuniset2.spec
+4
-1
test_ui.cc
extensions/tests/test_ui.cc
+6
-0
UniSetTypes.h
include/UniSetTypes.h
+1
-0
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+15
-0
IONotifyController.cc
src/Processes/IONotifyController.cc
+20
-4
NCRestorer.cc
src/Processes/NCRestorer.cc
+7
-0
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+0
-2
SViewer.cc
src/Various/SViewer.cc
+1
-1
No files found.
conf/libuniset2.spec
View file @
ecd5516e
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.2
Release: alt2
2
Release: alt2
3
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -451,6 +451,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Wed Feb 17 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt23
- IONotifyController: fixed buf for init thresholdslist
* Tue Feb 09 2016 Pavel Vainerman <pv@altlinux.ru> 2.2-alt22
- ModbusSlave(TCP): add show ip:port to vmonit setbug #9012
...
...
extensions/tests/test_ui.cc
View file @
ecd5516e
...
...
@@ -190,6 +190,12 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE
(
ti3
.
hilimit
==
40
);
REQUIRE_THROWS_AS
(
ui
.
getThresholdInfo
(
sid
,
10
),
UniSetTypes
::
NameNotFound
);
// проверяем thresholds который был сформирован из секции <thresholds>
ui
.
setValue
(
10
,
378
);
REQUIRE
(
ui
.
getValue
(
13
)
==
1
);
ui
.
setValue
(
10
,
0
);
REQUIRE
(
ui
.
getValue
(
13
)
==
0
);
}
SECTION
(
"calibration"
)
...
...
include/UniSetTypes.h
View file @
ecd5516e
...
...
@@ -90,6 +90,7 @@ namespace UniSetTypes
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
UniversalIO
::
IOType
t
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IONotifyController_i
::
ThresholdInfo
&
ti
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IOController_i
::
ShortIOInfo
&
s
);
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
const
IONotifyController_i
::
ThresholdState
&
s
);
/*! Команды для управления лампочками */
enum
LampCommand
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
ecd5516e
...
...
@@ -557,3 +557,18 @@ std::ostream& UniSetTypes::operator<<( std::ostream& os, const IOController_i::S
return
os
;
}
// -------------------------------------------------------------------------
std
::
ostream
&
UniSetTypes
::
operator
<<
(
std
::
ostream
&
os
,
const
IONotifyController_i
::
ThresholdState
&
s
)
{
if
(
s
==
IONotifyController_i
::
LowThreshold
)
return
os
<<
"low"
;
if
(
s
==
IONotifyController_i
::
HiThreshold
)
return
os
<<
"hi"
;
if
(
s
==
IONotifyController_i
::
NormalThreshold
)
return
os
<<
"norm"
;
return
os
<<
"Unknown"
;
}
// -------------------------------------------------------------------------
src/Processes/IONotifyController.cc
View file @
ecd5516e
...
...
@@ -528,6 +528,7 @@ void IONotifyController::askThreshold(UniSetTypes::ObjectId sid, const UniSetTyp
tli
.
si
.
node
=
uniset_conf
()
->
getLocalNode
();
tli
.
list
=
std
::
move
(
lst
);
tli
.
type
=
li
->
second
->
type
;
tli
.
ait
=
li
->
second
;
// после этого вызова ti использовать нельзя
addThreshold
(
tli
.
list
,
std
::
move
(
ti
),
ci
);
...
...
@@ -863,11 +864,18 @@ IONotifyController_i::ThresholdList* IONotifyController::getThresholds( UniSetTy
}
catch
(
const
Exception
&
ex
)
{
uwarn
<<
myname
<<
"(getThresholds
List
): для датчика "
uwarn
<<
myname
<<
"(getThresholds): для датчика "
<<
uniset_conf
()
->
oind
->
getNameById
(
it
->
second
.
si
.
id
)
<<
" "
<<
ex
<<
endl
;
}
/*
catch( const IOController_i::NameNotFound& ex )
{
uwarn << myname << "(getThresholds): IOController_i::NameNotFound.. for sid"
<< uniset_conf()->oind->getNameById(it->second.si.id)
<< endl;
}
*/
res
->
tlist
.
length
(
it
->
second
.
list
.
size
()
);
unsigned
int
k
=
0
;
...
...
@@ -903,16 +911,24 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
try
{
(
*
res
)[
i
].
si
=
it
->
second
.
si
;
(
*
res
)[
i
].
value
=
IOController
::
localGetValue
(
it
->
second
.
ait
,
it
->
second
.
si
.
id
);
(
*
res
)[
i
].
value
=
IOController
::
localGetValue
(
it
->
second
.
ait
,
it
->
second
.
si
.
id
);
(
*
res
)[
i
].
type
=
it
->
second
.
type
;
}
catch
(
const
std
::
exception
&
ex
)
{
uwarn
<<
myname
<<
"(getThresholdsList):
для датчика
"
uwarn
<<
myname
<<
"(getThresholdsList):
for sid=
"
<<
uniset_conf
()
->
oind
->
getNameById
(
it
->
second
.
si
.
id
)
<<
" "
<<
ex
.
what
()
<<
endl
;
continue
;
}
catch
(
const
IOController_i
::
NameNotFound
&
ex
)
{
uwarn
<<
myname
<<
"(getThresholdsList): IOController_i::NameNotFound.. for sid="
<<
uniset_conf
()
->
oind
->
getNameById
(
it
->
second
.
si
.
id
)
<<
endl
;
continue
;
}
(
*
res
)[
i
].
tlist
.
length
(
it
->
second
.
list
.
size
()
);
...
...
src/Processes/NCRestorer.cc
View file @
ecd5516e
...
...
@@ -120,6 +120,13 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, std::shared_ptr<IOCon
for
(
auto
&
it
:
lst
)
it
.
sit
=
ic
->
myioEnd
();
try
{
auto
i
=
ic
->
find
(
inf
->
si
.
id
);
ic
->
askTMap
[
inf
->
si
.
id
].
ait
=
i
->
second
;
}
catch
(...){}
ic
->
askTMap
[
inf
->
si
.
id
].
si
=
inf
->
si
;
ic
->
askTMap
[
inf
->
si
.
id
].
type
=
inf
->
type
;
ic
->
askTMap
[
inf
->
si
.
id
].
list
=
std
::
move
(
lst
);
...
...
src/Processes/NCRestorer_XML.cc
View file @
ecd5516e
...
...
@@ -156,8 +156,6 @@ void NCRestorer_XML::read_list( const std::shared_ptr<UniXML>& xml, xmlNode* nod
{
try
{
ioRegistration
(
ic
,
uinf
,
true
);
}
catch
(
const
Exception
&
ex
)
...
...
src/Various/SViewer.cc
View file @
ecd5516e
...
...
@@ -304,7 +304,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
for
(
auto
k
=
0
;
k
<
m
;
k
++
)
{
IONotifyController_i
::
ThresholdInfo
*
ti
=
&
tlst
[
i
].
tlist
[
k
];
cout
<<
"
\t
("
<<
setw
(
3
)
<<
ti
->
id
<<
") | "
<<
ti
->
state
<<
" | hi: "
<<
setw
(
5
)
<<
ti
->
hilimit
;
cout
<<
"
\t
("
<<
setw
(
3
)
<<
ti
->
id
<<
") | "
<<
setw
(
5
)
<<
ti
->
state
<<
" | hi: "
<<
setw
(
5
)
<<
ti
->
hilimit
;
cout
<<
" | low: "
<<
setw
(
5
)
<<
ti
->
lowlimit
;
cout
<<
endl
;
}
...
...
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