12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //
- // Created by zx on 2020/7/7.
- //
- #ifndef NNXX_TESTS_STOREPROCESS_H
- #define NNXX_TESTS_STOREPROCESS_H
- #include <parkspace_allocation_message.pb.h>
- #include "dispatch_communicator.h"
- #include "TaskQueue/BaseTask.h"
- #include "Locate_communicator.h"
- #include "process_message.pb.h"
- class StoreProcessTask :public tq::BaseTask{
- public:
- StoreProcessTask(unsigned int command_id);
- virtual ~StoreProcessTask();
- Error_manager init_task(unsigned int terminor_id,
- message::Locate_information locate_info,message::Car_info car_info);
- /*
- * 检查当前任务是否处于空闲准备状态
- */
- bool is_ready();
- /*
- * 分配车位
- */
- Error_manager alloc_space();
- protected:
- virtual void Main();
- /*
- * 定位
- */
- Error_manager locate_step();
- /*
- * 调度
- */
- Error_manager dispatch_step();
- /*
- * 车位占用确认
- */
- Error_manager confirm_space_step();
- /*
- * 车位解锁,当停车失败时需要车位解锁
- */
- Error_manager release_space_step();
- /*
- * reset 进度信息
- */
- void reset_process_statu();
- /*
- * 发布进度
- */
- static void publish_thread_func(StoreProcessTask* p_commander);
- void publish_step_status();
- protected:
- unsigned int m_command_id;
- unsigned int m_terminor_id;
- message::Car_info m_car_info; //当前流程的车辆标识(车牌号)
- //停车请求发送过来的测量数据,终端位置的测量数据
- message::Locate_information m_locate_info;
- //以下的流程中产生的数据
- message::Measure_response_msg m_measure_response_msg; //测量模块的测量数据
- message::Parkspace_allocation_response_msg m_parcspace_alloc_response_msg; //分配的车位数据
- message::Dispatch_response_msg m_dispatch_response_msg; //调度模块的反馈数据
- message::Storing_process_statu_msg m_storing_process_statu_msg; //停车流程进度信息
- private:
- std::thread* m_publish_statu_thread; //广播状态线程
- Thread_condition m_publish_exit_condition; //发送的条件变量
- };
- #endif //NNXX_TESTS_STOREPROCESS_H
|