Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 93b9c701 authored by Chris Manton's avatar Chris Manton Committed by Automerger Merge Worker
Browse files

Enum-ify stack/include/avdt_api::tAVDT_RESULT am: 79b49324

Original change: https://android-review.googlesource.com/c/platform/system/bt/+/1575230

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I63ceb12a39d2762593d6f7727382cedfe9991617
parents fa6e9356 79b49324
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 */

#define LOG_TAG "bluetooth"

#include <gtest/gtest.h>

#include "client_interface.h"
+2 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
 *
 ******************************************************************************/

#define LOG_TAG "bluetooth"

#include <log/log.h>
#include <string.h>
#include "avdt_api.h"
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,9 @@
 *
 ******************************************************************************/

#define LOG_TAG "bluetooth"

#include <cutils/log.h>
#include <string.h>
#include "a2dp_codec_api.h"
#include "avdt_api.h"
+32 −6
Original line number Diff line number Diff line
@@ -25,8 +25,13 @@
#ifndef AVDT_API_H
#define AVDT_API_H

#include <base/strings/stringprintf.h>
#include <cstdint>
#include <string>

#include "bt_target.h"
#include "bt_types.h"
#include "osi/include/log.h"

/*****************************************************************************
 *  Constants
@@ -39,12 +44,33 @@
#define AVDT_CODEC_SIZE 20

/* API function return value result codes. */
#define AVDT_SUCCESS 0      /* Function successful */
#define AVDT_BAD_PARAMS 1   /* Invalid parameters */
#define AVDT_NO_RESOURCES 2 /* Not enough resources */
#define AVDT_BAD_HANDLE 3   /* Bad handle */
#define AVDT_BUSY 4         /* A procedure is already in progress */
#define AVDT_WRITE_FAIL 5   /* Write failed */
typedef enum : uint16_t {
  AVDT_SUCCESS = 0,      /* Function successful */
  AVDT_BAD_PARAMS = 1,   /* Invalid parameters */
  AVDT_NO_RESOURCES = 2, /* Not enough resources */
  AVDT_BAD_HANDLE = 3,   /* Bad handle */
  AVDT_BUSY = 4,         /* A procedure is already in progress */
  AVDT_WRITE_FAIL = 5,   /* Write failed */
} tAVDT_RESULT;

inline tAVDT_RESULT ToAvdtResult(uint16_t result) {
  ASSERT_LOG(result <= AVDT_WRITE_FAIL, "Unable to convert illegal result:%hu",
             result);
  return static_cast<tAVDT_RESULT>(result);
}

inline std::string avdt_result_text(const tAVDT_RESULT& result) {
  switch (result) {
    CASE_RETURN_TEXT(AVDT_SUCCESS);
    CASE_RETURN_TEXT(AVDT_BAD_PARAMS);
    CASE_RETURN_TEXT(AVDT_NO_RESOURCES);
    CASE_RETURN_TEXT(AVDT_BAD_HANDLE);
    CASE_RETURN_TEXT(AVDT_BUSY);
    CASE_RETURN_TEXT(AVDT_WRITE_FAIL);
    default:
      return base::StringPrintf("UNKNOWN[%hu]", result);
  }
}

/* The index to access the codec type in codec_info[]. */
#define AVDT_CODEC_TYPE_INDEX 2