void publisherUpdate(NodeArgs& na) { std::string topic = fromRosName(na.args.get(0).asString()); std::vector<Contact> contacts = query(topic, "-"); if (contacts.size() < 1) { na.fail("Cannot find topic"); return; } for (std::vector<Contact>::iterator it = contacts.begin(); it != contacts.end(); ++it) { Contact &c = *it; if (!c.isValid()) { continue; } c.setName(""); // just pass the message along, YARP ports know what to do with it ContactStyle style; style.admin = true; style.carrier = "tcp"; Bottle reply; if (!NetworkBase::write(c, na.request, reply, style)) { continue; } na.fromExternal(reply); } }
void publisherUpdate(NodeArgs& na) { ConstString topic = na.args.get(0).asString(); Contact c = lookup(topic); if (!c.isValid()) { na.fail("Cannot find topic"); return; } c = c.addName(""); // just pass the message along, YARP ports know what to do with it ContactStyle style; style.admin = true; style.carrier = "tcp"; Bottle reply; if (!NetworkBase::write(c,na.request,reply,style)) { na.fail("Cannot communicate with local port"); return; } na.fromExternal(reply); //printf("DONE with passing on publisherUpdate\n"); }