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

Side by Side Diff: device/bluetooth/dbus/bluetooth_gatt_descriptor_client.cc

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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/dbus/bluetooth_gatt_descriptor_client.h" 5 #include "device/bluetooth/dbus/bluetooth_gatt_descriptor_client.h"
6 6
7 #include <stddef.h>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/macros.h"
8 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
9 #include "base/observer_list.h" 12 #include "base/observer_list.h"
10 #include "dbus/bus.h" 13 #include "dbus/bus.h"
11 #include "dbus/object_manager.h" 14 #include "dbus/object_manager.h"
12 #include "third_party/cros_system_api/dbus/service_constants.h" 15 #include "third_party/cros_system_api/dbus/service_constants.h"
13 16
14 namespace bluez { 17 namespace bluez {
15 18
16 namespace { 19 namespace {
17 20
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 object_proxy->CallMethodWithErrorCallback( 102 object_proxy->CallMethodWithErrorCallback(
100 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, 103 &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
101 base::Bind(&BluetoothGattDescriptorClientImpl::OnValueSuccess, 104 base::Bind(&BluetoothGattDescriptorClientImpl::OnValueSuccess,
102 weak_ptr_factory_.GetWeakPtr(), callback), 105 weak_ptr_factory_.GetWeakPtr(), callback),
103 base::Bind(&BluetoothGattDescriptorClientImpl::OnError, 106 base::Bind(&BluetoothGattDescriptorClientImpl::OnError,
104 weak_ptr_factory_.GetWeakPtr(), error_callback)); 107 weak_ptr_factory_.GetWeakPtr(), error_callback));
105 } 108 }
106 109
107 // BluetoothGattDescriptorClientImpl override. 110 // BluetoothGattDescriptorClientImpl override.
108 void WriteValue(const dbus::ObjectPath& object_path, 111 void WriteValue(const dbus::ObjectPath& object_path,
109 const std::vector<uint8>& value, 112 const std::vector<uint8_t>& value,
110 const base::Closure& callback, 113 const base::Closure& callback,
111 const ErrorCallback& error_callback) override { 114 const ErrorCallback& error_callback) override {
112 dbus::ObjectProxy* object_proxy = 115 dbus::ObjectProxy* object_proxy =
113 object_manager_->GetObjectProxy(object_path); 116 object_manager_->GetObjectProxy(object_path);
114 if (!object_proxy) { 117 if (!object_proxy) {
115 error_callback.Run(kUnknownDescriptorError, ""); 118 error_callback.Run(kUnknownDescriptorError, "");
116 return; 119 return;
117 } 120 }
118 121
119 dbus::MethodCall method_call( 122 dbus::MethodCall method_call(
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 DCHECK(response); 190 DCHECK(response);
188 callback.Run(); 191 callback.Run();
189 } 192 }
190 193
191 // Called when a descriptor value response for a successful method call is 194 // Called when a descriptor value response for a successful method call is
192 // received. 195 // received.
193 void OnValueSuccess(const ValueCallback& callback, dbus::Response* response) { 196 void OnValueSuccess(const ValueCallback& callback, dbus::Response* response) {
194 DCHECK(response); 197 DCHECK(response);
195 dbus::MessageReader reader(response); 198 dbus::MessageReader reader(response);
196 199
197 const uint8* bytes = NULL; 200 const uint8_t* bytes = NULL;
198 size_t length = 0; 201 size_t length = 0;
199 202
200 if (!reader.PopArrayOfBytes(&bytes, &length)) 203 if (!reader.PopArrayOfBytes(&bytes, &length))
201 VLOG(2) << "Error reading array of bytes in ValueCallback"; 204 VLOG(2) << "Error reading array of bytes in ValueCallback";
202 205
203 std::vector<uint8> value; 206 std::vector<uint8_t> value;
204 207
205 if (bytes) 208 if (bytes)
206 value.assign(bytes, bytes + length); 209 value.assign(bytes, bytes + length);
207 210
208 callback.Run(value); 211 callback.Run(value);
209 } 212 }
210 213
211 // Called when a response for a failed method call is received. 214 // Called when a response for a failed method call is received.
212 void OnError(const ErrorCallback& error_callback, 215 void OnError(const ErrorCallback& error_callback,
213 dbus::ErrorResponse* response) { 216 dbus::ErrorResponse* response) {
(...skipping 28 matching lines...) Expand all
242 BluetoothGattDescriptorClient::BluetoothGattDescriptorClient() {} 245 BluetoothGattDescriptorClient::BluetoothGattDescriptorClient() {}
243 246
244 BluetoothGattDescriptorClient::~BluetoothGattDescriptorClient() {} 247 BluetoothGattDescriptorClient::~BluetoothGattDescriptorClient() {}
245 248
246 // static 249 // static
247 BluetoothGattDescriptorClient* BluetoothGattDescriptorClient::Create() { 250 BluetoothGattDescriptorClient* BluetoothGattDescriptorClient::Create() {
248 return new BluetoothGattDescriptorClientImpl(); 251 return new BluetoothGattDescriptorClientImpl();
249 } 252 }
250 253
251 } // namespace bluez 254 } // namespace bluez
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698