本文整理汇总了C++中QDBusMessage::service方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage::service方法的具体用法?C++ QDBusMessage::service怎么用?C++ QDBusMessage::service使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusMessage
的用法示例。
在下文中一共展示了QDBusMessage::service方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: registerMonitor
void FileContentIndexer::registerMonitor(const QDBusMessage& message)
{
if (!m_registeredMonitors.contains(message.service())) {
m_registeredMonitors << message.service();
m_monitorWatcher.addWatchedService(message.service());
}
}
示例2: UnregisterAgent
void ObexAgentManager::UnregisterAgent(const QDBusObjectPath &path, const QDBusMessage &msg)
{
if (m_agent == path && m_service == msg.service()) {
m_agent = QDBusObjectPath();
m_service.clear();
}
}
示例3: Subscribe
/// Implementation of the D-Bus method Subscribe
void PropertyAdaptor::Subscribe(const QDBusMessage &msg, QVariantList& values, quint64& timestamp)
{
contextDebug() << "Subscribe called";
// Store the information of the subscription. For each property, we record
// which clients have subscribed.
QString client = msg.service();
if (clientServiceNames.contains(client) == false) {
clientServiceNames.insert(client);
if (clientServiceNames.size() == 1) {
propertyPrivate->setSubscribed();
}
serviceWatcher.addWatchedService(client);
}
else {
contextDebug() << "Client" << client << "subscribed to property" << propertyPrivate->key << "multiple times";
}
// Don't treat the "client sends 2 Subscribe calls" as an error. When the
// provider is not running (e.g., during boot), the subscriber might send 2
// Subscribe calls: one of them before the provider is running, and the
// other when it notices that the provider has started.
// Construct the return values
Get(values, timestamp);
}
示例4: asyncCall
QDBusPendingCall QDBusConnection::asyncCall(const QDBusMessage &message, int) const
{
qDBusConnectionAsyncCallService = message.service();
qDBusConnectionAsyncCallPath = message.path();
qDBusConnectionAsyncCallInterface = message.interface();
qDBusConnectionAsyncCallMember = message.member();
qDBusConnectionAsyncCallArguments = message.arguments();
return QDBusPendingCall::fromCompletedCall(QDBusMessage());
}
示例5: 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();
}
示例6: uid
credentials_t::credentials_t(const QDBusMessage &message)
: uid("nobody"), gid("nobody")
{
QString sender = message.service() ;
uint32_t user_id = get_name_owner_from_dbus_sync(Maemo::Timed::bus(), sender) ;
if (user_id == ~0u)
log_warning("can't get user (uid) of the caller, already terminated?") ;
else
{
passwd *info = getpwuid(user_id) ;
if (info)
{
uid = info->pw_name ;
gid = gidToName(info->pw_gid) ;
}
}
}
示例7: Unsubscribe
/// Implementation of the D-Bus method Unsubscribe
void PropertyAdaptor::Unsubscribe(const QDBusMessage &msg)
{
contextDebug() << "Unsubscribe called";
QString client = msg.service();
if (clientServiceNames.remove(client)) {
if (clientServiceNames.size() == 0) {
propertyPrivate->setUnsubscribed();
}
serviceWatcher.removeWatchedService(client);
}
else {
contextDebug() << "Client" << client << "unsubscribed from property" <<
propertyPrivate->key << "without subscribing";
// Don't treat the "client sends Unsubscribe for a non-subscribed
// property" as an error. The intention of the client is to not be
// subscribed, so there's nothing to do.
}
}
示例8: dumpMessage
void QDBusViewer::dumpMessage(const QDBusMessage &message)
{
QList<QVariant> args = message.arguments();
QString out = QLatin1String("Received ");
switch (message.type()) {
case QDBusMessage::SignalMessage:
out += QLatin1String("signal ");
break;
case QDBusMessage::ErrorMessage:
out += QLatin1String("error message ");
break;
case QDBusMessage::ReplyMessage:
out += QLatin1String("reply ");
break;
default:
out += QLatin1String("message ");
break;
}
out += QLatin1String("from ");
out += message.service();
if (!message.path().isEmpty())
out += QLatin1String(", path ") + message.path();
if (!message.interface().isEmpty())
out += QLatin1String(", interface <i>") + message.interface() + QLatin1String("</i>");
if (!message.member().isEmpty())
out += QLatin1String(", member ") + message.member();
out += QLatin1String("<br>");
if (args.isEmpty()) {
out += QLatin1String(" (no arguments)");
} else {
out += QLatin1String(" Arguments: ");
foreach (QVariant arg, args) {
QString str = Qt::escape(QDBusUtil::argumentToString(arg));
// turn object paths into clickable links
str.replace(objectPathRegExp, QLatin1String("[ObjectPath: <a href=\"qdbus://bus\\1\">\\1</a>]"));
out += str;
out += QLatin1String(", ");
}
out.chop(2);
}
示例9: messageToScriptValue
static QScriptValue messageToScriptValue(QScriptEngine *engine, const QDBusMessage &message)
{
QScriptValue v = engine->newVariant(QVariant::fromValue(message));
v.setProperty(QLatin1String("service"), QScriptValue(engine, message.service()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("path"), QScriptValue(engine, message.path()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("interface"), QScriptValue(engine, message.interface()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("member"), QScriptValue(engine, message.member()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("type"), QScriptValue(engine, message.type()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("signature"), QScriptValue(engine, message.signature()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("isReplyRequired"), QScriptValue(engine, message.isReplyRequired()), QScriptValue::ReadOnly);
v.setProperty(QLatin1String("delayedReply"), QScriptValue(engine, message.isDelayedReply()));
QScriptValue argValue = engine->newArray();
const QList<QVariant> args = message.arguments();
for (int i = 0; i < args.count(); ++i)
argValue.setProperty(QScriptValue(engine, i).toString(),
engine->newVariant(args.at(i)));
v.setProperty(QLatin1String("arguments"), argValue);
return v;
}
示例10: credentials_from_dbus_connection
credentials_t Aegis::credentials_from_dbus_connection(const QDBusMessage &message)
{
// We are doing this in a kinda insecure way. Two steps:
// 1. Ask dbus daemon, what is the pid of the client.
// --- race race race --- (please someone file a bug about it) --- race race race ---
// 2. Ask aegis kernel extension, what are the credentials of given pid.
QString sender = message.service() ;
/* "returns "sender" on inbound messages
and "service" on outbound messages
which saves one QString object and
confuses at least me ..." -- so true ! */
// 1. Ask DBus daemon, what is the PID of the 'sender':
uint32_t owner_id = get_name_owner_from_dbus_sync(Maemo::Timed::bus(), sender) ;
if (owner_id == ~0u)
{
log_warning("can't get owner (pid) of the caller, already terminated?") ;
return credentials_t() ;
}
pid_t pid = owner_id ;
// 2. Getting aegis credentials from the kernel, by pid
creds_t aegis_creds = creds_gettask(pid) ;
// Don't check result, as NULL is a valid set of aegis credentials
credentials_t creds = Aegis::credentials_from_creds_t(aegis_creds) ;
creds_free(aegis_creds) ;
return creds ;
}
示例11: RegisterAgent
void ObexAgentManager::RegisterAgent(const QDBusObjectPath &path, const QDBusMessage &msg)
{
m_agent = path;
m_service = msg.service();
}
示例12: unregisterMonitor
void FileContentIndexer::unregisterMonitor(const QDBusMessage& message)
{
m_registeredMonitors.removeAll(message.service());
m_monitorWatcher.removeWatchedService(message.service());
}