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 #include "test/headless/text.h"
18 
19 #include <bluetooth/log.h>
20 
21 #include <string>
22 
23 #include "include/hardware/bluetooth.h"
24 #include "macros.h"
25 #include "os/log.h"
26 
bt_conn_direction_text(const bt_conn_direction_t & direction)27 std::string bt_conn_direction_text(const bt_conn_direction_t& direction) {
28   switch (direction) {
29     CASE_RETURN_TEXT(BT_CONN_DIRECTION_UNKNOWN);
30     CASE_RETURN_TEXT(BT_CONN_DIRECTION_OUTGOING);
31     CASE_RETURN_TEXT(BT_CONN_DIRECTION_INCOMING);
32     default:
33       bluetooth::log::fatal("Illegal bt_conn_direction:{}", int(direction));
34   }
35 }
36 
bt_discovery_state_text(const bt_discovery_state_t & state)37 std::string bt_discovery_state_text(const bt_discovery_state_t& state) {
38   switch (state) {
39     CASE_RETURN_TEXT(BT_DISCOVERY_STOPPED);
40     CASE_RETURN_TEXT(BT_DISCOVERY_STARTED);
41     default:
42       bluetooth::log::fatal("Illegal bt_discovery state:{}", int(state));
43   }
44 }
45