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