summaryrefslogtreecommitdiffstats
path: root/btif/src/btif_sock_sdp.c
diff options
context:
space:
mode:
authorzzy <zhenye@broadcom.com>2012-10-11 14:48:58 -0700
committerMatthew Xie <mattx@google.com>2012-10-15 22:37:12 -0700
commit8aae7556993cdba8995146be134f8b77a8e15ba4 (patch)
tree9b3a5155adabc5f4613b39ab259be86e5ee706e7 /btif/src/btif_sock_sdp.c
parentd4cfae4991ee5f1d0f56900e6dc39097f9413202 (diff)
downloadexternal_bluetooth_bluedroid-8aae7556993cdba8995146be134f8b77a8e15ba4.zip
external_bluetooth_bluedroid-8aae7556993cdba8995146be134f8b77a8e15ba4.tar.gz
external_bluetooth_bluedroid-8aae7556993cdba8995146be134f8b77a8e15ba4.tar.bz2
Add serial port profile support and allow to connect to rfcomm channel without sdp discovery
bug 7272974 Change-Id: Idc10edc056b48da2fd96bea84eba3fb73b97bab1
Diffstat (limited to 'btif/src/btif_sock_sdp.c')
-rw-r--r--btif/src/btif_sock_sdp.c57
1 files changed, 47 insertions, 10 deletions
diff --git a/btif/src/btif_sock_sdp.c b/btif/src/btif_sock_sdp.c
index 2dfc526..12adb6b 100644
--- a/btif/src/btif_sock_sdp.c
+++ b/btif/src/btif_sock_sdp.c
@@ -64,12 +64,6 @@
#define RESERVED_SCN_OPS 12
#define UUID_MAX_LENGTH 16
-static const UINT8 UUID_OBEX_OBJECT_PUSH[] = {0x00, 0x00, 0x11, 0x05, 0x00, 0x00, 0x10, 0x00,
- 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
-
-static const UINT8 UUID_PBAP_PSE[] = {0x00, 0x00, 0x11, 0x2F, 0x00, 0x00, 0x10, 0x00,
- 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
-
#define IS_UUID(u1,u2) !memcmp(u1,u2,UUID_MAX_LENGTH)
@@ -317,6 +311,45 @@ static int add_ops_sdp(const char *p_service_name,int scn)
return sdp_handle;
}
+#define SPP_NUM_PROTO_ELEMS 2
+static int add_spp_sdp(const char *service_name, int scn)
+{
+ UINT16 serviceclassid = UUID_SERVCLASS_SERIAL_PORT;
+ tSDP_PROTOCOL_ELEM proto_elem_list[SPP_NUM_PROTO_ELEMS];
+ int sdp_handle;
+
+ info("scn %d, service name %s", scn, service_name);
+
+ /* register the service */
+ if ((sdp_handle = SDP_CreateRecord()) != FALSE)
+ {
+ /*** Fill out the protocol element sequence for SDP ***/
+ proto_elem_list[0].protocol_uuid = UUID_PROTOCOL_L2CAP;
+ proto_elem_list[0].num_params = 0;
+ proto_elem_list[1].protocol_uuid = UUID_PROTOCOL_RFCOMM;
+ proto_elem_list[1].num_params = 1;
+
+ proto_elem_list[1].params[0] = scn;
+
+ if (SDP_AddProtocolList(sdp_handle, SPP_NUM_PROTO_ELEMS, proto_elem_list))
+ {
+ if (SDP_AddServiceClassIdList(sdp_handle, 1, &serviceclassid))
+ {
+ if ((SDP_AddAttribute(sdp_handle, ATTR_ID_SERVICE_NAME,
+ TEXT_STR_DESC_TYPE, (UINT32)(strlen(service_name)+1),
+ (UINT8 *)service_name)))
+ {
+ UINT16 list[1];
+ /* Make the service browseable */
+ list[0] = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
+ SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST,
+ 1, list);
+ }
+ }
+ }
+ }
+ return sdp_handle;
+}
@@ -351,6 +384,10 @@ static int add_rfc_sdp_by_uuid(const char* name, const uint8_t* uuid, int scn)
{
handle = add_pbap_sdp(name, final_scn); //PBAP Server is always 19
}
+ else if (IS_UUID(UUID_SPP, uuid))
+ {
+ handle = add_spp_sdp(name, final_scn);
+ }
else
{
handle = add_sdp_by_uuid(name, uuid, final_scn);
@@ -391,17 +428,17 @@ int add_rfc_sdp_rec(const char* name, const uint8_t* uuid, int scn)
switch(scn)
{
case RESERVED_SCN_PBS: // PBAP Reserved port
- add_pbap_sdp(name, scn);
+ uuid = UUID_PBAP_PSE;
break;
case RESERVED_SCN_OPS:
- add_ops_sdp(name,scn);
+ uuid = UUID_OBEX_OBJECT_PUSH;
break;
default:
+ uuid = UUID_SPP;
break;
}
}
- else
- sdp_handle = add_rfc_sdp_by_uuid(name, uuid, scn);
+ sdp_handle = add_rfc_sdp_by_uuid(name, uuid, scn);
return sdp_handle;
}