blob: d199746053d1c76d91db6ed58e01a87bfd93afdf [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>
11
Paul Stewart75897df2011-04-27 09:05:53 -070012#include "shill/control_interface.h"
13#include "shill/device.h"
14
15using std::string;
16
17namespace shill {
18Device::Device(ControlInterface *control_interface,
19 EventDispatcher */* dispatcher */)
Chris Masone413a3192011-05-09 17:10:05 -070020 : adaptor_(control_interface->CreateDeviceAdaptor(this)),
Paul Stewart75897df2011-04-27 09:05:53 -070021 running_(false) {
Chris Masoneee929b72011-05-10 10:02:18 -070022 // Initialize Interface monitor, so we can detect new interfaces
23 // TODO(cmasone): change this to VLOG(2) once we have it.
24 LOG(INFO) << "Device initialized.";
Paul Stewart75897df2011-04-27 09:05:53 -070025}
26
27Device::~Device() {
Chris Masone413a3192011-05-09 17:10:05 -070028 delete(adaptor_);
Paul Stewart75897df2011-04-27 09:05:53 -070029}
30
31void Device::Start() {
32 running_ = true;
Chris Masone413a3192011-05-09 17:10:05 -070033 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070034}
35
36void Device::Stop() {
37 running_ = false;
Chris Masone413a3192011-05-09 17:10:05 -070038 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070039}
40
41} // namespace shill