Esempio n. 1
0
	float res::getConfAsFloat(std::string section, std::string key) {
		if(!confExists(section, key))
			return 0.0;
			
		float convertedValue;
		std::istringstream buffer(mRes->mConfig[section][key]);
		buffer >> convertedValue;
		return convertedValue;
	}
Esempio n. 2
0
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
void CApplication::confLoad()
{
  DynamicJsonBuffer jsonBuffer;

  if (!confExists()) 
    confSave();

  if (confExists()) {
    int   size = fileGetSize(CAPP_CONF_FILE);
    char* strJson = new char[size + 1];

    fileGetContent(CAPP_CONF_FILE, strJson, size + 1);
    JsonObject& root = jsonBuffer.parseObject(strJson);

    m_cpuBoost           = root["cpuBoost"];
    m_otaBaseUrl         = (const char *)root["otaBaseUrl"];

    m_gpiodEmul          = root["emul"];
    m_gpiodMode          = root["mode"];
    m_gpiodLock          = root["lock"];
    m_gpiodDisable       = root["disable"];

    m_gpiodInDebounce[0] = root["in0Debounce"];
    m_gpiodInDebounce[1] = root["in1Debounce"];
    m_gpiodInDebounce[2] = root["in2Debounce"];
    m_gpiodInDebounce[3] = root["in3Debounce"];

    m_gpiodOutDefRun[0]  = root["out0DefRun"];
    m_gpiodOutDefRun[1]  = root["out1DefRun"];
    m_gpiodOutDefRun[2]  = root["out2DefRun"];
    m_gpiodOutDefRun[3]  = root["out3DefRun"];

    m_gpiodUdmDefRun[0]  = root["udm0DefRun"];
    m_gpiodUdmDefRun[1]  = root["udm1DefRun"];

    delete[] strJson;
    }
  } // confLoad
Esempio n. 3
0
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
void CApplication::confDelete() {
  if (confExists()) 
    fileDelete(CAPP_CONF_FILE);
  } // confDelete
Esempio n. 4
0
	std::string res::getConf(std::string section, std::string key) {
		return confExists(section, key) ? mRes->mConfig[section][key] : "";
	}