blob: 93d33e58bb45efd4cace216481d8f60b269a0ba6 [file] [log] [blame]
// Copyright 2018 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SHILL_DBUS_CHROMEOS_MM1_MODEM_LOCATION_PROXY_H_
#define SHILL_DBUS_CHROMEOS_MM1_MODEM_LOCATION_PROXY_H_
#include <map>
#include <memory>
#include <string>
#include "cellular/dbus-proxies.h"
#include "shill/cellular/mm1_modem_location_proxy_interface.h"
namespace shill {
namespace mm1 {
// A proxy to org.freedesktop.ModemManager1.Modem.Location.
class ChromeosModemLocationProxy : public ModemLocationProxyInterface {
public:
// Constructs an org.freedesktop.ModemManager1.Modem.Location DBus
// object proxy at |path| owned by |service|.
ChromeosModemLocationProxy(const scoped_refptr<dbus::Bus>& bus,
const std::string& path,
const std::string& service);
~ChromeosModemLocationProxy() override;
// Inherited methods from ModemLocationProxyInterface.
void Setup(uint32_t sources,
bool signal_location,
Error* error,
const ResultCallback& callback,
int timeout) override;
void GetLocation(Error* error,
const BrilloAnyCallback& callback,
int timeout) override;
private:
// Callbacks for Setup async call.
void OnSetupSuccess(const ResultCallback& callback);
void OnSetupFailure(const ResultCallback& callback,
brillo::Error* dbus_error);
// Callbacks for GetLocation async call.
void OnGetLocationSuccess(const BrilloAnyCallback& callback,
const std::map<uint32_t, brillo::Any>& results);
void OnGetLocationFailure(const BrilloAnyCallback& callback,
brillo::Error* dbus_error);
std::unique_ptr<org::freedesktop::ModemManager1::Modem::LocationProxy> proxy_;
base::WeakPtrFactory<ChromeosModemLocationProxy> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ChromeosModemLocationProxy);
};
} // namespace mm1
} // namespace shill
#endif // SHILL_DBUS_CHROMEOS_MM1_MODEM_LOCATION_PROXY_H_