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