1 // 2 // Copyright (C) 2012 The Android Open Source Project 3 // 4 // Licensed under the Apache License, Version 2.0 (the "License"); 5 // you may not use this file except in compliance with the License. 6 // You may obtain a copy of the License at 7 // 8 // http://www.apache.org/licenses/LICENSE-2.0 9 // 10 // Unless required by applicable law or agreed to in writing, software 11 // distributed under the License is distributed on an "AS IS" BASIS, 12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 // See the License for the specific language governing permissions and 14 // limitations under the License. 15 // 16 17 #ifndef SHILL_CELLULAR_MODEM_GSM_NETWORK_PROXY_INTERFACE_H_ 18 #define SHILL_CELLULAR_MODEM_GSM_NETWORK_PROXY_INTERFACE_H_ 19 20 #include <map> 21 #include <string> 22 #include <vector> 23 24 #include "shill/callbacks.h" 25 26 namespace shill { 27 28 class Error; 29 30 typedef std::map<std::string, std::string> GSMScanResult; 31 typedef std::vector<GSMScanResult> GSMScanResults; 32 33 typedef base::Callback<void(uint32_t)> SignalQualitySignalCallback; 34 typedef base::Callback<void( 35 uint32_t, 36 const std::string&, 37 const std::string&)> RegistrationInfoSignalCallback; 38 typedef base::Callback<void(uint32_t)> NetworkModeSignalCallback; 39 40 typedef base::Callback<void(uint32_t, const Error&)> SignalQualityCallback; 41 typedef base::Callback<void(uint32_t, 42 const std::string&, 43 const std::string&, 44 const Error&)> RegistrationInfoCallback; 45 typedef base::Callback<void(const GSMScanResults&, 46 const Error&)> ScanResultsCallback; 47 48 // These are the methods that a ModemManager.Modem.Gsm.Network proxy must 49 // support. The interface is provided so that it can be mocked in tests. 50 // All calls are made asynchronously. 51 // XXX fixup comment to reflect new reality 52 class ModemGSMNetworkProxyInterface { 53 public: 54 virtual ~ModemGSMNetworkProxyInterface() {} 55 56 virtual void GetRegistrationInfo(Error* error, 57 const RegistrationInfoCallback& callback, 58 int timeout) = 0; 59 virtual void GetSignalQuality(Error* error, 60 const SignalQualityCallback& callback, 61 int timeout) = 0; 62 virtual void Register(const std::string& network_id, 63 Error* error, const ResultCallback& callback, 64 int timeout) = 0; 65 virtual void Scan(Error* error, const ScanResultsCallback& callback, 66 int timeout) = 0; 67 68 // Properties. 69 virtual uint32_t AccessTechnology() = 0; 70 // Signal callbacks 71 virtual void set_signal_quality_callback( 72 const SignalQualitySignalCallback& callback) = 0; 73 virtual void set_network_mode_callback( 74 const NetworkModeSignalCallback& callback) = 0; 75 virtual void set_registration_info_callback( 76 const RegistrationInfoSignalCallback& callback) = 0; 77 }; 78 79 } // namespace shill 80 81 #endif // SHILL_CELLULAR_MODEM_GSM_NETWORK_PROXY_INTERFACE_H_ 82