blob: bcfe6b445064e2842d1868b9040ca64aa9409623 [file] [log] [blame]
Paul Stewart75897df2011-04-27 09:05:53 -07001// Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
2// 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_MANAGER_
6#define SHILL_MANAGER_
7
Chris Masone9be4a9d2011-05-16 15:44:09 -07008#include <string>
Paul Stewart75897df2011-04-27 09:05:53 -07009#include <vector>
Chris Masone487b8bf2011-05-13 16:27:57 -070010
Chris Masone9be4a9d2011-05-16 15:44:09 -070011#include <base/memory/ref_counted.h>
Chris Masone487b8bf2011-05-13 16:27:57 -070012#include <base/memory/scoped_ptr.h>
Paul Stewart75897df2011-04-27 09:05:53 -070013
Paul Stewart75897df2011-04-27 09:05:53 -070014#include "shill/device.h"
Paul Stewart0af98bf2011-05-10 17:38:08 -070015#include "shill/device_info.h"
Chris Masone8fe2c7e2011-06-09 15:51:19 -070016#include "shill/property_store_interface.h"
Chris Masone9be4a9d2011-05-16 15:44:09 -070017#include "shill/service.h"
18#include "shill/shill_event.h"
Paul Stewart75897df2011-04-27 09:05:53 -070019
20namespace shill {
21
Chris Masoned0ceb8c2011-06-02 10:05:39 -070022class ControlInterface;
Chris Masone8fe2c7e2011-06-09 15:51:19 -070023class Error;
Chris Masoned0ceb8c2011-06-02 10:05:39 -070024class EventDispatcher;
Chris Masone8fe2c7e2011-06-09 15:51:19 -070025class ManagerAdaptorInterface;
Chris Masoned0ceb8c2011-06-02 10:05:39 -070026
Chris Masone8fe2c7e2011-06-09 15:51:19 -070027class Manager : public PropertyStoreInterface {
Paul Stewart75897df2011-04-27 09:05:53 -070028 public:
29 // A constructor for the Manager object
Chris Masone9be4a9d2011-05-16 15:44:09 -070030 Manager(ControlInterface *control_interface,
31 EventDispatcher *dispatcher);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070032 virtual ~Manager();
Paul Stewart75897df2011-04-27 09:05:53 -070033 void Start();
34 void Stop();
35
Chris Masonec1e50412011-06-07 13:04:53 -070036 void RegisterDevice(DeviceRefPtr to_manage);
37 void DeregisterDevice(DeviceConstRefPtr to_forget);
Chris Masone9be4a9d2011-05-16 15:44:09 -070038
Chris Masonec1e50412011-06-07 13:04:53 -070039 void RegisterService(ServiceRefPtr to_manage);
40 void DeregisterService(ServiceConstRefPtr to_forget);
Chris Masone9be4a9d2011-05-16 15:44:09 -070041
42 void FilterByTechnology(Device::Technology tech,
Chris Masonec1e50412011-06-07 13:04:53 -070043 std::vector<DeviceRefPtr> *found);
Chris Masone9be4a9d2011-05-16 15:44:09 -070044
Chris Masonee0dea762011-06-09 09:06:03 -070045 ServiceRefPtr FindService(const std::string& name);
Chris Masone9be4a9d2011-05-16 15:44:09 -070046
Chris Masone8fe2c7e2011-06-09 15:51:19 -070047 // Implementation of PropertyStoreInterface
Chris Masone3bd3c8c2011-06-13 08:20:26 -070048 virtual bool Contains(const std::string &property);
49 virtual bool SetBoolProperty(const std::string &name,
50 bool value,
51 Error *error);
52 virtual bool SetStringProperty(const std::string &name,
53 const std::string &value,
54 Error *error);
Chris Masone8fe2c7e2011-06-09 15:51:19 -070055
Paul Stewart75897df2011-04-27 09:05:53 -070056 private:
Paul Stewart0af98bf2011-05-10 17:38:08 -070057 scoped_ptr<ManagerAdaptorInterface> adaptor_;
58 DeviceInfo device_info_;
Paul Stewart75897df2011-04-27 09:05:53 -070059 bool running_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070060 std::vector<std::string> known_properties_;
Chris Masonec1e50412011-06-07 13:04:53 -070061 std::vector<DeviceRefPtr> devices_;
62 std::vector<ServiceRefPtr> services_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070063
64 // Properties to be get/set via PropertyStoreInterface calls.
65 bool offline_mode_;
66 std::string state_;
67 std::string country_;
68 std::string portal_url_;
69
70 std::string active_profile_; // This is supposed to be, essentially,
71 // an RPC-visible object handle
72
Chris Masone413a3192011-05-09 17:10:05 -070073 friend class ManagerAdaptorInterface;
Paul Stewart75897df2011-04-27 09:05:53 -070074};
75
76} // namespace shill
77
78#endif // SHILL_MANAGER_