Skip to content

Commit

Permalink
zephyr: fix compiling issues.
Browse files Browse the repository at this point in the history
bug: v/45540

Signed-off-by: Zihao Gao <[email protected]>
  • Loading branch information
gzh-terry authored and hyson710 committed Jan 5, 2025
1 parent 5b610ed commit 6bf0867
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 12 deletions.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,6 @@ if(CONFIG_BLUETOOTH)

list(APPEND INCDIR ${BLUETOOTH_DIR}/service/vendor)

list(APPEND INCDIR ${BLUETOOTH_DIR}/service/stacks/include)

if(CONFIG_BLUETOOTH_SERVICE)
if(CONFIG_BLUETOOTH_STACK_BREDR_BLUELET
OR CONFIG_BLUETOOTH_STACK_LE_BLUELET)
Expand Down
1 change: 0 additions & 1 deletion Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ if BLUETOOTH_A2DP
config BLUETOOTH_A2DP_AAC_CODEC
bool "Bluetooth A2dp AAC codec support"
default n
select AAC_ENABLED

config BLUETOOTH_A2DP_MAX_CONNECTIONS
int "Maximum A2dp connections"
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,6 @@ CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/bluetooth/service/pr
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/bluetooth/service/stacks
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/bluetooth/service/stacks/include
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/bluetooth/service/vendor
CFLAGS += ${INCDIR_PREFIX}$(APPDIR)/frameworks/connectivity/bluetooth/service/stacks/include

