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

Side by Side Diff: device/bluetooth/bluetooth_classic_device_mac.mm

Issue 1542163002: Switch to standard integer types in device/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years 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 | « device/bluetooth/bluetooth_classic_device_mac.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "device/bluetooth/bluetooth_classic_device_mac.h" 5 #include "device/bluetooth/bluetooth_classic_device_mac.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h"
10 #include "base/bind.h" 9 #include "base/bind.h"
11 #include "base/hash.h" 10 #include "base/hash.h"
12 #include "base/mac/sdk_forward_declarations.h" 11 #include "base/mac/sdk_forward_declarations.h"
13 #include "base/sequenced_task_runner.h" 12 #include "base/sequenced_task_runner.h"
14 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
15 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
16 #include "base/strings/sys_string_conversions.h" 15 #include "base/strings/sys_string_conversions.h"
17 #include "device/bluetooth/bluetooth_socket_mac.h" 16 #include "device/bluetooth/bluetooth_socket_mac.h"
18 #include "device/bluetooth/bluetooth_uuid.h" 17 #include "device/bluetooth/bluetooth_uuid.h"
19 18
(...skipping 19 matching lines...) Expand all
39 for (IOBluetoothSDPDataElement* inner_element in inner_elements) { 38 for (IOBluetoothSDPDataElement* inner_element in inner_elements) {
40 if ([inner_element getTypeDescriptor] == kBluetoothSDPDataElementTypeUUID) { 39 if ([inner_element getTypeDescriptor] == kBluetoothSDPDataElementTypeUUID) {
41 sdp_uuid = [[inner_element getUUIDValue] getUUIDWithLength:16]; 40 sdp_uuid = [[inner_element getUUIDValue] getUUIDWithLength:16];
42 break; 41 break;
43 } 42 }
44 } 43 }
45 44
46 if (!sdp_uuid) 45 if (!sdp_uuid)
47 return BluetoothUUID(); 46 return BluetoothUUID();
48 47
49 const uint8* uuid_bytes = reinterpret_cast<const uint8*>([sdp_uuid bytes]); 48 const uint8_t* uuid_bytes =
49 reinterpret_cast<const uint8_t*>([sdp_uuid bytes]);
50 std::string uuid_str = base::HexEncode(uuid_bytes, 16); 50 std::string uuid_str = base::HexEncode(uuid_bytes, 16);
51 DCHECK_EQ(uuid_str.size(), 32U); 51 DCHECK_EQ(uuid_str.size(), 32U);
52 uuid_str.insert(8, "-"); 52 uuid_str.insert(8, "-");
53 uuid_str.insert(13, "-"); 53 uuid_str.insert(13, "-");
54 uuid_str.insert(18, "-"); 54 uuid_str.insert(18, "-");
55 uuid_str.insert(23, "-"); 55 uuid_str.insert(23, "-");
56 return BluetoothUUID(uuid_str); 56 return BluetoothUUID(uuid_str);
57 } 57 }
58 58
59 } // namespace 59 } // namespace
60 60
61 BluetoothClassicDeviceMac::BluetoothClassicDeviceMac( 61 BluetoothClassicDeviceMac::BluetoothClassicDeviceMac(
62 BluetoothAdapterMac* adapter, 62 BluetoothAdapterMac* adapter,
63 IOBluetoothDevice* device) 63 IOBluetoothDevice* device)
64 : BluetoothDeviceMac(adapter), device_([device retain]) {} 64 : BluetoothDeviceMac(adapter), device_([device retain]) {}
65 65
66 BluetoothClassicDeviceMac::~BluetoothClassicDeviceMac() { 66 BluetoothClassicDeviceMac::~BluetoothClassicDeviceMac() {
67 } 67 }
68 68
69 uint32 BluetoothClassicDeviceMac::GetBluetoothClass() const { 69 uint32_t BluetoothClassicDeviceMac::GetBluetoothClass() const {
70 return [device_ classOfDevice]; 70 return [device_ classOfDevice];
71 } 71 }
72 72
73 std::string BluetoothClassicDeviceMac::GetDeviceName() const { 73 std::string BluetoothClassicDeviceMac::GetDeviceName() const {
74 return base::SysNSStringToUTF8([device_ name]); 74 return base::SysNSStringToUTF8([device_ name]);
75 } 75 }
76 76
77 void BluetoothClassicDeviceMac::CreateGattConnectionImpl() { 77 void BluetoothClassicDeviceMac::CreateGattConnectionImpl() {
78 // Classic devices do not support GATT connection. 78 // Classic devices do not support GATT connection.
79 DidFailToConnectGatt(ERROR_UNSUPPORTED_DEVICE); 79 DidFailToConnectGatt(ERROR_UNSUPPORTED_DEVICE);
80 } 80 }
81 81
82 void BluetoothClassicDeviceMac::DisconnectGatt() {} 82 void BluetoothClassicDeviceMac::DisconnectGatt() {}
83 83
84 std::string BluetoothClassicDeviceMac::GetAddress() const { 84 std::string BluetoothClassicDeviceMac::GetAddress() const {
85 return GetDeviceAddress(device_); 85 return GetDeviceAddress(device_);
86 } 86 }
87 87
88 BluetoothDevice::VendorIDSource BluetoothClassicDeviceMac::GetVendorIDSource() 88 BluetoothDevice::VendorIDSource BluetoothClassicDeviceMac::GetVendorIDSource()
89 const { 89 const {
90 return VENDOR_ID_UNKNOWN; 90 return VENDOR_ID_UNKNOWN;
91 } 91 }
92 92
93 uint16 BluetoothClassicDeviceMac::GetVendorID() const { 93 uint16_t BluetoothClassicDeviceMac::GetVendorID() const {
94 return 0; 94 return 0;
95 } 95 }
96 96
97 uint16 BluetoothClassicDeviceMac::GetProductID() const { 97 uint16_t BluetoothClassicDeviceMac::GetProductID() const {
98 return 0; 98 return 0;
99 } 99 }
100 100
101 uint16 BluetoothClassicDeviceMac::GetDeviceID() const { 101 uint16_t BluetoothClassicDeviceMac::GetDeviceID() const {
102 return 0; 102 return 0;
103 } 103 }
104 104
105 bool BluetoothClassicDeviceMac::IsPaired() const { 105 bool BluetoothClassicDeviceMac::IsPaired() const {
106 return [device_ isPaired]; 106 return [device_ isPaired];
107 } 107 }
108 108
109 bool BluetoothClassicDeviceMac::IsConnected() const { 109 bool BluetoothClassicDeviceMac::IsConnected() const {
110 return [device_ isConnected]; 110 return [device_ isConnected];
111 } 111 }
(...skipping 19 matching lines...) Expand all
131 if ([service_class_data getTypeDescriptor] == 131 if ([service_class_data getTypeDescriptor] ==
132 kBluetoothSDPDataElementTypeDataElementSequence) { 132 kBluetoothSDPDataElementTypeDataElementSequence) {
133 BluetoothUUID uuid = ExtractUuid(service_class_data); 133 BluetoothUUID uuid = ExtractUuid(service_class_data);
134 if (uuid.IsValid()) 134 if (uuid.IsValid())
135 uuids.push_back(uuid); 135 uuids.push_back(uuid);
136 } 136 }
137 } 137 }
138 return uuids; 138 return uuids;
139 } 139 }
140 140
141 int16 BluetoothClassicDeviceMac::GetInquiryRSSI() const { 141 int16_t BluetoothClassicDeviceMac::GetInquiryRSSI() const {
142 return kUnknownPower; 142 return kUnknownPower;
143 } 143 }
144 144
145 int16 BluetoothClassicDeviceMac::GetInquiryTxPower() const { 145 int16_t BluetoothClassicDeviceMac::GetInquiryTxPower() const {
146 NOTIMPLEMENTED(); 146 NOTIMPLEMENTED();
147 return kUnknownPower; 147 return kUnknownPower;
148 } 148 }
149 149
150 bool BluetoothClassicDeviceMac::ExpectingPinCode() const { 150 bool BluetoothClassicDeviceMac::ExpectingPinCode() const {
151 NOTIMPLEMENTED(); 151 NOTIMPLEMENTED();
152 return false; 152 return false;
153 } 153 }
154 154
155 bool BluetoothClassicDeviceMac::ExpectingPasskey() const { 155 bool BluetoothClassicDeviceMac::ExpectingPasskey() const {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 PairingDelegate* pairing_delegate, 188 PairingDelegate* pairing_delegate,
189 const base::Closure& callback, 189 const base::Closure& callback,
190 const ConnectErrorCallback& error_callback) { 190 const ConnectErrorCallback& error_callback) {
191 NOTIMPLEMENTED(); 191 NOTIMPLEMENTED();
192 } 192 }
193 193
194 void BluetoothClassicDeviceMac::SetPinCode(const std::string& pincode) { 194 void BluetoothClassicDeviceMac::SetPinCode(const std::string& pincode) {
195 NOTIMPLEMENTED(); 195 NOTIMPLEMENTED();
196 } 196 }
197 197
198 void BluetoothClassicDeviceMac::SetPasskey(uint32 passkey) { 198 void BluetoothClassicDeviceMac::SetPasskey(uint32_t passkey) {
199 NOTIMPLEMENTED(); 199 NOTIMPLEMENTED();
200 } 200 }
201 201
202 void BluetoothClassicDeviceMac::ConfirmPairing() { 202 void BluetoothClassicDeviceMac::ConfirmPairing() {
203 NOTIMPLEMENTED(); 203 NOTIMPLEMENTED();
204 } 204 }
205 205
206 void BluetoothClassicDeviceMac::RejectPairing() { 206 void BluetoothClassicDeviceMac::RejectPairing() {
207 NOTIMPLEMENTED(); 207 NOTIMPLEMENTED();
208 } 208 }
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 return power_level; 272 return power_level;
273 } 273 }
274 274
275 // static 275 // static
276 std::string BluetoothClassicDeviceMac::GetDeviceAddress( 276 std::string BluetoothClassicDeviceMac::GetDeviceAddress(
277 IOBluetoothDevice* device) { 277 IOBluetoothDevice* device) {
278 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString])); 278 return CanonicalizeAddress(base::SysNSStringToUTF8([device addressString]));
279 } 279 }
280 280
281 } // namespace device 281 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_classic_device_mac.h ('k') | device/bluetooth/bluetooth_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698