/**
 * Called when FindService completes.
 */
void SLPDaemon::SLPServiceImpl::FindServiceHandler(
    ola::slp::proto::ServiceReply* response,
    ::google::protobuf::Closure* done,
    const URLEntries &urls) {
  for (URLEntries::const_iterator iter = urls.begin();
       iter != urls.end(); ++iter) {
    ola::slp::proto::URLEntry *url_entry = response->add_url_entry();
    url_entry->set_url(iter->url());
    url_entry->set_lifetime(iter->lifetime());
  }
  done->Run();
}
/*
 * Called when we receive a new url list.
 */
void DiscoveryDone(bool ok, const URLEntries &urls) {
  if (!ok) {
    OLA_WARN << "SLP discovery failed";
  } else if (urls.empty()) {
    OLA_INFO << "No services found";
  } else {
    URLEntries::const_iterator iter;
    for (iter = urls.begin(); iter != urls.end(); ++iter) {
      std::cout << "  " << iter->url() << std::endl;
    }
  }
}
Exemple #3
0
/**
 * Called when SLP completes discovery.
 */
void SimpleE133Monitor::DiscoveryCallback(bool ok, const URLEntries &urls) {
  if (ok) {
    URLEntries::const_iterator iter;
    UID uid(0, 0);
    IPV4Address ip;
    for (iter = urls.begin(); iter != urls.end(); ++iter) {
      OLA_INFO << "Located " << *iter;
      if (!ola::e133::ParseE133URL(iter->url(), &uid, &ip))
        continue;

      if (uid.IsBroadcast()) {
        OLA_WARN << "UID " << uid << "@" << ip << " is broadcast";
        continue;
      }
      AddIP(ip);
    }
  } else {
    OLA_INFO << "SLP discovery failed";
  }
}
/**
 * Called when SLP discovery completes.
 */
void SimpleE133Controller::DiscoveryCallback(bool ok, const URLEntries &urls) {
  if (ok) {
    URLEntries::const_iterator iter;
    UID uid(0, 0);
    IPV4Address ip;
    for (iter = urls.begin(); iter != urls.end(); ++iter) {
      OLA_INFO << "Located " << *iter;
      if (!ola::e133::ParseE133URL(iter->url(), &uid, &ip))
        continue;

      if (uid.IsBroadcast()) {
        OLA_WARN << "UID " << uid << "@" << ip << " is broadcast";
        continue;
      }
      AddUID(uid, ip);
    }
  }
  m_uid_list_updated = true;
  m_ss.Terminate();
}