OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_NETWORK_DEVICE_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_DEVICE_STATE_H_ |
6 #define CHROMEOS_NETWORK_DEVICE_STATE_H_ | 6 #define CHROMEOS_NETWORK_DEVICE_STATE_H_ |
7 | 7 |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/network/managed_state.h" | 9 #include "chromeos/network/managed_state.h" |
| 10 #include "chromeos/network/network_util.h" |
10 | 11 |
11 namespace chromeos { | 12 namespace chromeos { |
12 | 13 |
13 // Simple class to provide device state information. Similar to NetworkState; | 14 // Simple class to provide device state information. Similar to NetworkState; |
14 // see network_state.h for usage guidelines. | 15 // see network_state.h for usage guidelines. |
15 class CHROMEOS_EXPORT DeviceState : public ManagedState { | 16 class CHROMEOS_EXPORT DeviceState : public ManagedState { |
16 public: | 17 public: |
| 18 typedef std::vector<CellularScanResult> CellularScanResults; |
| 19 |
17 explicit DeviceState(const std::string& path); | 20 explicit DeviceState(const std::string& path); |
18 virtual ~DeviceState(); | 21 virtual ~DeviceState(); |
19 | 22 |
20 // ManagedState overrides | 23 // ManagedState overrides |
21 virtual bool PropertyChanged(const std::string& key, | 24 virtual bool PropertyChanged(const std::string& key, |
22 const base::Value& value) OVERRIDE; | 25 const base::Value& value) OVERRIDE; |
23 | 26 |
24 // Accessors | 27 // Accessors |
25 const std::string& mac_address() const { return mac_address_; } | 28 const std::string& mac_address() const { return mac_address_; } |
26 | 29 |
27 // Cellular specific accessors | 30 // Cellular specific accessors |
28 const std::string& home_provider_id() const { return home_provider_id_; } | 31 const std::string& home_provider_id() const { return home_provider_id_; } |
29 bool provider_requires_roaming() const { return provider_requires_roaming_; } | 32 bool provider_requires_roaming() const { return provider_requires_roaming_; } |
30 bool support_network_scan() const { return support_network_scan_; } | 33 bool support_network_scan() const { return support_network_scan_; } |
31 bool scanning() const { return scanning_; } | 34 bool scanning() const { return scanning_; } |
32 const std::string& technology_family() const { return technology_family_; } | 35 const std::string& technology_family() const { return technology_family_; } |
33 const std::string& carrier() const { return carrier_; } | 36 const std::string& carrier() const { return carrier_; } |
34 const std::string& sim_lock_type() const { return sim_lock_type_; } | 37 const std::string& sim_lock_type() const { return sim_lock_type_; } |
35 uint32 sim_retries_left() const { return sim_retries_left_; } | 38 uint32 sim_retries_left() const { return sim_retries_left_; } |
36 bool sim_lock_enabled() const { return sim_lock_enabled_; } | 39 bool sim_lock_enabled() const { return sim_lock_enabled_; } |
37 const std::string& meid() const { return meid_; } | 40 const std::string& meid() const { return meid_; } |
38 const std::string& imei() const { return imei_; } | 41 const std::string& imei() const { return imei_; } |
39 const std::string& iccid() const { return iccid_; } | 42 const std::string& iccid() const { return iccid_; } |
40 const std::string& mdn() const { return mdn_; } | 43 const std::string& mdn() const { return mdn_; } |
| 44 const CellularScanResults& scan_results() const { return scan_results_; } |
41 const DictionaryValue& properties() const { return properties_; } | 45 const DictionaryValue& properties() const { return properties_; } |
42 | 46 |
43 // Returns true if the technology family is GSM and sim_present_ is false. | 47 // Returns true if the technology family is GSM and sim_present_ is false. |
44 bool IsSimAbsent() const; | 48 bool IsSimAbsent() const; |
45 | 49 |
46 private: | 50 private: |
47 // Common Device Properties | 51 // Common Device Properties |
48 std::string mac_address_; | 52 std::string mac_address_; |
49 // Cellular specific propeties | 53 // Cellular specific propeties |
50 std::string home_provider_id_; | 54 std::string home_provider_id_; |
51 bool provider_requires_roaming_; | 55 bool provider_requires_roaming_; |
52 bool support_network_scan_; | 56 bool support_network_scan_; |
53 bool scanning_; | 57 bool scanning_; |
54 std::string technology_family_; | 58 std::string technology_family_; |
55 std::string carrier_; | 59 std::string carrier_; |
56 std::string sim_lock_type_; | 60 std::string sim_lock_type_; |
57 uint32 sim_retries_left_; | 61 uint32 sim_retries_left_; |
58 bool sim_lock_enabled_; | 62 bool sim_lock_enabled_; |
59 bool sim_present_; | 63 bool sim_present_; |
60 std::string meid_; | 64 std::string meid_; |
61 std::string imei_; | 65 std::string imei_; |
62 std::string iccid_; | 66 std::string iccid_; |
63 std::string mdn_; | 67 std::string mdn_; |
| 68 CellularScanResults scan_results_; |
64 // Keep all Device properties in a dictionary. Devices are limited and should | 69 // Keep all Device properties in a dictionary. Devices are limited and should |
65 // change rarely if ever, so the overhead for this is small. | 70 // change rarely if ever, so the overhead for this is small. |
66 DictionaryValue properties_; | 71 DictionaryValue properties_; |
67 | 72 |
68 DISALLOW_COPY_AND_ASSIGN(DeviceState); | 73 DISALLOW_COPY_AND_ASSIGN(DeviceState); |
69 }; | 74 }; |
70 | 75 |
71 } // namespace chromeos | 76 } // namespace chromeos |
72 | 77 |
73 #endif // CHROMEOS_NETWORK_DEVICE_STATE_H_ | 78 #endif // CHROMEOS_NETWORK_DEVICE_STATE_H_ |
OLD | NEW |