S&B Volcano vaporizer remote control with Pi Pico W
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

http.c 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * http.c
  3. *
  4. * https://github.com/krzmaz/pico-w-webserver-example
  5. * https://github.com/lwip-tcpip/lwip/blob/master/contrib/examples/httpd/genfiles_example/genfiles_example.c
  6. * https://www.nongnu.org/lwip/2_1_x/group__httpd.html
  7. *
  8. * Copyright (c) 2023 Thomas Buck (thomas@xythobuz.de)
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation, either version 3 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. *
  20. * See <http://www.gnu.org/licenses/>.
  21. */
  22. #include "lwip/apps/httpd.h"
  23. #include "config.h"
  24. #include "log.h"
  25. #include "http.h"
  26. void http_init(void) {
  27. httpd_init();
  28. }
  29. #include "lwip/apps/fs.h"
  30. #include <string.h>
  31. int fs_open_custom(struct fs_file *file, const char *name) {
  32. // TODO hook up to fat fs
  33. if (strcmp(name, "/src.tar.xz") == 0) {
  34. /*
  35. memset(file, 0, sizeof(struct fs_file));
  36. file->data = (const char *)data_tar_xz;
  37. file->len = data_tar_xz_len;
  38. file->index = file->len;
  39. file->flags = FS_FILE_FLAGS_HEADER_PERSISTENT;
  40. return 1;
  41. */
  42. (void)file;
  43. return 0;
  44. }
  45. return 0;
  46. }
  47. void fs_close_custom(struct fs_file *file) {
  48. (void)file;
  49. }