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
590c0bdc
Commit
590c0bdc
authored
Mar 26, 2011
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Подправил скрипты, чтобы они возвращали корректный значения завершения
для использования в скриптах на bash..
parent
0b32525f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
157 additions
and
156 deletions
+157
-156
admin.cc
Utilities/Admin/admin.cc
+151
-151
admin.sh
Utilities/Admin/admin.sh
+2
-0
uniset-start.sh
Utilities/scripts/uniset-start.sh
+4
-5
No files found.
Utilities/Admin/admin.cc
View file @
590c0bdc
...
...
@@ -128,172 +128,170 @@ int main(int argc, char** argv)
int
optindex
=
0
;
char
opt
=
0
;
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hc:beomsfur:l:i:x:g:w:y:p:"
,
longopts
,
&
optindex
))
!=
-
1
)
{
switch
(
opt
)
//разбираем параметры
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hc:beomsfur:l:i:x:g:w:y:p:"
,
longopts
,
&
optindex
))
!=
-
1
)
{
case
'h'
:
//--help
usage
();
return
0
;
case
'c'
:
//--confile
conffile
=
optarg
;
break
;
case
'o'
:
//--omap
switch
(
opt
)
//разбираем параметры
{
uniset_init
(
argc
,
argv
,
conffile
);
return
omap
();
}
break
;
case
'h'
:
//--help
usage
();
return
0
;
case
'b'
:
//--create
{
uniset_init
(
argc
,
argv
,
conffile
);
createSections
(
conf
);
}
return
0
;
case
'c'
:
//--confile
conffile
=
optarg
;
break
;
case
'm'
:
//--msgmap
{
uniset_init
(
argc
,
argv
,
conffile
);
return
msgmap
();
}
break
;
case
'x'
:
//--setValue
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
setValue
(
optarg
,
ui
);
}
break
;
case
'o'
:
//--omap
{
uniset_init
(
argc
,
argv
,
conffile
);
return
omap
();
}
break
;
case
'g'
:
//--getValue
{
// cout<<"(main):received option --getValue='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
getValue
(
optarg
,
ui
);
}
break
;
case
'b'
:
//--create
{
uniset_init
(
argc
,
argv
,
conffile
);
createSections
(
conf
);
}
return
0
;
case
'm'
:
//--msgmap
{
uniset_init
(
argc
,
argv
,
conffile
);
return
msgmap
();
}
break
;
case
'x'
:
//--setValue
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
setValue
(
optarg
,
ui
);
}
break
;
case
'w'
:
//--getRaw
Value
{
//
cout<<"(main):received option --getRaw
Value='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
getRaw
Value
(
optarg
,
ui
);
}
break
;
case
'g'
:
//--get
Value
{
//
cout<<"(main):received option --get
Value='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
get
Value
(
optarg
,
ui
);
}
break
;
case
'p'
:
//--oinfo
{
// cout<<"(main):received option --oinfo
='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
oinfo
(
optarg
,
ui
);
}
break
;
case
'w'
:
//--getRawValue
{
// cout<<"(main):received option --getRawValue
='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
getRawValue
(
optarg
,
ui
);
}
break
;
case
'e'
:
//--exist
{
// cout<<"(main):received option --exist"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
Exist
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
// cout<<"(exist): done"<<endl;
}
return
0
;
case
'p'
:
//--oinfo
{
// cout<<"(main):received option --oinfo='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
oinfo
(
optarg
,
ui
);
}
break
;
case
's'
:
//--star
t
{
//
cout<<"(main):received option --star
t"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
case
'e'
:
//--exis
t
{
//
cout<<"(main):received option --exis
t"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
StartUp
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
}
return
0
;
Command
cmd
=
Exist
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
// cout<<"(exist): done"<<endl;
}
return
0
;
case
'r'
:
//--configure
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
configure
(
optarg
,
ui
);
}
break
;
case
's'
:
//--start
{
// cout<<"(main):received option --start"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
StartUp
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
}
return
0
;
case
'f'
:
//--finish
{
// cout<<"(main):received option --finish"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
Finish
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
cout
<<
"(finish): done"
<<
endl
;
}
return
0
;
case
'r'
:
//--configure
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
configure
(
optarg
,
ui
);
}
break
;
case
'l'
:
//--logrotate
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
logRotate
(
optarg
,
ui
);
}
break
;
case
'f'
:
//--finish
{
// cout<<"(main):received option --finish"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
Finish
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
cout
<<
"(finish): done"
<<
endl
;
}
return
0
;
case
'y'
:
//--getCalibrate
{
// cout<<"(main):received option --getCalibrate='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
getCalibrate
(
optarg
,
ui
);
}
break
;
case
'l'
:
//--logrotate
{
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
logRotate
(
optarg
,
ui
);
}
break
;
case
'y'
:
//--getCalibrate
{
// cout<<"(main):received option --getCalibrate='"<<optarg<<"'"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
return
getCalibrate
(
optarg
,
ui
);
}
break
;
case
'u'
:
//--foldUp
{
// cout<<"(main):received option --foldUp"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
case
'u'
:
//--foldUp
{
//
cout<<"(main):received option --foldUp"<<endl;
uniset_init
(
argc
,
argv
,
conffile
);
UniversalInterface
ui
(
conf
);
Command
cmd
=
FoldUp
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
// cout<<"(foldUp): done"<<endl;
}
return
0
;
case
'?'
:
default:
{
short_usage
();
Command
cmd
=
FoldUp
;
ObjectRepository
*
rep
=
new
ObjectRepository
(
conf
);
commandToAll
(
conf
->
getServicesSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getControllersSection
(),
rep
,
(
Command
)
cmd
);
commandToAll
(
conf
->
getObjectsSection
(),
rep
,
(
Command
)
cmd
);
delete
rep
;
// cout<<"(foldUp): done"<<endl;
}
return
0
;
}
}
}
case
'?'
:
default:
{
short_usage
();
return
1
;
}
}
}
return
0
;
}
...
...
@@ -320,6 +318,8 @@ int main(int argc, char** argv)
{
cerr
<<
"неизвестное исключение"
<<
endl
;
}
return
1
;
}
// ==============================================================================================
...
...
@@ -507,11 +507,11 @@ int setValue( const string args, UniversalInterface &ui, Configuration* conf )
switch
(
t
)
{
case
UniversalIO
:
:
DigitalInput
:
ui
.
saveState
(
it
->
si
.
id
,(
it
->
val
?
true
:
false
),
t
,
it
->
si
.
node
);
ui
.
saveState
(
it
->
si
.
id
,(
it
->
val
?
true
:
false
),
t
,
it
->
si
.
node
);
break
;
case
UniversalIO
:
:
DigitalOutput
:
ui
.
setState
(
it
->
si
.
id
,(
it
->
val
?
true
:
false
),
it
->
si
.
node
);
ui
.
setState
(
it
->
si
.
id
,(
it
->
val
?
true
:
false
),
it
->
si
.
node
);
break
;
case
UniversalIO
:
:
AnalogInput
:
...
...
Utilities/Admin/admin.sh
View file @
590c0bdc
#!/bin/sh
./uniset-start.sh
-f
"./uniset-admin --confile test.xml --
`
basename
$0
.sh
`
$1
$2
$3
$4
"
exit
$?
Utilities/scripts/uniset-start.sh
View file @
590c0bdc
...
...
@@ -60,7 +60,7 @@ then
echo
Running
"
$start_line
"
$start_line
exit
0
exit
$?
fi
if
[
-n
"
$FG
"
]
...
...
@@ -69,20 +69,19 @@ then
if
[
-z
"
$COMLINE
"
]
then
echo
"Не указана команда для запуска"
exit
0
exit
1
fi
COMLINE
=
"
$COMLINE
--uniset-port
$OMNIPORT
"
echo
Запускаем
"
$COMLINE
"
$COMLINE
echo
Выходим
exit
1
exit
$?
fi
if
[
-z
"
$*
"
]
then
echo
"Не указана команда для запуска"
exit
0
exit
1
fi
checkPID
=
$(
echo
"
$1
"
|
grep
pidfile
=
)
...
...
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