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
db321372
Commit
db321372
authored
Dec 18, 2013
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(2.0): подправил IOControl
parent
5ffda9a7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
34 deletions
+30
-34
IOControl.cc
extensions/IOControl/IOControl.cc
+29
-33
IOControl.h
extensions/IOControl/IOControl.h
+1
-1
No files found.
extensions/IOControl/IOControl.cc
View file @
db321372
...
@@ -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,6 +116,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -121,6 +116,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
if
(
!
stype
.
empty
()
)
if
(
!
stype
.
empty
()
)
{
{
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
dlog
.
info
()
<<
myname
<<
"(init): card"
<<
i
<<
"(init): card"
<<
i
<<
" subdev"
<<
s
<<
" set type "
<<
stype
<<
endl
;
<<
" subdev"
<<
s
<<
" set type "
<<
stype
<<
endl
;
...
@@ -132,6 +128,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -132,6 +128,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
}
}
}
}
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): result numcards="
<<
cards
.
size
()
<<
endl
;
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"
));
...
@@ -153,10 +150,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -153,10 +150,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
": Unkown ID for "
<<
testlamp
;
err
<<
myname
<<
": Unkown ID for "
<<
testlamp
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): testLamp_S='"
<<
testlamp
<<
"'"
<<
endl
;
dlog
.
info
()
<<
myname
<<
"(init): testLamp_S='"
<<
testlamp
<<
"'"
<<
endl
;
}
}
...
@@ -168,10 +167,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -168,10 +167,12 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
{
{
ostringstream
err
;
ostringstream
err
;
err
<<
myname
<<
": Unknown ID for "
<<
tmode
;
err
<<
myname
<<
": Unknown ID for "
<<
tmode
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
dlog
.
info
()
<<
myname
<<
"(init): testMode_as='"
<<
testmode
<<
"'"
<<
endl
;
}
}
...
@@ -181,6 +182,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -181,6 +182,7 @@ 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"
);
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): read s_field='"
<<
s_field
dlog
.
info
()
<<
myname
<<
"(init): read s_field='"
<<
s_field
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
<<
"' s_fvalue='"
<<
s_fvalue
<<
"'"
<<
endl
;
...
@@ -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"
);
if
(
dlog
.
is_warn
()
)
dlog
.
warn
()
<<
myname
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,6 +225,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
...
@@ -222,6 +225,7 @@ 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
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
dlog
.
crit
()
<<
myname
<<
"(init): "
<<
err
.
str
()
<<
endl
;
throw
SystemError
(
err
.
str
());
throw
SystemError
(
err
.
str
());
}
}
...
@@ -283,6 +287,7 @@ void IOControl::execute()
...
@@ -283,6 +287,7 @@ void IOControl::execute()
}
}
maxHalf
=
maxItem
/
2
;
maxHalf
=
maxItem
/
2
;
if
(
dlog
.
is_info
()
)
dlog
.
info
()
<<
myname
<<
"(init): iomap size = "
<<
iomap
.
size
()
<<
endl
;
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
()
)
dlog
.
level3
()
<<
myname
<<
"(execute): CORBA::SystemException: "
<<
ex
.
NP_minorString
()
<<
endl
;
<<
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,6 +1336,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
...
@@ -1341,6 +1336,7 @@ void IOControl::askSensors( UniversalIO::UIOCommand cmd )
<<
"(askSensors): Не дождались готовности(work) SharedMemory к работе в течение "
<<
"(askSensors): Не дождались готовности(work) SharedMemory к работе в течение "
<<
activateTimeout
<<
" мсек"
;
<<
activateTimeout
<<
" мсек"
;
if
(
dlog
.
is_crit
()
)
dlog
.
crit
()
<<
err
.
str
()
<<
endl
;
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 @
db321372
...
@@ -119,7 +119,7 @@
...
@@ -119,7 +119,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