123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100 |
- #include "task_command_manager.h"
- #include "../wanji_lidar/wanji_manager.h"
- #include "../velodyne_lidar/velodyne_manager.h"
- //对外的接口函数,所有的任务发送方,都必须使用该函数。
- //execute_task在内部解析了Task_Base里面的Task_type,然后转发给具体某个模块的实例对象。
- //input:p_task_base 任务单,基类的指针,指向子类的实例,(多态)
- Error_manager Task_command_manager::execute_task(Task_Base* p_task_base)
- {
- Error_manager t_error;
- void * tp_tast_receiver = p_task_base->get_tast_receiver();
- switch ( p_task_base->get_task_type() )
- {
- case UNKNOW_TASK:
- t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
- " p_task_base->get_task_type() is UNKNOW_TASK ");
- break;
- case LASER_MANGER_SCAN_TASK:
- // if ( tp_tast_receiver != NULL )
- // {
- // t_error = ((Laser_manager*)tp_tast_receiver)->execute_task(p_task_base);
- // }
- // else
- // {
- // t_error = Laser_manager::get_instance_references().execute_task(p_task_base);
- // }
- break;
- case LASER_BASE_SCAN_TASK:
- // if ( tp_tast_receiver != NULL )
- // {
- // t_error = ((Laser_base*)tp_tast_receiver)->execute_task(p_task_base);
- // }
- // else
- // {
- // return Error_manager(Error_code::TASK_NO_RECEIVER, Error_level::MINOR_ERROR,
- // " Task_command_manager::execute_task have not receiver ");
- // }
- break;
- case LOCATE_MANGER_TASK:
- // if ( tp_tast_receiver != NULL )
- // {
- // t_error = ((Locate_manager*)tp_tast_receiver)->execute_task(p_task_base);
- // }
- // else
- // {
- // t_error = Locate_manager::get_instance_references().execute_task(p_task_base);
- // }
- break;
- case PLC_TASK:
- ;
- break;
- case WANJI_MANAGER_TASK:
- if ( tp_tast_receiver != NULL )
- {
- t_error = ((Wanji_manager*)tp_tast_receiver)->execute_task(p_task_base);
- }
- else
- {
- t_error = Wanji_manager::get_instance_references().execute_task(p_task_base);
- }
- break;
- case VELODYNE_MANAGER_TASK:
- if ( tp_tast_receiver != NULL )
- {
- t_error = ((Velodyne_manager*)tp_tast_receiver)->execute_task(p_task_base);
- }
- else
- {
- t_error = Velodyne_manager::get_instance_references().execute_task(p_task_base);
- }
- break;
- default:
- t_error.error_manager_reset(Error_code::TASK_TYPE_IS_UNKNOW, Error_level::MINOR_ERROR,
- " p_task_base->get_task_type() is UNKNOW_TASK ");
- break;
- }
- return t_error;
- }
|