Example #1
0
def get_terminals(terminal: Terminal):
    command = Functions.make_command(Constants.GET_TERMINALS_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)
Example #2
0
def get_workers(terminal: Terminal):
    command = Functions.make_command(Constants.GET_WORKERS_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)
Example #3
0
def get_cards(terminal: Terminal):
    command = Functions.make_command(Constants.GET_CARDS_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)
Example #4
0
def delete_terminal(terminal: Terminal, terminal_id):
    command = Functions.make_command(Constants.DELETE_TERMINAL_COMMAND,
                                     terminal.terminal_id, [terminal_id])
    terminal.communicate_with_server(command)
Example #5
0
def delete_worker(terminal: Terminal, worker_id):
    command = Functions.make_command(Constants.DELETE_WORKER_COMMAND,
                                     terminal.terminal_id, [worker_id])
    terminal.communicate_with_server(command)
Example #6
0
def delete_card(terminal: Terminal, card_rfid):
    command = Functions.make_command(Constants.DELETE_CARD_COMMAND,
                                     terminal.terminal_id, [card_rfid])
    terminal.communicate_with_server(command)
Example #7
0
def unassign(terminal: Terminal, card_rfid):
    command = Functions.make_command(Constants.UNASSIGN_COMMAND,
                                     terminal.terminal_id, [card_rfid])
    terminal.communicate_with_server(command)
Example #8
0
def add_worker(terminal: Terminal, worker_id, surname, name):
    command = Functions.make_command(Constants.ADD_WORKER_COMMAND,
                                     terminal.terminal_id,
                                     [worker_id, surname, name])
    terminal.communicate_with_server(command)
Example #9
0
def shutdown(terminal: Terminal):
    command = Functions.make_command(Constants.SHUTDOWN_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)
Example #10
0
def get_cards(terminal: Terminal):
    command = Functions.make_command(Constants.GET_CARDS_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)


def get_terminals(terminal: Terminal):
    command = Functions.make_command(Constants.GET_TERMINALS_COMMAND,
                                     terminal.terminal_id)
    terminal.communicate_with_server(command)


if __name__ == "__main__":
    shutdown_flag = False
    terminal = Terminal()
    terminal.connect_with_server()
    while not shutdown_flag:
        option_number = input(
            "Choose an option number (type 'help' for available commands): ")
        if option_number == 'help':
            print("Available commands:"
                  "\n0 - Close terminal"
                  "\n1 - Shutdown server"
                  "\n2 - Read card"
                  "\n3 - Add terminal"
                  "\n4 - Add worker"
                  "\n5 - Assign card to worker"
                  "\n6 - Unassign card"
                  "\n7 - Delete card"
                  "\n8 - Delete terminal"