rk3399_arm_lvds/service/main.cpp

66 lines
1.5 KiB
C++
Raw Permalink Normal View History

2024-03-05 03:46:18 +00:00
#include <iostream>
#include <memory>
#include "scanner.h"
#include "scannerregs.h"
#include "usbservice.h"
#include "motorboard.h"
#include "Capturer.h"
using namespace std;
int menu() {
int choice;
cout << " **** Menu **** " << endl << endl;
cout << "(2) stop. " << endl;
cout << "(5) regs list. " << endl;
cout << "(6) scan num. " << endl;
cout << "(7) scan auto" << endl;
cout << "(0) Quit. " << endl << endl;
cout << ": ";
cin >> choice;
return choice;
}
int main()
{
bool exit = false;
std::shared_ptr<MotorBoard> motorboard(new MotorBoard(nullptr));
std::shared_ptr<ICapturer> capturer(new Capturer());
std::shared_ptr<Scanner> scanner(new Scanner(capturer, motorboard,nullptr));
std::shared_ptr<IRegsAccess> scannerRegs(new ScannerRegAccess(scanner));
std::shared_ptr<UsbService> usbservie(new UsbService(capturer->regs(), motorboard->regs(), scannerRegs));
int option;
for (;;)
{
option = menu();
switch (option)
{
case 0:
exit = true;
break;
case 2:
scanner->stop_scan();
break;
case 5:
{
scanner->start_scan();
}
break;
break;
case 100:
{
}
break;
default:
cout << "Please select again! " << endl;
break;
}
/* code */
if (exit)
break;
}
cout << "exit munu" << endl;
return 0;
}