blob: e9472f04f6fa6976d9f1d5e19b950337898b0cbd [file] [log] [blame]
Jason Glasgow74f5ef22012-03-29 16:15:04 -04001// 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
14namespace shill {
15namespace mm1 {
16
mukesh agrawalf407d592013-07-31 11:37:57 -070017// A proxy to org.freedesktop.ModemManager1.Sim.
Jason Glasgow74f5ef22012-03-29 16:15:04 -040018class SimProxy : public SimProxyInterface {
19 public:
mukesh agrawalf407d592013-07-31 11:37:57 -070020 // Constructs an org.freedesktop.ModemManager1.Sim DBus object
Jason Glasgow74f5ef22012-03-29 16:15:04 -040021 // proxy at |path| owned by |service|.
22 SimProxy(DBus::Connection *connection,
23 const std::string &path,
24 const std::string &service);
25 virtual ~SimProxy();
26
27 // Inherited methods from SimProxyInterface.
28 virtual void SendPin(const std::string &pin,
29 Error *error,
30 const ResultCallback &callback,
31 int timeout);
32 virtual void SendPuk(const std::string &puk,
33 const std::string &pin,
34 Error *error,
35 const ResultCallback &callback,
36 int timeout);
37 virtual void EnablePin(const std::string &pin,
38 const bool enabled,
39 Error *error,
40 const ResultCallback &callback,
41 int timeout);
42 virtual void ChangePin(const std::string &old_pin,
43 const std::string &new_pin,
44 Error *error,
45 const ResultCallback &callback,
46 int timeout);
47
48 // Inherited properties from SimProxyInterface.
49 virtual const std::string SimIdentifier();
50 virtual const std::string Imsi();
51 virtual const std::string OperatorIdentifier();
52 virtual const std::string OperatorName();
53
54 private:
55 class Proxy : public org::freedesktop::ModemManager1::Sim_proxy,
56 public DBus::ObjectProxy {
57 public:
58 Proxy(DBus::Connection *connection,
59 const std::string &path,
60 const std::string &service);
61 virtual ~Proxy();
62
63 private:
64 // Method callbacks inherited from
65 // org::freedesktop::ModemManager1::SimProxy
66 virtual void SendPinCallback(const ::DBus::Error &dberror,
67 void *data);
68 virtual void SendPukCallback(const ::DBus::Error &dberror,
69 void *data);
Gary Morainabb30da2012-05-08 16:59:59 -070070 virtual void EnablePinCallback(const ::DBus::Error &dberror,
71 void *data);
72 virtual void ChangePinCallback(const ::DBus::Error &dberror,
73 void *data);
Jason Glasgow74f5ef22012-03-29 16:15:04 -040074
75 DISALLOW_COPY_AND_ASSIGN(Proxy);
76 };
77
78 Proxy proxy_;
79
80 DISALLOW_COPY_AND_ASSIGN(SimProxy);
81};
82
83} // namespace mm1
84} // namespace shill
85
86#endif // SHILL_MM1_SIM_PROXY_