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

Commit 27bb380e authored by Chris Manton's avatar Chris Manton
Browse files

stack::sdp [5/12] handle.SDP_AddAttribute

Bug: 339311914
Test: m .
Flag: EXEMPT, Logging Change

Change-Id: I981a16a9da3098b0ecb2f34e1c52fa086a642dd3
parent 540af4be
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -65,9 +65,13 @@ static void bta_ar_avrc_add_cat(uint16_t categories) {
  if (bta_ar_cb.sdp_tg_handle != 0) {
    p = temp;
    UINT16_TO_BE_STREAM(p, categories);
    get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
    if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
            bta_ar_cb.sdp_tg_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
        sizeof(temp), (uint8_t*)temp);
            sizeof(temp), (uint8_t*)temp)) {
      log::warn(
          "Unable to add SDP attribute for supported categories handle:{}",
          bta_ar_cb.sdp_tg_handle);
    }
  }
}

@@ -230,9 +234,12 @@ void bta_ar_reg_avrc(uint16_t service_uuid, const char* service_name,
       * Change supported categories on the second one */
      p = temp;
      UINT16_TO_BE_STREAM(p, categories);
      get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
          (uint32_t)2, (uint8_t*)temp);
      if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
              bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES,
              UINT_DESC_TYPE, (uint32_t)2, (uint8_t*)temp)) {
        log::warn("Unable to add supported features handle:{}",
                  bta_ar_cb.sdp_ct_handle);
      }
    }
  }
}
@@ -280,9 +287,12 @@ void bta_ar_dereg_avrc(uint16_t service_uuid) {
        /* change supported categories to the remaning one */
        p = temp;
        UINT16_TO_BE_STREAM(p, categories);
        get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
            bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
            (uint32_t)2, (uint8_t*)temp);
        if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
                bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES,
                UINT_DESC_TYPE, (uint32_t)2, (uint8_t*)temp)) {
          log::warn("Unable to add SDP supported features handle:{}",
                    bta_ar_cb.sdp_ct_handle);
        }
      }
    }
  }
@@ -367,9 +377,12 @@ void bta_ar_reg_avrc_for_src_sink_coexist(
       * Change supported categories on the second one */
      p = temp;
      UINT16_TO_BE_STREAM(p, categories);
      get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES, UINT_DESC_TYPE,
          (uint32_t)2, (uint8_t*)temp);
      if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
              bta_ar_cb.sdp_ct_handle, ATTR_ID_SUPPORTED_FEATURES,
              UINT_DESC_TYPE, (uint32_t)2, (uint8_t*)temp)) {
        log::warn("Unable to add SDP attribute supported features handle:{}",
                  bta_ar_cb.sdp_ct_handle);
      }
    }
  }
}
+12 −6
Original line number Diff line number Diff line
@@ -953,18 +953,24 @@ uint32_t gatt_add_sdp_record(const Uuid& uuid, uint16_t start_hdl,
      UINT8_TO_BE_STREAM(p, (UUID_DESC_TYPE << 3) | SIZE_FOUR_BYTES);
      uint32_t tmp = uuid.As32Bit();
      UINT32_TO_BE_STREAM(p, tmp);
      get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
      if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
              sdp_handle, ATTR_ID_SERVICE_CLASS_ID_LIST, DATA_ELE_SEQ_DESC_TYPE,
          (uint32_t)(p - buff), buff);
              (uint32_t)(p - buff), buff)) {
        log::warn("Unable to add SDP attribute for 32 bit uuid handle:{}",
                  sdp_handle);
      }
      break;
    }

    case Uuid::kNumBytes128:
      UINT8_TO_BE_STREAM(p, (UUID_DESC_TYPE << 3) | SIZE_SIXTEEN_BYTES);
      ARRAY_TO_BE_STREAM(p, uuid.To128BitBE().data(), (int)Uuid::kNumBytes128);
      get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
      if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
              sdp_handle, ATTR_ID_SERVICE_CLASS_ID_LIST, DATA_ELE_SEQ_DESC_TYPE,
          (uint32_t)(p - buff), buff);
              (uint32_t)(p - buff), buff)) {
        log::warn("Unable to add SDP attribute for 128 bit uuid handle:{}",
                  sdp_handle);
      }
      break;
  }

