mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-26 21:54:33 +08:00
4351d46804
The patch makes AVRCP to be transport agnostic so that it can be used in with socket pair to build unit tests. The idea is that all AVRCP specific logic will stay on avrcp-lib until it receives proper unit tests and then eventually will be used by audio plugin as well.
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
/*
|
|
*
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
*
|
|
* Copyright (C) 2014 Intel Corporation. All rights reserved.
|
|
*
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
* License as published by the Free Software Foundation; either
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Lesser General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
*
|
|
*/
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
#include <config.h>
|
|
#endif
|
|
|
|
#include <stdbool.h>
|
|
#include <glib.h>
|
|
|
|
#include "lib/bluetooth.h"
|
|
|
|
#include "src/log.h"
|
|
|
|
#include "avctp.h"
|
|
#include "avrcp-lib.h"
|
|
|
|
struct avrcp {
|
|
struct avctp *session;
|
|
};
|
|
|
|
void avrcp_shutdown(struct avrcp *session)
|
|
{
|
|
if (session->session)
|
|
avctp_shutdown(session->session);
|
|
|
|
g_free(session);
|
|
}
|
|
|
|
struct avrcp *avrcp_new(int fd, size_t imtu, size_t omtu, uint16_t version)
|
|
{
|
|
struct avrcp *session;
|
|
|
|
session = g_new0(struct avrcp, 1);
|
|
|
|
session->session = avctp_new(fd, imtu, omtu, version);
|
|
if (!session->session) {
|
|
g_free(session);
|
|
return NULL;
|
|
}
|
|
|
|
return session;
|
|
}
|
|
|
|
void avrcp_set_destroy_cb(struct avrcp *session, avrcp_destroy_cb_t cb,
|
|
void *user_data)
|
|
{
|
|
avctp_set_destroy_cb(session->session, cb, user_data);
|
|
}
|
|
|
|
int avrcp_init_uinput(struct avrcp *session, const char *name,
|
|
const char *address)
|
|
{
|
|
return avctp_init_uinput(session->session, name, address);
|
|
}
|