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