Bluetooth: AVDTP: SEP Definition
Added SEP structure SEP Registration function Change-Id: Ib8c4a1753c85390009c154a50a1a1a2f2794e8a2 Signed-off-by: Arun Jagadish <arun.jagadish@intel.com>
This commit is contained in:
parent
73a2100bd8
commit
6f3c4bf425
3 changed files with 94 additions and 0 deletions
55
include/bluetooth/avdtp.h
Normal file
55
include/bluetooth/avdtp.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/** @file
|
||||
* @brief Audio/Video Distribution Transport Protocol header.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright (c) 2015-2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
#ifndef __BT_AVDTP_H
|
||||
#define __BT_AVDTP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** @brief AVDTP SEID Information */
|
||||
struct bt_avdtp_seid_info {
|
||||
/** Stream End Point ID */
|
||||
uint8_t id:6;
|
||||
/** End Point usage status */
|
||||
uint8_t inuse:1;
|
||||
/** Reserved */
|
||||
uint8_t rfa0:1;
|
||||
/** Media-type of the End Point */
|
||||
uint8_t media_type:4;
|
||||
/** TSEP of the End Point */
|
||||
uint8_t tsep:1;
|
||||
/** Reserved */
|
||||
uint8_t rfa1:3;
|
||||
} __packed;
|
||||
|
||||
/** @brief AVDTP Local SEP*/
|
||||
struct bt_avdtp_seid_lsep {
|
||||
/** Stream End Point information */
|
||||
struct bt_avdtp_seid_info sep;
|
||||
/** Pointer to next local Stream End Point structure */
|
||||
struct bt_avdtp_seid_lsep *next;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __BT_AVDTP_H */
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#include <zephyr.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <errno.h>
|
||||
#include <atomic.h>
|
||||
#include <misc/byteorder.h>
|
||||
|
@ -26,6 +27,7 @@
|
|||
#include <bluetooth/hci.h>
|
||||
#include <bluetooth/bluetooth.h>
|
||||
#include <bluetooth/l2cap.h>
|
||||
#include <bluetooth/avdtp.h>
|
||||
|
||||
#include "l2cap_internal.h"
|
||||
#include "avdtp_internal.h"
|
||||
|
@ -48,6 +50,8 @@ static struct bt_avdtp bt_avdtp_pool[CONFIG_BLUETOOTH_AVDTP_CONN];
|
|||
|
||||
static struct bt_avdtp_event_cb *event_cb;
|
||||
|
||||
static struct bt_avdtp_seid_lsep *lseps;
|
||||
|
||||
#define AVDTP_CHAN(_ch) CONTAINER_OF(_ch, struct bt_avdtp, br_chan.chan)
|
||||
|
||||
/* L2CAP Interface callbacks */
|
||||
|
@ -154,6 +158,32 @@ int bt_avdtp_register(struct bt_avdtp_event_cb *cb)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_avdtp_register_sep(uint8_t media_type, uint8_t role,
|
||||
struct bt_avdtp_seid_lsep *lsep)
|
||||
{
|
||||
BT_DBG("");
|
||||
|
||||
static uint8_t bt_avdtp_seid = BT_AVDTP_MIN_SEID;
|
||||
|
||||
if (!lsep) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (bt_avdtp_seid == BT_AVDTP_MAX_SEID) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
lsep->sep.id = bt_avdtp_seid++;
|
||||
lsep->sep.inuse = 0;
|
||||
lsep->sep.media_type = media_type;
|
||||
lsep->sep.tsep = role;
|
||||
|
||||
lsep->next = lseps;
|
||||
lseps = lsep;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* init function */
|
||||
int bt_avdtp_init(void)
|
||||
{
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <bluetooth/avdtp.h>
|
||||
|
||||
/* @brief A2DP ROLE's */
|
||||
#define A2DP_SRC_ROLE 0x00
|
||||
#define A2DP_SNK_ROLE 0x01
|
||||
|
@ -97,6 +99,9 @@
|
|||
#define BT_AVDTP_MIN_MTU 48
|
||||
#define BT_AVDTP_MAX_MTU CONFIG_BLUETOOTH_L2CAP_IN_MTU
|
||||
|
||||
#define BT_AVDTP_MIN_SEID 0x01
|
||||
#define BT_AVDTP_MAX_SEID 0x3E
|
||||
|
||||
/* Helper to calculate needed outgoing buffer size. */
|
||||
#define BT_AVDTP_BUF_SIZE(mtu) (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
|
||||
sizeof(struct bt_hci_acl_hdr) + \
|
||||
|
@ -156,3 +161,7 @@ int bt_avdtp_connect(struct bt_conn *conn, struct bt_avdtp *session);
|
|||
|
||||
/* AVDTP disconnect */
|
||||
int bt_avdtp_disconnect(struct bt_avdtp *session);
|
||||
|
||||
/* AVDTP SEP register function */
|
||||
int bt_avdtp_register_sep(uint8_t media_type, uint8_t role,
|
||||
struct bt_avdtp_seid_lsep *sep);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue