diff --git a/internal/platform/implementation/linux/ble_medium.h b/internal/platform/implementation/linux/ble_medium.h new file mode 100644 index 00000000..3fe8155d --- /dev/null +++ b/internal/platform/implementation/linux/ble_medium.h @@ -0,0 +1,59 @@ +#ifndef PLATFORM_IMPL_LINUX_API_BLE_MEDIUM_H_ +#define PLATFORM_IMPL_LINUX_API_BLE_MEDIUM_H_ + +#include "internal/platform/implementation/ble.h" + +namespace nearby { +namespace linux { +// Container of operations that can be performed over the BLE medium. +class BleMedium : public api::BleMedium { +public: + BleMedium() {} + ~BleMedium() = default; + + bool StartAdvertising( + const std::string &service_id, const ByteArray &advertisement_bytes, + const std::string &fast_advertisement_service_uuid) override { + return false; + } + bool StopAdvertising(const std::string &service_id) override { return false; } + + // Returns true once the BLE scan has been initiated. + bool StartScanning(const std::string &service_id, + const std::string &fast_advertisement_service_uuid, + DiscoveredPeripheralCallback callback) override { + return false; + } + + // Returns true once BLE scanning for service_id is well and truly stopped; + // after this returns, there must be no more invocations of the + // DiscoveredPeripheralCallback passed in to StartScanning() for service_id. + bool StopScanning(const std::string &service_id) override { return false; } + + // Callback that is invoked when a new connection is accepted. + using AcceptedConnectionCallback = absl::AnyInvocable; + + // Returns true once BLE socket connection requests to service_id can be + // accepted. + bool StartAcceptingConnections(const std::string &service_id, + AcceptedConnectionCallback callback) override { + return false; + } + bool StopAcceptingConnections(const std::string &service_id) override { + return false; + } + + // Connects to a BLE peripheral. + // On success, returns a new BleSocket. + // On error, returns nullptr. + std::unique_ptr + Connect(api::BlePeripheral &peripheral, const std::string &service_id, + CancellationFlag *cancellation_flag) override { + return nullptr; + } +}; +} // namespace linux +} // namespace nearby + +#endif diff --git a/internal/platform/implementation/linux/ble_v2_medium.h b/internal/platform/implementation/linux/ble_v2_medium.h new file mode 100644 index 00000000..03dafe8b --- /dev/null +++ b/internal/platform/implementation/linux/ble_v2_medium.h @@ -0,0 +1,75 @@ +#ifndef PLATFORM_IMPL_LINUX_API_BLE_V2_MEDIUM_H_ +#define PLATFORM_IMPL_LINUX_API_BLE_V2_MEDIUM_H_ + +#include "internal/platform/implementation/ble_v2.h" + +namespace nearby { +namespace linux { +class BleV2Medium : public api::ble_v2::BleMedium { + bool StartAdvertising( + const api::ble_v2::BleAdvertisementData &advertising_data, + api::ble_v2::AdvertiseParameters advertise_set_parameters) override { + return false; + } + std::unique_ptr + StartAdvertising(const api::ble_v2::BleAdvertisementData &advertising_data, + api::ble_v2::AdvertiseParameters advertise_set_parameters, + AdvertisingCallback callback) override { + return nullptr; + } + bool StopAdvertising() override {return false;} + + bool StartScanning(const Uuid &service_uuid, + api::ble_v2::TxPowerLevel tx_power_level, + ScanCallback callback) override { + return false; + } + bool StopScanning() override { return false; } + + std::unique_ptr + StartScanning(const Uuid &service_uuid, + api::ble_v2::TxPowerLevel tx_power_level, + ScanningCallback callback) override { + return nullptr; + }; + + std::unique_ptr + StartGattServer(api::ble_v2::ServerGattConnectionCallback callback) override { + return nullptr; + } + + std::unique_ptr ConnectToGattServer( + api::ble_v2::BlePeripheral &peripheral, + api::ble_v2::TxPowerLevel tx_power_level, + api::ble_v2::ClientGattConnectionCallback callback) override { + return nullptr; + } + + std::unique_ptr + OpenServerSocket(const std::string &service_id) override { + return nullptr; + } + + std::unique_ptr + Connect(const std::string &service_id, + api::ble_v2::TxPowerLevel tx_power_level, + api::ble_v2::BlePeripheral &peripheral, + CancellationFlag *cancellation_flag) override { + return nullptr; + } + bool IsExtendedAdvertisementsAvailable() override { + return false; + } + bool GetRemotePeripheral(const std::string &mac_address, + GetRemotePeripheralCallback callback) override { + return false; + } + bool GetRemotePeripheral(api::ble_v2::BlePeripheral::UniqueId id, + GetRemotePeripheralCallback callback) override { + return false; + } +}; +} // namespace linux +} // namespace nearby + +#endif