Microchip® Advanced Software Framework

network-reboot.c File Reference
#include "contiki-net.h"
#include "net/ip/simple-udp.h"
#include "network-reboot.h"
#include "dev/leds.h"
#include "dev/watchdog.h"
#include <string.h>
#include <stdio.h>

Data Structures

struct  network_reboot_msg
 

Macros

#define SEND_INTERVAL   (20 * CLOCK_SECOND)
 
#define SEND_TIME   (random_rand() % (SEND_INTERVAL))
 
#define STARTUP_GRACE_PERIOD   (120 * CLOCK_SECOND)
 
#define UDP_PORT   31337
 

Functions

void network_reboot_init (void)
 
void network_reboot_reboot (int seconds)
 
 PROCESS (network_reboot_process,"network_reboot process")
 
 PROCESS_THREAD (network_reboot_process, ev, data)
 
static void receiver (struct simple_udp_connection *c, const uip_ipaddr_t *sender_addr, uint16_t sender_port, const uip_ipaddr_t *receiver_addr, uint16_t receiver_port, const uint8_t *data, uint16_t datalen)
 
static void send_msg (struct simple_udp_connection *conn, int seconds)
 

Variables

static struct simple_udp_connection broadcast_connection
 
static const char magic_bytes [6] = "Reboot"
 
static int seconds_until_reboot
 

#define SEND_INTERVAL   (20 * CLOCK_SECOND)

Referenced by PROCESS_THREAD().

#define SEND_TIME   (random_rand() % (SEND_INTERVAL))

Referenced by PROCESS_THREAD().

#define STARTUP_GRACE_PERIOD   (120 * CLOCK_SECOND)

Referenced by PROCESS_THREAD().

#define UDP_PORT   31337

Referenced by PROCESS_THREAD().

void network_reboot_init ( void  )
void network_reboot_reboot ( int  seconds)
PROCESS ( network_reboot_process  ,
"network_reboot process  
)
static void receiver ( struct simple_udp_connection c,
const uip_ipaddr_t sender_addr,
uint16_t  sender_port,
const uip_ipaddr_t receiver_addr,
uint16_t  receiver_port,
const uint8_t *  data,
uint16_t  datalen 
)
static

struct simple_udp_connection broadcast_connection
static
const char magic_bytes[6] = "Reboot"
static

Referenced by receiver(), and send_msg().

int seconds_until_reboot
static