blob: 5de33451925534a8eb80c5e24f6db829d32a2699 [file] [log] [blame]
// Copyright 2015 The Weave Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef LIBWEAVE_SRC_PRIVET_PUBLISHER_H_
#define LIBWEAVE_SRC_PRIVET_PUBLISHER_H_
#include <memory>
#include <string>
#include <vector>
#include <base/macros.h>
namespace weave {
namespace provider {
class DnsServiceDiscovery;
}
namespace privet {
class CloudDelegate;
class DeviceDelegate;
class WifiDelegate;
// Publishes privet service on DNS-SD.
class Publisher {
public:
Publisher(const DeviceDelegate* device,
const CloudDelegate* cloud,
const WifiDelegate* wifi,
provider::DnsServiceDiscovery* dns_sd);
~Publisher();
// Updates published information. Removes service if HTTP is not alive.
void Update();
private:
void ExposeService();
void RemoveService();
provider::DnsServiceDiscovery* dns_sd_{nullptr};
const DeviceDelegate* device_{nullptr};
const CloudDelegate* cloud_{nullptr};
const WifiDelegate* wifi_{nullptr};
std::pair<uint16_t, std::vector<std::string>> published_;
DISALLOW_COPY_AND_ASSIGN(Publisher);
};
} // namespace privet
} // namespace weave
#endif // LIBWEAVE_SRC_PRIVET_PUBLISHER_H_