| Index: src/service_manager.cc
|
| diff --git a/src/service_manager.cc b/src/service_manager.cc
|
| index 39f3c6d1d283d77c59bf4dea6823ea26cbe42e7d..4ca3348141462fae6949949f56b6033eb308d4e9 100644
|
| --- a/src/service_manager.cc
|
| +++ b/src/service_manager.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include <glog/logging.h>
|
|
|
| +#include "src/cashew_server.h"
|
| #include "src/service.h"
|
|
|
| namespace cashew {
|
| @@ -23,7 +24,7 @@ static const char* kTypeCellular = "cellular";
|
| ServiceManager::ServiceManager(DBus::Connection& connection) // NOLINT
|
| : DBus::ObjectProxy(connection, kFlimflamManagerPath,
|
| kFlimflamManagerName),
|
| - connection_(connection) {
|
| + connection_(connection), cashew_server_(NULL) {
|
| // init our state with a GetProperties() call to Flimflam
|
| // we'll update this state by monitoring PropertyChanged signals
|
| GetFlimflamServices();
|
| @@ -43,6 +44,11 @@ const Service* ServiceManager::GetService(const std::string& service_path)
|
| return static_cast<const Service *>(it->second);
|
| }
|
|
|
| +void ServiceManager::SetCashewServer(CashewServer *cashew_server) {
|
| + DLOG(INFO) << "SetCashewServer";
|
| + cashew_server_ = cashew_server;
|
| +}
|
| +
|
| // Flimflam Manager D-Bus Proxy methods
|
|
|
| void ServiceManager::PropertyChanged(const std::string& property_name,
|
| @@ -68,6 +74,17 @@ void ServiceManager::StateChanged(const std::string& new_state) {
|
| // onFlimflamOnline() hooks. If we care.
|
| }
|
|
|
| +// Service methods
|
| +
|
| +void ServiceManager::EmitDataPlansUpdate(const Service& service) {
|
| + DLOG(INFO) << "EmitDataPlansUpdate: service = " << service.GetPath();
|
| + if (cashew_server_ == NULL) {
|
| + DLOG(WARNING) << "EmitDataPlansUpdate: no Cashew server";
|
| + return;
|
| + }
|
| + cashew_server_->EmitDataPlansUpdate(service);
|
| +}
|
| +
|
| // Private methods
|
|
|
| void ServiceManager::DeleteServices(ServiceMap *service_map) {
|
| @@ -160,7 +177,7 @@ void ServiceManager::OnServicesUpdate(const ServicePathList& paths) {
|
| void ServiceManager::OnNewService(const DBus::Path& path) {
|
| DLOG(INFO) << "OnNewService: " << path;
|
| DCHECK(GetService(path) == NULL);
|
| - Service *service = new(std::nothrow) Service(connection_, path);
|
| + Service *service = new(std::nothrow) Service(this, connection_, path);
|
| if (service == NULL) {
|
| LOG(ERROR) << "OnNewService: couldn't create service for " << path;
|
| return;
|
|
|