nes-proj/project/Giomba/cart.c

64 lines
1.3 KiB
C

#include <stdio.h>
#include <string.h>
#include "os/dev/leds.h"
#include "batmon-sensor.h"
#include "../common/supermarket_net.h"
#include "event.h"
#include "log.h"
#include "sendrecv.h"
#include "status.h"
//static linkaddr_t destination_address = {{ 0x00, 0x12, 0x4b, 0x00, 0x0f, 0x8f, 0x18, 0x11 }};
PROCESS(cart_main_process, "Cart Process");
AUTOSTART_PROCESSES(&cart_main_process);
PROCESS_THREAD(cart_main_process, ev, data) {
PROCESS_BEGIN();
// SENSORS_ACTIVATE(batmon_sensor);
/*** Variables initialization ***/
status = NOT_ASSOCIATED;
etimer_set(&broadcast_timer, 10 * CLOCK_SECOND);
/*** Subsystem initialization ***/
net_init();
/* START */
printf("Hello! I'm the cart.\n");
while (true) {
PROCESS_WAIT_EVENT();
switch(status) {
case NOT_ASSOCIATED:
s_not_associated(ev, data);
break;
break;
case ASSOCIATED: break;
case SHOPPING: break;
case CASHOUT: break;
default: status = NOT_ASSOCIATED; break;
}
/*
if (ev == PROCESS_EVENT_TIMER) {
printf("Transmitting %d...\n", counter);
sprintf(message, "#%d Hello. It's me. -- by Adele", counter);
nullnet_len = strlen(message) + 1;
counter++;
NETSTACK_NETWORK.output(&destination_address);
etimer_reset(&my_timer);
}
*/
}
PROCESS_END();
}