From 4342064ee35d4facf1ad4cbde8f6f84460df02a0 Mon Sep 17 00:00:00 2001 From: root Date: Sat, 20 Mar 2021 12:08:14 +0000 Subject: add webserver content --- app/fs.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 app/fs.c (limited to 'app/fs.c') diff --git a/app/fs.c b/app/fs.c new file mode 100644 index 0000000..7b041fb --- /dev/null +++ b/app/fs.c @@ -0,0 +1,69 @@ +#include "project.h" + +#if 0 +#define FS_FILE_FLAGS_HEADER_INCLUDED 0x01 +#define FS_FILE_FLAGS_HEADER_PERSISTENT 0x02 +#define FS_FILE_FLAGS_HEADER_HTTPVER_1_1 0x04 +#define FS_FILE_FLAGS_SSI 0x08 +#endif + + +static char index_html[8192]; + +static uint32_t make_index (void) +{ + uint64_t abs = ref_get(); + EPOCH e; + UTC u; + ST l; + char buf[128]; + + PTB_INIT (index_html); + + e = ref_decompose (abs); + u = time_epoch_to_utc (e); + l = time_utc_to_lst (u, gps_lon); + + utc_to_str (buf, &u); + + PTB_ADD ("
\n");
+  PTB_ADD ("UTC: %s\n", buf);
+  PTB_ADD ("LST:                 %02d:%02d:%02d.%09d\n", l.hour, l.minute, l.second, l.nanosecond);
+  PTB_ADD("\n");
+
+  PTB_ADD ("GPS:\n");
+  PTB_ADD ("%s\n", gps_info);
+  PTB_ADD (" %s\n", gps_pos);
+  PTB_ADD (" %s\n", gps_svin_info);
+  PTB_ADD("\n");
+
+  PTB_ADD ("%s", gps_svinfo);
+  PTB_ADD ("
\n"); + + return PTB_LEN; +} + +int fs_open_custom (struct fs_file *file, const char *name) +{ + int len; + + if (strcmp (name, "/index.html")) return 0; + + len = make_index(); + + file->data = (const char *)index_html; + file->len = len; + file->index = file->len; + file->pextension = NULL; + file->flags = 0; + + + return 1; +} + + + + +void fs_close_custom (struct fs_file *file) +{ +} -- cgit v1.2.3