blob: d304999f2bbc8c99504ecefe456627f781c8c5bf [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);
Paul Stewart22aa71b2011-09-16 12:15:11 -070036 virtual bool TechnologyIs(const Technology::Identifier type) const;
Darin Petkovc408e692011-08-17 13:47:15 -070037
Chris Masone34af2182011-08-22 11:59:36 -070038 // cellular_<MAC>_<Service_Operator_Name>
Chris Masone6515aab2011-10-12 16:19:09 -070039 std::string GetStorageIdentifier() const;
Chris Masone34af2182011-08-22 11:59:36 -070040
Darin Petkovc408e692011-08-17 13:47:15 -070041 const std::string &activation_state() const { return activation_state_; }
42 void set_activation_state(const std::string &state) {
43 activation_state_ = state;
44 }
Chris Masone3bd3c8c2011-06-13 08:20:26 -070045
Darin Petkovd9661952011-08-03 16:25:42 -070046 uint8 strength() const { return strength_; }
47 void set_strength(uint8 strength) { strength_ = strength; }
48
Darin Petkovb27e5442011-08-16 14:36:45 -070049 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 Petkov3335b372011-08-22 11:05:32 -070055 const Cellular::Operator &serving_operator() const;
56 void set_serving_operator(const Cellular::Operator &oper);
57
Darin Petkovd2045802011-08-23 11:09:25 -070058 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 Stewartac4ac002011-08-26 12:04:26 -070064 private:
65 static const char kServiceType[];
66
Gaurav Shah1b7a6162011-11-09 11:41:01 -080067 virtual std::string GetDeviceRpcId(Error *error);
Paul Stewartac4ac002011-08-26 12:04:26 -070068
Chris Masone3bd3c8c2011-06-13 08:20:26 -070069 // Properties
70 std::string activation_state_;
Darin Petkov3335b372011-08-22 11:05:32 -070071 Cellular::Operator serving_operator_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070072 std::string network_tech_;
73 std::string roaming_state_;
74 std::string payment_url_;
75 uint8 strength_;
Darin Petkovb27e5442011-08-16 14:36:45 -070076 std::string usage_url_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070077
78 std::map<std::string, std::string> apn_info_;
79 std::map<std::string, std::string> last_good_apn_info_;
80
Chris Masone2b105542011-06-22 10:58:09 -070081 CellularRefPtr cellular_;
Darin Petkovd9661952011-08-03 16:25:42 -070082
Chris Masone3bd3c8c2011-06-13 08:20:26 -070083 DISALLOW_COPY_AND_ASSIGN(CellularService);
84};
85
86} // namespace shill
87
88#endif // SHILL_CELLULAR_SERVICE_