blob: d4aa285b43bc93dbd4b0d8b8cee3340d7b6c0942 [file] [log] [blame]
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "echo_server_app.h"
#include "lib/app/cpp/startup_context.h"
namespace echo2 {
EchoServerApp::EchoServerApp()
: EchoServerApp(fuchsia::sys::StartupContext::CreateFromStartupInfo()) {}
EchoServerApp::EchoServerApp(
std::unique_ptr<fuchsia::sys::StartupContext> context)
: context_(std::move(context)) {
context_->outgoing().AddPublicService<Echo>(
[this](fidl::InterfaceRequest<Echo> request) {
bindings_.AddBinding(this, std::move(request));
});
}
void EchoServerApp::EchoString(fidl::StringPtr value,
EchoStringCallback callback) {
printf("EchoString: %s\n", value->data());
callback(std::move(value));
}
} // namespace echo2