Jason Glasgow | 74f5ef2 | 2012-03-29 16:15:04 -0400 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
| 2 | // 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_MM1_SIM_PROXY_ |
| 6 | #define SHILL_MM1_SIM_PROXY_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | #include "shill/dbus_bindings/mm1-sim.h" |
| 11 | #include "shill/dbus_properties.h" |
| 12 | #include "shill/mm1_sim_proxy_interface.h" |
| 13 | |
| 14 | namespace shill { |
| 15 | namespace mm1 { |
| 16 | |
| 17 | class SimProxy : public SimProxyInterface { |
| 18 | public: |
| 19 | // Constructs a org.freedesktop.ModemManager1.Modem DBus object |
| 20 | // proxy at |path| owned by |service|. |
| 21 | SimProxy(DBus::Connection *connection, |
| 22 | const std::string &path, |
| 23 | const std::string &service); |
| 24 | virtual ~SimProxy(); |
| 25 | |
| 26 | // Inherited methods from SimProxyInterface. |
| 27 | virtual void SendPin(const std::string &pin, |
| 28 | Error *error, |
| 29 | const ResultCallback &callback, |
| 30 | int timeout); |
| 31 | virtual void SendPuk(const std::string &puk, |
| 32 | const std::string &pin, |
| 33 | Error *error, |
| 34 | const ResultCallback &callback, |
| 35 | int timeout); |
| 36 | virtual void EnablePin(const std::string &pin, |
| 37 | const bool enabled, |
| 38 | Error *error, |
| 39 | const ResultCallback &callback, |
| 40 | int timeout); |
| 41 | virtual void ChangePin(const std::string &old_pin, |
| 42 | const std::string &new_pin, |
| 43 | Error *error, |
| 44 | const ResultCallback &callback, |
| 45 | int timeout); |
| 46 | |
| 47 | // Inherited properties from SimProxyInterface. |
| 48 | virtual const std::string SimIdentifier(); |
| 49 | virtual const std::string Imsi(); |
| 50 | virtual const std::string OperatorIdentifier(); |
| 51 | virtual const std::string OperatorName(); |
| 52 | |
| 53 | private: |
| 54 | class Proxy : public org::freedesktop::ModemManager1::Sim_proxy, |
| 55 | public DBus::ObjectProxy { |
| 56 | public: |
| 57 | Proxy(DBus::Connection *connection, |
| 58 | const std::string &path, |
| 59 | const std::string &service); |
| 60 | virtual ~Proxy(); |
| 61 | |
| 62 | private: |
| 63 | // Method callbacks inherited from |
| 64 | // org::freedesktop::ModemManager1::SimProxy |
| 65 | virtual void SendPinCallback(const ::DBus::Error &dberror, |
| 66 | void *data); |
| 67 | virtual void SendPukCallback(const ::DBus::Error &dberror, |
| 68 | void *data); |
| 69 | virtual void EnableCallback(const ::DBus::Error &dberror, |
| 70 | void *data); |
| 71 | virtual void ChangeCallback(const ::DBus::Error &dberror, |
| 72 | void *data); |
| 73 | |
| 74 | DISALLOW_COPY_AND_ASSIGN(Proxy); |
| 75 | }; |
| 76 | |
| 77 | Proxy proxy_; |
| 78 | |
| 79 | DISALLOW_COPY_AND_ASSIGN(SimProxy); |
| 80 | }; |
| 81 | |
| 82 | } // namespace mm1 |
| 83 | } // namespace shill |
| 84 | |
| 85 | #endif // SHILL_MM1_SIM_PROXY_ |