2019-04-12 13:14:52 +00:00
|
|
|
#include "contiki.h"
|
|
|
|
#include "net/netstack.h"
|
|
|
|
#include "net/nullnet/nullnet.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "sys/log.h"
|
2019-04-14 16:24:52 +00:00
|
|
|
|
2019-04-16 13:51:46 +00:00
|
|
|
#define LOG_MODULE "Assigner"
|
|
|
|
#define LOG_LEVEL LOG_LEVEL_INFO
|
2019-04-12 13:14:52 +00:00
|
|
|
|
|
|
|
typedef struct cart
|
|
|
|
{
|
2019-04-14 16:24:52 +00:00
|
|
|
linkaddr_t cart_address;
|
2019-04-12 13:14:52 +00:00
|
|
|
uint8_t battery_status;
|
|
|
|
bool assigned;
|
|
|
|
uint32_t customer_id;
|
|
|
|
struct cart *next;
|
|
|
|
}cart;
|
|
|
|
|
2019-04-14 16:24:52 +00:00
|
|
|
extern bool supermarket_open;
|
|
|
|
extern cart* cart_list;
|
|
|
|
extern struct process assigner_process;
|
|
|
|
|
2019-04-12 13:14:52 +00:00
|
|
|
cart* cart_selection();
|
2019-04-14 16:24:52 +00:00
|
|
|
bool insert_cart(uint8_t new_req_battery, linkaddr_t mac_cart_addr);
|
|
|
|
bool bat_update(linkaddr_t src_cart_addr, uint8_t battery_level);
|
|
|
|
void handle_association_request(linkaddr_t src, const void* data);
|
|
|
|
void handle_battery_msg(linkaddr_t src, const void* data);
|
|
|
|
void check(void *ptr);
|