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};
-
+static const uint8_t UUID_SAP[] = {0x00, 0x00, 0x11, 0x2D, 0x00, 0x00, 0x10, 0x00,
+ 0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB};
// TODO:
// Both the fact that the UUIDs are declared in multiple places, plus the fact
// that there is a mess of UUID comparison and shortening methods will have to
static uint8_t bt_base_uuid[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
0x80, 0x00, 0x00, 0x80, 0x5F, 0x9B, 0x34, 0xFB };
- APPL_TRACE_DEBUG("uuid len:%d", u->len);
+ APPL_TRACE_DEBUG("%s() - uuid len:%d", __func__, u->len);
if(u->len != 16)
return *u;
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_MAP_SUPPORTED_FEATURES)) != NULL)
{
record->mns.supported_features = p_attr->attr_value.v.u32;
- APPL_TRACE_DEBUG("Found supported_features: %d", record->mns.supported_features );
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL)
{
record->mns.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->mns.hdr.service_name = (char *)p_attr->attr_value.v.array;
- APPL_TRACE_DEBUG("Found service name with length: %d", record->mns.hdr.service_name_length);
}
if (SDP_FindProfileVersionInRec(p_rec, UUID_SERVCLASS_MAP_PROFILE, &pversion))
{
record->mns.hdr.profile_version = pversion;
- APPL_TRACE_DEBUG("Found profile_version: %d", record->mns.hdr.profile_version);
}
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
{
record->mns.hdr.rfcomm_channel_number = pe.params[0];
- APPL_TRACE_DEBUG("Found rfcomm_channel_number: %d", record->mns.hdr.rfcomm_channel_number);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL)
{
record->mns.hdr.l2cap_psm = p_attr->attr_value.v.u16;
- APPL_TRACE_DEBUG("Found l2cap_psm: %d", record->mns.hdr.l2cap_psm);
}
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_MAS_INSTANCE_ID)) != NULL)
{
record->mas.mas_instance_id = p_attr->attr_value.v.u8;
- APPL_TRACE_DEBUG("Found mas_instance_id: %d", record->mas.mas_instance_id);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_MSG_TYPE)) != NULL)
{
record->mas.supported_message_types = p_attr->attr_value.v.u8;
- APPL_TRACE_DEBUG("Found supported_message_types: %d", record->mas.supported_message_types);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_MAP_SUPPORTED_FEATURES)) != NULL)
{
record->mas.supported_features = p_attr->attr_value.v.u32;
- APPL_TRACE_DEBUG("Found supported_features: %d", record->mas.supported_features);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL)
{
record->mas.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->mas.hdr.service_name = (char *)p_attr->attr_value.v.array;
- APPL_TRACE_DEBUG("Found service name with length: %d", record->mas.hdr.service_name_length);
}
if (SDP_FindProfileVersionInRec(p_rec, UUID_SERVCLASS_MAP_PROFILE, &pversion))
{
record->mas.hdr.profile_version = pversion;
- APPL_TRACE_DEBUG("Found profile_version: %d", record->mas.hdr.profile_version);
}
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
{
record->mas.hdr.rfcomm_channel_number = pe.params[0];
- APPL_TRACE_DEBUG("Found rfcomm_channel_number: %d", record->mas.hdr.rfcomm_channel_number);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL)
{
record->mas.hdr.l2cap_psm = p_attr->attr_value.v.u16;
- APPL_TRACE_DEBUG("Found l2cap_psm: %d", record->mas.hdr.l2cap_psm);
-
}
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_REPOSITORIES)) != NULL)
{
record->pse.supported_repositories = p_attr->attr_value.v.u8;
- APPL_TRACE_DEBUG("Found supported_repositories: %d", record->pse.supported_repositories);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_PBAP_SUPPORTED_FEATURES)) != NULL)
{
record->pse.supported_features = p_attr->attr_value.v.u32;
- APPL_TRACE_DEBUG("Found supported_features: %d", record->pse.supported_features);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL)
{
record->pse.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->pse.hdr.service_name = (char *)p_attr->attr_value.v.array;
- APPL_TRACE_DEBUG("Found service name with length: %d", record->pse.hdr.service_name_length);
}
if (SDP_FindProfileVersionInRec(p_rec, UUID_SERVCLASS_PHONE_ACCESS, &pversion))
{
record->pse.hdr.profile_version = pversion;
- APPL_TRACE_DEBUG("Found profile_version: %d", record->pse.hdr.profile_version);
}
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
{
record->pse.hdr.rfcomm_channel_number = pe.params[0];
- APPL_TRACE_DEBUG("Found rfcomm_channel_number: %d", record->pse.hdr.rfcomm_channel_number);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL)
{
record->pse.hdr.l2cap_psm = p_attr->attr_value.v.u16;
- APPL_TRACE_DEBUG("Found l2cap_psm: %d", record->pse.hdr.l2cap_psm);
}
-
}
static void bta_create_ops_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
{
record->ops.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->ops.hdr.service_name = (char *)p_attr->attr_value.v.array;
- APPL_TRACE_DEBUG("Found service name with length: %d", record->ops.hdr.service_name_length);
}
if (SDP_FindProfileVersionInRec(p_rec, UUID_SERVCLASS_OBEX_OBJECT_PUSH, &pversion))
{
record->ops.hdr.profile_version = pversion;
- APPL_TRACE_DEBUG("Found profile_version: %d", record->ops.hdr.profile_version);
}
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
{
record->ops.hdr.rfcomm_channel_number = pe.params[0];
- APPL_TRACE_DEBUG("Found rfcomm_channel_number: %d", record->ops.hdr.rfcomm_channel_number);
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_GOEP_L2CAP_PSM)) != NULL)
{
record->ops.hdr.l2cap_psm = p_attr->attr_value.v.u16;
- APPL_TRACE_DEBUG("Found l2cap_psm: %d", record->ops.hdr.l2cap_psm);
-
}
if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SUPPORTED_FORMATS_LIST)) != NULL)
{
/* Safety check - each entry should itself be a sequence */
if (SDP_DISC_ATTR_TYPE(p_attr->attr_len_type) != DATA_ELE_SEQ_DESC_TYPE) {
record->ops.supported_formats_list_len = 0;
- APPL_TRACE_ERROR("supported_formats_list - wrong attribute length/type:"
- " 0x%02x - expected 0x06",p_attr->attr_len_type);
+ APPL_TRACE_ERROR("%s() - supported_formats_list - wrong attribute length/type:"
+ " 0x%02x - expected 0x06", __func__, p_attr->attr_len_type);
} else {
int count = 0;
/* 1 byte for type/length 1 byte for value */
if ((SDP_DISC_ATTR_TYPE(p_sattr->attr_len_type) == UINT_DESC_TYPE)
&& (SDP_DISC_ATTR_LEN(p_sattr->attr_len_type) == 1))
{
- if(count == sizeof(record->ops.supported_formats_list)) {
- APPL_TRACE_ERROR("supported_formats_list - count overflow - "
- "too many sub attributes!!");
+ if (count == sizeof(record->ops.supported_formats_list)) {
+ APPL_TRACE_ERROR("%s() - supported_formats_list - count overflow - "
+ "too many sub attributes!!", __func__);
/* If you hit this, new formats have been added,
* update SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH */
break;
record->ops.supported_formats_list[count] = p_sattr->attr_value.v.u8;
count++;
} else {
- APPL_TRACE_ERROR("supported_formats_list - wrong sub attribute "
- "length/type: 0x%02x - expected 0x80"
- ,p_sattr->attr_len_type);
+ APPL_TRACE_ERROR("%s() - supported_formats_list - wrong sub attribute "
+ "length/type: 0x%02x - expected 0x80", __func__,
+ p_sattr->attr_len_type);
break;
}
}
- if(record->ops.supported_formats_list_len != count) {
- APPL_TRACE_WARNING("supported_formats_list - Length of attribute different "
+ if (record->ops.supported_formats_list_len != count) {
+ APPL_TRACE_WARNING("%s() - supported_formats_list - Length of attribute different "
"from the actual number of sub-attributes in the sequence "
- "att-length: %d - number of elements: %d"
- ,record->ops.supported_formats_list_len , count);
+ "att-length: %d - number of elements: %d", __func__,
+ record->ops.supported_formats_list_len , count);
}
record->ops.supported_formats_list_len = count;
}
+ }
+}
+
+static void bta_create_sap_sdp_record(bluetooth_sdp_record *record, tSDP_DISC_REC *p_rec)
+{
+ tSDP_DISCOVERY_DB *db = p_bta_sdp_cfg->p_sdp_db;
+ tSDP_DISC_ATTR *p_attr;
+ tSDP_PROTOCOL_ELEM pe;
+ UINT16 pversion = -1;
- APPL_TRACE_DEBUG("Found supported_formats_list - length: %d",
- record->ops.supported_formats_list_len);
+ record->sap.hdr.type = SDP_TYPE_MAP_MAS;
+ record->sap.hdr.service_name_length = 0;
+ record->sap.hdr.service_name = NULL;
+ record->sap.hdr.rfcomm_channel_number = 0;
+ record->sap.hdr.l2cap_psm = -1;
+ record->sap.hdr.profile_version = 0;
+
+ if ((p_attr = SDP_FindAttributeInRec(p_rec, ATTR_ID_SERVICE_NAME)) != NULL)
+ {
+ record->sap.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
+ record->sap.hdr.service_name = (char *)p_attr->attr_value.v.array;
+ }
+
+ if (SDP_FindProfileVersionInRec(p_rec, UUID_SERVCLASS_SAP, &pversion))
+ {
+ record->sap.hdr.profile_version = pversion;
+ }
+
+ if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
+ {
+ record->sap.hdr.rfcomm_channel_number = pe.params[0];
}
}
{
record->pse.hdr.service_name_length = SDP_DISC_ATTR_LEN(p_attr->attr_len_type);
record->pse.hdr.service_name = (char *)p_attr->attr_value.v.array;
- APPL_TRACE_DEBUG("Found service name with length: %d", record->pse.hdr.service_name_length);
}
/* Try to extract an RFCOMM channel */
if (SDP_FindProtocolListElemInRec(p_rec, UUID_PROTOCOL_RFCOMM, &pe))
{
record->pse.hdr.rfcomm_channel_number = pe.params[0];
- APPL_TRACE_DEBUG("Found rfcomm_channel_number: %d", record->pse.hdr.rfcomm_channel_number);
}
record->hdr.user1_ptr_len = p_bta_sdp_cfg->p_sdp_db->raw_size;
record->hdr.user1_ptr = p_bta_sdp_cfg->p_sdp_db->raw_data;
UINT16 uuid16 = 0;
int count = 0;
tBT_UUID su;
- APPL_TRACE_DEBUG("bta_sdp_search_cback res: 0x%x", result);
+ APPL_TRACE_DEBUG("%s() - res: 0x%x", __func__, result);
bta_sdp_cb.sdp_active = BTA_SDP_ACTIVE_NONE;
if (IS_UUID(UUID_MAP_MAS,uuid->uu.uuid128)) {
APPL_TRACE_DEBUG("%s() - found MAP (MAS) uuid", __func__);
bta_create_mas_sdp_record(&evt_data.records[count], p_rec);
-
- }else if (IS_UUID(UUID_MAP_MNS,uuid->uu.uuid128)) {
+ } else if (IS_UUID(UUID_MAP_MNS,uuid->uu.uuid128)) {
APPL_TRACE_DEBUG("%s() - found MAP (MNS) uuid", __func__);
bta_create_mns_sdp_record(&evt_data.records[count], p_rec);
-
- }else if(IS_UUID(UUID_PBAP_PSE,uuid->uu.uuid128)){
+ } else if (IS_UUID(UUID_PBAP_PSE,uuid->uu.uuid128)){
APPL_TRACE_DEBUG("%s() - found PBAP (PSE) uuid", __func__);
bta_create_pse_sdp_record(&evt_data.records[count], p_rec);
- }else if(IS_UUID(UUID_OBEX_OBJECT_PUSH,uuid->uu.uuid128)){
+ } else if (IS_UUID(UUID_OBEX_OBJECT_PUSH,uuid->uu.uuid128)){
APPL_TRACE_DEBUG("%s() - found Object Push Server (OPS) uuid", __func__);
bta_create_ops_sdp_record(&evt_data.records[count], p_rec);
- }else {
+ } else if (IS_UUID(UUID_SAP,uuid->uu.uuid128)) {
+ APPL_TRACE_DEBUG("%s() - found SAP uuid", __func__);
+ bta_create_sap_sdp_record(&evt_data.records[count], p_rec);
+ } else {
/* we do not have specific structure for this */
APPL_TRACE_DEBUG("%s() - profile not identified. using raw data", __func__);
static pthread_mutex_t sdp_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-
/**
* The need for a state variable have been reduced to two states.
* The remaining state control is handled by program flow
static int add_mapc_sdp(const bluetooth_sdp_mns_record* rec);
static int add_pbaps_sdp(const bluetooth_sdp_pse_record* rec);
static int add_opps_sdp(const bluetooth_sdp_ops_record* rec);
+static int add_saps_sdp(const bluetooth_sdp_sap_record* rec);
bt_status_t remove_sdp_record(int record_id);
static int free_sdp_slot(int id);
pthread_mutex_unlock(&sdp_lock);
}
-
int get_sdp_records_size(bluetooth_sdp_record* in_record, int count) {
bluetooth_sdp_record* record = in_record;
int records_size = 0;
}
pthread_mutex_unlock(&sdp_lock);
if(i >= MAX_SDP_SLOTS) {
- APPL_TRACE_ERROR("alloc_sdp_slot failed - no more free slots!");
+ APPL_TRACE_ERROR("%s() failed - no more free slots!", __func__);
/* Rearly the optimist is too optimistic, and cleanup is needed...*/
free(record);
return -1;
int handle = -1;
bluetooth_sdp_record* record = NULL;
if(id >= MAX_SDP_SLOTS) {
- APPL_TRACE_ERROR("free_sdp_slot failed - id %d is invalid", id);
+ APPL_TRACE_ERROR("%s() failed - id %d is invalid", __func__, id);
return handle;
}
pthread_mutex_lock(&sdp_lock);
static const sdp_slot_t* start_create_sdp(int id) {
sdp_slot_t* sdp_slot;
if(id >= MAX_SDP_SLOTS) {
- APPL_TRACE_ERROR("start_create_sdp failed - id %d is invalid", id);
+ APPL_TRACE_ERROR("%s() failed - id %d is invalid", __func__, id);
return NULL;
}
pthread_mutex_lock(&sdp_lock);
}
pthread_mutex_unlock(&sdp_lock);
if(sdp_slot == NULL) {
- APPL_TRACE_ERROR("start_create_sdp failed - state for id %d is "
- "sdp_slots[id].state = %d expected %d",
+ APPL_TRACE_ERROR("%s() failed - state for id %d is "
+ "sdp_slots[id].state = %d expected %d", __func__,
id, sdp_slots[id].state, SDP_RECORD_ALLOCED);
}
return sdp_slot;
pthread_mutex_lock(&sdp_lock);
sdp_slots[id].sdp_handle = handle;
pthread_mutex_unlock(&sdp_lock);
- BTIF_TRACE_DEBUG("Sdp Server %s id=%d to handle=0x%08x",
- __FUNCTION__, id, handle);
-
+ BTIF_TRACE_DEBUG("%s() id=%d to handle=0x%08x", __FUNCTION__, id, handle);
}
int handle;
handle = alloc_sdp_slot(record);
- BTIF_TRACE_DEBUG("Sdp Server %s handle = 0x%08x", __FUNCTION__, handle);
+ BTIF_TRACE_DEBUG("%s() handle = 0x%08x", __FUNCTION__, handle);
if(handle < 0)
return BT_STATUS_FAIL;
case SDP_TYPE_OPP_SERVER:
handle = add_opps_sdp(&record->ops);
break;
+ case SDP_TYPE_SAP_SERVER:
+ handle = add_saps_sdp(&record->sap);
+ break;
case SDP_TYPE_PBAP_PCE:
// break; not yet supported
default:
UINT8 temp[4];
UINT8* p_temp = temp;
- APPL_TRACE_DEBUG("add_mas_sdp: MASID = 0x%02x, scn 0x%02x, psm = 0x%04x\n service name %s",
+ APPL_TRACE_DEBUG("%s(): MASID = 0x%02x, scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
rec->mas_instance_id, rec->hdr.rfcomm_channel_number,
rec->hdr.l2cap_psm, rec->hdr.service_name);
if ((sdp_handle = SDP_CreateRecord()) == 0)
{
- APPL_TRACE_ERROR("MAPS SDP: Unable to register MAPS Service");
+ APPL_TRACE_ERROR("%s() - Unable to register MAPS Service", __func__);
return sdp_handle;
}
{
SDP_DeleteRecord(sdp_handle);
sdp_handle = 0;
- APPL_TRACE_ERROR("add_maps_sdp FAILED");
+ APPL_TRACE_ERROR("%s() FAILED", __func__);
}
else
{
bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */
- APPL_TRACE_DEBUG("MAPS: SDP Registered (handle 0x%08x)", sdp_handle);
+ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
}
return sdp_handle;
}
UINT8 temp[4];
UINT8* p_temp = temp;
- APPL_TRACE_DEBUG("add_mas_sdp: scn 0x%02x, psm = 0x%04x\n service name %s",
+ APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
APPL_TRACE_DEBUG(" feature_bits: 0x%08x", rec->supported_features);
if ((sdp_handle = SDP_CreateRecord()) == 0)
{
- APPL_TRACE_ERROR("add_mapc_sdp: Unable to register MAP Notification Service");
+ APPL_TRACE_ERROR("%s(): Unable to register MAP Notification Service", __func__);
return sdp_handle;
}
{
SDP_DeleteRecord(sdp_handle);
sdp_handle = 0;
- APPL_TRACE_ERROR("add_mapc_sdp FAILED");
+ APPL_TRACE_ERROR("%s() FAILED", __func__);
}
else
{
bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */
- APPL_TRACE_DEBUG("MAPC: SDP Registered (handle 0x%08x)", sdp_handle);
+ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
}
return sdp_handle;
}
UINT8 temp[4];
UINT8* p_temp = temp;
- APPL_TRACE_DEBUG("add_pbaps_sdp: scn 0x%02x, psm = 0x%04x\n service name %s",
+ APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
APPL_TRACE_DEBUG(" supported_repositories: 0x%08x, feature_bits: 0x%08x",
if ((sdp_handle = SDP_CreateRecord()) == 0)
{
- APPL_TRACE_ERROR("add_pbaps_sdp: Unable to register PBAP Server Service");
+ APPL_TRACE_ERROR("%s(): Unable to register PBAP Server Service", __func__);
return sdp_handle;
}
{
SDP_DeleteRecord(sdp_handle);
sdp_handle = 0;
- APPL_TRACE_ERROR("add_pbaps_sdp FAILED");
+ APPL_TRACE_ERROR("%s() FAILED", __func__);
}
else
{
bta_sys_add_uuid(service); /* UUID_SERVCLASS_MESSAGE_ACCESS */
- APPL_TRACE_DEBUG("PBAPS: SDP Registered (handle 0x%08x)", sdp_handle);
+ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
}
return sdp_handle;
}
tBTA_UTL_COD cod;
int i,j;
- APPL_TRACE_DEBUG("add_opps_sdp: scn 0x%02x, psm = 0x%04x\n service name %s",
+ APPL_TRACE_DEBUG("%s(): scn 0x%02x, psm = 0x%04x\n service name %s", __func__,
rec->hdr.rfcomm_channel_number, rec->hdr.l2cap_psm, rec->hdr.service_name);
APPL_TRACE_DEBUG(" supported formats count: %d",
if ((sdp_handle = SDP_CreateRecord()) == 0)
{
- APPL_TRACE_ERROR("add_opps_sdp: Unable to register Object Push Server Service");
+ APPL_TRACE_ERROR("%s(): Unable to register Object Push Server Service", __func__);
return sdp_handle;
}
{
SDP_DeleteRecord(sdp_handle);
sdp_handle = 0;
- APPL_TRACE_ERROR("add_opps_sdp FAILED");
+ APPL_TRACE_ERROR("%s() FAILED", __func__);
}
else
{
utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS);
bta_sys_add_uuid(service); /* UUID_SERVCLASS_OBEX_OBJECT_PUSH */
- APPL_TRACE_DEBUG("OPPS: SDP Registered (handle 0x%08x)", sdp_handle);
+ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
}
return sdp_handle;
}
+// Create a Sim Access Profile SDP record based on information stored in a bluetooth_sdp_sap_record.
+static int add_saps_sdp(const bluetooth_sdp_sap_record* rec)
+{
+ tSDP_PROTOCOL_ELEM protoList [2];
+ UINT16 services[2];
+ UINT16 browse = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
+ BOOLEAN status = TRUE;
+ UINT32 sdp_handle = 0;
+
+ APPL_TRACE_DEBUG("%s(): scn 0x%02x, service name %s", __func__,
+ rec->hdr.rfcomm_channel_number, rec->hdr.service_name);
+
+ if ((sdp_handle = SDP_CreateRecord()) == 0)
+ {
+ APPL_TRACE_ERROR("%s(): Unable to register SAPS Service", __func__);
+ return sdp_handle;
+ }
+
+ services[0] = UUID_SERVCLASS_SAP;
+ services[1] = UUID_SERVCLASS_GENERIC_TELEPHONY;
+
+ // add service class
+ status &= 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] = rec->hdr.rfcomm_channel_number;
+ status &= SDP_AddProtocolList(sdp_handle, 2, protoList);
+
+ // Add a name entry
+ status &= SDP_AddAttribute(sdp_handle,
+ (UINT16)ATTR_ID_SERVICE_NAME,
+ (UINT8)TEXT_STR_DESC_TYPE,
+ (UINT32)(rec->hdr.service_name_length + 1),
+ (UINT8 *)rec->hdr.service_name);
+
+ // Add in the Bluetooth Profile Descriptor List
+ status &= SDP_AddProfileDescriptorList(sdp_handle,
+ UUID_SERVCLASS_SAP,
+ rec->hdr.profile_version);
+
+ // Make the service browseable
+ status &= SDP_AddUuidSequence (sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &browse);
+
+ if (!status)
+ {
+ SDP_DeleteRecord(sdp_handle);
+ sdp_handle = 0;
+ APPL_TRACE_ERROR("%s(): FAILED deleting record", __func__);
+ }
+ else
+ {
+ bta_sys_add_uuid(UUID_SERVCLASS_SAP);
+ APPL_TRACE_DEBUG("%s(): SDP Registered (handle 0x%08x)", __func__, sdp_handle);
+ }
+ return sdp_handle;
+}
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
} else if (UUID_MATCHES(UUID_MAP_MAS,uuid)) {
// 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);
}