//
// Created by zx on 2020/1/3.
//

#ifndef SYSTEM_MANAGER_H
#define SYSTEM_MANAGER_H
#include "../laser/Laser.h"
#include "../plc/plc_communicator.h"
#include "../locate/locater.h"
#include "../terminor/terminal_command_executor.h"
#include "../verify/Verify_result.h"
#include "../wj_lidar/fence_controller.h"

class System_Manager
{
public:
    System_Manager();
    ~System_Manager();
    //初始化各个模块,包括雷达,plc,locater,terminor
    //1,读取运行环境下setting目录下的laser.prototxt,plc.prototxt,locater.prototxt,terminal.prototxt
    //2,根据配置创建雷达,plc,locater,terminal
    Error_manager init();
    //读取protobuf 配置文件
    //file:文件
    //parameter:要读取的配置
    static bool read_proto_param(std::string file, ::google::protobuf::Message& parameter);
protected:
    //plc指令回调函数,当plc收到测量指令后,调用此回调函数
    //terminal_id:收到指令的终端编号
    //owner:this指针
    static Error_manager plc_command_callback(int terminal_id,void* owner);



protected:
    std::vector<Laser_base*>                    m_laser_vector;
    std::vector<Terminor_Command_Executor*>     m_terminal_vector;
    Locater*                                    mp_locater;
    Plc_Communicator*                           mp_plc;

    //结果检验工具
    Verify_result*                              mp_verify_result_tool;
    ///terminoal 配置
    Terminal::Terminor_parameter_all            m_terminal_parameter_all;
    //万集雷达管理对象
    Fence_controller*                           mp_wj_controller;

};


#endif //SYSTEM_MANAGER_H
