1 // Copyright 2023 The Pigweed Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not 4 // use this file except in compliance with the License. You may obtain a copy of 5 // the License at 6 // 7 // https://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 // License for the specific language governing permissions and limitations under 13 // the License. 14 15 #include "pw_bluetooth_sapphire/internal/host/gap/gap.h" 16 17 namespace bt::gap { 18 TechnologyTypeToString(TechnologyType type)19const char* TechnologyTypeToString(TechnologyType type) { 20 switch (type) { 21 case TechnologyType::kClassic: 22 return "Classic"; 23 case TechnologyType::kDualMode: 24 return "DualMode"; 25 case TechnologyType::kLowEnergy: 26 return "LowEnergy"; 27 } 28 } 29 BrEdrSecurityModeToString(BrEdrSecurityMode mode)30const char* BrEdrSecurityModeToString(BrEdrSecurityMode mode) { 31 switch (mode) { 32 case BrEdrSecurityMode::Mode4: 33 return "Mode 4"; 34 case BrEdrSecurityMode::SecureConnectionsOnly: 35 return "Secure Connections Only Mode"; 36 } 37 } 38 LeSecurityModeToString(LESecurityMode mode)39const char* LeSecurityModeToString(LESecurityMode mode) { 40 switch (mode) { 41 case LESecurityMode::Mode1: 42 return "Mode 1"; 43 case LESecurityMode::SecureConnectionsOnly: 44 return "Secure Connections Only Mode"; 45 } 46 } 47 EncryptionStatusToString(pw::bluetooth::emboss::EncryptionStatus status)48const char* EncryptionStatusToString( 49 pw::bluetooth::emboss::EncryptionStatus status) { 50 switch (status) { 51 case pw::bluetooth::emboss::EncryptionStatus::OFF: 52 return "OFF"; 53 case pw::bluetooth::emboss::EncryptionStatus:: 54 ON_WITH_E0_FOR_BREDR_OR_AES_FOR_LE: 55 return "ON WITH E0 FOR BR/EDR OR AES FOR LE"; 56 case pw::bluetooth::emboss::EncryptionStatus::ON_WITH_AES_FOR_BREDR: 57 return "ON WITH AES-CCM FOR BR/EDR"; 58 } 59 60 return "(Unknown)"; 61 } 62 PairingStateTypeToString(PairingStateType type)63const char* PairingStateTypeToString(PairingStateType type) { 64 switch (type) { 65 case PairingStateType::kSecureSimplePairing: 66 return "SecureSimplePairing"; 67 case PairingStateType::kLegacyPairing: 68 return "LegacyPairing"; 69 case PairingStateType::kUnknown: 70 return "Unknown"; 71 }; 72 } 73 74 } // namespace bt::gap 75