Make PERIOD and SERVER_REPLY configurable
This commit is contained in:
parent
912ea85199
commit
1c53807727
3 changed files with 13 additions and 1 deletions
|
@ -6,4 +6,11 @@ WITH_UIP6=1
|
|||
UIP_CONF_IPV6=1
|
||||
CFLAGS+= -DUIP_CONF_IPV6_RPL
|
||||
|
||||
ifdef SERVER_REPLY
|
||||
CFLAGS+=-DSERVER_REPLY=$(SERVER_REPLY)
|
||||
endif
|
||||
ifdef PERIOD
|
||||
CFLAGS+=-DPERIOD=$(PERIOD)
|
||||
endif
|
||||
|
||||
include $(CONTIKI)/Makefile.include
|
||||
|
|
|
@ -46,8 +46,12 @@
|
|||
#define DEBUG DEBUG_PRINT
|
||||
#include "net/uip-debug.h"
|
||||
|
||||
#ifndef PERIOD
|
||||
#define PERIOD 60
|
||||
#endif
|
||||
|
||||
#define START_INTERVAL (15 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (60 * CLOCK_SECOND)
|
||||
#define SEND_INTERVAL (PERIOD * CLOCK_SECOND)
|
||||
#define SEND_TIME (random_rand() % (SEND_INTERVAL))
|
||||
#define MAX_PAYLOAD_LEN 30
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@ tcpip_handler(void)
|
|||
UIP_IP_BUF->srcipaddr.u8[sizeof(UIP_IP_BUF->srcipaddr.u8) - 1]);
|
||||
PRINTF("\n");
|
||||
#if SERVER_REPLY
|
||||
PRINTF("DATA sending reply\n");
|
||||
uip_ipaddr_copy(&server_conn->ripaddr, &UIP_IP_BUF->srcipaddr);
|
||||
uip_udp_packet_send(server_conn, "Reply", sizeof("Reply"));
|
||||
uip_create_unspecified(&server_conn->ripaddr);
|
||||
|
|
Loading…
Reference in a new issue