Process.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #pragma once
  2. #include <QObject>
  3. #include "common.h"
  4. #include "./modbus/PLCMonitor.h"
  5. #include "./src/CalibParam.pb.h"
  6. #include "laser/LivoxLaser.h"
  7. #include "laser/Sick511FileLaser.h"
  8. #include "src/measuretask.h"
  9. #include "qtmessagedef.h"
  10. class CProcess :public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. CProcess(Automatic::stCalibParam param,void* mainWnd=NULL);
  15. bool Init();
  16. std::string LastError() { return m_last_error; }
  17. void PushTask(uint16_t param , int action_type,bool test=false);
  18. size_t TaskQueueSize() { return m_thread_queue->TaskCount(); }
  19. virtual ~CProcess();
  20. protected:
  21. // after received command from plc
  22. static void action_callback(bool bOn, uint16_t param, void* pointer, int action_type);
  23. // send info to UI
  24. static void monitor_callback(QtMessageData data,void* pointer);
  25. static void create_mat_param(Automatic::stLaserCalibParam laser, double*);
  26. protected:
  27. signals:
  28. void MainWndSignal(QVariant data);
  29. protected:
  30. static void result_callback(void* data,void* pointer);
  31. public:
  32. // pointer of laser handles
  33. CLaser** m_laser;
  34. modbus::CPLCMonitor m_monitor;
  35. protected:
  36. tq::IQueue* m_thread_queue;
  37. // 激光标定参数
  38. Automatic::stCalibParam m_laser_calib_param;
  39. std::string m_last_error;
  40. public:
  41. ////获取最近结果
  42. mutable std::mutex m_mutex;
  43. void* m_main_wnd;
  44. int m_plate_index;
  45. };
  46. std::string Error_string(ERROR_CODE code);