| 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 <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include <base/basictypes.h> // NOLINT | 12 #include <base/basictypes.h> // NOLINT |
| 13 #include <dbus-c++/dbus.h> // NOLINT | 13 #include <dbus-c++/dbus.h> // NOLINT |
| 14 | 14 |
| 15 #include "src/cashew_server_glue.h" | 15 #include "src/cashew_server_glue.h" |
| 16 #include "src/data_plan.h" |
| 17 #include "src/service.h" |
| 18 #include "src/service_manager.h" |
| 16 | 19 |
| 17 namespace cashew { | 20 namespace cashew { |
| 18 | 21 |
| 19 typedef std::map<std::string, DBus::Variant> DataPlan; | |
| 20 typedef std::vector<DataPlan> DataPlanList; | |
| 21 | |
| 22 // Implements Cashew D-Bus API | 22 // Implements Cashew D-Bus API |
| 23 class CashewServer : public org::chromium::Cashew_adaptor, | 23 class CashewServer : public org::chromium::Cashew_adaptor, |
| 24 public DBus::IntrospectableAdaptor, | 24 public DBus::IntrospectableAdaptor, |
| 25 public DBus::ObjectAdaptor { | 25 public DBus::ObjectAdaptor { |
| 26 public: | 26 public: |
| 27 explicit CashewServer(DBus::Connection& connection); // NOLINT | 27 CashewServer(DBus::Connection& connection, // NOLINT |
| 28 virtual ~CashewServer() {} | 28 const ServiceManager& service_manager); |
| 29 virtual ~CashewServer(); |
| 29 | 30 |
| 30 // Cashew D-Bus API methods | 31 // Cashew D-Bus API methods |
| 31 | 32 |
| 32 // Get data plan info for a cellular service | 33 // Get data plan info for a cellular service |
| 33 virtual DataPlanList GetDataPlans(const std::string& service, | 34 virtual DBusDataPlanList GetDataPlans(const std::string& service_path, |
| 34 DBus::Error& error); // NOLINT | 35 DBus::Error& error); // NOLINT |
| 35 | 36 |
| 36 // Request that a DataPlansUpdate signal be sent for a cellular service | 37 // Request that a DataPlansUpdate signal be sent for a cellular service |
| 37 virtual void RequestDataPlansUpdate(const std::string& service, | 38 virtual void RequestDataPlansUpdate(const std::string& service_path, |
| 38 DBus::Error& error); // NOLINT | 39 DBus::Error& error); // NOLINT |
| 39 | 40 |
| 40 // Test method to verify that Cashew service is working | 41 // Test method to verify that Cashew service is working |
| 41 virtual bool IsAlive(DBus::Error& error); // NOLINT | 42 virtual bool IsAlive(DBus::Error& error); // NOLINT |
| 42 | 43 |
| 43 static const char* kServiceName; | 44 static const char* kServiceName; |
| 44 static const char* kServicePath; | 45 static const char* kServicePath; |
| 45 | 46 |
| 46 private: | 47 private: |
| 48 const ServiceManager& service_manager_; |
| 49 |
| 47 // Emit a DataPlansUpdate signal for a service | 50 // Emit a DataPlansUpdate signal for a service |
| 48 void EmitDataPlansUpdateSignal(const std::string& service); | 51 void EmitDataPlansUpdateSignal(const Service& service); |
| 49 | |
| 50 // Fill in data plan with hardcoded data for testing | |
| 51 void GetHardcodedDataPlan(DataPlan* data_plan); | |
| 52 | 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(CashewServer); | 53 DISALLOW_COPY_AND_ASSIGN(CashewServer); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 } // namespace cashew | 56 } // namespace cashew |
| 57 | 57 |
| 58 #endif // SRC_CASHEW_SERVER_H_ | 58 #endif // SRC_CASHEW_SERVER_H_ |
| OLD | NEW |