本文整理汇总了C++中QDBusMessage::setDelayedReply方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusMessage::setDelayedReply方法的具体用法?C++ QDBusMessage::setDelayedReply怎么用?C++ QDBusMessage::setDelayedReply使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusMessage
的用法示例。
在下文中一共展示了QDBusMessage::setDelayedReply方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVariable
Values AsebaNetworkInterface::GetVariable(const QString& node, const QString& variable, const QDBusMessage &message)
{
// make sure the node exists
NodesNamesMap::const_iterator nodeIt(nodesNames.find(node));
if (nodeIt == nodesNames.end())
{
DBusConnectionBus().send(message.createErrorReply(QDBusError::InvalidArgs, QString("node %0 does not exists").arg(node)));
return Values();
}
const unsigned nodeId(nodeIt.value());
unsigned pos(unsigned(-1));
unsigned length(unsigned(-1));
// check whether variable is user-defined
const UserDefinedVariablesMap::const_iterator userVarMapIt(userDefinedVariablesMap.find(node));
if (userVarMapIt != userDefinedVariablesMap.end())
{
const VariablesMap& userVarMap(userVarMapIt.value());
const VariablesMap::const_iterator userVarIt(userVarMap.find(variable.toStdWString()));
if (userVarIt != userVarMap.end())
{
pos = userVarIt->second.first;
length = userVarIt->second.second;
}
}
// if variable is not user-defined, check whether it is provided by this node
if (pos == unsigned(-1))
{
bool ok1, ok2;
pos = getVariablePos(nodeId, variable.toStdWString(), &ok1);
length = getVariableSize(nodeId, variable.toStdWString(), &ok2);
if (!(ok1 && ok2))
{
DBusConnectionBus().send(message.createErrorReply(QDBusError::InvalidArgs, QString("variable %0 does not exists in node %1").arg(variable).arg(node)));
return Values();
}
}
// send request to aseba network
{
GetVariables msg(nodeId, pos, length);
hub->sendMessage(msg);
}
// build bookkeeping for async reply
RequestData *request = new RequestData;
request->nodeId = nodeId;
request->pos = pos;
message.setDelayedReply(true);
request->reply = message.createReply();
pendingReads.push_back(request);
return Values();
}
示例2: sendDelayReply
uchar SyncBackup::sendDelayReply (const QDBusMessage &message)
{
FUNCTION_CALL_TRACE;
#ifdef UNIT_TEST
return 0;
#endif
// coverity[unreachable] //Suppressing false positives with code annotations
message.setDelayedReply(true);
if (!iReply)
iReply = new QDBusMessage;
*iReply = message.createReply();
return 0;
}
示例3: scriptValueToMessage
static void scriptValueToMessage(const QScriptValue &value, QDBusMessage &message)
{
QVariant v = value.toVariant();
message = qvariant_cast<QDBusMessage>(v);
message.setDelayedReply(value.property(QLatin1String("delayedReply")).toBoolean());
QList<QVariant> args;
quint32 len = value.property(QLatin1String("length")).toUInt32();
for (quint32 i = 0; i < len; ++i) {
QScriptValue item = value.property(i);
args.append(item.toVariant());
}
message.setArguments(args);
}
示例4: Confirm
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);
}
示例5: 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);
}
示例6: Request
void QBluetoothPasskeyAgent_Private::Request(const QString &path,
const QString &address,
const QDBusMessage &msg)
{
QString devname = path.mid(11);
QBluetoothAddress addr(address);
QBluetoothPasskeyRequest req(devname, addr);
m_parent->requestPasskey(req);
msg.setDelayedReply(true);
QDBusMessage reply;
if (req.isRejected()) {
reply = msg.createErrorReply("org.bluez.Error.Rejected", "Rejected");
}
else {
reply = msg.createReply(req.passkey());
}
QDBusConnection::systemBus().send(reply);
}
示例7: RequestConnect
void AgentAdaptor::RequestConnect(const QDBusMessage &message)
{
message.setDelayedReply(true);
m_userAgent->requestConnect(message);
}
示例8: RequestBrowser
void AgentAdaptor::RequestBrowser(const QDBusObjectPath &service_path, const QString &url,
const QDBusMessage &message)
{
message.setDelayedReply(true);
m_userAgent->requestBrowser(service_path.path(), url, message);
}