public bool LoadConfiguration() { bool ret = true; try { _monConf = MonConf.GetInstance(); _MonConfInfo = _monConf.GetNet(); if (_MonConfInfo == null) { throw _monConf.ex; } SetupCfg = _monConf.GetSetup(); if (SetupCfg == null) { throw _monConf.ex; } TargetObj1.ID = (byte)SetupCfg.AUVID1; TargetObj2.ID = (byte)SetupCfg.AUVID2; MonProtocol.MonProtocol.Velocity = SetupCfg.AcouVel; MonProtocol.MonProtocol.FixedOffset = SetupCfg.Offset; _serviceStarted = true;//if failed never get here return(_serviceStarted); } catch (Exception ex) { ret = false; EventAggregator.PublishMessage(new ErrorEvent(ex, LogType.Both)); } return(ret); }
public static IMonNetCore GetInstance(CommNet conf, Observer <CustomEventArgs> observer) { lock (SyncObject) { if (conf != null) { return(_netInstance ?? (_netInstance = new NetLiveService_Torp(conf, observer))); } else { return(null); } } }
public CommNet GetNet() { var netcomm = new CommNet(); try { netcomm.IP = GetNetIP(); netcomm.CmdPort = GetNetCmdPort(); netcomm.DataPort = GetNetDataPort(); netcomm.BroadPort = GetNetBroadPort(); netcomm.RecvPort = GetNetRecvPort(); return(netcomm); } catch (Exception e) { ex = e; return(null); } }
protected NetLiveService_Torp(CommNet conf, Observer <CustomEventArgs> observer) { _commConf = conf; _DataObserver = observer; }