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

Side by Side Diff: third_party/WebKit/Source/modules/bluetooth/BluetoothAdvertisingData.cpp

Issue 1941923002: bluetooth: Return int8_t and use -128 for unknown tx power. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Moar fixes Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "modules/bluetooth/BluetoothAdvertisingData.h" 5 #include "modules/bluetooth/BluetoothAdvertisingData.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 namespace { 9 namespace {
10 // TODO(ortuno): RSSI Unknown and Tx Power Unknown should have different 10 const int8_t kUnknownRSSI = 127;
scheib 2016/05/04 01:18:38 Comment explaining the source of the numbers (cite
ortuno 2016/05/04 16:44:12 We removed BluetoothAdvertisingData so no need to
11 // values. Add kUnknownTxPower when implemented: http://crbug.com/551572 11 const int8_t kUnknownTxPower = -128;
12 const int kUnknownPower = 127;
13 } // namespace 12 } // namespace
14 13
15 BluetoothAdvertisingData* BluetoothAdvertisingData::create(int8_t txPower, int8_ t rssi) 14 BluetoothAdvertisingData* BluetoothAdvertisingData::create(int8_t txPower, int8_ t rssi)
16 { 15 {
17 return new BluetoothAdvertisingData(txPower, rssi); 16 return new BluetoothAdvertisingData(txPower, rssi);
18 } 17 }
19 18
20 int8_t BluetoothAdvertisingData::txPower(bool& isNull) 19 int8_t BluetoothAdvertisingData::txPower(bool& isNull)
21 { 20 {
22 if (m_txPower == kUnknownPower) { 21 if (m_txPower == kUnknownTxPower) {
23 isNull = true; 22 isNull = true;
24 } 23 }
25 return m_txPower; 24 return m_txPower;
26 } 25 }
27 26
28 int8_t BluetoothAdvertisingData::rssi(bool& isNull) 27 int8_t BluetoothAdvertisingData::rssi(bool& isNull)
29 { 28 {
30 if (m_rssi == kUnknownPower) { 29 if (m_rssi == kUnknownRSSI) {
31 isNull = true; 30 isNull = true;
32 } 31 }
33 return m_rssi; 32 return m_rssi;
34 } 33 }
35 34
36 BluetoothAdvertisingData::BluetoothAdvertisingData(int8_t txPower, int8_t rssi) 35 BluetoothAdvertisingData::BluetoothAdvertisingData(int8_t txPower, int8_t rssi)
37 : m_txPower(txPower) 36 : m_txPower(txPower)
38 , m_rssi(rssi) 37 , m_rssi(rssi)
39 { 38 {
40 } 39 }
41 40
42 } // namespace blink 41 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698