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 
bt_conn_direction_text(const bt_conn_direction_t & direction)26 std::string bt_conn_direction_text(const bt_conn_direction_t& direction) {
27   switch (direction) {
28     CASE_RETURN_TEXT(BT_CONN_DIRECTION_UNKNOWN);
29     CASE_RETURN_TEXT(BT_CONN_DIRECTION_OUTGOING);
30     CASE_RETURN_TEXT(BT_CONN_DIRECTION_INCOMING);
31     default:
32       bluetooth::log::fatal("Illegal bt_conn_direction:{}", int(direction));
33   }
34 }
35 
bt_discovery_state_text(const bt_discovery_state_t & state)36 std::string bt_discovery_state_text(const bt_discovery_state_t& state) {
37   switch (state) {
38     CASE_RETURN_TEXT(BT_DISCOVERY_STOPPED);
39     CASE_RETURN_TEXT(BT_DISCOVERY_STARTED);
40     default:
41       bluetooth::log::fatal("Illegal bt_discovery state:{}", int(state));
42   }
43 }
44