Пример #1
0
void BatteryNotifier::batteryStateChanged(MeeGo::QmBattery::BatteryState state)
{
    switch(state) {
    case MeeGo::QmBattery::StateFull:
        stopLowBatteryNotifier();
        removeNotification(QStringList() << "x-nemo.battery");
        sendNotification(NotificationChargingComplete);
        break;

    case MeeGo::QmBattery::StateOK:
        stopLowBatteryNotifier();
        break;

    case MeeGo::QmBattery::StateLow:
        if (qmBattery->getChargingState() != MeeGo::QmBattery::StateCharging) {
            // The low battery notifications should be sent only if the battery is not charging
            startLowBatteryNotifier();
        }
        break;

    case MeeGo::QmBattery::StateEmpty:
        sendNotification(NotificationRechargeBattery);
        break;

    case MeeGo::QmBattery::StateError:
        break;
    }
}
Пример #2
0
TokenItem* TokenMenu::addToken(QString text, QString filePath, int size, bool special, GameObject *gameObject)
{
    // Check if the list already contains a token with the same text before insertion.
    QList<QListWidgetItem*> items = ui->m_tokenList->findItems(text, Qt::MatchExactly);
    if (items.empty()) {
        TokenItem *item = new TokenItem(filePath, text, size, special);

        if (!item->isPixLoaded()) {
            emit sendNotification(QString("L'image spécifiée par le chemin %1 n'a pas pu être chargée.")
                .arg(filePath));
        }

        item->setGameObject(gameObject);

        // push the item into the database
        RepositoryManager::s_TokenItemRepository.insertTokenItem(item);

        // add the item to the tokenList
        ui->m_tokenList->addItem(item);
        ui->m_tokenList->setCurrentItem(item);

        // Notifies everyone that an item has been added
        QString msg = QString("%1").arg(item->id());
        m_SenderClient->sendMessageToServer(msg, (quint16) TokenMenuCodes::ADD_TOKEN);

        return item;
    }
    else {
        emit sendNotification(QString("Un jeton nommé %1 existe déjà.").arg(text));

        return NULL;
    }
}
Пример #3
0
void LoginCommand::execute(Notification& noti)
{
	const string& name=noti.m_strNotiName;	
	void* data=noti.m_pData;
	if(StringHelper::isEqual(name,LoginFacade::COMMAND_EXIT))
	{
		sendNotification(LoginFacade::NOTIFICATION_CLOSE);
	}
	else if(StringHelper::isEqual(name,LoginFacade::COMMAND_LOGIN))
	{
		LoginVO vo=*((LoginVO*)data);
		IProxy* proxy=getFacade()->getProxy(LoginFacade::PROXY_LOGIN);
		LoginProxy* lp=dynamic_cast<LoginProxy*>(proxy);
		if(lp)
		{
			bool ret=lp->checkLogin(vo);
			if(ret)
			{
				//±¾µØ¼ì²é
				sendNotification(LoginFacade::NOTIFICATION_LOGIN_SUCESS);
			}
			else
			{
				sendNotification(LoginFacade::NOTIFICATION_LOGIN_FAIL);
			}

		}
	}
}
Пример #4
0
void EquipmentCommand::execute(Notification& noti)
{
    const string& name=noti.m_strNotiName;
    void* data=noti.m_pData;
    if(StringHelper::isEqual(name,EquipmentFacade::COMMAND_SWITCH_SEARCHPAGE))
    {
        sendNotification(EquipmentFacade::NOTIFICATION_SWITCH_SRH_SUCCESS);
    }
    else if(StringHelper::isEqual(name,EquipmentFacade::COMMAND_SWITCH_ARSENALPAGE))
    {
        sendNotification(EquipmentFacade::NOTIFICATION_SWITCH_ARL_SUCCESS);
    }
    /**
    else if(StringHelper::isEqual(name,EquipmentFacade::COMMAND_LOGIN))
    {
    	EquipmentVO vo=*((EquipmentVO*)data);
    	IProxy* proxy=getFacade()->getProxy(EquipmentFacade::PROXY_LOGIN);
    	EquipmentProxy* lp=dynamic_cast<EquipmentProxy*>(proxy);
    	if(lp)
    	{
    		bool ret=lp->checkEquipment(vo);
    		if(ret)
    		{
    			//±¾µØ¼ì²é
    			sendNotification(EquipmentFacade::NOTIFICATION_LOGIN_SUCESS);
    		}
    		else
    		{
    			sendNotification(EquipmentFacade::NOTIFICATION_LOGIN_FAIL);
    		}

    	}
    }
    */
}
Пример #5
0
void BatteryNotifier::applyChargingState(QtMobility::QSystemBatteryInfo::ChargingState state)
{
    switch(state) {
    case QtMobility::QSystemBatteryInfo::Charging:
        if (batteryInfo->chargerType() == QtMobility::QSystemBatteryInfo::USB_100mACharger) {
            sendNotification(NotificationNoEnoughPower);
        } else {
            // The low battery notifications should not be sent when the battery is charging
            stopLowBatteryNotifier();

            removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery");
            sendNotification(NotificationCharging);
        }
        break;

    case QtMobility::QSystemBatteryInfo::NotCharging:
        removeNotification(QStringList() << "x-nemo.battery");
        utiliseLED(false, QString("PatternBatteryCharging"));
        break;

    case QtMobility::QSystemBatteryInfo::ChargingError:
        sendNotification(NotificationChargingNotStarted);
        break;
    }
}
Пример #6
0
TTErr TTClock::setDuration(const TTValue& value)
{
    if (value.size() == 1) {
        
        if (value[0].type() == kTypeFloat64) {
            
            mDuration = value[0];
            
            // update offset
            if (mDuration < mOffset) {
                
                mOffset = mDuration;
                
                sendNotification(TTSymbol("ClockOffsetChanged"), mOffset);
            }
            
            mPosition = mOffset / mDuration;
            mDate = mOffset;
            
            sendNotification(TTSymbol("ClockDurationChanged"), mDuration);
            
            return kTTErrNone;
        }
    }
    
    return kTTErrGeneric;
}
Пример #7
0
void BatteryNotifier::chargingStateChanged(MeeGo::QmBattery::ChargingState state)
{
    switch(state) {
    case MeeGo::QmBattery::StateCharging:
        if (qmBattery->getChargerType() == MeeGo::QmBattery::USB_100mA) {
            sendNotification(NotificationNoEnoughPower);
        } else {
            // The low battery notifications should not be sent when the battery is charging
            stopLowBatteryNotifier();

            removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery");
            sendNotification(NotificationCharging);
        }
        break;

    case MeeGo::QmBattery::StateNotCharging:
        removeNotification(QStringList() << "x-nemo.battery");
        utiliseLED(false, QString("PatternBatteryCharging"));
        break;

    case MeeGo::QmBattery::StateChargingFailed:
        sendNotification(NotificationChargingNotStarted);
        break;
    }
}
Пример #8
0
void BatteryNotifier::applyChargingState(int, QBatteryInfo::ChargingState state)
{
    switch(state) {
    case QBatteryInfo::Charging:
        if (batteryInfo->chargerType() == QBatteryInfo::USBCharger && batteryInfo->currentFlow(0) <= 100) {
            sendNotification(NotificationNoEnoughPower);
        } else {
            // The low battery notifications should not be sent when the battery is charging
            stopLowBatteryNotifier();

            removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery");
            sendNotification(NotificationCharging);
        }
        break;

    case QBatteryInfo::NotCharging:
        sendNotification(NotificationChargingNotStarted);
        break;

    default:
        removeNotification(QStringList() << "x-nemo.battery");
        break;

    }
}
Пример #9
0
void BatteryNotifier::applyBatteryStatus(int, QBatteryInfo::BatteryStatus status)
{
    switch(status) {
    case QBatteryInfo::BatteryFull:
        stopLowBatteryNotifier();
        removeNotification(QStringList() << "x-nemo.battery");
        sendNotification(NotificationChargingComplete);
        break;

    case QBatteryInfo::BatteryOk:
        stopLowBatteryNotifier();
        break;

    case QBatteryInfo::BatteryLow:
        if (batteryInfo->chargingState(0) != QBatteryInfo::Charging) {
            // The low battery notifications should be sent only if the battery is not charging
            startLowBatteryNotifier();
        }
        break;

    case QBatteryInfo::BatteryEmpty:
        sendNotification(NotificationRechargeBattery);
        break;

    default:
        break;
    }
}
Пример #10
0
void BatteryNotifier::applyChargingState(QBatteryInfo::ChargingState state)
{
    switch(state) {
    case QBatteryInfo::Charging:
        if (batteryInfo->chargerType() == QBatteryInfo::USBCharger && batteryInfo->currentFlow() <= 100) {
            sendNotification(NotificationNoEnoughPower);
        } else {
            // The low battery notifications should not be sent when the battery is charging
            stopLowBatteryNotifier();

            removeNotification(QStringList() << "x-nemo.battery.removecharger" << "x-nemo.battery.chargingcomplete" << "x-nemo.battery.lowbattery");
            sendNotification(NotificationCharging);
        }
        break;

    case QBatteryInfo::IdleChargingState:
        if (batteryInfo->levelStatus() != QBatteryInfo::LevelFull) {
            sendNotification(NotificationChargingNotStarted);
            return;
        }

        // otherwise fallthrough, not charging because capacity is full
    default:
        removeNotification(QStringList() << "x-nemo.battery");
        break;

    }
}
Пример #11
0
void BatteryNotifier::applyPSMState(MeeGo::QmDeviceMode::PSMState psmState)
{
    if (psmState == MeeGo::QmDeviceMode::PSMStateOff) {
        sendNotification(NotificationExitingPSM);
    } else if (psmState == MeeGo::QmDeviceMode::PSMStateOn) {
        sendNotification(NotificationEnteringPSM);
    }
}
Пример #12
0
void BatteryNotifier::devicePSMStateChanged(MeeGo::QmDeviceMode::PSMState PSMState)
{
    if (PSMState == MeeGo::QmDeviceMode::PSMStateOff) {
        sendNotification(NotificationExitingPSM);
    } else if (PSMState == MeeGo::QmDeviceMode::PSMStateOn) {
        sendNotification(NotificationEnteringPSM);
    }
}
Пример #13
0
void BatteryNotifier::sendNotification(BatteryNotifier::NotificationID id)
{
    switch(id) {
    case NotificationCharging:
        sendNotification("x-nemo.battery",
                //% "Charging"
                qtTrId("qtn_ener_charging"));
        break;

    case NotificationChargingComplete:
        sendNotification("x-nemo.battery.chargingcomplete",
                //% "Charging complete"
                qtTrId("qtn_ener_charcomp"));
        break;

    case NotificationRemoveCharger:
        sendNotification("x-nemo.battery.removecharger",
                //% "Disconnect charger from power supply to save energy"
                qtTrId("qtn_ener_remcha"));
        break;

    case NotificationChargingNotStarted:
        sendNotification("x-nemo.battery.chargingnotstarted",
                //% "Charging not started. Replace charger."
                qtTrId("qtn_ener_repcharger"));
        break;

    case NotificationRechargeBattery:
        sendNotification("x-nemo.battery.recharge",
                //% "Recharge battery"
                qtTrId("qtn_ener_rebatt"));
        break;

    case NotificationEnteringPSM:
        sendNotification("x-nemo.battery.enterpsm",
                //% "Entering power save mode"
                qtTrId("qtn_ener_ent_psnote"));
        break;

    case NotificationExitingPSM:
        sendNotification("x-nemo.battery.exitpsm",
                //% "Exiting power save mode"
                qtTrId("qtn_ener_exit_psnote"));
        break;

    case NotificationLowBattery:
        sendNotification("x-nemo.battery.lowbattery",
                //% "Low battery"
                qtTrId("qtn_ener_lowbatt"));
        break;

    case NotificationNoEnoughPower:
        sendNotification("x-nemo.battery.notenoughpower",
                //% "Not enough power to charge"
                qtTrId("qtn_ener_nopowcharge"), "icon-m-energy-management-insufficient-power");
        break;
    }
}
Пример #14
0
void Listener::notify(NotificationDomain domain,
	NotificationEvent event, uint32 sequence, const CssmData &data)
{
	Connection &current = Server::active().connection();
	RefPointer<Notification> message = new Notification(domain, event, sequence, data);
	if (current.inSequence(message)) {
		StLock<Mutex> _(setLock);
		sendNotification(message);
		while (RefPointer<Notification> next = current.popNotification())
			sendNotification(next);
	}
}
Пример #15
0
void AMCPDevice::parseMultiline(const QString& line)
{
    if (line.length() > 0)
        this->response.append(line);
    else if (line.length() == 0 && this->line.length() == 0 && this->previousLine.length() == 0)
        sendNotification();
}
Пример #16
0
void NTFCDevice::setConnected()
{
    this->connected = true;
    this->command = NTFCDevice::CONNECTIONSTATE;

    sendNotification();
}
Пример #17
0
QVariant Subscribe::customCommand(const QString &command, const QList<QVariant> &args)
{
    auto assertWhere = QString("Custom command \"%1\" from module \"%2\"")
            .arg(command).arg(name()).toLocal8Bit();
    auto assertWhatInvalidArgs = "Invalid number of arguments!";
    auto assertWhatInvalidCommand = "Invalid command";

    if (command == "sendNotification")
    {
        Q_ASSERT_X(args.size() == 3, assertWhere.data(), assertWhatInvalidArgs);
        auto gid = args[0].toLongLong();
        auto tag = args[1].toString();
        auto text = args[2].toString();
        sendNotification(gid, tag, text);
    }
    else if (command == "sendForward")
    {
        Q_ASSERT_X(args.size() == 3, assertWhere.data(), assertWhatInvalidArgs);
        auto gid = args[0].toLongLong();
        auto tag = args[1].toString();
        auto msgId = args[2].toLongLong();
        sendForward(gid, tag, msgId);
    }
    else
        Q_ASSERT_X(false, assertWhere.data(), assertWhatInvalidCommand);

    return QVariant();
}
void METKAutoFading::resetAllCurrentOccluders()
{	
	Appearance oldValues;
	string objName = "";
	set<string>::iterator iter;
	for (iter = currentFading.begin(); iter != currentFading.end(); iter++)
	{
		objName = *iter;
		std::cout << "Wiedereinblenden: " << objName << std::endl;

		if (htOldValues.find(objName))
		{
			oldValues = *(htOldValues.find(objName));
			myObjMgr->setObjAttribute(objName,LAY_APPEARANCE, INF_TRANSPARENCY, new double(oldValues.Transparency), omINFOTYPE_DOUBLE, true, false);
			myObjMgr->setObjAttribute(objName,LAY_APPEARANCE, INF_SILHOUETTEWIDTH, new double(oldValues.SilhouetteWidth), omINFOTYPE_DOUBLE, true, false);
			vec3* tempVec3 = new vec3(oldValues.SilhouetteColor[0],oldValues.SilhouetteColor[1],oldValues.SilhouetteColor[2]);
			myObjMgr->setObjAttribute(objName,LAY_APPEARANCE, INF_SILHOUETTECOLOR, tempVec3, omINFOTYPE_DOUBLE, true, false);
			delete tempVec3;
			myObjMgr->setObjAttribute(objName,LAY_APPEARANCE, INF_SILHOUETTE, new bool(oldValues.SilhouetteVisible), omINFOTYPE_BOOL, true, false);
		}
		else
			std::cout << "No oldValues found in Hashtable for " << objName << std::endl;

		htOldValues.remove(objName);
	}

	currentFading.clear();
	htOldValues.getTable()->clear();

	sendNotification();
}
Пример #19
0
void AMCPDevice::parseTwoline(const QString& line)
{
    if (line.length() > 0)
         this->response.append(line);
    else if (line.length() == 0 && this->response.count() > 1)
        sendNotification();
}
Пример #20
0
void BatteryNotifier::applyChargerType(QBatteryInfo::ChargerType type)
{
    switch(type) {
    case QBatteryInfo::UnknownCharger:
        /*
         * After the user plugs out the charger from the device, this system
         * banner is displayed to remind the users to unplug charger from
         * the power supply for conserving energy.  Remove charger
         * notification should not be shown in case if USB cable is used for
         * charging the device.
         */
        if (chargerType == QBatteryInfo::WallCharger) {
            removeNotification(QStringList() << "x-nemo.battery" << "x-nemo.battery.chargingcomplete");
            sendNotification(NotificationRemoveCharger);
        }

        if (chargerType != QBatteryInfo::UnknownCharger && chargerType != QBatteryInfo::USBCharger && batteryInfo->batteryStatus(0) == QBatteryInfo::BatteryLow && batteryInfo->chargingState(0) != QBatteryInfo::Charging) {
            // A charger was connected but is no longer connected and the battery is low, so start low battery notifier
            startLowBatteryNotifier();
        }
        break;

    default:
        break;
    }

    chargerType = type;
}
Пример #21
0
TTErr TTDictionaryBase::clear()
{
//	mList->clear();
	mMap.clear();
	sendNotification("change", TTValue());
	return kTTErrNone;
}
Пример #22
0
//
// Send a notification to all registered listeners
//
void Listener::notify(NotificationDomain domain,
	NotificationEvent event, const CssmData &data)
{
	RefPointer<Notification> message = new Notification(domain, event, 0, data);
	StLock<Mutex> _(setLock);
	sendNotification(message);
}
Пример #23
0
bool AWActions::runCmd(const QString cmd) const
{
    qCDebug(LOG_AW) << "Cmd" << cmd;

    sendNotification(QString("Info"), i18n("Run %1", cmd));

    return QProcess::startDetached(cmd);
}
Пример #24
0
void AMCPDevice::setDisconnected()
{
    this->connected = false;
    this->command = AMCPDevice::CONNECTIONSTATE;
    sendNotification();

    QTimer::singleShot(5000, this, SLOT(reconnectDevice()));
}
Пример #25
0
IOReturn
PAEngine::performAudioEngineStop()
{
	debugFunctionEnter();

	sendNotification(kPAVirtualDeviceUserClientNotificationEngineStopped, 0);

	return kIOReturnSuccess;
}
Пример #26
0
// Checked: 2010-03-03 (RLVa-1.2.0a) | Modified: RLVa-1.2.0a
void RlvBehaviourNotifyHandler::onCommand(const RlvCommand& rlvCmd, ERlvCmdRet eRet, bool fInternal)
{
	if (fInternal)
		return;

	switch (rlvCmd.getParamType())
	{
		case RLV_TYPE_ADD:
		case RLV_TYPE_REMOVE:
			sendNotification(rlvCmd.asString(), "=" + rlvCmd.getParam());
			break;
		case RLV_TYPE_CLEAR:
			sendNotification(rlvCmd.asString());
			break;
		default:
			break;
	}
}
Пример #27
0
void Listener::notify(NotificationDomain domain,
	NotificationEvent event, uint32 sequence, const CssmData &data, audit_token_t auditToken)
{
	Connection &current = Server::active().connection();
	RefPointer<Notification> message = new Notification(domain, event, sequence, data);
	if (current.inSequence(message)) {
		StLock<Mutex> _(setLock);

		// This is a total layer violation, but no better place to put it
		uid_t uid = audit_token_to_euid(auditToken);
		gid_t gid = audit_token_to_egid(auditToken);
		SharedMemoryListener::createDefaultSharedMemoryListener(uid, gid);

		sendNotification(message);
		while (RefPointer<Notification> next = current.popNotification())
			sendNotification(next);
	}
}
Пример #28
0
void LiftRightExecutor::SensorDriverCallback(int _id, bool _detected){
    std::cout << "LIRT RIGHT" << std::endl;
    LiftProgressNotification* liftNotification = new LiftProgressNotification(LiftProgressNotification::ProgressType::SENSOR_TRIGGERED);
    sendNotification(liftNotification);
    Command* cmd = ActuatorAction::LiftRight(CALLBACK_GET_RIGHT);
        commandQueueLock.lock();
        commandsToProcess.push(Instruction(cmd));
        commandQueueLock.unlock();
        queueNotEmpty.notify_one();
}
Пример #29
0
void NTFCDevice::disconnectDevice()
{
    this->socket->blockSignals(true);
    this->socket->disconnectFromHost();
    this->socket->blockSignals(false);

    this->connected = false;
    this->command = NTFCDevice::CONNECTIONSTATE;

    sendNotification();
}
Пример #30
0
void ExampleExecutor::onTimeout(const boost::system::error_code &e, deadline_timer *t, void *obj, bool repeat){
    if (repeat){
        totalCounter++;
        sendNotification(new TimePassedNotification(ExampleExecutor::NAME, totalCounter));
        t->expires_at(t->expires_at() + boost::posix_time::milliseconds(SLEEP_TIMER));
        t->async_wait(boost::bind(&TimerCallback::onTimeout, this, boost::asio::placeholders::error, t, obj, repeat));
    }else{
        CountdownCommand* cc=static_cast<CountdownCommand*>(obj);
        sendResponseFromCommand(cc);
    }
}