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
a3f5805a
Commit
a3f5805a
authored
Aug 17, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(IOControl): исправил ошибку в обработке поля card
parent
10f2acb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
20 deletions
+30
-20
IOControl.cc
extensions/IOControl/IOControl.cc
+29
-20
IOControl.h
extensions/IOControl/IOControl.h
+1
-0
No files found.
extensions/IOControl/IOControl.cc
View file @
a3f5805a
...
...
@@ -26,7 +26,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
SharedMemory
*
ic
,
int
numcards
,
const
std
::
string
prefix_
)
:
UniSetObject
(
id
),
polltime
(
150
),
cards
(
numcards
+
1
),
cards
(
1
1
),
noCards
(
true
),
iomap
(
100
),
maxItem
(
0
),
...
...
@@ -42,6 +42,7 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
sidHeartBeat
(
UniSetTypes
::
DefaultObjectId
),
force
(
false
),
force_out
(
false
),
maxCardNum
(
10
),
activated
(
false
),
readconf_ok
(
false
),
term
(
false
),
...
...
@@ -60,6 +61,8 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
throw
SystemError
(
"Not find conf-node "
+
cname
+
" for "
+
myname
);
defCardNum
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-default-cardnum"
,
"-1"
);
maxCardNum
=
conf
->
getArgInt
(
"--"
+
prefix
+
"-max-cardnum"
,
"10"
);
cards
.
resize
(
maxCardNum
+
1
);
unideb
[
Debug
::
INFO
]
<<
myname
<<
"(init): numcards="
<<
numcards
<<
endl
;
...
...
@@ -78,7 +81,6 @@ IOControl::IOControl( UniSetTypes::ObjectId id, UniSetTypes::ObjectId icID,
stringstream
s2
;
s2
<<
"iodev"
<<
i
;
string
iodev
=
conf
->
getArgParam
(
s1
.
str
(),
it
.
getProp
(
s2
.
str
()));
if
(
iodev
.
empty
()
||
iodev
==
"/dev/null"
)
{
...
...
@@ -1609,35 +1611,45 @@ void IOControl::buildCardsList()
return
;
}
size_t
lastnum
=
1
;
for
(
;
lastnum
<
cards
.
size
();
lastnum
++
)
for
(
int
i
=
0
;
i
<
cards
.
size
();
i
++
)
{
if
(
cards
[
lastnum
]
==
0
)
if
(
cards
[
i
]
==
0
)
break
;
}
for
(
;
it
.
getCurrent
();
it
.
goNext
()
,
lastnum
++
)
for
(
;
it
.
getCurrent
();
it
.
goNext
()
)
{
// резервируем место (память)..
if
(
lastnum
+
1
>=
cards
.
size
()
)
cards
.
resize
(
lastnum
+
5
);
std
::
string
cname
(
it
.
getProp
(
"name"
));
int
cardnum
=
it
.
getIntProp
(
"card"
);
if
(
cardnum
<=
0
)
{
unideb
[
Debug
::
LEVEL3
]
<<
myname
<<
"(init): Unknown card number?! card="
<<
it
.
getIntProp
(
"card"
)
<<
"("
<<
cname
<<
")"
<<
endl
;
continue
;
}
if
(
cardnum
>
maxCardNum
)
{
unideb
[
Debug
::
LEVEL3
]
<<
myname
<<
"(init): BAD card number card='"
<<
it
.
getIntProp
(
"card"
)
<<
"'("
<<
cname
<<
"). Must be < "
<<
maxCardNum
<<
endl
;
continue
;
}
if
(
it
.
getIntProp
(
"ignore"
)
)
{
cards
[
last
num
]
=
NULL
;
cards
[
card
num
]
=
NULL
;
unideb
[
Debug
::
LEVEL3
]
<<
myname
<<
"(init): card="
<<
it
.
getProp
(
"card"
)
<<
"("
<<
cname
<<
")"
<<
" DISABLED! ignore=1"
<<
endl
;
continue
;
}
stringstream
s
;
s
<<
"--"
<<
prefix
<<
"-card"
<<
last
num
<<
"-ignore"
;
s
<<
"--"
<<
prefix
<<
"-card"
<<
card
num
<<
"-ignore"
;
if
(
findArgParam
(
s
.
str
(),
conf
->
getArgc
(),
conf
->
getArgv
())
!=
-
1
)
{
cards
[
last
num
]
=
NULL
;
cards
[
card
num
]
=
NULL
;
unideb
[
Debug
::
LEVEL3
]
<<
myname
<<
"(init): card="
<<
it
.
getProp
(
"card"
)
<<
"("
<<
cname
<<
")"
<<
" DISABLE! ("
<<
s
.
str
()
<<
")"
<<
endl
;
continue
;
...
...
@@ -1647,11 +1659,11 @@ void IOControl::buildCardsList()
if
(
iodev
.
empty
()
||
iodev
==
"/dev/null"
)
{
cards
[
last
num
]
=
NULL
;
cards
[
card
num
]
=
NULL
;
unideb
[
Debug
::
LEVEL3
]
<<
myname
<<
"(init): card="
<<
it
.
getProp
(
"card"
)
<<
"("
<<
cname
<<
")"
<<
" DISABLED (TestMode)!!! iodev='"
<<
iodev
<<
"'"
<<
endl
;
cout
<<
"******************** CARD"
<<
last
num
<<
": DISABLE!"
<<
endl
;
cout
<<
"******************** CARD"
<<
card
num
<<
": DISABLE!"
<<
endl
;
continue
;
}
...
...
@@ -1659,7 +1671,7 @@ void IOControl::buildCardsList()
try
{
cards
[
last
num
]
=
new
ComediInterface
(
iodev
);
cards
[
card
num
]
=
new
ComediInterface
(
iodev
);
noCards
=
false
;
}
catch
(
Exception
&
ex
)
...
...
@@ -1700,12 +1712,9 @@ void IOControl::buildCardsList()
unideb
[
Debug
::
INFO
]
<<
myname
<<
"(buildCardsList): card="
<<
it
.
getProp
(
"card"
)
<<
"("
<<
cname
<<
")"
<<
" init subdev"
<<
i
<<
" "
<<
it
.
getProp
(
s
.
str
())
<<
endl
;
cards
[
last
num
]
->
configureSubdev
(
i
-
1
,
st
);
cards
[
card
num
]
->
configureSubdev
(
i
-
1
,
st
);
}
}
}
// освобождаем неиспользуемое место (память)
cards
.
resize
(
lastnum
);
}
// -----------------------------------------------------------------------------
extensions/IOControl/IOControl.h
View file @
a3f5805a
...
...
@@ -363,6 +363,7 @@ class IOControl:
bool
force_out
;
/*!< флаг, включающий принудительное чтения выходов */
int
smReadyTimeout
;
/*!< время ожидания готовности SM к работе, мсек */
int
defCardNum
;
/*!< номер карты по умолчанию */
int
maxCardNum
;
/*! максимально разрешённый номер для карты */
UniSetTypes
::
uniset_mutex
iopollMutex
;
bool
activated
;
...
...
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