Beispiel #1
0
 public int MvCfFree()
 {
     this.MvCfFree();
     MvUtil.Foreach(this.CtrlMachines.Values, m => m.MvCfFree());
     this.DisposeSelf();
     return(0);
 }
Beispiel #2
0
        public int MvCfInit()
        {
            this.Mediater            = new MacMachineMediater();
            this.Mediater.MachineMgr = this;

            this.Config = MacMachineMgrCfg.LoadFromXmlFile();                 //先載入整機的Config

            this.HalContext = new MacHalContext(this.Config.ManifestCfgPath); //將Manifest路徑交給HalContext載入
            this.HalContext.MvCfInit();

            foreach (var row in this.Config.MachineCtrls)
            {
                //Create machine controller
                var machine = Activator.CreateInstance(row.MachineCtrlType.Type) as MacMachineCtrlBase;
                this.CtrlMachines[row.ID] = machine;

                //Initial machine controller
                machine.Mediater = this.Mediater;



                //Assign HAL to machine controller
                var hal = this.HalContext.HalDevices.Where(x => x.Value.ID == row.HalId).FirstOrDefault();
                machine.halAssembly = hal.Value as MacHalAssemblyBase;


                machine.halAssembly.HalConnect();
            }
            MvUtil.Foreach(this.CtrlMachines.Values, m => m.MvCfInit());

            return(0);
        }
Beispiel #3
0
 public int MvCfUnload()
 {
     this.HalContext.MvCfUnload();
     MvUtil.Foreach(this.CtrlMachines.Values, m => m.MvCfUnload());
     return(0);
 }