//-------------------------------------------------------------------------- void MeshLodTests::testMeshLodGenerator() { UnitTestSuite::getSingletonPtr()->startTestMethod(__FUNCTION__); LodConfig config; setTestLodConfig(config); MeshLodGenerator& gen = MeshLodGenerator::getSingleton(); gen.generateLodLevels(config); addProfile(config); config.advanced.useBackgroundQueue = false; config.advanced.useCompression = false; config.advanced.useVertexNormals = false; gen.generateLodLevels(config); LodConfig config2(config); config2.advanced.useBackgroundQueue = true; config2.mesh->removeLodLevels(); gen.generateLodLevels(config); blockedWaitForLodGeneration(config.mesh); CPPUNIT_ASSERT(config.levels.size() == config2.levels.size()); for (size_t i = 0; i < config.levels.size(); i++) { CPPUNIT_ASSERT(config.levels[i].outSkipped == config2.levels[i].outSkipped); CPPUNIT_ASSERT(config.levels[i].outUniqueVertexCount == config2.levels[i].outUniqueVertexCount); } }
void TestProxySerialization() { filesystem::FileSystem filesystem; auto tempFile = filesystem.GetTempPath() / filesystem.UniquePath(); TestProxyConfig<bool, std::string> config1( [](const std::string& v) { return v == "yes"; }, [](bool v) { return v ? std::string("yes") : std::string("no"); }, true); { JsonOutputArchive ar(tempFile.ToShortString()); ar.Serialize(config1, L"config"); } TestProxyConfig<bool, std::string> config2( [](const std::string& v) { return v == "yes"; }, [](bool v) { return v ? std::string("yes") : std::string("no"); }); { JsonInputArchive ar(tempFile.ToShortString()); ar.Serialize(config2, L"config"); } TS_ASSERT_EQUALS(config1.GetValue(), config2.GetValue()); filesystem.Remove(tempFile); }
void TestStringSerialization() { filesystem::FileSystem filesystem; auto tempFile = filesystem.GetTempPath() / filesystem.UniquePath(); TestConfig<std::string> config1("hello"); TestConfig<std::wstring> configW1(L"whello"); { JsonOutputArchive ar(tempFile.ToShortString()); ar.Serialize(config1, L"config"); ar.Serialize(configW1, L"configw"); } TestConfig<std::string> config2("hello"); TestConfig<std::wstring> configW2(L"whello"); { JsonInputArchive ar(tempFile.ToShortString()); ar.Serialize(config2, L"config"); ar.Serialize(configW2, L"configw"); } TS_ASSERT_EQUALS(config1.GetValue(), config2.GetValue()); TS_ASSERT_EQUALS(configW1.GetValue(), configW2.GetValue()); filesystem.Remove(tempFile); }
/** * @function SegmentFeasible * @brief Check if the segment between these two configurations is collision-free */ bool MyFeasibilityChecker::SegmentFeasible( const Vector & a, const Vector & b ) { Eigen::VectorXd config1(ndim), config2(ndim); for( int i = 0; i < ndim; i++ ) { config1(i) = a[i]; config2(i) = b[i]; } int n = (int)( (config2 - config1).norm() / stepsize ); for(int i = 0; i < n; i++) { Eigen::VectorXd conf = (double)(n - i)/(double)n * config1 + (double)(i)/(double)n * config2; world->robots[robot]->setConf(links, conf, true); if(world->checkCollisions()) { return false; } } return true; }
void BattleLayer::initLabels() { TTFConfig config2("Marker Felt.ttf", 30, GlyphCollection::DYNAMIC, nullptr, true); m_devilHP = 10; m_devilHPLabel = Label::createWithTTF(config2, "10", TextHAlignment::LEFT);//创建显示 魔王血量 的label m_devilHPLabel->setPosition(Point(m_winSize.width / 2 + 250, m_winSize.height / 2 + 200)); m_battleBase->addChild(m_devilHPLabel, 1); m_leadHP = 3; m_leadHPLabel = Label::createWithTTF(config2, "3", TextHAlignment::LEFT);//创建显示 主角血量 的label m_leadHPLabel->setPosition(Point(m_winSize.width / 2 + 250, m_winSize.height / 6)); m_battleBase->addChild(m_leadHPLabel, 1); }
void Network::requestConfiguration() { if (_id == ZT_TEST_NETWORK_ID) // pseudo-network-ID, uses locally generated static config return; if (controller() == RR->identity.address()) { if (RR->localNetworkController) { SharedPtr<NetworkConfig> nconf(config2()); Dictionary newconf; switch(RR->localNetworkController->doNetworkConfigRequest(InetAddress(),RR->identity,RR->identity,_id,Dictionary(),newconf)) { case NetworkController::NETCONF_QUERY_OK: this->setConfiguration(newconf,true); return; case NetworkController::NETCONF_QUERY_OBJECT_NOT_FOUND: this->setNotFound(); return; case NetworkController::NETCONF_QUERY_ACCESS_DENIED: this->setAccessDenied(); return; default: return; } } else { this->setNotFound(); return; } } TRACE("requesting netconf for network %.16llx from controller %s",(unsigned long long)_id,controller().toString().c_str()); // TODO: in the future we will include things like join tokens here, etc. Dictionary metaData; metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MAJOR_VERSION,ZEROTIER_ONE_VERSION_MAJOR); metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_MINOR_VERSION,ZEROTIER_ONE_VERSION_MINOR); metaData.setHex(ZT_NETWORKCONFIG_REQUEST_METADATA_KEY_NODE_REVISION,ZEROTIER_ONE_VERSION_REVISION); std::string mds(metaData.toString()); Packet outp(controller(),RR->identity.address(),Packet::VERB_NETWORK_CONFIG_REQUEST); outp.append((uint64_t)_id); outp.append((uint16_t)mds.length()); outp.append((const void *)mds.data(),(unsigned int)mds.length()); { Mutex::Lock _l(_lock); if (_config) outp.append((uint64_t)_config->revision()); else outp.append((uint64_t)0); } RR->sw->send(outp,true,0); }
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWndEx::OnCreate(lpCreateStruct) == -1) return -1; m_wndClientArea.ModifyStyleEx(WS_EX_CLIENTEDGE, 0); // create a view to occupy the client area of the frame //if (!m_wndView.Create(IDD_ABOUTBOX, this)) //m_wndView.Create(GetSafeHwnd(), CRect(10,300,100,330), _T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON, NULL, 2); //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) //{ // TRACE0("Failed to create view window\n"); // return -1; //} // set the visual manager and style based on persisted value OnApplicationLook(theApp.m_nAppLook); //// create a view to occupy the client area of the frame //if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW, CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL)) //{ // TRACE0("Failed to create view window\n"); // return -1; //} boost::filesystem::path iniPath; GetIniPath(iniPath); CComPtr<IConfig> ini = CreateIConfig(AMT_INI, iniPath); CString config1( ini->Get(g_szConfigSection, RepLabel1, _T("0")) ); CString config2( ini->Get(g_szConfigSection, RepLabel2, _T("1")) ); m_splitter.Create(m_hWndMDIClient, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN); m_repositoryDlg.Create(m_splitter); //m_detailSheetView.SetReflectNotifications(true); m_detailSheetView.SetTabStyles(CTCS_BOTTOM | CTCS_TOOLTIPS); m_detailSheetView.Create(m_splitter, ATL::CWindow::rcDefault); //m_detailView.SetFont(WTL::AtlGetDefaultGuiFont()); m_sourceEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault); m_sourceEclView.DoInit(); m_sourceEclView.SetReadOnly(true); //TODO: InitEclCommandMixin(this, this, &m_sourceEclView, this); m_detailSheetView.AddTab(m_sourceEclView, _T("Source ECL")); m_diffView.Create(m_detailSheetView, ATL::CWindow::rcDefault, _T(""), WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE); m_detailSheetView.AddTab(m_diffView, _T("Differences")); m_targetEclView.Create(m_detailSheetView, ATL::CWindow::rcDefault); m_targetEclView.DoInit(); m_targetEclView.SetReadOnly(true); //TODO: InitEclCommandMixin(this, this, &m_targetEclView, this); m_detailSheetView.AddTab(m_targetEclView, _T("Target ECL")); m_dependees.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_CLIENTEDGE); m_dependees.SetFont(WTL::AtlGetDefaultGuiFont()); m_detailSheetView.AddTab(m_dependees, _T("Dependee Check")); m_logView.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_VSCROLL | LBS_NOINTEGRALHEIGHT, WS_EX_CLIENTEDGE); m_logView.SetFont(WTL::AtlGetDefaultGuiFont()); m_detailSheetView.AddTab(m_logView, _T("Log")); WTL::CEdit edit; edit.Create(m_detailSheetView, ATL::CWindow::rcDefault, NULL, ES_MULTILINE | ES_READONLY | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_HSCROLL | WS_VSCROLL, WS_EX_CLIENTEDGE); CString face = _T("MS Shell Dlg"); int nPointSize = 8; WTL::CFont font; WTL::CLogFont logFont; logFont.lfCharSet = DEFAULT_CHARSET; logFont.lfHeight = nPointSize*10; ::_tcsncpy(logFont.lfFaceName, face, LF_FACESIZE); logFont.lfWeight = FW_LIGHT; logFont.lfQuality = PROOF_QUALITY; logFont.lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE; logFont.lfOutPrecision = OUT_TT_PRECIS; if ( font.CreatePointFontIndirect(&logFont,0) ) { edit.SetFont(font.Detach(),false); } m_warnView.SetEditCtrl(edit.Detach()); m_detailSheetView.AddTab(m_warnView, _T("Warnings")); m_detailSheetView.GetTabCtrl().SetCurSel(1); m_splitter.SetSplitterPanes(m_repositoryDlg, m_detailSheetView); m_splitter.SetSplitterPosPct(50); m_wndRibbonBar.Create(this); InitializeRibbon(); if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar\n"); return -1; // fail to create } m_wndStatusBar.AddElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE1, _T(""), TRUE), _T("")); m_wndStatusBar.AddExtendedElement(new CMFCRibbonStatusBarPane(ID_STATUSBAR_PANE2, _T(""), TRUE), _T("")); CMFCRibbonProgressBar * elem = new CMFCRibbonProgressBar(ID_STATUSBAR_PANE3); m_wndStatusBar.AddExtendedElement(elem, _T("Progress")); elem->SetRange(1, 1); elem->SetPos(0); // enable Visual Studio 2005 style docking window behavior CDockingManager::SetDockingMode(DT_SMART); // enable Visual Studio 2005 style docking window auto-hide behavior EnableAutoHidePanes(CBRS_ALIGN_ANY); // Enable enhanced windows management dialog //EnableWindowsDialog(ID_WINDOW_MANAGER, IDS_WINDOWS_MANAGER, TRUE); HICON newIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME_AMT)); HICON oldIcon = SetIcon(newIcon, false); HICON oldIcon2 = SetIcon(newIcon, true); RecalcLayout(); if ( !m_bStreamInit ) { m_pOldBuf = std::cerr.rdbuf(&m_EditStrBuf); m_pOldBufW = std::wcerr.rdbuf(&m_EditStrBufW); m_bStreamInit = true; } PostMessage(UM_INITIALIZE); return 0; }
// Load config info bool ecSettings::LoadConfig() { wxConfig config(wxGetApp().GetSettings().GetConfigAppName()); config.Read(_("/Window Status/FrameStatus"), & m_frameStatus); config.Read(_("/Window Status/ShowToolBar"), (bool*) & m_showToolBar); config.Read(_("/Window Status/ShowSplashScreen"), (bool*) & m_showSplashScreen); config.Read(_("/Window Status/ShowConflictsWindow"), (bool*) & m_showConflictsWindow); config.Read(_("/Window Status/ShowPropertiesWindow"), (bool*) & m_showPropertiesWindow); config.Read(_("/Window Status/ShowShortDescrWindow"), (bool*) & m_showShortDescrWindow); config.Read(_("/Window Status/ShowMemoryWindow"), (bool*) & m_showMemoryWindow); config.Read(_("/Window Status/ShowOutputWindow"), (bool*) & m_showOutputWindow); config.Read(_("/Files/LastFile"), & m_lastFilename); config.Read(_("/Window Size/WindowX"), & m_frameSize.x); config.Read(_("/Window Size/WindowY"), & m_frameSize.y); config.Read(_("/Window Size/WindowWidth"), & m_frameSize.width); config.Read(_("/Window Size/WindowHeight"), & m_frameSize.height); config.Read(_("/Window Size/TreeSashWidth"), & m_treeSashSize.x); config.Read(_("/Window Size/TreeSashHeight"), & m_treeSashSize.y); config.Read(_("/Window Size/ConfigPaneWidth"), & m_configPaneWidth); config.Read(_("/Window Size/ConflictsWidth"), & m_conflictsSashSize.x); config.Read(_("/Window Size/ConflictsHeight"), & m_conflictsSashSize.y); config.Read(_("/Window Size/PropertiesWidth"), & m_propertiesSashSize.x); config.Read(_("/Window Size/PropertiesHeight"), & m_propertiesSashSize.y); config.Read(_("/Window Size/ShortDescrWidth"), & m_shortDescrSashSize.x); config.Read(_("/Window Size/ShortDescrHeight"), & m_shortDescrSashSize.y); config.Read(_("/Window Size/OutputWidth"), & m_outputSashSize.x); config.Read(_("/Window Size/OutputHeight"), & m_outputSashSize.y); config.Read(_("/Window Size/MemoryWidth"), & m_memorySashSize.x); config.Read(_("/Window Size/MemoryHeight"), & m_memorySashSize.y); config.Read(_("/Options/ShowMacroNames"), (bool*) & m_showMacroNames); config.Read(_("/Options/UseCustomViewer"), (bool*) & m_bUseCustomViewer); config.Read(_("/Options/UseExternalBrowser"), (bool*) & m_bUseExternalBrowser); int tmp = (int) m_eUseCustomBrowser; config.Read(_("/Options/UseCustomBrowser"), & tmp); m_eUseCustomBrowser = (ecBrowserType) tmp; config.Read(_("/Options/Browser"), & m_strBrowser); config.Read(_("/Options/Viewer"), & m_strViewer); config.Read(_("/Options/HexDisplay"), (bool*) & m_bHex); config.Read(_("/Options/UseDefaultFonts"), (bool*) & m_windowSettings.m_useDefaults); config.Read(_("/Rule/Checking"), & m_nRuleChecking); // Find dialog settings config.Read(_("/Find/Text"), & m_findText); config.Read(_("/Find/MatchWholeWord"), (bool*) & m_findMatchWholeWord); config.Read(_("/Find/MatchCase"), & m_findMatchCase); config.Read(_("/Find/Direction"), (bool*) & m_findDirection); config.Read(_("/Find/SearchWhat"), & m_findSearchWhat); config.Read(_("/Find/DialogX"), & m_findDialogPos.x); config.Read(_("/Find/DialogY"), & m_findDialogPos.y); // Package dialog settings config.Read(_("/Packages/OmitHardwarePackages"), & m_omitHardwarePackages); config.Read(_("/Packages/MatchPackageNamesExactly"), & m_matchPackageNamesExactly); // Run tests settings m_runTestsSettings.LoadConfig(config); // Fonts m_windowSettings.LoadConfig(config); if (!config.Read(_("/Paths/UserToolsDir"), & m_userToolsDir)) { // Use the default provided by the installer config.Read(_("Default User Tools Path"), & m_userToolsDir); } // Only to be used if we fail to find the information installed // with the Configuration Tool. config.Read(_("/Paths/BuildToolsDir"), & m_buildToolsDir); if (m_buildToolsDir.IsEmpty()) // first invocation by this user { // we have no clues as to the location of the build tools so // test for ../../../gnutools relative to the configtool location wxFileName gnutools = wxFileName (wxGetApp().GetAppDir(), wxEmptyString); gnutools.Normalize(); // remove trailing "./" if present if (2 < gnutools.GetDirCount()) { gnutools.RemoveDir (gnutools.GetDirCount()-1); gnutools.RemoveDir (gnutools.GetDirCount()-1); gnutools.RemoveDir (gnutools.GetDirCount()-1); gnutools.AppendDir (wxT("gnutools")); if (gnutools.DirExists()) // we've found the gnutools m_buildToolsDir = gnutools.GetFullPath(); } } // look for *objcopy in and under the build tools directory if (! m_buildToolsDir.IsEmpty()) { wxArrayString objcopyFiles; wxString objcopyFileSpec(wxT("objcopy")); #ifdef __WXMSW__ objcopyFileSpec += wxT(".exe"); #endif size_t objcopyCount = wxDir::GetAllFiles(m_buildToolsDir, &objcopyFiles, wxT("*") + objcopyFileSpec, wxDIR_FILES | wxDIR_DIRS); for (int count=0; count < objcopyCount; count++) { wxFileName file (objcopyFiles [count]); wxString new_prefix (file.GetFullName().Left (file.GetFullName().Find(objcopyFileSpec))); if ((! new_prefix.IsEmpty()) && ('-' == new_prefix.Last())) new_prefix = new_prefix.Left (new_prefix.Len() - 1); // strip off trailing hyphen m_arstrBinDirs.Set(new_prefix, file.GetPath(wxPATH_GET_VOLUME)); } } if (!config.Read(_("/Build/Make Options"), & m_strMakeOptions)) { #ifdef __WXMSW__ SYSTEM_INFO SystemInfo; GetSystemInfo(&SystemInfo); // disable -j option for now due to problem with Cygwin 1.3.18 // m_strMakeOptions.Printf(_T("-j%d"),SystemInfo.dwNumberOfProcessors); #endif } // Set default build tools binary directories as specified by the installer ecFileName strDefaultBuildToolsPath; #ifdef __WXMSW__ { // This should look in HKEY_LOCAL_MACHINE wxConfig config2(wxT("eCos"), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE); wxString versionKey = GetInstallVersionKey(); wxConfigPathChanger path(& config2, wxString(wxT("/")) + versionKey + wxT("/")); if (!versionKey.IsEmpty() && config2.Read(wxT("Default Build Tools Path"), & strDefaultBuildToolsPath)) { #ifdef __WXMSW__ wxString gccExe(wxT("*-gcc.exe")); #else wxString gccExe(wxT("*-gcc")); #endif // Note that this is not a recursive search. Compilers for // different targets may be in the same directory. This finds all targets. // look for *-gcc[.exe] in the default build tools directory wxLogNull log; wxDir finder(strDefaultBuildToolsPath); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, gccExe); while (bMore) { wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath); bMore = finder.GetNext(& filename); } } } } #endif #ifndef __WXMSW__ // Look in the PATH for build tools, under Unix { wxString strPath; if (wxGetEnv(wxT("PATH"), & strPath)) { wxString gccExe(wxT("*-gcc")); wxArrayString arstrPath; ecUtils::Chop(strPath, arstrPath, wxT(':')); for (int i = arstrPath.GetCount()-1;i >= 0; --i) { // Reverse order is important to treat path correctly if (wxT(".") != arstrPath[i] && !arstrPath[i].IsEmpty()) { wxLogNull log; wxDir finder(arstrPath[i]); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, gccExe); while (bMore) { wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, arstrPath[i]); bMore = finder.GetNext(& filename); } } } } } } #endif // Read build tools directories (current user) { wxConfigPathChanger path(& config, wxT("/Build Tools/")); //config.SetPath(wxT("/Build Tools")); wxString key(wxT("")); long index; bool bMore = config.GetFirstEntry(key, index); while (bMore) { wxString value; if (config.Read(key, & value)) { m_arstrBinDirs.Set(key, value); } bMore = config.GetNextEntry(key, index); } } // Read toolchain paths (local machine again) #ifdef __WXMSW__ wxArrayString arstrToolChainPaths; // Use eCos just as a test. //GetRepositoryRegistryClues(arstrToolChainPaths,_T("eCos")); GetRepositoryRegistryClues(arstrToolChainPaths,_T("GNUPro eCos")); size_t i; for (i = (size_t) 0; i < arstrToolChainPaths.GetCount(); i++) { ecFileName strDir(arstrToolChainPaths[i]); strDir += wxT("H-i686-cygwin32\\bin"); if (strDir.IsDir()) { // This is a potential toolchain location. Look for *-gcc.exe wxLogNull log; wxDir finder(strDefaultBuildToolsPath); wxString filename; if (finder.IsOpened()) { bool bMore = finder.GetFirst(& filename, wxT("*-gcc.exe")); while (bMore) { // TODO: if there is more than one path, we will have to // check the existance of this target name in m_arstrBinDirs and // append to the end, or something. wxString targetName = filename.Left(filename.Find(wxT("-gcc"))); m_arstrBinDirs.Set(targetName, strDefaultBuildToolsPath); bMore = finder.GetNext(& filename); } } } } // The official user tools are now Cygwin 00r1. If you can't find these, // try GNUPro unsupported. GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro 00r1")); if (m_userToolPaths.GetCount() == 0) { GetRepositoryRegistryClues(m_userToolPaths, wxT("Cygwin 00r1")); } if (m_userToolPaths.GetCount() > 0) { for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++) { ecFileName str(m_userToolPaths[i]); str += "H-i686-cygwin32\\bin"; if(str.IsDir()) { m_userToolPaths[i] = str; } else { m_userToolPaths.Remove(i); i--; } } } else { GetRepositoryRegistryClues(m_userToolPaths, wxT("GNUPro unsupported")); for ( i = (size_t) 0 ; i < m_userToolPaths.GetCount(); i++) { ecFileName str(m_userToolPaths[i]); str += "H-i686-cygwin32\\bin"; if(str.IsDir()) { m_userToolPaths[i] = str; } else { m_userToolPaths.Remove(i); i--; } } } #endif // Include the path in the set of potential user paths { wxString strPath; if (wxGetEnv(wxT("PATH"), & strPath)) { wxArrayString arstrPath; ecUtils::Chop(strPath, arstrPath, wxT(';')); for (int i = arstrPath.GetCount()-1;i >= 0; --i) { // Reverse order is important to treat path correctly const ecFileName &strFolder = arstrPath[i]; if (wxT(".") != strFolder && !strFolder.IsEmpty()) { ecFileName strFile(strFolder); strFile += wxT("ls.exe"); if ( strFile.Exists() ) { if (!wxArrayStringIsMember(m_userToolPaths, strFolder)) { m_userToolPaths.Add(strFolder); } if ( m_userToolsDir.IsEmpty() ) { m_userToolsDir = strFolder; } } } } } } // Load current repository from eCos Configuration Tool/Paths/RepositoryDir { wxConfig eCosConfig(wxGetApp().GetSettings().GetConfigAppName(), wxEmptyString, wxEmptyString, wxEmptyString, wxCONFIG_USE_GLOBAL_FILE|wxCONFIG_USE_LOCAL_FILE); wxConfigPathChanger path(& config, wxT("/Repository/")); //if (!eCosConfig.Read(wxT("Folder"), & m_strRepository)) if (!eCosConfig.Read(wxT("/Paths/RepositoryDir"), & m_strRepository)) { #ifdef __WXMSW__ // If we can't find the current folder, look for clues in the registry. wxArrayString arstr; switch (GetRepositoryRegistryClues(arstr, wxT("eCos"))) { case 0: break; case 1: default: m_strRepository = arstr[0]; break; } #elif defined(__WXGTK__) // If we can't find the current folder, look for the latest version // in /opt/ecos m_strRepository = FindLatestVersion(); #else // Unsupported platform m_strRepositor = wxEmptyString; #endif } // If we have set ECOS_REPOSITORY, this overrides whatever we have // read or found. wxString envVarValue = wxGetenv(wxT("ECOS_REPOSITORY")); if (!envVarValue.IsEmpty()) { // Note that ECOS_REPOSITORY has the packages (or ecc) folder in the name. // In order to be in the form that is compatible with configtool operation, // it needs to have that stripped off. envVarValue = ecUtils::PosixToNativePath(envVarValue); // accommodate posix-style ECOS_REPOSITORY value under Cygwin wxString packagesName = wxFileNameFromPath(envVarValue); if (packagesName == wxT("ecc") || packagesName == wxT("packages")) envVarValue = wxPathOnly(envVarValue); m_strRepository = envVarValue; } } #ifdef __WXMSW__ if (m_userToolsDir.IsEmpty()) m_userToolsDir = GetCygwinInstallPath() + wxT("\\bin"); #else if (m_userToolsDir.IsEmpty()) m_userToolsDir = wxT("/bin"); #endif return TRUE; }
void IMU::Initiate() { XsPortInfoArray portInfoArray; xsEnumerateUsbDevices(portInfoArray); if (!portInfoArray.size()) { #ifdef PLATFORM_IS_WINDOWS throw std::runtime_error("IMU: failed to find IMU sensor"); #endif #ifdef PLATFORM_IS_LINUX XsPortInfo portInfo(pDevice->port, XsBaud::numericToRate(pDevice->baudRate)); portInfoArray.push_back(portInfo); #endif } pDevice->mtPort = portInfoArray.at(0); // Open the port with the detected device if (!pDevice->openPort(pDevice->mtPort)) throw std::runtime_error("IMU: could not open port."); Aris::Core::Sleep(10); // Put the device in configuration mode if (!pDevice->gotoConfig()) // Put the device into configuration mode before configuring the device { throw std::runtime_error("IMU: could not put device into configuration mode"); } // Request the device Id to check the device type pDevice->mtPort.setDeviceId(pDevice->getDeviceId()); // Check if we have an MTi / MTx / MTmk4 device if (!pDevice->mtPort.deviceId().isMtMk4()) { throw std::runtime_error("IMU: No MTi / MTx / MTmk4 device found."); } // Check device type if (pDevice->mtPort.deviceId().isMtMk4()) { XsOutputConfiguration config0(XDI_Quaternion, pDevice->sampleRate); XsOutputConfiguration config1(XDI_DeltaQ, pDevice->sampleRate); XsOutputConfiguration config2(XDI_DeltaV, pDevice->sampleRate); XsOutputConfiguration config3(XDI_Acceleration, pDevice->sampleRate); XsOutputConfigurationArray configArray; configArray.push_back(config0); configArray.push_back(config1); configArray.push_back(config2); configArray.push_back(config3); if (!pDevice->setOutputConfiguration(configArray)) { throw std::runtime_error("IMU: Could not configure MTmk4 pDevice-> Aborting."); } } else { throw std::runtime_error("IMU: Unknown device while configuring. Aborting."); } // Put the device in measurement mode if (!pDevice->gotoMeasurement()) { throw std::runtime_error("IMU: Could not put device into measurement mode. Aborting."); } }