Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -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 | #ifndef SHILL_CELLULAR_SERVICE_ |
| 6 | #define SHILL_CELLULAR_SERVICE_ |
| 7 | |
| 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
| 11 | #include <base/basictypes.h> |
| 12 | |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 13 | #include "shill/refptr_types.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 14 | #include "shill/service.h" |
| 15 | |
| 16 | namespace shill { |
| 17 | |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 18 | class ControlInterface; |
| 19 | class EventDispatcher; |
| 20 | class Manager; |
| 21 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 22 | class CellularService : public Service { |
| 23 | public: |
| 24 | CellularService(ControlInterface *control_interface, |
| 25 | EventDispatcher *dispatcher, |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 26 | Manager *manager, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 27 | const CellularRefPtr &device); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 28 | virtual ~CellularService(); |
| 29 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame^] | 30 | // Inherited from Service. |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 31 | virtual void Connect(); |
| 32 | virtual void Disconnect(); |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame^] | 33 | virtual void ActivateCellularModem(const std::string &carrier); |
| 34 | |
| 35 | const std::string &activation_state() const { return activation_state_; } |
| 36 | void set_activation_state(const std::string &state) { |
| 37 | activation_state_ = state; |
| 38 | } |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 39 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 40 | uint8 strength() const { return strength_; } |
| 41 | void set_strength(uint8 strength) { strength_ = strength; } |
| 42 | |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 43 | const std::string &payment_url() const { return payment_url_; } |
| 44 | void set_payment_url(const std::string &url) { payment_url_ = url; } |
| 45 | |
| 46 | const std::string &usage_url() const { return usage_url_; } |
| 47 | void set_usage_url(const std::string &url) { usage_url_ = url; } |
| 48 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 49 | protected: |
| 50 | virtual std::string CalculateState() { return "idle"; } |
| 51 | |
| 52 | // Properties |
| 53 | std::string activation_state_; |
| 54 | std::string operator_name_; |
| 55 | std::string operator_code_; |
| 56 | std::string network_tech_; |
| 57 | std::string roaming_state_; |
| 58 | std::string payment_url_; |
| 59 | uint8 strength_; |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 60 | std::string usage_url_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 61 | |
| 62 | std::map<std::string, std::string> apn_info_; |
| 63 | std::map<std::string, std::string> last_good_apn_info_; |
| 64 | |
| 65 | private: |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 66 | virtual std::string GetDeviceRpcId(); |
Chris Masone | 95207da | 2011-06-29 16:50:49 -0700 | [diff] [blame] | 67 | |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 68 | CellularRefPtr cellular_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 69 | const std::string type_; |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 70 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 71 | DISALLOW_COPY_AND_ASSIGN(CellularService); |
| 72 | }; |
| 73 | |
| 74 | } // namespace shill |
| 75 | |
| 76 | #endif // SHILL_CELLULAR_SERVICE_ |