Exemplo n.º 1
0
void plugin::setLedName ( const QString& channel, const QString& name, bool updateDatabase )
{
    if ( !m_ios.contains(channel) ) return;
    if (name.isNull()) return;

    plugin::iochannel& io = m_ios[channel];

    io.name = name;

    // change name property
    SceneDocument sc = SceneDocument::createModelChangeItem("leds");
    sc.setData("channel", channel);
    sc.setData("name", name);
    sc.setData("value", io.value);
    sc.setData("moodlight", io.moodlight);
    changeProperty(sc.getData());

    if (updateDatabase) {
        // save name to database
        QVariantMap settings;
        settings[QLatin1String("channel")] = channel;
        settings[QLatin1String("name")] = name;
        settings[QLatin1String("isname")] = true;
        changeConfig("channelname_" + channel.toUtf8(),settings);
    }
}
Exemplo n.º 2
0
/**
 * Resets the configuration back to default
 */
void Config::reset()
{
	changeConfig(constants::MONITORINTERVAL, constants::DEFAULT);
	changeConfig(constants::NUMOFRECORDS, constants::DEFAULT);
	changeConfig(constants::BLK_READ, constants::DEFAULT);
	changeConfig(constants::BLK_READ_S, constants::DEFAULT);
	changeConfig(constants::KB_READ_S, constants::DEFAULT);
	changeConfig(constants::BLK_WRITE, constants::DEFAULT);
	changeConfig(constants::BLK_WRITE_S, constants::DEFAULT);
	changeConfig(constants::KB_WRITES_S, constants::DEFAULT);
}
Exemplo n.º 3
0
// service a client request; test the opcode and then do appropriate servicing
void CPicoServSession::DispatchMessageL(const RMessage &aMessage)
{
	switch (aMessage.Function()) {
		case PicoMsgLoadState: 
			if(!rom_data) User::Leave(-1); // no ROM
			User::LeaveIfError(saveLoadGame(1));
			gamestate = PGS_Running;
			return;

		case PicoMsgSaveState:
			if(!rom_data) User::Leave(-1);
			User::LeaveIfError(saveLoadGame(0));
			gamestate = PGS_Running;
			return;

		case PicoMsgLoadROM:
			loadROM();
			return;
		
		case PicoMsgResume:
			if(rom_data) gamestate = PGS_Running;
			return;

		case PicoMsgReset: 
			if(rom_data) {
				PicoReset(0);
				pico_was_reset = 1;
				gamestate = PGS_Running;
			}
			return;

		case PicoMsgKeys:
			gamestate = PGS_KeyConfig;
			return;

		case PicoMsgPause:
			gamestate = PGS_Paused;
			return;

		case PicoMsgQuit:
			DEBUGPRINT(_L("got quit msg."));
			gamestate = PGS_Quit;
			return;

		// config change
		case PicoMsgConfigChange: // launcher -> emu
			changeConfig();
			return;

		case PicoMsgRetrieveConfig: // emu -> launcher
			sendConfig();
			return;

		case PicoMsgRetrieveDebugStr: // emu -> launcher
			sendDebug();
			return;

		// requests we don't understand at all are a different thing,
		// so panic the client here, this function also completes the message
		default:
			PanicClient(EBadRequest);
			return;
	}
}