1 // 2 // Copyright (C) 2015 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_DBUS_CHROMEOS_MM1_MODEM_MODEM3GPP_PROXY_H_ 18 #define SHILL_DBUS_CHROMEOS_MM1_MODEM_MODEM3GPP_PROXY_H_ 19 20 #include <string> 21 #include <vector> 22 23 #include "cellular/dbus-proxies.h" 24 #include "shill/cellular/mm1_modem_modem3gpp_proxy_interface.h" 25 26 namespace shill { 27 namespace mm1 { 28 29 // A proxy to org.freedesktop.ModemManager1.Modem.Modem3gpp. 30 class ChromeosModemModem3gppProxy : public ModemModem3gppProxyInterface { 31 public: 32 // Constructs an org.freedesktop.ModemManager1.Modem.Modem3gpp DBus 33 // object proxy at |path| owned by |service|. 34 ChromeosModemModem3gppProxy(const scoped_refptr<dbus::Bus>& bus, 35 const std::string& path, 36 const std::string& service); 37 ~ChromeosModemModem3gppProxy() override; 38 // Inherited methods from ModemModem3gppProxyInterface. 39 void Register(const std::string& operator_id, 40 Error* error, 41 const ResultCallback& callback, 42 int timeout) override; 43 void Scan(Error* error, 44 const KeyValueStoresCallback& callback, 45 int timeout) override; 46 47 private: 48 // Callbacks for Register async call. 49 void OnRegisterSuccess(const ResultCallback& callback); 50 void OnRegisterFailure(const ResultCallback& callback, 51 brillo::Error* dbus_error); 52 53 // Callbacks for Scan async call. 54 void OnScanSuccess(const KeyValueStoresCallback& callback, 55 const std::vector<brillo::VariantDictionary>& results); 56 void OnScanFailure(const KeyValueStoresCallback& callback, 57 brillo::Error* dbus_error); 58 59 std::unique_ptr<org::freedesktop::ModemManager1::Modem::Modem3gppProxy> 60 proxy_; 61 62 base::WeakPtrFactory<ChromeosModemModem3gppProxy> weak_factory_{this}; 63 DISALLOW_COPY_AND_ASSIGN(ChromeosModemModem3gppProxy); 64 }; 65 66 } // namespace mm1 67 } // namespace shill 68 69 #endif // SHILL_DBUS_CHROMEOS_MM1_MODEM_MODEM3GPP_PROXY_H_ 70