综合平台编程器项目的远程存储
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 

61 rader
2.3 KiB

  1. /**
  2. * @file main.cpp
  3. * @brief 综合平台编程器应用程序入口。
  4. * @version 0.1.0
  5. * @author suyu
  6. * @date 2026-08-05
  7. */
  8. #include <QApplication>
  9. #include "infrastructure/json_project_storage.h"
  10. #include "infrastructure/plc_communication_service.h"
  11. #include "infrastructure/plc_register_repository.h"
  12. #include "domain/active_register_repository.h"
  13. #include "services/hmi_editor_service.h"
  14. #include "services/hmi_runtime_service.h"
  15. #include "services/logic_editor_service.h"
  16. #include "services/offline_simulation_service.h"
  17. #include "services/project_service.h"
  18. #include "services/runtime_mode_service.h"
  19. #include "services/register_monitor_service.h"
  20. #include "ui/main_window.h"
  21. int main(int argc, char *argv[])
  22. {
  23. QApplication application(argc, argv);
  24. application.setApplicationName(QObject::tr("综合平台编程器"));
  25. application.setOrganizationName(QStringLiteral("QtProXinJe"));
  26. // 组合根负责创建具体实现并将抽象依赖注入服务和 UI
  27. JsonProjectStorage project_storage;
  28. ProjectService project_service(project_storage);
  29. HmiEditorService hmi_editor_service(project_service);
  30. LogicEditorService logic_editor_service(project_service);
  31. // 当前离线模式使用内存仓库,后续真机模式替换为 PLC 缓存实现
  32. VirtualRegisterRepository virtual_register_repository;
  33. PlcRegisterRepository plc_register_repository;
  34. ActiveRegisterRepository active_register_repository(virtual_register_repository);
  35. PlcCommunicationService plc_communication_service(plc_register_repository);
  36. HmiRuntimeService hmi_runtime_service(active_register_repository);
  37. RegisterMonitorService register_monitor_service(active_register_repository);
  38. OfflineSimulationService offline_simulation_service(virtual_register_repository);
  39. RuntimeModeService runtime_mode_service(
  40. project_service, offline_simulation_service);
  41. runtime_mode_service.configurePlc(
  42. plc_communication_service,
  43. active_register_repository,
  44. virtual_register_repository,
  45. plc_register_repository);
  46. MainWindow main_window(
  47. runtime_mode_service,
  48. project_service,
  49. hmi_editor_service,
  50. logic_editor_service,
  51. hmi_runtime_service,
  52. register_monitor_service);
  53. main_window.show();
  54. return application.exec();
  55. }