mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
Update module-bluetooth-device to the new ipc.
This commit is contained in:
parent
5db081a898
commit
7323e1a0a8
3 changed files with 217 additions and 172 deletions
|
|
@ -22,22 +22,26 @@
|
|||
|
||||
#include "ipc.h"
|
||||
|
||||
/* This table contains the string representation for messages */
|
||||
static const char *strmsg[] = {
|
||||
"BT_GETCAPABILITIES_REQ",
|
||||
"BT_GETCAPABILITIES_RSP",
|
||||
"BT_SETCONFIGURATION_REQ",
|
||||
"BT_SETCONFIGURATION_RSP",
|
||||
"BT_STREAMSTART_REQ",
|
||||
"BT_STREAMSTART_RSP",
|
||||
"BT_STREAMSTOP_REQ",
|
||||
"BT_STREAMSTOP_RSP",
|
||||
"BT_STREAMSUSPEND_IND",
|
||||
"BT_STREAMRESUME_IND",
|
||||
"BT_CONTROL_REQ",
|
||||
"BT_CONTROL_RSP",
|
||||
"BT_CONTROL_IND",
|
||||
"BT_STREAMFD_IND",
|
||||
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
|
||||
|
||||
/* This table contains the string representation for messages types */
|
||||
static const char *strtypes[] = {
|
||||
"BT_REQUEST",
|
||||
"BT_RESPONSE",
|
||||
"BT_INDICATION",
|
||||
"BT_ERROR",
|
||||
};
|
||||
|
||||
/* This table contains the string representation for messages names */
|
||||
static const char *strnames[] = {
|
||||
"BT_GET_CAPABILITIES",
|
||||
"BT_SET_CONFIGURATION",
|
||||
"BT_NEW_STREAM",
|
||||
"BT_START_STREAM",
|
||||
"BT_STOP_STREAM",
|
||||
"BT_SUSPEND_STREAM",
|
||||
"BT_RESUME_STREAM",
|
||||
"BT_CONTROL",
|
||||
};
|
||||
|
||||
int bt_audio_service_open(void)
|
||||
|
|
@ -88,7 +92,7 @@ int bt_audio_service_get_data_fd(int sk)
|
|||
msgh.msg_control = &cmsg_b;
|
||||
msgh.msg_controllen = CMSG_LEN(sizeof(int));
|
||||
|
||||
ret = (int) recvmsg(sk, &msgh, 0);
|
||||
ret = recvmsg(sk, &msgh, 0);
|
||||
if (ret < 0) {
|
||||
err = errno;
|
||||
fprintf(stderr, "%s: Unable to receive fd: %s (%d)\n",
|
||||
|
|
@ -109,10 +113,18 @@ int bt_audio_service_get_data_fd(int sk)
|
|||
return -1;
|
||||
}
|
||||
|
||||
const char *bt_audio_strmsg(int type)
|
||||
const char *bt_audio_strtype(uint8_t type)
|
||||
{
|
||||
if (type < 0 || (size_t) type > (sizeof(strmsg) / sizeof(strmsg[0])))
|
||||
if (type >= ARRAY_SIZE(strtypes))
|
||||
return NULL;
|
||||
|
||||
return strmsg[type];
|
||||
return strtypes[type];
|
||||
}
|
||||
|
||||
const char *bt_audio_strname(uint8_t name)
|
||||
{
|
||||
if (name >= ARRAY_SIZE(strnames))
|
||||
return NULL;
|
||||
|
||||
return strnames[name];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue