Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for APStreamline in APWeb #3

Open
wants to merge 128 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
06c81dd
Makefile: correct mavlink generation
peterbarker Jun 10, 2017
c92697c
main: make serial port, broadcast and http port optional
peterbarker Jun 10, 2017
16cdbb8
main: option to receive fc data via UDP rather than serial
peterbarker Jun 10, 2017
f42a871
OSX compatability. osx defines the reboot function as int reboo…
davidbuzz Jun 11, 2017
75601ae
Merge pull request #3 from davidbuzz/master
tridge Jun 11, 2017
7522b6d
Merge pull request #2 from peterbarker/udp-in
tridge Jun 11, 2017
2ba008b
Readme - added requirement note
SamuelDudley Jun 12, 2017
52c5a85
Create http threads in detached state
peterbarker Jun 21, 2017
58f1545
fixed select logic
tridge Oct 27, 2017
7b9769b
Add origin checking
peterbarker Oct 27, 2017
e1075bd
Add avi mime type
peterbarker Oct 27, 2017
f2b011b
fixed multiple charts for same variable
peterbarker Oct 27, 2017
de29403
mavlink_statustext for logging
peterbarker Oct 27, 2017
a16d25f
return true if exception from JSON
peterbarker Oct 27, 2017
ba735ee
mavlink.js: send set_time_utc every 20 seconds
peterbarker Oct 27, 2017
efa44f7
mavlink.js: function to append a colourful message to an element-by-id
peterbarker Oct 27, 2017
5471230
mavlink.js: canonicalise whitespace in JSON before parsing
peterbarker Oct 27, 2017
a959463
ublox.js: reduce ublox refresh from 7 to 2 days
peterbarker Oct 27, 2017
b628527
files/calibration.html: remove bad element id
peterbarker Oct 27, 2017
5dacb61
files/calibration.html: clarify reboot-after-calibrate comment
peterbarker Oct 27, 2017
49e6717
files/calibration.html: make mag canvas larger
peterbarker Oct 27, 2017
fdf9943
files/calibration.html: include mag offsets in status
peterbarker Oct 27, 2017
4c0d6b1
files/calibration.html: ensure color is always set
peterbarker Oct 27, 2017
2dd930b
files/calibration.html: correct fill of calibration parms
peterbarker Oct 27, 2017
cde65f2
files/filesystem.html: present file count in interface
peterbarker Oct 27, 2017
5c79b6e
files/filesystem.html: add delete_all function
peterbarker Oct 27, 2017
049dbf2
files/filesystem.html: use 'Parent Directory' in place of ''
peterbarker Oct 27, 2017
a2a6fb9
files/nvram.html: correct refresh action
peterbarker Oct 27, 2017
7456091
files/parameters.html: fix search show/hide on refresh
peterbarker Oct 27, 2017
580a440
files/parameters.html: added support for bitmasks in parameters
peterbarker Oct 27, 2017
1545542
files/status.html: display STATUSTEXT on status page
peterbarker Oct 27, 2017
eaa657d
files/status.html: show EKF status on GPS page
peterbarker Oct 27, 2017
d6925fd
files/status.html: fixes for rc-ok checks
peterbarker Oct 27, 2017
efb7708
files/status.html: adjust refresh to 4Hz
peterbarker Oct 27, 2017
2e59531
files/status.html: save last position when available
peterbarker Oct 27, 2017
d374631
files/status.html: option to test 4 motors
peterbarker Oct 27, 2017
5b043a5
rename get_ssid to get_ssid_info
peterbarker Oct 27, 2017
1d0ef8a
mavlink_json: whitespace fix
peterbarker Oct 27, 2017
9c9c3e0
web_server: adjust debug level
peterbarker Oct 27, 2017
b5185b9
web_server.c: freertos compatability
peterbarker Oct 27, 2017
539a862
functions.c: deconst some variables in freertos
peterbarker Oct 27, 2017
754fb16
functions.c: sync write fh on file upload
peterbarker Oct 27, 2017
8c7c8a3
html/functions.c: prettify sonix upgrade messages
peterbarker Oct 28, 2017
8eb4d8c
functions.c: fix bug in nvram_set_value
peterbarker Oct 28, 2017
e351809
functions.c: read data length from nvram in nvram_pack_values
peterbarker Oct 28, 2017
e429957
functions.c: add get_ssid function
peterbarker Oct 28, 2017
b6e01c8
web_server.c: freertos-specific sock_printf functionality
peterbarker Oct 28, 2017
fbf8ada
web_server.c: copy in FreeRTOS web_server_connection_process method
peterbarker Oct 28, 2017
d7766c6
web_server.c: copy in FreeRTOS web_server_task_process
peterbarker Oct 28, 2017
3c639de
web_server.c: protect POSIX-specific functions, update Sonix includes
peterbarker Oct 28, 2017
398a729
web_server.c: origin-checking allows from FreeRTOS get_local_ip
peterbarker Oct 28, 2017
990cd05
web_server.h: FreeRTOS support
peterbarker Oct 28, 2017
2a09606
fixed misaligned accesses for SERVO_OUTPUT_RAW
peterbarker Oct 28, 2017
949b8df
include.h: FreeRTOS support
peterbarker Oct 28, 2017
eba1787
functions.c: update FreeRTOS includes
peterbarker Oct 28, 2017
9df86d5
functions.c: FreeRTOS reboot function
peterbarker Oct 28, 2017
680e38a
Makefile: conform to gnu99 standards
peterbarker Jun 13, 2017
f7d6efb
Add a .gitignore
peterbarker Jun 14, 2017
4000bc8
files: index.html: adjust welcome message
peterbarker Aug 18, 2017
d642269
Use console_printf in place of fprintf
peterbarker Jun 21, 2017
46c7b8b
main: avoid calling mavlink_broadcast with bad fd
peterbarker Jun 13, 2017
41246aa
web_server: Add UDP address:port output
peterbarker Jun 20, 2017
9c5fab0
web_server: allow specification of IP address for TCP listen
peterbarker Jun 21, 2017
208087d
web_server: Make serial port read errors non-fatal
peterbarker Jun 21, 2017
81a23fd
web_server: Increase debug on accept failure
peterbarker Jun 21, 2017
d37c41f
web_server: Move http accept into own function, add error checking
peterbarker Jun 21, 2017
62e75f0
files: filesystem.html: option to start in a specific directory
peterbarker Aug 31, 2017
de652bf
linux: use clock_gettime to reliably get boot time
peterbarker Sep 7, 2017
06ce9fc
linux: invoke shutdown(1) for __reboot
peterbarker Jun 14, 2017
c415f39
posix: add disk_info function
peterbarker Jun 14, 2017
d6bf301
posix: add file_listdir
peterbarker Jun 14, 2017
61d0a86
posix: download_filesystem support
peterbarker Sep 1, 2017
9bce46d
linux: Get system information statistics working
peterbarker Jun 22, 2017
db0dbde
web_server: catch SIGPIPE
peterbarker Sep 28, 2017
2e3c95f
filesystem.html: sort by filename
peterbarker Oct 5, 2017
0875be2
files: Generalise some interface messages
peterbarker Jun 14, 2017
2d31758
files: parameters.html: set default category to All
peterbarker Aug 18, 2017
4257006
linux: use system_time messages to set system clock
peterbarker Sep 22, 2017
61022e2
APSync: linux: use nmcli for control of network interfaces
peterbarker Jun 14, 2017
7cefe58
APSync: system.html: 0 is a valid channel (use any)
peterbarker Sep 1, 2017
873fbd8
APSync: functions.c: 0 is a valid wifi channel
peterbarker Sep 1, 2017
086f0c4
APSync: Create custom apsync status.html page
peterbarker Jun 21, 2017
c1cf78e
APSync: create custom calibration page without one-touch calibration
peterbarker Sep 1, 2017
86b9bd4
APSync: Use local files for apsync and apsync.local hostnames
peterbarker Aug 18, 2017
ba5d331
APSync: Add direct link to download dataflash logs
peterbarker Aug 31, 2017
ea1850a
linux: use clock_settime in place of stime for setting system time
peterbarker Sep 25, 2017
d123f2d
APSync: trusted IP address is 10.0.1.128
peterbarker Nov 1, 2017
c1a1d1e
mavlink.js: ensure stream rate matches refresh rate
peterbarker Nov 2, 2017
3e4817c
Add support for a configuration file
peterbarker Nov 2, 2017
a3fdaba
APSync: copy in a whole bunch of improvements to status.html
peterbarker Nov 2, 2017
cc8da2f
Avoid putting misleading fc baudrate in interface
peterbarker Nov 2, 2017
ad9a6ec
linux: simplify get_sys_seconds_boot
peterbarker Nov 2, 2017
e58c5bf
linux: correct sanity check of FC_MIN_DATE
peterbarker Dec 10, 2017
cf31727
mavlink.js: fix IE; doesn't do ECMA6 default parameters
peterbarker Dec 13, 2017
2ef8a32
Makefile: conform to gnu99 standards
peterbarker Jun 13, 2017
3d68e89
Add a .gitignore
peterbarker Jun 14, 2017
0fb539d
files: index.html: adjust welcome message
peterbarker Aug 18, 2017
514d219
Use console_printf in place of fprintf
peterbarker Jun 21, 2017
010f86e
main: avoid calling mavlink_broadcast with bad fd
peterbarker Jun 13, 2017
9efce71
web_server: Add UDP address:port output
peterbarker Jun 20, 2017
61758fb
web_server: allow specification of IP address for TCP listen
peterbarker Jun 21, 2017
a408636
web_server: Make serial port read errors non-fatal
peterbarker Jun 21, 2017
30c8d45
web_server: Increase debug on accept failure
peterbarker Jun 21, 2017
abb5e29
web_server: Move http accept into own function, add error checking
peterbarker Jun 21, 2017
67f1df0
files: filesystem.html: option to start in a specific directory
peterbarker Aug 31, 2017
1631374
linux: use clock_gettime to reliably get boot time
peterbarker Sep 7, 2017
34a7fb3
linux: invoke shutdown(1) for __reboot
peterbarker Jun 14, 2017
2e1dfb2
posix: add disk_info function
peterbarker Jun 14, 2017
de8842e
posix: add file_listdir
peterbarker Jun 14, 2017
dcfc332
posix: download_filesystem support
peterbarker Sep 1, 2017
2cadb19
linux: Get system information statistics working
peterbarker Jun 22, 2017
d6bca4c
web_server: catch SIGPIPE
peterbarker Sep 28, 2017
f4b8aab
filesystem.html: sort by filename
peterbarker Oct 5, 2017
be7dfdc
Added copy URL button
shortstheory Aug 2, 2018
4bdf991
Merge branch 'apsync' into video_streaming
shortstheory Aug 2, 2018
feaa880
Fixed layout bug
shortstheory Aug 7, 2018
b0d8471
Changed SIG for killing the stream server
shortstheory Aug 8, 2018
cd4289c
Fixed segfault bug
shortstheory Aug 8, 2018
bad39ae
Changed location of stream server binary
shortstheory Sep 18, 2018
2374b8f
Changed stream_server executable path
shortstheory Sep 18, 2018
9ce1ff1
mavlink: update to ardupilot master
peterbarker Mar 14, 2019
80d1085
Makefile: use mavgen shipped with mavlink's pymavlink
peterbarker Mar 14, 2019
ab9568b
Merged with current version of AP master
shortstheory Mar 27, 2019
e801235
Fixed CORS requests from Chrome/Safari
shortstheory Mar 31, 2019
11a48e5
Disabled the file recorder
shortstheory Apr 1, 2019
e4b0b54
Re-enabled quality for UVC cameras
shortstheory Apr 1, 2019
2b4dcf1
Removed file recording checkbox
shortstheory May 21, 2019
b820315
Changed path of stream_server executable for APStreamline
shortstheory Jul 31, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
generated
web_server
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CC=gcc
CFLAGS=-Wall -g -Werror
CFLAGS=-Wall -g -Werror -std=gnu99

