summaryrefslogtreecommitdiffstats
path: root/include/hardware/bt_sdp.h
diff options
context:
space:
mode:
authorkschulz <k.schulz@samsung.com>2015-03-06 09:15:43 +0100
committerAndre Eisenbach <eisenbach@google.com>2015-04-10 16:48:44 -0700
commit9a92a7bff0d0768888cfeef4db6b6fd81bec32ae (patch)
treea5346d3e5d1560b50a293c3dc91a0422cd6de44b /include/hardware/bt_sdp.h
parent3de70a1d6a1b8c0e7febce5e8fc4f0b3ad400b7d (diff)
downloadhardware_libhardware-9a92a7bff0d0768888cfeef4db6b6fd81bec32ae.zip
hardware_libhardware-9a92a7bff0d0768888cfeef4db6b6fd81bec32ae.tar.gz
hardware_libhardware-9a92a7bff0d0768888cfeef4db6b6fd81bec32ae.tar.bz2
L2CAP and SDP Search API for BT profiles (1/2)
Added interface to create SDP records, to allow the upper layers to set the content of the SDP record, including both a RCFOMM channel and a l2cap PSM. Change-Id: I7c47848a10b3d3091afbeadb4de8a8d7ea812288
Diffstat (limited to 'include/hardware/bt_sdp.h')
-rw-r--r--include/hardware/bt_sdp.h144
1 files changed, 144 insertions, 0 deletions
diff --git a/include/hardware/bt_sdp.h b/include/hardware/bt_sdp.h
new file mode 100644
index 0000000..d298ad6
--- /dev/null
+++ b/include/hardware/bt_sdp.h
@@ -0,0 +1,144 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include "bluetooth.h"
+
+#define SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH 15
+
+__BEGIN_DECLS
+
+/**
+ * These events are handled by the state machine
+ */
+typedef enum {
+ SDP_TYPE_RAW, // Used to carry raw SDP search data for unknown UUID's
+ SDP_TYPE_MAP_MAS,
+ SDP_TYPE_MAP_MNS,
+ SDP_TYPE_PBAP_PSE,
+ SDP_TYPE_PBAP_PCE,
+ SDP_TYPE_OPP_SERVER
+} bluetooth_sdp_types;
+
+typedef struct _bluetooth_sdp_hdr {
+ bluetooth_sdp_types type;
+ bt_uuid_t uuid;
+ uint32_t service_name_length;
+ char *service_name;
+ int32_t rfcomm_channel_number;
+ int32_t l2cap_psm;
+ int32_t profile_version;
+} bluetooth_sdp_hdr;
+
+/**
+ * Some signals need additional pointers, hence we introduce a
+ * generic way to handle these pointers.
+ */
+typedef struct _bluetooth_sdp_hdr_overlay {
+ bluetooth_sdp_types type;
+ bt_uuid_t uuid;
+ uint32_t service_name_length;
+ char *service_name;
+ int32_t rfcomm_channel_number;
+ int32_t l2cap_psm;
+ int32_t profile_version;
+
+ // User pointers, only used for some signals - see bluetooth_sdp_ops_record
+ int user1_ptr_len;
+ uint8_t *user1_ptr;
+ int user2_ptr_len;
+ uint8_t *user2_ptr;
+} bluetooth_sdp_hdr_overlay;
+
+typedef struct _bluetooth_sdp_mas_record {
+ bluetooth_sdp_hdr_overlay hdr;
+ uint32_t mas_instance_id;
+ uint32_t supported_features;
+ uint32_t supported_message_types;
+} bluetooth_sdp_mas_record;
+
+typedef struct _bluetooth_sdp_mns_record {
+ bluetooth_sdp_hdr_overlay hdr;
+ uint32_t supported_features;
+} bluetooth_sdp_mns_record;
+
+typedef struct _bluetooth_sdp_pse_record {
+ bluetooth_sdp_hdr_overlay hdr;
+ uint32_t supported_features;
+ uint32_t supported_repositories;
+} bluetooth_sdp_pse_record;
+
+typedef struct _bluetooth_sdp_pce_record {
+ bluetooth_sdp_hdr_overlay hdr;
+} bluetooth_sdp_pce_record;
+
+typedef struct _bluetooth_sdp_ops_record {
+ bluetooth_sdp_hdr_overlay hdr;
+ int supported_formats_list_len;
+ uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH];
+} bluetooth_sdp_ops_record;
+
+typedef union {
+ bluetooth_sdp_hdr_overlay hdr;
+ bluetooth_sdp_mas_record mas;
+ bluetooth_sdp_mns_record mns;
+ bluetooth_sdp_pse_record pse;
+ bluetooth_sdp_pce_record pce;
+ bluetooth_sdp_ops_record ops;
+} bluetooth_sdp_record;
+
+
+/** Callback for SDP search */
+typedef void (*btsdp_search_callback)(bt_status_t status, bt_bdaddr_t *bd_addr, uint8_t* uuid, int num_records, bluetooth_sdp_record *records);
+
+typedef struct {
+ /** Set to sizeof(btsdp_callbacks_t) */
+ size_t size;
+ btsdp_search_callback sdp_search_cb;
+} btsdp_callbacks_t;
+
+typedef struct {
+ /** Set to size of this struct */
+ size_t size;
+
+ /** Register BT SDP search callbacks */
+ bt_status_t (*init)(btsdp_callbacks_t *callbacks);
+
+ /** Unregister BT SDP */
+ bt_status_t (*deinit)();
+
+ /** Search for SDP records with specific uuid on remote device */
+ bt_status_t (*sdp_search)(bt_bdaddr_t *bd_addr, const uint8_t* uuid);
+
+ /**
+ * Use listen in the socket interface to create rfcomm and/or l2cap PSM channels,
+ * (without UUID and service_name and set the BTSOCK_FLAG_NO_SDP flag in flags).
+ * Then use createSdpRecord to create the SDP record associated with the rfcomm/l2cap channels.
+ *
+ * Returns a handle to the SDP record, which can be parsed to remove_sdp_record.
+ *
+ * record (in) The SDP record to create
+ * record_handle (out)The corresponding record handle will be written to this pointer.
+ */
+ bt_status_t (*create_sdp_record)(bluetooth_sdp_record *record, int* record_handle);
+
+ /** Remove a SDP record created by createSdpRecord */
+ bt_status_t (*remove_sdp_record)(int sdp_handle);
+} btsdp_interface_t;
+
+__END_DECLS
+