Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 1 | // Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 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_MODEM_GSM_CARD_PROXY_INTERFACE_ |
| 6 | #define SHILL_MODEM_GSM_CARD_PROXY_INTERFACE_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
| 10 | namespace shill { |
| 11 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 12 | class AsyncCallHandler; |
| 13 | class Error; |
| 14 | |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 15 | // These are the methods that a ModemManager.Modem.Gsm.Card proxy must |
| 16 | // support. The interface is provided so that it can be mocked in tests. |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 17 | // All calls are made asynchronously. Call completion is signalled through |
| 18 | // the corresponding 'OnXXXCallback' method in the ProxyDelegate interface. |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 19 | class ModemGSMCardProxyInterface { |
| 20 | public: |
| 21 | virtual ~ModemGSMCardProxyInterface() {} |
| 22 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 23 | virtual void GetIMEI(AsyncCallHandler *call_handler, int timeout) = 0; |
| 24 | virtual void GetIMSI(AsyncCallHandler *call_handler, int timeout) = 0; |
| 25 | virtual void GetSPN(AsyncCallHandler *call_handler, int timeout) = 0; |
| 26 | virtual void GetMSISDN(AsyncCallHandler *call_handler, int timeout) = 0; |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 27 | |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 28 | virtual void EnablePIN(const std::string &pin, bool enabled, |
| 29 | AsyncCallHandler *call_handler, int timeout) = 0; |
| 30 | virtual void SendPIN(const std::string &pin, |
| 31 | AsyncCallHandler *call_handler, int timeout) = 0; |
| 32 | virtual void SendPUK(const std::string &puk, const std::string &pin, |
| 33 | AsyncCallHandler *call_handler, int timeout) = 0; |
Darin Petkov | e42e101 | 2011-08-31 12:35:04 -0700 | [diff] [blame] | 34 | virtual void ChangePIN(const std::string &old_pin, |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 35 | const std::string &new_pin, |
| 36 | AsyncCallHandler *call_handler, int timeout) = 0; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 37 | }; |
| 38 | |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 39 | // ModemManager.Modem.Gsm.Card callback delegate to be associated with the |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 40 | // proxy. |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 41 | class ModemGSMCardProxyDelegate { |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 42 | public: |
Darin Petkov | 580c7af | 2011-10-24 12:32:50 +0200 | [diff] [blame] | 43 | virtual ~ModemGSMCardProxyDelegate() {} |
Eric Shienbrood | 5de44ab | 2011-12-05 10:46:27 -0500 | [diff] [blame^] | 44 | |
| 45 | virtual void OnGetIMEICallback(const std::string &imei, |
| 46 | const Error &e, |
| 47 | AsyncCallHandler *call_handler) = 0; |
| 48 | virtual void OnGetIMSICallback(const std::string &imsi, |
| 49 | const Error &e, |
| 50 | AsyncCallHandler *call_handler) = 0; |
| 51 | virtual void OnGetSPNCallback(const std::string &spn, |
| 52 | const Error &e, |
| 53 | AsyncCallHandler *call_handler) = 0; |
| 54 | virtual void OnGetMSISDNCallback(const std::string &misisdn, |
| 55 | const Error &e, |
| 56 | AsyncCallHandler *call_handler) = 0; |
| 57 | // Callback used for all four PIN operations: EnablePIN, SendPIN, |
| 58 | // SendPUK, and ChangePIN. |
| 59 | virtual void OnPINOperationCallback(const Error &e, |
| 60 | AsyncCallHandler *call_handler) = 0; |
Darin Petkov | 975b5e7 | 2011-08-30 11:48:08 -0700 | [diff] [blame] | 61 | }; |
| 62 | |
| 63 | } // namespace shill |
| 64 | |
| 65 | #endif // SHILL_MODEM_GSM_CARD_PROXY_INTERFACE_ |