无法连接到IDM_Channel

时间:2013-12-02 15:54:50

标签: redhawksdr

我正在使用此处找到的USRP_UHD项目:https://github.com/RedhawkSDR/USRP_UHD

我看到了这个问题:Component uses a device - failed to allocateCapacity。这位先生似乎有类似的问题,但我没有任何其他问题。

我正在尝试通过“Target SDR”启​​动包含USRP_UHD设备的节点。我最终得到了这个警告:

警告:Device_impl - 无法连接到IDM频道

系统说明:
CentOS 6.4 64位
REDHAWK 1.8.4
Ettus N200 + XCVR 2450子卡 GNU C ++版本4.4.7 20120313(Red Hat 4.4.7-3); Boost_104100; UHD_003.005.002-0未知

节点未运行时
nameclt list REDHAWK_DEV
list:NotFound异常:缺少节点

节点运行时
nameclt list REDHAWK_DEV
ODM_Channel
IDM_Channel
REDHAWK_DEV
USRP-TEST /(这是我的节点名称)

eventviewer REDHAWK_DEV IDM_Channel
接收事件。按“回车”键退出

对我来说一切似乎都没问题。我相信这里会发出警告:Device_impl.h

#if ENABLE_EVENTS
    if (idm_channel_ior) {
        try {
            CORBA::Object_var IDM_channel_obj = ossie::corba::Orb()->string_to_object(idm_channel_ior);
            if (CORBA::is_nil(IDM_channel_obj)) {
                LOG_ERROR(Device_impl, "Invalid IDM channel IOR: " << idm_channel_ior);
            } else {
                CosEventChannelAdmin::EventChannel_var idm_channel = CosEventChannelAdmin::EventChannel::_narrow(IDM_channel_obj);
                (*devPtr)->connectSupplierToIncomingEventChannel(idm_channel);
            }
        } catch (...) {
            LOG_WARN(Device_impl, "Unable to connect to IDM channel");
        }
    }
#endif

USRP设备似乎没有获取我在USRP_UHD.prf.xml中设置的任何属性 - 我希望解决此问题会有所帮助。谢谢!

1 个答案:

答案 0 :(得分:0)

关于您关于连接到IDM频道的问题,这是最近发现的核心框架1.9.0版本中的错误。在Device_Impl.cpp类的第833行调用find_POA时,抛出AdapterNonExistent异常。 Device_Impl.cpp类是所有C ++设备使用的基类,因此问题不仅限于USRP C ++设备。

设备使用IDM通道发送StateChangeEventType事件(参见http://redhawksdr.github.io/Documentation/mainch16.html#x18-26800016.3.1

如果您的系统依赖于这些事件类型,您的设备是C ++,并且您正在使用框架的v1.9.0,您可以通过覆盖设备中的connectSupplierToIncomingEventChannel方法来解决此问题。但是,升级到v1.9.1时应删除此工作。

在C ++设备的头类中,在现有的include语句下面添加以下内容:

#if ENABLE_EVENTS
#include <COS/CosEventChannelAdmin.hh>
#include "ossie/CorbaUtils.h"
#endif

然后在公共方法声明中添加以下内容:

#if ENABLE_EVENTS
    void connectSupplierToIncomingEventChannel (CosEventChannelAdmin::EventChannel_ptr idmChannel);
    CosEventChannelAdmin::EventChannel_var IDM_channel;
    CosEventChannelAdmin::ProxyPushConsumer_var proxy_consumer;
#endif

在设备的cpp类中,在服务功能下方添加以下方法。

#if ENABLE_EVENTS
void workAroundDevice_i::connectSupplierToIncomingEventChannel(CosEventChannelAdmin::EventChannel_ptr idm_channel)
{
    TRACE_ENTER(Device_impl);

    IDM_channel = CosEventChannelAdmin::EventChannel::_duplicate(idm_channel);

    CosEventChannelAdmin::SupplierAdmin_var supplier_admin;
    unsigned int number_tries;
    unsigned int maximum_tries = 10;

    number_tries = 0;
    while (true)
    {
        try {
            supplier_admin = IDM_channel->for_suppliers ();
            if (CORBA::is_nil(supplier_admin))
            {
                IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
                return;
            }
            break;
        }
        catch (CORBA::COMM_FAILURE& ex) {
            if (number_tries == maximum_tries) {
                IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
                return;
            }
            usleep(1000);   // wait 1 ms
            number_tries++;
            continue;
        }
    }
    proxy_consumer = CosEventChannelAdmin::ProxyPushConsumer::_nil();
    number_tries = 0;
    while (true)
    {
        try {
            proxy_consumer = supplier_admin->obtain_push_consumer ();
            if (CORBA::is_nil(proxy_consumer))
            {
                IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
                return;
            }
            break;
        }
        catch (CORBA::COMM_FAILURE& ex) {
            if (number_tries == maximum_tries) {
                IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
                return;
            }
            usleep(1000);   // wait 1 ms
            number_tries++;
            continue;
        }
    }
    //
    // Connect Push Supplier - retrying on Comms Failure.
    PortableServer::POA_var root_poa = PortableServer::POA::_narrow(ossie::corba::RootPOA());

    IDM_Channel_Supplier_i* supplier_servant = new IDM_Channel_Supplier_i(this);

    PortableServer::ObjectId_var oid = root_poa->activate_object(supplier_servant);

    CosEventComm::PushSupplier_var sptr = supplier_servant->_this();

    supplier_servant->_remove_ref();
    number_tries = 0;
    while (true)
    {
        try {
            proxy_consumer->connect_push_supplier(sptr.in());
            break;
        }
        catch (CORBA::BAD_PARAM& ex) {
            IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
            return;
        }
        catch (CosEventChannelAdmin::AlreadyConnected& ex) {
            break;
        }
        catch (CORBA::COMM_FAILURE& ex) {
            if (number_tries == maximum_tries) {
                IDM_channel = CosEventChannelAdmin::EventChannel::_nil();
                return;
            }
            usleep(1000);   // wait 1 ms
            number_tries++;
            continue;
        }
    }

}
#endif