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 <string> 20 21 #include "types/raw_address.h" 22 23 /* Some predefined tags */ 24 static std::string kLogConnectionTag("CONN_STATE"); 25 static std::string kLogStateMachineTag("SM"); 26 static std::string kLogControlPointCmd("ASCS_CP_CMD"); 27 static std::string kLogControlPointNotif("ASCS_CP_NOTIF"); 28 static std::string kLogAseStateNotif("ASE_NOTIF"); 29 static std::string kLogHciEvent("HCI_EVENT"); 30 static std::string kLogAfCallBt("AF --> "); 31 static std::string kLogBtCallAf("AF <-- "); 32 33 /* Operations on SM and ASEs */ 34 static std::string kLogStateChangedOp("STATE CHANGED"); 35 static std::string kLogTargetStateChangedOp("TARGET STATE CHANGED"); 36 static std::string kLogAseConfigOp("CODEC_CONFIG: "); 37 static std::string kLogAseQoSConfigOp("QOS_CONFIG: "); 38 static std::string kLogAseEnableOp("ENABLE: "); 39 static std::string kLogAseDisableOp("DISABLE: "); 40 static std::string kLogAseReleaseOp("RELEASE: "); 41 static std::string kLogAseSuspendOp("SUSPEND: "); 42 static std::string kLogAseUpdateMetadataOp("METADATA_UPDATE: "); 43 static std::string kLogAseStartReadyOp("RCV_START_READY: "); 44 static std::string kLogAseStopReadyOp("RCV_STOP_READY: "); 45 46 /* Operations on CISes */ 47 static std::string kLogCigCreateOp("CIG_CREATE:"); 48 static std::string kLogCigRemoveOp("CIG_REMOVE:"); 49 static std::string kLogCisCreateOp("CIS_CREATE: "); 50 static std::string kLogCisEstablishedOp("CIS_ESTABLISED: "); 51 static std::string kLogCisDisconnectOp("CIS_DISCONNECT: "); 52 static std::string kLogCisDisconnectedOp("CIS_DISCONNECTED: "); 53 static std::string kLogSetDataPathOp("SET_DATA_PATH: "); 54 static std::string kLogRemoveDataPathOp("REMOVE_DATA_PATH: "); 55 static std::string kLogDataPathCompleteOp("DATA_PATH_COMPLETE: "); 56 57 /* AF Client operations */ 58 static std::string kLogAfResume("RESUME_REQ: "); 59 static std::string kLogAfSuspend("SUSPEND_REQ: "); 60 static std::string kLogAfMetadataUpdate("METADATA_UPDATE: "); 61 static std::string kLogAfResumeConfirm("RESUME_CONFIRMED: "); 62 static std::string kLogAfSuspendConfirm("SUSPEND_CONFIRMED: "); 63 static std::string kLogAfCancel("REQUEST_CANCELED: "); 64 static std::string kLogAfReconfigComplete("RECONFIG_COMPLETE_EVT: "); 65 static std::string kLogAfSuspendForReconfig("SUSPEND_FOR_RECONFIG_EVT: "); 66 67 class LeAudioLogHistory { 68 public: 69 virtual ~LeAudioLogHistory(void) = default; 70 static LeAudioLogHistory* Get(void); 71 static void Cleanup(void); 72 static void DebugDump(int fd); 73 74 virtual void AddLogHistory(const std::string& tag, int group_id, 75 const RawAddress& addr, 76 const std::string& msg) = 0; 77 virtual void AddLogHistory(const std::string& tag, int group_id, 78 const RawAddress& addr, const std::string& msg, 79 const std::string& extra) = 0; 80 };