| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef SRC_CASHEW_SERVER_H_ | 5 #ifndef SRC_CASHEW_SERVER_H_ |
| 6 #define SRC_CASHEW_SERVER_H_ | 6 #define SRC_CASHEW_SERVER_H_ |
| 7 | 7 |
| 8 #include <glib.h> | |
| 9 | |
| 10 #include <map> | 8 #include <map> |
| 11 #include <string> | 9 #include <string> |
| 12 #include <vector> | 10 #include <vector> |
| 13 | 11 |
| 14 #include <base/basictypes.h> // NOLINT | 12 #include <base/basictypes.h> // NOLINT |
| 15 #include <dbus-c++/dbus.h> // NOLINT | 13 #include <dbus-c++/dbus.h> // NOLINT |
| 16 | 14 |
| 17 #include "src/cashew_server_glue.h" | 15 #include "src/cashew_server_glue.h" |
| 18 #include "src/data_plan.h" | 16 #include "src/data_plan.h" |
| 19 #include "src/service.h" | 17 #include "src/service.h" |
| 20 | 18 |
| 21 namespace cashew { | 19 namespace cashew { |
| 22 | 20 |
| 23 class ServiceManager; | 21 class ServiceManager; |
| 24 | 22 |
| 25 // Implements Cashew D-Bus API | 23 // Implements Cashew D-Bus API |
| 26 class CashewServer : public org::chromium::Cashew_adaptor, | 24 class CashewServer : public org::chromium::Cashew_adaptor, |
| 27 public DBus::IntrospectableAdaptor, | 25 public DBus::IntrospectableAdaptor, |
| 28 public DBus::ObjectAdaptor { | 26 public DBus::ObjectAdaptor { |
| 29 public: | 27 public: |
| 30 CashewServer(DBus::Connection& connection, // NOLINT | 28 CashewServer(DBus::Connection& connection, // NOLINT |
| 31 ServiceManager * const service_manager, | 29 ServiceManager * const service_manager); |
| 32 GMainLoop * const main_loop); | |
| 33 virtual ~CashewServer(); | 30 virtual ~CashewServer(); |
| 34 | 31 |
| 35 // Cashew D-Bus API methods | 32 // Cashew D-Bus API methods |
| 36 | 33 |
| 37 // Get data plan info for a cellular service | 34 // Get data plan info for a cellular service |
| 38 virtual DBusDataPlanList GetDataPlans(const std::string& service_path, | 35 virtual DBusDataPlanList GetDataPlans(const std::string& service_path, |
| 39 DBus::Error& error); // NOLINT | 36 DBus::Error& error); // NOLINT |
| 40 | 37 |
| 41 // Request that a DataPlansUpdate signal be sent for a cellular service | 38 // Request that a DataPlansUpdate signal be sent for a cellular service |
| 42 virtual void RequestDataPlansUpdate(const std::string& service_path, | 39 virtual void RequestDataPlansUpdate(const std::string& service_path, |
| 43 DBus::Error& error); // NOLINT | 40 DBus::Error& error); // NOLINT |
| 44 | 41 |
| 45 // Test method to verify that Cashew service is working | 42 // Test method to verify that Cashew service is working |
| 46 virtual bool IsAlive(DBus::Error& error); // NOLINT | 43 virtual bool IsAlive(DBus::Error& error); // NOLINT |
| 47 | 44 |
| 48 static const char* kServiceName; | 45 static const char* kServiceName; |
| 49 static const char* kServicePath; | 46 static const char* kServicePath; |
| 50 | 47 |
| 51 // Service Manager methods | 48 // Service Manager methods |
| 52 | 49 |
| 53 // Service Manager wants us to emit an update for a Service | 50 // Service Manager wants us to emit an update for a Service |
| 54 virtual void EmitDataPlansUpdate(const Service& service); | 51 virtual void EmitDataPlansUpdate(const Service& service); |
| 55 | 52 |
| 56 private: | 53 private: |
| 57 ServiceManager * const service_manager_; | 54 ServiceManager * const service_manager_; |
| 58 | 55 |
| 59 // glib main loop | |
| 60 GMainLoop * const main_loop_; | |
| 61 | |
| 62 // Emit a DataPlansUpdate D-Bus signal for a service | 56 // Emit a DataPlansUpdate D-Bus signal for a service |
| 63 void EmitDataPlansUpdateSignal(const Service& service); | 57 void EmitDataPlansUpdateSignal(const Service& service); |
| 64 | 58 |
| 65 DISALLOW_COPY_AND_ASSIGN(CashewServer); | 59 DISALLOW_COPY_AND_ASSIGN(CashewServer); |
| 66 }; | 60 }; |
| 67 | 61 |
| 68 } // namespace cashew | 62 } // namespace cashew |
| 69 | 63 |
| 70 #endif // SRC_CASHEW_SERVER_H_ | 64 #endif // SRC_CASHEW_SERVER_H_ |
| OLD | NEW |