Chromium Code Reviews| Index: device/bluetooth/bluetooth_classic_win_fake.cc |
| diff --git a/device/bluetooth/bluetooth_classic_win_fake.cc b/device/bluetooth/bluetooth_classic_win_fake.cc |
| index 920acefb7f187a5ba80280d461c5558d09d82502..2b8bec05eb589081a0f37dde47fd65c66c799abb 100644 |
| --- a/device/bluetooth/bluetooth_classic_win_fake.cc |
| +++ b/device/bluetooth/bluetooth_classic_win_fake.cc |
| @@ -15,31 +15,36 @@ BluetoothClassicWrapperFake::~BluetoothClassicWrapperFake() {} |
| HBLUETOOTH_RADIO_FIND BluetoothClassicWrapperFake::FindFirstRadio( |
| const BLUETOOTH_FIND_RADIO_PARAMS* params, |
| HANDLE* out_handle) { |
| - NOTIMPLEMENTED(); |
| + if (simulated_radios_.get() != nullptr) { |
|
scheib
2016/02/07 01:45:19
Just:
if (simulated_radios_) {
gogerald1
2016/02/08 17:00:04
Done.
|
| + *out_handle = (PVOID)simulated_radios_.get(); |
| + return *out_handle; |
| + } |
| return NULL; |
| } |
| DWORD BluetoothClassicWrapperFake::GetRadioInfo( |
| HANDLE handle, |
| PBLUETOOTH_RADIO_INFO out_radio_info) { |
| - NOTIMPLEMENTED(); |
| + if (simulated_radios_.get() != nullptr) { |
|
scheib
2016/02/07 01:45:18
Just:
if (simulated_radios_) {
gogerald1
2016/02/08 17:00:05
Done.
|
| + *out_radio_info = simulated_radios_->radio_info; |
| + } |
| return ERROR_SUCCESS; |
|
scheib
2016/02/07 01:45:18
Return success even if there were no radios?
gogerald1
2016/02/08 17:00:04
Done. Move error record from next CL to this CL.
|
| } |
| BOOL BluetoothClassicWrapperFake::FindRadioClose(HBLUETOOTH_RADIO_FIND handle) { |
| - NOTIMPLEMENTED(); |
| return TRUE; |
| } |
| BOOL BluetoothClassicWrapperFake::IsConnectable(HANDLE handle) { |
| - NOTIMPLEMENTED(); |
| + if (simulated_radios_.get() != nullptr) { |
|
scheib
2016/02/07 01:45:18
Just:
if (simulated_radios_) {
gogerald1
2016/02/08 17:00:04
Done.
|
| + return simulated_radios_->is_connectable; |
| + } |
| return TRUE; |
|
scheib
2016/02/07 01:45:19
If no radios it seems that FALSE should be returne
gogerald1
2016/02/08 17:00:05
Done.
|
| } |
| HBLUETOOTH_DEVICE_FIND BluetoothClassicWrapperFake::FindFirstDevice( |
| const BLUETOOTH_DEVICE_SEARCH_PARAMS* params, |
| BLUETOOTH_DEVICE_INFO* out_device_info) { |
| - NOTIMPLEMENTED(); |
| return NULL; |
| } |
| @@ -58,14 +63,28 @@ BOOL BluetoothClassicWrapperFake::FindDeviceClose( |
| BOOL BluetoothClassicWrapperFake::EnableDiscovery(HANDLE handle, |
| BOOL is_enable) { |
| - NOTIMPLEMENTED(); |
| return TRUE; |
| } |
| BOOL BluetoothClassicWrapperFake::EnableIncomingConnections(HANDLE handle, |
| BOOL is_enable) { |
| - NOTIMPLEMENTED(); |
| return TRUE; |
| } |
| + |
| +BluetoothRadio* BluetoothClassicWrapperFake::SimulateARadio( |
| + base::string16 name, |
| + BLUETOOTH_ADDRESS address) { |
| + BluetoothRadio* radio = new BluetoothRadio(); |
| + radio->is_connectable = true; // set it connectable by default. |
| + size_t length = |
| + ((name.size() > BLUETOOTH_MAX_NAME_SIZE) ? BLUETOOTH_MAX_NAME_SIZE |
| + : name.size()); |
| + for (size_t i = 0; i < length; i++) { |
|
scheib
2016/02/07 01:45:19
There is very likely a src/base utility for this,
gogerald1
2016/02/08 17:00:04
It looks this function is used to write formatted
|
| + radio->radio_info.szName[i] = name.at(i); |
| + } |
| + radio->radio_info.address = address; |
| + simulated_radios_.reset(radio); |
| + return radio; |
| +} |
| } // namespace device |
| } // namespace win |