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

Commit 46413ccf authored by Srinu Jella's avatar Srinu Jella Committed by android-build-merger
Browse files

Read local supported codecs as part of boot sequence

am: 4b777e99

* commit '4b777e99':
  Read local supported codecs as part of boot sequence
parents 8363f1b6 4b777e99
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ typedef struct controller_t {

  uint8_t (*get_ble_resolving_list_max_size)(void);
  void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
  uint8_t *(*get_local_supported_codecs)(uint8_t *number_of_codecs);
} controller_t;

const controller_t *controller_get_interface();
+22 −1
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ const uint8_t SCO_HOST_BUFFER_SIZE = 0xff;
#define MAX_FEATURES_CLASSIC_PAGE_COUNT 3
#define BLE_SUPPORTED_STATES_SIZE         8
#define BLE_SUPPORTED_FEATURES_SIZE       8
#define MAX_LOCAL_SUPPORTED_CODECS_SIZE   8

static const hci_t *hci;
static const hci_packet_factory_t *packet_factory;
@@ -67,6 +68,8 @@ static uint8_t ble_resolving_list_max_size;
static uint8_t ble_supported_states[BLE_SUPPORTED_STATES_SIZE];
static bt_device_features_t features_ble;
static uint16_t ble_suggested_default_data_length;
static uint8_t local_supported_codecs[MAX_LOCAL_SUPPORTED_CODECS_SIZE];
static uint8_t number_of_local_supported_codecs = 0;

static bool readable;
static bool ble_supported;
@@ -241,6 +244,14 @@ static future_t *start_up(void) {
    packet_parser->parse_generic_command_complete(response);
  }

  // read local supported codecs
  if(HCI_READ_LOCAL_CODECS_SUPPORTED(supported_commands)) {
    response = AWAIT_COMMAND(packet_factory->make_read_local_supported_codecs());
    packet_parser->parse_read_local_supported_codecs_response(
        response,
        &number_of_local_supported_codecs, local_supported_codecs);
  }

  readable = true;
  return future_new_immediate(FUTURE_SUCCESS);
}
@@ -290,6 +301,15 @@ static uint8_t get_last_features_classic_index(void) {
  return last_features_classic_page_index;
}

static uint8_t *get_local_supported_codecs(uint8_t *number_of_codecs) {
  assert(readable);
  if(number_of_local_supported_codecs) {
    *number_of_codecs = number_of_local_supported_codecs;
    return local_supported_codecs;
  }
  return NULL;
}

static const bt_device_features_t *get_features_ble(void) {
  assert(readable);
  assert(ble_supported);
@@ -460,7 +480,8 @@ static const controller_t interface = {
  get_ble_white_list_size,

  get_ble_resolving_list_max_size,
  set_ble_resolving_list_max_size
  set_ble_resolving_list_max_size,
  get_local_supported_codecs
};

const controller_t *controller_get_interface() {
+1 −0
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ typedef struct {
  BT_HDR *(*make_ble_read_resolving_list_size)(void);
  BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
  BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask);
  BT_HDR *(*make_read_local_supported_codecs)(void);
} hci_packet_factory_t;

const hci_packet_factory_t *hci_packet_factory_get_interface();
+5 −0
Original line number Diff line number Diff line
@@ -91,6 +91,11 @@ typedef struct {
    BT_HDR *response,
    uint16_t *ble_default_packet_length_ptr
  );

  void (*parse_read_local_supported_codecs_response)(
    BT_HDR *response,
    uint8_t *number_of_local_supported_codecs, uint8_t *local_supported_codecs);

} hci_packet_parser_t;

const hci_packet_parser_t *hci_packet_parser_get_interface();
+6 −1
Original line number Diff line number Diff line
@@ -137,6 +137,10 @@ static BT_HDR *make_ble_read_suggested_default_data_length(void) {
    return make_command_no_params(HCI_BLE_READ_DEFAULT_DATA_LENGTH);
}

static BT_HDR *make_read_local_supported_codecs(void) {
    return make_command_no_params(HCI_READ_LOCAL_SUPPORTED_CODECS);
}

static BT_HDR *make_ble_set_event_mask(const bt_event_mask_t *event_mask) {
  uint8_t *stream;
  uint8_t parameter_size = sizeof(bt_event_mask_t);
@@ -193,7 +197,8 @@ static const hci_packet_factory_t interface = {
  make_ble_read_local_supported_features,
  make_ble_read_resolving_list_size,
  make_ble_read_suggested_default_data_length,
  make_ble_set_event_mask
  make_ble_set_event_mask,
  make_read_local_supported_codecs
};

const hci_packet_factory_t *hci_packet_factory_get_interface() {
Loading