|
| 1 | +/* mbed Microcontroller Library |
| 2 | + * Copyright (c) 2021 ARM Limited |
| 3 | + * SPDX-License-Identifier: Apache-2.0 |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | + |
| 18 | +#ifndef BLE_CLIAPP_BLE_TRACE_HELPERS_H |
| 19 | +#define BLE_CLIAPP_BLE_TRACE_HELPERS_H |
| 20 | + |
| 21 | +#include "ble/BLE.h" |
| 22 | +#include "ble/SecurityManager.h" |
| 23 | +#include "mbed-trace/mbed_trace.h" |
| 24 | +#include "pal/GapTypes.h" |
| 25 | +#include "pal/GapEvents.h" |
| 26 | +#include "dm_api.h" |
| 27 | +#include "common/UUID.h" |
| 28 | + |
| 29 | +namespace ble { |
| 30 | +#if MBED_CONF_MBED_TRACE_ENABLE |
| 31 | +void trace_le_supported_features(uint64_t feat); |
| 32 | + |
| 33 | +const char* dm_callback_event_to_string(uint8_t event); |
| 34 | +const char* hci_opcode_to_string(uint16_t opcode); |
| 35 | +const char* attribute_error_code_to_string(uint8_t error); |
| 36 | +const char* attribute_opcode_to_string(uint8_t error); |
| 37 | +const char* ble_error_to_string(ble_error_t error); |
| 38 | +const char* att_client_callback_event_to_string(uint8_t code); |
| 39 | +const char* att_error_code_to_string(uint8_t code); |
| 40 | +#endif //MBED_CONF_MBED_TRACE_ENABLE |
| 41 | + |
| 42 | +template<size_t size> |
| 43 | +const char* to_string(const ble::byte_array_t<size> &array) |
| 44 | +{ |
| 45 | + return (mbed_trace_array)(array.data(), array.size()); |
| 46 | +} |
| 47 | + |
| 48 | +const char* to_string(const UUID& uuid); |
| 49 | + |
| 50 | +const char *to_string(bool v); |
| 51 | + |
| 52 | +const char *to_string(ble::SecurityManager::SecurityIOCapabilities_t capabilities); |
| 53 | + |
| 54 | +const char *to_string(ble::io_capability_t capabilities); |
| 55 | + |
| 56 | +const char *to_string(ble::SecurityManager::SecurityMode_t security_mode); |
| 57 | + |
| 58 | +const char *passkey_str(const uint8_t* passkey); |
| 59 | + |
| 60 | +const char *to_string(const ble::address_t& address); |
| 61 | + |
| 62 | +const char *to_string(const ble::link_encryption_t encryption); |
| 63 | + |
| 64 | +const char *to_string(Keypress_t keypress); |
| 65 | + |
| 66 | +const char *to_string(ble::pairing_failure_t reason); |
| 67 | + |
| 68 | +const char *to_string(target_peer_address_type_t type); |
| 69 | + |
| 70 | +const char *to_string(privacy_mode_t mode); |
| 71 | + |
| 72 | +const char *to_string(ble::advertising_type_t advType); |
| 73 | + |
| 74 | +const char *to_string(ble::own_address_type_t addressType); |
| 75 | + |
| 76 | +const char *to_string(ble::advertising_filter_policy_t policy); |
| 77 | + |
| 78 | +const char *to_string(ble::phy_t phy); |
| 79 | + |
| 80 | +const char *to_string(ble::scanning_filter_policy_t policy); |
| 81 | + |
| 82 | +const char *to_string(ble::duplicates_filter_t filtering); |
| 83 | + |
| 84 | +const char *to_string(ble::peer_address_type_t addressType); |
| 85 | + |
| 86 | +const char *to_string(ble::initiator_filter_policy_t policy); |
| 87 | + |
| 88 | +const char *to_string(ble::coded_symbol_per_bit_t sym); |
| 89 | + |
| 90 | +const char *to_string(ble::local_disconnection_reason_t reason); |
| 91 | + |
| 92 | +const char *to_string(ble::advertising_channel_map_t map); |
| 93 | + |
| 94 | +const char *to_string(ble::connection_peer_address_type_t connection_peer_address_type); |
| 95 | + |
| 96 | +const char *to_string(ble::whitelist_address_type_t whitelist_address_type); |
| 97 | + |
| 98 | +const char *to_string(ble::hci_error_code_t error); |
| 99 | + |
| 100 | +const char *to_string(ble::advertising_fragment_description_t fragment_description); |
| 101 | + |
| 102 | +const char *to_string(ble::peripheral_privacy_configuration_t::resolution_strategy_t resolution_strategy); |
| 103 | + |
| 104 | +const char *to_string(ble::GapEventType event_type); |
| 105 | + |
| 106 | +const char *to_string(ble::received_advertising_type_t type); |
| 107 | + |
| 108 | +const char *to_string(ble::connection_role_t role); |
| 109 | + |
| 110 | +const char *to_string(ble::direct_address_type_t direct_address_type); |
| 111 | + |
| 112 | +const char *to_string(ble::advertising_data_status_t data_status); |
| 113 | + |
| 114 | +const char *to_string(ble::att_security_requirement_t security_requirement); |
| 115 | + |
| 116 | +const char *to_string(GattAuthCallbackReply_t authorization_reply); |
| 117 | + |
| 118 | +} // namespace ble |
| 119 | + |
| 120 | +#endif //BLE_CLIAPP_BLE_TRACE_HELPERS_H |
0 commit comments