StoreProcessTask.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. //
  2. // Created by zx on 2020/7/7.
  3. //
  4. #ifndef NNXX_TESTS_STOREPROCESS_H
  5. #define NNXX_TESTS_STOREPROCESS_H
  6. #include <parkspace_allocation_message.pb.h>
  7. #include "dispatch_communicator.h"
  8. #include "TaskQueue/BaseTask.h"
  9. #include "Locate_communicator.h"
  10. #include "process_message.pb.h"
  11. class StoreProcessTask :public tq::BaseTask{
  12. public:
  13. StoreProcessTask(unsigned int command_id);
  14. virtual ~StoreProcessTask();
  15. Error_manager init_task(message::Command_info command_info,
  16. message::Locate_information locate_info,message::Car_info car_info);
  17. /*
  18. * 分配车位
  19. */
  20. Error_manager alloc_space();
  21. protected:
  22. virtual void Main();
  23. /*
  24. * 定位
  25. */
  26. Error_manager locate_step();
  27. /*
  28. * 调度
  29. */
  30. Error_manager dispatch_step();
  31. /*
  32. * 车位占用确认
  33. */
  34. Error_manager confirm_space_step();
  35. /*
  36. * 车位解锁,当停车失败时需要车位解锁
  37. */
  38. Error_manager release_space_step();
  39. /*
  40. * reset 进度信息
  41. */
  42. void reset_process_statu();
  43. /*
  44. * 初始化 接收到的消息
  45. */
  46. void reset_recv_msg();
  47. /*
  48. * 发布进度
  49. */
  50. static void publish_thread_func(StoreProcessTask* p_commander);
  51. void publish_step_status();
  52. protected:
  53. message::Command_info m_command_info;
  54. unsigned int m_terminor_id;
  55. message::Car_info m_car_info; //当前流程的车辆标识(车牌号)
  56. //停车请求发送过来的测量数据,终端位置的测量数据
  57. message::Locate_information m_locate_info;
  58. //以下的流程中产生的数据
  59. message::Measure_response_msg m_measure_response_msg; //测量模块的测量数据
  60. message::Parkspace_allocation_response_msg m_parcspace_alloc_response_msg; //分配的车位数据
  61. message::Dispatch_response_msg m_dispatch_response_msg; //调度模块的反馈数据
  62. std::mutex m_storing_statu_lock;
  63. message::Storing_process_statu_msg m_storing_process_statu_msg; //停车流程进度信息
  64. private:
  65. std::thread* m_publish_statu_thread; //广播状态线程
  66. Thread_condition m_publish_exit_condition; //发送的条件变量
  67. };
  68. #endif //NNXX_TESTS_STOREPROCESS_H