private void HalConnect(MacHalBase hal) { hal.HalConnect(); foreach (var kv in hal.Hals) { this.HalConnect(kv.Value); } }
private void HalClose(MacHalBase hal) { hal.HalClose(); foreach (var kv in hal.Hals) { this.HalClose(kv.Value); } }
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.DeviceId] = inst; } else { hal.Hals[deviceCfg.DeviceId] = inst; } if (deviceCfg.Devices == null) { return; } foreach (var dcv in deviceCfg.Devices) { HalCreate(dcv, inst); } }
public void SetHalDevice(EnumMacDeviceId key, MacHalBase hal) { this.SetHalDevice(key, hal); }
public void SetHalDevice(string key, MacHalBase hal) { this.Hals[key] = hal; }