Exemplo n.º 1
0
 private void HalConnect(MacHalBase hal)
 {
     hal.HalConnect();
     foreach (var kv in hal.Hals)
     {
         this.HalConnect(kv.Value);
     }
 }
Exemplo n.º 2
0
 private void HalClose(MacHalBase hal)
 {
     hal.HalClose();
     foreach (var kv in hal.Hals)
     {
         this.HalClose(kv.Value);
     }
 }
Exemplo n.º 3
0
        void HalCreate(MacManifestDeviceCfg deviceCfg, MacHalBase hal = null)
        {
            var drivers = (from row in this.manifest.Drivers
                           where row.DriverId == deviceCfg.DriverId
                           select row).ToList();

            //Check driver count
            if (drivers.Count == 0)
            {
                throw new MacWrongDriverException("No Driver");
            }
            else if (drivers.Count > 1)
            {
                throw new MacWrongDriverException("Duplicate Driver");
            }

            var driver = drivers.FirstOrDefault();
            var type   = driver.AssignType;
            var inst   = Activator.CreateInstance(type) as MacHalBase;

            if (inst == null)
            {
                throw new MacHalObjectNotFoundException();
            }

            inst.HalDeviceCfg = deviceCfg;
            inst.HalDriverCfg = driver;
            inst.HalContext   = this;

            if (hal == null)
            {
                this.HalDevices[deviceCfg.DeviceName] = inst;
            }
            else
            {
                hal.Hals[deviceCfg.DeviceName] = inst;
            }


            if (deviceCfg.Devices == null)
            {
                return;
            }
            foreach (var dcv in deviceCfg.Devices)
            {
                HalCreate(dcv, inst);
            }
        }
Exemplo n.º 4
0
 public void SetHalDevice(string key, MacHalBase hal)
 {
     this.Hals[key] = hal;
 }
Exemplo n.º 5
0
 public void SetHalDevice(MacEnumDevice key, MacHalBase hal)
 {
     this.SetHalDevice(key, hal);
 }