blob: 87401032417a38ac28db5867753774aa2d8f5730 [file] [log] [blame]
Chris Masone3bd3c8c2011-06-13 08:20:26 -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 "shill/cellular.h"
6
7#include <string>
8
9#include <base/logging.h>
Chris Masoneb925cc82011-06-22 15:39:57 -070010#include <chromeos/dbus/service_constants.h>
Chris Masone3bd3c8c2011-06-13 08:20:26 -070011
12#include "shill/cellular_service.h"
13#include "shill/control_interface.h"
14#include "shill/device.h"
15#include "shill/device_info.h"
16#include "shill/manager.h"
17#include "shill/shill_event.h"
18
19using std::string;
20
21namespace shill {
22
23Cellular::Cellular(ControlInterface *control_interface,
24 EventDispatcher *dispatcher,
25 Manager *manager,
26 const string &link,
27 int interface_index)
28 : Device(control_interface,
29 dispatcher,
30 manager,
31 link,
32 interface_index),
33 service_(new CellularService(control_interface,
34 dispatcher,
35 this,
36 "service-" + link)),
37 service_registered_(false) {
Chris Masoneb925cc82011-06-22 15:39:57 -070038 RegisterConstBool(flimflam::kScanningProperty, &scanning_);
39 RegisterUint16(flimflam::kScanIntervalProperty, &scan_interval_);
40
41 RegisterBool(flimflam::kCellularAllowRoamingProperty, &allow_roaming_);
42 RegisterConstString(flimflam::kCarrierProperty, &carrier_);
43 RegisterConstString(flimflam::kMeidProperty, &meid_);
44 RegisterConstString(flimflam::kImeiProperty, &imei_);
45 RegisterConstString(flimflam::kImsiProperty, &imsi_);
46 RegisterConstString(flimflam::kEsnProperty, &esn_);
47 RegisterConstString(flimflam::kMdnProperty, &mdn_);
48 RegisterConstString(flimflam::kMinProperty, &min_);
49 RegisterConstString(flimflam::kModelIDProperty, &model_id_);
50 RegisterConstString(flimflam::kManufacturerProperty, &manufacturer_);
51 RegisterConstString(flimflam::kFirmwareRevisionProperty, &firmware_revision_);
52 RegisterConstString(flimflam::kHardwareRevisionProperty, &hardware_revision_);
53 RegisterConstInt16(flimflam::kPRLVersionProperty, &prl_version_);
54
55 // TODO(cmasone): Deal with these compound properties
56 // known_properties_.push_back(flimflam::kSIMLockStatusProperty);
57 // known_properties_.push_back(flimflam::kFoundNetworksProperty);
58
Chris Masone3bd3c8c2011-06-13 08:20:26 -070059 VLOG(2) << "Cellular device " << link_name() << " initialized.";
60}
61
62Cellular::~Cellular() {
63 Stop();
64}
65
66void Cellular::Start() {
67 Device::Start();
68}
69
70void Cellular::Stop() {
Chris Masone2b105542011-06-22 10:58:09 -070071 manager_->DeregisterService(service_);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070072 Device::Stop();
73}
74
75bool Cellular::TechnologyIs(const Device::Technology type) {
76 return type == Device::kCellular;
77}
78
79} // namespace shill