Added user feedback on IP configuration.

This commit is contained in:
oliverschmidt 2007-11-25 15:00:32 +00:00
parent 45c836c289
commit 20d395e9b6
3 changed files with 20 additions and 8 deletions

View file

@ -30,7 +30,7 @@
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
* $Id: contiki-main.c,v 1.6 2007/11/24 13:02:27 oliverschmidt Exp $
* $Id: contiki-main.c,v 1.7 2007/11/25 15:06:00 oliverschmidt Exp $
*/
#include <stdio.h>
@ -79,15 +79,19 @@ main(void)
process_start((struct process *)&ethernet_process, (char *)&config);
uip_ipaddr(&addr, 192,168,0,128);
printf("IP Address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_sethostaddr(&addr);
uip_ipaddr(&addr, 255,255,255,0);
printf("Subnet Mask: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setnetmask(&addr);
uip_ipaddr(&addr, 192,168,0,1);
printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setdraddr(&addr);
uip_ipaddr(&addr, 192,168,0,1);
printf("DNS Server: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
resolv_conf(&addr);
}
#endif

View file

@ -30,7 +30,7 @@
*
* Author: Oliver Schmidt <ol.sc@web.de>
*
* $Id: contiki-main.c,v 1.5 2007/11/24 21:29:07 oliverschmidt Exp $
* $Id: contiki-main.c,v 1.6 2007/11/25 15:03:40 oliverschmidt Exp $
*/
#include <stdio.h>
@ -94,15 +94,19 @@ main(void)
process_start((struct process *)&ethernet_process, (char *)&config);
uip_ipaddr(&addr, 192,168,0,128);
printf("IP Address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_sethostaddr(&addr);
uip_ipaddr(&addr, 255,255,255,0);
printf("Subnet Mask: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setnetmask(&addr);
uip_ipaddr(&addr, 192,168,0,1);
printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setdraddr(&addr);
uip_ipaddr(&addr, 192,168,0,1);
printf("DNS Server: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
resolv_conf(&addr);
}
#endif

View file

@ -29,7 +29,7 @@
*
* This file is part of the Contiki OS
*
* $Id: contiki-main.c,v 1.9 2007/11/17 20:15:48 oliverschmidt Exp $
* $Id: contiki-main.c,v 1.10 2007/11/25 15:00:32 oliverschmidt Exp $
*
*/
@ -64,14 +64,17 @@ main(void)
autostart_start((struct process **)autostart_processes);
uip_ipaddr(&addr, 192,168,2,2);
printf("IP Address: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_sethostaddr(&addr);
uip_ipaddr(&addr, 192,168,2,1);
uip_setdraddr(&addr);
uip_ipaddr(&addr, 255,255,255,0);
printf("Subnet Mask: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setnetmask(&addr);
uip_ipaddr(&addr, 192,168,2,1);
printf("Def. Router: %d.%d.%d.%d\n", uip_ipaddr_to_quad(&addr));
uip_setdraddr(&addr);
while(1) {
int n;
n = process_run();
@ -89,16 +92,17 @@ void log_message(char *m1, char *m2)
{
printf("%s%s\n", m1, m2);
}
/*---------------------------------------------------------------------------*/
void
uip_log(char *m)
{
printf("uIP: '%s'\n", m);
}
/*---------------------------------------------------------------------------*/
unsigned short
sensors_light1(void)
{
static unsigned short count;
return count++;
}
/*---------------------------------------------------------------------------*/