Merge branch 'master' of git.giomba.it:giomba/nes-proj

This commit is contained in:
Daniela 2019-04-16 15:54:04 +02:00
commit 91a93b6d6a
2 changed files with 6 additions and 5 deletions

View File

@ -19,7 +19,7 @@
typedef struct user_invoice typedef struct user_invoice
{ {
uint8_t n_prods; uint8_t n_prods;
float total_sum; uint32_t total_sum;
uint32_t customer_id; uint32_t customer_id;
uint8_t empty; uint8_t empty;
linkaddr_t address_basket; linkaddr_t address_basket;
@ -93,7 +93,7 @@ static void input_callback(const void* data, uint16_t len, const linkaddr_t* sou
} }
if (received_msg.msg_type == PRODUCT_MSG) { if (received_msg.msg_type == PRODUCT_MSG) {
product_msg *product = (product_msg*)(&received_msg); product_msg *product = (product_msg*)(&received_msg);
printf("Received id: %d, price %f\n", (int)product->product_id, product->price); printf("Received id: %d, price %f\n", (int)product->product_id, (int)product->price);
uint8_t index = invoice_index(product->customer_id, invoices); uint8_t index = invoice_index(product->customer_id, invoices);
if (index != -1) { if (index != -1) {
if (invoices[index].n_prods > 0) { if (invoices[index].n_prods > 0) {
@ -123,9 +123,10 @@ PROCESS_THREAD(cassa_main_process, ev, data) {
nullnet_set_input_callback(input_callback); //this should be moved down? nullnet_set_input_callback(input_callback); //this should be moved down?
printf("Dear customer, insert your card id\n");
while (true) { while (true) {
printf("Dear customer, insert your card id\n");
PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message); PROCESS_WAIT_EVENT_UNTIL(ev == serial_line_event_message);
printf("Customer's id: %s\n", (char*)data); printf("Customer's id: %s\n", (char*)data);

View File

@ -72,7 +72,7 @@ typedef struct product_msg
enum message_type msg_type; enum message_type msg_type;
uint32_t customer_id; uint32_t customer_id;
uint32_t product_id; uint32_t product_id;
float price; uint32_t price;
}product_msg; }product_msg;