#include #include #include #include #include #include "filetools.h" #include "stringex.hpp" #include #include "usbservice.h" #include "Capturer.h" #include "motorboard.h" #include "itransmit.h" #include "scannerregs.h" #include "scanner.h" #include "inotify.h" #include "memoryex.h" #include "usbimageprocqueue.h" #include "imageusbtesthandler.h" #include "applog.h" #include "jsonconfig.h" using namespace std; volatile int done_scan = 0; int menu() { int choice; cout << " **** Menu **** " << endl << endl; cout << "(1) notify." << endl; cout << "(2) clear notify. " << endl; cout << "(3/4) autocorrect " << endl; cout << "(5) color mode change test " << endl; cout << "(0) Quit. " << endl << endl; cout << ": "; cin >> choice; return choice; } int main() { auto cap = std::shared_ptr(new Capturer()); auto mt = std::shared_ptr(new MotorBoard(nullptr)); auto scanner = std::shared_ptr(new Scanner(cap, mt,nullptr)); UsbService us(cap->regs(), mt->regs()); auto notify = us.notify(); std::shared_ptr usbImage(new UsbImageProcQueue(notify)); auto transfer = us.transmiter(); std::shared_ptr regs = std::shared_ptr(new ScannerRegAccess(scanner, usbImage, transfer)); scanner->set_imagehandler(std::shared_ptr(new ImageUsbHandler(usbImage))); us.set_scannerregs(regs); unsigned int val = 0; bool exit = false; int option = 0; unsigned char data[116] = {0x00}; int count = 0; // auto mem = std::shared_ptr(new VectorMemroy()); // mem->resize(10); // memcpy(mem->data(),data,sizeof(data)); for (;;) { option = menu(); switch (option) { case 0: exit = true; break; case 1: this_thread::sleep_for(chrono::milliseconds(1)); break; case 2: notify->clear(); break; case 3: // { // auto nread= transfer->read_bulk(data,sizeof(data)); // break; // } case 4: scanner->test_autocorrect(option==3); break; case 5: { HGScanConfig config = {0}; for (size_t i = 0; i < 40; i++) { std::string msg=(i % 2 == 0?" mode COLOR ":" mode GRAY "); std::cout << "Test color mode change index = "<test_cap(config); this_thread::sleep_for(chrono::milliseconds(1)); } std::cout << "Please select again! " << std::endl; break; } default: std::cout << "Please select again! " << std::endl; break; } /* code */ if (exit) break; } std::cout << "exit munu" << std::endl; return 0; }