blob: c1636a8916f6144230093fcfbfdcf902132b6375 [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#ifndef SHILL_CELLULAR_SERVICE_
6#define SHILL_CELLULAR_SERVICE_
7
8#include <map>
9#include <string>
10
11#include <base/basictypes.h>
12
Darin Petkov3335b372011-08-22 11:05:32 -070013#include "shill/cellular.h"
Chris Masone2b105542011-06-22 10:58:09 -070014#include "shill/refptr_types.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070015#include "shill/service.h"
16
17namespace shill {
18
Chris Masone6791a432011-07-12 13:23:19 -070019class ControlInterface;
Darin Petkovb100ae72011-08-24 16:19:45 -070020class Error;
Chris Masone6791a432011-07-12 13:23:19 -070021class EventDispatcher;
22class Manager;
23
Chris Masone3bd3c8c2011-06-13 08:20:26 -070024class CellularService : public Service {
25 public:
26 CellularService(ControlInterface *control_interface,
27 EventDispatcher *dispatcher,
Chris Masone6791a432011-07-12 13:23:19 -070028 Manager *manager,
mukesh agrawal51a7e932011-07-27 16:18:26 -070029 const CellularRefPtr &device);
Darin Petkovd9661952011-08-03 16:25:42 -070030 virtual ~CellularService();
31
Darin Petkovc408e692011-08-17 13:47:15 -070032 // Inherited from Service.
Darin Petkov4d6d9412011-08-24 13:19:54 -070033 virtual void Connect(Error *error);
Darin Petkovb27e5442011-08-16 14:36:45 -070034 virtual void Disconnect();
Darin Petkovb100ae72011-08-24 16:19:45 -070035 virtual void ActivateCellularModem(const std::string &carrier, Error *error);
Darin Petkovc408e692011-08-17 13:47:15 -070036
Chris Masone34af2182011-08-22 11:59:36 -070037 // cellular_<MAC>_<Service_Operator_Name>
38 std::string GetStorageIdentifier(const std::string &mac);
39
Darin Petkovc408e692011-08-17 13:47:15 -070040 const std::string &activation_state() const { return activation_state_; }
41 void set_activation_state(const std::string &state) {
42 activation_state_ = state;
43 }
Chris Masone3bd3c8c2011-06-13 08:20:26 -070044
Darin Petkovd9661952011-08-03 16:25:42 -070045 uint8 strength() const { return strength_; }
46 void set_strength(uint8 strength) { strength_ = strength; }
47
Darin Petkovb27e5442011-08-16 14:36:45 -070048 const std::string &payment_url() const { return payment_url_; }
49 void set_payment_url(const std::string &url) { payment_url_ = url; }
50
51 const std::string &usage_url() const { return usage_url_; }
52 void set_usage_url(const std::string &url) { usage_url_ = url; }
53
Darin Petkov3335b372011-08-22 11:05:32 -070054 const Cellular::Operator &serving_operator() const;
55 void set_serving_operator(const Cellular::Operator &oper);
56
Darin Petkovd2045802011-08-23 11:09:25 -070057 const std::string &network_tech() const { return network_tech_; }
58 void set_network_tech(const std::string &tech) { network_tech_ = tech; }
59
60 const std::string &roaming_state() const { return roaming_state_; }
61 void set_roaming_state(const std::string &state) { roaming_state_ = state; }
62
Chris Masone3bd3c8c2011-06-13 08:20:26 -070063 protected:
64 virtual std::string CalculateState() { return "idle"; }
65
Paul Stewartac4ac002011-08-26 12:04:26 -070066 private:
67 static const char kServiceType[];
68
69 virtual std::string GetDeviceRpcId();
70
Chris Masone3bd3c8c2011-06-13 08:20:26 -070071 // Properties
72 std::string activation_state_;
Darin Petkov3335b372011-08-22 11:05:32 -070073 Cellular::Operator serving_operator_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070074 std::string network_tech_;
75 std::string roaming_state_;
76 std::string payment_url_;
77 uint8 strength_;
Darin Petkovb27e5442011-08-16 14:36:45 -070078 std::string usage_url_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070079
80 std::map<std::string, std::string> apn_info_;
81 std::map<std::string, std::string> last_good_apn_info_;
82
Chris Masone2b105542011-06-22 10:58:09 -070083 CellularRefPtr cellular_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070084 const std::string type_;
Darin Petkovd9661952011-08-03 16:25:42 -070085
Chris Masone3bd3c8c2011-06-13 08:20:26 -070086 DISALLOW_COPY_AND_ASSIGN(CellularService);
87};
88
89} // namespace shill
90
91#endif // SHILL_CELLULAR_SERVICE_