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
1013ff59
Commit
1013ff59
authored
Sep 23, 2016
by
Mikhail Karpenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update device list and status information in camogmgui
parent
75cce656
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
28 deletions
+49
-28
Makefile
src/Makefile
+1
-1
camogm_interface.php
src/camogmgui/camogm_interface.php
+29
-19
camogmgui.js
src/camogmgui/camogmgui.js
+19
-8
hdd.png
src/camogmgui/images/hdd.png
+0
-0
No files found.
src/Makefile
View file @
1013ff59
...
...
@@ -7,7 +7,7 @@ CONFIGS = qt_source
IMAGES
=
$(GUIDIR)
/images/filebrowser-01.gif
$(GUIDIR)
/images/filebrowser-bottom-01.gif
$(GUIDIR)
/images/png_white_30.png
\
$(GUIDIR)
/images/record.gif
$(GUIDIR)
/images/reload.png
$(GUIDIR)
/images/stop.gif
$(GUIDIR)
/images/create_folder.png
\
$(GUIDIR)
/images/divider.png
$(GUIDIR)
/images/folder.gif
$(GUIDIR)
/images/help.png
$(GUIDIR)
/images/quicktime.png
\
$(GUIDIR)
/images/rec_folder.png
$(GUIDIR)
/images/up_folder.gif
$(GUIDIR)
/images/play_audio.png
$(GUIDIR)
/images/rec_folder.png
$(GUIDIR)
/images/up_folder.gif
$(GUIDIR)
/images/play_audio.png
$(GUIDIR)
/images/hdd.png
SRCS
=
camogm.c camogm_ogm.c camogm_jpeg.c camogm_mov.c camogm_kml.c camogm_read.c index_list.c
...
...
src/camogmgui/camogm_interface.php
View file @
1013ff59
...
...
@@ -124,7 +124,7 @@ else if ($cmd == "status")
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
$status
);
printf
(
"%s"
,
$status
);
}
else
if
(
$cmd
==
"run_status"
)
{
...
...
@@ -151,7 +151,7 @@ else if ($cmd == "run_status")
header
(
"Content-Type: text/xml"
);
header
(
"Content-Length: "
.
strlen
(
$status
)
.
"
\n
"
);
header
(
"Pragma: no-cache
\n
"
);
printf
(
$status
);
printf
(
"%s"
,
$status
);
}
else
if
(
$cmd
==
"get_hdd_space"
){
if
(
isset
(
$_GET
[
'mountpoint'
]))
...
...
@@ -188,7 +188,7 @@ else if ($cmd=="mount") { // mount media like HDD
echo
"</"
.
$cmd
.
">"
;
xml_footer
();
}
else
if
(
$cmd
==
"unmount"
)
{
// unmount media like HDD
else
if
(
(
$cmd
==
"umount"
)
||
(
$cmd
==
"unmount"
)
)
{
// unmount media like HDD
$message
=
""
;
if
(
isset
(
$_GET
[
'mountpoint'
]))
{
$mountpoint
=
$_GET
[
'mountpoint'
];
...
...
@@ -348,29 +348,36 @@ else
case
"listdevices"
:
exec
(
"cat /proc/partitions"
,
$arr1
);
exec
(
"cat /proc/mounts"
,
$arr2
);
$j
=
0
;
// first two lines are header and empty line separator, skip them
$i
=
2
;
while
(
$i
<
count
(
$arr1
))
{
if
(
!
strpos
(
$arr1
[
$i
],
"mtdblock"
))
{
// skip flash and RAM disk partitions
if
(
!
strpos
(
$arr1
[
$i
],
"mtdblock"
)
&&
!
strpos
(
$arr1
[
$i
],
"ram"
))
{
$temp
=
$arr1
[
$i
];
while
(
strstr
(
$temp
,
" "
))
{
$temp
=
str_replace
(
chr
(
9
),
" "
,
$temp
);
$temp
=
str_replace
(
" "
,
" "
,
$temp
);
}
//echo $temp;
preg_match_all
(
'/[a-z]{3,3}[0-9]{1,1}/'
,
$temp
,
$available_partitons
);
//preg_match_all('/[a-z]{3,3}/', $temp, $available_devices);
$parts
=
explode
(
" "
,
$temp
);
$size
=
$parts
[
3
];
if
(
preg_match_all
(
'/ +[a-z]{3,3}[0-9]{1,1}$/'
,
$temp
,
$available_partitons
)
>
0
)
{
// remove leading spaces
$partitions
[
$j
]
=
preg_replace
(
"/^ +/"
,
""
,
$available_partitons
[
0
][
0
]);
$parts
=
explode
(
" "
,
$temp
);
$size
[
$j
]
=
$parts
[
3
];
$j
++
;
}
}
$i
++
;
}
foreach
(
$available_partitons
as
$device
)
{
$j
=
0
;
foreach
(
$partitions
as
$partition
)
{
echo
"<item>"
;
echo
"<partition>/dev/"
.
$device
[
0
]
.
"</partition>"
;
echo
"<size>"
.
round
(
$size
/
1024
/
1024
,
2
)
.
" GB</size>"
;
$i
=
2
;
echo
"<partition>/dev/"
.
$partition
.
"</partition>"
;
echo
"<size>"
.
round
(
$size
[
$j
]
/
1024
/
1024
,
2
)
.
" GB</size>"
;
$j
++
;
$i
=
0
;
while
(
$i
<
count
(
$arr2
))
{
if
(
strpos
(
$arr2
[
$i
],
$
device
[
0
]
))
if
(
strpos
(
$arr2
[
$i
],
$
partition
))
{
$parts
=
explode
(
" "
,
$arr2
[
$i
]);
$mountpoint
=
$parts
[
1
];
...
...
@@ -378,17 +385,20 @@ else
}
$i
++
;
}
if
(
$mountpoint
!=
""
)
if
(
$mountpoint
!=
""
)
{
echo
"<mountpoint>"
.
$mountpoint
.
"</mountpoint>"
;
else
$mountpoint
=
""
;
}
else
{
echo
"<mountpoint>none</mountpoint>"
;
if
(
$filesystem
!=
""
)
}
if
(
$filesystem
!=
""
)
{
echo
"<filesystem>"
.
$filesystem
.
"</filesystem>"
;
else
$filesystem
=
""
;
}
else
{
echo
"<filesystem>none</filesystem>"
;
}
echo
"</item>"
;
}
break
;
case
"mkdir"
:
...
...
src/camogmgui/camogmgui.js
View file @
1013ff59
...
...
@@ -75,7 +75,7 @@ function scan_devices() {
function
process_scan_devices
(
xmldoc
)
{
if
(
xmldoc
.
getElementsByTagName
(
'listdevices'
).
length
>
0
)
{
var
content
=
""
;
content
+=
"<table cellpadding='
10
' cellspacing='0' cellmargin='0'>"
;
content
+=
"<table cellpadding='
5
' cellspacing='0' cellmargin='0'>"
;
content
+=
"<tr><td></td><td><b>Partition</b></td><td><b>Mountpoint</b></td><td><b>Size</b></td><td><b>Filesystem</b></td><td></td></tr>"
;
for
(
var
i
=
0
;
i
<
xmldoc
.
getElementsByTagName
(
'item'
).
length
;
i
++
)
{
if
(
xmldoc
.
getElementsByTagName
(
'item'
)[
i
].
firstChild
.
firstChild
.
data
!=
null
)
{
...
...
@@ -85,7 +85,7 @@ function process_scan_devices(xmldoc) {
content
+=
" value='/var/hdd'"
;
content
+=
"></td><td>"
+
xmldoc
.
getElementsByTagName
(
'size'
)[
i
].
firstChild
.
data
+
"</td><td>"
+
'</td><td><a href="#" onClick="mount_custom_partition(
\'
'
+
xmldoc
.
getElementsByTagName
(
'partition'
)[
i
].
firstChild
.
data
+
'
\'
);">mount</a></td></tr>'
;
}
else
{
content
+=
"<tr><td><img alt=
\"
HDD
\"
src=
\"
../camerasetup/
images/hdd.png
\"
></td><td>"
+
xmldoc
.
getElementsByTagName
(
'partition'
)[
i
].
firstChild
.
data
;
content
+=
"<tr><td><img alt=
\"
HDD
\"
src=
\"
images/hdd.png
\"
></td><td>"
+
xmldoc
.
getElementsByTagName
(
'partition'
)[
i
].
firstChild
.
data
;
content
+=
"</td><td>"
+
xmldoc
.
getElementsByTagName
(
'mountpoint'
)[
i
].
firstChild
.
data
+
"</td><td>"
;
content
+=
xmldoc
.
getElementsByTagName
(
'size'
)[
i
].
firstChild
.
data
+
"</td><td>"
+
xmldoc
.
getElementsByTagName
(
'filesystem'
)[
i
].
firstChild
.
data
;
content
+=
'</td><td><a href="#" onClick="unmount_custom_partition(
\'
'
+
xmldoc
.
getElementsByTagName
(
'mountpoint'
)[
i
].
firstChild
.
data
+
'
\'
);">unmount</a></td></tr>'
;
...
...
@@ -272,9 +272,11 @@ function makeRequest(url, parameters) {
function
process_request
()
{
if
(
http_request
.
readyState
==
4
)
{
if
(
http_request
.
status
==
200
)
{
console
.
log
(
"process_request"
);
if
(
http_request
.
responseXML
!=
null
)
{
var
xmldoc
=
http_request
.
responseXML
;
if
(
xmldoc
.
getElementsByTagName
(
'camogm_state'
).
length
>
0
)
{
console
.
log
(
xmldoc
.
getElementsByTagName
(
'state'
)[
0
].
firstChild
.
data
);
process_recording
(
xmldoc
);
}
if
(
xmldoc
.
getElementsByTagName
(
'command'
).
length
>
0
)
{
...
...
@@ -319,7 +321,10 @@ function process_recording(xmldoc) {
var
frame_number
=
xmldoc
.
getElementsByTagName
(
'frame_number'
)[
0
].
firstChild
.
data
;
var
file_length
=
xmldoc
.
getElementsByTagName
(
'file_length'
)[
0
].
firstChild
.
data
;
var
file_name
=
xmldoc
.
getElementsByTagName
(
'file_name'
)[
0
].
firstChild
.
data
;
if
(
state
==
'"stopped"'
){
clearInterval
(
update_intvl
);
}
//Update HTML
document
.
getElementById
(
'ajax_state'
).
innerHTML
=
state
.
substring
(
1
,
state
.
length
-
1
);
document
.
getElementById
(
'ajax_file_duration'
).
innerHTML
=
Math
.
round
(
file_duration
*
100
)
/
100
+
" seconds / "
+
frame_number
+
" frames"
;
...
...
@@ -345,11 +350,14 @@ function process_recording(xmldoc) {
}
recording
=
false
;
function
update_state
()
{
if
(
recording
)
{
//
if (recording) {
makeRequest
(
'camogm_interface.php'
,
'?cmd=status'
);
setTimeout
(
'update_state()'
,
200
);
}
//
setTimeout('update_state()', 200);
//
}
}
var
update_intvl
;
function
toggle_recording
()
{
if
(
recording
)
// Stop it
{
...
...
@@ -376,7 +384,7 @@ function toggle_recording() {
setTimeout
(
'list_files(getCookie("current_dir"))'
,
300
);
setTimeout
(
'get_hdd_space()'
,
600
);
setTimeout
(
"makeRequest('camogm_interface.php', '?cmd=status')"
,
900
);
//setTimeout(last_update
, 900);
}
else
// Start it
{
...
...
@@ -390,8 +398,11 @@ function toggle_recording() {
// show we are 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
);
}
update_state
();
//
update_state();
}
function
rename_file
(
oldname
,
newname
)
{
makeRequest
(
'camogm_interface.php'
,
'?cmd=file_rename&file_old='
+
oldname
+
'&file_new='
+
newname
);
...
...
src/camogmgui/images/hdd.png
0 → 100644
View file @
1013ff59
1.62 KB
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