ifeq ($(CONFIG_BLUETOOTH_SERVICE), y)
ifneq ($(CONFIG_BLUETOOTH_STACK_BREDR_BLUELET)$(CONFIG_BLUETOOTH_STACK_LE_BLUELET),)
Expand Down
2 changes: 2 additions & 0 deletions framework/include/bt_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
extern "C" {
#endif

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif

#define CASE_RETURN_STR(const) \
case const: \
Expand Down
2 changes: 2 additions & 0 deletions service/profiles/a2dp/sink/a2dp_sink_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <kvdb.h>
#endif

#include "a2dp_audio.h"
#include "a2dp_device.h"
#include "a2dp_sink_service.h"
#include "adapter_internel.h"
#include "bt_addr.h"
Expand Down
1 change: 1 addition & 0 deletions service/profiles/a2dp/source/a2dp_source_audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include <nuttx/circbuf.h>

#include "sal_a2dp_source_interface.h"
#include "sal_interface.h"

#include "a2dp_codec.h"
#include "a2dp_control.h"
Expand Down
2 changes: 2 additions & 0 deletions service/profiles/a2dp/source/a2dp_source_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
#include <kvdb.h>
#endif

#include "a2dp_audio.h"
#include "a2dp_device.h"
#include "a2dp_source_service.h"
#include "adapter_internel.h"
#include "bt_a2dp_source.h"
Expand Down
1 change: 1 addition & 0 deletions service/profiles/avrcp/control/avrcp_control_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <unistd.h>

#include "adapter_internel.h"
#include "avrcp_msg.h"
#include "avrcp_control_service.h"
#include "bt_addr.h"
#include "bt_list.h"
Expand Down
1 change: 1 addition & 0 deletions service/profiles/avrcp/target/avrcp_target_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <unistd.h>

#include "adapter_internel.h"
#include "avrcp_msg.h"
#include "avrcp_target_service.h"
#include "bt_addr.h"
#include "bt_list.h"
Expand Down
3 changes: 3 additions & 0 deletions service/profiles/system/bt_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ bt_status_t bt_media_player_set_status(bt_media_player_t* player, bt_media_statu
{
int event;

if (!player)
return BT_STATUS_PARM_INVALID;

if (player->play_status == status)
return BT_STATUS_SUCCESS;

Expand Down
3 changes: 2 additions & 1 deletion service/src/adapter_service.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
#include "bt_device.h"
#include "bt_list.h"
#include "bt_profile.h"
#include "bt_utils.h"
#include "bt_uuid.h"
#include "btservice.h"
#include "callbacks_list.h"
Expand All @@ -54,6 +53,8 @@
#include "state_machine.h"
#include "storage.h"
#define LOG_TAG "adapter-svc"

#include "bt_utils.h"
#include "utils/log.h"

#define CALLBACK_FOREACH(_list, _struct, _cback, ...) BT_CALLBACK_FOREACH(_list, _struct, _cback, ##__VA_ARGS__)
Expand Down
4 changes: 3 additions & 1 deletion service/stacks/include/sal_a2dp_sink_interface.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/****************************************************************************
* Copyright (C) 2024 Xiaomi Corporation
*
Expand All @@ -17,6 +16,8 @@
#ifndef __SAL_A2DP_SINK_INTERFACE_H__
#define __SAL_A2DP_SINK_INTERFACE_H__

#ifdef CONFIG_BLUETOOTH_A2DP

#include "a2dp_event.h"
#include "bt_device.h"

Expand All @@ -28,4 +29,5 @@ bt_status_t bt_sal_a2dp_sink_start_stream(bt_controller_id_t id, bt_address_t* a

void bt_sal_a2dp_sink_event_callback(a2dp_event_t* event);

#endif /* CONFIG_BLUETOOTH_A2DP */
#endif /* __SAL_A2DP_SINK_INTERFACE_H__ */
4 changes: 3 additions & 1 deletion service/stacks/include/sal_a2dp_source_interface.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/****************************************************************************
* Copyright (C) 2024 Xiaomi Corporation
*
Expand All @@ -17,6 +16,8 @@
#ifndef __SAL_A2DP_SOURCE_INTERFACE_H__
#define __SAL_A2DP_SOURCE_INTERFACE_H__

#ifdef CONFIG_BLUETOOTH_A2DP

#include "a2dp_event.h"
#include "bt_device.h"

Expand All @@ -31,4 +32,5 @@ bt_status_t bt_sal_a2dp_source_send_data(bt_controller_id_t id, bt_address_t* re

void bt_sal_a2dp_source_event_callback(a2dp_event_t* event);

#endif /* CONFIG_BLUETOOTH_A2DP */
#endif /* __SAL_A2DP_SOURCE_INTERFACE_H__ */
6 changes: 6 additions & 0 deletions service/stacks/include/sal_avrcp_control_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#ifndef __SAL_AVRCP_CONTROL_INTERFACE_H__
#define __SAL_AVRCP_CONTROL_INTERFACE_H__

#if defined(CONFIG_BLUETOOTH_AVRCP_CONTROL) || defined(CONFIG_BLUETOOTH_AVRCP_TARGET)

#include "avrcp_msg.h"
#include "bt_avrcp.h"
#include "bt_device.h"

Expand All @@ -35,4 +38,7 @@ bt_status_t bt_sal_avrcp_control_register_notification(bt_controller_id_t id,
bt_status_t bt_sal_avrcp_control_get_element_attributes(bt_controller_id_t id,
bt_address_t* bd_addr, uint8_t attrs_count, avrcp_media_attr_type_t* types);

void bt_sal_avrcp_control_event_callback(avrcp_msg_t* msg);

#endif /* CONFIG_BLUETOOTH_AVRCP_CONTROL || CONFIG_BLUETOOTH_AVRCP_TARGET */
#endif /* __SAL_AVRCP_CONTROL_INTERFACE_H__ */
6 changes: 6 additions & 0 deletions service/stacks/include/sal_avrcp_target_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
#ifndef __SAL_AVRCP_TARGET_INTERFACE_H__
#define __SAL_AVRCP_TARGET_INTERFACE_H__

#if defined(CONFIG_BLUETOOTH_AVRCP_CONTROL) || defined(CONFIG_BLUETOOTH_AVRCP_TARGET)

#include "avrcp_msg.h"
#include "bt_avrcp.h"
#include "bt_device.h"

Expand All @@ -33,4 +36,7 @@ bt_status_t bt_sal_avrcp_target_notify_play_position_changed(bt_controller_id_t
bt_address_t* addr, uint32_t position);
bt_status_t bt_sal_avrcp_target_register_volume_changed(bt_controller_id_t id, bt_address_t* addr);

void bt_sal_avrcp_target_event_callback(avrcp_msg_t* msg);

#endif /* CONFIG_BLUETOOTH_AVRCP_CONTROL || CONFIG_BLUETOOTH_AVRCP_TARGET */
#endif /* __SAL_AVRCP_TARGET_INTERFACE_H__ */
3 changes: 3 additions & 0 deletions service/stacks/include/sal_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include "sal_adapter_interface.h"
#include "sal_bluelet.h"
#endif
#if defined(CONFIG_BLUETOOTH_STACK_BREDR_ZBLUE) || defined(CONFIG_BLUETOOTH_STACK_LE_ZBLUE)
#include "sal_zblue.h"
#endif

typedef struct bt_stack_info {
char name[32];
Expand Down
1 change: 0 additions & 1 deletion service/stacks/zephyr/include/sal_zblue.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/****************************************************************************
* Copyright (C) 2024 Xiaomi Corporation
*
Expand Down
3 changes: 2 additions & 1 deletion service/stacks/zephyr/sal_a2dp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ static void zblue_on_seted_codec(struct bt_conn* conn, struct bt_a2dp_media_code
#endif /* CONFIG_BLUETOOTH_A2DP_SINK */
}
}
#endif /* CONFIG_BLUETOOTH_A2DP */

#ifdef CONFIG_BLUETOOTH_A2DP_SOURCE
static const uint8_t a2dp_sbc_src_codec[] = {
Expand Down Expand Up @@ -583,3 +582,5 @@ bt_status_t bt_sal_a2dp_sink_start_stream(bt_controller_id_t id, bt_address_t* a
return BT_STATUS_NOT_SUPPORTED;
#endif /* CONFIG_BLUETOOTH_A2DP_SINK */
}

#endif /* CONFIG_BLUETOOTH_A2DP */
7 changes: 4 additions & 3 deletions service/stacks/zephyr/sal_avrcp_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <stdint.h>
#include <stdlib.h>

#include "avrcp_msg.h"
#include "bluetooth.h"
#include "bt_addr.h"
#include "sal_a2dp_sink_interface.h"
Expand All @@ -37,6 +36,7 @@
#include "utils/log.h"

#if defined(CONFIG_BLUETOOTH_AVRCP_CONTROL) || defined(CONFIG_BLUETOOTH_AVRCP_TARGET)

static void zblue_on_connected(struct bt_conn* conn);
static void zblue_on_disconnected(struct bt_conn* conn);
static void zblue_on_notify(struct bt_conn* conn, uint8_t event_id, uint8_t status);
Expand Down Expand Up @@ -204,7 +204,7 @@ static void zblue_on_notify(struct bt_conn* conn, uint8_t event_id, uint8_t stat
#ifdef CONFIG_BLUETOOTH_AVRCP_CONTROL
/* Note: This callback can be triggered when a set absolute volume command is received */
msg = avrcp_msg_new(AVRC_SET_ABSOLUTE_VOLUME, &bd_addr);
msg->data.absvol.volume = volume;
msg->data.absvol.volume = status;
bt_sal_avrcp_control_event_callback(msg);
#endif /* CONFIG_BLUETOOTH_AVRCP_CONTROL */
}
Expand Down Expand Up @@ -336,7 +336,6 @@ static void zblue_on_playback_pos(struct bt_conn* conn, uint32_t pos)
bt_sal_avrcp_control_event_callback(msg);
#endif /* CONFIG_BLUETOOTH_AVRCP_CONTROL */
}
#endif

bt_status_t bt_sal_avrcp_control_init(void)
{
Expand Down Expand Up @@ -549,3 +548,5 @@ bt_status_t bt_sal_avrcp_control_get_element_attributes(bt_controller_id_t id,
return BT_STATUS_NOT_SUPPORTED;
#endif
}

#endif /* CONFIG_BLUETOOTH_AVRCP_CONTROL || CONFIG_BLUETOOTH_AVRCP_TARGET */

0 comments on commit 6bf0867

Please sign in to comment.