nes-proj/project/common/supermarket_net.h

83 lines
1.2 KiB
C
Raw Normal View History

2019-04-11 15:46:54 +00:00
#ifndef SUPERMARKET_NET_H
#define SUPERMARKET_NET_H
2019-04-12 14:30:01 +00:00
enum message_type {
2019-04-11 15:46:54 +00:00
ASSOCIATION_REQUEST_MSG,
ASSOCIATION_REPLY_MSG,
BATTERY_STATUS_MSG,
ASSIGNMENT_MSG,
2019-04-12 14:30:01 +00:00
CASH_OUT_MSG,
2019-04-11 15:46:54 +00:00
PRODUCT_MSG,
2019-04-12 14:30:01 +00:00
ITEM_ELEM_MSG,
BASKET_MSG,
2019-04-12 14:44:25 +00:00
START_OF_LIST_PRODUCTS_MSG
2019-04-11 15:46:54 +00:00
};
2019-04-12 14:30:01 +00:00
typedef struct msg {
enum message_type msg_type;
}msg;
2019-04-12 14:30:05 +00:00
2019-04-12 14:44:25 +00:00
typedef struct assoc_req_msg
2019-04-12 14:30:01 +00:00
{
enum message_type msg_type;
uint8_t battery_percentage;
2019-04-12 14:30:05 +00:00
2019-04-12 14:30:01 +00:00
}assoc_req_msg;
2019-04-12 14:30:05 +00:00
2019-04-12 14:30:01 +00:00
typedef struct assoc_reply_msg
{
enum message_type msg_type;
}assoc_reply_msg;
2019-04-12 14:30:05 +00:00
2019-04-12 14:30:01 +00:00
typedef struct battery_msg
{
enum message_type msg_type;
uint8_t battery_percentage;
}battery_msg;
typedef struct assign_msg
{
enum message_type msg_type;
uint32_t customer_id;
2019-04-12 14:44:25 +00:00
}assign_msg;
2019-04-12 14:30:01 +00:00
typedef struct basket_msg
2019-04-12 14:44:25 +00:00
{
2019-04-12 14:30:01 +00:00
enum message_type msg_type;
uint8_t n_products;
uint8_t customer_id;
}basket_msg;
typedef struct cash_out_msg
{
enum message_type msg_type;
uint8_t customer_id;
}cash_out_msg;
typedef struct product_msg
{
2019-04-12 14:44:25 +00:00
enum message_type msg_type;
2019-04-12 14:30:01 +00:00
uint8_t customer_id;
uint8_t product_id;
float prize;
}product_msg;
typedef struct user_invoice
{
uint8_t n_prods;
float total_sum;
uint8_t customer_id;
uint8_t empty;
2019-04-12 14:44:25 +00:00
2019-04-12 14:30:01 +00:00
}user_invoice;
2019-04-11 15:46:54 +00:00
#endif