diff options
author | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 13:45:43 +0000 |
---|---|---|
committer | joth@chromium.org <joth@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-21 13:45:43 +0000 |
commit | 3cc2e593f52cc27ca6694b6ec33f769f6d2dbd52 (patch) | |
tree | 39bd70a7c63982c1fd76fb61fc91e4fc23d6ee16 /chrome/browser/chromeos | |
parent | 3fd9dae0d14e2a5ec30f738defb1811825740755 (diff) | |
download | chromium_src-3cc2e593f52cc27ca6694b6ec33f769f6d2dbd52.zip chromium_src-3cc2e593f52cc27ca6694b6ec33f769f6d2dbd52.tar.gz chromium_src-3cc2e593f52cc27ca6694b6ec33f769f6d2dbd52.tar.bz2 |
Adds wifi mac addresses and cell IDs to the corresponding network library classes.
Adds basic support to Chrome for using the wifi API, and basic test.
Does not yet provide concrete implementation of the underlying methods, this will be in follow-up CLs once I have ChromeOS device.
BUG=45671
TEST=GeolocationChromeOsWifiDataProviderTest.*
Review URL: http://codereview.chromium.org/2769007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos')
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 15 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.h | 52 |
2 files changed, 67 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index cd4bd45..cc1194e 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -154,6 +154,19 @@ void WirelessNetwork::ConfigureFromService(const ServiceInfo& service) { } //////////////////////////////////////////////////////////////////////////////// +// CellularNetwork + +void CellularNetwork::Clear() { + WirelessNetwork::Clear(); + cell_towers_.clear(); +} + +void CellularNetwork::ConfigureFromService(const ServiceInfo& service) { + WirelessNetwork::ConfigureFromService(service); + // TODO(joth): Update |cell_towers_| once ChromeOS side is implemented. +} + +//////////////////////////////////////////////////////////////////////////////// // WifiNetwork void WifiNetwork::Clear() { @@ -162,6 +175,7 @@ void WifiNetwork::Clear() { passphrase_.clear(); identity_.clear(); cert_path_.clear(); + access_points_.clear(); } void WifiNetwork::ConfigureFromService(const ServiceInfo& service) { @@ -170,6 +184,7 @@ void WifiNetwork::ConfigureFromService(const ServiceInfo& service) { passphrase_ = service.passphrase; identity_ = service.identity; cert_path_ = service.cert_path; + // TODO(joth): Update |access_points_| once ChromeOS side is implemented. } std::string WifiNetwork::GetEncryptionString() { diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h index 1f00132..d68aeb2 100644 --- a/chrome/browser/chromeos/cros/network_library.h +++ b/chrome/browser/chromeos/cros/network_library.h @@ -101,15 +101,56 @@ class WirelessNetwork : public Network { class CellularNetwork : public WirelessNetwork { public: + struct CellTower { + enum RadioType { + RADIOTYPE_GSM, + RADIOTYPE_CDMA, + RADIOTYPE_WCDMA, + } radio_type; // GSM/WCDMA CDMA + int mobile_country_code; // MCC MCC + int mobile_network_code; // MNC SID + int location_area_code; // LAC NID + int cell_id; // CID BID + base::Time timestamp; // Timestamp when this cell was primary + int signal_strength; // Radio signal strength measured in dBm. + int timing_advance; // Represents the distance from the cell tower. Each + // unit is roughly 550 meters. + }; + typedef std::vector<CellTower> CellTowerVector; + CellularNetwork() : WirelessNetwork() {} explicit CellularNetwork(const ServiceInfo& service) : WirelessNetwork() { ConfigureFromService(service); } + // Returns list of recently visible cell towers for this network. If the + // network is not visible (e.g. if this object was obtained from a remembered + // networks call) then this list will be empty. + // TODO(joth): Provide implementation in NetworkLibraryImpl to fill this. + const std::vector<CellTower>& cell_towers() const { return cell_towers_; } + void set_cell_towers(const std::vector<CellTower>& cell_towers) { + cell_towers_ = cell_towers; + } + + // WirelessNetwork overrides. + virtual void Clear(); + virtual void ConfigureFromService(const ServiceInfo& service); + + protected: + std::vector<CellTower> cell_towers_; }; class WifiNetwork : public WirelessNetwork { public: + struct AccessPoint { + std::string mac_address; // The mac address of the WiFi node. + base::Time timestamp; // Timestamp when this AP was detected. + int signal_strength; // Radio signal strength measured in dBm. + int signal_to_noise; // Current signal to noise ratio measured in dB. + int channel; // Wifi channel number. + }; + typedef std::vector<AccessPoint> AccessPointVector; + WifiNetwork() : WirelessNetwork(), encryption_(SECURITY_NONE) {} @@ -136,6 +177,16 @@ class WifiNetwork : public WirelessNetwork { void set_cert_path(const std::string& cert_path) { cert_path_ = cert_path; } + // Returns list of recently visible access points (base stations) for this + // network. If the network is not visible (e.g. if this object was obtained + // from a remembered networks call) then this list will be empty. + // TODO(joth): Provide implementation in NetworkLibraryImpl to fill this. + const std::vector<AccessPoint>& access_points() const { + return access_points_; + } + void set_access_points(const std::vector<AccessPoint>& access_points) { + access_points_ = access_points; + } // WirelessNetwork overrides. virtual void Clear(); @@ -150,6 +201,7 @@ class WifiNetwork : public WirelessNetwork { std::string passphrase_; std::string identity_; std::string cert_path_; + std::vector<AccessPoint> access_points_; }; typedef std::vector<WifiNetwork> WifiNetworkVector; |