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
099e52f6
Commit
099e52f6
authored
Jan 31, 2012
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Сделал в simitator поддержку задания id в стиле "id@node"
parent
e8eb2ad7
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
24 deletions
+31
-24
main.cc
Utilities/SImitator/main.cc
+26
-22
start_fg.sh
Utilities/SImitator/start_fg.sh
+1
-1
libuniset.spec
conf/libuniset.spec
+4
-1
No files found.
Utilities/SImitator/main.cc
View file @
099e52f6
...
...
@@ -8,16 +8,17 @@ using namespace UniSetTypes;
void
help_print
()
{
cout
<<
endl
<<
"--help - Помощь по утилите"
<<
endl
;
cout
<<
"--sid id1,..,idXX - sensors ID (AI,AO)"
<<
endl
;
cout
<<
"--sid id1@Node1,id2,..,idXX@NodeXX - Аналоговые датчики (AI,AO)"
<<
endl
;
cout
<<
endl
;
cout
<<
"--min val - Нижняя граница датчика. По умолчанию 0"
<<
endl
;
cout
<<
"--max val - Верхняя граница датчика. По умолчанию 100 "
<<
endl
;
cout
<<
"--step val - Шаг датчика. По умолчанию 1"
<<
endl
;
cout
<<
"--pause msec - Пауза. По умолчанию 200 мсек"
<<
endl
<<
endl
;
}
// -----------------------------------------------------------------------------
struct
IInfo
struct
ExtInfo
:
public
UniSetTypes
::
ParamSInfo
{
ObjectId
id
;
UniversalIO
::
IOTypes
iotype
;
};
// -----------------------------------------------------------------------------
...
...
@@ -43,27 +44,30 @@ int main( int argc, char **argv )
cerr
<<
endl
<<
"Use --sid id1,..,idXX"
<<
endl
<<
endl
;
return
1
;
}
UniSetTypes
::
IDList
lst1
=
UniSetTypes
::
explode
(
sid
);
std
::
list
<
ObjectId
>
l1
=
lst1
.
getList
();
if
(
l1
.
empty
()
)
std
::
list
<
UniSetTypes
::
ParamSInfo
>
lst
=
UniSetTypes
::
getSInfoList
(
sid
,
UniSetTypes
::
conf
);
if
(
lst
.
empty
()
)
{
cerr
<<
endl
<<
"Use --sid id1,..,idXX"
<<
endl
<<
endl
;
return
1
;
}
std
::
list
<
I
Info
>
l
;
for
(
std
::
list
<
ObjectId
>::
iterator
it
=
l1
.
begin
();
it
!=
l1
.
end
();
++
it
)
std
::
list
<
Ext
Info
>
l
;
for
(
std
::
list
<
UniSetTypes
::
ParamSInfo
>::
iterator
it
=
lst
.
begin
();
it
!=
lst
.
end
();
++
it
)
{
UniversalIO
::
IOTypes
t
=
conf
->
getIOType
(
(
*
it
)
);
UniversalIO
::
IOTypes
t
=
conf
->
getIOType
(
it
->
si
.
id
);
if
(
t
!=
UniversalIO
::
AnalogInput
&&
t
!=
UniversalIO
::
AnalogOutput
)
{
cerr
<<
endl
<<
"Неверный типа датчика '"
<<
t
<<
"' для id='"
<<
(
*
it
)
<<
"'. Тип должен быть AI или AO."
<<
endl
<<
endl
;
cerr
<<
endl
<<
"Неверный типа датчика '"
<<
t
<<
"' для id='"
<<
it
->
fname
<<
"'. Тип должен быть AI или AO."
<<
endl
<<
endl
;
return
1
;
}
IInfo
i
;
i
.
id
=
(
*
it
);
if
(
it
->
si
.
node
==
DefaultObjectId
)
it
->
si
.
node
=
conf
->
getLocalNode
();
ExtInfo
i
;
i
.
si
=
it
->
si
;
i
.
iotype
=
t
;
l
.
push_back
(
i
);
}
...
...
@@ -113,18 +117,18 @@ int main( int argc, char **argv )
j
=
amin
;
cout
<<
"
\r
"
<<
" i = "
<<
j
<<
" "
<<
flush
;
for
(
std
::
list
<
I
Info
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
for
(
std
::
list
<
Ext
Info
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
{
try
{
if
(
it
->
iotype
==
UniversalIO
::
AnalogInput
)
ui
.
saveValue
(
it
->
id
,
j
,
UniversalIO
::
AnalogInput
);
ui
.
saveValue
(
it
->
si
,
j
,
UniversalIO
::
AnalogInput
,
DefaultObjectId
);
else
ui
.
setValue
(
it
->
id
,
j
);
ui
.
setValue
(
it
->
si
,
j
,
DefaultObjectId
);
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"save id="
<<
it
->
id
<<
" "
<<
ex
<<
endl
;
cerr
<<
endl
<<
"save id="
<<
it
->
fname
<<
" "
<<
ex
<<
endl
;
}
}
...
...
@@ -141,18 +145,18 @@ int main( int argc, char **argv )
i
=
amax
;
cout
<<
"
\r
"
<<
" i = "
<<
i
<<
" "
<<
flush
;
for
(
std
::
list
<
I
Info
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
for
(
std
::
list
<
Ext
Info
>::
iterator
it
=
l
.
begin
();
it
!=
l
.
end
();
++
it
)
{
try
{
if
(
it
->
iotype
==
UniversalIO
::
AnalogInput
)
ui
.
saveValue
(
it
->
id
,
i
,
UniversalIO
::
AnalogInput
);
ui
.
saveValue
(
it
->
si
,
i
,
UniversalIO
::
AnalogInput
,
DefaultObjectId
);
else
ui
.
setValue
(
it
->
id
,
i
);
ui
.
setValue
(
it
->
si
,
i
,
DefaultObjectId
);
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"save id="
<<
it
->
id
<<
" "
<<
ex
<<
endl
;
cerr
<<
endl
<<
"save id="
<<
it
->
fname
<<
" "
<<
ex
<<
endl
;
}
}
}
...
...
@@ -162,12 +166,12 @@ int main( int argc, char **argv )
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"(
main
): "
<<
ex
<<
endl
;
cerr
<<
endl
<<
"(
simitator
): "
<<
ex
<<
endl
;
return
1
;
}
catch
(
...
)
{
cerr
<<
endl
<<
"catch..."
<<
endl
;
cerr
<<
endl
<<
"
(simitator):
catch..."
<<
endl
;
return
1
;
}
...
...
Utilities/SImitator/start_fg.sh
View file @
099e52f6
...
...
@@ -4,7 +4,7 @@ ulimit -Sc 1000000
#for i in `seq 1 20`;
#do
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10
,16,9
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10
@localhost,9@3002
#done
#wait
...
...
conf/libuniset.spec
View file @
099e52f6
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.3
Release: alt
2.1
Release: alt
3
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
* Tue Jan 31 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt3
- minor fixes in simitator
* Tue Jan 24 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt2.1
- rebuild
...
...
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