Removed platform types dependency from windows platform codes

PiperOrigin-RevId: 676447748
This commit is contained in:
Guogang Li
2024-09-19 09:37:29 -07:00
committed by Copybara-Service
parent a9e753e1e1
commit 47f2dfec28
48 changed files with 1972 additions and 2133 deletions
@@ -21,6 +21,8 @@
#include "absl/synchronization/mutex.h"
#include "absl/synchronization/notification.h"
#include "internal/platform/exception.h"
#include "internal/platform/implementation/ble_v2.h"
#include "internal/platform/implementation/bluetooth_adapter.h"
#include "internal/platform/implementation/windows/ble_v2_socket.h"
#include "internal/platform/implementation/windows/bluetooth_adapter.h"
#include "internal/platform/implementation/windows/utils.h"
@@ -36,7 +38,7 @@ BleV2ServerSocket::BleV2ServerSocket(api::BluetoothAdapter* adapter)
std::unique_ptr<api::ble_v2::BleSocket> BleV2ServerSocket::Accept() {
absl::MutexLock lock(&mutex_);
NEARBY_LOGS(INFO) << __func__ << ": Accept is called.";
LOG(INFO) << __func__ << ": Accept is called.";
while (!closed_ && pending_sockets_.empty()) {
cond_.Wait(&mutex_);
@@ -46,14 +48,14 @@ std::unique_ptr<api::ble_v2::BleSocket> BleV2ServerSocket::Accept() {
BleV2Socket ble_socket = pending_sockets_.front();
pending_sockets_.pop_front();
NEARBY_LOGS(INFO) << __func__ << ": Accepted a remote connection.";
LOG(INFO) << __func__ << ": Accepted a remote connection.";
return std::make_unique<BleV2Socket>(ble_socket);
}
Exception BleV2ServerSocket::Close() {
// TODO(b/271031645): implement BLE socket using weave
absl::MutexLock lock(&mutex_);
NEARBY_LOGS(INFO) << __func__ << ": Close is called.";
LOG(INFO) << __func__ << ": Close is called.";
if (closed_) {
return {Exception::kSuccess};
@@ -67,7 +69,7 @@ Exception BleV2ServerSocket::Close() {
bool BleV2ServerSocket::Bind() {
// TODO(b/271031645): implement BLE socket using weave
NEARBY_LOGS(ERROR) << __func__ << ": GATT socket started.";
LOG(ERROR) << __func__ << ": GATT socket started.";
return true;
}