-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
46 lines (34 loc) · 1.46 KB
/
Copy pathmain.cpp
File metadata and controls
46 lines (34 loc) · 1.46 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
#include "CameraSelector.hpp"
#include <iostream>
// #include <chrono>
// #include <thread>
int main()
{
// const int numCycles = 3;
// for (int i = 0; i < numCycles * 4; i++) {
// CameraState nextCamera = cameraStateMachine.getNextAvailableCamera();
// cameraStateMachine.setState(nextCamera, true);
// cameraStateMachine.updateCameraAvailability(nextCamera, false);
// std::cout << "Current state: " << cameraStateMachine.cameraStateToString(cameraStateMachine.getState()) << std::endl;
// std::cout << "Is participating: " << cameraStateMachine.getIsParticipating(nextCamera) << std::endl;
// std::this_thread::sleep_for(std::chrono::milliseconds(30));
// }
// take bool input either 0-inactive, 1-active
bool frontState, rightState, rearState, leftState, startState;
std::cout << "Enter State of Front Camera(0-inactive, 1-active):\n";
std::cin >> frontState;
std::cout << "Enter State of Right Camera(0-inactive, 1-active):\n";
std::cin >> rightState;
std::cout << "Enter State of Rear Camera(0-inactive, 1-active):\n";
std::cin >> rearState;
std::cout << "Enter State of Left Camera(0-inactive, 1-active):\n";
std::cin >> leftState;
StateMachine cameraStateMachine(frontState, rightState, rearState, leftState);
while (true)
{
cameraStateMachine.run();
}
return 0;
}
// To run this type below command
// g++ -o main.exe main.cpp CameraSelector.cpp