Merge remote branch 'sf/master'

This commit is contained in:
Salvatore Pitrulli 2011-04-16 16:27:10 +02:00
commit aa968309af
40 changed files with 531 additions and 441 deletions

View file

@ -12,7 +12,7 @@
#include "dev/leds.h"
#if !UIP_CONF_IPV6_RPL
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET)
#include "static-routing.h"
#endif
@ -491,10 +491,10 @@ PROCESS_THREAD(coap_server, ev, data)
PRINTF("COAP SERVER\n");
/* if static routes are used rather than RPL */
#if !UIP_CONF_IPV6_RPL
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET)
set_global_address();
configure_routing();
#endif /*!UIP_CONF_IPV6_RPL*/
#endif
current_tid = random_rand();

View file

@ -19,6 +19,7 @@ delete_buffer(void)
{
if (data_buffer) {
free(data_buffer);
data_buffer = NULL;
buffer_index = 0;
buffer_size = 0;
}

View file

@ -291,6 +291,7 @@ PROCESS_THREAD(rest_manager_process, ev, data)
PROCESS_PAUSE();
/*Periodic resources are only available to COAP implementation*/
#if 0
#ifdef WITH_COAP
periodic_resource_t* periodic_resource = NULL;
for (periodic_resource = (periodic_resource_t*)list_head(restful_periodic_services); periodic_resource; periodic_resource = periodic_resource->next) {
@ -327,6 +328,6 @@ PROCESS_THREAD(rest_manager_process, ev, data)
}
}
#endif /*WITH_COAP*/
#endif
PROCESS_END();
}

View file

@ -7,6 +7,8 @@
#include "static-routing.h"
#if !defined (CONTIKI_TARGET_MINIMAL_NET) /* Any other targets will be added here (&& ! defined (OTHER))*/
#define DEBUG 0
#if DEBUG
#include <stdio.h>
@ -66,3 +68,4 @@ void configure_routing(void)
}
}
#endif /*!UIP_CONF_IPV6_RPL*/
#endif /*CONTIKI_TARGET_MINIMAL_NET*/

View file

