// 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_SAMPLE_SAMPLE_PLATFORM_H_ #define PLATFORM_IMPL_SAMPLE_SAMPLE_PLATFORM_H_ #include #include "platform/api/atomic_boolean.h" #include "platform/api/atomic_reference.h" #include "platform/api/ble.h" #include "platform/api/ble_v2.h" #include "platform/api/bluetooth_adapter.h" #include "platform/api/bluetooth_classic.h" #include "platform/api/condition_variable.h" #include "platform/api/count_down_latch.h" #include "platform/api/hash_utils.h" #include "platform/api/lock.h" #include "platform/api/multi_thread_executor.h" #include "platform/api/settable_future.h" #include "platform/api/single_thread_executor.h" #include "platform/api/system_clock.h" #include "platform/api/thread_utils.h" #include "platform/api/wifi.h" #include "platform/cancelable.h" #include "platform/impl/sample/sample_wifi_medium.h" #include "platform/port/string.h" #include "platform/ptr.h" #include "platform/runnable.h" namespace location { namespace nearby { namespace sample { // The SamplePlatform class below shows an example of the factory functions // and typedefs. class SamplePlatform { public: class SampleSubmittableExecutor : public SubmittableExecutor { public: template Ptr > submit(Ptr > callable) { return Ptr >(); } }; class SampleSingleThreadExecutor : public SingleThreadExecutor { public: void execute(Ptr runnable) override {} void shutdown() override {} }; class SampleMultiThreadExecutor : public MultiThreadExecutor { public: void execute(Ptr runnable) override {} void shutdown() override {} }; class SampleScheduledExecutor { public: Ptr schedule(Ptr runnable, std::int64_t delay_millis) { return Ptr(); } void shutdown() {} }; typedef SampleSingleThreadExecutor SingleThreadExecutorType; static Ptr createSingleThreadExecutor() { return MakePtr(new SingleThreadExecutorType()); } typedef SampleMultiThreadExecutor MultiThreadExecutorType; static Ptr createMultiThreadExecutor( std::int32_t max_concurrency) { return MakePtr(new MultiThreadExecutorType()); } typedef SampleScheduledExecutor ScheduledExecutorType; static Ptr createScheduledExecutor() { return MakePtr(new ScheduledExecutorType()); } static Ptr createBluetoothAdapter() { return Ptr(); } static Ptr createWifiMedium() { return MakePtr(new SampleWifiMedium()); } static Ptr createCountDownLatch(std::int32_t count) { return Ptr(); } template static Ptr > createSettableFuture() { return Ptr >(); } static Ptr createThreadUtils() { return Ptr(); } static Ptr createSystemClock() { return Ptr(); } static Ptr createAtomicBoolean(bool initial_value) { return Ptr(); } template static Ptr > createAtomicReference(T initial_value) { return Ptr >(); } static Ptr createBluetoothClassicMedium() { return Ptr(); } static Ptr createBLEMedium() { return Ptr(); } static Ptr createBLEMediumV2() { return Ptr(); } static Ptr createLock() { return Ptr(); } static Ptr createConditionVariable(Ptr lock) { return Ptr(); } static Ptr createHashUtils() { return Ptr(); } static std::string getDeviceId() { return ""; } static std::string getPayloadPath(int64_t payload_id) { return "/tmp/" + std::to_string(payload_id); } }; } // namespace sample } // namespace nearby } // namespace location #endif // PLATFORM_IMPL_SAMPLE_SAMPLE_PLATFORM_H_