blob: 06103d4fbcc8abebe135567179d08182be5ca9f7 [file] [log] [blame]
// Copyright (c) 2012 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_PROXY_H_
#define SHILL_MODEM_PROXY_H_
#include <string>
#include <base/basictypes.h>
#include "dbus_proxies/org.freedesktop.ModemManager.Modem.h"
#include "shill/modem_proxy_interface.h"
namespace shill {
// A proxy to (old) ModemManager.Modem.
class ModemProxy : public ModemProxyInterface {
public:
// Constructs a ModemManager.Modem DBus object proxy at |path| owned by
// |service|.
ModemProxy(DBus::Connection *connection,
const std::string &path,
const std::string &service);
~ModemProxy() override;
// Inherited from ModemProxyInterface.
virtual void Enable(bool enable, Error *error,
const ResultCallback &callback, int timeout);
virtual void Disconnect(Error *error, const ResultCallback &callback,
int timeout);
virtual void GetModemInfo(Error *error, const ModemInfoCallback &callback,
int timeout);
virtual void set_state_changed_callback(
const ModemStateChangedSignalCallback &callback);
private:
class Proxy : public org::freedesktop::ModemManager::Modem_proxy,
public DBus::ObjectProxy {
public:
Proxy(DBus::Connection *connection,
const std::string &path,
const std::string &service);
~Proxy() override;
void set_state_changed_callback(
const ModemStateChangedSignalCallback &callback);
private:
// Signal callbacks inherited from ModemManager::Modem_proxy.
virtual void StateChanged(
const uint32_t &old, const uint32_t &_new, const uint32_t &reason);
// Method callbacks inherited from ModemManager::Modem_proxy.
virtual void EnableCallback(const DBus::Error &dberror, void *data);
virtual void GetInfoCallback(const ModemHardwareInfo &info,
const DBus::Error &dberror, void *data);
virtual void DisconnectCallback(const DBus::Error &dberror, void *data);
ModemStateChangedSignalCallback state_changed_callback_;
DISALLOW_COPY_AND_ASSIGN(Proxy);
};
Proxy proxy_;
DISALLOW_COPY_AND_ASSIGN(ModemProxy);
};
} // namespace shill
#endif // SHILL_MODEM_PROXY_H_