blob: 5da1d8ccf449c1b628e58e6db9c3f1a675983ebb [file] [log] [blame]
Darin Petkov63138a92012-02-06 14:09:15 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masoned7732e42011-05-20 11:08:56 -07002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef SHILL_DEVICE_DBUS_ADAPTOR_H_
6#define SHILL_DEVICE_DBUS_ADAPTOR_H_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12
13#include "shill/adaptor_interfaces.h"
14#include "shill/dbus_adaptor.h"
Darin Petkov4a09b6b2011-07-19 12:52:06 -070015#include "shill/dbus_bindings/flimflam-device.h"
Chris Masoned7732e42011-05-20 11:08:56 -070016
17namespace shill {
Chris Masoned7732e42011-05-20 11:08:56 -070018
Chris Masoneec6b18b2011-06-08 14:09:10 -070019class Device;
20
Chris Masoned7732e42011-05-20 11:08:56 -070021// Subclass of DBusAdaptor for Device objects
Chris Masoneec6b18b2011-06-08 14:09:10 -070022// There is a 1:1 mapping between Device and DeviceDBusAdaptor instances.
23// Furthermore, the Device owns the DeviceDBusAdaptor and manages its lifetime,
24// so we're OK with DeviceDBusAdaptor having a bare pointer to its owner device.
Chris Masoned7732e42011-05-20 11:08:56 -070025class DeviceDBusAdaptor : public org::chromium::flimflam::Device_adaptor,
26 public DBusAdaptor,
27 public DeviceAdaptorInterface {
28 public:
Chris Masoned7732e42011-05-20 11:08:56 -070029 static const char kPath[];
30
Chris Masoneec6b18b2011-06-08 14:09:10 -070031 DeviceDBusAdaptor(DBus::Connection* conn, Device *device);
Chris Masoned7732e42011-05-20 11:08:56 -070032 virtual ~DeviceDBusAdaptor();
Chris Masoned7732e42011-05-20 11:08:56 -070033
Chris Masoned0ceb8c2011-06-02 10:05:39 -070034 // Implementation of DeviceAdaptorInterface.
Chris Masone4e851612011-07-01 10:46:53 -070035 virtual const std::string &GetRpcIdentifier();
36 virtual const std::string &GetRpcConnectionIdentifier();
Chris Masone4e851612011-07-01 10:46:53 -070037 virtual void EmitBoolChanged(const std::string& name, bool value);
38 virtual void EmitUintChanged(const std::string& name, uint32 value);
39 virtual void EmitIntChanged(const std::string& name, int value);
40 virtual void EmitStringChanged(const std::string& name,
41 const std::string& value);
Darin Petkov3cfbf212011-11-21 16:02:09 +010042 virtual void EmitStringmapsChanged(const std::string &name,
43 const Stringmaps &value);
Darin Petkov63138a92012-02-06 14:09:15 +010044 virtual void EmitKeyValueStoreChanged(const std::string &name,
45 const KeyValueStore &value);
Chris Masoned0ceb8c2011-06-02 10:05:39 -070046
47 // Implementation of Device_adaptor.
Darin Petkov9ae310f2011-08-30 15:41:13 -070048 virtual std::map<std::string, ::DBus::Variant> GetProperties(
49 ::DBus::Error &error);
50 virtual void SetProperty(const std::string& name,
51 const ::DBus::Variant& value,
52 ::DBus::Error &error);
53 virtual void ClearProperty(const std::string& , ::DBus::Error &error);
Eric Shienbrood9a245532012-03-07 14:20:39 -050054 virtual void Enable(::DBus::Error &error);
55 virtual void Disable(::DBus::Error &error);
Darin Petkov9ae310f2011-08-30 15:41:13 -070056 virtual void ProposeScan(::DBus::Error &error);
57 virtual ::DBus::Path AddIPConfig(const std::string& , ::DBus::Error &error);
58 virtual void Register(const std::string &network_id, ::DBus::Error &error);
Darin Petkove42e1012011-08-31 12:35:04 -070059 virtual void RequirePin(const std::string &pin,
60 const bool &require,
Darin Petkov9ae310f2011-08-30 15:41:13 -070061 ::DBus::Error &error);
Darin Petkove42e1012011-08-31 12:35:04 -070062 virtual void EnterPin(const std::string &pin, ::DBus::Error &error);
63 virtual void UnblockPin(const std::string &unblock_code,
64 const std::string &pin,
Darin Petkov9ae310f2011-08-30 15:41:13 -070065 ::DBus::Error &error);
Darin Petkove42e1012011-08-31 12:35:04 -070066 virtual void ChangePin(const std::string &old_pin,
67 const std::string &new_pin,
Darin Petkov9ae310f2011-08-30 15:41:13 -070068 ::DBus::Error &error);
Ben Chanad663e12013-01-08 01:58:47 -080069 virtual void Reset(::DBus::Error &error);
Paul Stewart6ff27f52012-07-11 06:51:41 -070070 virtual void ResetByteCounters(::DBus::Error &error);
Darin Petkovc37a9c42012-09-06 15:28:22 +020071 virtual void SetCarrier(const std::string &carrier, ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070072
73 private:
Chris Masoneec6b18b2011-06-08 14:09:10 -070074 Device *device_;
Chris Masone4e851612011-07-01 10:46:53 -070075 const std::string connection_name_;
Chris Masoned7732e42011-05-20 11:08:56 -070076 DISALLOW_COPY_AND_ASSIGN(DeviceDBusAdaptor);
77};
78
79} // namespace shill
80#endif // SHILL_DEVICE_DBUS_ADAPTOR_H_