예제 #1
0
파일: UnitCore.cs 프로젝트: BJFX/Torp
        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);
        }
예제 #2
0
 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);
         }
     }
 }
예제 #3
0
파일: MonitorConf.cs 프로젝트: BJFX/Torp
        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);
            }
        }
예제 #4
0
 protected NetLiveService_Torp(CommNet conf, Observer <CustomEventArgs> observer)
 {
     _commConf     = conf;
     _DataObserver = observer;
 }