2007-04-11 05:37:24 +08:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* BlueZ - Bluetooth protocol stack for Linux
|
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2007 Marcel Holtmann <marcel@holtmann.org>
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define IPC_TYPE_CONNECT 0x0001
|
|
|
|
|
2007-06-12 07:26:24 +08:00
|
|
|
#define IPC_SOCKET_NAME "\0/org/bluez/audio"
|
2007-05-27 05:12:20 +08:00
|
|
|
|
|
|
|
#ifndef UNIX_PATH_MAX
|
|
|
|
#define UNIX_PATH_MAX 108
|
|
|
|
#endif
|
2007-05-27 01:17:34 +08:00
|
|
|
|
2007-06-05 06:03:21 +08:00
|
|
|
/* Supported roles */
|
|
|
|
#define PKT_ROLE_NONE 0
|
|
|
|
#define PKT_ROLE_AUTO 1
|
|
|
|
#define PKT_ROLE_VOICE 2
|
|
|
|
#define PKT_ROLE_HIFI 3
|
|
|
|
|
|
|
|
/* Packet types */
|
|
|
|
#define PKT_TYPE_CFG_REQ 0
|
|
|
|
#define PKT_TYPE_CFG_RSP 1
|
2007-06-06 06:44:36 +08:00
|
|
|
#define PKT_TYPE_STATUS_REQ 2
|
|
|
|
#define PKT_TYPE_STATUS_RSP 3
|
|
|
|
#define PKT_TYPE_CTL_REQ 4
|
|
|
|
#define PKT_TYPE_CTL_RSP 5
|
2007-06-15 04:36:26 +08:00
|
|
|
#define PKT_TYPE_CTL_NTFY 6
|
2007-06-05 06:03:21 +08:00
|
|
|
|
|
|
|
/* Errors codes */
|
|
|
|
#define PKT_ERROR_NONE 0
|
|
|
|
|
|
|
|
struct ipc_packet {
|
|
|
|
uint8_t id; /* Device id */
|
|
|
|
uint8_t role; /* Audio role eg: voice, wifi, auto... */
|
|
|
|
uint8_t type; /* Packet type */
|
|
|
|
uint8_t error; /* Packet error code */
|
|
|
|
uint8_t length; /* Payload length in bytes */
|
|
|
|
uint8_t data[0]; /* Packet payload */
|
2007-04-11 05:37:24 +08:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2007-06-05 06:03:21 +08:00
|
|
|
/* File descriptor options */
|
|
|
|
#define CFG_FD_OPT_READ 0
|
|
|
|
#define CFG_FD_OPT_WRITE 1
|
|
|
|
#define CFG_FD_OPT_READWRITE 2
|
|
|
|
|
|
|
|
struct ipc_data_cfg {
|
|
|
|
int fd; /* Stream file descriptor */
|
|
|
|
uint8_t fd_opt; /* Stream file descriptor options: read, write or readwrite*/
|
|
|
|
uint8_t encoding; /* Stream encoding */
|
|
|
|
uint8_t bitpool; /* Encoding bitpool */
|
|
|
|
uint8_t channels; /* Number of audio channel */
|
2007-06-06 06:44:36 +08:00
|
|
|
uint8_t pkt_len; /* Stream packet length */
|
|
|
|
uint8_t sample_size; /* Sample size in bytes */
|
2007-06-05 06:03:21 +08:00
|
|
|
uint16_t rate; /* Stream sample rate */
|
2007-04-11 05:37:24 +08:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2007-06-05 06:03:21 +08:00
|
|
|
/* Device status */
|
|
|
|
#define STATUS_DISCONNECTED 0
|
|
|
|
#define STATUS_CONNECTING 1
|
|
|
|
#define STATUS_CONNECTED 2
|
|
|
|
#define STATUS_STREAMING 3
|
|
|
|
|
|
|
|
struct ipc_data_status {
|
|
|
|
uint8_t status; /* Stream status */
|
2007-04-11 05:37:24 +08:00
|
|
|
} __attribute__ ((packed));
|
2007-06-05 06:03:21 +08:00
|
|
|
|
2007-06-15 04:36:26 +08:00
|
|
|
#define CTL_MODE_PLAYBACK 0
|
|
|
|
#define CTL_MODE_CAPTURE 1
|
|
|
|
#define CTL_MODE_GENERAL 2
|
|
|
|
|
2007-06-05 06:03:21 +08:00
|
|
|
/* Supported control operations */
|
2007-06-15 04:36:26 +08:00
|
|
|
#define CTL_KEY_POWER 0x40
|
|
|
|
#define CTL_KEY_VOL_UP 0x41
|
|
|
|
#define CTL_KEY_VOL_DOWN 0x42
|
|
|
|
#define CTL_KEY_MUTE 0x43
|
|
|
|
#define CTL_KEY_PLAY 0x44
|
|
|
|
#define CTL_KEY_STOP 0x45
|
|
|
|
#define CTL_KEY_PAUSE 0x46
|
|
|
|
#define CTL_KEY_RECORD 0x47
|
|
|
|
#define CTL_KEY_REWIND 0x48
|
|
|
|
#define CTL_KEY_FAST_FORWARD 0x49
|
|
|
|
#define CTL_KEY_EJECT 0x4A
|
|
|
|
#define CTL_KEY_FORWARD 0x4B
|
|
|
|
#define CTL_KEY_BACKWARD 0x4C
|
2007-06-05 06:03:21 +08:00
|
|
|
|
|
|
|
struct ipc_data_ctl {
|
2007-06-15 04:36:26 +08:00
|
|
|
uint8_t mode; /* Control Mode */
|
|
|
|
uint8_t key; /* Control Key */
|
2007-06-05 06:03:21 +08:00
|
|
|
} __attribute__ ((packed));
|