35 #include "contiki-net.h"
42 static struct ctk_label ipaddrlabel =
44 static char ipaddr[17];
45 static struct ctk_textentry ipaddrtextentry =
47 static struct ctk_label netmasklabel =
49 static char netmask[17];
50 static struct ctk_textentry netmasktextentry =
52 static struct ctk_label gatewaylabel =
54 static char gateway[17];
55 static struct ctk_textentry gatewaytextentry =
58 static struct ctk_label dnsserverlabel =
60 static char dnsserver[17];
61 static struct ctk_textentry dnsservertextentry =
64 static struct ctk_button tcpipclosebutton =
67 PROCESS(netconf_process,
"Network configurator");
69 AUTOSTART_PROCESSES(&netconf_process);
71 static void makestrings(
void);
75 makebyte(uint8_t byte,
char *str)
78 *str++ = (byte / 100 ) % 10 +
'0';
81 *str++ = (byte / 10) % 10 +
'0';
83 *str++ = (byte % 10) +
'0';
89 makeaddr(uip_ipaddr_t *addr,
char *str)
91 str = makebyte(addr->u8[0], str);
93 str = makebyte(addr->u8[1], str);
95 str = makebyte(addr->u8[2], str);
97 str = makebyte(addr->u8[3], str);
104 uip_ipaddr_t addr, *addrptr;
107 makeaddr(&addr, ipaddr);
110 makeaddr(&addr, netmask);
113 makeaddr(&addr, gateway);
116 addrptr = resolv_getserver();
117 if(addrptr !=
NULL) {
118 makeaddr(addrptr, dnsserver);
124 nullterminate(
char *cptr)
128 for(; *cptr !=
' ' && *cptr != 0; ++cptr);
133 apply_tcpipconfig(
void)
137 nullterminate(ipaddr);
142 nullterminate(netmask);
147 nullterminate(gateway);
153 nullterminate(dnsserver);
199 if(data == (process_data_t)&tcpipclosebutton) {
205 #
if CTK_CONF_WINDOWCLOSE
208 ev == PROCESS_EVENT_EXIT) {
#define CTK_WIDGET_ADD(win, widg)
Add a widget to a window.
process_event_t ctk_signal_window_close
Emitted when a window is closed.
process_event_t ctk_signal_button_activate
Same as ctk_signal_widget_activate.
#define uip_sethostaddr(addr)
Set the IP address of this host.
#define uip_gethostaddr(addr)
Get the IP address of this host.
void ctk_window_open(CC_REGISTER_ARG struct ctk_window *w)
Open a window, or bring window to front if already open.
#define CTK_WIDGET_FOCUS(win, widg)
Set focus to a widget.
void ctk_window_close(struct ctk_window *w)
Close a window if it is open.
#define PROCESS_BEGIN()
Define the beginning of a process.
#define CTK_TEXTENTRY(x, y, w, h, text, len)
Instantiating macro for the ctk_textentry widget.
#define NULL
The null pointer.
#define uiplib_ipaddrconv
Convert a textual representation of an IP address to a numerical representation.
#define uip_getdraddr(addr)
Get the default router's IP address.
#define uip_setdraddr(addr)
Set the default router's IP address.
#define CTK_LABEL(x, y, w, h, text)
Instantiating macro for the ctk_label widget.
#define PROCESS_THREAD(name, ev, data)
Define the body of a process.
#define PROCESS_END()
Define the end of a process.
void ctk_window_new(struct ctk_window *window, unsigned char w, unsigned char h, char *title)
Create a new window.
#define LOADER_UNLOAD()
Unload a program from memory.
#define uip_getnetmask(addr)
Get the netmask.
#define PROCESS_WAIT_EVENT()
Wait for an event to be posted to the process.
#define PROCESS(name, strname)
Declare a process.
#define CTK_BUTTON(x, y, w, text)
Instantiating macro for the ctk_button widget.
Representation of a CTK window.
#define uip_setnetmask(addr)
Set the netmask.
void process_exit(struct process *p)
Cause a process to exit.