Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
2c148fb3
Commit
2c148fb3
authored
Jun 06, 2022
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added reboot.html
parent
eff38d20
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
0 deletions
+114
-0
reboot.html
src/multicam/reboot.html
+114
-0
No files found.
src/multicam/reboot.html
0 → 100644
View file @
2c148fb3
<html>
<head>
<title>
Reboot cameras
</title>
<meta
content=
""
>
<style></style>
<script
src=
"../js/jquery-3.1.1.js"
></script>
<script>
//192.168.0.41/multicam/reboot.html?ip=192.168.0.41,192.168.0.42,192.168.0.43,192.168.0.44,192.168.0.45&continue=http://192.168.0.41/multicam/index2.html&delay=10
// var reboot_url="/autocampars.php?reboot";
var
reboot_url
=
":2323/reboot"
;
// var reboot_url="/parsedit.php?immediate&sensor_port=0&WB_EN"; // just for testing
var
get_frame_url
=
"parsedit.php?immediate&sensor_port=0&THIS_FRAME"
;
var
good_frame
=
50
;
var
ips
=
[];
var
cont
=
""
;
var
delay_sec
=
"45"
;
var
count_left
=
0
;
var
url
=
""
$
(
function
(){
main
();
});
var
refresh_intvl
;
function
main
(){
console
.
log
(
"parseURL()"
);
var
ips_str
=
location
.
host
;
var
parameters
=
location
.
href
.
replace
(
/
\?
/ig
,
"&"
).
split
(
"&"
);
for
(
var
i
=
0
;
i
<
parameters
.
length
;
i
++
)
parameters
[
i
]
=
parameters
[
i
].
split
(
"="
);
for
(
var
i
=
1
;
i
<
parameters
.
length
;
i
++
)
{
switch
(
parameters
[
i
][
0
])
{
case
"ip"
:
ips
=
parameters
[
i
][
1
].
split
(
","
);
break
;
case
"continue"
:
// do not show previews - terribly slow for Bosons
cont
=
parameters
[
i
][
1
];
break
;
case
"delay"
:
// do not show previews - terribly slow for Bosons
delay_sec
=
parseFloat
(
parameters
[
i
][
1
]);
break
;
}
}
count_left
=
parseInt
(
delay_sec
);
for
(
var
i
=
0
;
i
<
ips
.
length
;
i
++
){
console
.
log
(
"ip["
+
i
+
"]="
+
ips
[
i
]);
}
console
.
log
(
"cont="
+
cont
);
console
.
log
(
"delay="
+
count_left
);
$
(
'#label_reboot'
).
html
(
'Rebooted, waiting to restart '
+
cont
+
" ..."
);
$
(
'#restart'
).
val
(
delay_sec
);
for
(
var
i
=
ips
.
length
-
1
;
i
>=
0
;
i
--
){
var
url
=
"http://"
+
ips
[
i
]
+
reboot_url
;
console
.
log
(
"Sending reboot request: "
+
url
);
$
.
ajax
({
url
:
url
,
ip
:
ips
[
i
],
success
:
function
(){
console
.
log
(
"****** reboot response from "
+
this
.
ip
+
", url="
+
this
.
url
);
}
}).
fail
(
function
(
data
,
status
){
console
.
log
(
this
.
ip
+
" No response - OK now (does not have a chance to send response while rebooting). url = "
+
this
.
url
);
});
}
refresh_intvl
=
setInterval
(
updateCount
,
1000
);
}
function
updateCount
(){
$
(
'#restart'
).
val
(
count_left
);
count_left
--
;
if
(
count_left
<
0
)
{
clearInterval
(
refresh_intvl
);
$
(
'#label_reboot'
).
html
(
'Waiting '
+
ips
[
0
]
+
" to initialize"
);
// add to the main program too?
refresh_intvl
=
setInterval
(
waitMasterFrame50
,
1000
);
// maybe try some safe url?
// window.location.replace(cont);
}
}
function
waitMasterFrame50
(){
clearInterval
(
refresh_intvl
);
// ajax failure will restart delay
$
.
ajax
({
url
:
"http://"
+
ips
[
0
]
+
"/"
+
get_frame_url
,
success
:
function
(
response
){
var
frame
=
parseInt
(
$
(
response
).
find
(
"THIS_FRAME"
).
text
());
console
.
log
(
"Master camera frame = "
+
frame
);
if
(
frame
>=
good_frame
)
{
$
(
'#label_reboot'
).
html
(
'Starting'
);
// add to the main program too?
if
(
cont
.
length
>
0
)
{
window
.
location
.
replace
(
cont
);
}
}
else
{
console
.
log
(
"Frame number="
+
frame
+
" < "
+
good_frame
+
"waiting longer"
);
$
(
'#restart'
).
val
(
count_left
);
count_left
++
;
refresh_intvl
=
setInterval
(
waitMasterFrame50
,
1000
);
}
}
}).
fail
(
function
(
data
,
status
){
console
.
log
(
this
.
ip
+
" Frame request failed. Retrying"
);
$
(
'#restart'
).
val
(
count_left
);
count_left
++
;
refresh_intvl
=
setInterval
(
waitMasterFrame50
,
1000
);
});
}
//7763773
</script>
</head>
<!-- <body onload = "main()"> -->
<body>
<div
>
<label
id=
"label_reboot"
style=
"font-size: 300%"
for=
"reboot_count"
>
Rebooted, waiting to ? ...
</label>
<input
id=
"restart"
style=
"font-size: 300%"
type=
"text"
name=
"restart"
size=
"4"
disabled=
"disabled"
>
</div>
</body>
</html>
\ No newline at end of file
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