Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
11fbd58a
Commit
11fbd58a
authored
Dec 17, 2014
by
Jeroen Vreeken
Browse files
Add traces path to ini file.
Small trace related stuff
parent
2d3db21c
Changes
7
Hide whitespace changes
Inline
Side-by-side
common/trace/trace2file.c
View file @
11fbd58a
/*
Copyright Jeroen Vreeken (jeroen@vreeken.net), 2014
Copyright Stichting C.A. Muller Radioastronomiestation, 2007, 2008, 2011
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
...
...
@@ -100,7 +99,7 @@ int main(int argc, char **argv)
printf
(
"Connection ready for tracing
\n
"
);
if
(
interval
)
{
if
(
interval
>
0
)
{
nsec_interval
=
t_int
.
tv_sec
*
1000000000
;
nsec_interval
+=
t_int
.
tv_nsec
;
...
...
@@ -115,7 +114,15 @@ int main(int argc, char **argv)
trace_packet_write
(
trace
,
pkt
);
trace_packet_write_fd
(
fd_file
,
pkt
);
trace_packet_put
(
pkt
);
}
else
if
(
interval
<
0
)
{
pkt
=
trace_packet_new
();
trace_packet_interval_set
(
pkt
,
&
t_int
,
TRACE_INTERVAL_TYPE_CHANGED
);
trace_packet_write
(
trace
,
pkt
);
trace_packet_write_fd
(
fd_file
,
pkt
);
trace_packet_put
(
pkt
);
}
pkt
=
trace_packet_new
();
trace_packet_name_set
(
pkt
,
tracename
);
...
...
common/utils/dt_host.c
View file @
11fbd58a
...
...
@@ -26,6 +26,7 @@ static char *controller_host = "localhost";
static
char
*
console_host
=
"localhost"
;
static
char
*
log_path
=
"/var/log/dt/"
;
static
char
*
htdocs_path
=
"/var/www/htdocs/"
;
static
char
*
traces_path
=
"/var/log/dt/traces/"
;
static
unsigned
short
htdocs_port
=
80
;
static
bool
init_done
=
false
;
...
...
@@ -82,6 +83,10 @@ static int load_config(void)
htdocs_port
=
g_key_file_get_integer
(
keyfile
,
groups
[
i
],
"port"
,
NULL
);
}
if
(
g_key_file_has_key
(
keyfile
,
groups
[
i
],
"traces"
,
NULL
))
{
traces_path
=
strdup
(
g_key_file_get_string
(
keyfile
,
groups
[
i
],
"traces"
,
NULL
));
}
}
}
...
...
@@ -127,6 +132,14 @@ char *dt_host_htdocs_path(void)
return
htdocs_path
;
}
char
*
dt_host_traces_path
(
void
)
{
if
(
!
init_done
)
load_config
();
return
traces_path
;
}
unsigned
short
dt_host_htdocs_port
(
void
)
{
if
(
!
init_done
)
...
...
common/utils/dt_host.h
View file @
11fbd58a
...
...
@@ -24,6 +24,7 @@ char *dt_host_console(void);
char
*
dt_host_controller
(
void
);
char
*
dt_host_log_path
(
void
);
char
*
dt_host_htdocs_path
(
void
);
char
*
dt_host_traces_path
(
void
);
unsigned
short
dt_host_htdocs_port
(
void
);
#endif
/* _INCLUDE_DT_HOST_H_ */
console/console/console_httpd.c
View file @
11fbd58a
...
...
@@ -26,6 +26,7 @@
#include <libwebsockets.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <dt_port_numbers.h>
...
...
@@ -168,7 +169,7 @@ void ws_client_flush(struct ws_client *client)
}
}
#define MAX_POLL_ELEMENTS
256
#define MAX_POLL_ELEMENTS
1024
struct
pollfd
pollfds
[
MAX_POLL_ELEMENTS
];
int
count_pollfds
=
0
;
...
...
@@ -361,7 +362,7 @@ static int status_remove(struct libwebsocket *wsi)
}
#define MAX_TRACE_ELEMENTS
256
#define MAX_TRACE_ELEMENTS
1024
struct
trace
*
traces
[
MAX_TRACE_ELEMENTS
];
int
count_traces
=
0
;
...
...
@@ -757,16 +758,23 @@ static int callback_http(struct libwebsocket_context *context,
if
(
strcmp
(
requested_uri
,
"/"
)
==
0
)
{
requested_uri
=
"/index.html"
;
}
char
*
cwd
=
dt_host_htdocs_path
();
char
*
cwd
;
if
(
strncmp
(
requested_uri
,
"/traces"
,
7
)
==
0
)
{
cwd
=
dt_host_traces_path
();
requested_uri
+=
7
;
}
else
{
cwd
=
dt_host_htdocs_path
();
}
char
*
resource_path
;
struct
stat
statbuf
;
resource_path
=
malloc
(
strlen
(
cwd
)
+
strlen
(
requested_uri
)
+
1
);
sprintf
(
resource_path
,
"%s%s"
,
cwd
,
requested_uri
);
printf
(
"resource path: %s
\n
"
,
resource_path
);
stat
(
resource_path
,
&
statbuf
);
if
(
resource_path
[
strlen
(
resource_path
)
-
1
]
==
'/'
)
{
if
(
S_ISDIR
(
statbuf
.
st_mode
)
)
{
r
=
list_dir
(
context
,
wsi
,
requested_uri
,
resource_path
);
}
else
if
(
!
strcmp
(
resource_path
+
strlen
(
resource_path
)
-
strlen
(
".cgi"
),
...
...
console/console/start_console.sh
View file @
11fbd58a
...
...
@@ -34,8 +34,8 @@ for tr in $TR; do
mv
-f
${
tr
}
${
tr
}
.1
done
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Position traces/Azimuth_Position.trace
2
50
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Position traces/Elevation_Position.trace
2
50
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Speed traces/Azimuth_Speed.trace
2
50
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Speed_Right traces/Elevation_Speed_Right.trace
2
50
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Speed_Left traces/Elevation_Speed_Left.trace
2
50
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Position traces/Azimuth_Position.trace
1
50
00
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Position traces/Elevation_Position.trace
1
50
00
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Azimuth_Speed traces/Azimuth_Speed.trace
1
50
00
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Speed_Right traces/Elevation_Speed_Right.trace
1
50
00
screen
-S
console
-X
screen
-t
trace_az_pos ../../common/trace/trace2file localhost 10000 Elevation_Speed_Left traces/Elevation_Speed_Left.trace
1
50
00
console/htdocs/trace.html
View file @
11fbd58a
...
...
@@ -11,9 +11,7 @@
<div
id=
"trace_win"
></div>
</head>
<body>
<div
id=
"graphdiv"
></div>
</body>
...
...
@@ -31,13 +29,17 @@ tw.title_set("Trace");
var
graph
=
new
dt_ui_element
(
"
trace_win_graph
"
);
var
tsel
=
new
dt_ui_select
(
"
trace_win_select
"
);
var
tlabel
=
new
dt_ui_element
(
"
trace_win_label
"
);
tw
.
add
([
graph
,
tsel
,
tlabel
]);
t
w
.
add
([
graph
,
tsel
]
);
t
label
.
text_set
(
"
Select trace...
"
);
graph
.
width_set
(
700
);
graph
.
height_set
(
350
);
graph
.
width_set
(
window
.
innerWidth
-
60
);
graph
.
height_set
(
window
.
innerHeight
-
200
);
tw
.
align_vertical
([
tsel
,
tlabel
,
graph
]);
tw
.
align_vertical
([
tsel
,
graph
]);
var
traces_url
=
"
/traces/
"
;
...
...
@@ -53,6 +55,8 @@ for (i = 0; i < traces_links.length; i++)
function
load_trace
(
tracename
)
{
tlabel
.
text_set
(
"
Loading
"
+
tracename
+
"
...
"
);
load_bin
(
tracename
,
function
(
buf
)
{
var
ts
=
new
trace_stream
();
var
got_time
=
false
;
...
...
@@ -86,9 +90,6 @@ function load_trace(tracename)
var
graph_data
=
new
Array
();
for
(
i
=
0
;
i
<
trace_data
.
length
;
i
++
)
{
console
.
log
(
i
+
"
:
"
+
trace_data
[
i
].
t
.
sec
+
"
.
"
+
trace_data
[
i
].
t
.
nsec
+
"
"
+
trace_data
[
i
].
value
);
var
td
=
new
Array
();
td
.
push
(
new
Date
(
trace_data
[
i
].
t
.
ms_get
()));
...
...
@@ -102,6 +103,7 @@ function load_trace(tracename)
graph_data
,
{
labels
:
[
"
x
"
,
ts
.
name
]
}
);
tlabel
.
text_set
(
"
Viewing
"
+
tracename
);
});
}
...
...
console/htdocs/traces
deleted
120000 → 0
View file @
2d3db21c
../console/traces
\ 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