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

Commit 0e936d8f authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Carve out SDP API and callback interface"

parents 1957c7ca 97190cdf
Loading
Loading
Loading
Loading
+572 −4

File changed.

Preview size limit exceeded, changes collapsed.

+57 −0
Original line number Diff line number Diff line
@@ -31,6 +31,7 @@
#include "bt_target.h"
#include "osi/include/osi.h"  // PTR_TO_UINT
#include "stack/include/bt_types.h"
#include "stack/include/sdp_api.h"
#include "stack/sdp/sdpint.h"
#include "types/bluetooth/uuid.h"
#include "types/raw_address.h"
@@ -1049,3 +1050,59 @@ uint8_t SDP_SetTraceLevel(uint8_t new_level) {

  return (sdp_cb.trace_level);
}

namespace {
bluetooth::legacy::stack::sdp::tSdpApi api_ = {
    .service =
        {
            .SDP_InitDiscoveryDb = ::SDP_InitDiscoveryDb,
            .SDP_CancelServiceSearch = ::SDP_CancelServiceSearch,
            .SDP_ServiceSearchRequest = ::SDP_ServiceSearchRequest,
            .SDP_ServiceSearchAttributeRequest =
                ::SDP_ServiceSearchAttributeRequest,
            .SDP_ServiceSearchAttributeRequest2 =
                ::SDP_ServiceSearchAttributeRequest2,
        },
    .db =
        {
            .SDP_FindServiceInDb = ::SDP_FindServiceInDb,
            .SDP_FindServiceUUIDInDb = ::SDP_FindServiceUUIDInDb,
            .SDP_FindServiceInDb_128bit = ::SDP_FindServiceInDb_128bit,
        },
    .record =
        {
            .SDP_FindAttributeInRec = ::SDP_FindAttributeInRec,
            .SDP_FindServiceUUIDInRec_128bit =
                ::SDP_FindServiceUUIDInRec_128bit,
            .SDP_FindProtocolListElemInRec = ::SDP_FindProtocolListElemInRec,
            .SDP_FindProfileVersionInRec = ::SDP_FindProfileVersionInRec,
            .SDP_FindServiceUUIDInRec = ::SDP_FindServiceUUIDInRec,
        },
    .handle =
        {
            .SDP_CreateRecord = ::SDP_CreateRecord,
            .SDP_DeleteRecord = ::SDP_DeleteRecord,
            .SDP_AddAttribute = ::SDP_AddAttribute,
            .SDP_AddSequence = ::SDP_AddSequence,
            .SDP_AddUuidSequence = ::SDP_AddUuidSequence,
            .SDP_AddProtocolList = ::SDP_AddProtocolList,
            .SDP_AddAdditionProtoLists = ::SDP_AddAdditionProtoLists,
            .SDP_AddProfileDescriptorList = ::SDP_AddProfileDescriptorList,
            .SDP_AddLanguageBaseAttrIDList = ::SDP_AddLanguageBaseAttrIDList,
            .SDP_AddServiceClassIdList = ::SDP_AddServiceClassIdList,
            .SDP_DeleteAttribute = ::SDP_DeleteAttribute,
        },
    .device_id =
        {
            .SDP_SetLocalDiRecord = ::SDP_SetLocalDiRecord,
            .SDP_DiDiscover = ::SDP_DiDiscover,
            .SDP_GetNumDiRecords = ::SDP_GetNumDiRecords,
            .SDP_GetDiRecord = ::SDP_GetDiRecord,
        },
};
}  // namespace

const bluetooth::legacy::stack::sdp::tSdpApi*
bluetooth::legacy::stack::sdp::get_legacy_stack_sdp_api() {
  return &api_;
}
+69 −0
Original line number Diff line number Diff line


#include <cstdint>

#include "stack/include/sdp_api.h"
#include "types/bluetooth/uuid.h"

namespace test {
namespace mock {
namespace stack_sdp_legacy {

bluetooth::legacy::stack::sdp::tSdpApi api_ = {
    .service =
        {
            .SDP_InitDiscoveryDb = [](tSDP_DISCOVERY_DB*, uint32_t, uint16_t,
                                      const bluetooth::Uuid*, uint16_t,
                                      const uint16_t*) -> bool {
              return false;
            },
            .SDP_CancelServiceSearch = nullptr,
            .SDP_ServiceSearchRequest = nullptr,
            .SDP_ServiceSearchAttributeRequest = nullptr,
            .SDP_ServiceSearchAttributeRequest2 = nullptr,
        },
    .db =
        {
            .SDP_FindServiceInDb = nullptr,
            .SDP_FindServiceUUIDInDb = nullptr,
            .SDP_FindServiceInDb_128bit = nullptr,
        },
    .record =
        {
            .SDP_FindAttributeInRec = nullptr,
            .SDP_FindServiceUUIDInRec_128bit = nullptr,
            .SDP_FindProtocolListElemInRec = nullptr,
            .SDP_FindProfileVersionInRec = nullptr,
            .SDP_FindServiceUUIDInRec = nullptr,
        },
    .handle =
        {
            .SDP_CreateRecord = nullptr,
            .SDP_DeleteRecord = nullptr,
            .SDP_AddAttribute = nullptr,
            .SDP_AddSequence = nullptr,
            .SDP_AddUuidSequence = nullptr,
            .SDP_AddProtocolList = nullptr,
            .SDP_AddAdditionProtoLists = nullptr,
            .SDP_AddProfileDescriptorList = nullptr,
            .SDP_AddLanguageBaseAttrIDList = nullptr,
            .SDP_AddServiceClassIdList = nullptr,
            .SDP_DeleteAttribute = nullptr,
        },
    .device_id =
        {
            .SDP_SetLocalDiRecord = nullptr,
            .SDP_DiDiscover = nullptr,
            .SDP_GetNumDiRecords = nullptr,
            .SDP_GetDiRecord = nullptr,
        },
};

}  // namespace stack_sdp_legacy
}  // namespace mock
}  // namespace test

const struct bluetooth::legacy::stack::sdp::tSdpApi*
bluetooth::legacy::stack::sdp::get_legacy_stack_sdp_api() {
  return &test::mock::stack_sdp_legacy::api_;
}