blob: f09ab60f1a659b3bc38fc8723603abde512b52bb [file] [log] [blame]
// Copyright 2017 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.
#ifndef MODEMFWD_DAEMON_H_
#define MODEMFWD_DAEMON_H_
#include <memory>
#include <string>
#include <base/files/file_path.h>
#include <base/memory/weak_ptr.h>
#include <brillo/daemons/dbus_daemon.h>
#include "modemfwd/modem.h"
#include "modemfwd/modem_flasher.h"
#include "modemfwd/modem_tracker.h"
namespace modemfwd {
class Daemon : public brillo::DBusDaemon {
public:
Daemon(const std::string& helper_directory,
const std::string& firmware_directory);
~Daemon() override = default;
protected:
// brillo::Daemon overrides.
int OnInit() override;
private:
// Called when a modem appears. Generally this means on startup but can
// also be called in response to e.g. rebooting the modem or SIM hot
// swapping.
void OnModemAppeared(std::unique_ptr<Modem> modem);
base::FilePath helper_dir_path_;
base::FilePath firmware_dir_path_;
std::unique_ptr<ModemTracker> modem_tracker_;
std::unique_ptr<ModemFlasher> modem_flasher_;
base::WeakPtrFactory<Daemon> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(Daemon);
};
} // namespace modemfwd
#endif // MODEMFWD_DAEMON_H_