Repository navigation
Expand file tree
/
Copy pathadminmenu.c
More file actions
70 lines (61 loc) · 1.69 KB
/
Copy pathadminmenu.c
File metadata and controls
70 lines (61 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <stdio.h>
#include <stdbool.h>
#include "safeinput.h"
#include "card.h"
#include "cardlist.h"
#include "cardaccess.h"
#include "adminmenu.h"
#include "addcard.h"
#include "remotedoor.h"
#include "listcard.h"
#include "scancard.h"
void adminMenu(CARDLIST *cardList) {
bool isRunning = true;
while(isRunning){
printf("\n\t--- ADMIN MENU ---\n");
printf("\n1. Remote Door Access.\n");
printf("2. List All Cards In System\n");
printf("3. Add New Card\n");
printf("4. Add/Remove Card Access\n");
printf("5. Scan Card\n");
printf("6. Exit\n");
int select = 0;
GetInputInt("Choose: ", &select);
switch(select){
case 1:
// Simulating opening a locked door.
printf("\n\t--- REMOTE DOOR ACCESS ---\n");
remoteDoor();
break;
case 2:
// List all the registered cards. 2 cards are added by default.
printf("\n\t--- LIST CARDS IN SYSTEM ---\n");
listCard(cardList);
break;
case 3:
// Let the user add a new card.
printf("\n\t--- ADD NEW CARD ---\n");
addCard(cardList);
break;
case 4:
// Let the user modify specific card access.
printf("\n\t--- ADD/REMOVE CARD ACCESS ---\n");
cardAccess(cardList);
break;
case 5:
// Use cardID from the register to simulate a doorscanner.
printf("\n\t--- SCAN CARD ---\n");
scanCard(cardList);
break;
case 6:
// Exit the program.
printf("\nProgram closing...\n");
isRunning = false;
break;
default:
// In case of input failure.
printf("\nERROR: Wrong entry. Please try again.\n");
break;
}
}
}