1 /* 2 * Copyright 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <cstddef> 20 #include <deque> 21 #include <string> 22 23 #include "test/headless/interface.h" 24 #include "test/headless/stopwatch.h" 25 #include "test/headless/timeout.h" 26 27 namespace bluetooth::test::headless { 28 29 using CheckPoint = size_t; 30 31 void start_messenger(); 32 void stop_messenger(); 33 34 namespace messenger { 35 36 struct Context { 37 Stopwatch stop_watch; 38 Timeout timeout; 39 CheckPoint check_point; 40 bool SetCallbacks(const std::vector<std::string>& callbacks); 41 std::vector<Callback> callbacks; 42 std::deque<std::shared_ptr<callback_params_t>> callback_ready_q; 43 }; 44 45 // Called by client to await any callback for the given callbacks 46 bool await_callback(Context& context); 47 48 namespace sdp { 49 50 CheckPoint get_check_point(); 51 bool await_service_discovery(const Timeout& timeout, 52 const CheckPoint& check_point, const size_t count); 53 std::deque<remote_device_properties_params_t> collect_from( 54 CheckPoint& check_point); 55 56 } // namespace sdp 57 } // namespace messenger 58 59 } // namespace bluetooth::test::headless 60