blob: a16b1bb49cba74db7dbed73879a2e31ac93b57ed [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
Chris Masone2b105542011-06-22 10:58:09 -070013#include "shill/refptr_types.h"
Chris Masone3bd3c8c2011-06-13 08:20:26 -070014#include "shill/service.h"
15
16namespace shill {
17
Chris Masone6791a432011-07-12 13:23:19 -070018class ControlInterface;
19class EventDispatcher;
20class Manager;
21
Chris Masone3bd3c8c2011-06-13 08:20:26 -070022class CellularService : public Service {
23 public:
24 CellularService(ControlInterface *control_interface,
25 EventDispatcher *dispatcher,
Chris Masone6791a432011-07-12 13:23:19 -070026 Manager *manager,
mukesh agrawal51a7e932011-07-27 16:18:26 -070027 const CellularRefPtr &device);
Darin Petkovd9661952011-08-03 16:25:42 -070028 virtual ~CellularService();
29
Darin Petkovc408e692011-08-17 13:47:15 -070030 // Inherited from Service.
Darin Petkovb27e5442011-08-16 14:36:45 -070031 virtual void Connect();
32 virtual void Disconnect();
Darin Petkovc408e692011-08-17 13:47:15 -070033 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 Masone3bd3c8c2011-06-13 08:20:26 -070039
Darin Petkovd9661952011-08-03 16:25:42 -070040 uint8 strength() const { return strength_; }
41 void set_strength(uint8 strength) { strength_ = strength; }
42
Darin Petkovb27e5442011-08-16 14:36:45 -070043 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 Masone3bd3c8c2011-06-13 08:20:26 -070049 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 Petkovb27e5442011-08-16 14:36:45 -070060 std::string usage_url_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070061
62 std::map<std::string, std::string> apn_info_;
63 std::map<std::string, std::string> last_good_apn_info_;
64
65 private:
Darin Petkovb27e5442011-08-16 14:36:45 -070066 virtual std::string GetDeviceRpcId();
Chris Masone95207da2011-06-29 16:50:49 -070067
Chris Masone2b105542011-06-22 10:58:09 -070068 CellularRefPtr cellular_;
Chris Masone3bd3c8c2011-06-13 08:20:26 -070069 const std::string type_;
Darin Petkovd9661952011-08-03 16:25:42 -070070
Chris Masone3bd3c8c2011-06-13 08:20:26 -070071 DISALLOW_COPY_AND_ASSIGN(CellularService);
72};
73
74} // namespace shill
75
76#endif // SHILL_CELLULAR_SERVICE_