61 lines
1.1 KiB
C
61 lines
1.1 KiB
C
#include <ncurses.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#include <fcntl.h>
|
|
#include <errno.h>
|
|
#include <termios.h>
|
|
#include <string.h>
|
|
|
|
#include "users.h"
|
|
#include "tui.h"
|
|
#include "rfid_handler.h"
|
|
#include "file_operations.h"
|
|
|
|
int main(int argc, char const **argv)
|
|
{
|
|
if (argc != 2)
|
|
{
|
|
printf("filename argument required\nUsage: %s [User database]\n", argv[0]);
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
int y_max, x_max;
|
|
char uart_address[51];
|
|
pthread_t uart_thread;
|
|
|
|
initscr();
|
|
|
|
getmaxyx(stdscr, y_max, x_max);
|
|
if (x_max <= MIN_X_TERMINAL_SIZE || y_max <= MIN_Y_TERMINAL_SIZE)
|
|
{
|
|
endwin();
|
|
clear();
|
|
puts("Terminal is too small. Exiting...\n");
|
|
return EXIT_FAILURE;
|
|
}
|
|
|
|
noecho();
|
|
noraw();
|
|
cbreak();
|
|
start_color();
|
|
curs_set(0);
|
|
|
|
assume_default_colors(COLOR_WHITE, COLOR_BLUE);
|
|
erase();
|
|
refresh();
|
|
|
|
uartDialog(uart_address, x_max, y_max);
|
|
|
|
pthread_create(&uart_thread, NULL, uartListener, uart_address);
|
|
|
|
//
|
|
|
|
pthread_join(uart_thread, NULL);
|
|
|
|
clear();
|
|
endwin();
|
|
return EXIT_SUCCESS;
|
|
}
|