def handle_card_scan(dev, mac_address, card_id): table_id = api.get_table_id(mac_address) customer_id = api.get_customer_id(card_id) table_available = api.table_available(table_id, customer_id) if customer_id and table_available: # If the table already has an occupancy, update it to set as occupied # if not create a new one occupancy = api.get_occupancy(table_id) if occupancy: api.set_occupied(table_id, occupancy) else: api.create_new_occupancy(table_id, customer_id) response = b"access1\x00" if table_available and customer_id\ else b"access0\x00" dev.char_write(0x0012, bytearray(response))
def request_bill(dev, mac_address): table_id = api.get_table_id(mac_address) api.request_bill(table_id) dev.char_write(0x0012, bytearray(b"ok\x00"))
def leave_table(dev, mac_address): table_id = api.get_table_id(mac_address) api.leave_table(table_id) dev.char_write(0x0012, bytearray(b"ok\x00"))
def get_order_status(dev, mac_address): table_id = api.get_table_id(mac_address) order_status = api.get_order_status(table_id) dev.char_write(0x0012, bytearray(order_status.encode("utf-8") + "\x00"))
def call_waiter(dev, mac_address): table_id = api.get_table_id(mac_address) api.call_waiter(table_id) dev.char_write(0x0012, bytearray(b"ok\x00"))