Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 1 | // 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 Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 6 | #include <stdio.h> |
Chris Masone | ee929b7 | 2011-05-10 10:02:18 -0700 | [diff] [blame^] | 7 | |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 8 | #include <string> |
| 9 | |
Chris Masone | ee929b7 | 2011-05-10 10:02:18 -0700 | [diff] [blame^] | 10 | #include <base/logging.h> |
| 11 | |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 12 | #include "shill/control_interface.h" |
| 13 | #include "shill/device.h" |
| 14 | |
| 15 | using std::string; |
| 16 | |
| 17 | namespace shill { |
| 18 | Device::Device(ControlInterface *control_interface, |
| 19 | EventDispatcher */* dispatcher */) |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 20 | : adaptor_(control_interface->CreateDeviceAdaptor(this)), |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 21 | running_(false) { |
Chris Masone | ee929b7 | 2011-05-10 10:02:18 -0700 | [diff] [blame^] | 22 | // 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 Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | Device::~Device() { |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 28 | delete(adaptor_); |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 29 | } |
| 30 | |
| 31 | void Device::Start() { |
| 32 | running_ = true; |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 33 | adaptor_->UpdateEnabled(); |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 34 | } |
| 35 | |
| 36 | void Device::Stop() { |
| 37 | running_ = false; |
Chris Masone | 413a319 | 2011-05-09 17:10:05 -0700 | [diff] [blame] | 38 | adaptor_->UpdateEnabled(); |
Paul Stewart | 75897df | 2011-04-27 09:05:53 -0700 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | } // namespace shill |