blob: c04349dd10951f620794896ba07df8b47640d70a [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>
6
7#include <stdio.h>
8#include <string>
9
Chris Masonede21bba2011-05-10 09:15:39 -070010#include "shill/shill_logging.h"
Paul Stewart75897df2011-04-27 09:05:53 -070011#include "shill/control_interface.h"
12#include "shill/device.h"
13
14using std::string;
15
16namespace shill {
17Device::Device(ControlInterface *control_interface,
18 EventDispatcher */* dispatcher */)
Chris Masone413a3192011-05-09 17:10:05 -070019 : adaptor_(control_interface->CreateDeviceAdaptor(this)),
Paul Stewart75897df2011-04-27 09:05:53 -070020 running_(false) {
Chris Masonede21bba2011-05-10 09:15:39 -070021 // Initialize Interface montior, so we can detect new interfaces
22 SHILL_LOG(INFO, SHILL_LOG_DEVICE) << "Device initialized.";
Paul Stewart75897df2011-04-27 09:05:53 -070023}
24
25Device::~Device() {
Chris Masone413a3192011-05-09 17:10:05 -070026 delete(adaptor_);
Paul Stewart75897df2011-04-27 09:05:53 -070027}
28
29void Device::Start() {
30 running_ = true;
Chris Masone413a3192011-05-09 17:10:05 -070031 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070032}
33
34void Device::Stop() {
35 running_ = false;
Chris Masone413a3192011-05-09 17:10:05 -070036 adaptor_->UpdateEnabled();
Paul Stewart75897df2011-04-27 09:05:53 -070037}
38
39} // namespace shill