blob: 86166ffe9208d203b436f51b0a3765f492855479 [file] [log] [blame]
// Copyright 2019 The Chromium OS 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 "hermes/daemon.h"
#include <memory>
#include <utility>
#include <base/threading/thread_task_runner_handle.h>
#include <chromeos/dbus/service_constants.h>
#include <google-lpa/lpa/core/lpa.h>
#include "hermes/context.h"
#include "hermes/modem_qrtr.h"
#include "hermes/socket_qrtr.h"
namespace hermes {
Daemon::Daemon()
: DBusServiceDaemon(kHermesServiceName),
executor_(base::ThreadTaskRunnerHandle::Get()),
smdp_(&logger_, &executor_) {
modem_ =
ModemQrtr::Create(std::make_unique<SocketQrtr>(), &logger_, &executor_);
lpa::core::Lpa::Builder b;
// TODO(crbug.com/1085825) Once a Channel class is created to abstract out the
// logical channel logic in ModemQrtr, a Channel (subclass?) can be used as an
// EuiccCard rather than the ModemQrtr instance.
b.SetEuiccCard(modem_.get())
.SetSmdpClientFactory(&smdp_)
.SetSmdsClientFactory(&smds_)
.SetLogger(&logger_);
lpa_ = b.Build();
}
void Daemon::RegisterDBusObjectsAsync(
brillo::dbus_utils::AsyncEventSequencer* sequencer) {
Context::Initialize(bus_, lpa_.get(), &executor_, &adaptor_factory_);
manager_ = std::make_unique<Manager>();
}
} // namespace hermes