diff options
author | Casper Bonde <c.bonde@samsung.com> | 2015-04-07 11:05:07 +0200 |
---|---|---|
committer | Andre Eisenbach <eisenbach@google.com> | 2015-04-15 23:25:08 -0700 |
commit | 8a0b80ebad0cb187ff7856d14b83fa74aed51d98 (patch) | |
tree | faa20411fd4a9e21ce4f8bfb321b7fc26be0c36a | |
parent | d7822d82ad56db0c1ef72ae0090c392f8fd5b4cb (diff) | |
download | android_system_bt-8a0b80ebad0cb187ff7856d14b83fa74aed51d98.tar.gz android_system_bt-8a0b80ebad0cb187ff7856d14b83fa74aed51d98.tar.bz2 android_system_bt-8a0b80ebad0cb187ff7856d14b83fa74aed51d98.zip |
Add support for Bluetooth Sim Access Profile (1/4)
Change-Id: Ie1dd95ee00976255f74b6747a1d3fc3ed59152f3
-rw-r--r-- | btif/include/btif_sock_sdp.h | 2 | ||||
-rw-r--r-- | btif/src/btif_sock_sdp.c | 77 |
2 files changed, 77 insertions, 2 deletions
diff --git a/btif/include/btif_sock_sdp.h b/btif/include/btif_sock_sdp.h index 3cbc70c9d..9c09b0f39 100644 --- a/btif/include/btif_sock_sdp.h +++ b/btif/include/btif_sock_sdp.h @@ -27,6 +27,8 @@ static const uint8_t UUID_PBAP_PSE[] = {0x00, 0x00, 0x11, 0x2F, 0x00, 0 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; static const uint8_t UUID_MAP_MAS[] = {0x00, 0x00, 0x11, 0x32, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; +static const uint8_t UUID_SAP[] = {0x00, 0x00, 0x11, 0x2D, 0x00, 0x00, 0x10, 0x00, + 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; static const uint8_t UUID_SPP[] = {0x00, 0x00, 0x11, 0x01, 0x00, 0x00, 0x10, 0x00, 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB}; diff --git a/btif/src/btif_sock_sdp.c b/btif/src/btif_sock_sdp.c index 61ea160f0..44897a670 100644 --- a/btif/src/btif_sock_sdp.c +++ b/btif/src/btif_sock_sdp.c @@ -366,6 +366,77 @@ error: return 0; } +#define BTA_SAPS_DEFAULT_VERSION 0x0102 /* SAP 1.02 (actual version 1.1) */ +static int add_saps_sdp(const char* p_service_name, int scn) +{ + + tSDP_PROTOCOL_ELEM protoList [2]; + UINT16 services[2]; + UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP; + BOOLEAN status = FALSE; + UINT32 sdp_handle = 0; + + APPL_TRACE_DEBUG("add_sap_sdd:scn %d, service name %s", scn, p_service_name); + + if ((sdp_handle = SDP_CreateRecord()) == 0) + { + APPL_TRACE_ERROR("MAPS SDP: Unable to register MAPS Service"); + return sdp_handle; + } + services[0] = UUID_SERVCLASS_SAP; + services[1] = UUID_SERVCLASS_GENERIC_TELEPHONY; + + /* add service class */ + if (SDP_AddServiceClassIdList(sdp_handle, 2, services)) + { + memset( protoList, 0 , 2*sizeof(tSDP_PROTOCOL_ELEM) ); + /* add protocol list, including RFCOMM scn */ + protoList[0].protocol_uuid = UUID_PROTOCOL_L2CAP; + protoList[0].num_params = 0; + protoList[1].protocol_uuid = UUID_PROTOCOL_RFCOMM; + protoList[1].num_params = 1; + protoList[1].params[0] = scn; + + if (SDP_AddProtocolList(sdp_handle, 2, protoList)) + { + status = TRUE; /* All mandatory fields were successful */ + + /* Add in the Bluetooth Profile Descriptor List */ + SDP_AddProfileDescriptorList(sdp_handle, + UUID_SERVCLASS_SAP, + BTA_SAPS_DEFAULT_VERSION); + /* Add the name. */ + SDP_AddAttribute(sdp_handle, + (UINT16)ATTR_ID_SERVICE_NAME, + (UINT8)TEXT_STR_DESC_TYPE, + (UINT32)(strlen(p_service_name) + 1), + (UINT8 *)p_service_name); + + } /* end of setting mandatory protocol list */ + } /* end of setting mandatory service class */ + + /* add supported feature and repositories */ + if (status) + { + /* Make the service browseable */ + SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse); + } + + if (!status) + { + SDP_DeleteRecord(sdp_handle); + sdp_handle = 0; + APPL_TRACE_ERROR("bta_mass_sdp_register FAILED"); + } + else + { + bta_sys_add_uuid(services[0]); /* UUID_SERVCLASS_SIM_ACCESS */ + APPL_TRACE_DEBUG("SAPS: SDP Registered (handle 0x%08x)", sdp_handle); + } + + return sdp_handle; +} + // Adds an RFCOMM SDP record for a service with the given |name|, |uuid|, and // |channel|. This function attempts to identify the type of the service based // upon its |uuid|, and will override the |channel| with a reserved channel @@ -403,8 +474,10 @@ static int add_rfc_sdp_by_uuid(const char *name, const uint8_t *uuid, } else if (UUID_MATCHES(UUID_SPP, uuid)) { handle = add_spp_sdp(name, final_channel); } else if (UUID_MATCHES(UUID_MAP_MAS,uuid)) { - // Record created by new SDP create record interface - handle = 0xff; + // Record created by new SDP create record interface + handle = 0xff; + } else if (UUID_MATCHES(UUID_SAP,uuid)) { + handle = add_saps_sdp(name, final_channel); } else { handle = add_sdp_by_uuid(name, uuid, final_channel); } |