示例#1
0
 public static BasicConf GetInstance()
 {
     lock (SyncObject)
     {
         return _basicConf ?? (_basicConf = new BasicConf());
     }
 }
示例#2
0
 public static BasicConf GetInstance()
 {
     lock (SyncObject)
     {
         return(_basicConf ?? (_basicConf = new BasicConf()));
     }
 }
示例#3
0
        public static ICommCore GetInstance(BasicConf conf, Observer<DataEventArgs> observer)
        {
            lock (SyncObject)
            {

                return _CommInstance ?? (_CommInstance = new CommService(conf, observer));
            }
        }
示例#4
0
        public bool LoadConfiguration()
        {
            bool ret = true;

            try
            {
                _appConf = BasicConf.GetInstance();
                ret      = UpdateSonarConfig();
            }
            catch (Exception ex)
            {
                ret = false;
            }
            return(ret);
        }
示例#5
0
 public bool LoadConfiguration()
 {
     bool ret = true;
     try
     {
         _appConf = BasicConf.GetInstance();
         ret = UpdateSonarConfig();
     }
     catch (Exception ex)
     {
         ret = false;
         
     }
     return ret;
 }
 protected NetWorkService(BasicConf conf, Observer<DataEventArgs> observe)
 {
     _conf = conf;
     _dataObserver = observe;
 }
        private bool CreateTCPService(BasicConf conf)
        {
            // 同步方法,会阻塞进程,调用init用task
            if (!SonarIsOK)
            {
                TCPDataService.ConnectSync();
                TCPDataService.Register(NetDataObserver);
                TCPCmdService.ConnectSync();
                TCPCmdService.Register(NetDataObserver);

            }
            if (!PoseIsOK)
            {
                TCPPoseService.ConnectSync();
                TCPPoseService.Register(NetDataObserver);

            }
            if (SonarIsOK && PoseIsOK)
                return true;
            return false;
        }
 public static INetCore GetInstance(BasicConf conf, Observer<DataEventArgs> observer)
 {
     lock (SyncObject)
     {
         if (conf != null)
             return _netInstance ?? (_netInstance = new NetWorkService(conf, observer));
         else
         {
             return null;
         }
     }
 }
示例#9
0
 protected CommService(BasicConf conf, Observer<DataEventArgs> observer)
 {
     _commConf = conf;
     _DataObserver = observer;
 }
示例#10
0
 /// <summary>
 ///  初始化串口数据服务
 /// </summary>
 /// <param name="configure">通信参数</param>
 /// <returns>成功or失败</returns>
 private bool CreateSerialService(BasicConf configure)
 {
     _serialPort = new SerialPort(configure.GetCommGPS(),int.Parse(configure.GetGPSDataRate()));
     if (!SerialService.Init(_serialPort) || !SerialService.Start()) return false;
     SerialService.Register(CommDataObserver);
     return true;
 }