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

Side by Side Diff: device/bluetooth/bluetooth_low_energy_win.cc

Issue 378293007: Expose "visible" and "authenticated" properties. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth.le.win.part3
Patch Set: Created 6 years, 5 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 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/bluetooth_low_energy_win.h" 5 #include "device/bluetooth/bluetooth_low_energy_win.h"
6 6
7 #include <cfg.h> 7 #include <cfg.h>
8 #define INITGUID // For DEVPKEY_Xxxx guid/pid pairs 8 #define INITGUID // For DEVPKEY_Xxxx guid/pid pairs
9 #include <devpkey.h> 9 #include <devpkey.h>
10 10
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 error)) { 315 error)) {
316 return false; 316 return false;
317 } 317 }
318 318
319 if (value->property_type() != DEVPROP_TYPE_UINT32) { 319 if (value->property_type() != DEVPROP_TYPE_UINT32) {
320 *error = kDeviceInfoError; 320 *error = kDeviceInfoError;
321 return false; 321 return false;
322 } 322 }
323 323
324 device_info->connected = !(value->AsUint32() & DN_DEVICE_DISCONNECTED); 324 device_info->connected = !(value->AsUint32() & DN_DEVICE_DISCONNECTED);
325 // Windows 8 exposes BLE devices only if they are visible and paired. This
326 // might change in the future if Windows offers a public API for discovering
327 // and pairing BLE devices.
328 device_info->visible = true;
329 device_info->authenticated = true;
325 return true; 330 return true;
326 } 331 }
327 332
328 bool CollectBluetoothLowEnergyDeviceInfo( 333 bool CollectBluetoothLowEnergyDeviceInfo(
329 const ScopedDeviceInfoSetHandle& device_info_handle, 334 const ScopedDeviceInfoSetHandle& device_info_handle,
330 PSP_DEVICE_INTERFACE_DATA device_interface_data, 335 PSP_DEVICE_INTERFACE_DATA device_interface_data,
331 scoped_ptr<device::win::BluetoothLowEnergyDeviceInfo>* device_info, 336 scoped_ptr<device::win::BluetoothLowEnergyDeviceInfo>* device_info,
332 std::string* error) { 337 std::string* error) {
333 // Retrieve required # of bytes for interface details 338 // Retrieve required # of bytes for interface details
334 ULONG required_length = 0; 339 ULONG required_length = 0;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 value_size_(value_size) { 517 value_size_(value_size) {
513 } 518 }
514 519
515 uint32_t DevicePropertyValue::AsUint32() const { 520 uint32_t DevicePropertyValue::AsUint32() const {
516 CHECK_EQ(property_type_, static_cast<DEVPROPTYPE>(DEVPROP_TYPE_UINT32)); 521 CHECK_EQ(property_type_, static_cast<DEVPROPTYPE>(DEVPROP_TYPE_UINT32));
517 CHECK_EQ(value_size_, sizeof(uint32_t)); 522 CHECK_EQ(value_size_, sizeof(uint32_t));
518 return *reinterpret_cast<uint32_t*>(value_.get()); 523 return *reinterpret_cast<uint32_t*>(value_.get());
519 } 524 }
520 525
521 BluetoothLowEnergyDeviceInfo::BluetoothLowEnergyDeviceInfo() 526 BluetoothLowEnergyDeviceInfo::BluetoothLowEnergyDeviceInfo()
522 : connected(false) { 527 : visible(false), authenticated(false), connected(false) {
523 address.ullLong = BLUETOOTH_NULL_ADDRESS; 528 address.ullLong = BLUETOOTH_NULL_ADDRESS;
524 } 529 }
525 530
526 BluetoothLowEnergyDeviceInfo::~BluetoothLowEnergyDeviceInfo() { 531 BluetoothLowEnergyDeviceInfo::~BluetoothLowEnergyDeviceInfo() {
527 } 532 }
528 533
529 bool IsBluetoothLowEnergySupported() { 534 bool IsBluetoothLowEnergySupported() {
530 return base::win::GetVersion() >= base::win::VERSION_WIN8; 535 return base::win::GetVersion() >= base::win::VERSION_WIN8;
531 } 536 }
532 537
(...skipping 29 matching lines...) Expand all
562 567
563 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting( 568 bool ExtractBluetoothAddressFromDeviceInstanceIdForTesting(
564 const std::string& instance_id, 569 const std::string& instance_id,
565 BLUETOOTH_ADDRESS* btha, 570 BLUETOOTH_ADDRESS* btha,
566 std::string* error) { 571 std::string* error) {
567 return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error); 572 return ExtractBluetoothAddressFromDeviceInstanceId(instance_id, btha, error);
568 } 573 }
569 574
570 } // namespace win 575 } // namespace win
571 } // namespace device 576 } // namespace device
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_low_energy_win.h ('k') | device/bluetooth/bluetooth_task_manager_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698