void Do() { m_OldSettings = g_Game->GetSimulation2()->GetMapSettingsString(); m_NewSettings = *msg->settings; SetSettings(m_NewSettings); }
bool EnvironmentConfig::Load() { bool loaded = ConfigurationToolBase::Load( wxT("config/environment_variables.xml") ); if(loaded) { // make sure that we are using the new format wxXmlNode *node = XmlUtils::FindFirstByTagName(m_doc.GetRoot(), wxT("ArchiveObject")); if(node) { node = XmlUtils::FindFirstByTagName(node, wxT("StringMap")); if(node) { // this is an old version, convert it to the new format EvnVarList vars; std::map<wxString, wxString> envSets; wxString content; wxXmlNode *child = node->GetChildren(); while(child) { if(child->GetName() == wxT("MapEntry")) { wxString key = child->GetPropVal(wxT("Key"), wxT("")); wxString val = child->GetPropVal(wxT("Value"), wxT("")); content << key << wxT("=") << val << wxT("\n"); } child = child->GetNext(); } envSets[wxT("Default")] = content.Trim().Trim(false); vars.SetEnvVarSets(envSets); SetSettings(vars); } } } return loaded; }
void CBitmapFonts::Build(HDC hDC, char *FontName, int *pbase, int FontSize, CBitmapFontSettings *pSettings) { HFONT font; // Base of the font texture ID base = *pbase; SetSettings(pSettings); // Generate storage for 96 chars glGenLists(MaxFont); // Create/Load the font font = CreateFontA(FontSize*(-1),// Height Of Font 0, // Width Of Font 0, // Angle Of Escapement 0, // Orientation Angle /*FW_THIN*/FW_BOLD,// Font Weight FALSE, // Italic FALSE, // Underline FALSE, // Strikeout ANSI_CHARSET,// Character Set Identifier OUT_TT_PRECIS,// Output Precision CLIP_DEFAULT_PRECIS,// Clipping Precision ANTIALIASED_QUALITY,// Output Quality FF_DONTCARE|DEFAULT_PITCH,// Family And Pitch FontName);// Font Name // Selects The Font We Want SelectObject(hDC, font); // Builds 96 characters starting at character 32 (space) wglUseFontBitmaps(hDC, 32, MaxFont, base); *pbase += MaxFont; }
BleBox::BleBox(const int id, const int pollIntervalsec) : m_stoprequested(false) { _log.Log(LOG_STATUS, "BleBox: Create instance"); m_HwdID = id; SetSettings(pollIntervalsec); }
TBPopupWindow::TBPopupWindow(TBWidget *target) : m_target(target) { TBWidgetListener::AddGlobalListener(this); SetSkinBg(TBIDC("TBPopupWindow"), WIDGET_INVOKE_INFO_NO_CALLBACKS); SetSettings(WINDOW_SETTINGS_NONE); }
CLogitechMediaServer::CLogitechMediaServer(const int ID, const std::string IPAddress, const int Port) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; m_IP = IPAddress; m_Port = Port; SetSettings(10, 3000); }
CLogitechMediaServer::CLogitechMediaServer(const int ID, const std::string IPAddress, const int Port, const int PollIntervalsec, const int PingTimeoutms) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; m_IP = IPAddress; m_Port = Port; SetSettings(PollIntervalsec, PingTimeoutms); }
BOOL InitInstance() { // Create the global atoms VNC_POPUPSELN_ATOM = GlobalAddAtom(VNC_POPUPSELN_ATOMNAME); if (VNC_POPUPSELN_ATOM == NULL) return FALSE; SetSettings(); return TRUE; }
void WidgetBase::Init ( boost::shared_ptr<Settings> settings, boost::shared_ptr<const SimulationGroup> simulationGroup, boost::shared_ptr<DerivedData>* dd) { SetSettings (settings); SetSimulationGroup (simulationGroup); SetDerivedData (dd); }
void VRestoreScreen::OnHandleCallback(IVisCallbackDataObject_cl* pData) { if (pData->m_pSender == &Vision::Callbacks.OnProgress) { // Only react to the message if it signals a background restore. VisProgressDataObject_cl* pPDO = (VisProgressDataObject_cl*)pData; if (pPDO->m_eType != VisProgressDataObject_cl::PDOT_BACKGROUND_RESTORE) return; } else if (pData->m_pSender == &Vision::Callbacks.OnBeforeSwapBuffers) { if (m_bGrab) { GrabBackgroundScreenshot(); m_bGrab = false; } } else if (pData->m_pSender == &Vision::Callbacks.OnLeaveForeground) { // Only grab a screen shot if the application is currently running. if (VAppBase::Get()->GetAppState() == VAppHelper::AS_RUNNING) { m_bGrab = true; } else { // Otherwise copy loading screen settings from VLoadingScreen module (if present). VLoadingScreen* pLoadingScreenModule = GetParent()->GetAppModule<VLoadingScreen>(); if (pLoadingScreenModule != NULL) { // But disable the fade out. Settings settings = pLoadingScreenModule->GetSettings(); settings.m_fFadeOutTime = 0.0f; SetSettings(settings); } } } else if (pData->m_pSender == &Vision::Callbacks.OnEnterBackground) { // Save the screen shot only now to reduce the time spent in Vision::Callbacks.OnLeaveForeground. // This is critical on Android devices. SaveBackgroundScreenshot(); } else if (pData->m_pSender == &Vision::Callbacks.OnEnterForeground) { // Reset screen shot grab state in case the application only went to the sleep state on Android. m_bGrab = false; V_SAFE_DELETE_ARRAY(m_pScreenshotBuffer); } VLoadingScreenBase::OnHandleCallback(pData); }
CLogitechMediaServer::CLogitechMediaServer(const int ID, const std::string &IPAddress, const int Port, const std::string &User, const std::string &Pwd, const int PollIntervalsec, const int PingTimeoutms) : m_IP(IPAddress), m_User(User), m_Pwd(Pwd), m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; m_Port = Port; m_bShowedStartupMessage = false; m_iMissedQueries = 0; SetSettings(PollIntervalsec, PingTimeoutms); }
bool Project::Create(const wxString &name, const wxString &description, const wxString &path, const wxString &projType) { m_vdCache.clear(); m_fileName = path + wxFileName::GetPathSeparator() + name + wxT(".project"); m_fileName.MakeAbsolute(); wxXmlNode *root = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("CodeLite_Project")); m_doc.SetRoot(root); m_doc.GetRoot()->AddProperty(wxT("Name"), name); wxXmlNode *descNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Description")); XmlUtils::SetNodeContent(descNode, description); m_doc.GetRoot()->AddChild(descNode); // Create the default virtual directories wxXmlNode *srcNode = NULL, *headNode = NULL; srcNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("VirtualDirectory")); srcNode->AddProperty(wxT("Name"), wxT("src")); m_doc.GetRoot()->AddChild(srcNode); headNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("VirtualDirectory")); headNode->AddProperty(wxT("Name"), wxT("include")); m_doc.GetRoot()->AddChild(headNode); //creae dependencies node wxXmlNode *depNode = new wxXmlNode(NULL, wxXML_ELEMENT_NODE, wxT("Dependencies")); root->AddChild(depNode); SaveXmlFile(); //create build settings SetSettings(new ProjectSettings(NULL)); ProjectSettingsPtr settings = GetSettings(); settings->SetProjectType(projType); SetSettings(settings); SetModified(true); return true; }
WizardDialogSetFunc::WizardDialogSetFunc(wxWindow* parent, process_set prc, usdat* userdata ) { userdat = userdata; master = parent; switch (prc) { case EDIT_MIKE_SETTINGS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("NB_Set")); // wxXmlResource::Get()->LoadDialog(this, parent, wxT("Distribution")); proc = EDIT_MIKE_SETTINGS; SetSettings(); break; case EDITYOUNGGAUSS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("GaussParams")); break; case EDITGAUSSPARAMS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("GaussParams")); break; case EDITSPRINGGAUSS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("GaussParams")); break; case EDITRATEGAUSS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("GaussParams")); break; case WALL_EDIT: wxXmlResource::Get()->LoadDialog(this, parent, wxT("SetWallParams")); break; case WEAKEN_EDIT: wxXmlResource::Get()->LoadDialog(this, parent, wxT("WeakenLayer")); break; case WEAKEN_ALL_EDIT: wxXmlResource::Get()->LoadDialog(this, parent, wxT("WeakenAll")); break; case EDIT_GRAIN_BOUNDARIES: wxXmlResource::Get()->LoadDialog(this, parent, wxT("MakeGrainBoundaries")); break; case EDIT_2ND_HOR_LAYER: wxXmlResource::Get()->LoadDialog(this, parent, wxT("WeakenAdditionalLayer")); break; case EDITLINEARPARAMS: wxXmlResource::Get()->LoadDialog(this, parent, wxT("LinearParams")); break; case WEAKEN_GRAIN: wxXmlResource::Get()->LoadDialog(this, parent, wxT("WeakenAll")); break; } }
PluginWizzflux::PluginWizzflux():PluginInterface("wizzflux", "Various Flux by Wizz.cc", BunnyZtampPlugin) { Flist = GetSettings("ListFlux", QStringList()).toStringList(); if(Flist.count() == 0) { Flist << "lemonde_une" << "lemonde_economie" << "lemonde_culture" << "lemonde_planete"; Flist << "lemonde_cinema" << "lemonde_livres" << "lemonde_sports" << "lemonde_voyages" << "lemonde_international"; Flist << "gala" << "voici" << "yahoo_closer"; Flist << "cnn_latest" << "cnn_usa" << "silicon_fr" << "generation_nt"; Flist << "fdj_loto" << "fdj_euromillions"; Flist << "horoscope_jour_balance" << "horoscope_jour_belier" << "horoscope_jour_cancer" << "horoscope_jour_capricorne"; Flist << "horoscope_jour_gemeaux" << "horoscope_jour_lion" << "horoscope_jour_poissons" << "horoscope_jour_sagittaire"; Flist << "horoscope_jour_scorpion" << "horoscope_jour_taureau" << "horoscope_jour_verseau" << "horoscope_jour_vierge" ; SetSettings("ListFlux", Flist); } }
tERROR cTmProfile::SetTaskSettings(cSerializable* settings) { if( !m_taskObj && m_dad && !m_bTaskGroup ) return errOK; bool bDestroy = !settings; if( !settings ) GetSettings(csdFROM_DATA_TO_TASK, settings); if( !settings ) return errOK; tERROR err = m_bTaskGroup ? errOK : errUNEXPECTED; if( !m_dad ) { if( m_tm->m_bl ) err = m_tm->m_bl->SetSettings(settings); } else if( m_taskObj ) { tBOOL bMakePersistent = cFALSE; if( m_tm->m_bl ) m_tm->m_bl->CustomizeSettings(m_sName.c_str(cCP_ANSI), settings, m_cfg.level(), csdFROM_DATA_TO_TASK, &bMakePersistent); err = m_taskObj->SetSettings(settings); if( bMakePersistent ) SetSettings(csdFROM_TASK_TO_DATA, NULL); } if( m_bTaskGroup ) { cTmProfileEnum child(this); while( child.next() ) child->SetTaskSettings(settings); } if( bDestroy ) g_root->DestroySerializable(settings); if( PR_SUCC(err) ) PR_TRACE((m_tm, prtIMPORTANT, "tm\t%S - task settings applied, task object(0x%08x)", m_sName.data(), (cObj*)m_task)); else PR_TRACE((m_tm, prtERROR, "tm\t%S - task settings not applied(%terr), task object(0x%08x)", m_sName.data(), err, (cObj*)m_task)); return err; }
CLogitechMediaServer::CLogitechMediaServer(const int ID) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; m_IP = ""; m_Port = 0; std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT Address, Port FROM Hardware WHERE ID==%d", m_HwdID); if (result.size() > 0) { m_IP = result[0][0]; m_Port = atoi(result[0][1].c_str()); } SetSettings(10, 3000); }
bool EMVideoClipMixer::LoadData(EMProjectDataLoader* p_opLoader) { EMDialogParameters oParams; char* vpData = reinterpret_cast<char*>(&oParams); string oTest = p_opLoader -> LoadString(); EMVideoTransition::LoadData(p_opLoader); int32 vSize = sizeof(EMDialogParameters); p_opLoader -> LoadBytes(vpData, vSize); SetSettings(reinterpret_cast<int32*>(vpData)); oTest = p_opLoader -> LoadString(); return true; };
void StateGameMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); player1_ = new Player(GetSettings(),GetMap()); player1_->SetGravityY(-9.8); for(int i = 0; i < GetImageLoader()->GetImageSetDictionary().size(); i++) { if(GetImageLoader()->GetImageSetDictionary()[i]->GetImageSetId() == EnumDLL::IMAGESETS::PLAYERIMAGESET) { player1_->SetObjectImageColor(GetImageLoader()->GetImageSetDictionary()[i]->GetImageDictionary()[0]); } } SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }
void VRestoreScreen::SaveBackgroundScreenshot() { // GrabBackgroundScreenshot() needs to be called before if (m_pScreenshotBuffer == NULL) return; const int iScreenWidth = Vision::Video.GetXRes(); const int iScreenHeight = Vision::Video.GetYRes(); ColorCorrect(m_pScreenshotBuffer, iScreenWidth, iScreenHeight, m_fBrightness, m_fSaturation); // use VTEX to scale and save the image Image_cl image; ImageMap_cl colorMap(iScreenWidth, iScreenHeight, 24, static_cast<UBYTE*>(m_pScreenshotBuffer)); image.AddColorMap(colorMap); // Decide which resolution to use for the saved image. int iScaledWidth = 512; while (iScaledWidth > iScreenWidth || iScaledWidth > iScreenHeight) { iScaledWidth /= 2; VASSERT(iScaledWidth > 0); } image.Scale(iScaledWidth, iScaledWidth); const char* szFilename = ":app_cache/vision_background.bmp"; IVFileOutStream* pOut = Vision::File.Create(szFilename); const bool bSaved = (image.SaveBMP(pOut) == VERR_NOERROR); V_SAFE_DELETE_ARRAY(m_pScreenshotBuffer); if (pOut != NULL) pOut->Close(); if (bSaved) { // Set up loading screen settings. Settings settings(szFilename); settings.m_eAspectRatioAlignment = ALIGN_NONE; SetSettings(settings); } else { hkvLog::Dev("VRestoreScreen: Could not save backgrounding screenshot\n"); } }
bool PluginRFID::HttpRequestHandle(HTTPRequest & request) { QString uri = request.GetURI(); if (uri.startsWith("/vl/rfid.jsp")) { QString serialnumber = request.GetArg("sn"); QString tagId = request.GetArg("t"); SetSettings("global/LastTag", tagId); Ztamp * z = ZtampManager::GetZtamp(this, tagId.toAscii()); Bunny * b = BunnyManager::GetBunny(this, serialnumber.toAscii()); b->SetPluginSetting(GetName(), "LastTag", tagId); if (z->OnRFID(b)) return true; if (b->OnRFID(QByteArray::fromHex(tagId.toAscii()))) return true; } return false; }
Document::Document (const QString& filename, QObject *plugin) : DocURL_ (QUrl::fromLocalFile (filename)) , Plugin_ (plugin) { SetSettings (); QFile file (filename); if (!file.open (QIODevice::ReadOnly)) { qWarning () << Q_FUNC_INFO << "unable to open file" << file.fileName () << file.errorString (); return; } QDomDocument doc; if (!doc.setContent (file.readAll (), true)) { qWarning () << Q_FUNC_INFO << "malformed XML in" << filename; return; } FB2Converter conv (this, doc); auto textDoc = conv.GetResult (); const auto& defaultFont = XmlSettingsManager::Instance () .property ("DefaultFont").value<QFont> (); textDoc->setDefaultFont (defaultFont); textDoc->setPageSize (QSize { XmlSettingsManager::Instance ().property ("PageWidth").toInt (), XmlSettingsManager::Instance ().property ("PageHeight").toInt () }); SetDocument (textDoc); Info_ = conv.GetDocumentInfo (); TOC_ = conv.GetTOC (); }
CLogitechMediaServer::CLogitechMediaServer(const int ID) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; m_IP = ""; m_Port = 0; m_User = ""; m_Pwd = ""; m_bShowedStartupMessage = false; std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT Address, Port, Username, Password FROM Hardware WHERE ID==%d", m_HwdID); if (result.size() > 0) { m_IP = result[0][0]; m_Port = atoi(result[0][1].c_str()); m_User = result[0][2]; m_Pwd = result[0][3]; } SetSettings(10, 3000); }
void ProtoWrapper::handleAccountCreated (Tp::PendingOperation *po) { if (po->isError ()) { qWarning () << Q_FUNC_INFO << po->errorName () << po->errorMessage (); emit gotEntity (Util::MakeNotification ("Azoth", tr ("Failed to create account: %1 (%2).") .arg (po->errorName ()) .arg (po->errorMessage ()), PCritical_)); return; } auto pacc = qobject_cast<Tp::PendingAccount*> (po); auto acc = handleNewAccount (pacc->account ()); if (acc && PendingSettings_.contains (pacc)) acc->SetSettings (PendingSettings_.take (pacc)); }
void StateEditorMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); editorOverLayController_ = new EditorOverLayController(settings, imageLoader); SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }
CKodi::CKodi(const int ID) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; SetSettings(10, 3000); }
void web::ProcessWebClients() { // listen for incoming clients EthernetClient client = m_server->available(); if (client) { bool bReset = false; #ifdef ARDUINO FILE stream_file; FILE * pFile = &stream_file; setup_sendbuf(); fdev_setup_stream(pFile, stream_putchar, NULL, _FDEV_SETUP_WRITE); stream_file.udata = &client; #else FILE * pFile = fdopen(client.GetSocket(), "w"); #endif freeMemory(); trace(F("Got a client\n")); //ShowSockStatus(); KVPairs key_value_pairs; char sPage[35]; if (!ParseHTTPHeader(client, &key_value_pairs, sPage, sizeof(sPage))) { trace(F("ERROR!\n")); ServeError(pFile); } else { trace(F("Page:%s\n"), sPage); //ShowSockStatus(); if (strcmp(sPage, "bin/setSched") == 0) { if (SetSchedule(key_value_pairs)) { if (GetRunSchedules()) ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/setZones") == 0) { if (SetZones(key_value_pairs)) { ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/delSched") == 0) { if (DeleteSchedule(key_value_pairs)) { if (GetRunSchedules()) ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/setQSched") == 0) { if (SetQSched(key_value_pairs)) { ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/settings") == 0) { if (SetSettings(key_value_pairs)) { ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/manual") == 0) { if (ManualZone(key_value_pairs)) { ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/run") == 0) { if (RunSchedules(key_value_pairs)) { ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else ServeError(pFile); } else if (strcmp(sPage, "bin/factory") == 0) { ResetEEPROM(); ReloadEvents(); ServeHeader(pFile, 200, "OK", false); } else if (strcmp(sPage, "bin/reset") == 0) { ServeHeader(pFile, 200, "OK", false); bReset = true; } else if (strcmp(sPage, "json/schedules") == 0) { JSONSchedules(key_value_pairs, pFile); } else if (strcmp(sPage, "json/zones") == 0) { JSONZones(key_value_pairs, pFile); } else if (strcmp(sPage, "json/settings") == 0) { JSONSettings(key_value_pairs, pFile); } else if (strcmp(sPage, "json/state") == 0) { JSONState(key_value_pairs, pFile); } else if (strcmp(sPage, "json/schedule") == 0) { JSONSchedule(key_value_pairs, pFile); } else if (strcmp(sPage, "json/wcheck") == 0) { JSONwCheck(key_value_pairs, pFile); } #ifdef LOGGING else if (strcmp(sPage, "json/logs") == 0) { JSONLogs(key_value_pairs, pFile); } else if (strcmp(sPage, "json/tlogs") == 0) { JSONtLogs(key_value_pairs, pFile); } #endif else if (strcmp(sPage, "ShowSched") == 0) { freeMemory(); ServeSchedPage(pFile); } else if (strcmp(sPage, "ShowZones") == 0) { freeMemory(); ServeZonesPage(pFile); } else if (strcmp(sPage, "ShowEvent") == 0) { ServeEventPage(pFile); } else if (strcmp(sPage, "ReloadEvent") == 0) { ReloadEvents(true); ServeEventPage(pFile); } else { if (strlen(sPage) == 0) strcpy(sPage, "index.htm"); // prepend path memmove(sPage + 5, sPage, sizeof(sPage) - 5); memcpy(sPage, "/web/", 5); sPage[sizeof(sPage)-1] = 0; trace(F("Serving Page: %s\n"), sPage); SdFile theFile; if (!theFile.open(sPage, O_READ)) Serve404(pFile); else { if (theFile.isFile()) ServeFile(pFile, sPage, theFile, client); else Serve404(pFile); theFile.close(); } } } #ifdef ARDUINO flush_sendbuf(client); // give the web browser time to receive the data delay(1); #else fflush(pFile); fclose(pFile); #endif // close the connection: client.stop(); if (bReset) sysreset(); } }
CPanasonic::CPanasonic(const int ID, const int PollIntervalsec, const int PingTimeoutms) : m_stoprequested(false) { m_HwdID = ID; SetSettings(PollIntervalsec, PingTimeoutms); }
CPanasonic::CPanasonic(const int ID) : m_stoprequested(false) { m_HwdID = ID; SetSettings(10, 3000); }
CKodi::CKodi(const int ID, const int PollIntervalsec, const int PingTimeoutms) : m_stoprequested(false), m_iThreadsRunning(0) { m_HwdID = ID; SetSettings(PollIntervalsec, PingTimeoutms); }
BOOL __stdcall AtlTraceLoadSettingsA(const CHAR *pszFileName, DWORD_PTR dwProcess /* = 0 */) { CHAR szFileName[_MAX_PATH]; if(!pszFileName) { CHAR szDrive[_MAX_DRIVE]; CHAR szDir[_MAX_DIR]; CHAR szFName[_MAX_FNAME]; CHAR szExt[_MAX_EXT]; DWORD dwret = ::GetModuleFileNameA(NULL, szFileName, MAX_PATH); if( dwret == 0 || dwret == MAX_PATH ) return FALSE; #if _SECURE_ATL ATL_CRT_ERRORCHECK(_splitpath_s(szFileName, szDrive, _countof(szDrive), szDir, _countof(szDir), szFName, _countof(szFName), szExt, _countof(szExt))); ATL_CRT_ERRORCHECK(strncpy_s(szExt, _MAX_EXT, TRACE_SETTINGS_EXT, sizeof(TRACE_SETTINGS_EXT))); ATL_CRT_ERRORCHECK(_makepath_s(szFileName, _MAX_PATH, szDrive, szDir, szFName, szExt)); #else _splitpath(szFileName, szDrive, szDir, szFName, szExt); strcpy(szExt, ".trc"); _makepath(szFileName, szDrive, szDir, szFName, szExt); #endif pszFileName = szFileName; } if(pszFileName) { if(-1 != GetFileAttributesA(pszFileName)) { // file exists CHAR szSection[MAX_PATH], szKey[MAX_PATH], szValue[MAX_PATH]; CHAR szName[MAX_PATH]; UINT nModules, nCategories, nStatus, nLevel; UINT nModule; CAtlTraceProcess *pProcess; CAtlTraceModule *pModule; CAtlTraceCategory *pCategory; CHAR *pszProcess = "Process"; CHAR cEnabled, cFuncAndCategoryNames, cFileNameAndLineInfo; CAtlAllocator *pAllocator = &g_Allocator; if (dwProcess) pAllocator = reinterpret_cast<CAtlAllocator*>(dwProcess); pProcess = pAllocator->GetProcess(); ATLASSERT(pProcess); if(!pProcess) return FALSE; pProcess->m_bLoaded = true; ::GetPrivateProfileStringA(pszProcess, "Info", "", szValue, MAX_PATH, pszFileName); szValue[MAX_PATH - 1] = 0; #if _SECURE_ATL if(5 != sscanf_s(szValue, "ModuleCount:%u, Level:%u, Enabled:%c, " "FuncAndCategoryNames:%c, FileNameAndLineNo:%c", &nModules, &pProcess->m_nLevel, &cEnabled, sizeof(cEnabled), &cFuncAndCategoryNames, sizeof(cFuncAndCategoryNames), &cFileNameAndLineInfo, sizeof(cFileNameAndLineInfo))) #else if(5 != sscanf(szValue, "ModuleCount:%u, Level:%u, Enabled:%c, " "FuncAndCategoryNames:%c, FileNameAndLineNo:%c", &nModules, &pProcess->m_nLevel, &cEnabled, &cFuncAndCategoryNames, &cFileNameAndLineInfo)) #endif { return FALSE; } pProcess->m_bEnabled = cEnabled != 'f'; pProcess->m_bFuncAndCategoryNames = cFuncAndCategoryNames != 'f'; pProcess->m_bFileNameAndLineNo = cFileNameAndLineInfo != 'f'; for(UINT i = 0; i < nModules; i++) { #if _SECURE_ATL if(-1 == sprintf_s(szKey, MAX_PATH, "Module%d", i+1)) return FALSE; #else sprintf(szKey, "Module%d", i+1); #endif ::GetPrivateProfileStringA(pszProcess, szKey, "", szSection, MAX_PATH, pszFileName); szSection[MAX_PATH -1] = 0; ::GetPrivateProfileStringA(szSection, "Name", "", szName, MAX_PATH, pszFileName); szName[MAX_PATH -1] = 0; if(!pAllocator->FindModule(CA2W(szName), &nModule)) continue; pModule = pAllocator->GetModule(nModule); ATLASSERT(pModule); if(!pModule) continue; ::GetPrivateProfileStringA(szSection, "Settings", "", szValue, MAX_PATH, pszFileName); szValue[MAX_PATH -1] = 0; #if _SECURE_ATL if(3 != sscanf_s(szValue, "CategoryCount:%u, Level:%u, Status:%u", &nCategories, &nLevel, &nStatus)) #else if(3 != sscanf(szValue, "CategoryCount:%u, Level:%u, Status:%u", &nCategories, &nLevel, &nStatus)) #endif continue; SetSettings(pModule, nLevel, nStatus); for(UINT j = 0; j < nCategories; j++) { #if _SECURE_ATL if(-1 == sprintf_s(szKey, MAX_PATH, "Category%d", j+1)) return FALSE; #else sprintf(szKey, "Category%d", j+1); #endif ::GetPrivateProfileStringA(szSection, szKey, "", szValue, MAX_PATH, pszFileName); szValue[MAX_PATH -1] = 0; #if _SECURE_ATL if(3 != sscanf_s(szValue, "Level:%u, Status:%u, Name:%s", &nLevel, &nStatus, szName, _countof(szName))) #else if(3 != sscanf(szValue, "Level:%u, Status:%u, Name:%s", &nLevel, &nStatus, szName)) #endif continue; UINT iCategory = pModule->m_iFirstCategory; while( iCategory != UINT( -1 ) ) { pCategory = pAllocator->GetCategory(iCategory); if( lstrcmpA(CW2A(pCategory->Name()), szName) == 0 ) { SetSettings(pCategory, nLevel, nStatus); } iCategory = pCategory->m_iNextCategory; } } } NotifyTool(); } } return TRUE; }