Skip to content

Commit

Permalink
Suggested fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
elandini84 committed Sep 15, 2023
1 parent 23c64f3 commit 82b44ea
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/devices/chatBot_nws_yarp/ChatBot_nws_yarp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,16 @@ bool ChatBot_nws_yarp::open(Searchable& prop)
"prefix for port names").asString();

m_inputBuffer.attach(m_inputPort);
m_inputPort.open(rootName+"/text:i");
m_outputPort.open(rootName + "/text:o");
if(!m_inputPort.open(rootName+"/text:i"))
{
yCError(CHATBOT_NWS_YARP) << "Could not open port" << rootName+"/text:i";
return false;
}
if(!m_outputPort.open(rootName + "/text:o"))
{
yCError(CHATBOT_NWS_YARP) << "Could not open port" << rootName+"/text:o";
return false;
}
if (!m_thriftServerPort.open(rootName+"/rpc"))
{
yCError(CHATBOT_NWS_YARP, "Failed to open rpc port");
Expand Down Expand Up @@ -59,7 +67,13 @@ bool ChatBot_nws_yarp::attach(yarp::dev::PolyDriver* deviceToAttach)
yCInfo(CHATBOT_NWS_YARP, "Attach done");

m_cbkHelper = new ChatBotRPC_CallbackHelper();
m_cbkHelper->setCommunications(m_iChatBot,&m_outputPort);
if(!m_cbkHelper->setCommunications(m_iChatBot,&m_outputPort))
{
yCError(CHATBOT_NWS_YARP) << "Error setting ChatBot_CallbackHelper object interfaces";
delete m_cbkHelper;
m_cbkHelper=nullptr;
return false;
}
m_inputBuffer.useCallback(*m_cbkHelper);
if(!m_msgsImpl.setInterfaces(m_iChatBot))
{
Expand Down

0 comments on commit 82b44ea

Please sign in to comment.