123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- //
- // Created by zx on 2020/7/9.
- //
- #ifndef NNXX_TESTS_PARKSPACE_COMMUNICATOR_H
- #define NNXX_TESTS_PARKSPACE_COMMUNICATOR_H
- #include "message_communicator.h"
- #include <parkspace_allocation_message.pb.h>
- #include "thread_safe_map.h"
- #include "communication_message.h"
- class Parkspace_excutor :public Singleton<Parkspace_excutor>
- {
- friend Singleton<Parkspace_excutor>;
- public:
- virtual ~Parkspace_excutor();
- /*
- * 请求分配车位
- */
- Error_manager alloc_request(message::Parkspace_allocation_request_msg& request,
- message::Parkspace_allocation_response_msg& result,Thread_condition& cancel_condition);
- /*
- * 查询车辆所在位置请求
- */
- Error_manager search_request(message::Parkspace_search_request_msg& request,
- message::Parkspace_search_response_msg& response,Thread_condition& cancel_condition);
- /*
- * 释放车位请求(停车失败或者取车完成时调用)
- */
- Error_manager release_request(message::Parkspace_release_request_msg& request,
- message::Parkspace_release_response_msg& response,Thread_condition& cancel_condition);
- /*
- * 确认占用车位消息
- */
- Error_manager confirm_request(message::Parkspace_confirm_alloc_request_msg& request,
- message::Parkspace_confirm_alloc_response_msg& response,Thread_condition& cancel_condition);
- Error_manager consume_msg(Communication_message* p_msg);
- Error_manager check_statu();
- protected:
- Parkspace_excutor();
- protected:
- thread_safe_map<std::string,message::Parkspace_allocation_response_msg> m_alloc_table;
- thread_safe_map<std::string,message::Parkspace_search_response_msg> m_search_table;
- thread_safe_map<std::string,message::Parkspace_release_response_msg> m_release_table;
- thread_safe_map<std::string,message::Parkspace_confirm_alloc_response_msg> m_confirm_table;
- message::Parkspace_allocation_status_msg m_parkspace_status_msg;
- std::chrono::system_clock::time_point m_parkspace_statu_time;
- };
- #endif //NNXX_TESTS_PARKSPACE_COMMUNICATOR_H
|