Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-apps-camogm
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-apps-camogm
Commits
85935b34
Commit
85935b34
authored
Sep 23, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/Elphel/elphel-apps-camogm
parents
2997e18c
569ab463
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
40 deletions
+43
-40
camogmgui.js
src/camogmgui/camogmgui.js
+43
-40
No files found.
src/camogmgui/camogmgui.js
View file @
85935b34
...
...
@@ -21,15 +21,16 @@ function init() {
check_audio_hardware
();
update_audio_form
(
document
.
getElementById
(
"audioform"
));
calc_split_size
();
scan_devices
();
//calling "is_mounted" at response
scan_devices
(
"is_mounted(selected_device)"
);
//global_timer = setInterval(timer_functions,2000);
}
function
reload
()
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=run_camogm'
);
setTimeout
(
'makeRequest("camogm_interface.php", "?cmd=setmov")'
,
500
);
// set MOV as default container format
}
function
mount_hdd
()
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=mount'
);
function
mount_hdd
(
callback
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=mount'
,
callback
);
document
.
getElementById
(
'directory'
).
value
=
"/var/hdd/"
;
document
.
getElementById
(
'mount_hdd_button'
).
style
.
display
=
"none"
;
}
...
...
@@ -39,32 +40,30 @@ function process_mount_hdd(xmldoc) {
if
(
response
==
"done"
)
{
//setTimeout('is_hdd_mounted()', 500);
is_hdd_mounted
(
);
setTimeout
(
'scan_devices()'
,
800
);
scan_devices
(
"is_mounted(selected_device)"
);
console
.
log
(
"mounted"
);
}
}
function
mount_custom_partition
(
partition
)
{
if
(
document
.
getElementById
(
"mount_point"
).
value
!=
""
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=mount&partition='
+
partition
+
'&mountpoint='
+
document
.
getElementById
(
"mount_point"
).
value
);
makeRequest
(
'camogm_interface.php'
,
'?cmd=mount&partition='
+
partition
+
'&mountpoint='
+
document
.
getElementById
(
"mount_point"
).
value
,
"scan_devices()"
);
document
.
getElementById
(
'directory'
).
value
=
"/var/hdd/"
;
document
.
getElementById
(
'mount_hdd_button'
).
style
.
display
=
"none"
;
setTimeout
(
'scan_devices()'
,
700
);
}
}
function
unmount_custom_partition
(
mountpoint
)
{
if
(
mountpoint
!=
""
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=umount&mountpoint='
+
mountpoint
);
setTimeout
(
'scan_devices()'
,
700
);
//scan_devices();
//calling back scan_devices()
makeRequest
(
'camogm_interface.php'
,
'?cmd=umount&mountpoint='
+
mountpoint
,
"scan_devices(list_files(
\"\"
))"
);
}
}
function
is_hdd_mounted
()
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=is_hdd_mounted'
);
makeRequest
(
'camogm_interface.php'
,
'?cmd=is_hdd_mounted'
);
}
function
is_mounted
(
dev
){
makeRequest
(
'camogm_interface.php'
,
'?cmd=is_hdd_mounted&partition='
+
dev
);
function
is_mounted
(
dev
,
callback
){
makeRequest
(
'camogm_interface.php'
,
'?cmd=is_hdd_mounted&partition='
+
dev
,
callback
);
}
function
nothing_is_mounted_hide
(){
...
...
@@ -103,8 +102,9 @@ function process_is_hdd_mounted(xmldoc) {
}
}
function
scan_devices
()
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=listdevices'
);
//scan_devices() - fills the device list.
function
scan_devices
(
callback
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=listdevices'
,
callback
);
}
var
devices
=
Array
();
...
...
@@ -140,17 +140,15 @@ function process_scan_devices(xmldoc) {
content
+=
"</table>"
;
document
.
getElementById
(
'ajax_devices'
).
innerHTML
=
content
;
}
if
(
devices
.
length
>
0
){
nothing_is_mounted_hide
();
for
(
var
i
=
0
;
i
<
devices
.
length
;
i
++
){
if
(
devices
[
i
]
==
"/dev/hda1"
)
selected_device
=
devices
[
i
];
if
(
devices
[
i
]
==
"/dev/sda1"
)
selected_device
=
devices
[
i
];
break
;
}
is_mounted
(
selected_device
);
}
else
{
nothing_is_mounted_hide
();
}
find_selected_device
();
}
function
find_selected_device
(){
for
(
var
i
=
0
;
i
<
devices
.
length
;
i
++
){
if
(
devices
[
i
]
==
"/dev/hda1"
)
selected_device
=
devices
[
i
];
if
(
devices
[
i
]
==
"/dev/sda1"
)
selected_device
=
devices
[
i
];
break
;
}
}
function
create_folder
()
{
...
...
@@ -174,13 +172,11 @@ function get_hdd_space() {
}
function
get_space
(
mountpoint
){
console
.
log
(
"getting space"
);
makeRequest
(
'camogm_interface.php'
,
'?cmd=get_hdd_space&mountpoint='
+
mountpoint
);
}
function
process_hdd_space
(
xmldoc
)
{
var
response
=
xmldoc
.
getElementsByTagName
(
'get_hdd_space'
)[
0
].
firstChild
.
data
;
console
.
log
(
"space is "
+
response
);
document
.
getElementById
(
'hdd_rem'
).
innerHTML
=
Math
.
round
(
response
/
1024
/
1024
/
1024
*
100
)
/
100
+
" GB"
;
//list_files("");
}
...
...
@@ -217,6 +213,7 @@ function list_files(dir) {
function
process_list_file
(
xmldoc
)
{
var
can_continue
=
true
;
if
(
xmldoc
.
getElementsByTagName
(
'list_files'
).
length
>
0
)
{
if
(
xmldoc
.
getElementsByTagName
(
'list_files'
)[
0
].
firstChild
!=
null
){
if
(
xmldoc
.
getElementsByTagName
(
'list_files'
)[
0
].
firstChild
.
data
!=
null
)
{
if
(
xmldoc
.
getElementsByTagName
(
'list_files'
)[
0
].
firstChild
.
data
==
"no webshare found"
)
{
console
.
log
(
"webshare not found"
);
...
...
@@ -228,9 +225,10 @@ function process_list_file(xmldoc) {
create_webshare
();
}
}
}
}
if
(
can_continue
){
console
.
log
(
"
continued
"
);
console
.
log
(
"
Processing file list
"
);
var
count
=
xmldoc
.
getElementsByTagName
(
'file'
).
length
;
var
response
=
"<table cellspacing=
\"
0px
\"
cellpadding=
\"
3px
\"
width=
\"
100%
\"
>"
;
response
+=
"<tr><td width=
\"
50%
\"
><b>File</b></td><td width=
\"
30%
\"
><b>Creation Date</b></td><td><b>Size</b></td></tr>"
;
...
...
@@ -288,7 +286,9 @@ function process_list_file(xmldoc) {
}
response
+=
"</table><br>"
;
document
.
getElementById
(
'filelist'
).
innerHTML
=
response
;
}
}
else
{
}
}
function
start_compressor
(
parent
,
port
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=init_compressor'
,
'&sensor_port='
+
port
);
...
...
@@ -314,7 +314,7 @@ function update_audio_form(thisform) {
}
}
function
makeRequest
(
url
,
parameters
)
{
function
makeRequest
(
url
,
parameters
,
callback
)
{
var
http_request
=
false
;
if
(
window
.
XMLHttpRequest
)
{
// Mozilla, Safari,...
http_request
=
new
XMLHttpRequest
();
...
...
@@ -339,18 +339,20 @@ function makeRequest(url, parameters) {
if
(
http_request
.
readyState
==
4
)
{
if
(
http_request
.
status
==
200
)
{
if
(
http_request
.
responseXML
!=
null
)
{
process_request
(
http_request
.
responseXML
);
process_request
(
http_request
.
responseXML
)
if
(
typeof
callback
!=
'undefined'
)
{
eval
(
callback
);
}
}
}
}
};
http_request
.
open
(
'GET'
,
url
+
parameters
,
true
);
http_request
.
open
(
'GET'
,
url
+
parameters
,
true
);
http_request
.
send
(
null
);
}
function
process_request
(
xmldoc
)
{
console
.
log
(
"process_request"
);
if
(
xmldoc
.
getElementsByTagName
(
'camogm_state'
).
length
>
0
)
{
console
.
log
(
xmldoc
.
getElementsByTagName
(
'state'
)[
0
].
firstChild
.
data
);
process_recording
(
xmldoc
);
...
...
@@ -368,7 +370,6 @@ function process_request(xmldoc) {
process_rename_file
(
xmldoc
);
break
;
case
"get_hdd_space"
:
console
.
log
(
"Got space responze"
);
process_hdd_space
(
xmldoc
);
break
;
case
"mount"
:
...
...
@@ -417,7 +418,8 @@ function process_recording(xmldoc) {
document
.
getElementById
(
'buffer_free'
).
style
.
width
=
Math
.
round
(
buffer_free
/
19791872
*
300
);
document
.
getElementById
(
'buffer_used'
).
style
.
width
=
Math
.
round
(
buffer_used
/
19791872
*
300
);
get_hdd_space
();
//get_hdd_space();
get_space
(
selected_mountpoint
);
if
(
xmldoc
.
getElementsByTagName
(
'buffer_overruns'
)[
0
].
firstChild
.
data
>
0
)
alert
(
"Buffer overrun! current datarate exceeds max. write rate"
)
...
...
@@ -425,7 +427,7 @@ function process_recording(xmldoc) {
recording
=
false
;
function
update_state
()
{
//if (recording) {
makeRequest
(
'camogm_interface.php'
,
'?cmd=status'
);
makeRequest
(
'camogm_interface.php'
,
'?cmd=status'
);
//setTimeout('update_state()', 200);
//}
}
...
...
@@ -457,8 +459,9 @@ function toggle_recording() {
}
//setTimeout('list_files(getCookie("current_dir"))', 300);
setTimeout
(
'get_hdd_space()'
,
600
);
//
setTimeout('get_hdd_space()', 600);
//setTimeout(last_update, 900);
//get_space(selected_mountpoint);
}
else
// Start it
{
...
...
@@ -473,8 +476,8 @@ function toggle_recording() {
document
.
getElementById
(
'record_text'
).
innerHTML
=
"<img src=
\"
images/stop.gif
\"
style=
\"
position:relative; bottom:-5px;
\"
> STOP"
;
document
.
getElementById
(
'sitecoloumn'
).
style
.
backgroundColor
=
"#AF2020"
;
//
clearInterval(update_intvl);
//
update_intvl = setInterval(update_state,1000);
clearInterval
(
update_intvl
);
update_intvl
=
setInterval
(
update_state
,
1000
);
}
//update_state();
}
...
...
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