Exemplo n.º 1
0
void Configuration::doLine(irr::core::stringc line){
	irr::core::stringc l = line;

	// Remove comments
	irr::s32 first = l.findFirst(irr::c8('#'));
	if (first!=-1)
		l = l.subString(0,first);
	l = l.trim(" \t\n\r");

	// Check that string hash content
	if (l==""){
		return;
	}

	// Split string into hash and value per
	first = l.findFirst(irr::c8('='));
	irr::core::stringc hash = l.subString(0,first).trim();
	irr::core::stringc value = l.subString(first+1,l.size()).trim();

	#if IRRLICHT_VERSION_MAJOR == 1 && IRRLICHT_VERSION_MINOR < 8
		stringc lower = irr::core::stringc(value);
		lower.make_lower();		
	#else
		stringc lower = value.make_lower();
	#endif

	// convert boolean to lower case
	if (lower=="true"){
		value = "true";
	}else if (lower=="false"){
		value = "false";
	}

	// Create setting
	setStringSetting(hash,value);
}
Exemplo n.º 2
0
int Settings::setControllerSerial(int intControllerId, const std::wstring &serial) {
	TelldusCore::MutexLocker locker(&mutex);
	return setStringSetting(Controller, intControllerId,  L"serial", serial, false);
}
Exemplo n.º 3
0
/*
* Set device argument
*/
int Settings::setDeviceParameter(int intDeviceId, const std::wstring &strName, const std::wstring &strValue){
	TelldusCore::MutexLocker locker(&mutex);
	return setStringSetting(Device, intDeviceId, strName, strValue, true);
}
Exemplo n.º 4
0
/*
* Set the device model
*/
int Settings::setModel(int intDeviceId, const std::wstring &strModel){
	TelldusCore::MutexLocker locker(&mutex);
	return setStringSetting(Device, intDeviceId, L"model", strModel, false);
}
Exemplo n.º 5
0
/*
* Set the device vendor
*/
int Settings::setProtocol(int intDeviceId, const std::wstring &strVendor){
	TelldusCore::MutexLocker locker(&mutex);
	return setStringSetting(Device, intDeviceId, L"protocol", strVendor, false);
}
Exemplo n.º 6
0
/*
* Set the name of the device
*/
int Settings::setName(Node type, int intDeviceId, const std::wstring &strNewName){
	TelldusCore::MutexLocker locker(&mutex);
	return setStringSetting(type, intDeviceId, L"name", strNewName, false);
}
Exemplo n.º 7
0
bool Settings::setDeviceState( int intDeviceId, int intDeviceState, const std::wstring &strDeviceStateValue ) {
	TelldusCore::MutexLocker locker(&mutex);
	bool retval = setIntSetting( Settings::Device, intDeviceId, L"state", intDeviceState, true );
	setStringSetting( Settings::Device, intDeviceId, L"stateValue", strDeviceStateValue, true );
	return retval;
}