首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Dbus -没有收到回复

Dbus -没有收到回复
EN

Stack Overflow用户
提问于 2017-04-27 07:15:47
回答 1查看 10K关注 0票数 2

我对Dbus有个奇怪的问题..。

我用Dbus-1。

问题是,它只在有时和不同的地方发生。有时用于IDAMsg_GetFontName,有时用于IDAMsg_GetForeColor (例如)。也许程序运行十倍好,然后有一次有错误。或者四倍罚款,然后两次错误。

但是,来自我的std::cout和Dbus的错误消息总是相同的:

代码语言:javascript
复制
Too few arguments

代码语言:javascript
复制
Did not receive a reply

但是,我怎么能有时争论太少呢?

怎么才能给Dbus这个错误信息,就像它看上去的那样,一个回复已经发送并得到了?

我们真的很感激你的帮助。

提亚

早咬

Dbus消息是:

代码语言:javascript
复制
Did not receive a reply. Possible causes include: the remote 
application did not send a reply, the message bus security policy 
blocked the reply, the reply timeout expired, or the network 
connection was broken.

发送一种方法:

代码语言:javascript
复制
if(vMethod == IDAMsg_Init || vMethod == IDAMsg_GetFontName
|| vMethod == IDAMsg_AppQuit
|| vMethod == IDAMsg_GetBackColor || vMethod == IDAMsg_GetForeColor
|| vMethod == IDAMsg_GetBorderColor){
    dbus_message_iter_init_append(msg, &args);
    if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &vMsg.Str_Send[0])) {
         cout << "DBUS -- SEND -- OUT OF MEMORY 1" << endl; return 0;
    }
    if(vMethod == IDAMsg_GetBorderColor || vMethod == IDAMsg_AppQuit){
        if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &vMsg.Str_Send[1])) {
             cout << "DBUS -- SEND -- OUT of Memory 2" << endl; return 0;
        }
    }
}

答覆如下:

代码语言:javascript
复制
if(vMethod == IDAMsg_Init || vMethod == IDAMsg_AppQuit
|| vMethod == IDAMsg_GetFontName
|| vMethod == IDAMsg_GetBackColor || vMethod == IDAMsg_GetForeColor
|| vMethod == IDAMsg_GetBorderColor){
    if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)){
         cout << "DBUS -- REPLY -- ARG is not String 1 " << endl;
    } else {
         dbus_message_iter_get_basic(&args, &nStr_In[0]);
    }
    if(vMethod == IDAMsg_GetBorderColor || vMethod == IDAMsg_AppQuit){
        if (!dbus_message_iter_next(&args)){
             cout << "DBUS -- REPLY -- Message has too few arguments 1" << endl;
        } else if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(&args)){
             cout << "DBUS -- REPLY -- Argument is not STRING 2" << endl;
        } else {
             dbus_message_iter_get_basic(&args, &nStr_In[1]);
        }
    }
    reply = dbus_message_new_method_return(msg);
    dbus_message_iter_init_append(reply, &args);
}
if(vMethod == IDAMsg_Init){
    if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_BOOLEAN, &stat)) {
         cout << "DBUS -- REPLY -- OUT of Memory 1" << endl; return;
    }
    if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_UINT32, &level)) {
         cout << "DBUS -- REPLY -- OUT of Memory 2" << endl; return;
    }
}

std::cout输出通常为:

代码语言:javascript
复制
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetForeColor
DBUS -- IDABrowse -- Got Reply  245_245_245 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply  102_143_165 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply  126_177_204 21614
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request send with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply  148_207_239 21614

但是如果出了什么问题,它看起来是这样的:

代码语言:javascript
复制
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetForeColor
DBUS -- IDABase -- Got Reply  245_245_245 21614
IDA -- IDABase -- INCOMING CALLBACK : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABase -- Request send with : GetBorderColor
DBUS --  SEND -- Message has too few arguments 1
DBUS -- IDABase -- Got Reply  Did not receive a reply. Possible 
causes include: the remote application did not send a reply, the 
message bus security policy blocked the reply, the reply timeout 
expired, or the network connection was broken. 32723

编辑:

我认为这方面的问题如下:

这是输出的正常顺序:

代码语言:javascript
复制
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- IDABrowse -- Request sending with : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Got Reply  126_177_204 21614

当发生错误时:

代码语言:javascript
复制
IDA -- IDABrowse -- INCOMING CALLBACK : GetBorderColor
DBUS -- EBIDA_IDA_Server -- Method Reply for : GetBorderColor
DBUS -- IDABrowse -- Request sending with : GetBorderColor
DBUS -- IDABrowse -- Got Reply  126_177_204 21614

如果出现错误,则第2行和第3行已更改。

回复在请求发送之前就存在了..。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-27 10:46:16

调试它的方法是使用dbus-monitor喧闹查看总线上的通信量(请求、回复、错误)。这将精确地指出错误,并向您显示是什么消息导致了错误。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43651006

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档