summaryrefslogtreecommitdiffstats
path: root/app/fs.c
blob: 7b041fbb4d2a1937c0474240b8efb19e2323e4fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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)
{
}