public static BasicConf GetInstance() { lock (SyncObject) { return _basicConf ?? (_basicConf = new BasicConf()); } }
public static BasicConf GetInstance() { lock (SyncObject) { return(_basicConf ?? (_basicConf = new BasicConf())); } }
public static ICommCore GetInstance(BasicConf conf, Observer<DataEventArgs> observer) { lock (SyncObject) { return _CommInstance ?? (_CommInstance = new CommService(conf, observer)); } }
public bool LoadConfiguration() { bool ret = true; try { _appConf = BasicConf.GetInstance(); ret = UpdateSonarConfig(); } catch (Exception ex) { ret = false; } return(ret); }
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; } } }
protected CommService(BasicConf conf, Observer<DataEventArgs> observer) { _commConf = conf; _DataObserver = observer; }
/// <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; }