mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-16 15:36:12 -04:00
Internal change
PiperOrigin-RevId: 368537620
This commit is contained in:
@@ -14,12 +14,30 @@
|
||||
|
||||
cc_library(
|
||||
name = "types",
|
||||
srcs = [
|
||||
"log_message.cc",
|
||||
"system_clock.cc",
|
||||
],
|
||||
hdrs = [
|
||||
"atomic_boolean.h",
|
||||
"atomic_reference.h",
|
||||
"cancelable.h",
|
||||
"condition_variable.h",
|
||||
"count_down_latch.h",
|
||||
"executor.h",
|
||||
"future.h",
|
||||
"input_file.h",
|
||||
"listenable_future.h",
|
||||
"log_message.h",
|
||||
"mutex.h",
|
||||
"output_file.h",
|
||||
"scheduled_executor.h",
|
||||
"settable_future.h",
|
||||
"submittable_executor.h",
|
||||
],
|
||||
deps = [
|
||||
"//platform/api:types",
|
||||
"//platform/base",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -27,6 +45,12 @@ cc_library(
|
||||
name = "comm",
|
||||
hdrs = [
|
||||
"ble.h",
|
||||
"bluetooth_adapter.h",
|
||||
"bluetooth_classic.h",
|
||||
"server_sync.h",
|
||||
"webrtc.h",
|
||||
"wifi.h",
|
||||
"wifi_lan.h",
|
||||
],
|
||||
visibility = ["//visibility:private"],
|
||||
deps = [
|
||||
@@ -37,7 +61,6 @@ cc_library(
|
||||
|
||||
cc_library(
|
||||
name = "crypto",
|
||||
testonly = True,
|
||||
srcs = [
|
||||
"crypto.cc",
|
||||
],
|
||||
@@ -50,6 +73,21 @@ cc_library(
|
||||
],
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "windows",
|
||||
srcs = [
|
||||
"platform.cc",
|
||||
],
|
||||
deps = [
|
||||
":comm",
|
||||
":crypto", # build_cleaner: keep
|
||||
":types",
|
||||
"//platform/api:comm",
|
||||
"//platform/api:platform",
|
||||
"//platform/api:types",
|
||||
],
|
||||
)
|
||||
|
||||
cc_test(
|
||||
name = "impl_test",
|
||||
size = "small",
|
||||
|
||||
@@ -29,7 +29,7 @@ class AtomicUint32 : public api::AtomicUint32 {
|
||||
|
||||
// Atomically reads and returns stored value.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::uint32_t Get() const override = 0;
|
||||
std::uint32_t Get() const override { return 0; };
|
||||
|
||||
// Atomically stores value.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_BLUETOOTH_ADAPTER_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_BLUETOOTH_ADAPTER_H_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "platform/api/bluetooth_adapter.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html
|
||||
class BluetoothAdapter : public api::BluetoothAdapter {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~BluetoothAdapter() override = default;
|
||||
|
||||
// Synchronously sets the status of the BluetoothAdapter to 'status', and
|
||||
// returns true if the operation was a success.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool SetStatus(Status status) override { return false; }
|
||||
// Returns true if the BluetoothAdapter's current status is
|
||||
// Status::Value::kEnabled.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool IsEnabled() const override { return false; }
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#getScanMode()
|
||||
//
|
||||
// Returns ScanMode::kUnknown on error.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
ScanMode GetScanMode() const override { return ScanMode::kUnknown; }
|
||||
// Synchronously sets the scan mode of the adapter, and returns true if the
|
||||
// operation was a success.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool SetScanMode(ScanMode scan_mode) override { return false; }
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#getName()
|
||||
// Returns an empty string on error
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetName() const override { return "Un-implemented"; }
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#setName(java.lang.String)
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool SetName(absl::string_view name) override { return false; }
|
||||
|
||||
// Returns BT MAC address assigned to this adapter.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetMacAddress() const override { return "Un-implemented"; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_ADAPTER_H_
|
||||
@@ -0,0 +1,186 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_H_
|
||||
|
||||
#include "platform/api/bluetooth_classic.h"
|
||||
#include "platform/base/exception.h"
|
||||
#include "platform/base/input_stream.h"
|
||||
#include "platform/base/output_stream.h"
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html.
|
||||
class BluetoothDevice : public api::BluetoothDevice {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~BluetoothDevice() override = default;
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#getName()
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetName() const override { return "Un-implemented"; }
|
||||
|
||||
// Returns BT MAC address assigned to this device.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetMacAddress() const override { return "Un-implemented"; }
|
||||
};
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html.
|
||||
class BluetoothSocket : public api::BluetoothSocket {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~BluetoothSocket();
|
||||
|
||||
// NOTE:
|
||||
// It is an undefined behavior if GetInputStream() or GetOutputStream() is
|
||||
// called for a not-connected BluetoothSocket, i.e. any object that is not
|
||||
// returned by BluetoothClassicMedium::ConnectToService() for client side or
|
||||
// BluetoothServerSocket::Accept() for server side of connection.
|
||||
|
||||
// Returns the InputStream of this connected BluetoothSocket.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
InputStream& GetInputStream() override { return fake_input_stream_; }
|
||||
|
||||
// Returns the OutputStream of this connected BluetoothSocket.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
OutputStream& GetOutputStream() override { return fake_output_stream_; }
|
||||
|
||||
// Closes both input and output streams, marks Socket as closed.
|
||||
// After this call object should be treated as not connected.
|
||||
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Close() override { return Exception{}; }
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html#getRemoteDevice()
|
||||
// Returns valid BluetoothDevice pointer if there is a connection, and
|
||||
// nullptr otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
BluetoothDevice* GetRemoteDevice() override { return nullptr; }
|
||||
|
||||
private:
|
||||
class FakeInputStream : public InputStream {
|
||||
~FakeInputStream() override = default;
|
||||
ExceptionOr<ByteArray> Read(std::int64_t size) override {
|
||||
return ExceptionOr<ByteArray>(Exception::kFailed);
|
||||
}
|
||||
Exception Close() override { return {.value = Exception::kFailed}; }
|
||||
};
|
||||
class FakeOutputStream : public OutputStream {
|
||||
~FakeOutputStream() override = default;
|
||||
|
||||
Exception Write(const ByteArray& data) override {
|
||||
return {.value = Exception::kFailed};
|
||||
}
|
||||
Exception Flush() override { return {.value = Exception::kFailed}; }
|
||||
Exception Close() override { return {.value = Exception::kFailed}; }
|
||||
};
|
||||
FakeInputStream fake_input_stream_;
|
||||
FakeOutputStream fake_output_stream_;
|
||||
};
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html.
|
||||
class BluetoothServerSocket : public api::BluetoothServerSocket {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~BluetoothServerSocket() override = default;
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#accept()
|
||||
//
|
||||
// Blocks until either:
|
||||
// - at least one incoming connection request is available, or
|
||||
// - ServerSocket is closed.
|
||||
// On success, returns connected socket, ready to exchange data.
|
||||
// Returns nullptr on error.
|
||||
// Once error is reported, it is permanent, and ServerSocket has to be closed.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<api::BluetoothSocket> Accept() override { return nullptr; }
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothServerSocket.html#close()
|
||||
//
|
||||
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Close() override { return Exception{}; }
|
||||
};
|
||||
|
||||
// Container of operations that can be performed over the Bluetooth Classic
|
||||
// medium.
|
||||
class BluetoothClassicMedium : public api::BluetoothClassicMedium {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~BluetoothClassicMedium() override = default;
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#startDiscovery()
|
||||
//
|
||||
// Returns true once the process of discovery has been initiated.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartDiscovery(DiscoveryCallback discovery_callback) override {
|
||||
return false;
|
||||
}
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#cancelDiscovery()
|
||||
//
|
||||
// Returns true once discovery is well and truly stopped; after this returns,
|
||||
// there must be no more invocations of the DiscoveryCallback passed in to
|
||||
// StartDiscovery().
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StopDiscovery() override { return false; }
|
||||
|
||||
// A combination of
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createInsecureRfcommSocketToServiceRecord
|
||||
// followed by
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothSocket.html#connect().
|
||||
//
|
||||
// service_uuid is the canonical textual representation
|
||||
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) of a
|
||||
// type 3 name-based
|
||||
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based))
|
||||
// UUID.
|
||||
//
|
||||
// On success, returns a new BluetoothSocket.
|
||||
// On error, returns nullptr.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<api::BluetoothSocket> ConnectToService(
|
||||
api::BluetoothDevice& remote_device, const std::string& service_uuid,
|
||||
CancellationFlag* cancellation_flag) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// https://developer.android.com/reference/android/bluetooth/BluetoothAdapter.html#listenUsingInsecureRfcommWithServiceRecord
|
||||
//
|
||||
// service_uuid is the canonical textual representation
|
||||
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Format) of a
|
||||
// type 3 name-based
|
||||
// (https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based))
|
||||
// UUID.
|
||||
//
|
||||
// Returns nullptr error.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<api::BluetoothServerSocket> ListenForService(
|
||||
const std::string& service_name,
|
||||
const std::string& service_uuid) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
BluetoothDevice* GetRemoteDevice(const std::string& mac_address) override {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_BLUETOOTH_CLASSIC_H_
|
||||
@@ -0,0 +1,39 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_CANCELABLE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_CANCELABLE_H_
|
||||
|
||||
#include "platform/api/cancelable.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// An interface to provide a cancellation mechanism for objects that represent
|
||||
// long-running operations.
|
||||
class Cancelable : public api::Cancelable {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~Cancelable() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool Cancel() override { return false; };
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_CANCELABLE_H_
|
||||
@@ -0,0 +1,54 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_CONDITION_VARIABLE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_CONDITION_VARIABLE_H_
|
||||
|
||||
#include "platform/api/condition_variable.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// The ConditionVariable class is a synchronization primitive that can be used
|
||||
// to block a thread, or multiple threads at the same time, until another thread
|
||||
// both modifies a shared variable (the condition), and notifies the
|
||||
// ConditionVariable.
|
||||
class ConditionVariable : public api::ConditionVariable {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ConditionVariable() override = default;
|
||||
|
||||
// Notifies all the waiters that condition state has changed.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Notify() override {}
|
||||
|
||||
// Waits indefinitely for Notify to be called.
|
||||
// May return prematurely in case of interrupt, if supported by platform.
|
||||
// Returns kSuccess, or kInterrupted on interrupt.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Wait() override { return Exception{}; }
|
||||
|
||||
// Waits while timeout has not expired for Notify to be called.
|
||||
// May return prematurely in case of interrupt, if supported by platform.
|
||||
// Returns kSuccess, or kInterrupted on interrupt.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Wait(absl::Duration timeout) override { return Exception{}; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_CONDITION_VARIABLE_H_
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_COUNT_DOWN_LATCH_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_COUNT_DOWN_LATCH_H_
|
||||
|
||||
#include "platform/api/count_down_latch.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A synchronization aid that allows one or more threads to wait until a set of
|
||||
// operations being performed in other threads completes.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CountDownLatch.html
|
||||
class CountDownLatch : public api::CountDownLatch {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~CountDownLatch() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Await() override { return Exception{}; }
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
ExceptionOr<bool> Await(absl::Duration timeout) override {
|
||||
return Exception{};
|
||||
}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void CountDown() override{};
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_COUNT_DOWN_LATCH_H_
|
||||
@@ -0,0 +1,48 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_EXECUTOR_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_EXECUTOR_H_
|
||||
|
||||
#include "platform/api/executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// This abstract class is the superclass of all classes representing an
|
||||
// Executor.
|
||||
class Executor : public api::Executor {
|
||||
public:
|
||||
// Before returning from destructor, executor must wait for all pending
|
||||
// jobs to finish.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~Executor() override = default;
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html#execute-java.lang.Runnable-
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Execute(Runnable&& runnable) override {}
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html#shutdown--
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Shutdown() override {}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
int GetTid(int index) const override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_EXECUTOR_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_FUTURE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_FUTURE_H_
|
||||
|
||||
#include "platform/api/future.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A Future represents the result of an asynchronous computation.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Future.html
|
||||
template <typename T>
|
||||
class Future : public api::Future<T> {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~Future() override = default;
|
||||
|
||||
// throws Exception::kInterrupted, Exception::kExecution
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
ExceptionOr<T> Get() override { return ExceptionOr<T>{Exception::kFailed}; }
|
||||
|
||||
// throws Exception::kInterrupted, Exception::kExecution
|
||||
// throws Exception::kTimeout if timeout is exceeded while waiting for
|
||||
// result.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
ExceptionOr<T> Get(absl::Duration timeout) override {
|
||||
return ExceptionOr<T>{Exception::kFailed};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_FUTURE_H_
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_INPUT_FILE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_INPUT_FILE_H_
|
||||
|
||||
#include "platform/api/input_file.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
#include "platform/base/exception.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// An InputFile represents a readable file on the system.
|
||||
class InputFile : public api::InputFile {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~InputFile() override = default;
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetFilePath() const override { return "Un-implemented"; }
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::int64_t GetTotalSize() const override { return 0; }
|
||||
|
||||
// throws Exception::kIo
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
ExceptionOr<ByteArray> Read(std::int64_t size) override {
|
||||
return ExceptionOr<ByteArray>(Exception::kFailed);
|
||||
}
|
||||
// throws Exception::kIo
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Close() override { return Exception{}; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_INPUT_FILE_H_
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_LISTENABLE_FUTURE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_LISTENABLE_FUTURE_H_
|
||||
|
||||
#include "platform/api/listenable_future.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A Future that accepts completion listeners.
|
||||
//
|
||||
// https://guava.dev/releases/20.0/api/docs/com/google/common/util/concurrent/ListenableFuture.html
|
||||
template <typename T>
|
||||
class ListenableFuture : public api::ListenableFuture<T> {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ListenableFuture() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void AddListener(Runnable runnable, api::Executor* executor) {}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_LISTENABLE_FUTURE_H_
|
||||
@@ -0,0 +1,29 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "platform/impl/windows/log_message.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void LogMessage::SetMinLogSeverity(Severity severity) {}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool LogMessage::ShouldCreateLogMessage(Severity severity) { return false; }
|
||||
|
||||
} // namespace api
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_
|
||||
|
||||
#include "platform/api/log_message.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A log message that prints to appropraite destination when ~LogMessage() is
|
||||
// called.
|
||||
//
|
||||
// note: the Severity enum should map (best effort) to the corresponding level
|
||||
// id that the platform logging implementation has.
|
||||
class LogMessage : public api::LogMessage {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~LogMessage() override = default;
|
||||
|
||||
// Printf like logging.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Print(const char* format, ...) override {}
|
||||
|
||||
// Returns a stream for std::cout like logging.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::ostream& Stream() override { return empty_stream_; }
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::ostream empty_stream_;
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_LOG_MESSAGE_H_
|
||||
@@ -0,0 +1,43 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_MUTEX_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_MUTEX_H_
|
||||
|
||||
#include "platform/api/mutex.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A lock is a tool for controlling access to a shared resource by multiple
|
||||
// threads.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/locks/Lock.html
|
||||
class Mutex : public api::Mutex {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~Mutex() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Lock() override {}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Unlock() override {}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_MUTEX_H_
|
||||
@@ -0,0 +1,47 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_OUTPUT_FILE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_OUTPUT_FILE_H_
|
||||
|
||||
#include "platform/api/output_file.h"
|
||||
#include "platform/base/byte_array.h"
|
||||
#include "platform/base/exception.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// An OutputFile represents a writable file on the system.
|
||||
class OutputFile : public api::OutputFile {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~OutputFile() override = default;
|
||||
|
||||
// throws Exception::kIo
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Write(const ByteArray& data) override { return Exception{}; }
|
||||
// throws Exception::kIo
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Flush() override { return Exception{}; }
|
||||
// throws Exception::kIo
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Close() override { return Exception{}; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_OUTPUT_FILE_H_
|
||||
@@ -0,0 +1,158 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#include "platform/api/platform.h"
|
||||
|
||||
#include "platform/impl/windows/atomic_boolean.h"
|
||||
#include "platform/impl/windows/atomic_reference.h"
|
||||
#include "platform/impl/windows/ble.h"
|
||||
#include "platform/impl/windows/bluetooth_adapter.h"
|
||||
#include "platform/impl/windows/bluetooth_classic.h"
|
||||
#include "platform/impl/windows/cancelable.h"
|
||||
#include "platform/impl/windows/condition_variable.h"
|
||||
#include "platform/impl/windows/count_down_latch.h"
|
||||
#include "platform/impl/windows/executor.h"
|
||||
#include "platform/impl/windows/future.h"
|
||||
#include "platform/impl/windows/input_file.h"
|
||||
#include "platform/impl/windows/listenable_future.h"
|
||||
#include "platform/impl/windows/log_message.h"
|
||||
#include "platform/impl/windows/mutex.h"
|
||||
#include "platform/impl/windows/output_file.h"
|
||||
#include "platform/impl/windows/scheduled_executor.h"
|
||||
#include "platform/impl/windows/server_sync.h"
|
||||
#include "platform/impl/windows/settable_future.h"
|
||||
#include "platform/impl/windows/submittable_executor.h"
|
||||
#include "platform/impl/windows/webrtc.h"
|
||||
#include "platform/impl/windows/wifi.h"
|
||||
#include "platform/impl/windows/wifi_lan.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace api {
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<AtomicBoolean> ImplementationPlatform::CreateAtomicBoolean(
|
||||
bool initial_value) {
|
||||
return absl::make_unique<windows::AtomicBoolean>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<AtomicUint32> ImplementationPlatform::CreateAtomicUint32(
|
||||
std::uint32_t value) {
|
||||
return absl::make_unique<windows::AtomicUint32>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<CountDownLatch> ImplementationPlatform::CreateCountDownLatch(
|
||||
std::int32_t count) {
|
||||
return absl::make_unique<windows::CountDownLatch>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<Mutex> ImplementationPlatform::CreateMutex(Mutex::Mode mode) {
|
||||
return absl::make_unique<windows::Mutex>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<ConditionVariable>
|
||||
ImplementationPlatform::CreateConditionVariable(Mutex* mutex) {
|
||||
return std::unique_ptr<ConditionVariable>(new windows::ConditionVariable());
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<InputFile> ImplementationPlatform::CreateInputFile(
|
||||
PayloadId payload_id, std::int64_t total_size) {
|
||||
return absl::make_unique<windows::InputFile>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<OutputFile> ImplementationPlatform::CreateOutputFile(
|
||||
PayloadId payload_id) {
|
||||
return absl::make_unique<windows::OutputFile>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<LogMessage> ImplementationPlatform::CreateLogMessage(
|
||||
const char* file, int line, LogMessage::Severity severity) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<SubmittableExecutor>
|
||||
ImplementationPlatform::CreateSingleThreadExecutor() {
|
||||
return absl::make_unique<windows::SubmittableExecutor>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<SubmittableExecutor>
|
||||
ImplementationPlatform::CreateMultiThreadExecutor(
|
||||
std::int32_t max_concurrency) {
|
||||
return absl::make_unique<windows::SubmittableExecutor>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<ScheduledExecutor>
|
||||
ImplementationPlatform::CreateScheduledExecutor() {
|
||||
return absl::make_unique<windows::ScheduledExecutor>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<BluetoothAdapter>
|
||||
ImplementationPlatform::CreateBluetoothAdapter() {
|
||||
return absl::make_unique<windows::BluetoothAdapter>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<BluetoothClassicMedium>
|
||||
ImplementationPlatform::CreateBluetoothClassicMedium(
|
||||
BluetoothAdapter& adapter) {
|
||||
return absl::make_unique<windows::BluetoothClassicMedium>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<BleMedium> ImplementationPlatform::CreateBleMedium(
|
||||
BluetoothAdapter& adapter) {
|
||||
return absl::make_unique<windows::BleMedium>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<ble_v2::BleMedium> ImplementationPlatform::CreateBleV2Medium(
|
||||
BluetoothAdapter&) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<ServerSyncMedium>
|
||||
ImplementationPlatform::CreateServerSyncMedium() {
|
||||
return std::unique_ptr<windows::ServerSyncMedium>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<WifiMedium> ImplementationPlatform::CreateWifiMedium() {
|
||||
return std::unique_ptr<WifiMedium>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<WifiLanMedium> ImplementationPlatform::CreateWifiLanMedium() {
|
||||
return absl::make_unique<windows::WifiLanMedium>();
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<WebRtcMedium> ImplementationPlatform::CreateWebRtcMedium() {
|
||||
return absl::make_unique<windows::WebRtcMedium>();
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
@@ -0,0 +1,59 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_SCHEDULED_EXECUTOR_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_SCHEDULED_EXECUTOR_H_
|
||||
|
||||
#include "platform/api/scheduled_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// An Executor that can schedule commands to run after a given delay, or to
|
||||
// execute periodically.
|
||||
//
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ScheduledExecutorService.html
|
||||
class ScheduledExecutor : public api::ScheduledExecutor {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ScheduledExecutor() override = default;
|
||||
|
||||
// Cancelable is kept both in the executor context, and in the caller context.
|
||||
// We want Cancelable to live until both caller and executor are done with it.
|
||||
// Exclusive ownership model does not work for this case;
|
||||
// using std:shared_ptr<> instead if std::unique_ptr<>.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::shared_ptr<api::Cancelable> Schedule(Runnable&& runnable,
|
||||
absl::Duration duration) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html#execute-java.lang.Runnable-
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Execute(Runnable&& runnable) override {}
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html#shutdown--
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Shutdown() override {}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
int GetTid(int index) const override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_SCHEDULED_EXECUTOR_H_
|
||||
@@ -0,0 +1,90 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_SERVER_SYNC_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_SERVER_SYNC_H_
|
||||
|
||||
#include "platform/api/server_sync.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// Abstraction that represents a Nearby endpoint exchanging data through
|
||||
// ServerSync Medium.
|
||||
class ServerSyncDevice : public api::ServerSyncDevice {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ServerSyncDevice() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetName() const override { return "Un-implemented"; }
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetGuid() const override { return "Un-implemented"; }
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetOwnGuid() const override { return "Un-implemented"; }
|
||||
};
|
||||
|
||||
// Container of operations that can be performed over the Chrome Sync medium.
|
||||
class ServerSyncMedium : public api::ServerSyncMedium {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ServerSyncMedium() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartAdvertising(absl::string_view service_id,
|
||||
absl::string_view endpoint_id,
|
||||
const ByteArray& endpoint_info) override {
|
||||
return false;
|
||||
}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void StopAdvertising(absl::string_view service_id) override {}
|
||||
|
||||
class DiscoveredDeviceCallback
|
||||
: public api::ServerSyncMedium::DiscoveredDeviceCallback {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~DiscoveredDeviceCallback() override = default;
|
||||
|
||||
// Called on a new ServerSyncDevice discovery.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void OnDeviceDiscovered(api::ServerSyncDevice* device,
|
||||
absl::string_view service_id,
|
||||
absl::string_view endpoint_id,
|
||||
const ByteArray& endpoint_info) override {}
|
||||
// Called when ServerSyncDevice is no longer reachable.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void OnDeviceLost(api::ServerSyncDevice* device,
|
||||
absl::string_view service_id) override {}
|
||||
};
|
||||
|
||||
// Returns true once the Chrome Sync scan has been initiated.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartDiscovery(absl::string_view service_id,
|
||||
const api::ServerSyncMedium::DiscoveredDeviceCallback&
|
||||
discovered_device_callback) override {
|
||||
return false;
|
||||
}
|
||||
// Returns true once Chrome Sync scan for service_id is well and truly
|
||||
// stopped; after this returns, there must be no more invocations of the
|
||||
// DiscoveredDeviceCallback passed in to startScanning() for service_id.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void StopDiscovery(absl::string_view service_id) override {}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_SERVER_SYNC_H_
|
||||
@@ -0,0 +1,51 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_SETTABLE_FUTURE_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_SETTABLE_FUTURE_H_
|
||||
|
||||
#include "platform/api/settable_future.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// A SettableFuture is a type of Future whose result can be set.
|
||||
//
|
||||
// https://google.github.io/guava/releases/20.0/api/docs/com/google/common/util/concurrent/SettableFuture.html
|
||||
template <typename T>
|
||||
class SettableFuture : public api::SettableFuture<T> {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~SettableFuture() override = default;
|
||||
|
||||
// Completes the future successfully. The value is returned to any waiters.
|
||||
// Returns true, if value was set.
|
||||
// Returns false, if Future is already in "done" state.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool Set(T value) override { return false; }
|
||||
|
||||
// Completes the future unsuccessfully. The exception value is returned to any
|
||||
// waiters.
|
||||
// Returns true, if exception was set.
|
||||
// Returns false, if Future is already in "done" state.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool SetException(Exception exception) override { return false; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_SETTABLE_FUTURE_H_
|
||||
@@ -0,0 +1,55 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_
|
||||
|
||||
#include "platform/api/submittable_executor.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// Main interface to be used by platform as a base class for
|
||||
// - MultiThreadExecutorWrapper
|
||||
// - SingleThreadExecutorWrapper
|
||||
// Platform must override bool submit(std::function<void()>) method.
|
||||
class SubmittableExecutor : public api::SubmittableExecutor {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~SubmittableExecutor() override = default;
|
||||
|
||||
// Submit a callable (with no delay).
|
||||
// Returns true, if callable was submitted, false otherwise.
|
||||
// Callable is not submitted if shutdown is in progress.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool DoSubmit(Runnable&& wrapped_callable) override { return false; }
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executor.html#execute-java.lang.Runnable-
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Execute(Runnable&& runnable) override {}
|
||||
|
||||
// https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html#shutdown--
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void Shutdown() override {}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
int GetTid(int index) const override { return 0; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_SUBMITTABLE_EXECUTOR_H_
|
||||
@@ -0,0 +1,36 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_SYSTEM_CLOCK_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_SYSTEM_CLOCK_H_
|
||||
|
||||
#include "platform/api/system_clock.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
|
||||
// Initialize global system state.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void SystemClock::Init() {}
|
||||
// Returns current absolute time. It is guaranteed to be monotonic.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
absl::Time SystemClock::ElapsedRealtime() { return absl::UnixEpoch(); }
|
||||
// Pauses current thread for the specified duration.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception SystemClock::Sleep(absl::Duration duration) { return Exception{}; }
|
||||
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_SYSTEM_CLOCK_H_
|
||||
@@ -0,0 +1,78 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_WEBRTC_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_WEBRTC_H_
|
||||
|
||||
#include "platform/api/webrtc.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
class WebRtcSignalingMessenger : public api::WebRtcSignalingMessenger {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WebRtcSignalingMessenger() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool SendMessage(absl::string_view peer_id,
|
||||
const ByteArray& message) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartReceivingMessages(
|
||||
api::WebRtcSignalingMessenger::OnSignalingMessageCallback
|
||||
on_message_callback,
|
||||
api::WebRtcSignalingMessenger::OnSignalingCompleteCallback
|
||||
on_complete_callback) override {
|
||||
return false;
|
||||
}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void StopReceivingMessages() override {}
|
||||
};
|
||||
|
||||
class WebRtcMedium : public api::WebRtcMedium {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WebRtcMedium() override = default;
|
||||
|
||||
// Gets the default two-letter country code associated with current locale.
|
||||
// For example, en_US locale resolves to "US".
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
const std::string GetDefaultCountryCode() override {
|
||||
return "Un-implemented";
|
||||
}
|
||||
|
||||
// Creates and returns a new webrtc::PeerConnectionInterface object via
|
||||
// |callback|.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void CreatePeerConnection(webrtc::PeerConnectionObserver* observer,
|
||||
PeerConnectionCallback callback) override {}
|
||||
|
||||
// Returns a signaling messenger for sending WebRTC signaling messages.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<api::WebRtcSignalingMessenger> GetSignalingMessenger(
|
||||
absl::string_view self_id,
|
||||
const connections::LocationHint& location_hint) override {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_WEBRTC_H_
|
||||
@@ -0,0 +1,98 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_WIFI_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_WIFI_H_
|
||||
|
||||
#include "platform/api/wifi.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// Represents a WiFi network found during a call to WifiMedium#scan().
|
||||
class WifiScanResult : public api::WifiScanResult {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WifiScanResult() override = default;
|
||||
|
||||
// Gets the SSID of this WiFi network.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetSsid() const override { return "Un-implemented"; }
|
||||
// Gets the signal strength of this WiFi network in dBm.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::int32_t GetSignalStrengthDbm() const override { return 0; }
|
||||
// Gets the frequency band of this WiFi network in MHz.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::int32_t GetFrequencyMhz() const override { return 0; }
|
||||
// Gets the authentication type of this WiFi network.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
api::WifiAuthType GetAuthType() const override {
|
||||
return api::WifiAuthType::kUnknown;
|
||||
}
|
||||
};
|
||||
|
||||
// Container of operations that can be performed over the WiFi medium.
|
||||
class WifiMedium : public api::WifiMedium {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WifiMedium() override = default;
|
||||
|
||||
class ScanResultCallback : public api::WifiMedium::ScanResultCallback {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~ScanResultCallback() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
void OnScanResults(
|
||||
const std::vector<api::WifiScanResult>& scan_results) override {}
|
||||
};
|
||||
|
||||
// Does not take ownership of the passed-in scan_result_callback -- destroying
|
||||
// that is up to the caller.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool Scan(const api::WifiMedium::ScanResultCallback& scan_result_callback)
|
||||
override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// If 'password' is an empty string, none has been provided. Returns
|
||||
// WifiConnectionStatus::CONNECTED on success, or the appropriate failure code
|
||||
// otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
api::WifiConnectionStatus ConnectToNetwork(
|
||||
absl::string_view ssid, absl::string_view password,
|
||||
api::WifiAuthType auth_type) override {
|
||||
return api::WifiConnectionStatus::kUnknown;
|
||||
}
|
||||
|
||||
// Blocks until it's certain of there being a connection to the internet, or
|
||||
// returns false if it fails to do so.
|
||||
//
|
||||
// How this method wants to verify said connection is totally up to it (so it
|
||||
// can feel free to ping whatever server, download whatever resource, etc.
|
||||
// that it needs to gain confidence that the internet is reachable hereon in).
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool VerifyInternetConnectivity() override { return false; }
|
||||
|
||||
// Returns the local device's IP address in the IPv4 dotted-quad format.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::string GetIpAddress() override { return "Un-implemented"; }
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_WIFI_H_
|
||||
@@ -0,0 +1,160 @@
|
||||
// Copyright 2020 Google LLC
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
#ifndef PLATFORM_IMPL_WINDOWS_WIFI_LAN_H_
|
||||
#define PLATFORM_IMPL_WINDOWS_WIFI_LAN_H_
|
||||
|
||||
#include "platform/api/wifi_lan.h"
|
||||
#include "platform/base/exception.h"
|
||||
#include "platform/base/input_stream.h"
|
||||
#include "platform/base/output_stream.h"
|
||||
|
||||
namespace location {
|
||||
namespace nearby {
|
||||
namespace windows {
|
||||
|
||||
// Opaque wrapper over a WifiLan service which contains |NsdServiceInfo|.
|
||||
class WifiLanService : public api::WifiLanService {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WifiLanService() override = default;
|
||||
|
||||
// Returns the |NsdServiceInfo| which contains the packed string of
|
||||
// |WifiLanServiceInfo| and the endpoint info with named key in a TXTRecord
|
||||
// map.
|
||||
// The details refer to
|
||||
// https://developer.android.com/reference/android/net/nsd/NsdServiceInfo.html.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
NsdServiceInfo GetServiceInfo() const override { return NsdServiceInfo{}; }
|
||||
};
|
||||
|
||||
class WifiLanSocket : public api::WifiLanSocket {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WifiLanSocket();
|
||||
|
||||
// Returns the InputStream of the WifiLanSocket.
|
||||
// On error, returned stream will report Exception::kIo on any operation.
|
||||
//
|
||||
// The returned object is not owned by the caller, and can be invalidated once
|
||||
// the WifiLanSocket object is destroyed.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
InputStream& GetInputStream() override { return fake_input_stream_; }
|
||||
|
||||
// Returns the OutputStream of the WifiLanSocket.
|
||||
// On error, returned stream will report Exception::kIo on any operation.
|
||||
//
|
||||
// The returned object is not owned by the caller, and can be invalidated once
|
||||
// the WifiLanSocket object is destroyed.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
OutputStream& GetOutputStream() override { return fake_output_stream_; }
|
||||
|
||||
// Returns Exception::kIo on error, Exception::kSuccess otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
Exception Close() override { return Exception{}; }
|
||||
|
||||
// Returns valid WifiLanService pointer if there is a connection, and
|
||||
// nullptr otherwise.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
WifiLanService* GetRemoteWifiLanService() override { return nullptr; }
|
||||
|
||||
private:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
class FakeInputStream : public InputStream {
|
||||
~FakeInputStream() override = default;
|
||||
ExceptionOr<ByteArray> Read(std::int64_t size) override {
|
||||
return ExceptionOr<ByteArray>(Exception::kFailed);
|
||||
}
|
||||
Exception Close() override { return {.value = Exception::kFailed}; }
|
||||
};
|
||||
class FakeOutputStream : public OutputStream {
|
||||
~FakeOutputStream() override = default;
|
||||
|
||||
Exception Write(const ByteArray& data) override {
|
||||
return {.value = Exception::kFailed};
|
||||
}
|
||||
Exception Flush() override { return {.value = Exception::kFailed}; }
|
||||
Exception Close() override { return {.value = Exception::kFailed}; }
|
||||
};
|
||||
FakeInputStream fake_input_stream_;
|
||||
FakeOutputStream fake_output_stream_;
|
||||
};
|
||||
|
||||
// Container of operations that can be performed over the WifiLan medium.
|
||||
class WifiLanMedium : public api::WifiLanMedium {
|
||||
public:
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
~WifiLanMedium() override = default;
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartAdvertising(const std::string& service_id,
|
||||
const NsdServiceInfo& nsd_service_info) override {
|
||||
return false;
|
||||
}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StopAdvertising(const std::string& service_id) override { return false; }
|
||||
|
||||
// Returns true once the WifiLan discovery has been initiated.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartDiscovery(const std::string& service_id,
|
||||
DiscoveredServiceCallback callback) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Returns true once WifiLan discovery for service_id is well and truly
|
||||
// stopped; after this returns, there must be no more invocations of the
|
||||
// DiscoveredServiceCallback passed in to StartDiscovery() for service_id.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StopDiscovery(const std::string& service_id) override { return false; }
|
||||
|
||||
// Returns true once WifiLan socket connection requests to service_id can be
|
||||
// accepted.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StartAcceptingConnections(const std::string& service_id,
|
||||
AcceptedConnectionCallback callback) override {
|
||||
return false;
|
||||
}
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
bool StopAcceptingConnections(const std::string& service_id) override {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Connects to a WifiLan service.
|
||||
// On success, returns a new WifiLanSocket.
|
||||
// On error, returns nullptr.
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::unique_ptr<api::WifiLanSocket> Connect(
|
||||
api::WifiLanService& wifi_lan_service, const std::string& service_id,
|
||||
CancellationFlag* cancellation_flag) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
WifiLanService* GetRemoteService(const std::string& ip_address,
|
||||
int port) override {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// TODO(b/184975123): replace with real implementation.
|
||||
std::pair<std::string, int> GetServiceAddress(
|
||||
const std::string& service_id) override {
|
||||
return std::pair<std::string, int>{"Un-implemented", 0};
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace windows
|
||||
} // namespace nearby
|
||||
} // namespace location
|
||||
|
||||
#endif // PLATFORM_IMPL_WINDOWS_WIFI_LAN_H_
|
||||
Reference in New Issue
Block a user