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
e65a7f59
Commit
e65a7f59
authored
Dec 18, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной…
(2.0): Убрал устаревшее поле "sensibility", а также разобрался с начальной инициализацией порогов (eterbug #9454)
parent
db321372
Show whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
201 additions
and
191 deletions
+201
-191
IOController_i.idl
IDL/Processes/IOController_i.idl
+2
-8
UniSetManager_i.idl
IDL/UniSetTypes/UniSetManager_i.idl
+0
-2
UniSetObject_i.idl
IDL/UniSetTypes/UniSetObject_i.idl
+0
-2
UniSetTypes_i.idl
IDL/UniSetTypes/UniSetTypes_i.idl
+0
-2
skel.src.xml
Utilities/codegen/skel.src.xml
+6
-2
TestGen.cc
Utilities/codegen/tests/TestGen.cc
+46
-21
TestGen.h
Utilities/codegen/tests/TestGen.h
+5
-2
libuniset.spec
conf/libuniset.spec
+1
-1
test.xml
conf/test.xml
+2
-0
IOControl.h
extensions/IOControl/IOControl.h
+0
-2
SharedMemory.cc
extensions/SharedMemory/SharedMemory.cc
+30
-6
IOBase.cc
extensions/lib/IOBase.cc
+4
-7
IOController.h
include/IOController.h
+8
-2
IONotifyController.h
include/IONotifyController.h
+7
-16
UInterface.h
include/UInterface.h
+2
-2
UniSetManager.h
include/UniSetManager.h
+0
-3
UniSetObserver.h
include/UniSetObserver.h
+0
-64
UniSetTypes.h
include/UniSetTypes.h
+8
-1
UInterface.cc
src/Interfaces/UInterface.cc
+4
-4
UniSetActivator.cc
src/ObjectRepository/UniSetActivator.cc
+3
-2
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+1
-2
IOController.cc
src/Processes/IOController.cc
+32
-0
IONotifyController.cc
src/Processes/IONotifyController.cc
+26
-22
NCRestorer.cc
src/Processes/NCRestorer.cc
+12
-5
NCRestorer_XML.cc
src/Processes/NCRestorer_XML.cc
+1
-11
MessageType.cc
src/Various/MessageType.cc
+0
-1
SViewer.cc
src/Various/SViewer.cc
+1
-1
No files found.
IDL/Processes/IOController_i.idl
View file @
e65a7f59
...
...
@@ -19,8 +19,6 @@
//
--------------------------------------------------------------------------
/*
!
\
file
*
\
author
Pavel
Vainerman
*
\
date
$
Date
:
2008
/
11
/
29
21
:
24
:
24
$
*
\
version
$
Id
:
IOController_i
.
idl
,
v
1.16
2008
/
11
/
29
21
:
24
:
24
vpashka
Exp
$
*/
//
--------------------------------------------------------------------------
#
ifndef
BaseIOController_i_IDL_
...
...
@@ -89,7 +87,6 @@ interface IOController_i : UniSetManager_i
long
maxRaw
; /*!< максимальное "сырое" значение */
long
minCal
; /*!< минимальное калиброванное значение */
long
maxCal
; /*!< максимальное калиброванное значение */
long
sensibility
; /*!< чуствительность (для первичного фильтрования) */
short
precision
; /*!< точность */
}
;
...
...
@@ -193,13 +190,11 @@ interface IONotifyController_i : IOController_i
*
\
param
tid
-
идентификатор
порога
*
\
param
lowLimit
-
нижний
порог
срабатыания
*
\
param
hiLimit
-
верхний
порог
срабатывания
*
\
param
sensibility
-
чуствительность
*
*
Датчик
срабатывает
при
условии
,
что
значение
меньше
(
lowLimit
-
sensibility
)
или
*
больше
(
hiLimit
+
sensibility
)
*
Датчик
срабатывает
при
условии
,
что
значение
<=
lowLimit
или
>=
hiLimit
*/
void
askThreshold
(
in
SensorInfo
si
,
in
UniSetTypes
::
ConsumerInfo
ci
,
in
UniSetTypes
::
ThresholdId
tid
,
in
long
lowLimit
,
in
long
hiLimit
,
in
long
sensibility
,
in
long
lowLimit
,
in
long
hiLimit
,
in
UniversalIO
::
UIOCommand
cmd
)
raises
(
NameNotFound
,
IOBadParam
,
BadRange
)
;
/*
!
...
...
@@ -225,7 +220,6 @@ interface IONotifyController_i : IOController_i
UniSetTypes
::
ThresholdId
id
;
long
hilimit
; /*!< верхняя граница срабатывания */
long
lowlimit
; /*!< нижняя гранийа срабатывания */
long
sensibility
; /*!< точность определения границ (?) */
ThresholdState
state
;
long
tv_sec
; /*!< время последнего изменения датчика, секунды (gettimeofday) */
long
tv_usec
; /*!< время последнего изменения датчика, мксек (gettimeofday) */
...
...
IDL/UniSetTypes/UniSetManager_i.idl
View file @
e65a7f59
...
...
@@ -19,8 +19,6 @@
//
--------------------------------------------------------------------------
/*
!
\
file
*
\
author
Pavel
Vainerman
*
\
date
$
Date
:
2007
/
12
/
18
20
:
24
:
11
$
*
\
version
$
Id
:
UniSetManager_i
.
idl
,
v
1.2
2007
/
12
/
18
20
:
24
:
11
vpashka
Exp
$
*/
//
--------------------------------------------------------------------------
#
ifndef
UniSetManager_i_IDL_
...
...
IDL/UniSetTypes/UniSetObject_i.idl
View file @
e65a7f59
...
...
@@ -19,8 +19,6 @@
//
--------------------------------------------------------------------------
/*
!
\
file
*
\
author
Pavel
Vainerman
*
\
date
$
Date
:
2007
/
12
/
17
22
:
50
:
59
$
*
\
version
$
Id
:
UniSetObject_i
.
idl
,
v
1.4
2007
/
12
/
17
22
:
50
:
59
vpashka
Exp
$
*/
//
--------------------------------------------------------------------------
#
ifndef
UniSetObject_i_IDL_
...
...
IDL/UniSetTypes/UniSetTypes_i.idl
View file @
e65a7f59
...
...
@@ -19,8 +19,6 @@
//
--------------------------------------------------------------------------
/*
!
\
file
*
\
author
Pavel
Vainerman
*
\
date
$
Date
:
2009
/
01
/
23
23
:
56
:
54
$
*
\
version
$
Id
:
UniSetTypes_i
.
idl
,
v
1.9
2009
/
01
/
23
23
:
56
:
54
vpashka
Exp
$
*/
//
--------------------------------------------------------------------------
#
ifndef
UniSetTypes_i_IDL_
...
...
Utilities/codegen/skel.src.xml
View file @
e65a7f59
...
...
@@ -17,9 +17,8 @@
</settings>
<variables>
<item
name=
"changeTime"
type=
"int"
default=
"2000"
min=
"0"
comment=
"change state time"
const=
"1"
public=
"1"
/>
<item
name=
"checkWorkingTime"
type=
"int"
default=
"3000"
min=
"0"
comment=
"check working time"
const=
"1"
public=
"1"
/>
<item
name=
"checkTime"
type=
"int"
default=
"3000"
min=
"0"
comment=
"check Working time"
const=
"1"
public=
"1"
/>
<item
name=
"checkDependTime"
type=
"int"
default=
"5000"
min=
"0"
comment=
"check depend time"
const=
"1"
public=
"1"
/>
<item
name=
"checkUndefTime"
type=
"int"
default=
"3000"
min=
"0"
comment=
"check undef time"
const=
"1"
public=
"1"
/>
</variables>
<smap>
<!-- name - название переменной в конф. файле -->
...
...
@@ -36,6 +35,11 @@
<!-- проверка работы undefined state -->
<item
name=
"undef_c"
vartype=
"out"
comment=
"аналоговый датчик (для проверки undef-состояния)"
/>
<item
name=
"check_undef_s"
vartype=
"in"
comment=
"датчик для выставления undef-состояния"
/>
<!-- проверка работы threshold-ов -->
<item
name=
"t_set_c"
vartype=
"out"
comment=
"аналоговый датчик (для выставления порога)"
/>
<item
name=
"t_check_s"
vartype=
"in"
comment=
"датчик для проверки срабатывания"
/>
</smap>
<msgmap>
...
...
Utilities/codegen/tests/TestGen.cc
View file @
e65a7f59
...
...
@@ -31,15 +31,18 @@ void TestProc::sysCommand( UniSetTypes::SystemMessage* sm )
TestProc_SK
::
sysCommand
(
sm
);
if
(
sm
->
command
==
SystemMessage
::
StartUp
||
sm
->
command
==
SystemMessage
::
WatchDog
)
{
askTimer
(
tmCheckDepend
,
checkDependTime
);
askTimer
(
tmCheckUndefState
,
checkUndefTime
);
askTimer
(
tmCheck
,
checkTime
);
askTimer
(
tmCheckWorking
,
checkWorkingTime
);
// В начальный момент времени блокирующий датчик =0, поэтому d2_check_s должен быть равен depend_off_value (-50).
dlog
.
level1
()
<<
myname
<<
"(startup): check init depend: "
<<
(
getValue
(
d2_check_s
)
==
-
50
?
"OK"
:
"FAIL"
)
<<
endl
;
}
}
// -----------------------------------------------------------------------------
void
TestProc
::
sensorInfo
(
SensorMessage
*
sm
)
{
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(sensorInfo): id="
<<
sm
->
id
<<
" val="
<<
sm
->
value
<<
" "
<<
UInterface
::
timeToString
(
sm
->
sm_tv_sec
,
":"
)
dlog
.
level2
()
<<
myname
<<
"(sensorInfo): id="
<<
sm
->
id
<<
" val="
<<
sm
->
value
<<
" "
<<
timeToString
(
sm
->
sm_tv_sec
,
":"
)
<<
"("
<<
setw
(
6
)
<<
sm
->
sm_tv_usec
<<
"): "
<<
endl
;
...
...
@@ -47,18 +50,18 @@ void TestProc::sensorInfo( SensorMessage *sm )
{
if
(
sm
->
value
)
{
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(sensorInfo): START WORKING.."
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"(sensorInfo): START WORKING.."
<<
endl
;
askTimer
(
tmChange
,
changeTime
);
}
else
{
askTimer
(
tmChange
,
0
);
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(sensorInfo): STOP WORKING.."
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"(sensorInfo): STOP WORKING.."
<<
endl
;
}
}
else
if
(
sm
->
id
==
check_undef_s
)
{
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(sensorInfo): CHECK UNDEFINED STATE ==> "
<<
(
sm
->
undefined
==
undef
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"(sensorInfo): CHECK UNDEFINED STATE ==> "
<<
(
sm
->
undefined
==
undef
?
"OK"
:
"FAIL"
)
<<
endl
;
}
}
// -----------------------------------------------------------------------------
...
...
@@ -68,14 +71,23 @@ void TestProc::timerInfo( TimerMessage *tm )
{
state
^=
true
;
out_lamp_c
=
(
state
?
lmpBLINK
:
lmpOFF
);
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo)
: state="
<<
state
<<
" lmp="
<<
out_lamp_c
<<
endl
;
dlog
.
level2
()
<<
myname
<<
"
: state="
<<
state
<<
" lmp="
<<
out_lamp_c
<<
endl
;
askTimer
(
tmCheckWorking
,
checkTime
);
// reset timer
}
else
if
(
tm
->
id
==
tmCheckWorking
)
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo)
: WORKING FAIL!"
<<
endl
;
else
if
(
tm
->
id
==
tmCheck
Depend
)
dlog
.
level1
()
<<
myname
<<
"
: WORKING FAIL!"
<<
endl
;
else
if
(
tm
->
id
==
tmCheck
)
{
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo): Check depend..."
<<
endl
;
dlog
.
level1
()
<<
endl
<<
endl
<<
"--------"
<<
endl
;
test_depend
();
test_undefined_state
();
test_thresholds
();
}
}
// -----------------------------------------------------------------------------
void
TestProc
::
test_depend
()
{
dlog
.
level1
()
<<
myname
<<
": Check depend..."
<<
endl
;
long
test_val
=
100
;
...
...
@@ -83,23 +95,36 @@ void TestProc::timerInfo( TimerMessage *tm )
setValue
(
depend_c
,
0
);
setValue
(
set_d1_check_s
,
test_val
);
setValue
(
set_d2_check_s
,
test_val
);
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo)
: check depend OFF: d1: "
<<
(
getValue
(
d1_check_s
)
==
0
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo)
: check depend OFF: d2: "
<<
(
getValue
(
d2_check_s
)
==
-
50
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"
: check depend OFF: d1: "
<<
(
getValue
(
d1_check_s
)
==
0
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"
: check depend OFF: d2: "
<<
(
getValue
(
d2_check_s
)
==
-
50
?
"OK"
:
"FAIL"
)
<<
endl
;
// set depend 1
setValue
(
depend_c
,
1
);
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo): check depend ON: d1: "
<<
(
getValue
(
d1_check_s
)
==
test_val
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo): check depend ON: d2: "
<<
(
getValue
(
d2_check_s
)
==
test_val
?
"OK"
:
"FAIL"
)
<<
endl
;
}
else
if
(
tm
->
id
==
tmCheckUndefState
)
{
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo): Check undef state..."
<<
endl
;
dlog
.
level1
()
<<
myname
<<
": check depend ON: d1: "
<<
(
getValue
(
d1_check_s
)
==
test_val
?
"OK"
:
"FAIL"
)
<<
endl
;
dlog
.
level1
()
<<
myname
<<
": check depend ON: d2: "
<<
(
getValue
(
d2_check_s
)
==
test_val
?
"OK"
:
"FAIL"
)
<<
endl
;
}
// -----------------------------------------------------------------------------
void
TestProc
::
test_undefined_state
()
{
// ---------------- Проверка выставления неопределённого состояния ---------------------
dlog
.
level1
()
<<
myname
<<
": Check undef state..."
<<
endl
;
undef
^=
true
;
si
.
id
=
undef_c
;
si
.
node
=
conf
->
getLocalNode
();
dlog
[
Debug
::
LEVEL1
]
<<
myname
<<
"(timerInfo)
: set undefined="
<<
undef
<<
endl
;
dlog
.
level1
()
<<
myname
<<
"
: set undefined="
<<
undef
<<
endl
;
ui
.
setUndefinedState
(
si
,
undef
,
getId
()
);
}
}
// -----------------------------------------------------------------------------
void
TestProc
::
test_thresholds
()
{
// ---------------- Проверка работы порогов ---------------------
dlog
.
level1
()
<<
myname
<<
": Check thresholds..."
<<
endl
;
setValue
(
t_set_c
,
0
);
dlog
.
level1
()
<<
myname
<<
": check threshold OFF value: "
<<
(
getValue
(
t_check_s
)
==
0
?
"OK"
:
"FAIL"
)
<<
endl
;
setValue
(
t_set_c
,
378
);
dlog
.
level1
()
<<
myname
<<
": check threshold ON value: "
<<
(
getValue
(
t_check_s
)
==
1
?
"OK"
:
"FAIL"
)
<<
endl
;
}
// -----------------------------------------------------------------------------
Utilities/codegen/tests/TestGen.h
View file @
e65a7f59
...
...
@@ -18,8 +18,7 @@ class TestProc:
{
tmChange
,
tmCheckWorking
,
tmCheckDepend
,
tmCheckUndefState
tmCheck
};
virtual
void
step
();
...
...
@@ -27,6 +26,10 @@ class TestProc:
virtual
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
virtual
void
sysCommand
(
UniSetTypes
::
SystemMessage
*
sm
);
void
test_depend
();
void
test_undefined_state
();
void
test_thresholds
();
private
:
bool
state
;
bool
undef
;
...
...
conf/libuniset.spec
View file @
e65a7f59
...
...
@@ -358,7 +358,7 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
- UniversalInterface --> UInterface
- ObjectsManager --> UniSetManager
- ObjectsActitvator --> UniSetActivator
- remove deprecated property: "sensebility"
* Tue Dec 10 2013 Pavel Vainerman <pv@altlinux.ru> 1.7-alt3
- add RRDServer
...
...
conf/test.xml
View file @
e65a7f59
...
...
@@ -43,6 +43,8 @@
set_d2_check_s=
"AI11_AS"
undef_c=
"AI54_S"
check_undef_s=
"AI54_S"
t_set_c=
"AI_AS"
t_check_s=
"Threshold1_S"
/>
<IOControl
name=
"IOControl"
/>
...
...
extensions/IOControl/IOControl.h
View file @
e65a7f59
...
...
@@ -94,7 +94,6 @@
<br>\b rmax - максимальное "сырое" значение
<br>\b cmin - минимальное "калиброванное" значение
<br>\b cmax - максимальное "калиброванное" значение
<br>\b sensibility - чуствительность. (deprecated)
<br>\b precision - Точность. Задаёт количство знаков после запятой.
<br>Т.е. при считывании из канала, значение домножается
<br>на 10^precision и уже таким сохраняется.
...
...
@@ -110,7 +109,6 @@
Используется для DI.
<br>\b lowlimit - нижний порого срабатывания.
<br>\b hilimit - верхний порого срабатывания.
<br>\b sensibility - чувствительность (deprecated)
<br>\b card - номер карты
<br>\b subdev - номер подустройства
...
...
extensions/SharedMemory/SharedMemory.cc
View file @
e65a7f59
...
...
@@ -72,9 +72,9 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string
t_fvalue
=
conf
->
getArgParam
(
"--t-filter-value"
);
heartbeat_node
=
conf
->
getArgParam
(
"--heartbeat-node"
);
if
(
heartbeat_node
.
empty
()
)
if
(
heartbeat_node
.
empty
()
&&
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(init): --heartbeat-node NULL ===> heartbeat NOT USED..."
<<
endl
;
else
else
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): heartbeat-node: "
<<
heartbeat_node
<<
endl
;
heartbeatCheckTime
=
conf
->
getArgInt
(
"--heartbeat-check-time"
,
"1000"
);
...
...
@@ -89,7 +89,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
string
wdt_dev
=
conf
->
getArgParam
(
"--wdt-device"
);
if
(
!
wdt_dev
.
empty
()
)
wdt
=
new
WDTInterface
(
wdt_dev
);
else
else
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(init): watchdog timer NOT USED (--wdt-device NULL)"
<<
endl
;
...
...
@@ -112,6 +112,7 @@ SharedMemory::SharedMemory( ObjectId id, string datafile, std::string confname )
{
ostringstream
err
;
err
<<
myname
<<
": ID not found ('pulsar') for "
<<
p
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
}
...
...
@@ -169,25 +170,32 @@ void SharedMemory::processingMessage( UniSetTypes::VoidMessage *msg )
}
catch
(
Exception
&
ex
)
{
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(processingMessage): "
<<
ex
<<
endl
;
}
catch
(
CORBA
::
SystemException
&
ex
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(processingMessage): CORBA::SystemException: "
<<
ex
.
NP_minorString
()
<<
endl
;
}
catch
(
CORBA
::
Exception
&
ex
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(processingMessage): CORBA::Exception: "
<<
ex
.
_name
()
<<
endl
;
}
catch
(
omniORB
::
fatalException
&
fe
)
{
if
(
dlog
.
is_crit
()
)
{
dlog
.
crit
()
<<
myname
<<
"(processingMessage): Caught omniORB::fatalException:"
<<
endl
;
dlog
.
crit
()
<<
myname
<<
"(processingMessage): file: "
<<
fe
.
file
()
<<
" line: "
<<
fe
.
line
()
<<
" mesg: "
<<
fe
.
errmsg
()
<<
endl
;
}
}
catch
(...)
{
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(processingMessage): catch..."
<<
endl
;
}
}
...
...
@@ -240,7 +248,7 @@ void SharedMemory::sysCommand( SystemMessage *sm )
msleep
(
100
);
}
if
(
!
isActivated
()
)
if
(
!
isActivated
()
&&
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(sysCommand): ************* don`t activate?! ************"
<<
endl
;
// подождать пока пройдёт инициализация
...
...
@@ -395,10 +403,12 @@ void SharedMemory::checkHeartBeat()
}
catch
(
Exception
&
ex
)
{
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(checkHeartBeat): "
<<
ex
<<
endl
;
}
catch
(...)
{
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(checkHeartBeat): ..."
<<
endl
;
}
}
...
...
@@ -439,6 +449,7 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
<<
") указан неверно ("
<<
it
.
getProp
(
"iotype"
)
<<
") должен быть 'AI'"
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
msg
.
str
()
<<
endl
;
kill
(
getpid
(),
SIGTERM
);
// throw NameNotFound(msg.str());
...
...
@@ -453,6 +464,7 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
{
ostringstream
msg
;
msg
<<
"(SharedMemory::readItem): дискретный датчик (heartbeat_ds_name) связанный с "
<<
it
.
getProp
(
"name"
);
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
msg
.
str
()
<<
endl
;
}
}
...
...
@@ -466,6 +478,7 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
// Если уж задали имя для датчика, то он должен существовать..
// поэтому завершаем процесс, если не нашли..
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
msg
.
str
()
<<
endl
;
kill
(
getpid
(),
SIGTERM
);
// throw NameNotFound(msg.str());
...
...
@@ -481,6 +494,7 @@ bool SharedMemory::readItem( UniXML& xml, UniXML_iterator& it, xmlNode* sec )
msg
<<
"(SharedMemory::readItem): НЕ УКАЗАН id для "
<<
it
.
getProp
(
"name"
)
<<
" секция "
<<
sec
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
msg
.
str
()
<<
endl
;
kill
(
getpid
(),
SIGTERM
);
// throw NameNotFound(msg.str());
...
...
@@ -499,6 +513,7 @@ SharedMemory* SharedMemory::init_smemory( int argc, const char* const* argv )
if
(
dfile
[
0
]
!=
'.'
&&
dfile
[
0
]
!=
'/'
)
dfile
=
conf
->
getConfDir
()
+
dfile
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
"(smemory): datfile = "
<<
dfile
<<
endl
;
UniSetTypes
::
ObjectId
ID
=
conf
->
getControllerID
(
conf
->
getArgParam
(
"--smemory-id"
,
"SharedMemory"
));
...
...
@@ -527,6 +542,7 @@ void SharedMemory::readEventList( std::string oname )
xmlNode
*
enode
=
conf
->
getNode
(
oname
);
if
(
enode
==
NULL
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(readEventList): "
<<
oname
<<
" не найден..."
<<
endl
;
return
;
}
...
...
@@ -534,6 +550,7 @@ void SharedMemory::readEventList( std::string oname )
UniXML_iterator
it
(
enode
);
if
(
!
it
.
goChildren
()
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(readEventList): <eventlist> пустой..."
<<
endl
;
return
;
}
...
...
@@ -550,7 +567,7 @@ void SharedMemory::readEventList( std::string oname )
dlog
.
info
()
<<
myname
<<
"(readEventList): add "
<<
it
.
getProp
(
"name"
)
<<
endl
;
elst
.
push_back
(
oid
);
}
else
else
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(readEventList): Не найден ID для "
<<
it
.
getProp
(
"name"
)
<<
endl
;
}
...
...
@@ -574,7 +591,7 @@ void SharedMemory::sendEvent( UniSetTypes::SystemMessage& sm )
catch
(...){};
}
if
(
!
ok
)
if
(
!
ok
&&
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(sendEvent): Объект "
<<
(
*
it
)
<<
" НЕДОСТУПЕН"
<<
endl
;
}
}
...
...
@@ -598,6 +615,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
UniXML
*
xml
=
conf
->
getConfXML
();
if
(
!
xml
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(buildHistoryList): xml=NULL?!"
<<
endl
;
return
;
}
...
...
@@ -605,6 +623,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
xmlNode
*
n
=
xml
->
extFindNode
(
cnode
,
1
,
1
,
"History"
,
""
);
if
(
!
n
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(buildHistoryList): <History> not found. ignore..."
<<
endl
;
hist
.
clear
();
return
;
...
...
@@ -615,6 +634,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
bool
no_history
=
conf
->
getArgInt
(
"--sm-no-history"
,
it
.
getProp
(
"no_history"
));
if
(
no_history
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(buildHistoryList): no_history='1'.. history skipped..."
<<
endl
;
hist
.
clear
();
return
;
...
...
@@ -626,6 +646,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
if
(
!
it
.
goChildren
()
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(buildHistoryList): <History> empty. ignore..."
<<
endl
;
return
;
}
...
...
@@ -645,6 +666,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi
.
fuse_id
=
conf
->
getSensorID
(
it
.
getProp
(
"fuse_id"
));
if
(
hi
.
fuse_id
==
DefaultObjectId
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(buildHistory): not found sensor ID for "
<<
it
.
getProp
(
"fuse_id"
)
<<
" history item id="
<<
it
.
getProp
(
"id"
)
...
...
@@ -661,6 +683,7 @@ void SharedMemory::buildHistoryList( xmlNode* cnode )
hi
.
fuse_val
=
it
.
getIntProp
(
"fuse_value"
);
}
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(buildHistory): add fuse_id="
<<
hi
.
fuse_id
<<
" fuse_val="
<<
hi
.
fuse_val
<<
" fuse_use_val="
<<
hi
.
fuse_use_val
...
...
@@ -695,6 +718,7 @@ void SharedMemory::checkHistoryFilter( UniXML_iterator& xit )
ai
.
id
=
conf
->
getSensorID
(
xit
.
getProp
(
"name"
));
if
(
ai
.
id
==
DefaultObjectId
)
{
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(checkHistoryFilter): not found sensor ID for "
<<
xit
.
getProp
(
"name"
)
<<
endl
;
continue
;
}
...
...
extensions/lib/IOBase.cc
View file @
e65a7f59
...
...
@@ -355,16 +355,16 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
// значение должно быть меньше lowLimit-чуствительность
if
(
it
->
ti
.
inverse
)
{
if
(
val
<=
(
it
->
ti
.
lowlimit
-
it
->
ti
.
sensibility
)
)
if
(
val
<=
it
->
ti
.
lowlimit
)
set
=
true
;
else
if
(
val
>=
(
it
->
ti
.
hilimit
+
it
->
ti
.
sensibility
)
)
else
if
(
val
>=
it
->
ti
.
hilimit
)
set
=
false
;
}
else
{
if
(
val
<=
(
it
->
ti
.
lowlimit
-
it
->
ti
.
sensibility
)
)
if
(
val
<=
it
->
ti
.
lowlimit
)
set
=
false
;
else
if
(
val
>=
(
it
->
ti
.
hilimit
+
it
->
ti
.
sensibility
)
)
else
if
(
val
>=
it
->
ti
.
hilimit
)
set
=
true
;
}
...
...
@@ -457,7 +457,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b
->
cal
.
maxRaw
=
0
;
b
->
cal
.
minCal
=
0
;
b
->
cal
.
maxCal
=
0
;
b
->
cal
.
sensibility
=
0
;
b
->
cal
.
precision
=
0
;
b
->
cdiagram
=
0
;
b
->
f_median
=
false
;
...
...
@@ -472,7 +471,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b
->
cal
.
maxRaw
=
it
.
getIntProp
(
"rmax"
);
b
->
cal
.
minCal
=
it
.
getIntProp
(
"cmin"
);
b
->
cal
.
maxCal
=
it
.
getIntProp
(
"cmax"
);
b
->
cal
.
sensibility
=
it
.
getIntProp
(
"sensibility"
);
b
->
cal
.
precision
=
it
.
getIntProp
(
"precision"
);
int
f_size
=
def_filtersize
;
...
...
@@ -542,7 +540,6 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b
->
ti
.
lowlimit
=
it
.
getIntProp
(
"lowlimit"
);
b
->
ti
.
hilimit
=
it
.
getIntProp
(
"hilimit"
);
b
->
ti
.
sensibility
=
it
.
getIntProp
(
"sensibility"
);
b
->
ti
.
inverse
=
it
.
getIntProp
(
"inverse"
);
}
}
...
...
include/IOController.h
View file @
e65a7f59
...
...
@@ -102,7 +102,6 @@ class IOController:
struct
USensorInfo
;
typedef
std
::
map
<
UniSetTypes
::
KeyType
,
USensorInfo
>
IOStateList
;
// ================== Достпуные сигналы =================
/*!
// \warning В сигнале напрямую передаётся итератор (т.е. по сути указатель на внутреннюю структуру!)
...
...
@@ -193,11 +192,18 @@ class IOController:
virtual
bool
disactivateObject
();
virtual
bool
activateObject
();
/*! Начальная инициализация (выставление значений) */
virtual
void
activateInit
();
/*! регистрация датчиков, за информацию о которых отвечает данный IOController */
virtual
void
sensorsRegistration
(){};
/*! удаление из репозитория датчиков за информацию о которых отвечает данный IOController */
virtual
void
sensorsUnregistration
();
typedef
sigc
::
signal
<
void
,
IOStateList
::
iterator
&
,
IOController
*>
InitSignal
;
// signal по изменению определённого датчика
inline
InitSignal
signal_init
(){
return
sigInit
;
}
/*! регистрация датчика
force=true - не проверять на дублирование (оптимизация)
*/
...
...
@@ -230,7 +236,6 @@ class IOController:
ai
.
ci
.
maxRaw
=
0
;
ai
.
ci
.
minCal
=
0
;
ai
.
ci
.
maxCal
=
0
;
ai
.
ci
.
sensibility
=
0
;
ai
.
ci
.
precision
=
0
;
}
return
ai
;
...
...
@@ -275,6 +280,7 @@ class IOController:
friend
class
NCRestorer
;
ChangeSignal
sigAnyChange
;
ChangeSignal
sigAnyUndefChange
;
InitSignal
sigInit
;
IOStateList
ioList
;
/*!< список с текущим состоянием аналоговых входов/выходов */
UniSetTypes
::
uniset_rwmutex
ioMutex
;
/*!< замок для блокирования совместного доступа к ioList */
...
...
include/IONotifyController.h
View file @
e65a7f59
...
...
@@ -63,7 +63,6 @@ class NCRestorer;
и оставлены для совместимости со старыми интерфейсами.
... продолжение следует...
\section sec_NC_Consumers Заказчики
В качестве "заказчиков" могут выступать любые UniSet-объекты (UniSetObject),
обладающие "обратным адресом" (идентификатором), по которому присылается
...
...
@@ -143,8 +142,7 @@ class IONotifyController:
virtual
void
askThreshold
(
const
IOController_i
::
SensorInfo
&
si
,
const
UniSetTypes
::
ConsumerInfo
&
ci
,
UniSetTypes
::
ThresholdId
tid
,
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
CORBA
::
Long
sensibility
,
UniversalIO
::
UIOCommand
cmd
);
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
UniversalIO
::
UIOCommand
cmd
);
virtual
UniSetTypes
::
IDSeq
*
askSensorsSeq
(
const
UniSetTypes
::
IDSeq
&
lst
,
const
UniSetTypes
::
ConsumerInfo
&
ci
,
UniversalIO
::
UIOCommand
cmd
);
...
...
@@ -175,7 +173,7 @@ class IONotifyController:
struct
ThresholdInfoExt
:
public
IONotifyController_i
::
ThresholdInfo
{
ThresholdInfoExt
(
UniSetTypes
::
ThresholdId
tid
,
CORBA
::
Long
low
,
CORBA
::
Long
hi
,
CORBA
::
Long
sb
,
ThresholdInfoExt
(
UniSetTypes
::
ThresholdId
tid
,
CORBA
::
Long
low
,
CORBA
::
Long
hi
,
UniSetTypes
::
ObjectId
_sid
=
UniSetTypes
::
DefaultObjectId
,
bool
inv
=
false
)
:
sid
(
_sid
),
...
...
@@ -184,21 +182,16 @@ class IONotifyController:
id
=
tid
;
hilimit
=
hi
;
lowlimit
=
low
;
sensibility
=
sb
;
state
=
IONotifyController_i
::
NormalThreshold
;
}
ConsumerList
clst
;
/*! идентификатор дискретного датчика
связанного с данным порогом
*/
/*! идентификатор дискретного датчика связанного с данным порогом */
UniSetTypes
::
ObjectId
sid
;
/*! итератор в списке датчиков
(для оптимально-быстрого доступа)
*/
IOController
::
IOStateList
::
iterator
itSID
;
/*! итератор в списке датчиков (для оптимально-быстрого доступа) */
IOController
::
IOStateList
::
iterator
sit
;
/*! инверсная логика */
bool
inverse
;
...
...
@@ -207,12 +200,10 @@ class IONotifyController:
{
return
((
id
==
r
.
id
)
&&
(
hilimit
==
r
.
hilimit
)
&&
(
lowlimit
==
r
.
lowlimit
)
&&
(
sensibility
==
r
.
sensibility
)
);
(
lowlimit
==
r
.
lowlimit
)
);
}
};
typedef
std
::
list
<
ThresholdInfoExt
>
ThresholdExtList
;
/*! массив пар датчик->список потребителей */
...
...
@@ -237,6 +228,7 @@ class IONotifyController:
protected
:
IONotifyController
();
virtual
bool
activateObject
();
virtual
void
initItem
(
IOStateList
::
iterator
&
it
,
IOController
*
ic
);
// ФИЛЬТРЫ
bool
myIOFilter
(
const
USensorInfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
...
...
@@ -251,7 +243,6 @@ class IONotifyController:
//! поиск информации о пороговом датчике
ThresholdExtList
::
iterator
findThreshold
(
UniSetTypes
::
KeyType
k
,
UniSetTypes
::
ThresholdId
tid
);
//! сохранение информации об изменении состояния датчика в базу
virtual
void
loggingInfo
(
UniSetTypes
::
SensorMessage
&
sm
);
...
...
include/UInterface.h
View file @
e65a7f59
...
...
@@ -124,12 +124,12 @@ class UInterface
//! Заказ информации об изменении дискретного датчика
void
askThreshold
(
UniSetTypes
::
ObjectId
sensorId
,
UniSetTypes
::
ThresholdId
tid
,
UniversalIO
::
UIOCommand
cmd
,
CORBA
::
Long
lowLimit
=
0
,
CORBA
::
Long
hiLimit
=
0
,
CORBA
::
Long
sensibility
=
0
,
CORBA
::
Long
lowLimit
=
0
,
CORBA
::
Long
hiLimit
=
0
,
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
);
void
askRemoteThreshold
(
UniSetTypes
::
ObjectId
sensorId
,
UniSetTypes
::
ObjectId
node
,
UniSetTypes
::
ThresholdId
thresholdId
,
UniversalIO
::
UIOCommand
cmd
,
CORBA
::
Long
lowLimit
=
0
,
CORBA
::
Long
hiLimit
=
0
,
CORBA
::
Long
sensibility
=
0
,
CORBA
::
Long
lowLimit
=
0
,
CORBA
::
Long
hiLimit
=
0
,
UniSetTypes
::
ObjectId
backid
=
UniSetTypes
::
DefaultObjectId
);
// ---------------------------------------------------------------
...
...
include/UniSetManager.h
View file @
e65a7f59
...
...
@@ -62,7 +62,6 @@ class UniSetManager:
UniSetManager
(
const
std
::
string
&
name
,
const
std
::
string
&
section
);
virtual
~
UniSetManager
();
virtual
UniSetTypes
::
ObjectType
getType
(){
return
UniSetTypes
::
getObjectType
(
"UniSetManager"
);
}
// ------ функции объявленные в интерфейсе(IDL) ------
...
...
@@ -114,7 +113,6 @@ class UniSetManager:
int
objectsCount
();
// количество подчиненных объектов
PortableServer
::
POA_ptr
getPOA
(){
return
PortableServer
::
POA
::
_duplicate
(
poa
);
}
PortableServer
::
POAManager_ptr
getPOAManager
(){
return
PortableServer
::
POAManager
::
_duplicate
(
pman
);
}
...
...
@@ -136,7 +134,6 @@ class UniSetManager:
//! \note Переопределяя не забывайте вызвать базовую
virtual
bool
disactivateObject
();
typedef
UniSetManagerList
::
iterator
MListIterator
;
int
getObjectsInfo
(
UniSetManager
*
mngr
,
UniSetTypes
::
SimpleInfoSeq
*
seq
,
...
...
include/UniSetObserver.h
deleted
100644 → 0
View file @
db321372
/* This file is part of the UniSet project
* Copyright (c) 2002 Free Software Foundation, Inc.
* Copyright (c) 2002 Pavel Vainerman
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// --------------------------------------------------------------------------
/*! \file
* \author Pavel Vainerman
*/
// --------------------------------------------------------------------------
#ifndef ProxyManager_H_
#define ProxyManager_H_
//---------------------------------------------------------------------------
#include <map>
#include "UniSetObject.h"
//----------------------------------------------------------------------------
class
PassiveObject
;
//----------------------------------------------------------------------------
/*! \class ProxyManager
* Менеджер пассивных объектов, который выступает вместо них во всех внешних связях....
*/
class
ProxyManager
:
public
UniSetObject
{
public
:
ProxyManager
(
UniSetTypes
::
ObjectId
id
);
~
ProxyManager
();
void
attachObject
(
PassiveObject
*
po
,
UniSetTypes
::
ObjectId
id
);
void
detachObject
(
UniSetTypes
::
ObjectId
id
);
UInterface
*
uin
;
protected
:
ProxyManager
();
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
virtual
void
allMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
virtual
bool
activateObject
();
virtual
bool
disactivateObject
();
private
:
typedef
std
::
map
<
UniSetTypes
::
ObjectId
,
PassiveObject
*>
PObjectMap
;
PObjectMap
omap
;
};
//----------------------------------------------------------------------------------------
#endif // ProxyManager
//----------------------------------------------------------------------------------------
include/UniSetTypes.h
View file @
e65a7f59
...
...
@@ -60,14 +60,21 @@ namespace UniSetTypes
/*! генератор уникального положительного ключа
* Уникальность гарантируется только для пары значений
* id и node.
* \warning что тут у нас с переполнением..
* \warning Уникальность генерируемого ключа еще не проверялась,
но нареканий по использованию тоже не было :)
* \todo Желательно продумать что-нибудь с использованием хэш.
*/
inline
static
KeyType
key
(
UniSetTypes
::
ObjectId
id
,
UniSetTypes
::
ObjectId
node
)
inline
static
KeyType
key
(
const
UniSetTypes
::
ObjectId
id
,
const
UniSetTypes
::
ObjectId
node
)
{
return
KeyType
((
id
*
node
)
+
(
id
+
2
*
node
));
}
inline
static
KeyType
key
(
const
IOController_i
::
SensorInfo
&
si
)
{
return
key
(
si
.
id
,
si
.
node
);
}
typedef
std
::
list
<
std
::
string
>
ListObjectName
;
/*!< Список объектов типа ObjectName */
typedef
ObjectId
SysId
;
...
...
src/Interfaces/UInterface.cc
View file @
e65a7f59
...
...
@@ -1219,15 +1219,15 @@ string UInterface::set_err(const string& pre, UniSetTypes::ObjectId id, UniSetTy
// --------------------------------------------------------------------------------------------
void
UInterface
::
askThreshold
(
UniSetTypes
::
ObjectId
sid
,
UniSetTypes
::
ThresholdId
tid
,
UniversalIO
::
UIOCommand
cmd
,
CORBA
::
Long
low
,
CORBA
::
Long
hi
,
CORBA
::
Long
sb
,
CORBA
::
Long
low
,
CORBA
::
Long
hi
,
UniSetTypes
::
ObjectId
backid
)
{
askRemoteThreshold
(
sid
,
uconf
->
getLocalNode
(),
tid
,
cmd
,
low
,
hi
,
sb
,
backid
);
askRemoteThreshold
(
sid
,
uconf
->
getLocalNode
(),
tid
,
cmd
,
low
,
hi
,
backid
);
}
// --------------------------------------------------------------------------------------------
void
UInterface
::
askRemoteThreshold
(
UniSetTypes
::
ObjectId
sid
,
UniSetTypes
::
ObjectId
node
,
UniSetTypes
::
ThresholdId
tid
,
UniversalIO
::
UIOCommand
cmd
,
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
CORBA
::
Long
sensibility
,
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
UniSetTypes
::
ObjectId
backid
)
{
if
(
backid
==
UniSetTypes
::
DefaultObjectId
)
...
...
@@ -1264,7 +1264,7 @@ void UInterface::askRemoteThreshold( UniSetTypes::ObjectId sid, UniSetTypes::Obj
ci
->
id
=
backid
;
ci
->
node
=
uconf
->
getLocalNode
();
inc
->
askThreshold
(
si
,
ci
,
tid
,
lowLimit
,
hiLimit
,
sensibility
,
cmd
);
inc
->
askThreshold
(
si
,
ci
,
tid
,
lowLimit
,
hiLimit
,
cmd
);
return
;
}
catch
(
CORBA
::
TRANSIENT
){}
...
...
src/ObjectRepository/UniSetActivator.cc
View file @
e65a7f59
...
...
@@ -248,14 +248,15 @@ void UniSetActivator::stop()
if
(
ulog
.
is_system
()
)
ulog
.
system
()
<<
myname
<<
"(stop): discard request ok."
<<
endl
;
/*
try
{
if
(
ulog
.
is_system
()
)
ulog
.
system
()
<<
myname
<<
"(stop):: shutdown orb... "
<<
endl
;
orb
->
shutdown
(
false
);
}
catch
(...){}
*/
if
(
ulog
.
is_system
()
)
ulog
.
system
()
<<
myname
<<
"(stop): shutdown ok."
<<
endl
;
}
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
e65a7f59
...
...
@@ -333,8 +333,7 @@ using namespace UniSetTypes;
{
return
os
<<
" rmin="
<<
c
.
minRaw
<<
" rmax="
<<
c
.
maxRaw
<<
" cmin="
<<
c
.
minCal
<<
" cmax="
<<
c
.
maxCal
<<
" precision="
<<
c
.
precision
<<
" sensibility="
<<
c
.
sensibility
;
<<
" precision="
<<
c
.
precision
;
}
// ------------------------------------------------------------------------------------------
bool
UniSetTypes
::
check_filter
(
UniXML_iterator
&
it
,
const
std
::
string
f_prop
,
const
std
::
string
f_val
)
...
...
src/Processes/IOController.cc
View file @
e65a7f59
...
...
@@ -64,6 +64,10 @@ bool IOController::activateObject()
{
bool
res
=
UniSetManager
::
activateObject
();
sensorsRegistration
();
// Начальная инициализация
activateInit
();
return
res
;
}
// ------------------------------------------------------------------------------------------
...
...
@@ -85,11 +89,39 @@ void IOController::sensorsUnregistration()
}
catch
(
Exception
&
ex
)
{
if
(
ulog
.
is_crit
()
)
ulog
.
crit
()
<<
myname
<<
"(sensorsUnregistration): "
<<
ex
<<
endl
;
}
catch
(...){}
}
}
// ------------------------------------------------------------------------------------------
void
IOController
::
activateInit
()
{
// Разрегистрируем аналоговые датчики
for
(
IOStateList
::
iterator
li
=
ioList
.
begin
();
li
!=
ioList
.
end
();
++
li
)
{
try
{
USensorInfo
&
s
(
li
->
second
);
// Проверка зависимостей
if
(
s
.
d_si
.
id
!=
DefaultObjectId
)
{
IOStateList
::
iterator
d_it
=
myiofind
(
UniSetTypes
::
key
(
s
.
d_si
)
);
if
(
d_it
!=
ioEnd
()
)
s
.
checkDepend
(
d_it
,
this
);
}
sigInit
.
emit
(
li
,
this
);
}
catch
(
Exception
&
ex
)
{
if
(
ulog
.
is_crit
()
)
ulog
.
crit
()
<<
myname
<<
"(activateInit): "
<<
ex
<<
endl
;
}
catch
(...){}
}
}
// ------------------------------------------------------------------------------------------
CORBA
::
Long
IOController
::
getValue
(
const
IOController_i
::
SensorInfo
&
si
)
...
...
src/Processes/IONotifyController.cc
View file @
e65a7f59
...
...
@@ -66,6 +66,7 @@ IONotifyController::IONotifyController( ObjectId id, NCRestorer* d ):
maxAttemtps
(
conf
->
getPIntField
(
"ConsumerMaxAttempts"
,
5
))
{
signal_change_undefined_state
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
IONotifyController
::
onChangeUndefinedState
));
signal_init
().
connect
(
sigc
::
mem_fun
(
*
this
,
&
IONotifyController
::
initItem
));
// добавляем фильтры
addIOFilter
(
sigc
::
mem_fun
(
this
,
&
IONotifyController
::
myIOFilter
)
);
...
...
@@ -309,18 +310,12 @@ void IONotifyController::ask(AskMap& askLst, const IOController_i::SensorInfo& s
}
}
// ------------------------------------------------------------------------------------------
bool
IONotifyController
::
myIOFilter
(
const
USensorInfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
)
bool
IONotifyController
::
myIOFilter
(
const
USensorInfo
&
ai
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
)
{
if
(
ai
.
value
==
newvalue
)
return
false
;
if
(
ai
.
ci
.
sensibility
<=
0
)
return
true
;
if
(
abs
(
ai
.
value
-
newvalue
)
<
ai
.
ci
.
sensibility
)
return
false
;
return
true
;
}
// ------------------------------------------------------------------------------------------
...
...
@@ -453,8 +448,11 @@ void IONotifyController::loggingInfo(UniSetTypes::SensorMessage& sm)
// --------------------------------------------------------------------------------------------------------------
bool
IONotifyController
::
activateObject
()
{
IOController
::
activateObject
();
// сперва вычитаем датчиков и заказчиков..
readDump
();
// а потом уже собственно активация..
IOController
::
activateObject
();
return
true
;
}
// --------------------------------------------------------------------------------------------------------------
...
...
@@ -472,6 +470,14 @@ void IONotifyController::readDump()
}
}
// --------------------------------------------------------------------------------------------------------------
void
IONotifyController
::
initItem
(
IOStateList
::
iterator
&
li
,
IOController
*
ic
)
{
USensorInfo
&
s
(
li
->
second
);
if
(
s
.
type
==
UniversalIO
::
AI
||
s
.
type
==
UniversalIO
::
AO
)
checkThreshold
(
li
,
s
.
si
,
false
);
}
// ------------------------------------------------------------------------------------------
void
IONotifyController
::
dumpOrdersList
(
const
IOController_i
::
SensorInfo
&
si
,
const
IONotifyController
::
ConsumerList
&
lst
)
{
...
...
@@ -515,8 +521,7 @@ void IONotifyController::dumpThresholdList(const IOController_i::SensorInfo& si,
void
IONotifyController
::
askThreshold
(
const
IOController_i
::
SensorInfo
&
si
,
const
UniSetTypes
::
ConsumerInfo
&
ci
,
UniSetTypes
::
ThresholdId
tid
,
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
CORBA
::
Long
sb
,
UniversalIO
::
UIOCommand
cmd
)
CORBA
::
Long
lowLimit
,
CORBA
::
Long
hiLimit
,
UniversalIO
::
UIOCommand
cmd
)
{
if
(
lowLimit
>
hiLimit
)
throw
IONotifyController_i
::
BadRange
();
...
...
@@ -531,8 +536,8 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
// поиск датчика в списке
UniSetTypes
::
KeyType
skey
(
key
(
si
.
id
,
si
.
node
)
);
AskThresholdMap
::
iterator
it
=
askTMap
.
find
(
skey
);
ThresholdInfoExt
ti
(
tid
,
lowLimit
,
hiLimit
,
sb
);
ti
.
itSID
=
myioEnd
();
ThresholdInfoExt
ti
(
tid
,
lowLimit
,
hiLimit
);
ti
.
sit
=
myioEnd
();
switch
(
cmd
)
{
...
...
@@ -605,7 +610,7 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
sm
.
ci
=
li
->
second
.
ci
;
// Проверка нижнего предела
if
(
val
<=
(
lowLimit
-
sb
)
)
if
(
val
<=
lowLimit
)
{
sm
.
threshold
=
false
;
CORBA
::
Object_var
op
=
ui
.
resolve
(
ci
.
id
,
ci
.
node
);
...
...
@@ -614,7 +619,7 @@ void IONotifyController::askThreshold(const IOController_i::SensorInfo& si, cons
ref
->
push
(
sm
.
transport_msg
());
}
// Проверка верхнего предела
else
if
(
val
>=
(
hiLimit
+
sb
)
)
else
if
(
val
>=
hiLimit
)
{
sm
.
threshold
=
true
;
CORBA
::
Object_var
op
=
ui
.
resolve
(
ci
.
id
,
ci
.
node
);
...
...
@@ -691,7 +696,6 @@ bool IONotifyController::addThreshold(ThresholdExtList& lst, ThresholdInfoExt& t
addConsumer
(
ti
.
clst
,
ci
);
// запоминаем начальное время
struct
timeval
tm
;
struct
timezone
tz
;
...
...
@@ -766,9 +770,11 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
for
(
ThresholdExtList
::
iterator
it
=
lst
->
second
.
list
.
begin
();
it
!=
lst
->
second
.
list
.
end
();
++
it
)
{
// Используем здесь sm.value чтобы не делать ещё раз lock на li->second.value
// Проверка нижнего предела
// значение должно быть меньше lowLimit-чуствительность
if
(
li
->
second
.
value
<=
(
it
->
lowlimit
-
it
->
sensibility
)
)
if
(
sm
.
value
<=
it
->
lowlimit
)
{
if
(
it
->
state
==
IONotifyController_i
::
LowThreshold
)
continue
;
...
...
@@ -793,7 +799,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if
(
it
->
inverse
)
state
^=
1
;
localSetValue
(
it
->
itSID
,
SensorInfo
(
it
->
sid
),(
state
?
1
:
0
),
getId
());
localSetValue
(
it
->
sit
,
SensorInfo
(
it
->
sid
),(
state
?
1
:
0
),
getId
());
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
@@ -808,7 +814,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
}
// Проверка верхнего предела
// значение должно быть больше hiLimit+чуствительность
else
if
(
li
->
second
.
value
>=
(
it
->
hilimit
+
it
->
sensibility
)
)
else
if
(
sm
.
value
>=
it
->
hilimit
)
{
if
(
it
->
state
==
IONotifyController_i
::
HiThreshold
)
continue
;
...
...
@@ -832,7 +838,7 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
if
(
it
->
inverse
)
state
^=
1
;
localSetValue
(
it
->
itSID
,
SensorInfo
(
it
->
sid
),(
state
?
1
:
0
),
getId
());
localSetValue
(
it
->
sit
,
SensorInfo
(
it
->
sid
),(
state
?
1
:
0
),
getId
());
}
catch
(
UniSetTypes
::
Exception
&
ex
)
{
...
...
@@ -849,7 +855,6 @@ void IONotifyController::checkThreshold( IOStateList::iterator& li,
it
->
state
=
IONotifyController_i
::
NormalThreshold
;
}
}
// unlock
}
// --------------------------------------------------------------------------------------------------------------
IONotifyController
::
ThresholdExtList
::
iterator
IONotifyController
::
findThreshold
(
UniSetTypes
::
KeyType
key
,
UniSetTypes
::
ThresholdId
tid
)
...
...
@@ -910,7 +915,6 @@ IONotifyController_i::ThresholdsListSeq* IONotifyController::getThresholdsList()
(
*
res
)[
i
].
tlist
[
k
].
id
=
it2
->
id
;
(
*
res
)[
i
].
tlist
[
k
].
hilimit
=
it2
->
hilimit
;
(
*
res
)[
i
].
tlist
[
k
].
lowlimit
=
it2
->
lowlimit
;
(
*
res
)[
i
].
tlist
[
k
].
sensibility
=
it2
->
sensibility
;
(
*
res
)[
i
].
tlist
[
k
].
state
=
it2
->
state
;
(
*
res
)[
i
].
tlist
[
k
].
tv_sec
=
it2
->
tv_sec
;
(
*
res
)[
i
].
tlist
[
k
].
tv_usec
=
it2
->
tv_usec
;
...
...
src/Processes/NCRestorer.cc
View file @
e65a7f59
...
...
@@ -65,6 +65,7 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break
;
default
:
if
(
ulog
.
is_crit
()
)
ulog
.
crit
()
<<
ic
->
getName
()
<<
"(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА! -> "
<<
conf
->
oind
->
getNameById
(
inf
.
si
.
id
,
inf
.
si
.
node
)
<<
endl
;
return
;
...
...
@@ -84,7 +85,8 @@ void NCRestorer::addlist( IONotifyController* ic, SInfo& inf, IONotifyController
break
;
default
:
ulog
.
crit
()
<<
ic
->
getName
()
<<
"(askDumper::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> "
if
(
ulog
.
is_crit
()
)
ulog
.
crit
()
<<
ic
->
getName
()
<<
"(NCRestorer::addlist): НЕИЗВЕСТНЫЙ ТИП ДАТЧИКА!-> "
<<
conf
->
oind
->
getNameById
(
inf
.
si
.
id
,
inf
.
si
.
node
)
<<
endl
;
break
;
}
...
...
@@ -120,7 +122,7 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
// default init iterators
for
(
IONotifyController
::
ThresholdExtList
::
iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
it
->
itSID
=
ic
->
myioEnd
();
it
->
sit
=
ic
->
myioEnd
();
UniSetTypes
::
KeyType
k
(
key
(
inf
.
si
.
id
,
inf
.
si
.
node
)
);
ic
->
askTMap
[
k
].
si
=
inf
.
si
;
...
...
@@ -128,6 +130,8 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
ic
->
askTMap
[
k
].
list
=
lst
;
ic
->
askTMap
[
k
].
ait
=
ic
->
myioEnd
();
// Начальная инициализация делается в IOController (IONotifyContoller) в момент "активации". см. IOController::activateInit()
#if 0
try
{
switch( inf.type )
...
...
@@ -148,22 +152,25 @@ void NCRestorer::addthresholdlist( IONotifyController* ic, SInfo& inf, IONotifyC
break;
}
}
catch
(
Exception
&
ex
)
catch(
Exception& ex
)
{
if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): " << ex
<< " для " << conf->oind->getNameById(inf.si.id, inf.si.node) << endl;
throw;
}
catch( CORBA::SystemException& ex )
{
if( ulog.is_warn() )
ulog.warn() << ic->getName() << "(NCRestorer::addthresholdlist): "
<< conf->oind->getNameById(inf.si.id,inf.si.node) << " недоступен!!(CORBA::SystemException): "
<< ex.NP_minorString() << endl;
throw;
}
#endif
}
// ------------------------------------------------------------------------------------------
NCRestorer
::
SInfo
&
NCRestorer
::
SInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
)
NCRestorer
::
SInfo
&
NCRestorer
::
SInfo
::
operator
=
(
IOController_i
::
SensorIOInfo
&
inf
)
{
this
->
si
=
inf
.
si
;
this
->
type
=
inf
.
type
;
...
...
@@ -199,6 +206,6 @@ void NCRestorer::init_depends_signals( IONotifyController* ic )
IOController
::
ChangeSignal
s
=
ic
->
signal_change_value
(
it
->
second
.
d_si
);
s
.
connect
(
sigc
::
mem_fun
(
&
it
->
second
,
&
IOController
::
USensorInfo
::
checkDepend
)
);
}
}
}
// -----------------------------------------------------------------------------
src/Processes/NCRestorer_XML.cc
View file @
e65a7f59
...
...
@@ -115,6 +115,7 @@ void NCRestorer_XML::read_list( UniXML& xml, xmlNode* node, IONotifyController*
if
(
!
getSensorInfo
(
xml
,
it
,
inf
)
)
{
if
(
ulog
.
is_warn
()
)
ulog
.
warn
()
<<
ic
->
getName
()
<<
"(read_list): не смог получить информацию по датчику "
<<
endl
;
continue
;
}
...
...
@@ -265,14 +266,7 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
else
if
(
prior
==
"Super"
)
inf
.
priority
=
Message
::
Super
;
else
{
inf
.
priority
=
Message
::
Medium
;
if
(
ulog
.
is_info
()
)
{
ulog
.
info
()
<<
"(NCRestorer_XML:getSensorInfo): не указан приоритет для "
<<
xml
.
getProp
(
it
,
"name"
)
<<
endl
;
}
}
inf
.
type
=
UniSetTypes
::
getIOType
(
xml
.
getProp
(
it
,
"iotype"
));
if
(
inf
.
type
==
UniversalIO
::
UnknownIOType
)
...
...
@@ -289,7 +283,6 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf
.
ci
.
maxRaw
=
xml
.
getIntProp
(
it
,
"rmax"
);
inf
.
ci
.
minCal
=
xml
.
getIntProp
(
it
,
"cmin"
);
inf
.
ci
.
maxCal
=
xml
.
getIntProp
(
it
,
"cmax"
);
inf
.
ci
.
sensibility
=
xml
.
getIntProp
(
it
,
"sensibility"
);
inf
.
ci
.
precision
=
xml
.
getIntProp
(
it
,
"precision"
);
}
else
...
...
@@ -298,7 +291,6 @@ bool NCRestorer_XML::getSensorInfo( UniXML& xml, xmlNode* it, SInfo& inf )
inf
.
ci
.
maxRaw
=
0
;
inf
.
ci
.
minCal
=
0
;
inf
.
ci
.
maxCal
=
0
;
inf
.
ci
.
sensibility
=
0
;
inf
.
ci
.
precision
=
0
;
}
...
...
@@ -379,7 +371,6 @@ void NCRestorer_XML::read_thresholds(UniXML& xml, xmlNode* node, IONotifyControl
{
ulog
.
info
()
<<
"(read_thresholds):
\t
threshold low="
<<
ti
.
lowlimit
<<
"
\t
hi="
<<
ti
.
hilimit
<<
"
\t
sb="
<<
ti
.
sensibility
<<
"
\t
sid="
<<
ti
.
sid
<<
"
\t
inverse="
<<
ti
.
inverse
<<
endl
<<
flush
;
...
...
@@ -482,7 +473,6 @@ bool NCRestorer_XML::getThresholdInfo( UniXML& xml,xmlNode* node,
ti
.
id
=
uit
.
getIntProp
(
"id"
);
ti
.
lowlimit
=
uit
.
getIntProp
(
"lowlimit"
);
ti
.
hilimit
=
uit
.
getIntProp
(
"hilimit"
);
ti
.
sensibility
=
uit
.
getIntProp
(
"sensibility"
);
ti
.
inverse
=
uit
.
getIntProp
(
"inverse"
);
ti
.
state
=
IONotifyController_i
::
NormalThreshold
;
return
true
;
...
...
src/Various/MessageType.cc
View file @
e65a7f59
...
...
@@ -85,7 +85,6 @@ tid(UniSetTypes::DefaultThresholdId)
ci
.
maxRaw
=
0
;
ci
.
minCal
=
0
;
ci
.
maxCal
=
0
;
ci
.
sensibility
=
0
;
ci
.
precision
=
0
;
}
...
...
src/Various/SViewer.cc
View file @
e65a7f59
...
...
@@ -286,7 +286,7 @@ void SViewer::updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tls
IONotifyController_i
::
ThresholdInfo
*
ti
=
&
tlst
[
i
].
tlist
[
k
];
cout
<<
"
\t
("
<<
setw
(
3
)
<<
ti
->
id
<<
") | "
<<
ti
->
state
<<
" | hi: "
<<
setw
(
5
)
<<
ti
->
hilimit
;
cout
<<
" | low: "
<<
setw
(
5
)
<<
ti
->
lowlimit
;
cout
<<
" | sb: "
<<
setw
(
5
)
<<
ti
->
sensibility
<<
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