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 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 13 | #include "shill/cellular.h" |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 14 | #include "shill/refptr_types.h" |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 15 | #include "shill/service.h" |
| 16 | |
| 17 | namespace shill { |
| 18 | |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 19 | class ControlInterface; |
Darin Petkov | b100ae7 | 2011-08-24 16:19:45 -0700 | [diff] [blame] | 20 | class Error; |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 21 | class EventDispatcher; |
| 22 | class Manager; |
| 23 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 24 | class CellularService : public Service { |
| 25 | public: |
| 26 | CellularService(ControlInterface *control_interface, |
| 27 | EventDispatcher *dispatcher, |
Chris Masone | 6791a43 | 2011-07-12 13:23:19 -0700 | [diff] [blame] | 28 | Manager *manager, |
mukesh agrawal | 51a7e93 | 2011-07-27 16:18:26 -0700 | [diff] [blame] | 29 | const CellularRefPtr &device); |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 30 | virtual ~CellularService(); |
| 31 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 32 | // Inherited from Service. |
Darin Petkov | 4d6d941 | 2011-08-24 13:19:54 -0700 | [diff] [blame] | 33 | virtual void Connect(Error *error); |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 34 | virtual void Disconnect(); |
Darin Petkov | b100ae7 | 2011-08-24 16:19:45 -0700 | [diff] [blame] | 35 | virtual void ActivateCellularModem(const std::string &carrier, Error *error); |
Paul Stewart | 22aa71b | 2011-09-16 12:15:11 -0700 | [diff] [blame] | 36 | virtual bool TechnologyIs(const Technology::Identifier type) const; |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 37 | |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 38 | // cellular_<MAC>_<Service_Operator_Name> |
Chris Masone | 9d77993 | 2011-08-25 16:33:41 -0700 | [diff] [blame] | 39 | std::string GetStorageIdentifier(); |
Chris Masone | 34af218 | 2011-08-22 11:59:36 -0700 | [diff] [blame] | 40 | |
Darin Petkov | c408e69 | 2011-08-17 13:47:15 -0700 | [diff] [blame] | 41 | const std::string &activation_state() const { return activation_state_; } |
| 42 | void set_activation_state(const std::string &state) { |
| 43 | activation_state_ = state; |
| 44 | } |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 45 | |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 46 | uint8 strength() const { return strength_; } |
| 47 | void set_strength(uint8 strength) { strength_ = strength; } |
| 48 | |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 49 | const std::string &payment_url() const { return payment_url_; } |
| 50 | void set_payment_url(const std::string &url) { payment_url_ = url; } |
| 51 | |
| 52 | const std::string &usage_url() const { return usage_url_; } |
| 53 | void set_usage_url(const std::string &url) { usage_url_ = url; } |
| 54 | |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 55 | const Cellular::Operator &serving_operator() const; |
| 56 | void set_serving_operator(const Cellular::Operator &oper); |
| 57 | |
Darin Petkov | d204580 | 2011-08-23 11:09:25 -0700 | [diff] [blame] | 58 | const std::string &network_tech() const { return network_tech_; } |
| 59 | void set_network_tech(const std::string &tech) { network_tech_ = tech; } |
| 60 | |
| 61 | const std::string &roaming_state() const { return roaming_state_; } |
| 62 | void set_roaming_state(const std::string &state) { roaming_state_ = state; } |
| 63 | |
Paul Stewart | ac4ac00 | 2011-08-26 12:04:26 -0700 | [diff] [blame] | 64 | private: |
| 65 | static const char kServiceType[]; |
| 66 | |
| 67 | virtual std::string GetDeviceRpcId(); |
| 68 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 69 | // Properties |
| 70 | std::string activation_state_; |
Darin Petkov | 3335b37 | 2011-08-22 11:05:32 -0700 | [diff] [blame] | 71 | Cellular::Operator serving_operator_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 72 | std::string network_tech_; |
| 73 | std::string roaming_state_; |
| 74 | std::string payment_url_; |
| 75 | uint8 strength_; |
Darin Petkov | b27e544 | 2011-08-16 14:36:45 -0700 | [diff] [blame] | 76 | std::string usage_url_; |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 77 | |
| 78 | std::map<std::string, std::string> apn_info_; |
| 79 | std::map<std::string, std::string> last_good_apn_info_; |
| 80 | |
Chris Masone | 2b10554 | 2011-06-22 10:58:09 -0700 | [diff] [blame] | 81 | CellularRefPtr cellular_; |
Darin Petkov | d966195 | 2011-08-03 16:25:42 -0700 | [diff] [blame] | 82 | |
Chris Masone | 3bd3c8c | 2011-06-13 08:20:26 -0700 | [diff] [blame] | 83 | DISALLOW_COPY_AND_ASSIGN(CellularService); |
| 84 | }; |
| 85 | |
| 86 | } // namespace shill |
| 87 | |
| 88 | #endif // SHILL_CELLULAR_SERVICE_ |