summaryrefslogtreecommitdiffstats
path: root/app/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/fs.c')
-rw-r--r--app/fs.c69
1 files changed, 69 insertions, 0 deletions
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 ("<pre>\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 ("</pre>\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)
+{
+}