blob: 80e66f232576cef2167dd0dc7b3b4179ef5ec2ad [file] [log] [blame]
Darin Petkovd78ee7e2012-01-12 11:21:10 +01001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
Chris Masoned7732e42011-05-20 11:08:56 -07002// 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_SERVICE_DBUS_ADAPTOR_H_
6#define SHILL_SERVICE_DBUS_ADAPTOR_H_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12
13#include "shill/adaptor_interfaces.h"
14#include "shill/dbus_adaptor.h"
Darin Petkov4a09b6b2011-07-19 12:52:06 -070015#include "shill/dbus_bindings/flimflam-service.h"
Chris Masoned7732e42011-05-20 11:08:56 -070016
17namespace shill {
Chris Masoned7732e42011-05-20 11:08:56 -070018
Chris Masoneec6b18b2011-06-08 14:09:10 -070019class Service;
20
Chris Masoned7732e42011-05-20 11:08:56 -070021// Subclass of DBusAdaptor for Service objects
Chris Masoneec6b18b2011-06-08 14:09:10 -070022// There is a 1:1 mapping between Service and ServiceDBusAdaptor
23// instances. Furthermore, the Service owns the ServiceDBusAdaptor
24// and manages its lifetime, so we're OK with ServiceDBusAdaptor
25// having a bare pointer to its owner service.
Chris Masoned7732e42011-05-20 11:08:56 -070026class ServiceDBusAdaptor : public org::chromium::flimflam::Service_adaptor,
27 public DBusAdaptor,
28 public ServiceAdaptorInterface {
29 public:
Chris Masoned7732e42011-05-20 11:08:56 -070030 static const char kPath[];
31
mukesh agrawalbebf1b82013-04-23 15:06:33 -070032 ServiceDBusAdaptor(DBus::Connection *conn, Service *service);
Chris Masoned7732e42011-05-20 11:08:56 -070033 virtual ~ServiceDBusAdaptor();
Chris Masoned0ceb8c2011-06-02 10:05:39 -070034
35 // Implementation of ServiceAdaptorInterface.
Chris Masone95207da2011-06-29 16:50:49 -070036 virtual const std::string &GetRpcIdentifier() { return path(); }
Darin Petkovd78ee7e2012-01-12 11:21:10 +010037 virtual void UpdateConnected();
38 virtual void EmitBoolChanged(const std::string &name, bool value);
39 virtual void EmitUint8Changed(const std::string &name, uint8 value);
mukesh agrawale1d90e92012-02-15 17:36:08 -080040 virtual void EmitUint16Changed(const std::string &name, uint16 value);
Darin Petkovd78ee7e2012-01-12 11:21:10 +010041 virtual void EmitUintChanged(const std::string &name, uint32 value);
42 virtual void EmitIntChanged(const std::string &name, int value);
Paul Stewart1e3bc4962012-09-14 12:20:22 -070043 virtual void EmitRpcIdentifierChanged(
44 const std::string &name, const std::string &value);
Darin Petkovd78ee7e2012-01-12 11:21:10 +010045 virtual void EmitStringChanged(
mukesh agrawale1d90e92012-02-15 17:36:08 -080046 const std::string &name, const std::string &value);
Darin Petkov9cb02682012-01-28 00:17:38 +010047 virtual void EmitStringmapChanged(const std::string &name,
48 const Stringmap &value);
Chris Masoned7732e42011-05-20 11:08:56 -070049
50 // Implementation of Service_adaptor
51 std::map<std::string, ::DBus::Variant> GetProperties(::DBus::Error &error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070052 void SetProperty(const std::string& name,
53 const ::DBus::Variant& value,
Chris Masoned7732e42011-05-20 11:08:56 -070054 ::DBus::Error &error);
Paul Stewartbcb2c962012-10-31 10:52:10 -070055 void ClearProperty(const std::string&, ::DBus::Error &error);
56 std::vector<bool> ClearProperties(const std::vector<std::string>&,
57 ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070058 void Connect(::DBus::Error &error);
59 void Disconnect(::DBus::Error &error);
60 void Remove(::DBus::Error &error);
61 void MoveBefore(const ::DBus::Path& , ::DBus::Error &error);
62 void MoveAfter(const ::DBus::Path& , ::DBus::Error &error);
Darin Petkovc408e692011-08-17 13:47:15 -070063 void ActivateCellularModem(const std::string &carrier, ::DBus::Error &error);
Ben Chan5d924542013-02-14 17:49:08 -080064 void CompleteCellularActivation(::DBus::Error &error);
Paul Stewart967eaeb2013-04-25 19:53:07 -070065 std::map<::DBus::Path, std::string> GetLoadableProfileEntries(
66 ::DBus::Error &error);
Chris Masoned7732e42011-05-20 11:08:56 -070067
68 private:
Chris Masoneec6b18b2011-06-08 14:09:10 -070069 Service *service_;
Darin Petkovc408e692011-08-17 13:47:15 -070070
Chris Masoned7732e42011-05-20 11:08:56 -070071 DISALLOW_COPY_AND_ASSIGN(ServiceDBusAdaptor);
72};
73
74} // namespace shill
75#endif // SHILL_SERVICE_DBUS_ADAPTOR_H_