2014-02-13 23:20:07 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* 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 {
|
2014-02-20 20:30:56 +08:00
|
|
|
struct avctp *conn;
|
2014-02-13 23:20:07 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
void avrcp_shutdown(struct avrcp *session)
|
|
|
|
{
|
2014-02-20 20:30:56 +08:00
|
|
|
if (session->conn)
|
|
|
|
avctp_shutdown(session->conn);
|
2014-02-13 23:20:07 +08:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2014-02-20 20:30:56 +08:00
|
|
|
session->conn = avctp_new(fd, imtu, omtu, version);
|
|
|
|
if (!session->conn) {
|
2014-02-13 23:20:07 +08:00
|
|
|
g_free(session);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return session;
|
|
|
|
}
|
|
|
|
|
|
|
|
void avrcp_set_destroy_cb(struct avrcp *session, avrcp_destroy_cb_t cb,
|
|
|
|
void *user_data)
|
|
|
|
{
|
2014-02-20 20:30:56 +08:00
|
|
|
avctp_set_destroy_cb(session->conn, cb, user_data);
|
2014-02-13 23:20:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int avrcp_init_uinput(struct avrcp *session, const char *name,
|
|
|
|
const char *address)
|
|
|
|
{
|
2014-02-20 20:30:56 +08:00
|
|
|
return avctp_init_uinput(session->conn, name, address);
|
2014-02-13 23:20:07 +08:00
|
|
|
}
|