SRC = $(wildcard *.c) $(wildcard lib/*.c) $(wildcard linux/*.c)
SRC = $(wildcard *.c) $(wildcard lib/*.c) $(wildcard linux/*.c) $(wildcard posix/*.c)
OBJ = $(SRC:%.c=%.o)
LIBS = -ltalloc -lpthread

Expand All @@ -12,7 +12,7 @@ all: files/embedded.c mavlink web_server
mavlink: generated/mavlink/ardupilotmega/mavlink.h

generated/mavlink/ardupilotmega/mavlink.h:
mavgen.py --lang C ../mavlink/message_definitions/v1.0/ardupilotmega.xml -o generated/mavlink --wire-protocol=2.0
modules/mavlink/pymavlink/tools/mavgen.py --lang C modules/mavlink/message_definitions/v1.0/ardupilotmega.xml -o generated/mavlink --wire-protocol=2.0

web_server: $(OBJ) files/embedded.c
$(CC) -o web_server $(OBJ) $(LIBS)
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ Some information on the JSON protocol used is here:

https://docs.google.com/document/d/12IQFXDRIif06BiriHSCGdiJGZ6zsQ_phQsG_iI6_MAo/edit?usp=sharing

#### Build Notes
_Ubuntu 16.04_
- libtalloc-dev is required to build this project. You can install the required package with the following command: `sudo apt-get install libtalloc-dev`


15 changes: 12 additions & 3 deletions cgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "includes.h"
#include <ctype.h>

#ifdef _POSIX_VERSION
#include "posix/functions.h"
#endif

#define CONTENT_DISPOSITION "Content-Disposition:"
#define CONTENT_TYPE "Content-Type:"
#define MULTIPART_FORM_DATA "multipart/form-data"
Expand Down Expand Up @@ -430,6 +434,7 @@ static const struct mime_type {
{".txt", "text/plain", MIME_TYPE_TEXT_PLAIN},
{".html", "text/html;charset=UTF-8", MIME_TYPE_TEXT_HTML},
{".mp4", "video/mp4", MIME_TYPE_VIDEO_MP4},
{".avi", "video/avi", MIME_TYPE_VIDEO_AVI},
{".bin", "data", MIME_TYPE_UNKNOWN},
{".svg", "image/svg+xml", MIME_TYPE_IMAGE_SVG},
{".js", "application/javascript", MIME_TYPE_JAVASCRIPT},
Expand Down Expand Up @@ -588,13 +593,11 @@ static void download(struct cgi_state *cgi, const char *path)

mtype = get_mime_type(path);

#ifdef SYSTEM_FREERTOS
if (strncmp(path, "fs/", 3) == 0) {
download_filesystem(cgi, path);
return;
}
#endif


size_t size = 0;
const char *contents = get_embedded_file(path, &size);
if (!contents) {
Expand Down Expand Up @@ -649,6 +652,12 @@ static bool setup_standalone(struct cgi_state *cgi)
cgi->content_length = atoi(&line[16]);
} else if (strncasecmp(line,"Content-Type: ", 14)==0) {
cgi->content_type = talloc_strdup(cgi, &line[14]);
} else if (strncasecmp(line,"Origin: ", 8)==0) {
cgi->origin = talloc_strdup(cgi, &line[8]);
if (cgi->check_origin != NULL && !cgi->check_origin(cgi->origin)) {
cgi->http_error(cgi, "400 Bad Origin", "",
"request with incorrect origin header");
}
}
/* ignore all other requests! */
}
Expand Down
3 changes: 3 additions & 0 deletions cgi.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,12 @@ struct cgi_state {
const char *err, const char *header, const char *info);
void (*download)(struct cgi_state *cgi, const char *path);
void (*put)(struct cgi_state *cgi, const char *name, const char *value);
bool (*check_origin)(const char *origin);

/* data */
struct cgi_var *variables;
struct template_state *tmpl;
const char *origin;
char *content_type;
unsigned long content_length;
int request_post;
Expand All @@ -65,6 +67,7 @@ enum CGI_MIME_TYPE {MIME_TYPE_IMAGE_GIF,
MIME_TYPE_TEXT_PLAIN,
MIME_TYPE_TEXT_HTML,
MIME_TYPE_VIDEO_MP4,
MIME_TYPE_VIDEO_AVI,
MIME_TYPE_JAVASCRIPT,
MIME_TYPE_JSON,
MIME_TYPE_CSS,
Expand Down
2 changes: 1 addition & 1 deletion files/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
all:
@echo "Generating embedded.c"
@./embed.py *.html images/*.svg */*.js */*.json */*.css */*.jpg */*.png */*.mjpg data/*.xml
@./embed.py *.html images/*.svg */*.js */*.json */*.css */*.jpg */*.png */*.mjpg data/*.xml apsync/*.html
@echo "Generating manifest"
@./gen_manifest.sh
@echo "Generating version.h"
Expand Down
Loading