blob: 99ce87b46953c80d6de9ea1a042b343d5108ea43 [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#include <time.h>
Paul Stewart75897df2011-04-27 09:05:53 -07006#include <stdio.h>
Chris Masoneee929b72011-05-10 10:02:18 -07007
Paul Stewart75897df2011-04-27 09:05:53 -07008#include <string>
9
Chris Masoneee929b72011-05-10 10:02:18 -070010#include <base/logging.h>
Chris Masone487b8bf2011-05-13 16:27:57 -070011#include <base/memory/ref_counted.h>
Chris Masoneee929b72011-05-10 10:02:18 -070012
Paul Stewart75897df2011-04-27 09:05:53 -070013#include "shill/control_interface.h"
14#include "shill/device.h"
Chris Masone0e1d1042011-05-09 18:07:03 -070015#include "shill/shill_event.h"
Paul Stewart75897df2011-04-27 09:05:53 -070016
17using std::string;
18
19namespace shill {
20Device::Device(ControlInterface *control_interface,
Chris Masone0e1d1042011-05-09 18:07:03 -070021 EventDispatcher *dispatcher)
Chris Masone413a3192011-05-09 17:10:05 -070022 : adaptor_(control_interface->CreateDeviceAdaptor(this)),
Paul Stewart75897df2011-04-27 09:05:53 -070023 running_(false) {
Chris Masoneee929b72011-05-10 10:02:18 -070024 // Initialize Interface monitor, so we can detect new interfaces
25 // TODO(cmasone): change this to VLOG(2) once we have it.
26 LOG(INFO) << "Device initialized.";
Paul Stewart75897df2011-04-27 09:05:53 -070027}
28
29Device::~Device() {
Chris Masone413a3192011-05-09 17:10:05 -070030 delete(adaptor_);
Paul Stewart75897df2011-04-27 09:05:53 -070031}
32
33void Device::Start() {
34 running_ = true;
Chris Masone413a3192011-05-09 17:10:05 -070035 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070036}
37
38void Device::Stop() {
39 running_ = false;
Chris Masone413a3192011-05-09 17:10:05 -070040 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070041}
42
43} // namespace shill