38 lines
994 B
C
38 lines
994 B
C
#include <ncurses.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
|
|
void uartDialog(int terminal_x, int terminal_y)
|
|
{
|
|
char *prompt = "Please enter UART device address for RFID reader (probably /dev/ttyUSB0): ";
|
|
char *header = "Enter UART Address";
|
|
|
|
int win_height = 15;
|
|
int win_width = 80;
|
|
int start_y = (terminal_y - win_height) / 2;
|
|
int start_x = (terminal_x - win_width) / 2;
|
|
|
|
start_color();
|
|
init_pair(1, COLOR_BLACK, COLOR_WHITE);
|
|
|
|
WINDOW *uartwin = newwin(win_height, win_width, start_y, start_x);
|
|
|
|
wbkgd(uartwin, COLOR_PAIR(1));
|
|
|
|
box(uartwin, 0, 0);
|
|
wattron(uartwin, COLOR_PAIR(1));
|
|
mvwprintw(uartwin, 0, (win_width - strlen(header)) / 2, "%s", header);
|
|
mvwprintw(uartwin, 3, (win_width - strlen(prompt)) / 2, "%s", prompt);
|
|
wattroff(uartwin, COLOR_PAIR(1));
|
|
wrefresh(uartwin);
|
|
|
|
getch();
|
|
|
|
wclear(uartwin);
|
|
wrefresh(uartwin);
|
|
touchwin(stdscr);
|
|
refresh();
|
|
delwin(uartwin);
|
|
refresh();
|
|
} |