// // Created by zx on 2020/6/18. // #include #include "./error_code/error_code.h" //#include "LogFiles.h" #include #include "./communication/communication_socket_base.h" #include "./tool/thread_pool.h" #include "./system/system_communication.h" #include "./system/system_executor.h" #include "./dispatch/dispatch_manager.h" #include "./dispatch/dispatch_communication.h" #include // std::for_each #define LIVOX_NUMBER 2 GOOGLE_GLOG_DLL_DECL void shut_down_logging(const char* data, int size) { time_t tt; time( &tt ); tt = tt + 8*3600; // transform the time zone tm* t= gmtime( &tt ); char buf[255]={0}; sprintf(buf,"./%d%02d%02d-%02d%02d%02d-dump.txt", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); FILE* tp_file=fopen(buf,"w"); fprintf(tp_file,data,strlen(data)); fclose(tp_file); } #include using namespace std; void myfunction (int i) { // function: std::cout << ' ' << i; } int main(int argc,char* argv[]) { const char* logPath = "./"; google::InitGoogleLogging("LidarMeasurement"); google::SetStderrLogging(google::INFO); google::SetLogDestination(0, logPath); google::SetLogFilenameExtension("zxlog"); google::InstallFailureSignalHandler(); google::InstallFailureWriter(&shut_down_logging); FLAGS_colorlogtostderr = true; // Set log color FLAGS_logbufsecs = 0; // Set log output speed(s) FLAGS_max_log_size = 1024; // Set max log file size(GB) FLAGS_stop_logging_if_full_disk = true; Error_manager t_error; std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Request_from_dispatch_to_plc) = " << sizeof(Dispatch_communication::Request_from_dispatch_to_plc) << std::endl; std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Response_from_plc_to_dispatch) = " << sizeof(Dispatch_communication::Response_from_plc_to_dispatch) << std::endl; std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Status_from_dispatch_to_plc) = " << sizeof(Dispatch_communication::Status_from_dispatch_to_plc) << std::endl; std::cout << " huli test :::: " << " sizeof(Dispatch_communication::Status_from_plc_to_dispatch) = " << sizeof(Dispatch_communication::Status_from_plc_to_dispatch) << std::endl; t_error = Dispatch_communication::get_instance_references().communication_init(); std::cout << " huli test :::: " << " t_error = " << t_error << std::endl; std::cout << "Dispatch_communication = " << Dispatch_communication::get_instance_references().get_status() << std::endl; Carrier_base t_carrier_base; t_carrier_base.carrier_base_init(); std::shared_ptr tp_carrier_task(new Carrier_task); tp_carrier_task->task_init(NULL,std::chrono::milliseconds(15000), 1,2,3,"asd", 0,10,20,30); std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl; std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl; std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << t_carrier_base.get_carrier_status() << std::endl; std::cout << " ---------------------------------------------------" << std::endl; t_error = t_carrier_base.execute_one_level_task(tp_carrier_task); std::cout << " huli test :::: " << " t_error = " << t_error << std::endl; while ( 1 ) { std::cout << " huli test :::: " << " tp_carrier_task->get_task_statu = " << tp_carrier_task->get_task_statu() << std::endl; std::cout << " huli test :::: " << " tp_carrier_task->m_respons_status = " << tp_carrier_task->m_respons_status << std::endl; std::cout << " huli test :::: " << " t_carrier_base.get_carrier_status() = " << t_carrier_base.get_carrier_status() << std::endl; std::cout << " ---------------------------------------------------" << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(100)); } char ch123 ; std::cin >> ch123 ; Dispatch_communication::get_instance_references().communication_uninit(); return 0; int t_dispatch_id = 0; // std::cin >> t_dispatch_id ; if ( argc == 2 ) { std::cout << " huli test :::: " << " argv[1] = " << argv[1] << std::endl; t_dispatch_id = atoi(argv[1]); } std::cout << " huli test :::: " << " t_dispatch_id = " << t_dispatch_id << std::endl; Dispatch_manager::get_instance_references().dispatch_manager_init(t_dispatch_id); std::cout << "Dispatch_manager = " << Dispatch_manager::get_instance_references().get_dispatch_manager_status() << std::endl; System_executor::get_instance_references().system_executor_init(8); std::cout << "System_executor = " << System_executor::get_instance_references().get_system_executor_status() << std::endl; System_communication::get_instance_references().communication_init(); char ch ; std::cin >> ch ; System_communication::get_instance_references().communication_uninit(); System_executor::get_instance_references().system_executor_uninit(); Dispatch_manager::get_instance_references().dispatch_manager_uninit(); return 0; }