From fed8f328c62d5f8d3566f040de9c53c6ac9ba2e7 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Mon, 12 May 2014 11:57:00 +0300 Subject: [PATCH] android: Add SCO IPC API SCO API will be used when communicating with SCO HAL. --- android/Makefile.am | 1 + android/sco-ipc-api.txt | 37 +++++++++++++++++++++++++++++++++++++ android/sco-msg.h | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 android/sco-ipc-api.txt create mode 100644 android/sco-msg.h diff --git a/android/Makefile.am b/android/Makefile.am index fb3dcbbbf..a34b2889d 100644 --- a/android/Makefile.am +++ b/android/Makefile.am @@ -18,6 +18,7 @@ android_bluetoothd_SOURCES = android/main.c \ src/log.c \ android/hal-msg.h \ android/audio-msg.h \ + android/sco-msg.h \ android/utils.h \ src/sdpd-database.c src/sdpd-server.c \ src/sdpd-service.c src/sdpd-request.c \ diff --git a/android/sco-ipc-api.txt b/android/sco-ipc-api.txt new file mode 100644 index 000000000..05848d2e0 --- /dev/null +++ b/android/sco-ipc-api.txt @@ -0,0 +1,37 @@ +Bluetooth SCO Audio Plugin +========================== + +The SCO Audio Plugin communicate through abstract socket name +"\0bluez_sco_socket". + + .----SCO----. .--Android--. + | Plugin | | Daemon | + | | Command | | + | | --------------------------> | | + | | | | + | | <-------------------------- | | + | | Response | | + | | | | + | | | | + | | | | + '-----------' '-----------' + + + SCO HAL Daemon + ---------------------------------------------------- + + call connect_sco() --> create SCO socket + return connect_sco() <-- return socket fd and mtu + +SCO Audio Service (ID 0) +======================== + + Opcode 0x00 - Error response + + Response parameters: Status (1 octet) + + Opcode 0x01 - Connect SCO command + + Command parameters: + Response parameters: MTU (2 octets) + File descriptor (inline) diff --git a/android/sco-msg.h b/android/sco-msg.h new file mode 100644 index 000000000..df0d85884 --- /dev/null +++ b/android/sco-msg.h @@ -0,0 +1,36 @@ +/* + * + * 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 + * + */ + +static const char BLUEZ_SCO_SK_PATH[] = "\0bluez_sco_socket"; + +#define SCO_SERVICE_ID 0 + +#define SCO_STATUS_SUCCESS IPC_STATUS_SUCCESS +#define SCO_STATUS_FAILED 0x01 + +#define SCO_OP_STATUS IPC_OP_STATUS + +#define SCO_OP_CONNECT 0x01 +struct sco_rsp_connect { + uint16_t mtu; +} __attribute__((packed)); -- 2.47.3