public OperationResult<bool> Connect(FSAgent fsAgent, bool isPing) { try { FiresecSerializedClient = new FiresecSerializedClient(); FiresecSerializedClient.FSAgent = fsAgent; FiresecSerializedClient.SubscribeFsAgentEvents(); ConfigurationConverter = new ConfigurationConverter(FiresecSerializedClient); var result = ConfigurationConverter.ConvertMetadataFromFiresec(); if (!result.HasError) { ConfigurationCash.DriversConfiguration = result.Result; return new OperationResult<bool>() { Result = true }; } else { return new OperationResult<bool>(result.Error); } } catch (Exception e) { Logger.Error(e, "FiresecDriver.Synchronyze"); LoadingErrorManager.Add(e); return new OperationResult<bool>(e.Message); } }
public FiresecDriver(int lastJournalNo, string FS_Address, int FS_Port, string FS_Login, string FS_Password, bool isPing) { LoadingErrors = new StringBuilder(); try { FiresecSerializedClient = new FiresecSerializedClient(); FiresecSerializedClient.Connect(FS_Address, FS_Port, FS_Login, FS_Password, isPing); ConfigurationConverter = new ConfigurationConverter() { FiresecSerializedClient = FiresecSerializedClient }; ConfigurationConverter.ConvertMetadataFromFiresec(); } catch (Exception e) { Logger.Error(e, "FiresecDriver.Synchronyze"); FiresecDriver.LoadingErrors.Append(e.Message); } }
public OperationResult<DeviceConfiguration> DeviceReadConfiguration(DeviceConfiguration deviceConfiguration, Guid deviceUID) { var firesecConfiguration = ConvertBack(deviceConfiguration, false); var device = deviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID); var result = FiresecSerializedClient.DeviceReadConfig(firesecConfiguration, device.GetPlaceInTree()); var operationResult = new OperationResult<DeviceConfiguration>() { HasError = result.HasError, Error = result.Error }; if (operationResult.HasError) return operationResult; if (result.Result == null) return new OperationResult<DeviceConfiguration>("Ошибка. Получена пустая конфигурация"); var configurationManager = new ConfigurationConverter(); operationResult.Result = configurationManager.ConvertOnlyDevices(result.Result); return operationResult; }
public OperationResult<DeviceConfiguration> DeviceAutoDetectChildren(DeviceConfiguration deviceConfiguration, Guid deviceUID, bool fastSearch) { var firesecConfiguration = ConvertBack(deviceConfiguration, false); var device = deviceConfiguration.Devices.FirstOrDefault(x => x.UID == deviceUID); var result = FiresecSerializedClient.DeviceAutoDetectChildren(firesecConfiguration, device.GetPlaceInTree(), fastSearch); var operationResult = new OperationResult<DeviceConfiguration>() { HasError = result.HasError, Error = result.Error }; if (operationResult.HasError) return operationResult; if (result.Result == null) return new OperationResult<DeviceConfiguration>(); var configurationConverter = new ConfigurationConverter(FiresecSerializedClient); operationResult.Result = configurationConverter.ConvertOnlyDevices(result.Result); return operationResult; }