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
72f3dddf
Commit
72f3dddf
authored
Dec 18, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(2.0): подправил IOControl
parent
9604017f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
47 deletions
+43
-47
IOControl.cc
extensions/IOControl/IOControl.cc
+42
-46
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
No files found.
extensions/IOControl/IOControl.cc
View file @
72f3dddf
...
@@ -50,11 +50,6 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -50,11 +50,6 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
testmode
(
tmNone
),
testmode
(
tmNone
),
prev_testmode
(
tmNone
)
prev_testmode
(
tmNone
)
{
{
// {
// string myfullname = conf->oind->getNameById(id);
// myname = ORepHelpers::getShortName(myfullname.c_str());
// }
string
cname
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-confnode"
,
myname
);
string
cname
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-confnode"
,
myname
);
cnode
=
conf
->
getNode
(
cname
);
cnode
=
conf
->
getNode
(
cname
);
if
(
cnode
==
NULL
)
if
(
cnode
==
NULL
)
...
@@ -121,8 +116,9 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -121,8 +116,9 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
if
(
!
stype
.
empty
()
)
if
(
!
stype
.
empty
()
)
{
{
dlog
.
info
()
<<
myname
if
(
dlog
.
is_info
()
)
<<
"(init): card"
<<
i
dlog
.
info
()
<<
myname
<<
"(init): card"
<<
i
<<
" subdev"
<<
s
<<
" set type "
<<
stype
<<
endl
;
<<
" subdev"
<<
s
<<
" set type "
<<
stype
<<
endl
;
cards
[
i
]
->
configureSubdev
(
s
-
1
,
st
);
cards
[
i
]
->
configureSubdev
(
s
-
1
,
st
);
...
@@ -132,7 +128,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -132,7 +128,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
}
}
}
}
dlog
.
info
()
<<
myname
<<
"(init): result numcards="
<<
cards
.
size
()
<<
endl
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): result numcards="
<<
cards
.
size
()
<<
endl
;
polltime
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-polltime"
,
it
.
getProp
(
"polltime"
));
polltime
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-polltime"
,
it
.
getProp
(
"polltime"
));
if
(
!
polltime
)
if
(
!
polltime
)
...
@@ -153,11 +150,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -153,11 +150,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
": Unkown ID for "
<<
testlamp
;
err
<<
myname
<<
": Unkown ID for "
<<
testlamp
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
dlog
.
info
()
<<
myname
<<
"(init): testLamp_S='"
<<
testlamp
<<
"'"
<<
endl
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): testLamp_S='"
<<
testlamp
<<
"'"
<<
endl
;
}
}
string
tmode
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-test-mode"
,
it
.
getProp
(
"testmode_as"
));
string
tmode
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-test-mode"
,
it
.
getProp
(
"testmode_as"
));
...
@@ -168,11 +167,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -168,11 +167,13 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
": Unknown ID for "
<<
tmode
;
err
<<
myname
<<
": Unknown ID for "
<<
tmode
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
dlog
.
info
()
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
}
}
shm
=
new
SMInterface
(
icID
,
&
ui
,
myid
,
ic
);
shm
=
new
SMInterface
(
icID
,
&
ui
,
myid
,
ic
);
...
@@ -181,7 +182,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -181,7 +182,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
s_field
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-field"
);
s_field
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-field"
);
s_fvalue
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-value"
);
s_fvalue
=
conf
->
getArgParam
(
"--"
+
prefix
+
"-s-filter-value"
);
dlog
.
info
()
<<
myname
<<
"(init): read s_field='"
<<
s_field
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): read s_field='"
<<
s_field
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
int
blink_msec
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-blink-time"
,
it
.
getProp
(
"blink-time"
),
300
);
int
blink_msec
=
conf
->
getArgPInt
(
"--"
+
prefix
+
"-blink-time"
,
it
.
getProp
(
"blink-time"
),
300
);
...
@@ -205,11 +207,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -205,11 +207,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
if
(
sidTestSMReady
==
DefaultObjectId
)
if
(
sidTestSMReady
==
DefaultObjectId
)
{
{
sidTestSMReady
=
conf
->
getSensorID
(
"TestMode_S"
);
sidTestSMReady
=
conf
->
getSensorID
(
"TestMode_S"
);
dlog
.
warn
()
<<
myname
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(init): Unknown ID for sm-ready-test-sid (--"
<<
prefix
<<
"-sm-ready-test-sid)."
<<
"(init): Unknown ID for sm-ready-test-sid (--"
<<
prefix
<<
"-sm-ready-test-sid)."
<<
" Use 'TestMode_S'"
<<
endl
;
<<
" Use 'TestMode_S'"
<<
endl
;
}
}
else
else
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): test-sid: "
<<
sm_ready_sid
<<
endl
;
dlog
.
info
()
<<
myname
<<
"(init): test-sid: "
<<
sm_ready_sid
<<
endl
;
...
@@ -222,7 +225,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -222,7 +225,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
": Not found ID for 'HeartBeat' "
<<
heart
;
err
<<
myname
<<
": Not found ID for 'HeartBeat' "
<<
heart
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
...
@@ -283,7 +287,8 @@ void IOControl::execute()
...
@@ -283,7 +287,8 @@ void IOControl::execute()
}
}
maxHalf
=
maxItem
/
2
;
maxHalf
=
maxItem
/
2
;
dlog
.
info
()
<<
myname
<<
"(init): iomap size = "
<<
iomap
.
size
()
<<
endl
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): iomap size = "
<<
iomap
.
size
()
<<
endl
;
cerr
<<
myname
<<
"(iomap size): "
<<
iomap
.
size
()
<<
endl
;
cerr
<<
myname
<<
"(iomap size): "
<<
iomap
.
size
()
<<
endl
;
...
@@ -310,7 +315,7 @@ void IOControl::execute()
...
@@ -310,7 +315,7 @@ void IOControl::execute()
}
}
}
}
if
(
!
activated
)
if
(
!
activated
&&
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(execute): ************* don`t activate?! ************"
<<
endl
;
dlog
.
crit
()
<<
myname
<<
"(execute): ************* don`t activate?! ************"
<<
endl
;
try
try
...
@@ -378,16 +383,19 @@ void IOControl::execute()
...
@@ -378,16 +383,19 @@ void IOControl::execute()
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): "
<<
ex
<<
endl
;
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): "
<<
ex
<<
endl
;
}
}
catch
(
CORBA
::
SystemException
&
ex
)
catch
(
CORBA
::
SystemException
&
ex
)
{
{
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): CORBA::SystemException: "
if
(
dlog
.
is_level3
()
)
<<
ex
.
NP_minorString
()
<<
endl
;
dlog
.
level3
()
<<
myname
<<
"(execute): CORBA::SystemException: "
<<
ex
.
NP_minorString
()
<<
endl
;
}
}
catch
(...)
catch
(...)
{
{
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): catch ..."
<<
endl
;
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): catch ..."
<<
endl
;
}
}
if
(
term
)
if
(
term
)
...
@@ -481,22 +489,13 @@ void IOControl::ioread( IOInfo* it )
...
@@ -481,22 +489,13 @@ void IOControl::ioread( IOInfo* it )
ComediInterface
*
card
=
cards
.
getCard
(
it
->
ncard
);
ComediInterface
*
card
=
cards
.
getCard
(
it
->
ncard
);
/*
cout << conf->oind->getMapName(it->si.id)
<< " card=" << card << " ncard=" << it->ncard
<< " dev=" << card->devname()
<< " subdev: " << it->subdev << " chan: " << it->channel << endl;
*/
if
(
card
==
NULL
||
it
->
subdev
==
DefaultSubdev
||
it
->
channel
==
DefaultChannel
)
if
(
card
==
NULL
||
it
->
subdev
==
DefaultSubdev
||
it
->
channel
==
DefaultChannel
)
return
;
return
;
// cout << conf->oind->getMapName(it->si.id)
// << " subdev: " << it->subdev << " chan: " << it->channel << endl;
if
(
it
->
si
.
id
==
DefaultObjectId
)
if
(
it
->
si
.
id
==
DefaultObjectId
)
{
{
cerr
<<
myname
<<
"(iopoll): sid=DefaultObjectId?!"
<<
endl
;
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(iopoll): sid=DefaultObjectId?!"
<<
endl
;
return
;
return
;
}
}
...
@@ -524,9 +523,9 @@ void IOControl::ioread( IOInfo* it )
...
@@ -524,9 +523,9 @@ void IOControl::ioread( IOInfo* it )
{
{
bool
set
=
card
->
getDigitalChannel
(
it
->
subdev
,
it
->
channel
);
bool
set
=
card
->
getDigitalChannel
(
it
->
subdev
,
it
->
channel
);
/*
/*
if(
ulog.ebugging(Debug::LEVEL3
) )
if(
dlog.is_level3(
) )
{
{
if( dlog.is_level3() )
dlog.level3() << myname << "(iopoll): read DI "
dlog.level3() << myname << "(iopoll): read DI "
<< " sid=" << it->si.id
<< " sid=" << it->si.id
<< " subdev=" << it->subdev
<< " subdev=" << it->subdev
<< " chan=" << it->channel
<< " chan=" << it->channel
...
@@ -534,14 +533,8 @@ void IOControl::ioread( IOInfo* it )
...
@@ -534,14 +533,8 @@ void IOControl::ioread( IOInfo* it )
<< endl;
<< endl;
}
}
*/
*/
// cout << " jar=" << ib->ptJar.getInterval()
// << " ondelay=" << ib->ptOnDelay.getInterval()
// << endl;
IOBase
::
processingAsDI
(
ib
,
set
,
shm
,
force
);
IOBase
::
processingAsDI
(
ib
,
set
,
shm
,
force
);
// cout << "val=" << ib->value << endl;
// немного оптимизации
// немного оптимизации
// сразу выставляем.сбрасываем флаг тестирования
// сразу выставляем.сбрасываем флаг тестирования
if
(
it
->
si
.
id
==
testLamp_S
)
if
(
it
->
si
.
id
==
testLamp_S
)
...
@@ -674,7 +667,8 @@ void IOControl::ioread( IOInfo* it )
...
@@ -674,7 +667,8 @@ void IOControl::ioread( IOInfo* it )
}
}
catch
(...)
catch
(...)
{
{
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(iopoll): catch ..."
<<
endl
;
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(iopoll): catch ..."
<<
endl
;
}
}
}
}
...
@@ -694,7 +688,8 @@ void IOControl::readConfiguration()
...
@@ -694,7 +688,8 @@ void IOControl::readConfiguration()
UniXML_iterator
it
(
root
);
UniXML_iterator
it
(
root
);
if
(
!
it
.
goChildren
()
)
if
(
!
it
.
goChildren
()
)
{
{
std
::
cerr
<<
myname
<<
"(readConfiguration): section <sensors> empty?!!
\n
"
;
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
<<
"(readConfiguration): section <sensors> empty?!!
\n
"
;
return
;
return
;
}
}
...
@@ -962,7 +957,6 @@ void IOControl::blink( BlinkList& lst, bool& bstate )
...
@@ -962,7 +957,6 @@ void IOControl::blink( BlinkList& lst, bool& bstate )
if
(
lst
.
empty
()
)
if
(
lst
.
empty
()
)
return
;
return
;
for
(
BlinkList
::
iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
for
(
BlinkList
::
iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
{
{
IOInfo
*
io
(
*
it
);
IOInfo
*
io
(
*
it
);
...
@@ -1065,7 +1059,8 @@ void IOControl::check_testmode()
...
@@ -1065,7 +1059,8 @@ void IOControl::check_testmode()
}
}
catch
(
Exception
&
ex
)
catch
(
Exception
&
ex
)
{
{
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(sigterm): "
<<
ex
<<
endl
;
if
(
dlog
.
is_level3
()
)
dlog
.
level3
()
<<
myname
<<
"(sigterm): "
<<
ex
<<
endl
;
}
}
catch
(...){}
catch
(...){}
}
}
...
@@ -1341,7 +1336,8 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -1341,7 +1336,8 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
<<
"(askSensors): Не дождались готовности(work) SharedMemory к работе в течение "
<<
"(askSensors): Не дождались готовности(work) SharedMemory к работе в течение "
<<
activateTimeout
<<
" мсек"
;
<<
activateTimeout
<<
" мсек"
;
dlog
.
crit
()
<<
err
.
str
()
<<
endl
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
err
.
str
()
<<
endl
;
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
kill
(
SIGTERM
,
getpid
());
// прерываем (перезапускаем) процесс...
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
...
...
extensions/IOControl/IOControl.h
View file @
72f3dddf
...
@@ -123,7 +123,7 @@
...
@@ -123,7 +123,7 @@
<br> J1 - chanenel 0 - 15
<br> J1 - chanenel 0 - 15
<br> J2
<br> J2
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br>\b lamp - признак, что данный аналоговый датчик является "лампочкой".
<br> Т.е. на самом деле дискретный выход, который может иметь
три состояния
<br> Т.е. на самом деле дискретный выход, который может иметь
состояния:
<br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpOFF - выключен
<br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpON - включен
<br>UniSetTypes::lmpBLINK - мигание с частотой 1
<br>UniSetTypes::lmpBLINK - мигание с частотой 1
...
...
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