@ -8,6 +8,7 @@
#ifndef STATICROUTING_H_
#define STATICROUTING_H_
#if !defined (CONTIKI_TARGET_MINIMAL_NET)
#define NODE_IP(nodeid,type,ipaddr) NODE_##nodeid##_##type(ipaddr)
/*desktop machine*/
@ -56,4 +57,5 @@ do{\
void set_global_address(void);
void configure_routing(void);
#endif /*CONTIKI_TARGET_MINIMAL_NET*/
#endif /* STATICROUTING_H_ */

View file

@ -50,10 +50,9 @@ extern const char* header_delimiter;
/*HTTP method types*/
typedef enum {
HTTP_METHOD_GET = (1 << 0),
HTTP_METHOD_HEAD = (1 << 1),
HTTP_METHOD_POST = (1 << 2),
HTTP_METHOD_PUT = (1 << 3),
HTTP_METHOD_DELETE = (1 << 4)
HTTP_METHOD_POST = (1 << 1),
HTTP_METHOD_PUT = (1 << 2),
HTTP_METHOD_DELETE = (1 << 3)
} http_method_t;
//DY : FIXME right now same enum names with COAP with different values. Will this work fine?

View file

@ -7,7 +7,7 @@
#include "buffer.h"
#include "rest-util.h"
#if !UIP_CONF_IPV6_RPL
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET)
#include "static-routing.h"
#endif
@ -235,8 +235,6 @@ is_method_handled(connection_state_t* conn_state, const char* method)
/*other method types can be added here if needed*/
if(strncmp(method, http_get_string, 3) == 0) {
conn_state->request.request_type = HTTP_METHOD_GET;
} else if(strncmp(method, http_head_string, 4) == 0) {
conn_state->request.request_type = HTTP_METHOD_HEAD;
} else if (strncmp(method, http_post_string, 4) == 0) {
conn_state->request.request_type = HTTP_METHOD_POST;
} else if (strncmp(method, http_put_string, 3) == 0) {
@ -392,10 +390,12 @@ content_type_t http_get_header_content_type(http_request_t* request)
static
PT_THREAD(handle_request(connection_state_t* conn_state))
{
static int error;
const char* content_len;
PSOCK_BEGIN(&(conn_state->sin));
static int error;
const char* content_len = NULL;
content_len = NULL;
error = HTTP_NO_ERROR; /*always reinit static variables due to protothreads*/
@ -512,14 +512,19 @@ PT_THREAD(handle_request(connection_state_t* conn_state))
static
PT_THREAD(send_data(connection_state_t* conn_state))
{
uint16_t index;
http_response_t* response;
http_header_t* header;
uint8_t* buffer;
PSOCK_BEGIN(&(conn_state->sout));
PRINTF("send_data -> \n");
uint16_t index = 0;
http_response_t* response = &conn_state->response;
http_header_t* header = response->headers;
uint8_t* buffer = allocate_buffer(200);
index = 0;
response = &conn_state->response;
header = response->headers;
buffer = allocate_buffer(200);
/*FIXME: what is the best solution here to send the data. Right now, if buffer is not allocated, no data is sent!*/
if (buffer) {
@ -583,10 +588,12 @@ PROCESS(http_server, "Httpd Process");
PROCESS_THREAD(http_server, ev, data)
{
connection_state_t *conn_state;
PROCESS_BEGIN();
/* if static routes are used rather than RPL */
#if !UIP_CONF_IPV6_RPL
#if !UIP_CONF_IPV6_RPL && !defined (CONTIKI_TARGET_MINIMAL_NET)
set_global_address();
configure_routing();
#endif /*!UIP_CONF_IPV6_RPL*/
@ -603,7 +610,7 @@ PROCESS_THREAD(http_server, ev, data)
while(1) {
PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event);
connection_state_t *conn_state = (connection_state_t *)data;
conn_state = (connection_state_t *)data;
if(uip_connected()) {
PRINTF("##Connected##\n");

View file

@ -117,13 +117,13 @@ base64_add_char(struct base64_decoder_state *s, char c)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_dec64_process, ev, data)
{
struct shell_input *input;
struct base64_decoder_state s;
int i;
PROCESS_BEGIN();
while(1) {
struct shell_input *input;
struct base64_decoder_state s;
int i;
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;

View file

@ -103,6 +103,7 @@ PROCESS_THREAD(shell_ls_process, ev, data)
PROCESS_THREAD(shell_append_process, ev, data)
{
static int fd = 0;
struct shell_input *input;
PROCESS_EXITHANDLER(cfs_close(fd));
@ -115,7 +116,6 @@ PROCESS_THREAD(shell_append_process, ev, data)
"append: could not open file for writing: ", data);
} else {
while(1) {
struct shell_input *input;
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;
/* printf("cat input %d %d\n", input->len1, input->len2);*/
@ -139,6 +139,7 @@ PROCESS_THREAD(shell_append_process, ev, data)
PROCESS_THREAD(shell_write_process, ev, data)
{
static int fd = 0;
struct shell_input *input;
int r;
PROCESS_EXITHANDLER(cfs_close(fd));
@ -152,7 +153,6 @@ PROCESS_THREAD(shell_write_process, ev, data)
"write: could not open file for writing: ", data);
} else {
while(1) {
struct shell_input *input;
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;
/* printf("cat input %d %d\n", input->len1, input->len2);*/
@ -187,11 +187,14 @@ PROCESS_THREAD(shell_write_process, ev, data)
PROCESS_THREAD(shell_read_process, ev, data)
{
static int fd = 0;
static int block_size = MAX_BLOCKSIZE;
char *next;
char filename[MAX_FILENAME_LEN];
int len;
int offset = 0;
static int block_size = MAX_BLOCKSIZE;
char buf[MAX_BLOCKSIZE];
struct shell_input *input;
PROCESS_EXITHANDLER(cfs_close(fd));
PROCESS_BEGIN();
@ -236,10 +239,6 @@ PROCESS_THREAD(shell_read_process, ev, data)
} else {
while(1) {
char buf[MAX_BLOCKSIZE];
int len;
struct shell_input *input;
len = cfs_read(fd, buf, block_size);
if(len <= 0) {
cfs_close(fd);

View file

@ -133,8 +133,9 @@ send_ping(uip_ipaddr_t *dest_addr)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_ping_process, ev, data)
{
static struct etimer e;
struct shell_input *input;
PROCESS_BEGIN();
if(data == NULL) {
@ -149,9 +150,6 @@ PROCESS_THREAD(shell_ping_process, ev, data)
running = 1;
while(running) {
static struct etimer e;
etimer_set(&e, CLOCK_SECOND * 10);
PROCESS_WAIT_EVENT();

View file

@ -67,6 +67,7 @@ PROCESS(shell_rsh_server_process, "rsh server");
PROCESS_THREAD(shell_rsh_process, ev, data)
{
static rimeaddr_t receiver;
struct shell_input *input;
const char *nextptr;
char buf[40];
@ -88,7 +89,6 @@ PROCESS_THREAD(shell_rsh_process, ev, data)
meshconn_connect(&meshconn, &receiver);
while(1) {
struct shell_input *input;
PROCESS_WAIT_EVENT();
if(ev == shell_event_input) {
input = data;
@ -114,6 +114,8 @@ PROCESS_THREAD(shell_rsh_process, ev, data)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_rsh_server_process, ev, data)
{
struct shell_input *input;
PROCESS_BEGIN();
while(1) {
@ -123,7 +125,6 @@ PROCESS_THREAD(shell_rsh_server_process, ev, data)
if(ev == PROCESS_EVENT_EXITED) {
front_process = NULL;
} else if(ev == shell_event_input) {
struct shell_input *input;
input = data;
packetbuf_clear();
memcpy(packetbuf_dataptr(), input->data1, input->len1);

View file

@ -117,10 +117,10 @@ print_usage(void)
PROCESS_THREAD(shell_sendtest_process, ev, data)
{
static rimeaddr_t receiver;
static unsigned long cpu, lpm, rx, tx;
const char *nextptr;
const char *args;
char buf[40];
static unsigned long cpu, lpm, rx, tx;
unsigned long cpu2, lpm2, rx2, tx2;
PROCESS_BEGIN();

View file

@ -131,6 +131,7 @@ PROCESS_THREAD(shell_binprint_process, ev, data)
uint16_t *ptr;
int i;
char buf[2*64], *bufptr;
uint16_t val;
PROCESS_BEGIN();
@ -145,9 +146,8 @@ PROCESS_THREAD(shell_binprint_process, ev, data)
bufptr = buf;
ptr = (uint16_t *)input->data1;
for(i = 0; i < input->len1 && i < input->len1 - 1; i += 2) {
uint16_t data;
memcpy(&data, ptr, sizeof(data));
bufptr += sprintf(bufptr, "%u ", data);
memcpy(&val, ptr, sizeof(val));
bufptr += sprintf(bufptr, "%u ", val);
if(bufptr - buf >= sizeof(buf) - 6) {
shell_output_str(&binprint_command, buf, "");
bufptr = buf;
@ -160,9 +160,8 @@ PROCESS_THREAD(shell_binprint_process, ev, data)
ptr = (uint16_t *)input->data2;
for(i = 0; i < input->len2 && i < input->len2 - 1; i += 2) {
uint16_t data;
memcpy(&data, ptr, sizeof(data));
bufptr += sprintf(bufptr, "%u ", data);
memcpy(&val, ptr, sizeof(val));
bufptr += sprintf(bufptr, "%u ", val);
if(bufptr - buf >= sizeof(buf) - 6) {
shell_output_str(&binprint_command, buf, "");
bufptr = buf;
@ -180,8 +179,9 @@ PROCESS_THREAD(shell_binprint_process, ev, data)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_size_process, ev, data)
{
struct shell_input *input;
static unsigned long size;
struct shell_input *input;
char buf[10];
PROCESS_BEGIN();
size = 0;
@ -193,7 +193,6 @@ PROCESS_THREAD(shell_size_process, ev, data)
size += input->len1 + input->len2;
if(input->len1 + input->len2 == 0) {
char buf[10];
snprintf(buf, sizeof(buf), "%lu", size);
shell_output_str(&size_command, buf, "");
PROCESS_EXIT();

View file

@ -91,11 +91,11 @@ PROCESS_THREAD(shell_time_process, ev, data)
uint16_t time[2];
} msg;
unsigned long newtime;
const char *nextptr;
PROCESS_BEGIN();
if(data != NULL) {
const char *nextptr;
newtime = shell_strtolong(data, &nextptr);
if(data != nextptr) {
shell_set_time(newtime);
@ -122,6 +122,7 @@ PROCESS_THREAD(shell_time_process, ev, data)
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(shell_timestamp_process, ev, data)
{
struct shell_input *input;
struct msg {
uint16_t len;
uint16_t time[2];
@ -132,7 +133,6 @@ PROCESS_THREAD(shell_timestamp_process, ev, data)
PROCESS_BEGIN();
while(1) {
struct shell_input *input;
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
input = data;
if(input->len1 + input->len2 == 0) {
@ -161,7 +161,9 @@ PROCESS_THREAD(shell_timestamp_process, ev, data)
PROCESS_THREAD(shell_repeat_server_process, ev, data)
{
static char *command;
static struct process *started_process;
char command_copy[MAX_COMMANDLENGTH];
int ret;
if(ev == shell_event_input) {
goto exit;
@ -174,8 +176,6 @@ PROCESS_THREAD(shell_repeat_server_process, ev, data)
PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_CONTINUE &&
data == &shell_repeat_process);
{
int ret;
static struct process *started_process;
strncpy(command_copy, command, MAX_COMMANDLENGTH);
ret = shell_start_command(command_copy, (int)strlen(command_copy),
&repeat_command, &started_process);

View file

@ -90,6 +90,8 @@ PROCESS_THREAD(shell_vars_process, ev, data)
PROCESS_THREAD(shell_var_process, ev, data)
{
int i;
int j;
char numbuf[32];
PROCESS_BEGIN();
@ -99,8 +101,6 @@ PROCESS_THREAD(shell_var_process, ev, data)
for(i = 0; i < symbols_nelts; ++i) {
if(symbols[i].name != NULL &&
strncmp(symbols[i].name, data, strlen(symbols[i].name)) == 0) {
char numbuf[32];
int j;
sprintf(numbuf, " %d", *((int *)symbols[i].value));
shell_output_str(&var_command, (char *)symbols[i].name, numbuf);

View file

@ -410,6 +410,8 @@ shell_register_command(struct shell_command *c)
PROCESS_THREAD(shell_process, ev, data)
{
static struct process *started_process;
struct shell_input *input;
int ret;
PROCESS_BEGIN();
/* Let the system start up before showing the prompt. */
@ -420,9 +422,7 @@ PROCESS_THREAD(shell_process, ev, data)
PROCESS_WAIT_EVENT_UNTIL(ev == shell_event_input);
{
struct shell_input *input = data;
int ret;
input = data;
ret = shell_start_command(input->data1, input->len1, NULL,
&started_process);

View file

@ -271,6 +271,8 @@ msg_for_me(void)
static
PT_THREAD(handle_dhcp(process_event_t ev, void *data))
{
clock_time_t ticks;
PT_BEGIN(&s.pt);
init:
@ -350,7 +352,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
}
while(s.ticks > 0) {
clock_time_t ticks;
ticks = IMIN(s.ticks, MAX_TICKS);
s.ticks -= ticks;
etimer_set(&s.etimer, ticks);
@ -368,7 +369,6 @@ PT_THREAD(handle_dhcp(process_event_t ev, void *data))
/* renewing: */
xid++;
do {
clock_time_t ticks;
while(ev != tcpip_event) {
tcpip_poll_udp(s.conn);
PT_YIELD(&s.pt);

View file

@ -301,12 +301,8 @@ schedule_powercycle(struct rtimer *t, rtimer_clock_t time)
time = RTIMER_NOW() - RTIMER_TIME(t) + 2;
}
#if NURTIMER
r = rtimer_reschedule(t, time, 1);
#else
r = rtimer_set(t, RTIMER_TIME(t) + time, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
#endif
if(r != RTIMER_OK) {
printf("schedule_powercycle: could not set rtimer\n");
}
@ -323,12 +319,8 @@ schedule_powercycle_fixed(struct rtimer *t, rtimer_clock_t fixed_time)
fixed_time = RTIMER_NOW() + 1;
}
#if NURTIMER
r = rtimer_reschedule(t, RTIMER_TIME(t) - time, 1);
#else
r = rtimer_set(t, fixed_time, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
#endif
if(r != RTIMER_OK) {
printf("schedule_powercycle: could not set rtimer\n");
}
@ -337,8 +329,14 @@ schedule_powercycle_fixed(struct rtimer *t, rtimer_clock_t fixed_time)
static void
powercycle_turn_radio_off(void)
{
uint8_t was_on = radio_is_on;
if(we_are_sending == 0) {
off();
#if CONTIKIMAC_CONF_COMPOWER
if(was_on && !radio_is_on) {
compower_accumulate(&compower_idle_activity);
}
#endif /* CONTIKIMAC_CONF_COMPOWER */
}
}
static void
@ -363,16 +361,11 @@ powercycle(struct rtimer *t, void *ptr)
cycle_start += CYCLE_TIME;
if(WITH_STREAMING && is_streaming) {
#if NURTIMER
if(!RTIMER_CLOCK_LT(cycle_start, RTIMER_NOW(), stream_until))
#else
if(!RTIMER_CLOCK_LT(RTIMER_NOW(), stream_until))
#endif
{
is_streaming = 0;
rimeaddr_copy(&is_streaming_to, &rimeaddr_null);
rimeaddr_copy(&is_streaming_to_too, &rimeaddr_null);
}
if(!RTIMER_CLOCK_LT(RTIMER_NOW(), stream_until)) {
is_streaming = 0;
rimeaddr_copy(&is_streaming_to, &rimeaddr_null);
rimeaddr_copy(&is_streaming_to_too, &rimeaddr_null);
}
}
packet_seen = 0;
@ -384,11 +377,7 @@ powercycle(struct rtimer *t, void *ptr)
powercycle_turn_radio_on();
// schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME);
#if 0
#if NURTIMER
while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + CCA_CHECK_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME));
#endif
#endif /* 0 */
/* Check if a packet is seen in the air. If so, we keep the
radio on for a while (LISTEN_TIME_AFTER_PACKET_DETECTED) to
@ -401,10 +390,6 @@ powercycle(struct rtimer *t, void *ptr)
break;
}
powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
}
// schedule_powercycle_fixed(t, t0 + CCA_CHECK_TIME + CCA_SLEEP_TIME);
schedule_powercycle_fixed(t, RTIMER_NOW() + CCA_SLEEP_TIME);
@ -441,9 +426,6 @@ powercycle(struct rtimer *t, void *ptr)
}
if(silence_periods > MAX_SILENCE_PERIODS) {
powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
break;
}
if(WITH_FAST_SLEEP &&
@ -451,9 +433,6 @@ powercycle(struct rtimer *t, void *ptr)
!(NETSTACK_RADIO.receiving_packet() ||
NETSTACK_RADIO.pending_packet())) {
powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
break;
}
if(NETSTACK_RADIO.pending_packet()) {
@ -469,9 +448,6 @@ powercycle(struct rtimer *t, void *ptr)
!RTIMER_CLOCK_LT(RTIMER_NOW(),
(start + LISTEN_TIME_AFTER_PACKET_DETECTED))) {
powercycle_turn_radio_off();
#if CONTIKIMAC_CONF_COMPOWER
compower_accumulate(&compower_idle_activity);
#endif /* CONTIKIMAC_CONF_COMPOWER */
}
}
}
@ -766,11 +742,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
for(i = 0; i < CCA_COUNT_MAX; ++i) {
t0 = RTIMER_NOW();
on();
#if NURTIMER
while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + CCA_CHECK_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_CHECK_TIME)) { }
#endif
if(NETSTACK_RADIO.channel_clear() == 0) {
collisions++;
off();
@ -778,11 +750,7 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
}
off();
t0 = RTIMER_NOW();
#if NURTIMER
while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + CCA_SLEEP_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + CCA_SLEEP_TIME)) { }
#endif
}
}
@ -801,15 +769,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
watchdog_periodic();
t0 = RTIMER_NOW();
#if NURTIMER
for(strobes = 0, collisions = 0;
got_strobe_ack == 0 && collisions == 0 &&
RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t0 + STROBE_TIME); strobes++) {
#else
for(strobes = 0, collisions = 0;
got_strobe_ack == 0 && collisions == 0 &&
RTIMER_CLOCK_LT(RTIMER_NOW(), t0 + STROBE_TIME); strobes++) {
#endif
watchdog_periodic();
@ -830,21 +792,15 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr)
ret = NETSTACK_RADIO.transmit(transmit_len);
wt = RTIMER_NOW();
#if NURTIMER
while(RTIMER_CLOCK_LT(wt, RTIMER_NOW(), wt + INTER_PACKET_INTERVAL));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + INTER_PACKET_INTERVAL)) { }
#endif
if(!is_broadcast && (NETSTACK_RADIO.receiving_packet() ||
NETSTACK_RADIO.pending_packet() ||
NETSTACK_RADIO.channel_clear() == 0)) {
uint8_t ackbuf[ACK_LEN];
wt = RTIMER_NOW();
#if NURTIMER
while(RTIMER_CLOCK_LT(wt, RTIMER_NOW(), wt + AFTER_ACK_DETECTECT_WAIT_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), wt + AFTER_ACK_DETECTECT_WAIT_TIME)) { }
#endif
len = NETSTACK_RADIO.read(ackbuf, ACK_LEN);
if(len == ACK_LEN) {
got_strobe_ack = 1;
@ -1088,22 +1044,16 @@ send_announcement(void *ptr)
for(i = 0; i < CCA_COUNT_MAX; ++i) {
t = RTIMER_NOW();
on();
#if NURTIMER
while(RTIMER_CLOCK_LT(t, RTIMER_NOW(), t + CCA_CHECK_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t + CCA_CHECK_TIME));
#endif
if(NETSTACK_RADIO.channel_clear() == 0) {
collisions++;
off();
break;
}
off();
#if NURTIMER
while(RTIMER_CLOCK_LT(t0, RTIMER_NOW(), t + CCA_SLEEP_TIME + CCA_CHECK_TIME));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t + CCA_SLEEP_TIME + CCA_CHECK_TIME)) { }
#endif
}
if(collisions == 0) {
@ -1112,11 +1062,8 @@ send_announcement(void *ptr)
NETSTACK_RADIO.transmit(transmit_len);
t = RTIMER_NOW();
#if NURTIMER
while(RTIMER_CLOCK_LT(t, RTIMER_NOW(), t + INTER_PACKET_INTERVAL));
#else
while(RTIMER_CLOCK_LT(RTIMER_NOW(), t + INTER_PACKET_INTERVAL)) { }
#endif
NETSTACK_RADIO.transmit(transmit_len);
}
we_are_sending = 0;
@ -1158,15 +1105,8 @@ init(void)
{
radio_is_on = 0;
PT_INIT(&pt);
#if NURTIMER
rtimer_setup(&rt, RTIMER_HARD,
(void (*)(struct rtimer *, void *, int status))powercycle,
NULL);
rtimer_schedule(&rt, CYCLE_TIME, 1);
#else
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
#endif
contikimac_is_on = 1;
@ -1187,12 +1127,8 @@ turn_on(void)
if(contikimac_is_on == 0) {
contikimac_is_on = 1;
contikimac_keep_radio_on = 0;
#if NURTIMER
rtimer_schedule(&rt, CYCLE_TIME, 1);
#else
rtimer_set(&rt, RTIMER_NOW() + CYCLE_TIME, 1,
(void (*)(struct rtimer *, void *))powercycle, NULL);
#endif
}
return 1;
}

View file

@ -241,6 +241,13 @@ packet_sent(void *ptr, int status, int num_transmissions)
PRINTF("csma: retransmitting with time %lu %p\n", time, q);
ctimer_set(&transmit_timer, time,
transmit_queued_packet, NULL);
/* This is needed to correctly attribute energy that we spent
transmitting this packet. */
q = list_head(queued_packet_list);
queuebuf_free(q->buf);
q->buf = queuebuf_new_from_packetbuf();
} else {
PRINTF("csma: drop with status %d after %d transmissions, %d collisions\n",
status, q->transmissions, q->collisions);

View file

@ -342,13 +342,20 @@ rpl_select_parent(rpl_dag_t *dag)
best = NULL;
for(p = list_head(dag->parents); p != NULL; p = p->next) {
if(best == NULL) {
if(p->rank == INFINITE_RANK) {
/* ignore this neighbor */
} else if(best == NULL) {
best = p;
} else {
best = dag->of->best_parent(best, p);
}
}
if(best == NULL) {
/* need to handle update of best... */
return NULL;
}
if(dag->preferred_parent != best) {
dag->preferred_parent = best; /* Cache the value. */
dag->of->update_metric_container(dag);
@ -642,7 +649,8 @@ rpl_process_parent_event(rpl_dag_t *dag, rpl_parent_t *p)
rpl_reset_dio_timer(dag, 1);
}
if(!acceptable_rank(dag, dag->of->calculate_rank(NULL, parent_rank))) {
if(parent_rank == INFINITE_RANK ||
!acceptable_rank(dag, dag->of->calculate_rank(NULL, parent_rank))) {
/* The candidate parent is no longer valid: the rank increase resulting
from the choice of it as a parent would be too high. */
return 0;

View file

@ -47,7 +47,7 @@
#include "net/uip-ds6.h"
#include "net/uip-packetqueue.h"
#define DEBUG DEBUG_ANNOTATE
#define DEBUG DEBUG_NONE
#include "net/uip-debug.h"
#ifdef UIP_CONF_DS6_NEIGHBOR_STATE_CHANGED

View file

@ -742,14 +742,20 @@ void rf230_warm_reset(void) {
/* CCA energy threshold = -91dB + 2*SR_CCA_ED_THRESH. Reset defaults to -77dB */
/* Use RF230 base of -91; RF231 base is -90 according to datasheet */
#ifdef RF230_CONF_CCA_THRES
#if RF230_CONF_CCA_THRES < -91
#warning
#warning RF230_CONF_CCA_THRES below hardware limit, setting to -91dBm
#warning
hal_subregister_write(SR_CCA_ED_THRES,0);
#elif RF230_CONF_CCA_THRES > -61
#warning
#warning RF230_CONF_CCA_THRES above hardware limit, setting to -61dBm
#warning
hal_subregister_write(SR_CCA_ED_THRES,15);
#else
hal_subregister_write(SR_CCA_ED_THRES,(RF230_CONF_CCA_THRES+91)/2);
#endif
#endif
/* Use automatic CRC unless manual is specified */

View file

@ -70,9 +70,29 @@
#define UART2_UCTS ((volatile uint32_t *) ( UART2_BASE + UCTS ))
#define UART2_UBRCNT ((volatile uint32_t *) ( UART2_BASE + UBRCNT ))
extern volatile uint32_t u1_head, u1_tail;
/* The mc1322x has a 32 byte hardware FIFO for transmitted characters.
* Currently it is always filled from a larger RAM buffer. It would be
* possible to eliminate that overhead by filling directly from a chain
* of data buffer pointers, but printf's would be not so easy.
*/
#define UART1_TX_BUFFERSIZE 1024
extern volatile uint32_t u1_tx_head, u1_tx_tail;
void uart1_putc(char c);
/* The mc1322x has a 32 byte hardware FIFO for received characters.
* If a larger rx buffersize is specified the FIFO will be extended into RAM.
* RAM transfers will occur on interrupt when the FIFO is nearly full.
* If a smaller buffersize is specified hardware flow control will be
* initiated at that FIFO level.
* Set to 32 for no flow control or RAM buffer.
*/
#define UART1_RX_BUFFERSIZE 128
#if UART1_RX_BUFFERSIZE > 32
extern volatile uint32_t u1_rx_head, u1_rx_tail;
#define uart1_can_get() ((u1_rx_head!=u1_rx_tail) || (*UART1_URXCON > 0))
#else
#define uart1_can_get() (*UART1_URXCON > 0)
#endif
uint8_t uart1_getc(void);

View file

@ -36,43 +36,91 @@
#include <mc1322x.h>
#include <stdint.h>
volatile char u1_tx_buf[1024];
volatile uint32_t u1_head, u1_tail;
volatile char u1_tx_buf[UART1_TX_BUFFERSIZE];
volatile uint32_t u1_tx_head, u1_tx_tail;
#if UART1_RX_BUFFERSIZE > 32
volatile char u1_rx_buf[UART1_RX_BUFFERSIZE-32];
volatile uint32_t u1_rx_head, u1_rx_tail;
#endif
void uart1_isr(void) {
#if UART1_RX_BUFFERSIZE > 32
if (*UART1_USTAT & ( 1 << 6)) { //receive interrupt
while( *UART1_URXCON != 0 ) { //flush the hardware fifo into the software buffer
uint32_t u1_rx_tail_next;
u1_rx_tail_next = u1_rx_tail+1;
if (u1_rx_tail_next >= sizeof(u1_rx_buf))
u1_rx_tail_next = 0;
if (u1_rx_head != u1_rx_tail_next) {
u1_rx_buf[u1_rx_tail]= *UART1_UDATA;
u1_rx_tail = u1_rx_tail_next;
}
}
return;
}
#endif
while( *UART1_UTXCON != 0 ) {
if (u1_head == u1_tail) {
if (u1_tx_head == u1_tx_tail) {
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON |= (1 << 13); /*disable tx interrupt */
#else
disable_irq(UART1);
#endif
return;
}
*UART1_UDATA = u1_tx_buf[u1_tail];
u1_tail++;
if (u1_tail >= sizeof(u1_tx_buf))
u1_tail = 0;
*UART1_UDATA = u1_tx_buf[u1_tx_tail];
u1_tx_tail++;
if (u1_tx_tail >= sizeof(u1_tx_buf))
u1_tx_tail = 0;
}
}
void uart1_putc(char c) {
/* disable UART1 since */
/* UART1 isr modifies u1_head and u1_tail */
disable_irq(UART1);
/* UART1 isr modifies u1_tx_head and u1_tx_tail */
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON |= (1 << 13); /*disable tx interrupt */
#else
disable_irq(UART1);
#endif
if( (u1_head == u1_tail) &&
if( (u1_tx_head == u1_tx_tail) &&
(*UART1_UTXCON != 0)) {
*UART1_UDATA = c;
} else {
u1_tx_buf[u1_head] = c;
u1_head += 1;
if (u1_head >= sizeof(u1_tx_buf))
u1_head = 0;
if (u1_head == u1_tail) { /* drop chars when no room */
if (u1_head) { u1_head -=1; } else { u1_head = sizeof(u1_tx_buf); }
u1_tx_buf[u1_tx_head] = c;
u1_tx_head += 1;
if (u1_tx_head >= sizeof(u1_tx_buf))
u1_tx_head = 0;
if (u1_tx_head == u1_tx_tail) { /* drop chars when no room */
if (u1_tx_head) { u1_tx_head -=1; } else { u1_tx_head = sizeof(u1_tx_buf); }
}
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON &= ~(1 << 13); /*enable tx interrupt */
#else
enable_irq(UART1);
#endif
}
}
uint8_t uart1_getc(void) {
#if UART1_RX_BUFFERSIZE > 32
/* First pull from the ram buffer */
uint8_t c=0;
if (u1_rx_head != u1_rx_tail) {
c = u1_rx_buf[u1_rx_head++];
if (u1_rx_head >= sizeof(u1_rx_buf))
u1_rx_head=0;
return c;
}
#endif
/* Then pull from the hardware fifo */
while(uart1_can_get() == 0) { continue; }
return *UART1_UDATA;
}

View file

@ -47,7 +47,7 @@ void default_vreg_init(void) {
void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp) {
/* UART must be disabled to set the baudrate */
/* UART must be disabled to set the baudrate */
*UART1_UCON = 0;
*UART1_UBRCNT = ( inc << 16 ) | mod;
@ -63,18 +63,27 @@ void uart1_init(uint16_t inc, uint16_t mod, uint8_t samp) {
/* you must enable the peripheral first BEFORE setting the function in GPIO_FUNC_SEL */
/* From the datasheet: "The peripheral function will control operation of the pad IF */
/* THE PERIPHERAL IS ENABLED. */
*UART1_UCON = (1 << 0) | (1 << 1); /* enable receive, transmit */
#if UART1_RX_BUFFERSIZE > 32
*UART1_UCON = (1 << 0) | (1 << 1) ; /* enable receive, transmit, and both interrupts */
*UART1_URXCON = 30; /* interrupt when fifo is nearly full */
u1_rx_head = 0; u1_rx_tail = 0;
#elif UART1_RX_BUFFERSIZE < 32 /* enable receive, transmit, flow control, disable rx interrupt */
*UART1_UCON = (1 << 0) | (1 << 1) | (1 << 12) | (1 << 14);
*UART1_UCTS = UART1_RX_BUFFERSIZE; /* drop cts when tx buffer at trigger level */
*GPIO_FUNC_SEL1 = ( (0x01 << (0*2)) | (0x01 << (1*2)) ); /* set GPIO17-16 to UART1 CTS and RTS */
#else
*UART1_UCON = (1 << 0) | (1 << 1) | (1 << 14); /* enable receive, transmit, disable rx interrupt */
#endif
if(samp == UCON_SAMP_16X)
set_bit(*UART1_UCON,UCON_SAMP);
*GPIO_FUNC_SEL0 = ( (0x01 << (14*2)) | (0x01 << (15*2)) ); /* set GPIO15-14 to UART (UART1 TX and RX)*/
/* interrupt when there are this number or more bytes free in the TX buffer*/
*UART1_UTXCON = 16;
u1_tx_head = 0; u1_tx_tail = 0;
u1_head = 0; u1_tail = 0;
/* tx and rx interrupts are enabled in the UART by default */
/* see status register bits 13 and 14 */
/* enable UART1 interrupts in the interrupt controller */
enable_irq(UART1);
}

View file

@ -34,6 +34,7 @@
*/
#include <stdlib.h>
#include <io.h>
#include <signal.h>
#include "sys/energest.h"

View file

@ -32,6 +32,7 @@
*/
#include "dev/watchdog.h"
#include <stdlib.h>
/*---------------------------------------------------------------------------*/
void
@ -57,5 +58,7 @@ watchdog_stop(void)
void
watchdog_reboot(void)
{
// Death by watchdog.
exit(-1);
}
/*---------------------------------------------------------------------------*/

View file

@ -10,7 +10,7 @@ Each resource has a handler function which is called by the REST layer to serve
(i.e. "helloworld" resource has a handler function named "helloworld_handler" which is called when a web service request is received for "helloworld" resource.)
To run REST examples in COOJA under Linux
To run REST examples in COOJA on Linux
--------------------------------------------
Accessing the server from outside:
@ -50,9 +50,10 @@ Client periodically accesses resources of server and prints the payload.
Note: If the generated binary is bigger than the MOTE code size, then you will get a "region text is full" error.
Right now, REST+HTTP example uses (Contiki + ContikiMAC + uIPv6 + RPL + HTTP Server + REST Layer) which does not fit in Tmote Sky memory.
To save same code space and make the example fit, you can define static routes rather than using RPL or use nullrdc rather than ContikiMAC.
If border router does not fit, then first try to update the Makefile of border router in <CONTIKI_HOME>/examples/ipv6/rpl-border-router by
setting WITH_WEBSERVER=0.
To run REST server on real nodes under Linux
To run REST server on real nodes (i.e. tmote sky)
--------------------------------------------
1. Program the nodes with the rest-server-example
@ -71,7 +72,19 @@ To run REST server on real nodes under Linux
5. Test the connectivity by pinging them.
ping6 <IPv6 Address of the MOTE>
6. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it is available at <NODE_IP_ADDR>:61616)
6. Remaining parts are the same with the COOJA example. (i.e. if it is a COAP Server, it's available at <NODE_IP_ADDR>:61616)
To run REST server with minimal-net on Linux
--------------------------------------------
1. Compile with minimal-net setting.
make rest-server-example TARGET=minimal-net
2. Run the generated executable with sudo and note the IP address of the server which will be printed right after.
sudo ./rest-server-example.minimal-net
3. How to access and test the server is same with the other settings. (i.e. if it is a COAP Server,
it's available at <IP_ADDRESS_FROM_STEP_2>:61616 and if it's a HTTP Server it is available at <IP_ADDRESS_FROM_STEP_2>:8080)
To Do

View file

@ -5,10 +5,12 @@
#include "contiki-net.h"
#include "rest.h"
#if defined (CONTIKI_TARGET_SKY) /* Any other targets will be added here (&& defined (OTHER))*/
#include "dev/light-sensor.h"
#include "dev/battery-sensor.h"
#include "dev/sht11-sensor.h"
#include "dev/leds.h"
#endif /*defined (CONTIKI_TARGET_SKY)*/
#define DEBUG 1
#if DEBUG
@ -36,9 +38,24 @@ helloworld_handler(REQUEST* request, RESPONSE* response)
sprintf(temp,"Hello World!\n");
rest_set_header_content_type(response, TEXT_PLAIN);
rest_set_response_payload(response, temp, strlen(temp));
rest_set_response_payload(response, (uint8_t*)temp, strlen(temp));
}
RESOURCE(discover, METHOD_GET, ".well-known/core");
void
discover_handler(REQUEST* request, RESPONSE* response)
{
char temp[100];
int index = 0;
index += sprintf(temp + index, "%s,", "</helloworld>;n=\"HelloWorld\"");
index += sprintf(temp + index, "%s,", "</led>;n=\"LedControl\"");
index += sprintf(temp + index, "%s", "</light>;n=\"Light\"");
rest_set_response_payload(response, (uint8_t*)temp, strlen(temp));
rest_set_header_content_type(response, APPLICATION_LINK_FORMAT);
}
#if defined (CONTIKI_TARGET_SKY)
/*A simple actuator example, depending on the color query parameter and post variable mode, corresponding led is activated or deactivated*/
RESOURCE(led, METHOD_POST | METHOD_PUT , "led");
@ -120,20 +137,8 @@ toggle_handler(REQUEST* request, RESPONSE* response)
{
leds_toggle(LEDS_RED);
}
#endif /*defined (CONTIKI_TARGET_SKY)*/
RESOURCE(discover, METHOD_GET, ".well-known/core");
void
discover_handler(REQUEST* request, RESPONSE* response)
{
char temp[100];
int index = 0;
index += sprintf(temp + index, "%s,", "</helloworld>;n=\"HelloWorld\"");
index += sprintf(temp + index, "%s,", "</led>;n=\"LedControl\"");
index += sprintf(temp + index, "%s", "</light>;n=\"Light\"");
rest_set_response_payload(response, temp, strlen(temp));
rest_set_header_content_type(response, APPLICATION_LINK_FORMAT);
}
PROCESS(rest_server_example, "Rest Server Example");
AUTOSTART_PROCESSES(&rest_server_example);
@ -148,14 +153,16 @@ PROCESS_THREAD(rest_server_example, ev, data)
PRINTF("HTTP Server\n");
#endif
SENSORS_ACTIVATE(light_sensor);
rest_init();
rest_activate_resource(&resource_helloworld);
#if defined (CONTIKI_TARGET_SKY)
SENSORS_ACTIVATE(light_sensor);
rest_activate_resource(&resource_led);
rest_activate_resource(&resource_light);
rest_activate_resource(&resource_toggle);
#endif /*defined (CONTIKI_TARGET_SKY)*/
rest_activate_resource(&resource_helloworld);
rest_activate_resource(&resource_discover);
PROCESS_END();

View file

@ -1,9 +1,9 @@
CONTIKI_PROJECT = sky-webserver
all: sky-webserver sky-telnet-server telnet-tweet
PLATFORM_BUILD=1 # This is needed to avoid the shell to include the httpd-cfs version of the websrerver
PLATFORM_BUILD=1 # This is needed to avoid the shell to include the httpd-cfs version of the webserver
APPS = webserver twitter telnetd
CFLAGS = -DWITH_UIP=1 -I. #-DWITH_NULLMAC=1
DEFINES=MAC_DRIVER=cxmac_driver,MAC_CHANNEL_CHECK_RATE=8
CFLAGS = -DWITH_UIP=1 -I.
DEFINES=NETSTACK_CONF_RDC=cxmac_driver,NETSTACK_CONF_RDC_CHANNEL_CHECK_RATE=8
# The webserver application normally contains a built-in file system and support
# for server-side includes.

View file

@ -54,6 +54,7 @@
#include "lib/petsciiconv.h"
static struct httpd_cgi_call *calls = NULL;
static struct collect_neighbor_list neighbor_list;
/*---------------------------------------------------------------------------*/
static
@ -168,7 +169,7 @@ static unsigned short
make_neighbor(void *arg)
{
struct httpd_state *s = (struct httpd_state *)arg;
struct collect_neighbor *n = collect_neighbor_get(s->u.count);
struct collect_neighbor *n = collect_neighbor_list_get(&neighbor_list, s->u.count);
if(n == NULL) {
return 0;
@ -188,12 +189,12 @@ PT_THREAD(neighborscall(struct httpd_state *s, char *ptr))
announcement_listen(1);
/* printf("neighbor_num %d\n", neighbor_num());*/
/* printf("neighbor_num %d\n", collect_neighbor_list_num(&neighbor_list)); */
for(s->u.count = 0; s->u.count < collect_neighbor_num(); s->u.count++) {
/* printf("count %d\n", s->u.count);*/
if(collect_neighbor_get(s->u.count) != NULL) {
/* printf("!= NULL\n");*/
for(s->u.count = 0; s->u.count < collect_neighbor_list_num(&neighbor_list); s->u.count++) {
/* printf("count %d\n", s->u.count); */
if(collect_neighbor_list_get(&neighbor_list, s->u.count) != NULL) {
/* printf("!= NULL\n"); */
PSOCK_GENERATOR_SEND(&s->sout, make_neighbor, s);
}
}
@ -208,14 +209,14 @@ received_announcement(struct announcement *a, const rimeaddr_t *from,
{
struct collect_neighbor *n;
/* printf("adv_received %d.%d\n", from->u8[0], from->u8[1]);*/
/* printf("adv_received %d.%d\n", from->u8[0], from->u8[1]); */
n = collect_neighbor_find(from);
n = collect_neighbor_list_find(&neighbor_list, from);
if(n == NULL) {
collect_neighbor_add(from, value, 1);
collect_neighbor_list_add(&neighbor_list, from, value);
} else {
collect_neighbor_update(n, value);
collect_neighbor_update_rtmetric(n, value);
}
}
@ -241,8 +242,11 @@ httpd_cgi_init(void)
announcement_register(&announcement, 31,
received_announcement);
announcement_set_value(&announcement, 0);
announcement_listen(2);
collect_neighbor_list_new(&neighbor_list);
collect_neighbor_init();
/* neighbor_discovery_open(&conn, 31,
CLOCK_SECOND * 4,
CLOCK_SECOND * 20,

View file

@ -1,11 +1,11 @@
%!: /header.html
<script type="text/javascript">
var start;i=new Image(50,60)i.src="spin.gif"function load(){var img=document.getElementById("spin");img.innerHTML='&nbsp;';loadData()}function loadData(){var r;try{r=new XMLHttpRequest()}catch(e){try{r=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{r=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){alert("Your browser does not support AJAX!");return false}}}r.onreadystatechange=function(){if(r.readyState==1){var img=document.getElementById("spin");img.innerHTML='<img src="spin.gif">'}if(r.readyState==4){var img=document.getElementById("spin");img.innerHTML='took '+((new Date()).getTime()-start.getTime())/1000+' seconds';eval(r.responseText)}}start=new Date();r.open("GET","/sensordata.shtml",true);r.send(null)}function e(el){d=document;if(d.getElementById){return d.getElementById(el)}else if(d.all){return d.all[el]}}function s(el,n,max,text){e(el).innerHTML='<table width=504 border=0 cellpadding=1 cellspacing=0>'+'<tr><td width=200>'+text+'</td>'+'<td width='+(300*n/max)+' bgcolor="gray">&nbsp;</td>'+'<td width='+(300-300*n/max)+' bgcolor="lightgray">&nbsp;</td>'+'</table>'}function dc(n,d){return n.toFixed(d)}function t(m){n=dc(-39.6+0.01*m,1);s('temp',n,40,'Temperature '+n+' &deg;C')}function h(m){n=dc(-4+0.0405*m-2.8e-6*(m*m),2);s('hum',n,100,'Humidity '+n+'%')}function l1(m){n=dc(.7629394375*m,0);s('l1',n,200,'Light 1 '+n)}function l2(m){n=dc(.4693603*m,0);s('l2',n,200,'Light 2 '+n)}function rs(m){n=m+45;s('rs',n,100,'RSSI '+n)}function p(c,l,t,r){tm=c+l;cp=c*1.8/tm;lp=l*0.0545/tm;lt=t*17.7/tm;lr=r*20/tm;n=cp+lp+lt+lr;s('p',n,30,'Power consumption '+dc(n,2)+' mW');s('pc',cp,30,'CPU power '+dc(cp,2)+' mW');s('pl',lp,30,'LPM power '+dc(lp,2)+' mW');s('pr',lr,30,'Radio RX power '+dc(lr,2)+' mW');s('pt',lt,30,'Radio TX power '+dc(lt,2)+' mW')}function i(n){e('i').innerHTML=n}
var start,d=document;i=new Image(50,60);i.src="spin.gif";function load(){var img=d.getElementById("spin");img.innerHTML='&nbsp;';loadData()}function loadData(){var r;try{r=new XMLHttpRequest()}catch(e){try{r=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{r=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){alert("Your browser does not support AJAX!");return false}}}r.onreadystatechange=function(){if(r.readyState==1){var img=d.getElementById("spin");img.innerHTML='<img src="spin.gif">'}if(r.readyState==4){var img=d.getElementById("spin");img.innerHTML='took '+((new Date()).getTime()-start.getTime())/1000+' seconds';eval(r.responseText)}};start=new Date();r.open("GET","/sensordata.shtml",true);r.send(null)}function e(el){if(d.getElementById){return d.getElementById(el)}if(d.all){return d.all[el]}}function s(el,n,max,text){e(el).innerHTML='<table width=504 border=0 cellpadding=1 cellspacing=0><tr><td width=200>'+text+'</td><td width='+(300*n/max)+' bgcolor="gray">&nbsp;</td><td width='+(300-300*n/max)+' bgcolor="lightgray">&nbsp;</td></table>'}function dc(n,d){return n.toFixed(d)}function t(m){n=dc(-39.6+0.01*m,1);s('temp',n,40,'Temperature '+n+' &deg;C')}function h(m){n=dc(-4+0.0405*m-2.8e-6*(m*m),2);s('hum',n,100,'Humidity '+n+'%')}function l1(m){n=dc(.7629394375*m,0);s('l1',n,200,'Light 1 '+n)}function l2(m){n=dc(.4693603*m,0);s('l2',n,200,'Light 2 '+n)}function rs(m){n=m+45;s('rs',n,100,'RSSI '+n)}function p(c,l,t,r){tm=c+l;cp=c*1.8/tm;lp=l*0.0545/tm;lt=t*17.7/tm;lr=r*20/tm;n=cp+lp+lt+lr;s('p',n,30,'Power consumption '+dc(n,2)+' mW');s('pc',cp,30,'CPU power '+dc(cp,2)+' mW');s('pl',lp,30,'LPM power '+dc(lp,2)+' mW');s('pr',lr,30,'Radio RX power '+dc(lr,2)+' mW');s('pt',lt,30,'Radio TX power '+dc(lt,2)+' mW')}function i(n){e('i').innerHTML=n}
</script>
<h1>Node
%! nodeid
</h1>
<a onclick="loadSensordata();" href="#">Reload</a>
<a onclick="loadData();" href="#">Reload</a>
<span id="spin"> </span>
<h2>Environment</h2>
<div id="temp"></div>
@ -22,5 +22,3 @@ var start;i=new Image(50,60)i.src="spin.gif"function load(){var img=document.get
<br><br>
<div id="i">0</div>
%!: /footer.html

View file

@ -1,4 +1,4 @@
/*********Generated by contiki/tools/makefsdata on 2010-02-03*********/
/*********Generated by contiki/tools/makefsdata on 2011-04-11*********/
const char data_sensordata_shtml[30] = {
@ -7,7 +7,7 @@ const char data_sensordata_shtml[30] = {
0x25, 0x21, 0x20, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73,
0x0a, 0x00};
const char data_sensors_shtml[2264] = {
const char data_sensors_shtml[2221] = {
/* /sensors.shtml */
0x2f, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x73, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x00,
0x25, 0x21, 0x3a, 0x20, 0x2f, 0x68, 0x65, 0x61, 0x64, 0x65,
@ -15,226 +15,222 @@ const char data_sensors_shtml[2264] = {
0x72, 0x69, 0x70, 0x74, 0x20, 0x74, 0x79, 0x70, 0x65, 0x3d,
0x22, 0x74, 0x65, 0x78, 0x74, 0x2f, 0x6a, 0x61, 0x76, 0x61,
0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x22, 0x3e, 0x0a, 0x76,
0x61, 0x72, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x3b, 0x69,
0x3d, 0x6e, 0x65, 0x77, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65,
0x28, 0x35, 0x30, 0x2c, 0x36, 0x30, 0x29, 0x69, 0x2e, 0x73,
0x72, 0x63, 0x3d, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x2e, 0x67,
0x69, 0x66, 0x22, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x28, 0x29, 0x7b, 0x76,
0x61, 0x72, 0x20, 0x69, 0x6d, 0x67, 0x3d, 0x64, 0x6f, 0x63,
0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x74, 0x45,
0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79, 0x49, 0x64,
0x28, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x29, 0x3b, 0x69,
0x6d, 0x67, 0x2e, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x48, 0x54,
0x4d, 0x4c, 0x3d, 0x27, 0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b,
0x27, 0x3b, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61,
0x28, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x44, 0x61, 0x74, 0x61,
0x28, 0x29, 0x7b, 0x76, 0x61, 0x72, 0x20, 0x72, 0x3b, 0x74,
0x72, 0x79, 0x7b, 0x72, 0x3d, 0x6e, 0x65, 0x77, 0x20, 0x58,
0x4d, 0x4c, 0x48, 0x74, 0x74, 0x70, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x28, 0x29, 0x7d, 0x63, 0x61, 0x74, 0x63,
0x68, 0x28, 0x65, 0x29, 0x7b, 0x74, 0x72, 0x79, 0x7b, 0x72,
0x3d, 0x6e, 0x65, 0x77, 0x20, 0x41, 0x63, 0x74, 0x69, 0x76,
0x65, 0x58, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28, 0x22,
0x4d, 0x73, 0x78, 0x6d, 0x6c, 0x32, 0x2e, 0x58, 0x4d, 0x4c,
0x48, 0x54, 0x54, 0x50, 0x22, 0x29, 0x7d, 0x63, 0x61, 0x74,
0x63, 0x68, 0x28, 0x65, 0x29, 0x7b, 0x74, 0x72, 0x79, 0x7b,
0x72, 0x3d, 0x6e, 0x65, 0x77, 0x20, 0x41, 0x63, 0x74, 0x69,
0x76, 0x65, 0x58, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x28,
0x22, 0x4d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74,
0x2e, 0x58, 0x4d, 0x4c, 0x48, 0x54, 0x54, 0x50, 0x22, 0x29,
0x7d, 0x63, 0x61, 0x74, 0x63, 0x68, 0x28, 0x65, 0x29, 0x7b,
0x61, 0x6c, 0x65, 0x72, 0x74, 0x28, 0x22, 0x59, 0x6f, 0x75,
0x72, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x73, 0x65, 0x72, 0x20,
0x64, 0x6f, 0x65, 0x73, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73,
0x75, 0x70, 0x70, 0x6f, 0x72, 0x74, 0x20, 0x41, 0x4a, 0x41,
0x58, 0x21, 0x22, 0x29, 0x3b, 0x72, 0x65, 0x74, 0x75, 0x72,
0x6e, 0x20, 0x66, 0x61, 0x6c, 0x73, 0x65, 0x7d, 0x7d, 0x7d,
0x72, 0x2e, 0x6f, 0x6e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x73,
0x74, 0x61, 0x74, 0x65, 0x63, 0x68, 0x61, 0x6e, 0x67, 0x65,
0x3d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28,
0x29, 0x7b, 0x69, 0x66, 0x28, 0x72, 0x2e, 0x72, 0x65, 0x61,
0x64, 0x79, 0x53, 0x74, 0x61, 0x74, 0x65, 0x3d, 0x3d, 0x31,
0x61, 0x72, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x2c, 0x64,
0x3d, 0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x3b,
0x69, 0x3d, 0x6e, 0x65, 0x77, 0x20, 0x49, 0x6d, 0x61, 0x67,
0x65, 0x28, 0x35, 0x30, 0x2c, 0x36, 0x30, 0x29, 0x3b, 0x69,
0x2e, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x73, 0x70, 0x69, 0x6e,
0x2e, 0x67, 0x69, 0x66, 0x22, 0x3b, 0x66, 0x75, 0x6e, 0x63,
0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x28,
0x29, 0x7b, 0x76, 0x61, 0x72, 0x20, 0x69, 0x6d, 0x67, 0x3d,
0x64, 0x6f, 0x63, 0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x67,
0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42,
0x79, 0x49, 0x64, 0x28, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22,
0x29, 0x3b, 0x69, 0x6d, 0x67, 0x2e, 0x69, 0x6e, 0x6e, 0x65,
0x72, 0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x27, 0x3c, 0x69, 0x6d,
0x67, 0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x73, 0x70, 0x69,
0x6e, 0x2e, 0x67, 0x69, 0x66, 0x22, 0x3e, 0x27, 0x7d, 0x69,
0x66, 0x28, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x53,
0x74, 0x61, 0x74, 0x65, 0x3d, 0x3d, 0x34, 0x29, 0x7b, 0x76,
0x61, 0x72, 0x20, 0x69, 0x6d, 0x67, 0x3d, 0x64, 0x6f, 0x63,
0x75, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x67, 0x65, 0x74, 0x45,
0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79, 0x49, 0x64,
0x28, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x29, 0x3b, 0x69,
0x6d, 0x67, 0x2e, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x48, 0x54,
0x4d, 0x4c, 0x3d, 0x27, 0x74, 0x6f, 0x6f, 0x6b, 0x20, 0x27,
0x2b, 0x28, 0x28, 0x6e, 0x65, 0x77, 0x20, 0x44, 0x61, 0x74,
0x65, 0x28, 0x29, 0x29, 0x2e, 0x67, 0x65, 0x74, 0x54, 0x69,
0x6d, 0x65, 0x28, 0x29, 0x2d, 0x73, 0x74, 0x61, 0x72, 0x74,
0x2e, 0x67, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x28, 0x29,
0x29, 0x2f, 0x31, 0x30, 0x30, 0x30, 0x2b, 0x27, 0x20, 0x73,
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x27, 0x3b, 0x65, 0x76,
0x61, 0x6c, 0x28, 0x72, 0x2e, 0x72, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x54, 0x65, 0x78, 0x74, 0x29, 0x7d, 0x7d,
0x73, 0x74, 0x61, 0x72, 0x74, 0x3d, 0x6e, 0x65, 0x77, 0x20,
0x44, 0x61, 0x74, 0x65, 0x28, 0x29, 0x3b, 0x72, 0x2e, 0x6f,
0x70, 0x65, 0x6e, 0x28, 0x22, 0x47, 0x45, 0x54, 0x22, 0x2c,
0x22, 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x6f, 0x72, 0x64, 0x61,
0x74, 0x61, 0x2e, 0x73, 0x68, 0x74, 0x6d, 0x6c, 0x22, 0x2c,
0x74, 0x72, 0x75, 0x65, 0x29, 0x3b, 0x72, 0x2e, 0x73, 0x65,
0x6e, 0x64, 0x28, 0x6e, 0x75, 0x6c, 0x6c, 0x29, 0x7d, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x65, 0x28,
0x65, 0x6c, 0x29, 0x7b, 0x64, 0x3d, 0x64, 0x6f, 0x63, 0x75,
0x6d, 0x65, 0x6e, 0x74, 0x3b, 0x69, 0x66, 0x28, 0x64, 0x2e,
0x67, 0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74,
0x42, 0x79, 0x49, 0x64, 0x29, 0x7b, 0x72, 0x65, 0x74, 0x75,
0x72, 0x6e, 0x20, 0x64, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c,
0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79, 0x49, 0x64, 0x28,
0x65, 0x6c, 0x29, 0x7d, 0x65, 0x6c, 0x73, 0x65, 0x20, 0x69,
0x66, 0x28, 0x64, 0x2e, 0x61, 0x6c, 0x6c, 0x29, 0x7b, 0x72,
0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x64, 0x2e, 0x61, 0x6c,
0x6c, 0x5b, 0x65, 0x6c, 0x5d, 0x7d, 0x7d, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x73, 0x28, 0x65, 0x6c,
0x2c, 0x6e, 0x2c, 0x6d, 0x61, 0x78, 0x2c, 0x74, 0x65, 0x78,
0x74, 0x29, 0x7b, 0x65, 0x28, 0x65, 0x6c, 0x29, 0x2e, 0x69,
0x64, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x42, 0x79, 0x49, 0x64, 0x28, 0x22, 0x73, 0x70,
0x69, 0x6e, 0x22, 0x29, 0x3b, 0x69, 0x6d, 0x67, 0x2e, 0x69,
0x6e, 0x6e, 0x65, 0x72, 0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x27,
0x3c, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64,
0x74, 0x68, 0x3d, 0x35, 0x30, 0x34, 0x20, 0x62, 0x6f, 0x72,
0x64, 0x65, 0x72, 0x3d, 0x30, 0x20, 0x63, 0x65, 0x6c, 0x6c,
0x70, 0x61, 0x64, 0x64, 0x69, 0x6e, 0x67, 0x3d, 0x31, 0x20,
0x63, 0x65, 0x6c, 0x6c, 0x73, 0x70, 0x61, 0x63, 0x69, 0x6e,
0x67, 0x3d, 0x30, 0x3e, 0x27, 0x2b, 0x27, 0x3c, 0x74, 0x72,
0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68,
0x3d, 0x32, 0x30, 0x30, 0x3e, 0x27, 0x2b, 0x74, 0x65, 0x78,
0x74, 0x2b, 0x27, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x27, 0x2b,
0x27, 0x3c, 0x74, 0x64, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68,
0x3d, 0x27, 0x2b, 0x28, 0x33, 0x30, 0x30, 0x2a, 0x6e, 0x2f,
0x6d, 0x61, 0x78, 0x29, 0x2b, 0x27, 0x20, 0x62, 0x67, 0x63,
0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x67, 0x72, 0x61, 0x79,
0x22, 0x3e, 0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b, 0x3c, 0x2f,
0x74, 0x64, 0x3e, 0x27, 0x2b, 0x27, 0x3c, 0x74, 0x64, 0x20,
0x77, 0x69, 0x64, 0x74, 0x68, 0x3d, 0x27, 0x2b, 0x28, 0x33,
0x30, 0x30, 0x2d, 0x33, 0x30, 0x30, 0x2a, 0x6e, 0x2f, 0x6d,
0x61, 0x78, 0x29, 0x2b, 0x27, 0x20, 0x62, 0x67, 0x63, 0x6f,
0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x6c, 0x69, 0x67, 0x68, 0x74,
0x67, 0x72, 0x61, 0x79, 0x22, 0x3e, 0x26, 0x6e, 0x62, 0x73,
0x70, 0x3b, 0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x27, 0x2b, 0x27,
0x3c, 0x2f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x3e, 0x27, 0x7d,
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64,
0x63, 0x28, 0x6e, 0x2c, 0x64, 0x29, 0x7b, 0x72, 0x65, 0x74,
0x75, 0x72, 0x6e, 0x20, 0x6e, 0x2e, 0x74, 0x6f, 0x46, 0x69,
0x78, 0x65, 0x64, 0x28, 0x64, 0x29, 0x7d, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x74, 0x28, 0x6d, 0x29,
0x7b, 0x6e, 0x3d, 0x64, 0x63, 0x28, 0x2d, 0x33, 0x39, 0x2e,
0x36, 0x2b, 0x30, 0x2e, 0x30, 0x31, 0x2a, 0x6d, 0x2c, 0x31,
0x29, 0x3b, 0x73, 0x28, 0x27, 0x74, 0x65, 0x6d, 0x70, 0x27,
0x2c, 0x6e, 0x2c, 0x34, 0x30, 0x2c, 0x27, 0x54, 0x65, 0x6d,
0x70, 0x65, 0x72, 0x61, 0x74, 0x75, 0x72, 0x65, 0x20, 0x27,
0x2b, 0x6e, 0x2b, 0x27, 0x20, 0x26, 0x64, 0x65, 0x67, 0x3b,
0x43, 0x27, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x20, 0x68, 0x28, 0x6d, 0x29, 0x7b, 0x6e, 0x3d,
0x64, 0x63, 0x28, 0x2d, 0x34, 0x2b, 0x30, 0x2e, 0x30, 0x34,
0x30, 0x35, 0x2a, 0x6d, 0x2d, 0x32, 0x2e, 0x38, 0x65, 0x2d,
0x36, 0x2a, 0x28, 0x6d, 0x2a, 0x6d, 0x29, 0x2c, 0x32, 0x29,
0x3b, 0x73, 0x28, 0x27, 0x68, 0x75, 0x6d, 0x27, 0x2c, 0x6e,
0x2c, 0x31, 0x30, 0x30, 0x2c, 0x27, 0x48, 0x75, 0x6d, 0x69,
0x64, 0x69, 0x74, 0x79, 0x20, 0x27, 0x2b, 0x6e, 0x2b, 0x27,
0x25, 0x27, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x20, 0x6c, 0x31, 0x28, 0x6d, 0x29, 0x7b, 0x6e,
0x3d, 0x64, 0x63, 0x28, 0x2e, 0x37, 0x36, 0x32, 0x39, 0x33,
0x39, 0x34, 0x33, 0x37, 0x35, 0x2a, 0x6d, 0x2c, 0x30, 0x29,
0x3b, 0x73, 0x28, 0x27, 0x6c, 0x31, 0x27, 0x2c, 0x6e, 0x2c,
0x32, 0x30, 0x30, 0x2c, 0x27, 0x4c, 0x69, 0x67, 0x68, 0x74,
0x20, 0x31, 0x20, 0x27, 0x2b, 0x6e, 0x29, 0x7d, 0x66, 0x75,
0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x32, 0x28,
0x6d, 0x29, 0x7b, 0x6e, 0x3d, 0x64, 0x63, 0x28, 0x2e, 0x34,
0x36, 0x39, 0x33, 0x36, 0x30, 0x33, 0x2a, 0x6d, 0x2c, 0x30,
0x29, 0x3b, 0x73, 0x28, 0x27, 0x6c, 0x32, 0x27, 0x2c, 0x6e,
0x2c, 0x32, 0x30, 0x30, 0x2c, 0x27, 0x4c, 0x69, 0x67, 0x68,
0x74, 0x20, 0x32, 0x20, 0x27, 0x2b, 0x6e, 0x29, 0x7d, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x72, 0x73,
0x28, 0x6d, 0x29, 0x7b, 0x6e, 0x3d, 0x6d, 0x2b, 0x34, 0x35,
0x3b, 0x73, 0x28, 0x27, 0x72, 0x73, 0x27, 0x2c, 0x6e, 0x2c,
0x31, 0x30, 0x30, 0x2c, 0x27, 0x52, 0x53, 0x53, 0x49, 0x20,
0x27, 0x2b, 0x6e, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x20, 0x70, 0x28, 0x63, 0x2c, 0x6c, 0x2c,
0x74, 0x2c, 0x72, 0x29, 0x7b, 0x74, 0x6d, 0x3d, 0x63, 0x2b,
0x6c, 0x3b, 0x63, 0x70, 0x3d, 0x63, 0x2a, 0x31, 0x2e, 0x38,
0x2f, 0x74, 0x6d, 0x3b, 0x6c, 0x70, 0x3d, 0x6c, 0x2a, 0x30,
0x2e, 0x30, 0x35, 0x34, 0x35, 0x2f, 0x74, 0x6d, 0x3b, 0x6c,
0x74, 0x3d, 0x74, 0x2a, 0x31, 0x37, 0x2e, 0x37, 0x2f, 0x74,
0x6d, 0x3b, 0x6c, 0x72, 0x3d, 0x72, 0x2a, 0x32, 0x30, 0x2f,
0x74, 0x6d, 0x3b, 0x6e, 0x3d, 0x63, 0x70, 0x2b, 0x6c, 0x70,
0x2b, 0x6c, 0x74, 0x2b, 0x6c, 0x72, 0x3b, 0x73, 0x28, 0x27,
0x70, 0x27, 0x2c, 0x6e, 0x2c, 0x33, 0x30, 0x2c, 0x27, 0x50,
0x6f, 0x77, 0x65, 0x72, 0x20, 0x63, 0x6f, 0x6e, 0x73, 0x75,
0x6d, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x27, 0x2b, 0x64,
0x63, 0x28, 0x6e, 0x2c, 0x32, 0x29, 0x2b, 0x27, 0x20, 0x6d,
0x57, 0x27, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x70, 0x63, 0x27,
0x2c, 0x63, 0x70, 0x2c, 0x33, 0x30, 0x2c, 0x27, 0x43, 0x50,
0x55, 0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20, 0x27, 0x2b,
0x64, 0x63, 0x28, 0x63, 0x70, 0x2c, 0x32, 0x29, 0x2b, 0x27,
0x20, 0x6d, 0x57, 0x27, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x70,
0x6c, 0x27, 0x2c, 0x6c, 0x70, 0x2c, 0x33, 0x30, 0x2c, 0x27,
0x4c, 0x50, 0x4d, 0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20,
0x27, 0x2b, 0x64, 0x63, 0x28, 0x6c, 0x70, 0x2c, 0x32, 0x29,
0x2b, 0x27, 0x20, 0x6d, 0x57, 0x27, 0x29, 0x3b, 0x73, 0x28,
0x27, 0x70, 0x72, 0x27, 0x2c, 0x6c, 0x72, 0x2c, 0x33, 0x30,
0x2c, 0x27, 0x52, 0x61, 0x64, 0x69, 0x6f, 0x20, 0x52, 0x58,
0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20, 0x27, 0x2b, 0x64,
0x63, 0x28, 0x6c, 0x72, 0x2c, 0x32, 0x29, 0x2b, 0x27, 0x20,
0x6d, 0x57, 0x27, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x70, 0x74,
0x27, 0x2c, 0x6c, 0x74, 0x2c, 0x33, 0x30, 0x2c, 0x27, 0x52,
0x61, 0x64, 0x69, 0x6f, 0x20, 0x54, 0x58, 0x20, 0x70, 0x6f,
0x77, 0x65, 0x72, 0x20, 0x27, 0x2b, 0x64, 0x63, 0x28, 0x6c,
0x74, 0x2c, 0x32, 0x29, 0x2b, 0x27, 0x20, 0x6d, 0x57, 0x27,
0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b, 0x27, 0x3b, 0x6c, 0x6f,
0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x28, 0x29, 0x7d, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f,
0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x28, 0x29, 0x7b, 0x76,
0x61, 0x72, 0x20, 0x72, 0x3b, 0x74, 0x72, 0x79, 0x7b, 0x72,
0x3d, 0x6e, 0x65, 0x77, 0x20, 0x58, 0x4d, 0x4c, 0x48, 0x74,
0x74, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x28,
0x29, 0x7d, 0x63, 0x61, 0x74, 0x63, 0x68, 0x28, 0x65, 0x29,
0x7b, 0x74, 0x72, 0x79, 0x7b, 0x72, 0x3d, 0x6e, 0x65, 0x77,
0x20, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x58, 0x4f, 0x62,
0x6a, 0x65, 0x63, 0x74, 0x28, 0x22, 0x4d, 0x73, 0x78, 0x6d,
0x6c, 0x32, 0x2e, 0x58, 0x4d, 0x4c, 0x48, 0x54, 0x54, 0x50,
0x22, 0x29, 0x7d, 0x63, 0x61, 0x74, 0x63, 0x68, 0x28, 0x65,
0x29, 0x7b, 0x74, 0x72, 0x79, 0x7b, 0x72, 0x3d, 0x6e, 0x65,
0x77, 0x20, 0x41, 0x63, 0x74, 0x69, 0x76, 0x65, 0x58, 0x4f,
0x62, 0x6a, 0x65, 0x63, 0x74, 0x28, 0x22, 0x4d, 0x69, 0x63,
0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x2e, 0x58, 0x4d, 0x4c,
0x48, 0x54, 0x54, 0x50, 0x22, 0x29, 0x7d, 0x63, 0x61, 0x74,
0x63, 0x68, 0x28, 0x65, 0x29, 0x7b, 0x61, 0x6c, 0x65, 0x72,
0x74, 0x28, 0x22, 0x59, 0x6f, 0x75, 0x72, 0x20, 0x62, 0x72,
0x6f, 0x77, 0x73, 0x65, 0x72, 0x20, 0x64, 0x6f, 0x65, 0x73,
0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x75, 0x70, 0x70, 0x6f,
0x72, 0x74, 0x20, 0x41, 0x4a, 0x41, 0x58, 0x21, 0x22, 0x29,
0x3b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x66, 0x61,
0x6c, 0x73, 0x65, 0x7d, 0x7d, 0x7d, 0x72, 0x2e, 0x6f, 0x6e,
0x72, 0x65, 0x61, 0x64, 0x79, 0x73, 0x74, 0x61, 0x74, 0x65,
0x63, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x3d, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x28, 0x29, 0x7b, 0x69, 0x66,
0x28, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x53, 0x74,
0x61, 0x74, 0x65, 0x3d, 0x3d, 0x31, 0x29, 0x7b, 0x76, 0x61,
0x72, 0x20, 0x69, 0x6d, 0x67, 0x3d, 0x64, 0x2e, 0x67, 0x65,
0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79,
0x49, 0x64, 0x28, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x29,
0x3b, 0x69, 0x6d, 0x67, 0x2e, 0x69, 0x6e, 0x6e, 0x65, 0x72,
0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x27, 0x3c, 0x69, 0x6d, 0x67,
0x20, 0x73, 0x72, 0x63, 0x3d, 0x22, 0x73, 0x70, 0x69, 0x6e,
0x2e, 0x67, 0x69, 0x66, 0x22, 0x3e, 0x27, 0x7d, 0x69, 0x66,
0x28, 0x72, 0x2e, 0x72, 0x65, 0x61, 0x64, 0x79, 0x53, 0x74,
0x61, 0x74, 0x65, 0x3d, 0x3d, 0x34, 0x29, 0x7b, 0x76, 0x61,
0x72, 0x20, 0x69, 0x6d, 0x67, 0x3d, 0x64, 0x2e, 0x67, 0x65,
0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79,
0x49, 0x64, 0x28, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x29,
0x3b, 0x69, 0x6d, 0x67, 0x2e, 0x69, 0x6e, 0x6e, 0x65, 0x72,
0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x27, 0x74, 0x6f, 0x6f, 0x6b,
0x20, 0x27, 0x2b, 0x28, 0x28, 0x6e, 0x65, 0x77, 0x20, 0x44,
0x61, 0x74, 0x65, 0x28, 0x29, 0x29, 0x2e, 0x67, 0x65, 0x74,
0x54, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x2d, 0x73, 0x74, 0x61,
0x72, 0x74, 0x2e, 0x67, 0x65, 0x74, 0x54, 0x69, 0x6d, 0x65,
0x28, 0x29, 0x29, 0x2f, 0x31, 0x30, 0x30, 0x30, 0x2b, 0x27,
0x20, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x27, 0x3b,
0x65, 0x76, 0x61, 0x6c, 0x28, 0x72, 0x2e, 0x72, 0x65, 0x73,
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x54, 0x65, 0x78, 0x74, 0x29,
0x7d, 0x7d, 0x3b, 0x73, 0x74, 0x61, 0x72, 0x74, 0x3d, 0x6e,
0x65, 0x77, 0x20, 0x44, 0x61, 0x74, 0x65, 0x28, 0x29, 0x3b,
0x72, 0x2e, 0x6f, 0x70, 0x65, 0x6e, 0x28, 0x22, 0x47, 0x45,
0x54, 0x22, 0x2c, 0x22, 0x2f, 0x73, 0x65, 0x6e, 0x73, 0x6f,
0x72, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x73, 0x68, 0x74, 0x6d,
0x6c, 0x22, 0x2c, 0x74, 0x72, 0x75, 0x65, 0x29, 0x3b, 0x72,
0x2e, 0x73, 0x65, 0x6e, 0x64, 0x28, 0x6e, 0x75, 0x6c, 0x6c,
0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x20, 0x69, 0x28, 0x6e, 0x29, 0x7b, 0x65, 0x28, 0x27, 0x69,
0x27, 0x29, 0x2e, 0x69, 0x6e, 0x6e, 0x65, 0x72, 0x48, 0x54,
0x4d, 0x4c, 0x3d, 0x6e, 0x7d, 0x0a, 0x3c, 0x2f, 0x73, 0x63,
0x72, 0x69, 0x70, 0x74, 0x3e, 0x0a, 0x3c, 0x68, 0x31, 0x3e,
0x4e, 0x6f, 0x64, 0x65, 0x0a, 0x25, 0x21, 0x20, 0x6e, 0x6f,
0x64, 0x65, 0x69, 0x64, 0x0a, 0x3c, 0x2f, 0x68, 0x31, 0x3e,
0x0a, 0x3c, 0x61, 0x20, 0x6f, 0x6e, 0x63, 0x6c, 0x69, 0x63,
0x6b, 0x3d, 0x22, 0x6c, 0x6f, 0x61, 0x64, 0x53, 0x65, 0x6e,
0x73, 0x6f, 0x72, 0x64, 0x61, 0x74, 0x61, 0x28, 0x29, 0x3b,
0x22, 0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x23, 0x22,
0x3e, 0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x3c, 0x2f, 0x61,
0x3e, 0x0a, 0x3c, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x69, 0x64,
0x3d, 0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x3e, 0x20, 0x3c,
0x2f, 0x73, 0x70, 0x61, 0x6e, 0x3e, 0x0a, 0x3c, 0x68, 0x32,
0x3e, 0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65,
0x6e, 0x74, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0x0a, 0x3c, 0x64,
0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x74, 0x65, 0x6d,
0x70, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x68,
0x75, 0x6d, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e,
0x0a, 0x3c, 0x68, 0x32, 0x3e, 0x4c, 0x69, 0x67, 0x68, 0x74,
0x3c, 0x2f, 0x68, 0x32, 0x3e, 0x0a, 0x3c, 0x64, 0x69, 0x76,
0x20, 0x69, 0x64, 0x3d, 0x22, 0x6c, 0x31, 0x22, 0x3e, 0x3c,
0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c, 0x64, 0x69, 0x76,
0x20, 0x69, 0x64, 0x3d, 0x22, 0x6c, 0x32, 0x22, 0x3e, 0x3c,
0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c, 0x68, 0x32, 0x3e,
0x50, 0x6f, 0x77, 0x65, 0x72, 0x3c, 0x2f, 0x68, 0x32, 0x3e,
0x0a, 0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22,
0x70, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x20, 0x65, 0x28, 0x65, 0x6c, 0x29, 0x7b, 0x69, 0x66, 0x28,
0x64, 0x2e, 0x67, 0x65, 0x74, 0x45, 0x6c, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x42, 0x79, 0x49, 0x64, 0x29, 0x7b, 0x72, 0x65,
0x74, 0x75, 0x72, 0x6e, 0x20, 0x64, 0x2e, 0x67, 0x65, 0x74,
0x45, 0x6c, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x79, 0x49,
0x64, 0x28, 0x65, 0x6c, 0x29, 0x7d, 0x69, 0x66, 0x28, 0x64,
0x2e, 0x61, 0x6c, 0x6c, 0x29, 0x7b, 0x72, 0x65, 0x74, 0x75,
0x72, 0x6e, 0x20, 0x64, 0x2e, 0x61, 0x6c, 0x6c, 0x5b, 0x65,
0x6c, 0x5d, 0x7d, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x20, 0x73, 0x28, 0x65, 0x6c, 0x2c, 0x6e, 0x2c,
0x6d, 0x61, 0x78, 0x2c, 0x74, 0x65, 0x78, 0x74, 0x29, 0x7b,
0x65, 0x28, 0x65, 0x6c, 0x29, 0x2e, 0x69, 0x6e, 0x6e, 0x65,
0x72, 0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x27, 0x3c, 0x74, 0x61,
0x62, 0x6c, 0x65, 0x20, 0x77, 0x69, 0x64, 0x74, 0x68, 0x3d,
0x35, 0x30, 0x34, 0x20, 0x62, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x3d, 0x30, 0x20, 0x63, 0x65, 0x6c, 0x6c, 0x70, 0x61, 0x64,
0x64, 0x69, 0x6e, 0x67, 0x3d, 0x31, 0x20, 0x63, 0x65, 0x6c,
0x6c, 0x73, 0x70, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x3d, 0x30,
0x3e, 0x3c, 0x74, 0x72, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77,
0x69, 0x64, 0x74, 0x68, 0x3d, 0x32, 0x30, 0x30, 0x3e, 0x27,
0x2b, 0x74, 0x65, 0x78, 0x74, 0x2b, 0x27, 0x3c, 0x2f, 0x74,
0x64, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77, 0x69, 0x64, 0x74,
0x68, 0x3d, 0x27, 0x2b, 0x28, 0x33, 0x30, 0x30, 0x2a, 0x6e,
0x2f, 0x6d, 0x61, 0x78, 0x29, 0x2b, 0x27, 0x20, 0x62, 0x67,
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3d, 0x22, 0x67, 0x72, 0x61,
0x79, 0x22, 0x3e, 0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b, 0x3c,
0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x74, 0x64, 0x20, 0x77, 0x69,
0x64, 0x74, 0x68, 0x3d, 0x27, 0x2b, 0x28, 0x33, 0x30, 0x30,
0x2d, 0x33, 0x30, 0x30, 0x2a, 0x6e, 0x2f, 0x6d, 0x61, 0x78,
0x29, 0x2b, 0x27, 0x20, 0x62, 0x67, 0x63, 0x6f, 0x6c, 0x6f,
0x72, 0x3d, 0x22, 0x6c, 0x69, 0x67, 0x68, 0x74, 0x67, 0x72,
0x61, 0x79, 0x22, 0x3e, 0x26, 0x6e, 0x62, 0x73, 0x70, 0x3b,
0x3c, 0x2f, 0x74, 0x64, 0x3e, 0x3c, 0x2f, 0x74, 0x61, 0x62,
0x6c, 0x65, 0x3e, 0x27, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74,
0x69, 0x6f, 0x6e, 0x20, 0x64, 0x63, 0x28, 0x6e, 0x2c, 0x64,
0x29, 0x7b, 0x72, 0x65, 0x74, 0x75, 0x72, 0x6e, 0x20, 0x6e,
0x2e, 0x74, 0x6f, 0x46, 0x69, 0x78, 0x65, 0x64, 0x28, 0x64,
0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e,
0x20, 0x74, 0x28, 0x6d, 0x29, 0x7b, 0x6e, 0x3d, 0x64, 0x63,
0x28, 0x2d, 0x33, 0x39, 0x2e, 0x36, 0x2b, 0x30, 0x2e, 0x30,
0x31, 0x2a, 0x6d, 0x2c, 0x31, 0x29, 0x3b, 0x73, 0x28, 0x27,
0x74, 0x65, 0x6d, 0x70, 0x27, 0x2c, 0x6e, 0x2c, 0x34, 0x30,
0x2c, 0x27, 0x54, 0x65, 0x6d, 0x70, 0x65, 0x72, 0x61, 0x74,
0x75, 0x72, 0x65, 0x20, 0x27, 0x2b, 0x6e, 0x2b, 0x27, 0x20,
0x26, 0x64, 0x65, 0x67, 0x3b, 0x43, 0x27, 0x29, 0x7d, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x68, 0x28,
0x6d, 0x29, 0x7b, 0x6e, 0x3d, 0x64, 0x63, 0x28, 0x2d, 0x34,
0x2b, 0x30, 0x2e, 0x30, 0x34, 0x30, 0x35, 0x2a, 0x6d, 0x2d,
0x32, 0x2e, 0x38, 0x65, 0x2d, 0x36, 0x2a, 0x28, 0x6d, 0x2a,
0x6d, 0x29, 0x2c, 0x32, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x68,
0x75, 0x6d, 0x27, 0x2c, 0x6e, 0x2c, 0x31, 0x30, 0x30, 0x2c,
0x27, 0x48, 0x75, 0x6d, 0x69, 0x64, 0x69, 0x74, 0x79, 0x20,
0x27, 0x2b, 0x6e, 0x2b, 0x27, 0x25, 0x27, 0x29, 0x7d, 0x66,
0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x31,
0x28, 0x6d, 0x29, 0x7b, 0x6e, 0x3d, 0x64, 0x63, 0x28, 0x2e,
0x37, 0x36, 0x32, 0x39, 0x33, 0x39, 0x34, 0x33, 0x37, 0x35,
0x2a, 0x6d, 0x2c, 0x30, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x6c,
0x31, 0x27, 0x2c, 0x6e, 0x2c, 0x32, 0x30, 0x30, 0x2c, 0x27,
0x4c, 0x69, 0x67, 0x68, 0x74, 0x20, 0x31, 0x20, 0x27, 0x2b,
0x6e, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x6c, 0x32, 0x28, 0x6d, 0x29, 0x7b, 0x6e, 0x3d,
0x64, 0x63, 0x28, 0x2e, 0x34, 0x36, 0x39, 0x33, 0x36, 0x30,
0x33, 0x2a, 0x6d, 0x2c, 0x30, 0x29, 0x3b, 0x73, 0x28, 0x27,
0x6c, 0x32, 0x27, 0x2c, 0x6e, 0x2c, 0x32, 0x30, 0x30, 0x2c,
0x27, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x20, 0x32, 0x20, 0x27,
0x2b, 0x6e, 0x29, 0x7d, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69,
0x6f, 0x6e, 0x20, 0x72, 0x73, 0x28, 0x6d, 0x29, 0x7b, 0x6e,
0x3d, 0x6d, 0x2b, 0x34, 0x35, 0x3b, 0x73, 0x28, 0x27, 0x72,
0x73, 0x27, 0x2c, 0x6e, 0x2c, 0x31, 0x30, 0x30, 0x2c, 0x27,
0x52, 0x53, 0x53, 0x49, 0x20, 0x27, 0x2b, 0x6e, 0x29, 0x7d,
0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x70,
0x28, 0x63, 0x2c, 0x6c, 0x2c, 0x74, 0x2c, 0x72, 0x29, 0x7b,
0x74, 0x6d, 0x3d, 0x63, 0x2b, 0x6c, 0x3b, 0x63, 0x70, 0x3d,
0x63, 0x2a, 0x31, 0x2e, 0x38, 0x2f, 0x74, 0x6d, 0x3b, 0x6c,
0x70, 0x3d, 0x6c, 0x2a, 0x30, 0x2e, 0x30, 0x35, 0x34, 0x35,
0x2f, 0x74, 0x6d, 0x3b, 0x6c, 0x74, 0x3d, 0x74, 0x2a, 0x31,
0x37, 0x2e, 0x37, 0x2f, 0x74, 0x6d, 0x3b, 0x6c, 0x72, 0x3d,
0x72, 0x2a, 0x32, 0x30, 0x2f, 0x74, 0x6d, 0x3b, 0x6e, 0x3d,
0x63, 0x70, 0x2b, 0x6c, 0x70, 0x2b, 0x6c, 0x74, 0x2b, 0x6c,
0x72, 0x3b, 0x73, 0x28, 0x27, 0x70, 0x27, 0x2c, 0x6e, 0x2c,
0x33, 0x30, 0x2c, 0x27, 0x50, 0x6f, 0x77, 0x65, 0x72, 0x20,
0x63, 0x6f, 0x6e, 0x73, 0x75, 0x6d, 0x70, 0x74, 0x69, 0x6f,
0x6e, 0x20, 0x27, 0x2b, 0x64, 0x63, 0x28, 0x6e, 0x2c, 0x32,
0x29, 0x2b, 0x27, 0x20, 0x6d, 0x57, 0x27, 0x29, 0x3b, 0x73,
0x28, 0x27, 0x70, 0x63, 0x27, 0x2c, 0x63, 0x70, 0x2c, 0x33,
0x30, 0x2c, 0x27, 0x43, 0x50, 0x55, 0x20, 0x70, 0x6f, 0x77,
0x65, 0x72, 0x20, 0x27, 0x2b, 0x64, 0x63, 0x28, 0x63, 0x70,
0x2c, 0x32, 0x29, 0x2b, 0x27, 0x20, 0x6d, 0x57, 0x27, 0x29,
0x3b, 0x73, 0x28, 0x27, 0x70, 0x6c, 0x27, 0x2c, 0x6c, 0x70,
0x2c, 0x33, 0x30, 0x2c, 0x27, 0x4c, 0x50, 0x4d, 0x20, 0x70,
0x6f, 0x77, 0x65, 0x72, 0x20, 0x27, 0x2b, 0x64, 0x63, 0x28,
0x6c, 0x70, 0x2c, 0x32, 0x29, 0x2b, 0x27, 0x20, 0x6d, 0x57,
0x27, 0x29, 0x3b, 0x73, 0x28, 0x27, 0x70, 0x72, 0x27, 0x2c,
0x6c, 0x72, 0x2c, 0x33, 0x30, 0x2c, 0x27, 0x52, 0x61, 0x64,
0x69, 0x6f, 0x20, 0x52, 0x58, 0x20, 0x70, 0x6f, 0x77, 0x65,
0x72, 0x20, 0x27, 0x2b, 0x64, 0x63, 0x28, 0x6c, 0x72, 0x2c,
0x32, 0x29, 0x2b, 0x27, 0x20, 0x6d, 0x57, 0x27, 0x29, 0x3b,
0x73, 0x28, 0x27, 0x70, 0x74, 0x27, 0x2c, 0x6c, 0x74, 0x2c,
0x33, 0x30, 0x2c, 0x27, 0x52, 0x61, 0x64, 0x69, 0x6f, 0x20,
0x54, 0x58, 0x20, 0x70, 0x6f, 0x77, 0x65, 0x72, 0x20, 0x27,
0x2b, 0x64, 0x63, 0x28, 0x6c, 0x74, 0x2c, 0x32, 0x29, 0x2b,
0x27, 0x20, 0x6d, 0x57, 0x27, 0x29, 0x7d, 0x66, 0x75, 0x6e,
0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x69, 0x28, 0x6e, 0x29,
0x7b, 0x65, 0x28, 0x27, 0x69, 0x27, 0x29, 0x2e, 0x69, 0x6e,
0x6e, 0x65, 0x72, 0x48, 0x54, 0x4d, 0x4c, 0x3d, 0x6e, 0x7d,
0x0a, 0x3c, 0x2f, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x3e,
0x0a, 0x3c, 0x68, 0x31, 0x3e, 0x4e, 0x6f, 0x64, 0x65, 0x0a,
0x25, 0x21, 0x20, 0x6e, 0x6f, 0x64, 0x65, 0x69, 0x64, 0x0a,
0x3c, 0x2f, 0x68, 0x31, 0x3e, 0x0a, 0x3c, 0x61, 0x20, 0x6f,
0x6e, 0x63, 0x6c, 0x69, 0x63, 0x6b, 0x3d, 0x22, 0x6c, 0x6f,
0x61, 0x64, 0x44, 0x61, 0x74, 0x61, 0x28, 0x29, 0x3b, 0x22,
0x20, 0x68, 0x72, 0x65, 0x66, 0x3d, 0x22, 0x23, 0x22, 0x3e,
0x52, 0x65, 0x6c, 0x6f, 0x61, 0x64, 0x3c, 0x2f, 0x61, 0x3e,
0x0a, 0x3c, 0x73, 0x70, 0x61, 0x6e, 0x20, 0x69, 0x64, 0x3d,
0x22, 0x73, 0x70, 0x69, 0x6e, 0x22, 0x3e, 0x20, 0x3c, 0x2f,
0x73, 0x70, 0x61, 0x6e, 0x3e, 0x0a, 0x3c, 0x68, 0x32, 0x3e,
0x45, 0x6e, 0x76, 0x69, 0x72, 0x6f, 0x6e, 0x6d, 0x65, 0x6e,
0x74, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0x0a, 0x3c, 0x64, 0x69,
0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x74, 0x65, 0x6d, 0x70,
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x68, 0x75,
0x6d, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x68, 0x32, 0x3e, 0x4c, 0x69, 0x67, 0x68, 0x74, 0x3c,
0x2f, 0x68, 0x32, 0x3e, 0x0a, 0x3c, 0x64, 0x69, 0x76, 0x20,
0x69, 0x64, 0x3d, 0x22, 0x6c, 0x31, 0x22, 0x3e, 0x3c, 0x2f,
0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c, 0x64, 0x69, 0x76, 0x20,
0x69, 0x64, 0x3d, 0x22, 0x6c, 0x32, 0x22, 0x3e, 0x3c, 0x2f,
0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c, 0x68, 0x32, 0x3e, 0x50,
0x6f, 0x77, 0x65, 0x72, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0x0a,
0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70,
0x63, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70,
0x6c, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70,
0x72, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70,
0x74, 0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a,
0x3c, 0x62, 0x72, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x69, 0x22,
0x3e, 0x30, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x25,
0x21, 0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72,
0x2e, 0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x0a, 0x0a, 0x00};
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70, 0x63,
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70, 0x6c,
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70, 0x72,
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x64, 0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x70, 0x74,
0x22, 0x3e, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x3c,
0x62, 0x72, 0x3e, 0x3c, 0x62, 0x72, 0x3e, 0x0a, 0x3c, 0x64,
0x69, 0x76, 0x20, 0x69, 0x64, 0x3d, 0x22, 0x69, 0x22, 0x3e,
0x30, 0x3c, 0x2f, 0x64, 0x69, 0x76, 0x3e, 0x0a, 0x25, 0x21,
0x3a, 0x20, 0x2f, 0x66, 0x6f, 0x6f, 0x74, 0x65, 0x72, 0x2e,
0x68, 0x74, 0x6d, 0x6c, 0x0a, 0x00};
const char data_footer_html[39] = {
/* /footer.html */
@ -455,4 +451,4 @@ const struct httpd_fsdata_file file_index_html[] ={{ file_header_html, d
#define HTTPD_FS_ROOT file_index_html
#define HTTPD_FS_NUMFILES 8
#define HTTPD_FS_SIZE 4050
#define HTTPD_FS_SIZE 4007

View file

@ -1,11 +1,11 @@
/* This is the uncompressed version of the script in httpd-fs/sensordata.shtml */
var start;
var start, d = document;
i = new Image(50,60)
i.src = "spin.gif"
i = new Image(50,60);
i.src = "spin.gif";
function load() {
var img = document.getElementById("spin");
var img = d.getElementById("spin");
img.innerHTML = '&nbsp;';
loadData();
}
@ -25,27 +25,27 @@ function loadData() {
}
r.onreadystatechange = function() {
if(r.readyState == 1) {
var img = document.getElementById("spin");
var img = d.getElementById("spin");
img.innerHTML = '<img src="spin.gif">';
}
if(r.readyState == 4) {
var img = document.getElementById("spin");
var img = d.getElementById("spin");
img.innerHTML = 'took ' +
((new Date()).getTime() - start.getTime()) / 1000 +
' seconds';
eval(r.responseText);
}
}
};
start = new Date();
r.open("GET", "/sensordata.shtml", true);
r.send(null);
}
function e(el) {
d = document;
if(d.getElementById) {
return d.getElementById(el);
} else if (d.all) {
}
if (d.all) {
return d.all[el];
}
}

View file

@ -48,6 +48,7 @@
#include "lib/random.h"
#include "net/netstack.h"
#include "net/mac/frame802154.h"
#include "lib/include/uart1.h"
#if WITH_UIP6
#include "net/sicslowpan.h"
@ -490,7 +491,6 @@ main(void)
cop_service();
#endif
/* TODO: replace this with a uart rx interrupt */
if(uart1_input_handler != NULL) {
if(uart1_can_get()) {
uart1_input_handler(uart1_getc());

View file

@ -36,8 +36,7 @@
TARGET_LIBFILES = /lib/w32api/libws2_32.a /lib/w32api/libiphlpapi.a
CONTIKI_TARGET_DIRS = . cfs ctk loader
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32-dir.c \
ctk-console.c
CONTIKI_TARGET_SOURCEFILES = contiki-main.c clock.c cfs-win32-dir.c ctk-console.c
CONTIKI_SOURCEFILES += $(CTK) cfs-posix.c ctk-conio.c wpcap.c wpcap-drv.c \
$(CONTIKI_TARGET_SOURCEFILES)
@ -88,6 +87,7 @@ VCFLAGS = -Od -Z7 $(filter-out -Wall -g -O,$(CFLAGS))
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c
cl -nologo $(VCFLAGS) -c $< -Fo$@
@makedepend $(CFLAGS) -o.o -f- $< 2> nul: | sed -e s!$(<:.c=.o)!$@! -e s!\\!/!g > $(@:.o=.d)
CUSTOM_RULE_C_TO_CO = 1
%.co: %.c

View file

@ -21,10 +21,6 @@ extend two makefiles are necessary:
- Makefile plays the role of a Contiki 2.x project Makefile
- Makefile.win32 is an ordinary (yet complex) Contiki 2.x Makefile.$(TARGET)
As an alternative to building with Cygwin, gcc and the Contiki 2.x build system
it is also possible to use Microsoft Visual Studio 2008 (including the Express
Edition) by loading platform/win32/contiki.sln.
As platform/win32/Makefile.win32 includes cpu/native/Makefile.native the WinPcap
library is used for network I/O. Please consult cpu/native/net/README-WPCAP for
further details.

18
platform/win32/README-VC Normal file
View file

@ -0,0 +1,18 @@
The 'win32' target allows projects to be built using two different toolchains:
1. GCC / Cygwin
Start your build from a Cygwin Shell and set TARGET=win32 to use this toolchain.
The result will be similiar to the 'minimal-net' target. The advantage of 'win32'
over 'minimal-net' is the support for GUI applications using the Contiki Toolkit
(CTK). For this reason several projects in the /examples directory are built in
the target 'win32' by default.
2. VC++ / GnuWin
Start your build from a VC++ Command Prompt and set TARGET=win32 to use this
toolchain. You need however a few addional tools in your PATH:
- cp.exe / rm.exe (http://gnuwin32.sourceforge.net/packages/coreutils.htm)
- make.exe (http://gnuwin32.sourceforge.net/packages/make.htm)
- sed.exe (http://gnuwin32.sourceforge.net/packages/sed.htm)
- makedepend.exe (http://llg.cubic.org/docs/vc7.html)

View file

@ -153,7 +153,9 @@ typedef unsigned short uip_stats_t;
#define SHELL_GUI_CONF_YSIZE 30
#ifdef PLATFORM_BUILD
#define TELNETD_CONF_GUI 1
#endif /* PLATFORM_BUILD */
#ifdef PLATFORM_BUILD

View file

@ -60,7 +60,7 @@ const char *netmask;
int slipfd = 0;
uint16_t basedelay=0,delaymsec=0;
uint32_t startsec,startmsec,delaystartsec,delaystartmsec;
int timestamp = 0;
int timestamp = 0, flowcontrol=0;
int ssystem(const char *fmt, ...)
__attribute__((__format__ (__printf__, 1, 2)));
@ -172,7 +172,7 @@ serial_to_tun(FILE *inslip, int outfd)
if(inbufptr >= sizeof(uip.inbuf)) {
inbufptr = 0;
if(timestamp) stamptime();
fprintf(stderr, "*** dropping too large packet\n");
fprintf(stderr, "*** dropping large %d byte packet\n",inbufptr);
}
ret = fread(&c, 1, 1, inslip);
#ifdef linux
@ -459,7 +459,10 @@ stty_telos(int fd)
/* Nonblocking read. */
tty.c_cc[VTIME] = 0;
tty.c_cc[VMIN] = 0;
tty.c_cflag &= ~CRTSCTS;
if (flowcontrol)
tty.c_cflag |= CRTSCTS;
else
tty.c_cflag &= ~CRTSCTS;
tty.c_cflag &= ~HUPCL;
tty.c_cflag &= ~CLOCAL;
@ -616,12 +619,16 @@ main(int argc, char **argv)
prog = argv[0];
setvbuf(stdout, NULL, _IOLBF, 0); /* Line buffered output. */
while((c = getopt(argc, argv, "B:D:Lhs:t:v::d::a:p:T")) != -1) {
while((c = getopt(argc, argv, "B:H:D:Lhs:t:v::d::a:p:T")) != -1) {
switch(c) {
case 'B':
baudrate = atoi(optarg);
break;
case 'H':
flowcontrol=1;
break;
case 'L':
timestamp=1;
break;
@ -671,6 +678,7 @@ fprintf(stderr,"usage: %s [options] ipaddress\n", prog);
fprintf(stderr,"example: tunslip6 -L -v2 -s ttyUSB1 aaaa::1/64\n");
fprintf(stderr,"Options are:\n");
fprintf(stderr," -B baudrate 9600,19200,38400,57600,115200 (default)\n");
fprintf(stderr," -H Hardware CTS/RTS flow control (default disabled)\n");
fprintf(stderr," -L Log output format (adds time stamps)\n");
fprintf(stderr," -s siodev Serial device (default /dev/ttyUSB0)\n");
fprintf(stderr," -T Make tap interface (default is tun interface)\n");
@ -696,7 +704,7 @@ exit(1);
argv += (optind - 1);
if(argc != 2 && argc != 3) {
err(1, "usage: %s [-B baudrate] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog);
err(1, "usage: %s [-B baudrate] [-H] [-L] [-s siodev] [-t tundev] [-T] [-v verbosity] [-d delay] [-a serveraddress] [-p serverport] ipaddress", prog);
}
ipaddr = argv[1];