+33 −16
Original line number Diff line number Diff line
@@ -88,9 +88,11 @@ uint32_t pan_register_with_sdp(uint16_t uuid, const char* p_name,
  }

  /* Add protocol element sequence from the constant string */
  get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
      sdp_handle, ATTR_ID_PROTOCOL_DESC_LIST, DATA_ELE_SEQ_DESC_TYPE, proto_len,
      (uint8_t*)(pan_proto_elem_data + 2));
  if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          sdp_handle, ATTR_ID_PROTOCOL_DESC_LIST, DATA_ELE_SEQ_DESC_TYPE,
          proto_len, (uint8_t*)(pan_proto_elem_data + 2))) {
    log::warn("Unable to add SDP PAN profile attribute handle:{}", sdp_handle);
  }

  /* Language base */
  if (!get_legacy_stack_sdp_api()->handle.SDP_AddLanguageBaseAttrIDList(
@@ -106,23 +108,31 @@ uint32_t pan_register_with_sdp(uint16_t uuid, const char* p_name,
  }

  /* Service Name */
  get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
  if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          sdp_handle, ATTR_ID_SERVICE_NAME, TEXT_STR_DESC_TYPE,
      (uint8_t)(strlen(p_name) + 1), (uint8_t*)p_name);
          (uint8_t)(strlen(p_name) + 1), (uint8_t*)p_name)) {
    log::warn("Unable to add SDP service name attribute handle:{}", sdp_handle);
  }

  /* Service description */
  get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
  if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          sdp_handle, ATTR_ID_SERVICE_DESCRIPTION, TEXT_STR_DESC_TYPE,
      (uint8_t)(strlen(p_desc) + 1), (uint8_t*)p_desc);
          (uint8_t)(strlen(p_desc) + 1), (uint8_t*)p_desc)) {
    log::warn("Unable to add SDP service description attribute handle:{}",
              sdp_handle);
  }

  /* Security description */
  // Only NAP and PANU has service level security; GN has no security
  if (uuid == UUID_SERVCLASS_NAP || uuid == UUID_SERVCLASS_PANU) {
    UINT16_TO_BE_FIELD(&security, 0x0001);
  }
  get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
  if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
          sdp_handle, ATTR_ID_SECURITY_DESCRIPTION, UINT_DESC_TYPE, 2,
      (uint8_t*)&security);
          (uint8_t*)&security)) {
    log::warn("Unable to add SDP security description attribute handle:{}",
              sdp_handle);
  }

  if (uuid == UUID_SERVCLASS_NAP) {
    uint16_t NetAccessType = 0x0005;      /* Ethernet */
@@ -132,14 +142,21 @@ uint32_t pan_register_with_sdp(uint16_t uuid, const char* p_name,
    /* Net access type. */
    p = array;
    UINT16_TO_BE_STREAM(p, NetAccessType);
    get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
        sdp_handle, ATTR_ID_NET_ACCESS_TYPE, UINT_DESC_TYPE, 2, array);
    if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
            sdp_handle, ATTR_ID_NET_ACCESS_TYPE, UINT_DESC_TYPE, 2, array)) {
      log::warn("Unable to add SDP attribute net access type handle:{}",
                sdp_handle);
    }

    /* Net access rate. */
    p = array;
    UINT32_TO_BE_STREAM(p, NetAccessRate);
    get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
        sdp_handle, ATTR_ID_MAX_NET_ACCESS_RATE, UINT_DESC_TYPE, 4, array);
    if (!get_legacy_stack_sdp_api()->handle.SDP_AddAttribute(
            sdp_handle, ATTR_ID_MAX_NET_ACCESS_RATE, UINT_DESC_TYPE, 4,
            array)) {
      log::warn("Unable to add SDP attribute net access rate handle:{}",
                sdp_handle);
    }
  }

  /* Make the service browsable */