本文整理汇总了C++中QDBusMessage类的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage类的具体用法?C++ QDBusMessage怎么用?C++ QDBusMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDBusMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
long long
PlatformUdisks::getSize(const QString &devicePath)
{
long long ret;
QDBusConnection connection = QDBusConnection::systemBus();
QDBusMessage message;
QList<QVariant> args;
args << "org.freedesktop.UDisks";
args << "DeviceSize";
message = QDBusMessage::createMethodCall("org.freedesktop.UDisks", devicePath, "org.freedesktop.DBus.Properties", "Get");
message.setArguments(args);
QDBusReply<QDBusVariant> reply = connection.call(message);
if (!reply.isValid())
return(0);
ret = reply.value().variant().toLongLong();
return(ret);
}
示例2: sendDBusRegister
bool DBusComm::sendDBusRegister()
{
QDBusMessage reply = positioningdProxy->call("registerListener",
myService.toLatin1().constData(),
myPath.toLatin1().constData());
if (reply.type() == QDBusMessage::ReplyMessage) {
QList<QVariant> values = reply.arguments();
clientId = values.takeFirst().toInt();
quint32 m = values.takeFirst().toUInt();
availablePositioningMethods = (QGeoPositionInfoSource::PositioningMethod) m;
minimumUpdateInterval = values.takeFirst().toUInt();
} else {
cerr << endl << "DBus error:\n";
cerr << reply.errorName().toLatin1().constData() << endl;
cerr << reply.errorMessage().toLatin1().constData() << endl;
return false;
}
return true;
}
示例3: slotDBusSignal
void ServiceListener::slotDBusSignal( const QDBusMessage& message )
{
odebug << "ConnMan: " << message.member() << oendl;
if( message.member() == "PropertyChanged" ) {
QString prop = message[0].toString();
if( prop == "State" ) {
QString oldState = m_state;
QString newState = message[1].toVariant().value.toString();
if( oldState != newState ) {
emit serviceStateChanged( QDBusObjectPath( QCString( m_proxy->path() )), oldState, newState );
m_state = newState;
sendSignalStrength();
}
}
else if( prop == "Strength" ) {
m_strength = message[1].toVariant().value.toByte();
sendSignalStrength();
}
}
}
示例4: tDebug
void
FdoNotifyPlugin::dbusCapabiltiesReplyReceived( const QDBusMessage& reply )
{
if ( reply.type() != QDBusMessage::ReplyMessage )
{
tDebug( LOGVERBOSE ) << Q_FUNC_INFO << "Did not receive a ReplyMessage";
}
const QStringList &list = reply.arguments().at( 0 ).toStringList();
QListIterator<QString> iter( list );
while ( iter.hasNext() )
{
QString capabilty = iter.next();
if ( capabilty.compare( "body-markup" ) == 0 )
{
m_wmSupportsBodyMarkup = true;
break;
}
}
}
示例5: dispatchEvent
//Callback (slot) used to retrieve subscribed event information
void DBusInterface::dispatchEvent(const QDBusMessage& message)
{
// unpack event
QString eventReceivedName= message.arguments().at(1).value<QString>();
Values eventReceivedValues = dBusMessagetoValues(message,2);
// find and trigger matching callback
if( callbacks.count(eventReceivedName) > 0)
{
callbacks[eventReceivedName](eventReceivedValues);
}
}
示例6: addr
void QBluetoothPasskeyAgent_Private::Confirm(const QString &path,
const QString &address,
const QString &value,
const QDBusMessage &msg)
{
QString devname = path.mid(11);
QBluetoothAddress addr(address);
msg.setDelayedReply(true);
QDBusMessage reply;
if (m_parent->confirmPasskey(devname, addr, value)) {
reply = msg.createReply();
}
else {
reply = msg.createErrorReply("org.bluez.Error.Rejected", "Rejected");
}
QDBusConnection::systemBus().send(reply);
}
示例7: RequestInput
void AgentAdaptor::RequestInput(const QDBusObjectPath &service_path,
const QVariantMap &fields,
const QDBusMessage &message)
{
QVariantMap json;
Q_FOREACH (const QString &key, fields.keys()){
QVariantMap payload = qdbus_cast<QVariantMap>(fields[key]);
json.insert(key, payload);
}
message.setDelayedReply(true);
ServiceRequestData *reqdata = new ServiceRequestData;
reqdata->objectPath = service_path.path();
reqdata->fields = json;
reqdata->reply = message.createReply();
reqdata->msg = message;
m_userAgent->requestUserInput(reqdata);
}
示例8: qDebug
QList<Job::Ptr> SystemdPrivate::listJobs()
{
QList<Job::Ptr> jobs;
qDBusRegisterMetaType<ManagerDBusJob>();
qDBusRegisterMetaType<ManagerDBusJobList>();
QDBusPendingReply<ManagerDBusJobList> reply = isdface.ListJobs();
reply.waitForFinished();
if (reply.isError()) {
qDebug() << reply.error().message();
} else {
const QDBusMessage message = reply.reply();
if (message.type() == QDBusMessage::ReplyMessage) {
const ManagerDBusJobList queued = qdbus_cast<ManagerDBusJobList>(message.arguments().first());
Q_FOREACH(const ManagerDBusJob job, queued) {
jobs.append(Job::Ptr(new Job(job.path.path()), &QObject::deleteLater));
}
}
}
示例9: getDaemonVersionCall
QString SettingsUi::readDaemonVersion()
{
QDBusInterface getDaemonVersionCall("com.kimmoli.tohkbd2", "/", "com.kimmoli.tohkbd2", QDBusConnection::systemBus());
getDaemonVersionCall.setTimeout(2000);
QDBusMessage getDaemonVersionReply = getDaemonVersionCall.call(QDBus::AutoDetect, "getVersion");
if (getDaemonVersionReply.type() == QDBusMessage::ErrorMessage)
{
qDebug() << "Error reading daemon version:" << getDaemonVersionReply.errorMessage();
return QString("N/A");
}
QString daemonVersion = getDaemonVersionReply.arguments().at(0).toString();
qDebug() << "Daemon version is" << daemonVersion;
return daemonVersion;
}
示例10: qDebug
QList<Systemd::Job*> Systemd::SystemdPrivate::listJobs()
{
qDBusRegisterMetaType<ManagerDBusJob>();
qDBusRegisterMetaType<ManagerDBusJobList>();
QDBusPendingReply<ManagerDBusJobList> reply = isdface.ListJobs();
reply.waitForFinished();
if (reply.isError()) {
qDebug() << reply.error().message();
return QList<Systemd::Job*>();
}
QList<Systemd::Job*> queued;
const QDBusMessage message = reply.reply();
if (message.type() == QDBusMessage::ReplyMessage) {
const ManagerDBusJobList jobs = qdbus_cast<ManagerDBusJobList>(message.arguments().first());
Q_FOREACH(const ManagerDBusJob job, jobs) {
queued.append(new Systemd::Job(job.path.path()));
}
}
示例11: qWarning
QVariant DBusResponseWaiter::waitForReply(QVariant variant) const
{
if (QDBusPendingCall* call = const_cast<QDBusPendingCall*>(extractPendingCall(variant)))
{
call->waitForFinished();
if (call->isError())
{
qWarning() << "error:" << call->error();
return QVariant("error");
}
QDBusMessage reply = call->reply();
if (reply.arguments().count() > 0)
{
return reply.arguments().at(0);
}
}
return QVariant();
}
示例12:
bool
PlatformUdisks::isUSB(const QString &udiskPath)
{
QDBusConnection connection = QDBusConnection::systemBus();
QDBusMessage message;
QList<QVariant> args;
args << "org.freedesktop.UDisks";
args << "DriveConnectionInterface";
message = QDBusMessage::createMethodCall("org.freedesktop.UDisks", udiskPath, "org.freedesktop.DBus.Properties", "Get");
message.setArguments(args);
QDBusReply<QDBusVariant> reply = connection.call(message);
if (!reply.isValid())
return false;
if (reply.value().variant().toString() == "usb")
return true;
else
return false;
}
示例13: _mitakuuluuMessageReceived
void DbusAdapter::_mitakuuluuMessageReceived(QDBusMessage msg) {
qDebug() << "Mitakuuluu messageReceived:" << msg;
QDBusArgument *arg = (QDBusArgument *) msg.arguments().at(0).data();
if (arg->currentType() == QDBusArgument::MapType) {
QMap<QString, QString> argMap = unpackMessage(*arg);
qDebug() << "Extracted argument map:" << argMap;
emit commhistoryd(argMap.value("author"), argMap.value("message"));
}
}
示例14: if
void DeviceHandler::slotAsyncReply( int callId, const QDBusMessage& reply )
{
QString method = m_calls[callId];
if (reply.type() == QDBusMessage::ReplyMessage) {
odebug << "********* " << m_devProxy->interface() << " " << method << " success" << oendl;
if( m_pool ) {
if( reply.count() > 0 )
m_pool->handlerSuccess( this, method, reply[0].toString() );
else
m_pool->handlerSuccess( this, method, QString::null );
}
}
else if (reply.type() == QDBusMessage::ErrorMessage) {
odebug << "********* " << m_devProxy->interface() << " " << method << " fail: " << reply.error().name() << ": " << reply.error().message() << oendl;
if( m_pool )
m_pool->handlerError( this, method, reply.error().name(), reply.error().message() );
}
m_calls.remove(callId);
}
示例15: bus
// Create DBus connection with the interface ch.epfl.mobots.AsebaNetwork
DBusInterface::DBusInterface() :
bus(QDBusConnection::sessionBus()),
callbacks({}),
dbusMainInterface("ch.epfl.mobots.Aseba", "/", "ch.epfl.mobots.AsebaNetwork",bus)
{
checkConnection();
// setup event filter
QDBusMessage eventfilterMessage = dbusMainInterface.call("CreateEventFilter");
QDBusObjectPath eventfilterPath = eventfilterMessage.arguments().at(0).value<QDBusObjectPath>();
eventfilterInterface = new QDBusInterface("ch.epfl.mobots.Aseba", eventfilterPath.path(), "ch.epfl.mobots.EventFilter",bus);
if(!bus.connect("ch.epfl.mobots.Aseba",
eventfilterPath.path(),
"ch.epfl.mobots.EventFilter",
"Event",
this,
SLOT(dispatchEvent(const QDBusMessage&))))
{
qDebug() << "failed to connect eventfilter signal to dispatchEvent slot!";
}
}