Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: chromeos/components/tether/device_status_util.h

Issue 2917813002: [CrOS Tether] Move the DeviceStatus normalizer code from HostScanner into its own file. (Closed)
Patch Set: Fix spelling error typo. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromeos/components/tether/BUILD.gn ('k') | chromeos/components/tether/device_status_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium 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 CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_
6 #define CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_
7
8 #include "chromeos/components/tether/proto/tether.pb.h"
9
10 namespace chromeos {
11
12 namespace tether {
13
14 // Normalizes the values contained in |device_status| and outputs the normalized
15 // values for carrier, battery percentage, and signal strength. The values are
16 // normalized according to the following rules:
17 // (1) Carrier: If the proto's cell_provider field is present and non-empty,
18 // it is output; otherwise, the "unknown-carrier" constant is output.
19 // (2) Battery percentage: If the proto's battery_percentage field is present
20 // and within the range [0, 100], it is output; if the field is present
21 // but not in [0, 100], 0 is output if the input is <0 and 100 is output
22 // if the input is >100; if the field is not present, 100 is output.
23 // (3) Signal strength: If the proto's connection_strength field is present
24 // and within the range [0, 4], it is multiplied by 25 and output in a new
25 // range [0, 100]; if the field is present but not in [0, 4], 0 is output
26 // if the input is <0 and 100 is output if the input >4; if the field is
27 // not present, 100 is output. Note that the multipier is needed because
28 // Android's connection strength is a value from 0 to 4, while Chrome OS's
29 // signal strength ranges from 0 to 100.
30 void NormalizeDeviceStatus(const DeviceStatus& status,
31 std::string* carrier_out,
32 int32_t* battery_percentage_out,
33 int32_t* signal_strength_out);
34
35 } // namespace tether
36
37 } // namespace chromeos
38
39 #endif // CHROMEOS_COMPONENTS_TETHER_DEVICE_STATUS_UTIL_H_
OLDNEW
« no previous file with comments | « chromeos/components/tether/BUILD.gn ('k') | chromeos/components/tether/device_status_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698