aboutsummaryrefslogtreecommitdiff
path: root/src/menu/privinc
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-09-27 17:03:06 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2022-11-01 16:26:16 +0100
commit980858186149651df5543b6fc99a4f7db0cdd089 (patch)
treed347200b0a562d84df505097651ad0642f207fdd /src/menu/privinc
parent39f50e601d395bbd2d78d0147ac530b756da2fff (diff)
downloadjancity-980858186149651df5543b6fc99a4f7db0cdd089.tar.gz
WIP
Diffstat (limited to 'src/menu/privinc')
-rw-r--r--src/menu/privinc/menu_net.h62
-rw-r--r--src/menu/privinc/menu_private.h11
2 files changed, 70 insertions, 3 deletions
diff --git a/src/menu/privinc/menu_net.h b/src/menu/privinc/menu_net.h
new file mode 100644
index 0000000..1980917
--- /dev/null
+++ b/src/menu/privinc/menu_net.h
@@ -0,0 +1,62 @@
+#ifndef MENU_NETCFG_H
+#define MENU_NETCFG_H
+
+#include <gui.h>
+#include <gui/button.h>
+#include <gui/checkbox.h>
+#include <gui/container.h>
+#include <gui/label.h>
+#include <gui/line_edit.h>
+#include <net.h>
+#include <stdbool.h>
+#include <stddef.h>
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+struct menu_net_gui
+{
+ char device[32], address[32], port[sizeof "65535"];
+ bool update_domain;
+ struct gui_container cnt;
+ struct gui_label type;
+ struct gui_button type_btn;
+ enum net_domain domain;
+
+ union
+ {
+ struct gui_container cnt;
+
+ struct menu_ipv4_gui
+ {
+ struct gui_container cnt, relay_cnt, announce_cnt;
+ struct gui_button next_page_btn;
+ struct gui_label address, port, relay, announce;
+ struct gui_line_edit address_le, port_le, announce_le;
+ struct gui_checkbox relay_ch, announce_ch;
+ } ipv4;
+
+ struct menu_serial_gui
+ {
+ struct gui_container cnt, hw_ctrl_cnt;
+ struct gui_label device, speed, hw_ctrl;
+ struct gui_button speed_btn;
+ struct gui_line_edit device_le;
+ struct gui_checkbox hw_ctrl_ch;
+ size_t speed_i;
+ } serial;
+ } gui;
+};
+
+int menu_net_gui_init(struct menu_net_gui *m);
+void menu_net_gui_update(struct menu_net_gui *m);
+int menu_net_server(const struct menu_net_gui *m, union net_server *s);
+int menu_net_connect(const struct menu_net_gui *m, union net_connect *c);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* MENU_NETCFG_H */
diff --git a/src/menu/privinc/menu_private.h b/src/menu/privinc/menu_private.h
index 181825c..d8aa089 100644
--- a/src/menu/privinc/menu_private.h
+++ b/src/menu/privinc/menu_private.h
@@ -3,8 +3,10 @@
#include <camera.h>
#include <input.h>
+#include <net.h>
#include <peripheral.h>
-#include <stdbool.h>
+#include <settings.h>
+#include <stddef.h>
#ifdef __cplusplus
extern "C"
@@ -16,6 +18,7 @@ struct menu_common
struct camera cam;
union peripheral p;
struct input in;
+ struct settings s;
};
int menu_update(struct menu_common *c,
@@ -23,9 +26,11 @@ int menu_update(struct menu_common *c,
int (*render)(const struct menu_common *, void *),
void *arg);
int menu_main(struct menu_common *c);
-int menu_hostjoin(struct menu_common *c, bool *back);
+int menu_hostjoin(struct menu_common *c);
+int menu_settings(struct menu_common *c);
int menu_join(struct menu_common *c);
-int menu_gamecfg(struct menu_common *c);
+int menu_host(struct menu_common *c);
+int menu_gamecfg(struct menu_common *c, struct net_host *h, net_peer p);
void menu_on_pressed(void *arg);
#ifdef __cplusplus