private void InitializeStation(InstanceMemory mem, ConfiguredStation cs) { Station s = null; try { s = NewStation(cs.ConfigData, mem); if (s != null) { s.Connect(); cs.Station = s; cs.Description = s.StationDescription; // allow station to provide an updated description cs.Enabled = true; } } catch (Exception e) { cs.Error = e.Message; errors += "Station not available: "; errorsDetail += "Station not available: "; if (s != null) { errors += s.ToString(); errorsDetail += s.ToString(); } errors += "\n"; errors += e.Message + "\n"; errorsDetail += "\n"; errorsDetail += e + "\n"; } }
private void ConfigureStations(InstanceMemory mem, ConfigData config) { // for each station element in the configStream file, // create a station and add it to the stations list List<ConfigData> stationConfigs = config.GetConfigSections(Constants.StationConfig); int index = 0; foreach (ConfigData sConfig in stationConfigs) { ConfiguredStation cs = new ConfiguredStation(index++, sConfig); cs.Description = sConfig.Value(Constants.StationDescription); if (string.IsNullOrWhiteSpace(cs.Description)) cs.Description = sConfig.Value(Constants.StationClassName); configuredStations.Add(cs); // if the Station is configured to be inactive, don't initialize bool active = sConfig.BoolValue(Constants.ActiveStation, true); if (active) { InitializeStation(mem, cs); } } }