本文整理汇总了C++中QDBusMessage::type方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage::type方法的具体用法?C++ QDBusMessage::type怎么用?C++ QDBusMessage::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusMessage
的用法示例。
在下文中一共展示了QDBusMessage::type方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeNotification
//
// Function to force a close of a notification
void NotifyClient::closeNotification(quint32 id)
{
// return if we don't have valid connection
if (! b_validconnection) return;
QDBusMessage reply = notifyclient->call(QLatin1String("CloseNotification", id));
if (reply.type() == QDBusMessage::InvalidMessage)
qCritical("CMST - Invalid reply received to CloseNotification method.");
else if (reply.type() == QDBusMessage::ErrorMessage)
qCritical("CMST - Error reply received to CloseNotification method: %s", qPrintable(reply.errorMessage()) );
return;
}
示例2: testNotificationActivated
void Ut_CReporterNotification::testNotificationActivated()
{
notification = new CReporterNotification("crash-reporter", "test-summary",
"test-body", "icon-test");
// Spy activated signal from notification.
QSignalSpy activatedSpy(notification, SIGNAL(activated()));
// Wait for notification.
QTest::qWait(1000);
QVERIFY(notification->isPublished() == true);
QString objPath(CREPORTER_DBUS_NTF_OBJECT_PATH);
objPath.append("00000000000000000000000000000000");
// Interact with the notification via D-Bus and block.
QDBusMessage reply = QDBusConnection::sessionBus().call(QDBusMessage::createMethodCall(
QDBusConnection::sessionBus().baseService(), objPath,
CREPORTER_DBUS_NTF_INTERFACE, "activate"));
if (reply.type() == QDBusMessage::ErrorMessage) {
qDebug() << reply.errorMessage();
QFAIL("Error message received from D-Bus.");
}
QVERIFY(activatedSpy.count() == 1);
}
示例3: GetIntrospectXml
const QString PBTreeNode::GetIntrospectXml(const QDBusObjectPath &object_path)
{
// Connect to the introspectable interface
QDBusInterface iface(PBBusName, \
object_path.path(), \
ofDIntrospectableName, \
QDBusConnection::sessionBus());
// Lets see what we have - introspect this first
QDBusMessage reply = iface.call("Introspect");
if (reply.type() != QDBusMessage::ReplyMessage) {
qDebug("Could not introspect this object");
return NULL;
}
QList<QVariant> args = reply.arguments();
QList<QVariant>::iterator iter = args.begin();
QVariant variant = *iter;
// The introspected string describing this object
const QString intro_xml = variant.value<QString>();
return intro_xml;
}
示例4: GetObjectProperties
QVariantMap PBTreeNode::GetObjectProperties(const QDBusObjectPath &object_path, \
const QString interface)
{
QVariantMap properties;
// Connect to the freedesktop Properties interface
QDBusInterface iface(PBBusName, \
object_path.path(), \
ofDPropertiesName, \
QDBusConnection::sessionBus());
// GetAll properties
QDBusMessage reply = iface.call("GetAll",interface);
if (reply.type() != QDBusMessage::ReplyMessage) {
// not worth complaining if they dont have properties, just return the empty
return properties;
}
QList<QVariant> args = reply.arguments();
if (args.empty()) {
return properties;
}
QList<QVariant>::iterator p = args.begin();
QVariant variant = *p;
const QDBusArgument qda = variant.value<QDBusArgument>();
qda >> properties;
return properties;
}
示例5: notificationClosed
void AsemanLinuxNativeNotification::notificationClosed(const QDBusMessage &dmsg)
{
if( dmsg.type() != QDBusMessage::SignalMessage )
return ;
const QVariantList & args = dmsg.arguments();
if( args.isEmpty() )
return ;
uint id = args.at(0).toUInt();
if( !p->notifies.contains(id) )
return;
if( args.count() == 1 )
{
Q_EMIT notifyClosed(id);
p->notifies.remove(id);
return;
}
int type = args.at(1).toInt();
switch (type) {
case 1:
Q_EMIT notifyTimedOut( id );
break;
case 2:
default:
Q_EMIT notifyClosed( id );
p->notifies.remove(id);
break;
}
}
示例6: dumpRemovedMessage
void SHALDeviceNotifier::dumpRemovedMessage( const QDBusMessage & dmsg )
{
if( dmsg.type() != QDBusMessage::SignalMessage )
return ;
QList<QVariant> list = dmsg.arguments();
if( list.isEmpty() )
return ;
QString path = list.at(0).toString();
if( p->device_list.contains(path) )
emit this->deviceRemoved( p->device_list.take(path) );
if( p->features_list.contains(path) )
p->features_list.remove( path );
if( p->disc_list.contains(path) )
{
SDiscFeatures disc = p->disc_list.take(path);
p->device_to_disc.remove( disc.parent_str );
if( p->device_list.contains( disc.parent_str ) )
emit this->deviceDetected( p->device_list[disc.parent_str] );
emit this->discRemoved( disc );
}
}
示例7: qDebug
bool
BTAdaptor::validateBtDevice ()
{
qDebug() << "Validating bluetooth device";
QDBusMessage msg = QDBusMessage::createMethodCall ("org.bluez",
mAdapterPath,
"org.bluez.Adapter",
"GetProperties");
QDBusMessage reply = QDBusConnection::systemBus ().call (msg);
if (reply.type () == QDBusMessage::ErrorMessage)
{
qWarning() << "Error in dbus call";
return false;
}
QDBusArgument arg = reply.arguments ().at (0).value<QDBusArgument>();
if (arg.currentType () == QDBusArgument::MapType)
{
QMap<QString,QVariant> props = qdbus_cast<QMap<QString,QVariant> > (arg);
QMap<QString,QVariant>::iterator iter;
for (iter = props.begin (); iter != props.end (); ++iter)
{
// ! @todo Perform some validation on the returned properties
qDebug() << iter.key () << ":" << iter.value ();
}
}
}
示例8: SLOT
void
BTAdaptor::searchBtDevices ()
{
// Connect to the signal DeviceFound to obtain the list of devices
QDBusConnection bus = QDBusConnection::systemBus ();
bool success = bus.connect ("org.bluez",
mAdapterPath,
"org.bluez.Adapter",
"DeviceFound",
this,
SLOT (deviceFound(QString,QMap<QString,QVariant>)));
if (!success)
{
qDebug() << "Failure in connecting dbus signal";
return;
}
QDBusMessage msg = QDBusMessage::createMethodCall ("org.bluez",
mAdapterPath,
"org.bluez.Adapter",
"StartDiscovery");
QDBusMessage reply = bus.call (msg);
if (reply.type () == QDBusMessage::ErrorMessage)
{
qWarning() << "Error in dbus call to search for devices";
return ;
}
}
示例9: LockPhone
void SIMLockService::LockPhone()
{
//dbus-send --system --type=method_call
//--dest=com.nokia.system_ui /com/nokia/system_ui/request com.nokia.system_ui.request.devlock_open
//string:"com.nokia.mce"
//string:"/com/nokia/mce/request"
//string:"com.nokia.mce.request"
//string:"devlock_callback"
//uint32:'3'
QDBusMessage reply = LockInterface->call("devlock_open",
"com.nokia.mce",
"/com/nokia/mce/request",
"com.nokia.mce.request",
"devlock_callback", (quint32)3);
if(reply.type() == QDBusMessage::ErrorMessage)
qDebug() << "Failed to lock phone:" << reply.errorName() << reply.errorMessage();
if(reply.arguments()[0].toBool() == true)
qDebug() << "Phone locked";
else
qDebug() << "Phone failed to lock";
}
示例10: disconnectDevice
void NetworkDevice::disconnectDevice()
{
QDBusMessage query = m_networkDeviceInterface->call("Disconnect");
if(query.type() != QDBusMessage::ReplyMessage)
qCWarning(dcNetworkManager()) << query.errorName() << query.errorMessage();
}
示例11: cleanupTestCase
void KWalletExecuter::cleanupTestCase()
{
QDBusMessage msg =
QDBusMessage::createMethodCall("org.kde.kwalletd", "/MainApplication", "org.kde.KApplication", "quit");
const QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
Q_ASSERT(reply.type() != QDBusMessage::ErrorMessage);
}
示例12: initObjects
bool DbusPopupHandler::initObjects()
{
if (!initNotifyInterface())
return false;
FServerInfo = new ServerInfo;
QDBusMessage replyCaps = FNotifyInterface->call(QDBus::Block, "GetCapabilities");
if (replyCaps.type() != QDBusMessage::ErrorMessage)
{
for (int i=0; i<replyCaps.arguments().at(0).toStringList().count(); i++)
LOG_INFO(QString("Capabilities: %1").arg(replyCaps.arguments().at(0).toStringList().at(i)));
FServerInfo->capabilities = replyCaps.arguments().at(0).toStringList();
FAllowActions = FServerInfo->capabilities.contains("actions");
}
else
LOG_WARNING(QString("Capabilities: DBus Error: %1").arg(replyCaps.errorMessage()));
QDBusMessage replyInfo = FNotifyInterface->call(QDBus::Block, "GetServerInformation");
if (replyInfo.type() != QDBusMessage::ErrorMessage)
{
for (int i=0; i<replyInfo.arguments().count(); i++)
LOG_INFO(QString("Server Information: %1").arg(replyInfo.arguments().at(i).toString()));
FServerInfo->name = replyInfo.arguments().at(0).toString();
FServerInfo->vendor = replyInfo.arguments().at(1).toString();
FServerInfo->version = replyInfo.arguments().at(2).toString();
FServerInfo->spec_version = replyInfo.arguments().at(3).toString();
}
else
LOG_WARNING(QString("Server Information: DBus Error: %1").arg(replyInfo.errorMessage()));
if (FAllowActions)
{
connect(FNotifyInterface,SIGNAL(ActionInvoked(uint,QString)),this,SLOT(onActionInvoked(uint,QString)));
connect(FNotifyInterface,SIGNAL(NotificationClosed(uint,uint)),this,SLOT(onNotificationClosed(uint,uint)));
LOG_INFO(QLatin1String("Actions supported."));
}
else
LOG_INFO(QLatin1String("Actions not supported."));
FNotifications->insertNotificationHandler(NHO_DBUSPOPUP, this);
return true;
}
示例13: gotDevices
void ColordEngine::gotDevices(const QDBusMessage &message)
{
if (message.type() == QDBusMessage::ReplyMessage && message.arguments().size() == 1) {
QDBusArgument argument = message.arguments().first().value<QDBusArgument>();
ObjectPathList paths = qdbus_cast<ObjectPathList>(argument);
foreach (const QDBusObjectPath &path, paths) {
deviceAdded(path);
}
示例14: debugVariantList
QDebug operator<<(QDebug dbg, const QDBusMessage &msg)
{
dbg.nospace() << "QDBusMessage(type=" << msg.type()
<< ", service=" << msg.service();
if (msg.type() == QDBusMessage::MethodCallMessage ||
msg.type() == QDBusMessage::SignalMessage)
dbg.nospace() << ", path=" << msg.path()
<< ", interface=" << msg.interface()
<< ", member=" << msg.member();
if (msg.type() == QDBusMessage::ErrorMessage)
dbg.nospace() << ", error name=" << msg.errorName()
<< ", error message=" << msg.errorMessage();
dbg.nospace() << ", signature=" << msg.signature()
<< ", contents=(";
debugVariantList(dbg, msg.arguments());
dbg.nospace() << ") )";
return dbg.space();
}
示例15: call
QList<QVariant> QmIPCInterface::get(const QString& method,
const QVariant& arg1,
const QVariant& arg2) {
QList<QVariant> results;
QDBusMessage msg = call(method, arg1, arg2);
if (msg.type() == QDBusMessage::ReplyMessage) {
results = msg.arguments();
}
return results;
}