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_MODEM_GOBI_PROXY_H_
18#define SHILL_DBUS_CHROMEOS_MODEM_GOBI_PROXY_H_
19
20#include <string>
21
22#include <base/macros.h>
23
24#include "cellular/dbus-proxies.h"
25#include "shill/cellular/modem_gobi_proxy_interface.h"
26
27namespace shill {
28
29// A proxy to (old) ModemManager.Modem.Gobi.
30class ChromeosModemGobiProxy : public ModemGobiProxyInterface {
31 public:
32  // Constructs a ModemManager.Modem.Gobi DBus object proxy at |path| owned by
33  // |service|.
34  ChromeosModemGobiProxy(const scoped_refptr<dbus::Bus>& bus,
35                         const std::string& path,
36                         const std::string& service);
37  ~ChromeosModemGobiProxy() override;
38
39  // Inherited from ModemGobiProxyInterface.
40  void SetCarrier(const std::string& carrier,
41                  Error* error,
42                  const ResultCallback& callback,
43                  int timeout) override;
44
45 private:
46  // Callbacks for SetCarrier async call.
47  void OnSetCarrierSuccess(const ResultCallback& callback);
48  void OnSetCarrierFailure(const ResultCallback& callback,
49                           brillo::Error* dbus_error);
50
51  std::unique_ptr<org::chromium::ModemManager::Modem::GobiProxy> proxy_;
52
53  base::WeakPtrFactory<ChromeosModemGobiProxy> weak_factory_{this};
54  DISALLOW_COPY_AND_ASSIGN(ChromeosModemGobiProxy);
55};
56
57}  // namespace shill
58
59#endif  // SHILL_DBUS_CHROMEOS_MODEM_GOBI_PROXY_H_
60