blob: f0cb2ab8fd67d151d4f800bb42d0fcff8573f43b [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_service.h"
6
7#include <string>
8
9#include <base/logging.h>
10#include <chromeos/dbus/service_constants.h>
11
12#include "shill/cellular.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070013
14using std::string;
15
16namespace shill {
Darin Petkovc5f56562011-08-06 16:40:05 -070017
Chris Masone3bd3c8c2011-06-13 08:20:26 -070018CellularService::CellularService(ControlInterface *control_interface,
19 EventDispatcher *dispatcher,
Chris Masone6791a432011-07-12 13:23:19 -070020 Manager *manager,
mukesh agrawal51a7e932011-07-27 16:18:26 -070021 const CellularRefPtr &device)
22 : Service(control_interface, dispatcher, manager),
Chris Masone3bd3c8c2011-06-13 08:20:26 -070023 strength_(0),
mukesh agrawalf60e4062011-05-27 13:13:41 -070024 cellular_(device),
Chris Masone3bd3c8c2011-06-13 08:20:26 -070025 type_(flimflam::kTypeCellular) {
26
Chris Masone27c4aa52011-07-02 13:10:14 -070027 store_.RegisterConstString(flimflam::kActivationStateProperty,
28 &activation_state_);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070029
Chris Masone27c4aa52011-07-02 13:10:14 -070030 store_.RegisterStringmap(flimflam::kCellularApnProperty, &apn_info_);
31 store_.RegisterConstStringmap(flimflam::kCellularLastGoodApnProperty,
32 &last_good_apn_info_);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070033
Chris Masone4d42df82011-07-02 17:09:39 -070034 store_.RegisterConstString(flimflam::kNetworkTechnologyProperty,
35 &network_tech_);
36 store_.RegisterConstString(flimflam::kOperatorNameProperty, &operator_name_);
37 store_.RegisterConstString(flimflam::kOperatorCodeProperty, &operator_code_);
38 store_.RegisterConstString(flimflam::kPaymentURLProperty, &payment_url_);
39 store_.RegisterConstString(flimflam::kRoamingStateProperty, &roaming_state_);
40
Chris Masone27c4aa52011-07-02 13:10:14 -070041 store_.RegisterConstUint8(flimflam::kSignalStrengthProperty, &strength_);
Chris Masone27c4aa52011-07-02 13:10:14 -070042 store_.RegisterConstString(flimflam::kTypeProperty, &type_);
Darin Petkovb27e5442011-08-16 14:36:45 -070043 store_.RegisterConstString(flimflam::kUsageURLProperty, &usage_url_);
Chris Masone3bd3c8c2011-06-13 08:20:26 -070044}
45
46CellularService::~CellularService() { }
47
Darin Petkovc5f56562011-08-06 16:40:05 -070048void CellularService::Connect() {
49 cellular_->Connect();
50}
Chris Masone3bd3c8c2011-06-13 08:20:26 -070051
52void CellularService::Disconnect() { }
53
Darin Petkovc408e692011-08-17 13:47:15 -070054void CellularService::ActivateCellularModem(const string &carrier) {
55 cellular_->Activate(carrier);
56}
57
58string CellularService::GetDeviceRpcId() {
Chris Masone95207da2011-06-29 16:50:49 -070059 return cellular_->GetRpcIdentifier();
60}
61
Chris Masone3bd3c8c2011-06-13 08:20:26 -070062} // namespace shill