From 506f2f3d598a1a294f4de7d4caa4c653e27ee583 Mon Sep 17 00:00:00 2001 From: Olaf Rempel Date: Sun, 16 Mar 2008 00:39:37 +0100 Subject: [PATCH] todos --- control_tab.c | 25 ++++++++++++++++++------- graph_tab.c | 5 +++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/control_tab.c b/control_tab.c index 2a9eed5..735a837 100644 --- a/control_tab.c +++ b/control_tab.c @@ -6,6 +6,10 @@ #include "tcpsocket.h" #include "sockaddr.h" +int tdc_parse_data(int fd); +void tdc_flush_vars(void); +void tdc_send_hello(int fd); + enum { STAT_DISCONNECTED = 0, STAT_CONNECTING, @@ -28,16 +32,13 @@ static void update_connect_button(void) static void read_cb(gpointer data, gint source, GdkInputCondition condition) { - char buf[64]; - - int len = read(source, buf, sizeof(buf)); - if (len <= 0) { + if (tdc_parse_data(source) <= 0) { g_warning("gtdc:read_cb:read:%s", g_strerror(errno)); connect_status = STAT_DISCONNECTED; update_connect_button(); gdk_input_remove(socket_tag); - close(socket_fd); + close(source); } } @@ -54,8 +55,8 @@ static void connect_cb(gpointer data, gint source, GdkInputCondition condition) connect_status = STAT_CONNECTED; socket_tag = gdk_input_add(socket_fd, GDK_INPUT_READ, read_cb, NULL); - //TODO: clear variable data - //TODO: send TDC_HELLO + tdc_flush_vars(); + tdc_send_hello(source); } update_connect_button(); @@ -95,6 +96,16 @@ gint control_tab_init(GtkNotebook *notebook) gtk_table_attach(GTK_TABLE(table), button_connect, 0, 1, 0, 1, 0, 0, 10, 10); g_signal_connect(G_OBJECT(button_connect), "clicked", G_CALLBACK(connect_button_cb), NULL); + /* + * TODO: + * - address field + * - all_variable_refresh_timer + * - graph_variable_refresh_timer + * later: + * - board select + * - connection/protocol details/errors + */ + GtkWidget *label = gtk_label_new(" Control "); return gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label); } diff --git a/graph_tab.c b/graph_tab.c index 3d6e60a..96e1f51 100644 --- a/graph_tab.c +++ b/graph_tab.c @@ -31,6 +31,11 @@ gint graph_tab_init(GtkNotebook *notebook) GTK_FILL | GTK_EXPAND | GTK_SHRINK, 0, 0); gtk_databox_set_vruler(GTK_DATABOX(box), GTK_RULER(ruler)); + /* + * TODO: + * komplette datenhaltung.. (wie skalieren?) + * legende der graphen + */ GtkWidget *label = gtk_label_new(" Graph "); return gtk_notebook_append_page(GTK_NOTEBOOK(notebook), table, label);