blob: f087467ff4f1c21a5c3f8bfd2981eee344f4f08d [file] [log] [blame]
Eric Shienbrood5de44ab2011-12-05 10:46:27 -05001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Darin Petkov975b5e72011-08-30 11:48:08 -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_MODEM_GSM_CARD_PROXY_
6#define SHILL_MODEM_GSM_CARD_PROXY_
7
Hristo Stefanoved2c28c2011-11-29 15:37:30 -08008#include <string>
9
Darin Petkov975b5e72011-08-30 11:48:08 -070010#include <base/basictypes.h>
11
12#include "shill/dbus_bindings/modem-gsm-card.h"
13#include "shill/modem_gsm_card_proxy_interface.h"
14
15namespace shill {
16
17class ModemGSMCardProxy : public ModemGSMCardProxyInterface {
18 public:
19 // Constructs a ModemManager.Modem.Gsm.Card DBus object proxy at |path| owned
Darin Petkov580c7af2011-10-24 12:32:50 +020020 // by |service|. Callbacks will be dispatched to |delegate|.
21 ModemGSMCardProxy(ModemGSMCardProxyDelegate *delegate,
Darin Petkov975b5e72011-08-30 11:48:08 -070022 DBus::Connection *connection,
23 const std::string &path,
24 const std::string &service);
25 virtual ~ModemGSMCardProxy();
26
27 // Inherited from ModemGSMCardProxyInterface.
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050028 virtual void GetIMEI(AsyncCallHandler *call_handler, int timeout);
29 virtual void GetIMSI(AsyncCallHandler *call_handler, int timeout);
30 virtual void GetSPN(AsyncCallHandler *call_handler, int timeout);
31 virtual void GetMSISDN(AsyncCallHandler *call_handler, int timeout);
32 virtual void EnablePIN(const std::string &pin, bool enabled,
33 AsyncCallHandler *call_handler, int timeout);
34 virtual void SendPIN(const std::string &pin,
35 AsyncCallHandler *call_handler, int timeout);
36 virtual void SendPUK(const std::string &puk, const std::string &pin,
37 AsyncCallHandler *call_handler, int timeout);
Darin Petkove42e1012011-08-31 12:35:04 -070038 virtual void ChangePIN(const std::string &old_pin,
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050039 const std::string &new_pin,
40 AsyncCallHandler *call_handler, int timeout);
Darin Petkov975b5e72011-08-30 11:48:08 -070041
42 private:
43 class Proxy
44 : public org::freedesktop::ModemManager::Modem::Gsm::Card_proxy,
45 public DBus::ObjectProxy {
46 public:
Darin Petkov580c7af2011-10-24 12:32:50 +020047 Proxy(ModemGSMCardProxyDelegate *delegate,
Darin Petkov975b5e72011-08-30 11:48:08 -070048 DBus::Connection *connection,
49 const std::string &path,
50 const std::string &service);
51 virtual ~Proxy();
52
53 private:
54 // Signal callbacks inherited from ModemManager::Modem::Gsm::Card_proxy.
Eric Shienbrood5de44ab2011-12-05 10:46:27 -050055 // [None]
56
57 // Method callbacks inherited from ModemManager::Modem::Gsm::Card_proxy.
58 virtual void GetImeiCallback(const std::string &imei,
59 const DBus::Error &dberror, void *data);
60 virtual void GetImsiCallback(const std::string &imsi,
61 const DBus::Error &dberror, void *data);
62 virtual void GetSpnCallback(const std::string &spn,
63 const DBus::Error &dberror, void *data);
64 virtual void GetMsIsdnCallback(const std::string &misisdn,
65 const DBus::Error &dberror, void *data);
66 virtual void EnablePinCallback(const DBus::Error &dberror, void *data);
67 virtual void SendPinCallback(const DBus::Error &dberror, void *data);
68 virtual void SendPukCallback(const DBus::Error &dberror, void *data);
69 virtual void ChangePinCallback(const DBus::Error &dberror, void *data);
Darin Petkov975b5e72011-08-30 11:48:08 -070070
Darin Petkov580c7af2011-10-24 12:32:50 +020071 ModemGSMCardProxyDelegate *delegate_;
Darin Petkov975b5e72011-08-30 11:48:08 -070072
73 DISALLOW_COPY_AND_ASSIGN(Proxy);
74 };
75
76 Proxy proxy_;
77
78 DISALLOW_COPY_AND_ASSIGN(ModemGSMCardProxy);
79};
80
81} // namespace shill
82
83#endif // SHILL_MODEM_GSM_CARD_PROXY_