[cart] good version + debug for Natalia
This commit is contained in:
parent
f6e5c137a0
commit
0caca5fb4d
@ -21,7 +21,7 @@ PROCESS_THREAD(cart_main_process, ev, data) {
|
||||
|
||||
/*** Variables initialization ***/
|
||||
// status = NOT_ASSOCIATED; // TODO DEBUG
|
||||
status = NOT_ASSOCIATED;
|
||||
status = SHOPPING; // NOT_ASSOCIATED;
|
||||
etimer_set(&broadcast_timer, 5 * CLOCK_SECOND);
|
||||
|
||||
/*** Subsystem initialization ***/
|
||||
|
@ -48,7 +48,7 @@ void net_recv(const void* data, uint16_t len, const linkaddr_t* src, const linka
|
||||
process_post(&cart_main_process, PROCESS_EVENT_MSG, NULL);
|
||||
break;
|
||||
default:
|
||||
LOG_INFO("[W] message type unknown\n");
|
||||
LOG_INFO("[W] message type %d unknown\n", ((msg*)data)->msg_type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ void s_shopping(process_event_t ev, process_data_t data) {
|
||||
if (nprod < MAX_PRODUCT) {
|
||||
item_msg* m = (item_msg*)pkt.data;
|
||||
memcpy(&list[nprod], &m->p, sizeof(product_t));
|
||||
printf("[I] Adding item #%d, id %d, price %f to cart\n", nprod, (int)list[nprod].product_id, list[nprod].price);
|
||||
printf("[I] Adding item #%d, id %d, price %d to cart\n", nprod, (int)list[nprod].product_id, (int)list[nprod].price);
|
||||
nprod++;
|
||||
} else {
|
||||
printf("[W] Too many products. Dropping.\n");
|
||||
@ -93,7 +93,7 @@ void s_cash_out_wait4ack(process_event_t ev, process_data_t data) {
|
||||
void s_cash_out_send_list(process_event_t ev, process_data_t data) {
|
||||
/* Send list, then go back to initial state */
|
||||
for (uint8_t i = 0; i < nprod; ++i) {
|
||||
printf("[I] Sending product %d of %d: id %d, price: %f\n", i, nprod - 1, (int)list[i].product_id, list[i].price);
|
||||
printf("[I] Sending product %d of %d: id %d, price: %d\n", i, nprod - 1, (int)list[i].product_id, (int)list[i].price);
|
||||
product_msg m;
|
||||
m.msg_type = PRODUCT_MSG;
|
||||
m.customer_id = customer_id;
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
/* Hardcoded MAC Address for cart */
|
||||
/* This is used only to emulate the RFID tag */
|
||||
static linkaddr_t dest_addr = {{0x00, 0x12, 0x4b, 0x00, 0x0f, 0x24, 0x18, 0x04}};
|
||||
static linkaddr_t dest_addr = {{0x00, 0x12, 0x4b, 0x00, 0x0f, 0x82, 0x18, 0x04}};
|
||||
|
||||
product_t product_list[] = {
|
||||
{ 1, "21/12/19", 105 },
|
||||
|
Loading…
Reference in New Issue
Block a user