blob: 110d8f76245edfc2fb0ffa7e86b568c2f63c57f9 [file] [log] [blame] [edit]
// Copyright (c) 2011 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 SHILL_MODEM_
#define SHILL_MODEM_
#include <string>
#include <base/basictypes.h>
#include <base/memory/scoped_ptr.h>
#include <gtest/gtest_prod.h> // for FRIEND_TEST
#include "shill/dbus_properties_proxy_interface.h"
#include "shill/refptr_types.h"
namespace shill {
class ControlInterface;
class EventDispatcher;
class Manager;
// Handles an instance of ModemManager.Modem and an instance of a Cellular
// device.
class Modem {
public:
// |owner| is the ModemManager DBus service owner (e.g., ":1.17"). |path| is
// the ModemManager.Modem DBus object path (e.g.,
// "/org/chromium/ModemManager/Gobi/0").
Modem(const std::string &owner,
const std::string &path,
ControlInterface *control_interface,
EventDispatcher *dispatcher,
Manager *manager);
~Modem();
// Initializes support for the modem, possibly constructing a Cellular device.
void Init();
private:
friend class ModemManagerTest;
friend class ModemTest;
FRIEND_TEST(ModemTest, CreateCellularDevice);
FRIEND_TEST(ModemTest, Init);
static const char kPropertyLinkName[];
static const char kPropertyIPMethod[];
static const char kPropertyType[];
static const char kPropertyUnlockRequired[];
static const char kPropertyUnlockRetries[];
void CreateCellularDevice(const DBusPropertiesMap &properties);
// A proxy to the org.freedesktop.DBus.Properties interface used to obtain
// ModemManager.Modem properties and watch for property changes.
scoped_ptr<DBusPropertiesProxyInterface> dbus_properties_proxy_;
const std::string owner_;
const std::string path_;
CellularRefPtr device_;
ControlInterface *control_interface_;
EventDispatcher *dispatcher_;
Manager *manager_;
DISALLOW_COPY_AND_ASSIGN(Modem);
};
} // namespace shill
#endif // SHILL_MODEM_