mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
Updated for the latest version of httpd-simple in rpl-border-router
This commit is contained in:
parent
c1b88afe48
commit
c46acc0a77
@ -6,7 +6,7 @@ WITH_UIP6=1
|
||||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
APPS += webserver webbrowser
|
||||
APPS += webbrowser
|
||||
|
||||
CFLAGS += -DPROJECT_CONF_H=\"project-conf.h\"
|
||||
CONTIKI_SOURCEFILES += wget.c
|
||||
|
@ -33,7 +33,7 @@
|
||||
#define __PROJECT_RPL_WEB_CONF_H__
|
||||
|
||||
#undef QUEUEBUF_CONF_NUM
|
||||
#define QUEUEBUF_CONF_NUM 6
|
||||
#define QUEUEBUF_CONF_NUM 5
|
||||
|
||||
#undef UIP_CONF_BUFFER_SIZE
|
||||
#define UIP_CONF_BUFFER_SIZE 140
|
||||
@ -44,4 +44,8 @@
|
||||
#undef WEBSERVER_CONF_CFS_CONNS
|
||||
#define WEBSERVER_CONF_CFS_CONNS 2
|
||||
|
||||
/* Reserve space for a file name (default is to not use file name) */
|
||||
#undef WEBSERVER_CONF_CFS_PATHLEN
|
||||
#define WEBSERVER_CONF_CFS_PATHLEN 80
|
||||
|
||||
#endif /* __PROJECT_RPL_WEB_CONF_H__ */
|
||||
|
@ -40,15 +40,27 @@
|
||||
|
||||
#include "contiki.h"
|
||||
#include "httpd-simple.h"
|
||||
#include "webserver-nogui.h"
|
||||
#include "dev/sht11-sensor.h"
|
||||
#include "dev/light-sensor.h"
|
||||
#include "dev/leds.h"
|
||||
#include <stdio.h>
|
||||
|
||||
PROCESS(web_sense_process, "Sense Web Demo");
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
AUTOSTART_PROCESSES(&web_sense_process);
|
||||
httpd_init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||
httpd_appcall(data);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
AUTOSTART_PROCESSES(&web_sense_process,&webserver_nogui_process);
|
||||
|
||||
#define HISTORY 16
|
||||
static int temperature[HISTORY];
|
||||
@ -148,7 +160,6 @@ PROCESS_THREAD(web_sense_process, ev, data)
|
||||
PROCESS_BEGIN();
|
||||
|
||||
sensors_pos = 0;
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
|
||||
etimer_set(&timer, CLOCK_SECOND * 2);
|
||||
SENSORS_ACTIVATE(light_sensor);
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "dev/button-sensor.h"
|
||||
#include "dev/leds.h"
|
||||
#include "wget.h"
|
||||
#include "webserver-nogui.h"
|
||||
#include "httpd-simple.h"
|
||||
#include <stdio.h>
|
||||
|
||||
@ -59,8 +58,21 @@
|
||||
#define SET_LEDS_OFF "/0"
|
||||
|
||||
PROCESS(websense_remote_process, "Websense Remote");
|
||||
PROCESS(webserver_nogui_process, "Web server");
|
||||
PROCESS_THREAD(webserver_nogui_process, ev, data)
|
||||
{
|
||||
PROCESS_BEGIN();
|
||||
|
||||
AUTOSTART_PROCESSES(&websense_remote_process);
|
||||
httpd_init();
|
||||
|
||||
while(1) {
|
||||
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
|
||||
httpd_appcall(data);
|
||||
}
|
||||
|
||||
PROCESS_END();
|
||||
}
|
||||
AUTOSTART_PROCESSES(&websense_remote_process,&webserver_nogui_process);
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static const char *TOP = "<html><head><title>Contiki Websense Remote</title></head><body>\n";
|
||||
@ -141,7 +153,6 @@ PROCESS_THREAD(websense_remote_process, ev, data)
|
||||
|
||||
mode = 0;
|
||||
wget_init();
|
||||
process_start(&webserver_nogui_process, NULL);
|
||||
|
||||
SENSORS_ACTIVATE(button_sensor);
|
||||
|
||||
|
@ -68,6 +68,37 @@ static const char *file;
|
||||
static uint16_t port;
|
||||
static const struct wget_callbacks *callbacks;
|
||||
|
||||
const char http_10[9] =
|
||||
/* "HTTP/1.0" */
|
||||
{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x30, };
|
||||
const char http_11[9] =
|
||||
/* "HTTP/1.1" */
|
||||
{0x48, 0x54, 0x54, 0x50, 0x2f, 0x31, 0x2e, 0x31, };
|
||||
const char http_200[5] =
|
||||
/* "200 " */
|
||||
{0x32, 0x30, 0x30, 0x20, };
|
||||
const char http_301[5] =
|
||||
/* "301 " */
|
||||
{0x33, 0x30, 0x31, 0x20, };
|
||||
const char http_302[5] =
|
||||
/* "302 " */
|
||||
{0x33, 0x30, 0x32, 0x20, };
|
||||
const char http_crnl[3] =
|
||||
/* "\r\n" */
|
||||
{0xd, 0xa, };
|
||||
const char http_host[7] =
|
||||
/* "host: " */
|
||||
{0x68, 0x6f, 0x73, 0x74, 0x3a, 0x20, };
|
||||
const char http_content_type[15] =
|
||||
/* "content-type: " */
|
||||
{0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x2d, 0x74, 0x79, 0x70, 0x65, 0x3a, 0x20, };
|
||||
const char http_location[11] =
|
||||
/* "location: " */
|
||||
{0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, };
|
||||
const char http_http[8] =
|
||||
/* "http://" */
|
||||
{0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, };
|
||||
|
||||
PROCESS(wget_process, "wget");
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
Loading…
Reference in New Issue
Block a user