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
c6821247
Commit
c6821247
authored
Nov 17, 2009
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add new utility: uniset-simitator
parent
56d2ef5d
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
0 deletions
+133
-0
Makefile.am
Utilities/SImitator/Makefile.am
+3
-0
create_links.sh
Utilities/SImitator/create_links.sh
+4
-0
main.cc
Utilities/SImitator/main.cc
+118
-0
start_fg.sh
Utilities/SImitator/start_fg.sh
+7
-0
configure.ac
configure.ac
+1
-0
No files found.
Utilities/SImitator/Makefile.am
0 → 100644
View file @
c6821247
bin_PROGRAMS
=
uniset-simitator
uniset_simitator_LDADD
=
$(top_builddir)
/lib/libUniSet.la
uniset_simitator_SOURCES
=
main.cc
Utilities/SImitator/create_links.sh
0 → 100755
View file @
c6821247
#!/bin/sh
ln
-s
-f
/usr/bin/uniset-stop.sh stop.sh
ln
-s
-f
../../conf/test.xml test.xml
Utilities/SImitator/main.cc
0 → 100644
View file @
c6821247
// $Id: main.cc,v 1.1 2009/03/03 12:27:37 pv Exp $
#include <iostream>
#include "Exceptions.h"
#include "UniversalInterface.h"
// -----------------------------------------------------------------------------
using
namespace
std
;
using
namespace
UniSetTypes
;
// -----------------------------------------------------------------------------
void
help_print
()
{
cout
<<
endl
<<
"--help - "
<<
endl
;
cout
<<
"--sid id - sensor ID (AnalogInput)"
<<
endl
;
cout
<<
"--min val - . 0"
<<
endl
;
cout
<<
"--max val - . 100 "
<<
endl
;
cout
<<
"--step val - . 1"
<<
endl
;
cout
<<
"--pause msec - . 200 "
<<
endl
<<
endl
;
}
int
main
(
int
argc
,
char
**
argv
)
{
try
{
// help
// -------------------------------------
if
(
argc
>
1
&&
(
!
strcmp
(
argv
[
1
],
"--help"
)
||
!
strcmp
(
argv
[
1
],
"-h"
))
)
{
help_print
();
return
0
;
}
// -------------------------------------
uniset_init
(
argc
,
argv
,
"configure.xml"
);
UniversalInterface
ui
;
int
asid
=
conf
->
getArgInt
(
"--sid"
,
""
);
if
(
asid
<=
0
)
{
cerr
<<
endl
<<
"Use --sid id"
<<
endl
<<
endl
;
return
1
;
}
int
amin
=
conf
->
getArgInt
(
"--min"
,
"0"
);
int
amax
=
conf
->
getArgInt
(
"--max"
,
"100"
);
if
(
amin
>
amax
)
{
int
temp
=
amax
;
amax
=
amin
;
amin
=
temp
;
}
int
astep
=
conf
->
getArgInt
(
"--step"
,
"1"
);
if
(
astep
<=
0
)
{
cerr
<<
endl
<<
", --step val - "
<<
endl
<<
endl
;
return
1
;
}
int
amsec
=
conf
->
getArgInt
(
"--pause"
,
"200"
);
if
(
amsec
<=
10
)
{
cerr
<<
endl
<<
", --pause val - > 10"
<<
endl
<<
endl
;
return
1
;
}
cout
<<
endl
<<
"------------------------------"
<<
endl
;
cout
<<
" :"
<<
endl
;
cout
<<
"------------------------------"
<<
endl
;
cout
<<
" sid = "
<<
asid
<<
endl
;
cout
<<
" min = "
<<
amin
<<
endl
;
cout
<<
" max = "
<<
amax
<<
endl
;
cout
<<
" step = "
<<
astep
<<
endl
;
cout
<<
" pause = "
<<
amsec
<<
endl
;
cout
<<
"------------------------------"
<<
endl
<<
endl
;
int
i
=
amin
-
astep
,
j
=
amax
;
while
(
1
)
{
if
(
i
>=
amax
)
{
j
-=
astep
;
if
(
j
<
amin
)
//
j
=
amin
;
cout
<<
"
\r
"
<<
" i = "
<<
j
<<
" "
<<
flush
;
ui
.
saveValue
(
asid
,
j
,
UniversalIO
::
AnalogInput
);
if
(
j
<=
amin
)
{
i
=
amin
;
j
=
amax
;
}
}
else
{
i
+=
astep
;
if
(
i
>
amax
)
//
i
=
amax
;
cout
<<
"
\r
"
<<
" i = "
<<
i
<<
" "
<<
flush
;
ui
.
saveValue
(
asid
,
i
,
UniversalIO
::
AnalogInput
);
}
msleep
(
amsec
);
}
}
catch
(
Exception
&
ex
)
{
cerr
<<
endl
<<
"(main): "
<<
ex
<<
endl
;
return
1
;
}
catch
(
...
)
{
cerr
<<
endl
<<
"catch..."
<<
endl
;
return
1
;
}
return
0
;
}
// ------------------------------------------------------------------------------------------
Utilities/SImitator/start_fg.sh
0 → 100755
View file @
c6821247
#!/bin/sh
ulimit
-Sc
1000000
uniset-start.sh
-f
./uniset-simitator
--confile
test.xml
--sid
10
#--unideb-add-levels info,crit,warn,level9,system
configure.ac
View file @
c6821247
...
...
@@ -181,6 +181,7 @@ AC_CONFIG_FILES([Makefile
Utilities/InfoServer/Makefile
Utilities/MBTester/Makefile
Utilities/DBServer-MySQL/Makefile
Utilities/SImitator/Makefile
Utilities/JrnTests/Makefile
Utilities/UniXmlTest/Makefile
Utilities/codegen/Makefile
...
...
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