Convert BTIF code from C to C++
Modifications required:
* added proper casting
* moved variable definitions before goto statements
* added 'extern "C"' markers where needed
* renamed 'operator' to 'operator_name'
Bug: 28485365
Change-Id: I903357967387207e678866c02e008f047f8263f6
diff --git a/bta/ag/bta_ag_api.c b/bta/ag/bta_ag_api.c
index f3415be..117924c 100644
--- a/bta/ag/bta_ag_api.c
+++ b/bta/ag/bta_ag_api.c
@@ -108,7 +108,7 @@
**
*******************************************************************************/
void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,tBTA_AG_FEAT features,
- char * p_service_names[], UINT8 app_id)
+ const char * p_service_names[], UINT8 app_id)
{
tBTA_AG_API_REGISTER *p_buf =
(tBTA_AG_API_REGISTER *)osi_malloc(sizeof(tBTA_AG_API_REGISTER));
diff --git a/bta/hf_client/bta_hf_client_act.c b/bta/hf_client/bta_hf_client_act.c
index d41f298..fe6a283 100644
--- a/bta/hf_client/bta_hf_client_act.c
+++ b/bta/hf_client/bta_hf_client_act.c
@@ -613,8 +613,8 @@
memset(&evt, 0, sizeof(evt));
- strlcpy(evt.operator.name, name, BTA_HF_CLIENT_OPERATOR_NAME_LEN + 1);
- evt.operator.name[BTA_HF_CLIENT_OPERATOR_NAME_LEN] = '\0';
+ strlcpy(evt.operator_name.name, name, BTA_HF_CLIENT_OPERATOR_NAME_LEN + 1);
+ evt.operator_name.name[BTA_HF_CLIENT_OPERATOR_NAME_LEN] = '\0';
(*bta_hf_client_cb.p_cback)(BTA_HF_CLIENT_OPERATOR_NAME_EVT, &evt);
}
diff --git a/bta/hf_client/bta_hf_client_api.c b/bta/hf_client/bta_hf_client_api.c
index 3fc8b4b..83d648c 100644
--- a/bta/hf_client/bta_hf_client_api.c
+++ b/bta/hf_client/bta_hf_client_api.c
@@ -107,7 +107,7 @@
**
*******************************************************************************/
void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
- char *p_service_name)
+ const char *p_service_name)
{
tBTA_HF_CLIENT_API_REGISTER *p_buf =
(tBTA_HF_CLIENT_API_REGISTER *)osi_malloc(sizeof(tBTA_HF_CLIENT_API_REGISTER));
diff --git a/bta/include/bta_ag_api.h b/bta/include/bta_ag_api.h
index ff85c9b..e457e38 100644
--- a/bta/include/bta_ag_api.h
+++ b/bta/include/bta_ag_api.h
@@ -425,7 +425,7 @@
**
*******************************************************************************/
void BTA_AgRegister(tBTA_SERVICE_MASK services, tBTA_SEC sec_mask,
- tBTA_AG_FEAT features, char *p_service_names[], UINT8 app_id);
+ tBTA_AG_FEAT features, const char *p_service_names[], UINT8 app_id);
/*******************************************************************************
**
diff --git a/bta/include/bta_ag_co.h b/bta/include/bta_ag_co.h
index 2f52581..6f661e0 100644
--- a/bta/include/bta_ag_co.h
+++ b/bta/include/bta_ag_co.h
@@ -27,6 +27,10 @@
#include "bta_ag_api.h"
#include "hci/include/hci_audio.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
**
** Function bta_ag_co_init
@@ -109,4 +113,8 @@
*******************************************************************************/
extern void bta_ag_co_tx_write(UINT16 handle, UINT8 *p_data, UINT16 len);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_AG_CO_H */
diff --git a/bta/include/bta_av_co.h b/bta/include/bta_av_co.h
index ad8e697..8cd3c8b 100644
--- a/bta/include/bta_av_co.h
+++ b/bta/include/bta_av_co.h
@@ -27,6 +27,10 @@
#include "l2c_api.h"
#include "bta_av_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@@ -388,4 +392,8 @@
*******************************************************************************/
extern void bta_av_co_video_delay(tBTA_AV_HNDL hndl, UINT16 delay);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_AV_CO_H */
diff --git a/bta/include/bta_av_sbc.h b/bta/include/bta_av_sbc.h
index d7cfa89..858f832 100644
--- a/bta/include/bta_av_sbc.h
+++ b/bta/include/bta_av_sbc.h
@@ -25,6 +25,10 @@
#ifndef BTA_AV_SBC_H
#define BTA_AV_SBC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** constants
*****************************************************************************/
@@ -215,5 +219,9 @@
*******************************************************************************/
extern void bta_av_sbc_bld_hdr(BT_HDR *p_buf, UINT16 fr_per_pkt);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_AV_SBC_H */
diff --git a/bta/include/bta_dm_co.h b/bta/include/bta_dm_co.h
index 49343aa..cfb71fc 100644
--- a/bta/include/bta_dm_co.h
+++ b/bta/include/bta_dm_co.h
@@ -26,6 +26,9 @@
#include "bta_sys.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
#ifndef BTA_SCO_OUT_PKT_SIZE
#define BTA_SCO_OUT_PKT_SIZE BTM_SCO_DATA_SIZE_MAX
@@ -269,4 +272,8 @@
tBTA_LE_KEY_TYPE *p_init_key,
tBTA_LE_KEY_TYPE *p_resp_key );
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/bta/include/bta_gatts_co.h b/bta/include/bta_gatts_co.h
index b3ee99b..c2a048f 100644
--- a/bta/include/bta_gatts_co.h
+++ b/bta/include/bta_gatts_co.h
@@ -26,6 +26,10 @@
#include "bta_gatt_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
**
** Function bta_gatts_co_update_handle_range
@@ -77,5 +81,8 @@
extern BOOLEAN bta_gatts_co_load_handle_range(UINT8 index,
tBTA_GATTS_HNDL_RANGE *p_handle);
+#ifdef __cplusplus
+}
+#endif
#endif /* BTA_GATTS_CO_H */
diff --git a/bta/include/bta_hf_client_api.h b/bta/include/bta_hf_client_api.h
index 82235fa..74507e5 100644
--- a/bta/include/bta_hf_client_api.h
+++ b/bta/include/bta_hf_client_api.h
@@ -236,7 +236,7 @@
tBTA_HF_CLIENT_CONN conn;
tBTA_HF_CLIENT_IND ind;
tBTA_HF_CLIENT_VAL val;
- tBTA_HF_CLIENT_OPERATOR_NAME operator;
+ tBTA_HF_CLIENT_OPERATOR_NAME operator_name;
tBTA_HF_CLIENT_NUMBER number;
tBTA_HF_CLIENT_AT_RESULT result;
tBTA_HF_CLIENT_CLCC clcc;
@@ -295,7 +295,7 @@
**
*******************************************************************************/
void BTA_HfClientRegister(tBTA_SEC sec_mask, tBTA_HF_CLIENT_FEAT features,
- char *p_service_name);
+ const char *p_service_name);
/*******************************************************************************
**
diff --git a/bta/include/bta_hh_co.h b/bta/include/bta_hh_co.h
index 940b3cc..e963412 100755
--- a/bta/include/bta_hh_co.h
+++ b/bta/include/bta_hh_co.h
@@ -26,6 +26,10 @@
#include "bta_hh_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct
{
UINT16 rpt_uuid;
@@ -130,4 +134,9 @@
extern void bta_hh_le_co_reset_rpt_cache (BD_ADDR remote_bda, UINT8 app_id);
#endif /* #if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE) */
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_HH_CO_H */
diff --git a/bta/include/bta_hl_ci.h b/bta/include/bta_hl_ci.h
index c808938..7092fbc 100644
--- a/bta/include/bta_hl_ci.h
+++ b/bta/include/bta_hl_ci.h
@@ -28,6 +28,9 @@
#include "bta_api.h"
#include "bta_hl_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*****************************************************************************
** Constants and Data Types
@@ -120,4 +123,9 @@
extern void bta_hl_ci_put_echo_data( tBTA_HL_MCL_HANDLE mcl_handle,
tBTA_HL_STATUS status,
UINT16 evt );
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_HL_CI_H */
diff --git a/bta/include/bta_hl_co.h b/bta/include/bta_hl_co.h
index 05b37c7..cf27c80 100644
--- a/bta/include/bta_hl_co.h
+++ b/bta/include/bta_hl_co.h
@@ -28,6 +28,10 @@
#include "bta_api.h"
#include "bta_hl_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Constants and Data Types
*****************************************************************************/
@@ -231,4 +235,8 @@
extern void bta_hl_co_put_echo_data (UINT8 app_id, tBTA_HL_MCL_HANDLE mcl_handle,
UINT16 data_size, UINT8 *p_data, UINT16 evt);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_HL_CO_H */
diff --git a/bta/include/bta_jv_api.h b/bta/include/bta_jv_api.h
index f4999c5..45245a2 100644
--- a/bta/include/bta_jv_api.h
+++ b/bta/include/bta_jv_api.h
@@ -30,6 +30,10 @@
#include "btm_api.h"
#include "l2c_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Constants and data types
*****************************************************************************/
@@ -822,4 +826,8 @@
*******************************************************************************/
UINT16 BTA_JvRfcommGetPortHdl(UINT32 handle);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_JV_API_H */
diff --git a/bta/include/bta_jv_co.h b/bta/include/bta_jv_co.h
index 1984248..226d4f7 100644
--- a/bta/include/bta_jv_co.h
+++ b/bta/include/bta_jv_co.h
@@ -26,6 +26,10 @@
#include "bta_jv_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Function Declarations
*****************************************************************************/
@@ -50,4 +54,8 @@
extern int bta_co_l2cap_data_outgoing_size(void *user_data, int *size);
extern int bta_co_l2cap_data_outgoing(void *user_data, UINT8* buf, UINT16 size);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_DG_CO_H */
diff --git a/bta/include/bta_pan_api.h b/bta/include/bta_pan_api.h
index a6fd9aa..f6b1cd4 100644
--- a/bta/include/bta_pan_api.h
+++ b/bta/include/bta_pan_api.h
@@ -59,7 +59,7 @@
/* information regarding PAN roles */
typedef struct
{
- char *p_srv_name; /* service name for the PAN role */
+ const char *p_srv_name; /* service name for the PAN role */
UINT8 app_id; /* application id */
tBTA_SEC sec_mask; /* security setting for the role */
diff --git a/bta/include/bta_pan_co.h b/bta/include/bta_pan_co.h
index 3920370..e9d7e6c 100644
--- a/bta/include/bta_pan_co.h
+++ b/bta/include/bta_pan_co.h
@@ -26,6 +26,10 @@
#include "bta_pan_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Constants
*****************************************************************************/
@@ -197,4 +201,8 @@
extern void bta_pan_co_mfilt_ind(UINT16 handle, BOOLEAN indication, tBTA_PAN_STATUS result,
UINT16 len, UINT8 *p_filters);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTA_PAN_CO_H */
diff --git a/btcore/include/bdaddr.h b/btcore/include/bdaddr.h
index b9a99ce..a1c282d 100644
--- a/btcore/include/bdaddr.h
+++ b/btcore/include/bdaddr.h
@@ -24,6 +24,10 @@
#include "osi/include/hash_map.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Note: the string representation of a bdaddr is expected to have the format
// xx:xx:xx:xx:xx:xx
// where each 'x' is a hex digit. The API presented in this header will accept
@@ -58,3 +62,7 @@
// A hash function tailored for bdaddrs.
hash_index_t hash_function_bdaddr(const void *key);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/btcore/include/module.h b/btcore/include/module.h
index d88f5f3..e02567b 100644
--- a/btcore/include/module.h
+++ b/btcore/include/module.h
@@ -23,6 +23,10 @@
#include "osi/include/future.h"
#include "osi/include/thread.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef future_t *(*module_lifecycle_fn)(void);
typedef struct {
@@ -65,3 +69,7 @@
thread_t *callback_thread,
thread_fn callback
);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/btcore/include/property.h b/btcore/include/property.h
index 3a41422..1a8e7ea 100644
--- a/btcore/include/property.h
+++ b/btcore/include/property.h
@@ -24,6 +24,10 @@
#include "btcore/include/device_class.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Copies an array of consecutive properties of |count| to a newly
// allocated array. |properties| must not be NULL.
bt_property_t *property_copy_array(const bt_property_t *properties, size_t count);
@@ -75,3 +79,7 @@
int8_t property_as_rssi(const bt_property_t *property);
bt_scan_mode_t property_as_scan_mode(const bt_property_t *property);
const bt_uuid_t *property_as_uuids(const bt_property_t *property, size_t *count);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/btif/Android.mk b/btif/Android.mk
index 44d7c36..ea80659 100644
--- a/btif/Android.mk
+++ b/btif/Android.mk
@@ -23,61 +23,61 @@
# HAL layer
btifCommonSrc := \
- src/bluetooth.c
+ src/bluetooth.cc
# BTIF implementation
btifCommonSrc += \
- src/btif_av.c \
- src/btif_avrcp_audio_track.cpp \
- src/btif_config.c \
- src/btif_config_transcode.cpp \
- src/btif_core.c \
- src/btif_debug.c \
- src/btif_debug_btsnoop.c \
- src/btif_debug_conn.c \
- src/btif_dm.c \
- src/btif_gatt.c \
- src/btif_gatt_client.c \
- src/btif_gatt_multi_adv_util.c \
- src/btif_gatt_server.c \
- src/btif_gatt_test.c \
- src/btif_gatt_util.c \
- src/btif_hf.c \
- src/btif_hf_client.c \
- src/btif_hh.c \
- src/btif_hl.c \
- src/btif_sdp.c \
- src/btif_media_task.c \
- src/btif_pan.c \
- src/btif_profile_queue.c \
- src/btif_rc.c \
- src/btif_sm.c \
- src/btif_sock.c \
- src/btif_sock_rfc.c \
- src/btif_sock_l2cap.c \
- src/btif_sock_sco.c \
- src/btif_sock_sdp.c \
- src/btif_sock_thread.c \
- src/btif_sdp_server.c \
- src/btif_sock_util.c \
- src/btif_storage.c \
- src/btif_uid.c \
- src/btif_util.c \
- src/stack_manager.c
+ src/btif_av.cc \
+ src/btif_avrcp_audio_track.cc \
+ src/btif_config.cc \
+ src/btif_config_transcode.cc \
+ src/btif_core.cc \
+ src/btif_debug.cc \
+ src/btif_debug_btsnoop.cc \
+ src/btif_debug_conn.cc \
+ src/btif_dm.cc \
+ src/btif_gatt.cc \
+ src/btif_gatt_client.cc \
+ src/btif_gatt_multi_adv_util.cc \
+ src/btif_gatt_server.cc \
+ src/btif_gatt_test.cc \
+ src/btif_gatt_util.cc \
+ src/btif_hf.cc \
+ src/btif_hf_client.cc \
+ src/btif_hh.cc \
+ src/btif_hl.cc \
+ src/btif_sdp.cc \
+ src/btif_media_task.cc \
+ src/btif_pan.cc \
+ src/btif_profile_queue.cc \
+ src/btif_rc.cc \
+ src/btif_sm.cc \
+ src/btif_sock.cc \
+ src/btif_sock_rfc.cc \
+ src/btif_sock_l2cap.cc \
+ src/btif_sock_sco.cc \
+ src/btif_sock_sdp.cc \
+ src/btif_sock_thread.cc \
+ src/btif_sdp_server.cc \
+ src/btif_sock_util.cc \
+ src/btif_storage.cc \
+ src/btif_uid.cc \
+ src/btif_util.cc \
+ src/stack_manager.cc
# Callouts
btifCommonSrc += \
- co/bta_ag_co.c \
- co/bta_dm_co.c \
- co/bta_av_co.c \
- co/bta_hh_co.c \
- co/bta_hl_co.c \
- co/bta_pan_co.c \
- co/bta_gatts_co.c
+ co/bta_ag_co.cc \
+ co/bta_dm_co.cc \
+ co/bta_av_co.cc \
+ co/bta_hh_co.cc \
+ co/bta_hl_co.cc \
+ co/bta_pan_co.cc \
+ co/bta_gatts_co.cc
# Tests
btifTestSrc := \
- test/btif_storage_test.cpp
+ test/btif_storage_test.cc
# Includes
btifCommonIncludes := \
@@ -112,6 +112,9 @@
# libbtif static library for target
# ========================================================
include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+
LOCAL_C_INCLUDES := $(btifCommonIncludes)
LOCAL_SRC_FILES := $(btifCommonSrc)
# Many .h files have redefined typedefs
@@ -129,6 +132,9 @@
# btif unit tests for target
# ========================================================
include $(CLEAR_VARS)
+
+LOCAL_CPP_EXTENSION := .cc
+
LOCAL_C_INCLUDES := $(btifCommonIncludes)
LOCAL_SRC_FILES := $(btifTestSrc)
LOCAL_SHARED_LIBRARIES += liblog libhardware libhardware_legacy libcutils
diff --git a/btif/BUILD.gn b/btif/BUILD.gn
index 8a459c8..66ffcea 100644
--- a/btif/BUILD.gn
+++ b/btif/BUILD.gn
@@ -16,57 +16,57 @@
static_library("btif") {
sources = [
- "src/btif_av.c",
+ "src/btif_av.cc",
#TODO(jpawlowski): heavily depends on Android,
- # "src/btif_avrcp_audio_track.cpp",
- "src/btif_config.c",
- "src/btif_config_transcode.cpp",
- "src/btif_core.c",
- "src/btif_debug.c",
- "src/btif_debug_btsnoop.c",
- "src/btif_debug_conn.c",
- "src/btif_dm.c",
- "src/btif_gatt.c",
- "src/btif_gatt_client.c",
- "src/btif_gatt_multi_adv_util.c",
- "src/btif_gatt_server.c",
- "src/btif_gatt_test.c",
- "src/btif_gatt_util.c",
- "src/btif_hf.c",
- "src/btif_hf_client.c",
- "src/btif_hh.c",
- "src/btif_hl.c",
- "src/btif_mce.c",
- "src/btif_media_task.c",
- "src/btif_pan.c",
- "src/btif_profile_queue.c",
- "src/btif_rc.c",
- "src/btif_sdp.c",
- "src/btif_sdp_server.c",
- "src/btif_sm.c",
- "src/btif_sock.c",
- "src/btif_sock_l2cap.c",
- "src/btif_sock_rfc.c",
- "src/btif_sock_sco.c",
- "src/btif_sock_sdp.c",
- "src/btif_sock_thread.c",
- "src/btif_sock_util.c",
- "src/btif_storage.c",
- "src/btif_uid.c",
- "src/btif_util.c",
- "src/stack_manager.c",
+ # "src/btif_avrcp_audio_track.cc",
+ "src/btif_config.cc",
+ "src/btif_config_transcode.cc",
+ "src/btif_core.cc",
+ "src/btif_debug.cc",
+ "src/btif_debug_btsnoop.cc",
+ "src/btif_debug_conn.cc",
+ "src/btif_dm.cc",
+ "src/btif_gatt.cc",
+ "src/btif_gatt_client.cc",
+ "src/btif_gatt_multi_adv_util.cc",
+ "src/btif_gatt_server.cc",
+ "src/btif_gatt_test.cc",
+ "src/btif_gatt_util.cc",
+ "src/btif_hf.cc",
+ "src/btif_hf_client.cc",
+ "src/btif_hh.cc",
+ "src/btif_hl.cc",
+ "src/btif_mce.cc",
+ "src/btif_media_task.cc",
+ "src/btif_pan.cc",
+ "src/btif_profile_queue.cc",
+ "src/btif_rc.cc",
+ "src/btif_sdp.cc",
+ "src/btif_sdp_server.cc",
+ "src/btif_sm.cc",
+ "src/btif_sock.cc",
+ "src/btif_sock_l2cap.cc",
+ "src/btif_sock_rfc.cc",
+ "src/btif_sock_sco.cc",
+ "src/btif_sock_sdp.cc",
+ "src/btif_sock_thread.cc",
+ "src/btif_sock_util.cc",
+ "src/btif_storage.cc",
+ "src/btif_uid.cc",
+ "src/btif_util.cc",
+ "src/stack_manager.cc",
]
# BTIF callouts
sources += [
- "co/bta_ag_co.c",
- "co/bta_dm_co.c",
- "co/bta_av_co.c",
- "co/bta_hh_co.c",
- "co/bta_hl_co.c",
- "co/bta_pan_co.c",
- "co/bta_gatts_co.c",
+ "co/bta_ag_co.cc",
+ "co/bta_dm_co.cc",
+ "co/bta_av_co.cc",
+ "co/bta_hh_co.cc",
+ "co/bta_hl_co.cc",
+ "co/bta_pan_co.cc",
+ "co/bta_gatts_co.cc",
]
include_dirs = [
diff --git a/btif/co/bta_ag_co.c b/btif/co/bta_ag_co.cc
similarity index 94%
rename from btif/co/bta_ag_co.c
rename to btif/co/bta_ag_co.cc
index 31f58d8..cb4bdf7 100755
--- a/btif/co/bta_ag_co.c
+++ b/btif/co/bta_ag_co.cc
@@ -19,6 +19,7 @@
#define LOG_TAG "bt_btif_bta_ag"
#include "bta/include/bta_ag_api.h"
+#include "bta/include/bta_ag_co.h"
#include "hci/include/hci_audio.h"
#include "osi/include/osi.h"
@@ -71,7 +72,7 @@
#if (BTM_WBS_INCLUDED == TRUE )
BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (OFF), codec: 0x%x",
handle, codec);
- set_audio_state(handle, codec, state);
+ set_audio_state(handle, (sco_codec_t) codec, (sco_state_t) state);
#else
BTIF_TRACE_DEBUG("bta_ag_co_audio_state(handle %d)::Closed (OFF)",
handle);
@@ -82,9 +83,9 @@
break;
case SCO_STATE_SETUP:
#if (BTM_WBS_INCLUDED == TRUE )
- set_audio_state(handle, codec, state);
+ set_audio_state(handle, (sco_codec_t) codec, (sco_state_t) state);
#else
- set_audio_state(handle, BTA_AG_CODEC_CVSD, state);
+ set_audio_state(handle, (sco_codec_t) BTA_AG_CODEC_CVSD, (sco_state_t) state);
#endif
break;
default:
diff --git a/btif/co/bta_av_co.c b/btif/co/bta_av_co.cc
similarity index 99%
rename from btif/co/bta_av_co.c
rename to btif/co/bta_av_co.cc
index 76c8836..2a77a9a 100644
--- a/btif/co/bta_av_co.c
+++ b/btif/co/bta_av_co.cc
@@ -66,7 +66,7 @@
#define BTA_AV_CO_SBC_MAX_BITPOOL 53
/* SCMS-T protect info */
-const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = "\x02\x02\x00";
+const UINT8 bta_av_co_cp_scmst[BTA_AV_CP_INFO_LEN] = {0x02, 0x02, 0x00};
/* SBC SRC codec capabilities */
const tA2D_SBC_CIE bta_av_co_sbc_caps =
diff --git a/btif/co/bta_dm_co.c b/btif/co/bta_dm_co.cc
similarity index 100%
rename from btif/co/bta_dm_co.c
rename to btif/co/bta_dm_co.cc
diff --git a/btif/co/bta_gatts_co.c b/btif/co/bta_gatts_co.cc
similarity index 100%
rename from btif/co/bta_gatts_co.c
rename to btif/co/bta_gatts_co.cc
diff --git a/btif/co/bta_hh_co.c b/btif/co/bta_hh_co.cc
similarity index 98%
rename from btif/co/bta_hh_co.c
rename to btif/co/bta_hh_co.cc
index 93ae70d..cbb0507 100644
--- a/btif/co/bta_hh_co.c
+++ b/btif/co/bta_hh_co.cc
@@ -195,7 +195,7 @@
*******************************************************************************/
static void *btif_hh_poll_event_thread(void *arg)
{
- btif_hh_device_t *p_dev = arg;
+ btif_hh_device_t *p_dev = (btif_hh_device_t*)arg;
APPL_TRACE_DEBUG("%s: Thread created fd = %d", __func__, p_dev->fd);
struct pollfd pfds[1];
int ret;
@@ -456,7 +456,7 @@
**
** Returns void
*******************************************************************************/
-void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 vendor_id,
+void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, const char *dev_name, UINT16 vendor_id,
UINT16 product_id, UINT16 version, UINT8 ctry_code,
int dscp_len, UINT8 *p_dscp)
{
@@ -612,5 +612,6 @@
BTIF_TRACE_DEBUG("%s() - Reset cache for bda %s", __FUNCTION__, bdstr);
}
+
#endif /* #if (BLE_INCLUDED == TRUE && BTA_HH_LE_INCLUDED == TRUE) */
diff --git a/btif/co/bta_hl_co.c b/btif/co/bta_hl_co.cc
similarity index 100%
rename from btif/co/bta_hl_co.c
rename to btif/co/bta_hl_co.cc
diff --git a/btif/co/bta_pan_co.c b/btif/co/bta_pan_co.cc
similarity index 100%
rename from btif/co/bta_pan_co.c
rename to btif/co/bta_pan_co.cc
diff --git a/btif/include/btif_api.h b/btif/include/btif_api.h
index 355f188..baee449 100644
--- a/btif/include/btif_api.h
+++ b/btif/include/btif_api.h
@@ -35,6 +35,10 @@
#include "btif_common.h"
#include "btif_dm.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** BTIF CORE API
********************************************************************************/
@@ -420,4 +424,9 @@
**
*******************************************************************************/
void btif_debug_bond_event_dump(int fd);
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTIF_API_H */
diff --git a/btif/include/btif_av.h b/btif/include/btif_av.h
index b6c98e3..fcf5d6a 100644
--- a/btif/include/btif_av.h
+++ b/btif/include/btif_av.h
@@ -32,6 +32,9 @@
#include "btif_sm.h"
#include "bta_av_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*******************************************************************************
** Type definitions for callback functions
@@ -191,4 +194,8 @@
********************************************************************************/
void btif_av_clear_remote_suspend_flag(void);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTIF_AV_H */
diff --git a/btif/include/btif_av_api.h b/btif/include/btif_av_api.h
index 86cd40b..ef25f78 100644
--- a/btif/include/btif_av_api.h
+++ b/btif/include/btif_av_api.h
@@ -202,9 +202,4 @@
tBTIF_AV_MEDIA_FEED_CFG cfg; /* Media codec configuration */
} tBTIF_AV_MEDIA_FEEDINGS;
-
-#ifdef __cplusplus
-}
-#endif
-
#endif /* BTIF_AV_API_H */
diff --git a/btif/include/btif_av_co.h b/btif/include/btif_av_co.h
index a6a5bfa..8c59a95 100644
--- a/btif/include/btif_av_co.h
+++ b/btif/include/btif_av_co.h
@@ -21,6 +21,10 @@
#include "btif_media.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -171,4 +175,8 @@
*******************************************************************************/
BOOLEAN bta_av_co_get_remote_bitpool_pref(UINT8 *min, UINT8 *max);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_common.h b/btif/include/btif_common.h
index b48631b..04e8cf6 100644
--- a/btif/include/btif_common.h
+++ b/btif/include/btif_common.h
@@ -29,6 +29,10 @@
#include "bt_types.h"
#include "bta_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -216,4 +220,8 @@
void btif_init_ok(UNUSED_ATTR uint16_t event, UNUSED_ATTR char *p_param);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTIF_COMMON_H */
diff --git a/btif/include/btif_config.h b/btif/include/btif_config.h
index 495e938..7211f60 100644
--- a/btif/include/btif_config.h
+++ b/btif/include/btif_config.h
@@ -23,6 +23,10 @@
#include "bt_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char BTIF_CONFIG_MODULE[] = "btif_config_module";
typedef struct btif_config_section_iter_t btif_config_section_iter_t;
@@ -53,3 +57,7 @@
bool btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type);
void btif_debug_config_dump(int fd);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/btif/include/btif_debug_conn.h b/btif/include/btif_debug_conn.h
index bf1bd6a..8db83dc 100644
--- a/btif/include/btif_debug_conn.h
+++ b/btif/include/btif_debug_conn.h
@@ -22,6 +22,10 @@
#include "gatt_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
BTIF_DEBUG_CONNECTED = 1,
BTIF_DEBUG_DISCONNECTED
@@ -32,3 +36,7 @@
const tGATT_DISCONN_REASON disconnect_reason);
void btif_debug_conn_dump(int fd);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/btif/include/btif_dm.h b/btif/include/btif_dm.h
index 72ee378..553f9e0 100644
--- a/btif/include/btif_dm.h
+++ b/btif/include/btif_dm.h
@@ -22,10 +22,13 @@
#include "bta_api.h"
#include "btif_uid.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/************************************************************************************
** Functions
********************************************************************************/
-
void btif_dm_init(uid_set_t* set);
void btif_dm_cleanup(void);
@@ -103,4 +106,8 @@
#endif /* BLE_INCLUDED */
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_gatt.h b/btif/include/btif_gatt.h
index e71ba1e..d39ce45 100644
--- a/btif/include/btif_gatt.h
+++ b/btif/include/btif_gatt.h
@@ -28,7 +28,8 @@
#ifndef BTIF_GATT_H
#define BTIF_GATT_H
-
+extern const btgatt_client_interface_t btgattClientInterface;
+extern const btgatt_server_interface_t btgattServerInterface;
#endif
diff --git a/btif/include/btif_gatt_multi_adv_util.h b/btif/include/btif_gatt_multi_adv_util.h
index ac8351c..b4ed6c7 100644
--- a/btif/include/btif_gatt_multi_adv_util.h
+++ b/btif/include/btif_gatt_multi_adv_util.h
@@ -22,6 +22,10 @@
#include "bta_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define CLNT_IF_IDX 0
#define INST_ID_IDX 1
#define INST_ID_IDX_MAX (INST_ID_IDX + 1)
@@ -90,3 +94,6 @@
extern void btif_gattc_adv_data_cleanup(btif_adv_data_t* adv);
void btif_multi_adv_timer_ctrl(int client_if, alarm_callback_t cb);
+#ifdef __cplusplus
+}
+#endif
diff --git a/btif/include/btif_gatt_util.h b/btif/include/btif_gatt_util.h
index 715e0c5..b2359cf 100644
--- a/btif/include/btif_gatt_util.h
+++ b/btif/include/btif_gatt_util.h
@@ -24,6 +24,10 @@
#include "bta/include/bta_gatt_api.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void btif_to_bta_uuid(tBT_UUID *p_dest, bt_uuid_t *p_src);
void btif_to_bta_response(tBTA_GATTS_RSP *p_dest, btgatt_response_t* p_src);
void btif_to_bta_uuid_mask(tBTA_DM_BLE_PF_COND_MASK *p_mask, bt_uuid_t *p_src);
@@ -36,6 +40,9 @@
void btif_gatt_check_encrypted_link(BD_ADDR bd_addr, tBTA_GATT_TRANSPORT transport);
extern void btif_gatt_move_track_adv_data(btgatt_track_adv_info_t *p_dest,
btgatt_track_adv_info_t *p_src);
+#ifdef __cplusplus
+}
+#endif
#endif
diff --git a/btif/include/btif_hh.h b/btif/include/btif_hh.h
index faf9543..3dd4a54 100644
--- a/btif/include/btif_hh.h
+++ b/btif/include/btif_hh.h
@@ -26,6 +26,9 @@
#include "bta_hh_api.h"
#include "btu.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
/*******************************************************************************
** Constants & Macros
@@ -111,4 +114,8 @@
BOOLEAN btif_hh_add_added_dev(bt_bdaddr_t bd_addr, tBTA_HH_ATTR_MASK attr_mask);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_hl.h b/btif/include/btif_hl.h
index f8bac11..8d92bc8 100644
--- a/btif/include/btif_hl.h
+++ b/btif/include/btif_hl.h
@@ -25,6 +25,10 @@
#include "bt_common.h"
#include "osi/include/alarm.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -327,4 +331,9 @@
extern BOOLEAN btif_hl_proc_pending_op(UINT8 app_idx, UINT8 mcl_idx);
extern BOOLEAN btif_hl_load_mdl_config (UINT8 app_id, UINT8 buffer_size,
tBTA_HL_MDL_CFG *p_mdl_buf );
+
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_pan_internal.h b/btif/include/btif_pan_internal.h
index fad5577..ec05ac6 100644
--- a/btif/include/btif_pan_internal.h
+++ b/btif/include/btif_pan_internal.h
@@ -30,6 +30,10 @@
#include "btif_pan.h"
#include "bt_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -120,4 +124,8 @@
return addr[0] & 1 ? 0 : 1; /* Cannot be multicasting address */
}
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_sock_l2cap.h b/btif/include/btif_sock_l2cap.h
index 1286e36..e5ea71c 100644
--- a/btif/include/btif_sock_l2cap.h
+++ b/btif/include/btif_sock_l2cap.h
@@ -9,6 +9,10 @@
#include <hardware/bluetooth.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define L2CAP_MASK_FIXED_CHANNEL 0x10000
#define L2CAP_MASK_LE_COC_CHANNEL 0x20000
@@ -21,5 +25,8 @@
void btsock_l2cap_signaled(int fd, int flags, uint32_t user_id);
void on_l2cap_psm_assigned(int id, int psm);
+#ifdef __cplusplus
+}
#endif
+#endif
diff --git a/btif/include/btif_sock_thread.h b/btif/include/btif_sock_thread.h
index b81c494..f4ae2ef 100644
--- a/btif/include/btif_sock_thread.h
+++ b/btif/include/btif_sock_thread.h
@@ -24,6 +24,10 @@
#include <hardware/bluetooth.h>
#include <hardware/bt_sock.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -50,4 +54,8 @@
int btsock_thread_create(btsock_signaled_cb callback, btsock_cmd_cb cmd_callback);
int btsock_thread_exit(int handle);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_sock_util.h b/btif/include/btif_sock_util.h
index eb915f9..e70b847 100644
--- a/btif/include/btif_sock_util.h
+++ b/btif/include/btif_sock_util.h
@@ -29,10 +29,18 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void dump_bin(const char* title, const char* data, int size);
int sock_send_fd(int sock_fd, const uint8_t* buffer, int len, int send_fd);
int sock_send_all(int sock_fd, const uint8_t* buf, int len);
int sock_recv_all(int sock_fd, uint8_t* buf, int len);
+#ifdef __cplusplus
+}
+#endif
+
#endif
diff --git a/btif/include/btif_storage.h b/btif/include/btif_storage.h
index bc1060c..ed0ab19 100644
--- a/btif/include/btif_storage.h
+++ b/btif/include/btif_storage.h
@@ -24,6 +24,10 @@
#include "bt_target.h"
#include "bt_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -319,4 +323,8 @@
*****************************************************************************/
size_t btif_split_uuids_string(const char *str, bt_uuid_t *p_uuid, size_t max_uuids);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTIF_STORAGE_H */
diff --git a/btif/include/btif_uid.h b/btif/include/btif_uid.h
index 35faedb..57923a7 100644
--- a/btif/include/btif_uid.h
+++ b/btif/include/btif_uid.h
@@ -20,6 +20,10 @@
#include <hardware/bluetooth.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct uid_set_t;
typedef struct uid_set_t uid_set_t;
@@ -41,3 +45,7 @@
* The caller is responsible for calling osi_free() on the returned array.
*/
bt_uid_traffic_t* uid_set_read_and_clear(uid_set_t* set);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/btif/include/btif_util.h b/btif/include/btif_util.h
index ebba177..c17a156 100644
--- a/btif/include/btif_util.h
+++ b/btif/include/btif_util.h
@@ -28,6 +28,10 @@
#include "bt_types.h"
#include "bt_utils.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*******************************************************************************
** Constants & Macros
********************************************************************************/
@@ -78,4 +82,8 @@
void uuid_to_string_legacy(bt_uuid_t *p_uuid, char *str);
int ascii_2_hex (const char *p_ascii, int len, UINT8 *p_hex);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BTIF_UTIL_H */
diff --git a/btif/src/bluetooth.c b/btif/src/bluetooth.cc
similarity index 97%
rename from btif/src/bluetooth.c
rename to btif/src/bluetooth.cc
index 1414138..5d42fc6 100644
--- a/btif/src/bluetooth.c
+++ b/btif/src/bluetooth.cc
@@ -96,7 +96,7 @@
extern btmce_interface_t *btif_mce_get_interface();
#if BLE_INCLUDED == TRUE
/* gatt */
-extern btgatt_interface_t *btif_gatt_get_interface();
+extern const btgatt_interface_t *btif_gatt_get_interface();
#endif
/* avrc target */
extern btrc_interface_t *btif_rc_get_interface();
@@ -524,15 +524,11 @@
}
static int open_bluetooth_stack(const struct hw_module_t *module, UNUSED_ATTR char const *name, struct hw_device_t **abstraction) {
- static bluetooth_device_t device = {
- .common = {
- .tag = HARDWARE_DEVICE_TAG,
- .version = 0,
- .close = close_bluetooth_stack,
- },
- .get_bluetooth_interface = bluetooth__get_bluetooth_interface
- };
-
+ static bluetooth_device_t device;
+ device.common.tag = HARDWARE_DEVICE_TAG;
+ device.common.version = 0;
+ device.common.close = close_bluetooth_stack;
+ device.get_bluetooth_interface = bluetooth__get_bluetooth_interface;
device.common.module = (struct hw_module_t *)module;
*abstraction = (struct hw_device_t *)&device;
return 0;
diff --git a/btif/src/btif_av.c b/btif/src/btif_av.cc
similarity index 97%
rename from btif/src/btif_av.c
rename to btif/src/btif_av.cc
index cb61c98..fa4c6f2 100644
--- a/btif/src/btif_av.c
+++ b/btif/src/btif_av.cc
@@ -301,7 +301,7 @@
static BOOLEAN btif_av_state_idle_handler(btif_sm_event_t event, void *p_data)
{
BTIF_TRACE_DEBUG("%s event:%s flags %x", __FUNCTION__,
- dump_av_sm_event_name(event), btif_av_cb.flags);
+ dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags);
switch (event)
{
@@ -366,7 +366,7 @@
BTIF_TIMEOUT_AV_OPEN_ON_RC_MS,
btif_initiate_av_open_timer_timeout, NULL,
btu_general_alarm_queue);
- btif_rc_handler(event, p_data);
+ btif_rc_handler(event, (tBTA_AV*)p_data);
break;
/*
@@ -446,7 +446,7 @@
case BTA_AV_RC_CLOSE_EVT:
BTIF_TRACE_DEBUG("BTA_AV_RC_CLOSE_EVT: Stopping AV timer.");
alarm_cancel(av_open_on_rc_timer);
- btif_rc_handler(event, p_data);
+ btif_rc_handler(event, (tBTA_AV*)p_data);
break;
case BTIF_AV_OFFLOAD_START_REQ_EVT:
@@ -456,7 +456,7 @@
default:
BTIF_TRACE_WARNING("%s : unhandled event:%s", __FUNCTION__,
- dump_av_sm_event_name(event));
+ dump_av_sm_event_name((btif_av_sm_event_t)event));
return FALSE;
}
@@ -477,7 +477,7 @@
static BOOLEAN btif_av_state_opening_handler(btif_sm_event_t event, void *p_data)
{
BTIF_TRACE_DEBUG("%s event:%s flags %x", __FUNCTION__,
- dump_av_sm_event_name(event), btif_av_cb.flags);
+ dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags);
switch (event)
{
@@ -609,11 +609,11 @@
btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE);
break;
- CHECK_RC_EVENT(event, p_data);
+ CHECK_RC_EVENT(event, (tBTA_AV*)p_data);
default:
BTIF_TRACE_WARNING("%s : unhandled event:%s", __FUNCTION__,
- dump_av_sm_event_name(event));
+ dump_av_sm_event_name((btif_av_sm_event_t)event));
return FALSE;
}
@@ -634,7 +634,7 @@
static BOOLEAN btif_av_state_closing_handler(btif_sm_event_t event, void *p_data)
{
BTIF_TRACE_DEBUG("%s event:%s flags %x", __FUNCTION__,
- dump_av_sm_event_name(event), btif_av_cb.flags);
+ dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags);
switch (event)
{
@@ -689,7 +689,7 @@
default:
BTIF_TRACE_WARNING("%s : unhandled event:%s", __FUNCTION__,
- dump_av_sm_event_name(event));
+ dump_av_sm_event_name((btif_av_sm_event_t)event));
return FALSE;
}
return TRUE;
@@ -710,7 +710,7 @@
tBTA_AV *p_av = (tBTA_AV*)p_data;
BTIF_TRACE_DEBUG("%s event:%s flags %x", __FUNCTION__,
- dump_av_sm_event_name(event), btif_av_cb.flags);
+ dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags);
if ( (event == BTA_AV_REMOTE_CMD_EVT) && (btif_av_cb.flags & BTIF_AV_FLAG_REMOTE_SUSPEND) &&
(p_av->remote_cmd.rc_id == BTA_AV_RC_PLAY) )
@@ -847,11 +847,11 @@
BTIF_TRACE_ERROR("BTIF_AV_OFFLOAD_START_REQ_EVT: Stream not Started Opened");
break;
- CHECK_RC_EVENT(event, p_data);
+ CHECK_RC_EVENT(event, (tBTA_AV*)p_data);
default:
BTIF_TRACE_WARNING("%s : unhandled event:%s", __FUNCTION__,
- dump_av_sm_event_name(event));
+ dump_av_sm_event_name((btif_av_sm_event_t)event));
return FALSE;
}
@@ -873,7 +873,7 @@
tBTA_AV *p_av = (tBTA_AV*)p_data;
BTIF_TRACE_DEBUG("%s event:%s flags %x", __FUNCTION__,
- dump_av_sm_event_name(event), btif_av_cb.flags);
+ dump_av_sm_event_name((btif_av_sm_event_t)event), btif_av_cb.flags);
switch (event)
{
@@ -1027,11 +1027,11 @@
btif_a2dp_on_offload_started(p_av->status);
break;
- CHECK_RC_EVENT(event, p_data);
+ CHECK_RC_EVENT(event, (tBTA_AV*)p_data);
default:
BTIF_TRACE_WARNING("%s : unhandled event:%s", __FUNCTION__,
- dump_av_sm_event_name(event));
+ dump_av_sm_event_name((btif_av_sm_event_t)event));
return FALSE;
}
@@ -1070,21 +1070,21 @@
case BTA_AV_META_MSG_EVT:
if (av_src->meta_msg.p_data && av_src->meta_msg.len)
{
- av_dest->meta_msg.p_data = osi_calloc(av_src->meta_msg.len);
+ av_dest->meta_msg.p_data = (UINT8*)osi_calloc(av_src->meta_msg.len);
memcpy(av_dest->meta_msg.p_data, av_src->meta_msg.p_data,
av_src->meta_msg.len);
}
if (av_src->meta_msg.p_msg)
{
- av_dest->meta_msg.p_msg = osi_calloc(sizeof(tAVRC_MSG));
+ av_dest->meta_msg.p_msg = (tAVRC_MSG*)osi_calloc(sizeof(tAVRC_MSG));
memcpy(av_dest->meta_msg.p_msg, av_src->meta_msg.p_msg,
sizeof(tAVRC_MSG));
if (av_src->meta_msg.p_msg->vendor.p_vendor_data &&
av_src->meta_msg.p_msg->vendor.vendor_len)
{
- av_dest->meta_msg.p_msg->vendor.p_vendor_data = osi_calloc(
+ av_dest->meta_msg.p_msg->vendor.p_vendor_data = (UINT8 *)osi_calloc(
av_src->meta_msg.p_msg->vendor.vendor_len);
memcpy(av_dest->meta_msg.p_msg->vendor.p_vendor_data,
av_src->meta_msg.p_msg->vendor.p_vendor_data,
diff --git a/btif/src/btif_avrcp_audio_track.cpp b/btif/src/btif_avrcp_audio_track.cc
similarity index 100%
rename from btif/src/btif_avrcp_audio_track.cpp
rename to btif/src/btif_avrcp_audio_track.cc
diff --git a/btif/src/btif_config.c b/btif/src/btif_config.cc
similarity index 98%
rename from btif/src/btif_config.c
rename to btif/src/btif_config.cc
index f532b12..3018afd 100644
--- a/btif/src/btif_config.c
+++ b/btif/src/btif_config.cc
@@ -149,6 +149,9 @@
config = config_new_empty();
btif_config_source = NEW_FILE;
}
+
+ const char* time_str;
+
if (!config) {
LOG_ERROR(LOG_TAG, "%s unable to allocate a config object.", __func__);
goto error;
@@ -161,7 +164,7 @@
btif_config_remove_restricted(config);
// Read or set config file creation timestamp
- const char* time_str = config_get_string(config, INFO_SECTION, FILE_TIMESTAMP, NULL);
+ time_str = config_get_string(config, INFO_SECTION, FILE_TIMESTAMP, NULL);
if (time_str != NULL) {
strlcpy(btif_config_time_created, time_str, TIME_STRING_LENGTH);
} else {
@@ -210,15 +213,12 @@
return future_new_immediate(FUTURE_SUCCESS);
}
-EXPORT_SYMBOL const module_t btif_config_module = {
+EXPORT_SYMBOL module_t btif_config_module = {
.name = BTIF_CONFIG_MODULE,
.init = init,
.start_up = NULL,
.shut_down = shut_down,
- .clean_up = clean_up,
- .dependencies = {
- NULL
- }
+ .clean_up = clean_up
};
bool btif_config_has_section(const char *section) {
diff --git a/btif/src/btif_config_transcode.cpp b/btif/src/btif_config_transcode.cc
similarity index 96%
rename from btif/src/btif_config_transcode.cpp
rename to btif/src/btif_config_transcode.cc
index e8bd1a2..5998737 100644
--- a/btif/src/btif_config_transcode.cpp
+++ b/btif/src/btif_config_transcode.cc
@@ -27,7 +27,7 @@
using namespace tinyxml2;
-extern "C" config_t *btif_config_transcode(const char *xml_filename) {
+config_t *btif_config_transcode(const char *xml_filename) {
XMLDocument document;
int error = document.LoadFile(xml_filename);
if (error != XML_SUCCESS) {
diff --git a/btif/src/btif_core.c b/btif/src/btif_core.cc
similarity index 99%
rename from btif/src/btif_core.c
rename to btif/src/btif_core.cc
index ecb14d9..77ba668 100644
--- a/btif/src/btif_core.c
+++ b/btif/src/btif_core.cc
@@ -140,6 +140,10 @@
************************************************************************************/
extern fixed_queue_t *btu_hci_msg_queue;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
extern void bte_load_did_conf(const char *p_path);
/** TODO: Move these to _common.h */
@@ -150,11 +154,16 @@
void bte_main_enable_lpm(BOOLEAN enable);
#endif
void bte_main_postload_cfg(void);
+void bte_main_config_hci_logging(BOOLEAN enable, BOOLEAN bt_disabled);
+
+#ifdef __cplusplus
+}
+#endif
+
void btif_dm_execute_service_request(UINT16 event, char *p_param);
#ifdef BTIF_DM_OOB_TEST
void btif_dm_load_local_oob(void);
#endif
-void bte_main_config_hci_logging(BOOLEAN enable, BOOLEAN bt_disabled);
/*******************************************************************************
**
diff --git a/btif/src/btif_debug.c b/btif/src/btif_debug.cc
similarity index 100%
rename from btif/src/btif_debug.c
rename to btif/src/btif_debug.cc
diff --git a/btif/src/btif_debug_btsnoop.c b/btif/src/btif_debug_btsnoop.cc
similarity index 97%
rename from btif/src/btif_debug_btsnoop.c
rename to btif/src/btif_debug_btsnoop.cc
index 511f8a8..af3ed5f 100644
--- a/btif/src/btif_debug_btsnoop.c
+++ b/btif/src/btif_debug_btsnoop.cc
@@ -89,7 +89,11 @@
assert(rb_dst != NULL);
assert(rb_src != NULL);
- z_stream zs = {.zalloc = Z_NULL, .zfree = Z_NULL, .opaque = Z_NULL};
+ z_stream zs;
+ zs.zalloc = Z_NULL;
+ zs.zfree = Z_NULL;
+ zs.opaque = Z_NULL;
+
if (deflateInit(&zs, Z_DEFAULT_COMPRESSION) != Z_OK)
return false;
@@ -145,6 +149,11 @@
// Compress data
+ uint8_t b64_in[3] = {0};
+ char b64_out[5] = {0};
+
+ size_t line_length = 0;
+
bool rc = btsnoop_compress(ringbuffer, buffer);
if (rc == false) {
dprintf(fd, "%s Log compression failed", __func__);
@@ -153,10 +162,6 @@
// Base64 encode & output
- uint8_t b64_in[3] = {0};
- char b64_out[5] = {0};
-
- size_t line_length = 0;
while (ringbuffer_size(ringbuffer) > 0) {
size_t read = ringbuffer_pop(ringbuffer, b64_in, 3);
if (line_length >= MAX_LINE_LENGTH) {
diff --git a/btif/src/btif_debug_conn.c b/btif/src/btif_debug_conn.cc
similarity index 97%
rename from btif/src/btif_debug_conn.c
rename to btif/src/btif_debug_conn.cc
index 8746203..d9e70fa 100644
--- a/btif/src/btif_debug_conn.c
+++ b/btif/src/btif_debug_conn.cc
@@ -48,7 +48,7 @@
return buffer;
}
-static char *format_state(const btif_debug_conn_state_t state) {
+static const char *format_state(const btif_debug_conn_state_t state) {
switch (state) {
case BTIF_DEBUG_CONNECTED:
return "CONNECTED ";
diff --git a/btif/src/btif_dm.c b/btif/src/btif_dm.cc
similarity index 98%
rename from btif/src/btif_dm.c
rename to btif/src/btif_dm.cc
index 1bc9fa9..b828b10 100644
--- a/btif/src/btif_dm.c
+++ b/btif/src/btif_dm.cc
@@ -260,7 +260,7 @@
extern bt_status_t btif_hf_client_execute_service(BOOLEAN b_enable);
extern bt_status_t btif_sdp_execute_service(BOOLEAN b_enable);
extern int btif_hh_connect(bt_bdaddr_t *bd_addr);
-extern void bta_gatt_convert_uuid16_to_uuid128(UINT8 uuid_128[LEN_UUID_128], UINT16 uuid_16);
+extern "C" void bta_gatt_convert_uuid16_to_uuid128(UINT8 uuid_128[LEN_UUID_128], UINT16 uuid_16);
/******************************************************************************
** Functions
@@ -285,7 +285,7 @@
if (event == BTA_DM_BLE_KEY_EVT)
{
- dst_dm_sec->ble_key.p_key_value = osi_malloc(sizeof(tBTM_LE_KEY_VALUE));
+ dst_dm_sec->ble_key.p_key_value = (tBTM_LE_KEY_VALUE*)osi_malloc(sizeof(tBTM_LE_KEY_VALUE));
assert(src_dm_sec->ble_key.p_key_value);
memcpy(dst_dm_sec->ble_key.p_key_value, src_dm_sec->ble_key.p_key_value, sizeof(tBTM_LE_KEY_VALUE));
}
@@ -649,9 +649,9 @@
BTIF_STORAGE_FILL_PROPERTY(&prop_name, BT_PROPERTY_TYPE_OF_DEVICE,
sizeof(uint8_t), &remote_dev_type);
if (btif_storage_get_remote_device_property(&bdaddr, &prop_name) == BT_STATUS_SUCCESS)
- dev_type = remote_dev_type | device_type;
+ dev_type = (bt_device_type_t) (remote_dev_type | device_type);
else
- dev_type = device_type;
+ dev_type = (bt_device_type_t) device_type;
BTIF_STORAGE_FILL_PROPERTY(&properties[num_properties],
BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type);
@@ -736,8 +736,8 @@
if(is_hid)
#endif
{
- int status;
- status = btif_hh_connect(bd_addr);
+ bt_status_t status;
+ status = (bt_status_t) btif_hh_connect(bd_addr);
if(status != BT_STATUS_SUCCESS)
bond_state_changed(status, bd_addr, BT_BOND_STATE_NONE);
}
@@ -1394,9 +1394,9 @@
p_search_data->inq_res.device_type == BT_DEVICE_TYPE_BREDR) ||
(stored_device_type != BT_DEVICE_TYPE_BLE &&
p_search_data->inq_res.device_type == BT_DEVICE_TYPE_BLE))) {
- dev_type = BT_DEVICE_TYPE_DUMO;
+ dev_type = (bt_device_type_t)BT_DEVICE_TYPE_DUMO;
} else {
- dev_type = p_search_data->inq_res.device_type;
+ dev_type = (bt_device_type_t)p_search_data->inq_res.device_type;
}
if (p_search_data->inq_res.device_type == BT_DEVICE_TYPE_BLE)
@@ -1554,6 +1554,7 @@
#if (defined(BLE_INCLUDED) && (BLE_INCLUDED == TRUE))
case BTA_DM_DISC_BLE_RES_EVT:
+ {
BTIF_TRACE_DEBUG("%s:, services 0x%x)", __FUNCTION__,
p_data->disc_ble_res.service.uu.uuid16);
bt_uuid_t uuid;
@@ -1595,6 +1596,7 @@
BT_STATUS_SUCCESS, &bd_addr, 1, &prop);
}
+ }
break;
#endif /* BLE_INCLUDED */
@@ -1757,7 +1759,7 @@
{
bdcpy(bd_addr.address, pairing_cb.bd_addr);
btm_set_bond_type_dev(pairing_cb.bd_addr, BOND_TYPE_UNKNOWN);
- bond_state_changed(p_data->bond_cancel_cmpl.result, &bd_addr, BT_BOND_STATE_NONE);
+ bond_state_changed((bt_status_t)p_data->bond_cancel_cmpl.result, &bd_addr, BT_BOND_STATE_NONE);
}
break;
@@ -2100,7 +2102,7 @@
{
/* switch context to btif task context (copy full union size for convenience) */
bt_status_t status = btif_transfer_context(btif_dm_upstreams_evt, (uint16_t)event,
- (void*)p_data, sizeof(tBTA_DM_SEC), btif_dm_data_copy);
+ (char*)p_data, sizeof(tBTA_DM_SEC), btif_dm_data_copy);
/* catch any failed context transfers */
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
@@ -2144,7 +2146,7 @@
if (event == BTA_DM_INQ_RES_EVT)
p_data->inq_res.remt_name_not_required = check_eir_remote_name(p_data, NULL, NULL);
- btif_transfer_context (btif_dm_search_devices_evt , (UINT16) event, (void *)p_data, param_len,
+ btif_transfer_context (btif_dm_search_devices_evt , (UINT16) event, (char*)p_data, param_len,
(param_len > sizeof(tBTA_DM_SEARCH)) ? search_devices_copy_cb : NULL);
}
@@ -2853,9 +2855,9 @@
void btif_dm_proc_loc_oob(BOOLEAN valid, BT_OCTET16 c, BT_OCTET16 r)
{
FILE *fp;
- char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
- char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
- char *path = NULL;
+ const char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
+ const char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
+ const char *path = NULL;
char prop_oob[PROPERTY_VALUE_MAX];
BTIF_TRACE_DEBUG("%s: valid=%d", __func__, valid);
if (is_empty_128bit(oob_cb.oob_data.c192) && valid)
@@ -2891,9 +2893,9 @@
{
char t[128];
FILE *fp;
- char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
- char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
- char *path = NULL;
+ const char *path_a = "/data/misc/bluedroid/LOCAL/a.key";
+ const char *path_b = "/data/misc/bluedroid/LOCAL/b.key";
+ const char *path = NULL;
char prop_oob[PROPERTY_VALUE_MAX];
BOOLEAN result = FALSE;
bt_bdaddr_t bt_bd_addr;
@@ -3458,7 +3460,7 @@
char bdaddr[18];
bdaddr_to_string(&event->bd_addr, bdaddr, sizeof(bdaddr));
- char* func_name;
+ const char* func_name;
switch (event->function) {
case BTIF_DM_FUNC_CREATE_BOND:
func_name = "btif_dm_create_bond";
@@ -3474,7 +3476,7 @@
break;
}
- char* bond_state;
+ const char* bond_state;
switch (event->state) {
case BT_BOND_STATE_NONE:
bond_state = "BOND_STATE_NONE";
diff --git a/btif/src/btif_gatt.c b/btif/src/btif_gatt.cc
similarity index 95%
rename from btif/src/btif_gatt.c
rename to btif/src/btif_gatt.cc
index ccb1704..245540a 100644
--- a/btif/src/btif_gatt.c
+++ b/btif/src/btif_gatt.cc
@@ -46,9 +46,6 @@
const btgatt_callbacks_t *bt_gatt_callbacks = NULL;
-extern btgatt_client_interface_t btgattClientInterface;
-extern btgatt_server_interface_t btgattServerInterface;
-
/*******************************************************************************
**
** Function btif_gatt_init
diff --git a/btif/src/btif_gatt_client.c b/btif/src/btif_gatt_client.cc
similarity index 98%
rename from btif/src/btif_gatt_client.c
rename to btif/src/btif_gatt_client.cc
index 8205ba5..fb8a548 100644
--- a/btif/src/btif_gatt_client.c
+++ b/btif/src/btif_gatt_client.cc
@@ -321,7 +321,7 @@
if (p_src_data->read.p_value != NULL)
{
- p_dest_data->read.p_value = osi_malloc(sizeof(tBTA_GATT_UNFMT));
+ p_dest_data->read.p_value = (tBTA_GATT_UNFMT *)osi_malloc(sizeof(tBTA_GATT_UNFMT));
memcpy(p_dest_data->read.p_value, p_src_data->read.p_value,
sizeof(tBTA_GATT_UNFMT));
@@ -330,7 +330,7 @@
if (p_src_data->read.p_value->len > 0 &&
p_src_data->read.p_value->p_value != NULL) {
p_dest_data->read.p_value->p_value =
- osi_malloc(p_src_data->read.p_value->len);
+ (UINT8 *)osi_malloc(p_src_data->read.p_value->len);
memcpy(p_dest_data->read.p_value->p_value,
p_src_data->read.p_value->p_value,
p_src_data->read.p_value->len);
@@ -595,7 +595,7 @@
}
}
- dev_type = p_btif_cb->device_type;
+ dev_type = (bt_device_type_t) p_btif_cb->device_type;
BTIF_STORAGE_FILL_PROPERTY(&properties,
BT_PROPERTY_TYPE_OF_DEVICE, sizeof(dev_type), &dev_type);
btif_storage_set_remote_device_property(&(p_btif_cb->bd_addr), &properties);
@@ -740,7 +740,7 @@
if (p_data->read_reports.data_len > 0 && NULL != p_data->read_reports.p_rep_data)
{
- p_rep_data = osi_malloc(p_data->read_reports.data_len);
+ p_rep_data = (uint8_t *)osi_malloc(p_data->read_reports.data_len);
memcpy(p_rep_data, p_data->read_reports.p_rep_data, p_data->read_reports.data_len);
}
@@ -812,7 +812,7 @@
static void bta_gattc_cback(tBTA_GATTC_EVT event, tBTA_GATTC *p_data)
{
bt_status_t status = btif_transfer_context(btif_gattc_upstreams_evt,
- (uint16_t) event, (void*) p_data, sizeof(tBTA_GATTC), btapp_gattc_req_data);
+ (uint16_t) event, (char*) p_data, sizeof(tBTA_GATTC), btapp_gattc_req_data);
ASSERTC(status == BT_STATUS_SUCCESS, "Context transfer failed!", status);
}
@@ -957,7 +957,7 @@
if (data_len > 0)
{
- btif_scan_track_cb.read_reports.p_rep_data = osi_malloc(data_len);
+ btif_scan_track_cb.read_reports.p_rep_data = (UINT8 *)osi_malloc(data_len);
memcpy(btif_scan_track_cb.read_reports.p_rep_data, p_rep_data, data_len);
osi_free(p_rep_data);
}
@@ -1679,20 +1679,20 @@
if (src->p_manufacturer_data)
{
- dst->p_manufacturer_data = osi_malloc(src->manufacturer_len);
+ dst->p_manufacturer_data = (UINT8 *)osi_malloc(src->manufacturer_len);
memcpy(dst->p_manufacturer_data, src->p_manufacturer_data,
src->manufacturer_len);
}
if (src->p_service_data)
{
- dst->p_service_data = osi_malloc(src->service_data_len);
+ dst->p_service_data = (UINT8 *)osi_malloc(src->service_data_len);
memcpy(dst->p_service_data, src->p_service_data, src->service_data_len);
}
if (src->p_service_uuid)
{
- dst->p_service_uuid = osi_malloc(src->service_uuid_len);
+ dst->p_service_uuid = (UINT8 *)osi_malloc(src->service_uuid_len);
memcpy(dst->p_service_uuid, src->p_service_uuid, src->service_uuid_len);
}
break;
diff --git a/btif/src/btif_gatt_multi_adv_util.c b/btif/src/btif_gatt_multi_adv_util.cc
similarity index 96%
rename from btif/src/btif_gatt_multi_adv_util.c
rename to btif/src/btif_gatt_multi_adv_util.cc
index ddca7d2..d60292d 100644
--- a/btif/src/btif_gatt_multi_adv_util.c
+++ b/btif/src/btif_gatt_multi_adv_util.cc
@@ -62,12 +62,12 @@
if (NULL == p_multi_adv_com_data_cb)
{
- p_multi_adv_com_data_cb = osi_calloc(sizeof(btgatt_multi_adv_common_data));
+ p_multi_adv_com_data_cb = (btgatt_multi_adv_common_data*)osi_calloc(sizeof(btgatt_multi_adv_common_data));
/* Storing both client_if and inst_id details */
p_multi_adv_com_data_cb->clntif_map =
- osi_calloc((max_adv_inst * INST_ID_IDX_MAX) * sizeof(INT8));
+ (INT8*)osi_calloc((max_adv_inst * INST_ID_IDX_MAX) * sizeof(INT8));
- p_multi_adv_com_data_cb->inst_cb =
+ p_multi_adv_com_data_cb->inst_cb = (btgatt_multi_adv_inst_cb*)
osi_calloc((max_adv_inst + 1) * sizeof(btgatt_multi_adv_inst_cb));
for (int i = 0; i < max_adv_inst * 2; i += 2) {
@@ -226,21 +226,21 @@
if (manufacturer_len > 0)
{
- p_multi_adv_inst->p_manufacturer_data = osi_malloc(manufacturer_len);
+ p_multi_adv_inst->p_manufacturer_data = (uint8_t*)osi_malloc(manufacturer_len);
memcpy(p_multi_adv_inst->p_manufacturer_data, manufacturer_data, manufacturer_len);
}
p_multi_adv_inst->service_data_len = service_data_len;
if (service_data_len > 0)
{
- p_multi_adv_inst->p_service_data = osi_malloc(service_data_len);
+ p_multi_adv_inst->p_service_data = (uint8_t*)osi_malloc(service_data_len);
memcpy(p_multi_adv_inst->p_service_data, service_data, service_data_len);
}
p_multi_adv_inst->service_uuid_len = service_uuid_len;
if (service_uuid_len > 0)
{
- p_multi_adv_inst->p_service_uuid = osi_malloc(service_uuid_len);
+ p_multi_adv_inst->p_service_uuid = (uint8_t*)osi_malloc(service_uuid_len);
memcpy(p_multi_adv_inst->p_service_uuid, service_uuid, service_uuid_len);
}
}
diff --git a/btif/src/btif_gatt_server.c b/btif/src/btif_gatt_server.cc
similarity index 98%
rename from btif/src/btif_gatt_server.c
rename to btif/src/btif_gatt_server.cc
index 4a4cc5b..8916b61 100644
--- a/btif/src/btif_gatt_server.c
+++ b/btif/src/btif_gatt_server.cc
@@ -133,7 +133,7 @@
case BTA_GATTS_WRITE_EVT:
case BTA_GATTS_EXEC_WRITE_EVT:
case BTA_GATTS_MTU_EVT:
- p_dest_data->req_data.p_data = osi_malloc(sizeof(tBTA_GATTS_REQ_DATA));
+ p_dest_data->req_data.p_data = (tBTA_GATTS_REQ_DATA *)osi_malloc(sizeof(tBTA_GATTS_REQ_DATA));
memcpy(p_dest_data->req_data.p_data, p_src_data->req_data.p_data,
sizeof(tBTA_GATTS_REQ_DATA));
break;
@@ -352,7 +352,7 @@
{
bt_status_t status;
status = btif_transfer_context(btapp_gatts_handle_cback, (uint16_t) event,
- (void*)p_data, sizeof(tBTA_GATTS), btapp_gatts_copy_req_data);
+ (char*)p_data, sizeof(tBTA_GATTS), btapp_gatts_copy_req_data);
ASSERTC(status == BT_STATUS_SUCCESS, "Context transfer failed!", status);
}
@@ -618,7 +618,7 @@
btif_gatts_cb_t btif_cb;
btif_cb.server_if = (uint8_t) server_if;
btif_cb.srvc_handle = (uint16_t) service_handle;
- btif_cb.transport = (uint8_t) transport;
+ btif_cb.transport = (btgatt_transport_t) transport;
return btif_transfer_context(btgatts_handle_event, BTIF_GATTS_START_SERVICE,
(char*) &btif_cb, sizeof(btif_gatts_cb_t), NULL);
}
diff --git a/btif/src/btif_gatt_test.c b/btif/src/btif_gatt_test.cc
similarity index 98%
rename from btif/src/btif_gatt_test.c
rename to btif/src/btif_gatt_test.cc
index 349674e..f08ea2f 100644
--- a/btif/src/btif_gatt_test.c
+++ b/btif/src/btif_gatt_test.cc
@@ -210,7 +210,7 @@
* Implementation
*******************************************************************************/
-bt_status_t btif_gattc_test_command_impl(uint16_t command, btgatt_test_params_t* params)
+bt_status_t btif_gattc_test_command_impl(int command, btgatt_test_params_t* params)
{
switch(command) {
case 0x01: /* Enable */
@@ -263,7 +263,7 @@
if (params->u1 >= GATT_DISC_MAX)
{
LOG_ERROR(LOG_TAG, "%s: DISCOVER - Invalid type (%d)!", __FUNCTION__, params->u1);
- return 0;
+ return (bt_status_t)0;
}
param.s_handle = params->u2;
@@ -293,7 +293,7 @@
LOG_ERROR(LOG_TAG, "%s: UNKNOWN TEST COMMAND 0x%02x", __FUNCTION__, command);
break;
}
- return 0;
+ return (bt_status_t)0;
}
#endif
diff --git a/btif/src/btif_gatt_util.c b/btif/src/btif_gatt_util.cc
similarity index 97%
rename from btif/src/btif_gatt_util.c
rename to btif/src/btif_gatt_util.cc
index c93d866..44bcf34 100644
--- a/btif/src/btif_gatt_util.c
+++ b/btif/src/btif_gatt_util.cc
@@ -291,7 +291,7 @@
if (p_src->adv_pkt_len > 0)
{
- p_dest->p_adv_pkt_data = osi_malloc(p_src->adv_pkt_len);
+ p_dest->p_adv_pkt_data = (uint8_t*)osi_malloc(p_src->adv_pkt_len);
memcpy(p_dest->p_adv_pkt_data, p_src->p_adv_pkt_data,
p_src->adv_pkt_len);
osi_free_and_reset((void **)&p_src->p_adv_pkt_data);
@@ -299,7 +299,7 @@
if (p_src->scan_rsp_len > 0)
{
- p_dest->p_scan_rsp_data = osi_malloc(p_src->scan_rsp_len);
+ p_dest->p_scan_rsp_data = (uint8_t*)osi_malloc(p_src->scan_rsp_len);
memcpy(p_dest->p_scan_rsp_data, p_src->p_scan_rsp_data,
p_src->scan_rsp_len);
osi_free_and_reset((void **)&p_src->p_scan_rsp_data);
diff --git a/btif/src/btif_hf.c b/btif/src/btif_hf.cc
similarity index 99%
rename from btif/src/btif_hf.c
rename to btif/src/btif_hf.cc
index cb968da..5b958da 100644
--- a/btif/src/btif_hf.c
+++ b/btif/src/btif_hf.cc
@@ -567,7 +567,7 @@
#endif
/* Java needs to send OK/ERROR for these commands */
case BTA_AG_AT_CHLD_EVT:
- HAL_CBACK(bt_hf_callbacks, chld_cmd_cb, atoi(p_data->val.str),
+ HAL_CBACK(bt_hf_callbacks, chld_cmd_cb, (bthf_chld_type_t)atoi(p_data->val.str),
&btif_hf_cb[idx].connected_bda);
break;
@@ -655,7 +655,7 @@
param_len = sizeof(tBTA_AG_VAL);
/* switch context to btif task context (copy full union size for convenience) */
- status = btif_transfer_context(btif_hf_upstreams_evt, (uint16_t)event, (void*)p_data, param_len, NULL);
+ status = btif_transfer_context(btif_hf_upstreams_evt, (uint16_t)event, (char*)p_data, param_len, NULL);
/* catch any failed context transfers */
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
@@ -1594,7 +1594,7 @@
*******************************************************************************/
bt_status_t btif_hf_execute_service(BOOLEAN b_enable)
{
- char * p_service_names[] = BTIF_HF_SERVICE_NAMES;
+ const char * p_service_names[] = BTIF_HF_SERVICE_NAMES;
int i;
if (b_enable)
{
diff --git a/btif/src/btif_hf_client.c b/btif/src/btif_hf_client.cc
similarity index 97%
rename from btif/src/btif_hf_client.c
rename to btif/src/btif_hf_client.cc
index bdf0874..6367ee9 100644
--- a/btif/src/btif_hf_client.c
+++ b/btif/src/btif_hf_client.cc
@@ -693,18 +693,18 @@
switch (ind->type)
{
case BTA_HF_CLIENT_IND_CALL:
- HAL_CBACK(bt_hf_client_callbacks, call_cb, ind->value);
+ HAL_CBACK(bt_hf_client_callbacks, call_cb, (bthf_client_call_t)ind->value);
break;
case BTA_HF_CLIENT_IND_CALLSETUP:
- HAL_CBACK(bt_hf_client_callbacks, callsetup_cb, ind->value);
+ HAL_CBACK(bt_hf_client_callbacks, callsetup_cb, (bthf_client_callsetup_t)ind->value);
break;
case BTA_HF_CLIENT_IND_CALLHELD:
- HAL_CBACK(bt_hf_client_callbacks, callheld_cb, ind->value);
+ HAL_CBACK(bt_hf_client_callbacks, callheld_cb, (bthf_client_callheld_t)ind->value);
break;
case BTA_HF_CLIENT_IND_SERVICE:
- HAL_CBACK(bt_hf_client_callbacks, network_state_cb, ind->value);
+ HAL_CBACK(bt_hf_client_callbacks, network_state_cb, (bthf_client_network_state_t)ind->value);
break;
case BTA_HF_CLIENT_IND_SIGNAL:
@@ -712,7 +712,7 @@
break;
case BTA_HF_CLIENT_IND_ROAM:
- HAL_CBACK(bt_hf_client_callbacks, network_roaming_cb, ind->value);
+ HAL_CBACK(bt_hf_client_callbacks, network_roaming_cb, (bthf_client_service_type_t)ind->value);
break;
case BTA_HF_CLIENT_IND_BATTCH:
@@ -821,11 +821,11 @@
break;
case BTA_HF_CLIENT_VOICE_REC_EVT:
- HAL_CBACK(bt_hf_client_callbacks, vr_cmd_cb, p_data->val.value);
+ HAL_CBACK(bt_hf_client_callbacks, vr_cmd_cb, (bthf_client_vr_state_t)p_data->val.value);
break;
case BTA_HF_CLIENT_OPERATOR_NAME_EVT:
- HAL_CBACK(bt_hf_client_callbacks, current_operator_cb, p_data->operator.name);
+ HAL_CBACK(bt_hf_client_callbacks, current_operator_cb, p_data->operator_name.name);
break;
case BTA_HF_CLIENT_CLIP_EVT:
@@ -841,13 +841,13 @@
break;
case BTA_HF_CLIENT_AT_RESULT_EVT:
- HAL_CBACK(bt_hf_client_callbacks, cmd_complete_cb, p_data->result.type, p_data->result.cme);
+ HAL_CBACK(bt_hf_client_callbacks, cmd_complete_cb, (bthf_client_cmd_complete_t)p_data->result.type, p_data->result.cme);
break;
case BTA_HF_CLIENT_CLCC_EVT:
HAL_CBACK(bt_hf_client_callbacks, current_calls_cb, p_data->clcc.idx,
p_data->clcc.inc ? BTHF_CLIENT_CALL_DIRECTION_INCOMING : BTHF_CLIENT_CALL_DIRECTION_OUTGOING,
- p_data->clcc.status,
+ (bthf_client_call_state_t)p_data->clcc.status,
p_data->clcc.mpty ? BTHF_CLIENT_CALL_MPTY_TYPE_MULTI : BTHF_CLIENT_CALL_MPTY_TYPE_SINGLE,
p_data->clcc.number_present ? p_data->clcc.number : NULL);
break;
@@ -870,7 +870,7 @@
case BTA_HF_CLIENT_BTRH_EVT:
if (p_data->val.value <= BTRH_CLIENT_RESP_AND_HOLD_REJECT)
{
- HAL_CBACK(bt_hf_client_callbacks, resp_and_hold_cb, p_data->val.value);
+ HAL_CBACK(bt_hf_client_callbacks, resp_and_hold_cb, (bthf_client_resp_and_hold_t)p_data->val.value);
}
break;
@@ -920,7 +920,7 @@
bt_status_t status;
/* switch context to btif task context (copy full union size for convenience) */
- status = btif_transfer_context(btif_hf_client_upstreams_evt, (uint16_t)event, (void*)p_data, sizeof(*p_data), NULL);
+ status = btif_transfer_context(btif_hf_client_upstreams_evt, (uint16_t)event, (char*)p_data, sizeof(*p_data), NULL);
/* catch any failed context transfers */
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
diff --git a/btif/src/btif_hh.c b/btif/src/btif_hh.cc
similarity index 97%
rename from btif/src/btif_hh.c
rename to btif/src/btif_hh.cc
index 086742d..d4ad222 100644
--- a/btif/src/btif_hh.c
+++ b/btif/src/btif_hh.cc
@@ -103,7 +103,7 @@
{
UINT16 product_id;
UINT16 version_id;
- char* kb_name;
+ const char* kb_name;
} tHID_KB_LIST;
/************************************************************************************
@@ -143,7 +143,7 @@
extern void bta_hh_co_destroy(int fd);
extern void bta_hh_co_write(int fd, UINT8* rpt, UINT16 len);
extern bt_status_t btif_dm_remove_bond(const bt_bdaddr_t *bd_addr);
-extern void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, char *dev_name, UINT16 vendor_id,
+extern void bta_hh_co_send_hid_info(btif_hh_device_t *p_dev, const char *dev_name, UINT16 vendor_id,
UINT16 product_id, UINT16 version, UINT8 ctry_code,
int dscp_len, UINT8 *p_dscp);
extern BOOLEAN check_cod(const bt_bdaddr_t *remote_bdaddr, uint32_t cod);
@@ -246,7 +246,7 @@
*******************************************************************************/
static BT_HDR *create_pbuf(UINT16 len, UINT8 *data)
{
- BT_HDR* p_buf = osi_malloc(len + BTA_HH_MIN_OFFSET + sizeof(BT_HDR));
+ BT_HDR* p_buf = (BT_HDR*)osi_malloc(len + BTA_HH_MIN_OFFSET + sizeof(BT_HDR));
UINT8* pbuf_data;
p_buf->len = len;
@@ -271,7 +271,7 @@
BD_ADDR* bda;
BT_HDR* p_buf;
UINT8 data[] = {0x01, /* report id */
- btif_hh_keylockstates}; /* keystate */
+ static_cast<UINT8>(btif_hh_keylockstates)}; /* keystate */
/* Set report for other keyboards */
BTIF_TRACE_EVENT("%s: setting report on dev_handle %d to 0x%x",
@@ -744,7 +744,7 @@
p_dev = btif_hh_find_connected_dev_by_handle(p_data->conn.handle);
if (p_dev == NULL) {
BTIF_TRACE_WARNING("BTA_HH_OPEN_EVT: Error, cannot find device with handle %d", p_data->conn.handle);
- btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
// The connect request must come from device side and exceeded the connected
// HID device number.
BTA_HhClose(p_data->conn.handle);
@@ -754,13 +754,13 @@
BTIF_TRACE_WARNING("BTA_HH_OPEN_EVT: Error, failed to find the uhid driver...");
memcpy(&(p_dev->bd_addr), p_data->conn.bda, BD_ADDR_LEN);
//remove the connection and then try again to reconnect from the mouse side to recover
- btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
BTA_HhClose(p_data->conn.handle);
}
else {
BTIF_TRACE_WARNING("BTA_HH_OPEN_EVT: Found device...Getting dscp info for handle ... %d",p_data->conn.handle);
memcpy(&(p_dev->bd_addr), p_data->conn.bda, BD_ADDR_LEN);
- btif_hh_cb.status = BTIF_HH_DEV_CONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_CONNECTED;
// Send set_idle if the peer_device is a keyboard
if (check_cod((bt_bdaddr_t*)p_data->conn.bda, COD_HID_KEYBOARD )||
check_cod((bt_bdaddr_t*)p_data->conn.bda, COD_HID_COMBO))
@@ -784,7 +784,7 @@
p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED;
}
HAL_CBACK(bt_hh_callbacks, connection_state_cb, (bt_bdaddr_t*) &p_data->conn.bda,BTHH_CONN_STATE_DISCONNECTED);
- btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
}
break;
@@ -804,7 +804,7 @@
BTA_DmRemoveDevice((UINT8 *)p_dev->bd_addr.address);
}
- btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
p_dev->dev_status = BTHH_CONN_STATE_DISCONNECTED;
if (p_dev->fd >= 0) {
@@ -910,7 +910,7 @@
return;
}
{
- char *cached_name = NULL;
+ const char *cached_name = NULL;
bt_bdname_t bdname;
bt_property_t prop_name;
BTIF_STORAGE_FILL_PROPERTY(&prop_name, BT_PROPERTY_BDNAME,
@@ -1016,7 +1016,7 @@
BTIF_TRACE_DEBUG("BTA_HH_VC_UNPLUG_EVT: status = %d, handle = %d",
p_data->dev_status.status, p_data->dev_status.handle);
p_dev = btif_hh_find_connected_dev_by_handle(p_data->dev_status.handle);
- btif_hh_cb.status = BTIF_HH_DEV_DISCONNECTED;
+ btif_hh_cb.status = (BTIF_HH_STATUS)BTIF_HH_DEV_DISCONNECTED;
if (p_dev != NULL) {
BTIF_TRACE_DEBUG("BTA_HH_VC_UNPLUG_EVT:bda = %02x:%02x:%02x:%02x:%02x:%02x",
p_dev->bd_addr.address[0], p_dev->bd_addr.address[1],
@@ -1038,7 +1038,7 @@
else
btif_hh_remove_device(p_dev->bd_addr);
HAL_CBACK(bt_hh_callbacks, virtual_unplug_cb,&(p_dev->bd_addr),
- p_data->dev_status.status);
+ (bthh_status_t)p_data->dev_status.status);
}
break;
@@ -1086,7 +1086,7 @@
else if (BTA_HH_API_ERR_EVT == event)
param_len = 0;
/* switch context to btif task context (copy full union size for convenience) */
- status = btif_transfer_context(btif_hh_upstreams_evt, (uint16_t)event, (void*)p_data, param_len, NULL);
+ status = btif_transfer_context(btif_hh_upstreams_evt, (uint16_t)event, (char*)p_data, param_len, NULL);
/* catch any failed context transfers */
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
@@ -1493,7 +1493,7 @@
else {
int hex_bytes_filled;
size_t len = (strlen(report) + 1) / 2;
- UINT8 *hexbuf = osi_calloc(len);
+ UINT8 *hexbuf = (UINT8 *)osi_calloc(len);
/* Build a SetReport data buffer */
//TODO
@@ -1551,7 +1551,7 @@
else {
int hex_bytes_filled;
size_t len = (strlen(data) + 1) / 2;
- UINT8 *hexbuf = osi_calloc(len);
+ UINT8 *hexbuf = (UINT8 *)osi_calloc(len);
/* Build a SendData data buffer */
hex_bytes_filled = ascii_2_hex(data, len, hexbuf);
diff --git a/btif/src/btif_hl.c b/btif/src/btif_hl.cc
similarity index 99%
rename from btif/src/btif_hl.c
rename to btif/src/btif_hl.cc
index 5658d40..d12d529 100644
--- a/btif/src/btif_hl.c
+++ b/btif/src/btif_hl.cc
@@ -3718,7 +3718,7 @@
param_len = sizeof(tBTA_HL_MDL_IND);
break;
}
- status = btif_transfer_context(btif_hl_upstreams_evt, (uint16_t)event, (void*)p_data, param_len, NULL);
+ status = btif_transfer_context(btif_hl_upstreams_evt, (uint16_t)event, (char*)p_data, param_len, NULL);
/* catch any failed context transfers */
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
@@ -3819,7 +3819,7 @@
break;
}
- status = btif_transfer_context(btif_hl_upstreams_ctrl_evt, (uint16_t)event, (void*)p_data, param_len, NULL);
+ status = btif_transfer_context(btif_hl_upstreams_ctrl_evt, (uint16_t)event, (char*)p_data, param_len, NULL);
ASSERTC(status == BT_STATUS_SUCCESS, "context transfer failed", status);
}
/*******************************************************************************
@@ -4364,7 +4364,7 @@
BTIF_TRACE_DEBUG("btif_hl_update_maxfd max_org_s= %d", max_org_s);
for (const list_node_t *node = list_begin(soc_queue);
node != list_end(soc_queue); node = list_next(node)) {
- btif_hl_soc_cb_t *p_scb = list_node(node);
+ btif_hl_soc_cb_t *p_scb = (btif_hl_soc_cb_t *)list_node(node);
if (maxfd < p_scb->max_s) {
maxfd = p_scb->max_s;
BTIF_TRACE_DEBUG("btif_hl_update_maxfd maxfd=%d", maxfd);
@@ -4514,7 +4514,7 @@
for (const list_node_t *node = list_begin(soc_queue);
node != list_end(soc_queue); node = list_next(node)) {
- btif_hl_soc_cb_t *p_scb = list_node(node);
+ btif_hl_soc_cb_t *p_scb = (btif_hl_soc_cb_t *)list_node(node);
BTIF_TRACE_DEBUG("btif_hl_add_socket_to_set first p_scb=0x%x", p_scb);
if (btif_hl_get_socket_state(p_scb) == BTIF_HL_SOC_STATE_W4_ADD) {
@@ -4556,7 +4556,7 @@
BTIF_TRACE_DEBUG("entering %s",__FUNCTION__);
for (const list_node_t *node = list_begin(soc_queue);
node != list_end(soc_queue); node = list_next(node)) {
- btif_hl_soc_cb_t *p_scb = list_node(node);
+ btif_hl_soc_cb_t *p_scb = (btif_hl_soc_cb_t *)list_node(node);
if (btif_hl_get_socket_state(p_scb) == BTIF_HL_SOC_STATE_W4_REL) {
BTIF_TRACE_DEBUG("app_idx=%d mcl_id=%d, mdl_idx=%d",
p_scb->app_idx, p_scb->mcl_idx, p_scb->mdl_idx);
@@ -4586,7 +4586,7 @@
node != list_end(soc_queue); ) {
// We may mutate this list so we need keep track of
// the current node and only remove items behind.
- btif_hl_soc_cb_t *p_scb = list_node(node);
+ btif_hl_soc_cb_t *p_scb = (btif_hl_soc_cb_t *)list_node(node);
BTIF_TRACE_DEBUG("p_scb=0x%x", p_scb);
node = list_next(node);
if (btif_hl_get_socket_state(p_scb) == BTIF_HL_SOC_STATE_IDLE) {
@@ -4642,7 +4642,7 @@
for (const list_node_t *node = list_begin(soc_queue);
node != list_end(soc_queue); node = list_next(node)) {
- btif_hl_soc_cb_t *p_scb = list_node(node);
+ btif_hl_soc_cb_t *p_scb = (btif_hl_soc_cb_t *)list_node(node);
if (btif_hl_get_socket_state(p_scb) == BTIF_HL_SOC_STATE_W4_READ) {
if (FD_ISSET(p_scb->socket_id[1], p_cur_set)) {
BTIF_TRACE_DEBUG("read data state= BTIF_HL_SOC_STATE_W4_READ");
@@ -4654,7 +4654,7 @@
" sent tx_size=%d", p_dcb->tx_size);
osi_free_and_reset((void **)&p_dcb->p_tx_pkt);
}
- p_dcb->p_tx_pkt = osi_malloc(p_dcb->mtu);
+ p_dcb->p_tx_pkt = (UINT8*)osi_malloc(p_dcb->mtu);
int r = (int)recv(p_scb->socket_id[1], p_dcb->p_tx_pkt,
p_dcb->mtu, MSG_DONTWAIT);
if (r > 0) {
diff --git a/btif/src/btif_mce.c b/btif/src/btif_mce.cc
similarity index 97%
rename from btif/src/btif_mce.c
rename to btif/src/btif_mce.cc
index b1fb03a..d345033 100644
--- a/btif/src/btif_mce.c
+++ b/btif/src/btif_mce.cc
@@ -70,7 +70,7 @@
bdcpy(addr.address, evt_data->remote_addr);
- HAL_CBACK(bt_mce_callbacks, remote_mas_instances_cb, evt_data->status, &addr, evt_data->num_mas, insts);
+ HAL_CBACK(bt_mce_callbacks, remote_mas_instances_cb, (bt_status_t)evt_data->status, &addr, evt_data->num_mas, insts);
}
static void mas_discovery_comp_copy_cb(UINT16 event, char *p_dest, char *p_src)
diff --git a/btif/src/btif_media_task.c b/btif/src/btif_media_task.cc
similarity index 98%
rename from btif/src/btif_media_task.c
rename to btif/src/btif_media_task.cc
index da1085b..5ccc57d 100644
--- a/btif/src/btif_media_task.c
+++ b/btif/src/btif_media_task.cc
@@ -443,7 +443,7 @@
return ((UINT64)ts_now.tv_sec * USEC_PER_SEC) + ((UINT64)ts_now.tv_nsec / 1000);
}
-static void log_tstamps_us(char *comment, uint64_t timestamp_us)
+static void log_tstamps_us(const char *comment, uint64_t timestamp_us)
{
static UINT64 prev_us = 0;
const UINT64 now_us = timestamp_us;
@@ -1017,7 +1017,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_clear_track(void)
{
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = BTIF_MEDIA_AUDIO_SINK_CLEAR_TRACK;
fixed_queue_enqueue(btif_media_cmd_msg_queue, p_buf);
@@ -1037,7 +1037,7 @@
void btif_reset_decoder(UINT8 *p_av)
{
- tBTIF_MEDIA_SINK_CFG_UPDATE *p_buf =
+ tBTIF_MEDIA_SINK_CFG_UPDATE *p_buf = (tBTIF_MEDIA_SINK_CFG_UPDATE *)
osi_malloc(sizeof(tBTIF_MEDIA_SINK_CFG_UPDATE));
APPL_TRACE_EVENT("btif_reset_decoder");
@@ -1419,7 +1419,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_send_cmd_evt(UINT16 Evt)
{
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = Evt;
fixed_queue_enqueue(btif_media_cmd_msg_queue, p_buf);
@@ -1578,7 +1578,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_enc_init_req(tBTIF_MEDIA_INIT_AUDIO *p_msg)
{
- tBTIF_MEDIA_INIT_AUDIO *p_buf = osi_malloc(sizeof(tBTIF_MEDIA_INIT_AUDIO));
+ tBTIF_MEDIA_INIT_AUDIO *p_buf = (tBTIF_MEDIA_INIT_AUDIO *)osi_malloc(sizeof(tBTIF_MEDIA_INIT_AUDIO));
memcpy(p_buf, p_msg, sizeof(tBTIF_MEDIA_INIT_AUDIO));
p_buf->hdr.event = BTIF_MEDIA_SBC_ENC_INIT;
@@ -1598,7 +1598,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_enc_update_req(tBTIF_MEDIA_UPDATE_AUDIO *p_msg)
{
- tBTIF_MEDIA_UPDATE_AUDIO *p_buf =
+ tBTIF_MEDIA_UPDATE_AUDIO *p_buf = (tBTIF_MEDIA_UPDATE_AUDIO *)
osi_malloc(sizeof(tBTIF_MEDIA_UPDATE_AUDIO));
memcpy(p_buf, p_msg, sizeof(tBTIF_MEDIA_UPDATE_AUDIO));
@@ -1619,7 +1619,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_audio_feeding_init_req(tBTIF_MEDIA_INIT_AUDIO_FEEDING *p_msg)
{
- tBTIF_MEDIA_INIT_AUDIO_FEEDING *p_buf =
+ tBTIF_MEDIA_INIT_AUDIO_FEEDING *p_buf = (tBTIF_MEDIA_INIT_AUDIO_FEEDING *)
osi_malloc(sizeof(tBTIF_MEDIA_INIT_AUDIO_FEEDING));
memcpy(p_buf, p_msg, sizeof(tBTIF_MEDIA_INIT_AUDIO_FEEDING));
@@ -1640,7 +1640,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_start_aa_req(void)
{
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = BTIF_MEDIA_START_AA_TX;
fixed_queue_enqueue(btif_media_cmd_msg_queue, p_buf);
@@ -1659,7 +1659,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_stop_aa_req(void)
{
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = BTIF_MEDIA_STOP_AA_TX;
@@ -1692,7 +1692,7 @@
if (fixed_queue_is_empty(btif_media_cb.RxSbcQ)) /* Que is already empty */
return TRUE;
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = BTIF_MEDIA_FLUSH_AA_RX;
fixed_queue_enqueue(btif_media_cmd_msg_queue, p_buf);
@@ -1710,7 +1710,7 @@
*******************************************************************************/
BOOLEAN btif_media_task_aa_tx_flush_req(void)
{
- BT_HDR *p_buf = osi_malloc(sizeof(BT_HDR));
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(sizeof(BT_HDR));
p_buf->event = BTIF_MEDIA_FLUSH_AA_TX;
@@ -2548,7 +2548,7 @@
BT_HDR *btif_media_aa_readbuf(void)
{
uint64_t now_us = time_now_us();
- BT_HDR *p_buf = fixed_queue_try_dequeue(btif_media_cb.TxAaQ);
+ BT_HDR *p_buf = (BT_HDR *)fixed_queue_try_dequeue(btif_media_cb.TxAaQ);
btif_media_cb.stats.tx_queue_total_readbuf_calls++;
btif_media_cb.stats.tx_queue_last_readbuf_us = now_us;
@@ -2753,7 +2753,7 @@
btif_media_cb.encoder.s16NumOfBlocks;
while (nb_frame) {
- BT_HDR *p_buf = osi_malloc(BTIF_MEDIA_AA_BUF_SIZE);
+ BT_HDR *p_buf = (BT_HDR *)osi_malloc(BTIF_MEDIA_AA_BUF_SIZE);
/* Init buffer */
p_buf->offset = BTIF_MEDIA_AA_SBC_OFFSET;
diff --git a/btif/src/btif_pan.c b/btif/src/btif_pan.cc
similarity index 99%
rename from btif/src/btif_pan.c
rename to btif/src/btif_pan.cc
index 4c5b4f1..5108fd7 100644
--- a/btif/src/btif_pan.c
+++ b/btif/src/btif_pan.cc
@@ -699,7 +699,7 @@
{
int btpan_conn_local_role = bta_role_to_btpan(conn->local_role);
int btpan_remote_role = bta_role_to_btpan(conn->remote_role);
- callback.connection_state_cb(BTPAN_STATE_DISCONNECTED, 0, (const bt_bdaddr_t*)conn->peer,
+ callback.connection_state_cb(BTPAN_STATE_DISCONNECTED, (bt_status_t)0, (const bt_bdaddr_t*)conn->peer,
btpan_conn_local_role, btpan_remote_role);
btpan_cleanup_conn(conn);
}
diff --git a/btif/src/btif_profile_queue.c b/btif/src/btif_profile_queue.cc
similarity index 96%
rename from btif/src/btif_profile_queue.c
rename to btif/src/btif_profile_queue.cc
index cb01dc7..0dbecd5 100644
--- a/btif/src/btif_profile_queue.c
+++ b/btif/src/btif_profile_queue.cc
@@ -81,7 +81,7 @@
}
}
- connect_node_t *p_node = osi_malloc(sizeof(connect_node_t));
+ connect_node_t *p_node = (connect_node_t *)osi_malloc(sizeof(connect_node_t));
memcpy(p_node, p_param, sizeof(connect_node_t));
list_append(connect_queue, p_node);
}
@@ -148,7 +148,7 @@
if (!connect_queue || list_is_empty(connect_queue))
return BT_STATUS_FAIL;
- connect_node_t *p_head = list_front(connect_queue);
+ connect_node_t *p_head = (connect_node_t *)list_front(connect_queue);
// If the queue is currently busy, we return success anyway,
// since the connection has been queued...
diff --git a/btif/src/btif_rc.c b/btif/src/btif_rc.cc
similarity index 98%
rename from btif/src/btif_rc.c
rename to btif/src/btif_rc.cc
index 9bc57fd..f378db9 100644
--- a/btif/src/btif_rc.c
+++ b/btif/src/btif_rc.cc
@@ -208,7 +208,7 @@
static int send_event (int fd, uint16_t type, uint16_t code, int32_t value);
static void send_key (int fd, uint16_t key, int pressed);
static int uinput_driver_check();
-static int uinput_create(char *name);
+static int uinput_create(const char *name);
static int init_uinput (void);
static void close_uinput (void);
static void sleep_ms(period_ms_t timeout_ms);
@@ -348,7 +348,7 @@
return -1;
}
-int uinput_create(char *name)
+int uinput_create(const char *name)
{
struct uinput_dev dev;
int fd, x = 0;
@@ -396,7 +396,7 @@
int init_uinput (void)
{
- char *name = "AVRCP";
+ const char *name = "AVRCP";
BTIF_TRACE_DEBUG("%s", __FUNCTION__);
uinput_fd = uinput_create(name);
@@ -483,20 +483,20 @@
if (btif_rc_cb.rc_features & BTA_AV_FEAT_BROWSE)
{
- rc_features |= BTRC_FEAT_BROWSE;
+ rc_features = (btrc_remote_features_t)(rc_features | BTRC_FEAT_BROWSE);
}
#if (AVRC_ADV_CTRL_INCLUDED == TRUE)
if ( (btif_rc_cb.rc_features & BTA_AV_FEAT_ADV_CTRL) &&
(btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG))
{
- rc_features |= BTRC_FEAT_ABSOLUTE_VOLUME;
+ rc_features = (btrc_remote_features_t)(rc_features | BTRC_FEAT_ABSOLUTE_VOLUME);
}
#endif
if (btif_rc_cb.rc_features & BTA_AV_FEAT_METADATA)
{
- rc_features |= BTRC_FEAT_METADATA;
+ rc_features = (btrc_remote_features_t)(rc_features | BTRC_FEAT_METADATA);
}
BTIF_TRACE_DEBUG("%s: rc_features=0x%x", __FUNCTION__, rc_features);
@@ -582,7 +582,7 @@
handle_rc_features(btif_rc_cb.rc_addr);
if (bt_rc_callbacks)
{
- result = uinput_driver_check();
+ result = (bt_status_t)uinput_driver_check();
if (result == BT_STATUS_SUCCESS)
{
init_uinput();
@@ -1385,7 +1385,7 @@
num_attr = BTRC_MAX_ELEM_ATTR_SIZE;
for (attr_cnt = 0; attr_cnt < BTRC_MAX_ELEM_ATTR_SIZE; attr_cnt++)
{
- element_attrs[attr_cnt] = attr_cnt + 1;
+ element_attrs[attr_cnt] = (btrc_media_attr_t)(attr_cnt + 1);
}
}
else if (pavrc_cmd->get_elem_attrs.num_attr == 0xFF)
@@ -1419,7 +1419,7 @@
}
if (filled_attr_count == num_attr)
{
- element_attrs[num_attr] = pavrc_cmd->get_elem_attrs.attrs[attr_cnt];
+ element_attrs[num_attr] = (btrc_media_attr_t)pavrc_cmd->get_elem_attrs.attrs[attr_cnt];
num_attr++;
}
}
@@ -1441,7 +1441,7 @@
btif_rc_cb.rc_notif[BTRC_EVT_PLAY_POS_CHANGED - 1].bNotify = FALSE;
return;
}
- HAL_CBACK(bt_rc_callbacks, register_notification_cb, pavrc_cmd->reg_notif.event_id,
+ HAL_CBACK(bt_rc_callbacks, register_notification_cb, (btrc_event_id_t)pavrc_cmd->reg_notif.event_id,
pavrc_cmd->reg_notif.param);
}
break;
@@ -1772,7 +1772,7 @@
{
status=BT_STATUS_DONE;
BTIF_TRACE_ERROR("%s: volume value already set earlier: 0x%02x",__FUNCTION__, volume);
- return status;
+ return (bt_status_t)status;
}
if ((btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG) &&
@@ -1814,7 +1814,7 @@
}
else
status=BT_STATUS_NOT_READY;
- return status;
+ return (bt_status_t)status;
}
#if (AVRC_ADV_CTRL_INCLUDED == TRUE)
@@ -2342,7 +2342,7 @@
list_append(btif_rc_cb.rc_supported_event_list, p_event);
}
}
- p_event = list_front(btif_rc_cb.rc_supported_event_list);
+ p_event = (btif_rc_supported_event_t*)list_front(btif_rc_cb.rc_supported_event_list);
if (p_event != NULL)
{
register_for_event_notification(p_event);
@@ -2425,7 +2425,7 @@
rc_start_play_status_timer();
}
HAL_CBACK(bt_rc_ctrl_callbacks, play_status_changed_cb,
- &rc_addr, p_rsp->param.play_status);
+ &rc_addr, (btrc_play_status_t)p_rsp->param.play_status);
break;
case AVRC_EVT_TRACK_CHANGE:
@@ -2538,7 +2538,7 @@
rc_stop_play_status_timer();
}
HAL_CBACK(bt_rc_ctrl_callbacks, play_status_changed_cb,
- &rc_addr, p_rsp->param.play_status);
+ &rc_addr, (btrc_play_status_t)p_rsp->param.play_status);
break;
case AVRC_EVT_TRACK_CHANGE:
@@ -3320,7 +3320,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3369,7 +3369,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3417,7 +3417,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3472,7 +3472,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3530,7 +3530,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3587,7 +3587,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3647,7 +3647,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3698,7 +3698,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3761,7 +3761,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3814,7 +3814,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
@@ -3863,7 +3863,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3910,7 +3910,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __func__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -3962,7 +3962,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
/***************************************************************************
@@ -4006,7 +4006,7 @@
#else
BTIF_TRACE_DEBUG("%s: feature not enabled", __FUNCTION__);
#endif
- return status;
+ return (bt_status_t)status;
}
static const btrc_interface_t bt_rc_interface = {
diff --git a/btif/src/btif_sdp.c b/btif/src/btif_sdp.cc
similarity index 98%
rename from btif/src/btif_sdp.c
rename to btif/src/btif_sdp.cc
index 21cf684..ef4ebab 100644
--- a/btif/src/btif_sdp.c
+++ b/btif/src/btif_sdp.cc
@@ -71,7 +71,7 @@
bdcpy(addr.address, evt_data->remote_addr);
- HAL_CBACK(bt_sdp_callbacks, sdp_search_cb, evt_data->status,
+ HAL_CBACK(bt_sdp_callbacks, sdp_search_cb, (bt_status_t)evt_data->status,
&addr, (uint8_t*)(evt_data->uuid.uu.uuid128),
evt_data->record_count, evt_data->records);
}
diff --git a/btif/src/btif_sdp_server.c b/btif/src/btif_sdp_server.cc
similarity index 99%
rename from btif/src/btif_sdp_server.c
rename to btif/src/btif_sdp_server.cc
index d02dfa0..90b1798 100644
--- a/btif/src/btif_sdp_server.c
+++ b/btif/src/btif_sdp_server.cc
@@ -187,7 +187,7 @@
static int alloc_sdp_slot(bluetooth_sdp_record* in_record) {
int i;
int record_size = get_sdp_records_size(in_record, 1);
- bluetooth_sdp_record* record = osi_malloc(record_size);
+ bluetooth_sdp_record* record = (bluetooth_sdp_record*)osi_malloc(record_size);
copy_sdp_records(in_record, record, 1);
diff --git a/btif/src/btif_sm.c b/btif/src/btif_sm.cc
similarity index 100%
rename from btif/src/btif_sm.c
rename to btif/src/btif_sm.cc
diff --git a/btif/src/btif_sock.c b/btif/src/btif_sock.cc
similarity index 98%
rename from btif/src/btif_sock.c
rename to btif/src/btif_sock.cc
index 3b43545..42747c4 100644
--- a/btif/src/btif_sock.c
+++ b/btif/src/btif_sock.cc
@@ -57,6 +57,7 @@
assert(thread_handle == -1);
assert(thread == NULL);
+ bt_status_t status;
btsock_thread_init();
thread_handle = btsock_thread_create(btsock_signaled, NULL);
if (thread_handle == -1) {
@@ -64,7 +65,7 @@
goto error;
}
- bt_status_t status = btsock_rfc_init(thread_handle, uid_set);
+ status = btsock_rfc_init(thread_handle, uid_set);
if (status != BT_STATUS_SUCCESS) {
LOG_ERROR(LOG_TAG, "%s error initializing RFCOMM sockets: %d", __func__, status);
goto error;
diff --git a/btif/src/btif_sock_l2cap.c b/btif/src/btif_sock_l2cap.cc
similarity index 98%
rename from btif/src/btif_sock_l2cap.c
rename to btif/src/btif_sock_l2cap.cc
index 9c1b26f..5438405 100644
--- a/btif/src/btif_sock_l2cap.c
+++ b/btif/src/btif_sock_l2cap.cc
@@ -135,8 +135,8 @@
static struct packet *packet_alloc(const uint8_t *data, uint32_t len)
{
- struct packet *p = osi_calloc(sizeof(*p));
- uint8_t *buf = osi_malloc(len);
+ struct packet *p = (struct packet *)osi_calloc(sizeof(*p));
+ uint8_t *buf = (uint8_t *)osi_malloc(len);
p->data = buf;
p->len = len;
@@ -299,7 +299,7 @@
{
unsigned security = 0;
int fds[2];
- l2cap_socket *sock = osi_calloc(sizeof(*sock));
+ l2cap_socket *sock = (l2cap_socket*) osi_calloc(sizeof(*sock));
if (flags & BTSOCK_FLAG_ENCRYPT)
security |= is_server ? BTM_SEC_IN_ENCRYPT : BTM_SEC_OUT_ENCRYPT;
@@ -1034,7 +1034,7 @@
if (!(flags & SOCK_THREAD_FD_EXCEPTION) || (ioctl(sock->our_fd, FIONREAD, &size)
== 0 && size)) {
- uint8_t *buffer = osi_malloc(L2CAP_MAX_SDU_LENGTH);
+ uint8_t *buffer = (uint8_t*) osi_malloc(L2CAP_MAX_SDU_LENGTH);
/* Apparently we hijack the req_id (UINT32) to pass the pointer to the buffer to
* the write complete callback, which call a free... wonder if this works on a
* 64 bit platform? */
diff --git a/btif/src/btif_sock_rfc.c b/btif/src/btif_sock_rfc.cc
similarity index 98%
rename from btif/src/btif_sock_rfc.c
rename to btif/src/btif_sock_rfc.cc
index a2ecac0..89a1f19 100644
--- a/btif/src/btif_sock_rfc.c
+++ b/btif/src/btif_sock_rfc.cc
@@ -107,6 +107,8 @@
return pth != -1;
}
+extern "C" int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);
+
bt_status_t btsock_rfc_init(int poll_thread_handle, uid_set_t* set) {
pth = poll_thread_handle;
uid_set = set;
@@ -314,7 +316,7 @@
out:;
pthread_mutex_unlock(&slot_lock);
- return status;
+ return (bt_status_t)status;
}
bt_status_t btsock_rfc_connect(const bt_bdaddr_t *bd_addr, const uint8_t *service_uuid, int channel, int *sock_fd, int flags, int app_uid) {
@@ -373,7 +375,7 @@
out:;
pthread_mutex_unlock(&slot_lock);
- return status;
+ return (bt_status_t)status;
}
static int create_server_sdp_record(rfc_slot_t *slot) {
@@ -488,11 +490,13 @@
uint32_t new_listen_slot_id = 0;
pthread_mutex_lock(&slot_lock);
+ rfc_slot_t *accept_rs;
+
rfc_slot_t *srv_rs = find_rfc_slot_by_id(id);
if (!srv_rs)
goto out;
- rfc_slot_t *accept_rs = create_srv_accept_rfc_slot(srv_rs, (const bt_bdaddr_t *)p_open->rem_bda, p_open->handle, p_open->new_listen_handle);
+ accept_rs = create_srv_accept_rfc_slot(srv_rs, (const bt_bdaddr_t *)p_open->rem_bda, p_open->handle, p_open->new_listen_handle);
if (!accept_rs)
goto out;
@@ -765,7 +769,7 @@
static bool flush_incoming_que_on_wr_signal(rfc_slot_t *slot) {
while (!list_is_empty(slot->incoming_queue)) {
- BT_HDR *p_buf = list_front(slot->incoming_queue);
+ BT_HDR *p_buf = (BT_HDR *)list_front(slot->incoming_queue);
switch (send_data_to_app(slot->fd, p_buf)) {
case SENT_NONE:
case SENT_PARTIAL:
@@ -787,7 +791,6 @@
//fix me: need a jv flow control api to serialize the call in stack
APPL_TRACE_DEBUG("enable data flow, rfc_handle:0x%x, rfc_port_handle:0x%x, user_id:%d",
slot->rfc_handle, slot->rfc_port_handle, slot->id);
- extern int PORT_FlowControl_MaxCredit(uint16_t handle, bool enable);
PORT_FlowControl_MaxCredit(slot->rfc_port_handle, true);
return true;
}
@@ -795,12 +798,12 @@
void btsock_rfc_signaled(UNUSED_ATTR int fd, int flags, uint32_t user_id) {
pthread_mutex_lock(&slot_lock);
+ bool need_close = false;
+
rfc_slot_t *slot = find_rfc_slot_by_id(user_id);
if (!slot)
goto out;
- bool need_close = false;
-
// Data available from app, tell stack we have outgoing data.
if (flags & SOCK_THREAD_FD_RD && !slot->f.server) {
if (slot->f.connected) {
@@ -908,11 +911,12 @@
uint32_t id = (uintptr_t)user_data;
int ret = false;
+ int received;
rfc_slot_t *slot = find_rfc_slot_by_id(id);
if (!slot)
goto out;
- int received = recv(slot->fd, buf, size, 0);
+ received = recv(slot->fd, buf, size, 0);
if(received == size) {
ret = true;
} else {
diff --git a/btif/src/btif_sock_sco.c b/btif/src/btif_sock_sco.cc
similarity index 96%
rename from btif/src/btif_sock_sco.c
rename to btif/src/btif_sock_sco.cc
index 4f3699f..c68a6ff 100644
--- a/btif/src/btif_sock_sco.c
+++ b/btif/src/btif_sock_sco.cc
@@ -142,6 +142,8 @@
static sco_socket_t *sco_socket_establish_locked(bool is_listening, const bt_bdaddr_t *bd_addr, int *sock_fd) {
int pair[2] = { INVALID_FD, INVALID_FD };
sco_socket_t *sco_socket = NULL;
+ socket_t *socket = NULL;
+ tBTM_STATUS status;
if (socketpair(AF_LOCAL, SOCK_STREAM, 0, pair) == -1) {
LOG_ERROR(LOG_TAG, "%s unable to allocate socket pair: %s", __func__, strerror(errno));
@@ -154,13 +156,13 @@
goto error;
}
- tBTM_STATUS status = BTM_CreateSco((uint8_t *)bd_addr, !is_listening, sco_parameters.packet_types, &sco_socket->sco_handle, connect_completed_cb, disconnect_completed_cb);
+ status = BTM_CreateSco((uint8_t *)bd_addr, !is_listening, sco_parameters.packet_types, &sco_socket->sco_handle, connect_completed_cb, disconnect_completed_cb);
if (status != BTM_CMD_STARTED) {
LOG_ERROR(LOG_TAG, "%s unable to create SCO socket: %d", __func__, status);
goto error;
}
- socket_t *socket = socket_new_from_fd(pair[1]);
+ socket = socket_new_from_fd(pair[1]);
if (!socket) {
LOG_ERROR(LOG_TAG, "%s unable to allocate socket from file descriptor %d.", __func__, pair[1]);
goto error;
@@ -224,6 +226,9 @@
sco_socket_t *sco_socket = sco_socket_find_locked(conn_data->sco_inx);
int client_fd = INVALID_FD;
+ uint16_t temp;
+ sco_socket_t *new_sco_socket;
+
if (!sco_socket) {
LOG_ERROR(LOG_TAG, "%s unable to find sco_socket for handle: %hu", __func__, conn_data->sco_inx);
goto error;
@@ -234,14 +239,14 @@
goto error;
}
- sco_socket_t *new_sco_socket = sco_socket_establish_locked(true, NULL, &client_fd);
+ new_sco_socket = sco_socket_establish_locked(true, NULL, &client_fd);
if (!new_sco_socket) {
LOG_ERROR(LOG_TAG, "%s unable to allocate new sco_socket.", __func__);
goto error;
}
// Swap socket->sco_handle and new_socket->sco_handle
- uint16_t temp = sco_socket->sco_handle;
+ temp = sco_socket->sco_handle;
sco_socket->sco_handle = new_sco_socket->sco_handle;
new_sco_socket->sco_handle = temp;
diff --git a/btif/src/btif_sock_sdp.c b/btif/src/btif_sock_sdp.cc
similarity index 97%
rename from btif/src/btif_sock_sdp.c
rename to btif/src/btif_sock_sdp.cc
index a1acaff..2cd328c 100644
--- a/btif/src/btif_sock_sdp.c
+++ b/btif/src/btif_sock_sdp.cc
@@ -126,7 +126,10 @@
proto_list[2].num_params = 0;
}
- char *stage = "protocol_list";
+ // Mark the service as browseable.
+ uint16_t list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
+
+ const char *stage = "protocol_list";
if (!SDP_AddProtocolList(sdp_handle, num_proto_elements, proto_list))
goto error;
@@ -139,8 +142,6 @@
goto error;
}
- // Mark the service as browseable.
- uint16_t list = UUID_SERVCLASS_PUBLIC_BROWSE_GROUP;
stage = "browseable";
if (!SDP_AddUuidSequence(sdp_handle, ATTR_ID_BROWSE_GROUP_LIST, 1, &list))
goto error;
@@ -171,11 +172,6 @@
return 0;
}
- // Create the base SDP record.
- char *stage = "create_base_record";
- if (!create_base_record(handle, name, channel, FALSE /* with_obex */))
- goto error;
-
// Convert the |uuid| into a big-endian representation and add it as a
// sequence.
uint8_t type = UUID_DESC_TYPE;
@@ -184,12 +180,18 @@
// Store the address of type buf in a pointer on the stack, so we can pass
// a double pointer to SDP_AddSequence
uint8_t *type_buf_ptr = type_buf;
+ uint8_t *tmp = type_buf;
+
+ // Create the base SDP record.
+ const char *stage = "create_base_record";
+ if (!create_base_record(handle, name, channel, FALSE /* with_obex */))
+ goto error;
+
// Do the conversion to big-endian -- tmp is only used to iterate through the
// UUID array in the macro and serves no other purpose as the conversion
// macros are not hygenic.
{
- uint8_t *tmp = type_buf;
ARRAY_TO_BE_STREAM(tmp, uuid, UUID_MAX_LENGTH);
}
@@ -221,13 +223,14 @@
return 0;
}
+ uint16_t service = UUID_SERVCLASS_PBAP_PSE;
+
// Create the base SDP record.
- char *stage = "create_base_record";
+ const char *stage = "create_base_record";
if (!create_base_record(handle, name, channel, TRUE /* with_obex */))
goto error;
// Add service class
- uint16_t service = UUID_SERVCLASS_PBAP_PSE;
stage = "service_class";
if (!SDP_AddServiceClassIdList(handle, 1, &service))
goto error;
@@ -270,14 +273,22 @@
return 0;
}
+ // Add sequence for supported types.
+ uint8_t desc_type[OBEX_PUSH_NUM_FORMATS];
+ uint8_t type_len[OBEX_PUSH_NUM_FORMATS];
+ uint8_t *type_value[OBEX_PUSH_NUM_FORMATS];
+ uint8_t j = 0;
+
+ uint16_t service = UUID_SERVCLASS_OBEX_OBJECT_PUSH;
+ tBTA_UTL_COD cod;
+
// Create the base SDP record.
- char *stage = "create_base_record";
+ const char *stage = "create_base_record";
if (!create_base_record(handle, name, channel, TRUE /* with_obex */))
goto error;
// Add service class.
stage = "service_class";
- uint16_t service = UUID_SERVCLASS_OBEX_OBJECT_PUSH;
if (!SDP_AddServiceClassIdList(handle, 1, &service))
goto error;
@@ -287,11 +298,6 @@
0x0100))
goto error;
- // Add sequence for supported types.
- uint8_t desc_type[OBEX_PUSH_NUM_FORMATS];
- uint8_t type_len[OBEX_PUSH_NUM_FORMATS];
- uint8_t *type_value[OBEX_PUSH_NUM_FORMATS];
- uint8_t j = 0;
for (int i = 0; i < OBEX_PUSH_NUM_FORMATS; i++) {
if ((BTUI_OPS_FORMATS >> i) & 1) {
@@ -307,7 +313,6 @@
goto error;
// Set class of device.
- tBTA_UTL_COD cod;
cod.service = BTM_COD_SERVICE_OBJ_TRANSFER;
stage = "class_of_device";
if (!utl_set_device_class(&cod, BTA_UTL_SET_COD_SERVICE_CLASS))
@@ -340,11 +345,12 @@
}
// Create the base SDP record.
- char *stage = "create_base_record";
+ const char *stage = "create_base_record";
+ uint16_t service = UUID_SERVCLASS_SERIAL_PORT;
+
if (!create_base_record(handle, name, channel, FALSE /* with_obex */))
goto error;
- uint16_t service = UUID_SERVCLASS_SERIAL_PORT;
stage = "service_class";
if (!SDP_AddServiceClassIdList(handle, 1, &service))
goto error;
diff --git a/btif/src/btif_sock_thread.c b/btif/src/btif_sock_thread.cc
similarity index 100%
rename from btif/src/btif_sock_thread.c
rename to btif/src/btif_sock_thread.cc
diff --git a/btif/src/btif_sock_util.c b/btif/src/btif_sock_util.cc
similarity index 100%
rename from btif/src/btif_sock_util.c
rename to btif/src/btif_sock_util.cc
diff --git a/btif/src/btif_storage.c b/btif/src/btif_storage.cc
similarity index 99%
rename from btif/src/btif_storage.c
rename to btif/src/btif_storage.cc
index 791203f..7bfa200 100644
--- a/btif/src/btif_storage.c
+++ b/btif/src/btif_storage.cc
@@ -758,7 +758,7 @@
{
bt_property_t addr_prop;
memcpy(&addr_prop, &properties[i], sizeof(bt_property_t));
- addr_prop.type = BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP;
+ addr_prop.type = (bt_property_type_t) BT_PROPERTY_REMOTE_DEVICE_TIMESTAMP;
btif_storage_set_remote_device_property(remote_bd_addr,
&addr_prop);
}
diff --git a/btif/src/btif_uid.c b/btif/src/btif_uid.cc
similarity index 93%
rename from btif/src/btif_uid.c
rename to btif/src/btif_uid.cc
index 0a7f378..054d505 100644
--- a/btif/src/btif_uid.c
+++ b/btif/src/btif_uid.cc
@@ -40,7 +40,7 @@
} uid_set_t;
uid_set_t* uid_set_create(void) {
- uid_set_t* set = osi_calloc(sizeof(uid_set_t));
+ uid_set_t* set = (uid_set_t*)osi_calloc(sizeof(uid_set_t));
pthread_mutex_init(&set->lock, NULL);
return set;
}
@@ -67,7 +67,7 @@
}
if (!node) {
- node = osi_calloc(sizeof(uid_set_node_t));
+ node = (uid_set_node_t*)osi_calloc(sizeof(uid_set_node_t));
node->data.app_uid = app_uid;
node->next = set->head;
set->head = node;
@@ -109,7 +109,7 @@
}
// Allocate an array of elements + 1, to signify the end with app_uid set to -1.
- bt_uid_traffic_t* result = osi_calloc(sizeof(bt_uid_traffic_t) * (len + 1));
+ bt_uid_traffic_t* result = (bt_uid_traffic_t*)osi_calloc(sizeof(bt_uid_traffic_t) * (len + 1));
bt_uid_traffic_t* data = result;
node = set->head;
diff --git a/btif/src/btif_util.c b/btif/src/btif_util.cc
similarity index 100%
rename from btif/src/btif_util.c
rename to btif/src/btif_util.cc
diff --git a/btif/src/stack_manager.c b/btif/src/stack_manager.cc
similarity index 98%
rename from btif/src/stack_manager.c
rename to btif/src/stack_manager.cc
index e132221..03bfb3f 100644
--- a/btif/src/stack_manager.c
+++ b/btif/src/stack_manager.cc
@@ -55,7 +55,7 @@
// Unvetted includes/imports, etc which should be removed or vetted in the future
static future_t *hack_future;
-void bte_main_enable();
+extern "C" void bte_main_enable();
void btif_thread_post(thread_fn func, void *context);
// End unvetted section
@@ -190,6 +190,9 @@
// Synchronous function to clean up the stack
static void event_clean_up_stack(void *context) {
+
+ future_t *local_hack_future;
+
if (!stack_is_initialized) {
LOG_INFO(LOG_TAG, "%s found the stack already in a clean state", __func__);
goto cleanup;
@@ -198,7 +201,7 @@
ensure_stack_is_not_running();
LOG_INFO(LOG_TAG, "%s is cleaning up the stack", __func__);
- future_t *local_hack_future = future_new();
+ local_hack_future = future_new();
hack_future = local_hack_future;
stack_is_initialized = false;
diff --git a/btif/test/btif_storage_test.cpp b/btif/test/btif_storage_test.cc
similarity index 100%
rename from btif/test/btif_storage_test.cpp
rename to btif/test/btif_storage_test.cc
diff --git a/build/BUILD.gn b/build/BUILD.gn
index 42b530c..81a89bc 100644
--- a/build/BUILD.gn
+++ b/build/BUILD.gn
@@ -59,6 +59,7 @@
# but we use some c++14 features. Uncomment when this get fixed in code.:
"-std=c++14",
"-fno-exceptions",
+ "-fpermissive",
]
defines = [
diff --git a/device/include/controller.h b/device/include/controller.h
index 291c33d..0856cf4 100644
--- a/device/include/controller.h
+++ b/device/include/controller.h
@@ -27,6 +27,10 @@
#include "hci_packet_factory.h"
#include "hci_packet_parser.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char CONTROLLER_MODULE[] = "controller_module";
typedef struct controller_t {
@@ -84,3 +88,7 @@
const hci_t *hci_interface,
const hci_packet_factory_t *packet_factory_interface,
const hci_packet_parser_t *packet_parser_interface);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/device/include/interop.h b/device/include/interop.h
index 76a83fc..32c0af3 100644
--- a/device/include/interop.h
+++ b/device/include/interop.h
@@ -22,6 +22,10 @@
#include "btcore/include/bdaddr.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char INTEROP_MODULE[] = "interop_module";
// NOTE:
@@ -80,3 +84,7 @@
// Clear the dynamic portion of the interoperability workaround database.
void interop_database_clear(void);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/hci/include/btsnoop.h b/hci/include/btsnoop.h
index 14fbf72..99415bc 100644
--- a/hci/include/btsnoop.h
+++ b/hci/include/btsnoop.h
@@ -22,6 +22,10 @@
#include "bt_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char BTSNOOP_MODULE[] = "btsnoop_module";
typedef struct btsnoop_t {
@@ -37,3 +41,7 @@
} btsnoop_t;
const btsnoop_t *btsnoop_get_interface(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/hci/include/btsnoop_mem.h b/hci/include/btsnoop_mem.h
index fd8c560..dc52865 100644
--- a/hci/include/btsnoop_mem.h
+++ b/hci/include/btsnoop_mem.h
@@ -22,6 +22,10 @@
#include "bt_types.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Callback invoked for each HCI packet.
// Highlander mode - there can be only one...
typedef void (*btsnoop_data_cb)(const uint16_t type, const uint8_t *p_data, const size_t len);
@@ -34,3 +38,7 @@
// is sent/received. Packets will be filtered and then
// forwarded to the |btsnoop_data_cb|.
void btsnoop_mem_capture(const BT_HDR *p_buf);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/hci/include/hci_audio.h b/hci/include/hci_audio.h
index 3eb1d61..f03b647 100644
--- a/hci/include/hci_audio.h
+++ b/hci/include/hci_audio.h
@@ -20,6 +20,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Audio state definitions.
typedef enum {
SCO_STATE_OFF = 0, // Audio is off.
@@ -38,3 +42,7 @@
// Set the audio state on the controller for SCO (PCM, WBS, ...) using the
// vendor library.
void set_audio_state(uint16_t handle, sco_codec_t codec, sco_state_t state);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/bt_trace.h b/include/bt_trace.h
index fea0c3c..2ed4393 100644
--- a/include/bt_trace.h
+++ b/include/bt_trace.h
@@ -18,6 +18,10 @@
#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char BTE_LOGMSG_MODULE[] = "bte_logmsg_module";
/* BTE tracing IDs for debug purposes */
@@ -414,3 +418,7 @@
extern UINT8 appl_trace_level;
void LogMsg (UINT32 trace_set_mask, const char *fmt_str, ...);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/main/BUILD.gn b/main/BUILD.gn
index 05bcb6f..c2029f9 100644
--- a/main/BUILD.gn
+++ b/main/BUILD.gn
@@ -17,7 +17,7 @@
shared_library("bluetooth.default") {
# HAL layer
sources = [
- "//btif/src/bluetooth.c",
+ "//btif/src/bluetooth.cc",
]
# platform specific
diff --git a/main/bte_main.c b/main/bte_main.c
index da36056..4f94b43 100644
--- a/main/bte_main.c
+++ b/main/bte_main.c
@@ -88,6 +88,10 @@
*******************************************************************************/
fixed_queue_t *btu_hci_msg_queue;
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/******************************************************************************
**
** Function bte_main_boot_entry
@@ -267,3 +271,7 @@
osi_free(p_msg);
}
}
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/alarm.h b/osi/include/alarm.h
index 9a4210c..e1089a4 100644
--- a/osi/include/alarm.h
+++ b/osi/include/alarm.h
@@ -21,6 +21,10 @@
#include <stdbool.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct alarm_t alarm_t;
typedef struct fixed_queue_t fixed_queue_t;
typedef struct thread_t thread_t;
@@ -118,3 +122,7 @@
// Dump alarm-related statistics and debug info to the |fd| file descriptor.
// The information is in user-readable text format. The |fd| must be valid.
void alarm_debug_dump(int fd);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/allocation_tracker.h b/osi/include/allocation_tracker.h
index b9fa594..65fe43b 100644
--- a/osi/include/allocation_tracker.h
+++ b/osi/include/allocation_tracker.h
@@ -22,6 +22,10 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct allocation_tracker_t allocation_tracker_t;
typedef uint8_t allocator_id_t;
@@ -55,3 +59,7 @@
// Get the full size for an allocation, taking into account the size of canaries.
size_t allocation_tracker_resize_for_canary(size_t size);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/allocator.h b/osi/include/allocator.h
index e746883..ff7a638 100644
--- a/osi/include/allocator.h
+++ b/osi/include/allocator.h
@@ -22,6 +22,10 @@
#include <stdint.h>
#include <stdlib.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef void *(*alloc_fn)(size_t size);
typedef void (*free_fn)(void *ptr);
@@ -46,3 +50,7 @@
// |p_ptr| is a pointer to the buffer pointer to be reset.
// |p_ptr| cannot be NULL.
void osi_free_and_reset(void **p_ptr);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/config.h b/osi/include/config.h
index d7c8ff9..970c0cc 100644
--- a/osi/include/config.h
+++ b/osi/include/config.h
@@ -18,6 +18,10 @@
#include <stdbool.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// The default section name to use if a key/value pair is not defined within
// a section.
#define CONFIG_DEFAULT_SECTION "Global"
@@ -134,3 +138,7 @@
// and special formatting in the original file will be lost. Neither |config| nor
// |filename| may be NULL.
bool config_save(const config_t *config, const char *filename);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/fixed_queue.h b/osi/include/fixed_queue.h
index 1fb1b4b..a125336 100644
--- a/osi/include/fixed_queue.h
+++ b/osi/include/fixed_queue.h
@@ -23,6 +23,10 @@
#include "osi/include/list.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct fixed_queue_t;
typedef struct fixed_queue_t fixed_queue_t;
typedef struct reactor_t reactor_t;
@@ -122,3 +126,7 @@
// Unregisters the dequeue ready callback for |queue| from whichever reactor
// it is registered with, if any. This function is idempotent.
void fixed_queue_unregister_dequeue(fixed_queue_t *queue);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/future.h b/osi/include/future.h
index d1bbd64..5fff56d 100644
--- a/osi/include/future.h
+++ b/osi/include/future.h
@@ -18,6 +18,10 @@
#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct future_t future_t;
#define FUTURE_SUCCESS ((void *)1)
@@ -39,3 +43,7 @@
// Waits for the |future| to be ready. Returns the value set in |future_ready|.
// Frees the future before return. |future| may not be NULL.
void *future_await(future_t *async_result);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/list.h b/osi/include/list.h
index a510178..9e7a9e3 100644
--- a/osi/include/list.h
+++ b/osi/include/list.h
@@ -3,6 +3,10 @@
#include <stdbool.h>
#include <stdlib.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct list_node_t;
typedef struct list_node_t list_node_t;
@@ -112,3 +116,7 @@
// Returns the value stored at the location pointed to by the iterator |node|.
// |node| must not equal the value returned by |list_end|.
void *list_node(const list_node_t *node);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/metrics.h b/osi/include/metrics.h
index 4855301..f0aee3c 100644
--- a/osi/include/metrics.h
+++ b/osi/include/metrics.h
@@ -20,6 +20,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef enum {
DEVICE_TYPE_UNKNOWN,
DEVICE_TYPE_BREDR,
@@ -95,3 +99,7 @@
// Writes the metrics, in human-readable protobuf format, into the descriptor
// |fd|. If |clear| is true, metrics events are cleared afterwards.
void metrics_print(int fd, bool clear);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/mutex.h b/osi/include/mutex.h
index 6b6a545..3d1b306 100644
--- a/osi/include/mutex.h
+++ b/osi/include/mutex.h
@@ -20,6 +20,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Mutex-related state init
void mutex_init(void);
@@ -31,3 +35,7 @@
// Unlock the global mutex
void mutex_global_unlock(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/osi.h b/osi/include/osi.h
index 8cdf808..ed8fc2a 100644
--- a/osi/include/osi.h
+++ b/osi/include/osi.h
@@ -21,6 +21,10 @@
#include <stdbool.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define UNUSED_ATTR __attribute__((unused))
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#define INVALID_FD (-1)
@@ -59,3 +63,7 @@
// No guarantees of distribution are made.
// Effort is made for this to come from a real random source.
int osi_rand(void);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/properties.h b/osi/include/properties.h
index bb3e61d..35c21e1 100644
--- a/osi/include/properties.h
+++ b/osi/include/properties.h
@@ -24,6 +24,10 @@
#include <cutils/properties.h>
#endif // defined(OS_GENERIC)
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Get value associated with key |key| into |value|.
// Returns the length of the value which will never be greater than
// PROPERTY_VALUE_MAX - 1 and will always be zero terminated.
@@ -35,3 +39,7 @@
// Write value of property associated with key |key| to |value|.
// Returns 0 on success, < 0 on failure
int osi_property_set(const char *key, const char *value);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/osi/include/ringbuffer.h b/osi/include/ringbuffer.h
index b81e742..6741384 100644
--- a/osi/include/ringbuffer.h
+++ b/osi/include/ringbuffer.h
@@ -20,6 +20,10 @@
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct ringbuffer_t ringbuffer_t;
// NOTE:
@@ -59,3 +63,7 @@
// Deletes |length| bytes from the ringbuffer starting from the head
// Return actual number of bytes deleted.
size_t ringbuffer_delete(ringbuffer_t *rb, size_t length);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/semaphore.h b/osi/include/semaphore.h
index 20932b2..822b9c1 100644
--- a/osi/include/semaphore.h
+++ b/osi/include/semaphore.h
@@ -20,6 +20,10 @@
#include <stdbool.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct semaphore_t;
typedef struct semaphore_t semaphore_t;
@@ -55,3 +59,7 @@
// The caller must not close the returned file descriptor. |semaphore| may not
// be NULL.
int semaphore_get_fd(const semaphore_t *semaphore);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/socket.h b/osi/include/socket.h
index 2833290..ac49921 100644
--- a/osi/include/socket.h
+++ b/osi/include/socket.h
@@ -23,6 +23,10 @@
#include <stdint.h>
#include <sys/types.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
typedef struct reactor_t reactor_t;
typedef struct socket_t socket_t;
typedef uint16_t port_t;
@@ -98,3 +102,7 @@
// Unregisters |socket| from whichever reactor it is registered with, if any. This
// function is idempotent.
void socket_unregister(socket_t *socket);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/thread.h b/osi/include/thread.h
index b77f726..88864ea 100644
--- a/osi/include/thread.h
+++ b/osi/include/thread.h
@@ -21,10 +21,15 @@
#include <stdbool.h>
#include <stdlib.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define THREAD_NAME_MAX 16
typedef struct reactor_t reactor_t;
typedef struct thread_t thread_t;
+
typedef void (*thread_fn)(void *context);
// Creates and starts a new thread with the given name. Only THREAD_NAME_MAX
@@ -73,3 +78,7 @@
// Returns the name of the given |thread|. |thread| may not be NULL.
const char *thread_name(const thread_t *thread);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/osi/include/wakelock.h b/osi/include/wakelock.h
index 658a205..c82d687 100644
--- a/osi/include/wakelock.h
+++ b/osi/include/wakelock.h
@@ -21,6 +21,10 @@
#include <stdbool.h>
#include <hardware/bluetooth.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Set the Bluetooth OS callouts to |callouts|.
// This function should be called when native kernel wakelocks are not used
// directly. If this function is not called, or |callouts| is NULL, then native
@@ -52,3 +56,7 @@
// Dump wakelock-related debug info to the |fd| file descriptor.
// The caller is responsible for closing the |fd|.
void wakelock_debug_dump(int fd);
+
+#ifdef __cplusplus
+}
+#endif
\ No newline at end of file
diff --git a/stack/include/bt_types.h b/stack/include/bt_types.h
index 34447b6..c193cf8 100644
--- a/stack/include/bt_types.h
+++ b/stack/include/bt_types.h
@@ -281,7 +281,7 @@
#define UINT24_TO_BE_STREAM(p, u24) {*(p)++ = (UINT8)((u24) >> 16); *(p)++ = (UINT8)((u24) >> 8); *(p)++ = (UINT8)(u24);}
#define UINT16_TO_BE_STREAM(p, u16) {*(p)++ = (UINT8)((u16) >> 8); *(p)++ = (UINT8)(u16);}
#define UINT8_TO_BE_STREAM(p, u8) {*(p)++ = (UINT8)(u8);}
-#define ARRAY_TO_BE_STREAM(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[ijk];}
+#define ARRAY_TO_BE_STREAM(p, a, len) {int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[ijk];}
#define ARRAY_TO_BE_STREAM_REVERSE(p, a, len) {register int ijk; for (ijk = 0; ijk < len; ijk++) *(p)++ = (UINT8) a[len - ijk - 1];}
#define BE_STREAM_TO_UINT8(u8, p) {u8 = (UINT8)(*(p)); (p) += 1;}
diff --git a/stack/include/sdp_api.h b/stack/include/sdp_api.h
index 16f2dbc..0081a10 100644
--- a/stack/include/sdp_api.h
+++ b/stack/include/sdp_api.h
@@ -21,6 +21,10 @@
#include "bt_target.h"
#include "sdpdefs.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*****************************************************************************
** Constants
*****************************************************************************/
@@ -676,4 +680,8 @@
*******************************************************************************/
BOOLEAN SDP_FindServiceUUIDInRec(tSDP_DISC_REC *p_rec, tBT_UUID *p_uuid);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* SDP_API_H */
diff --git a/udrv/include/uipc.h b/udrv/include/uipc.h
index 466e678..eeadee3 100644
--- a/udrv/include/uipc.h
+++ b/udrv/include/uipc.h
@@ -18,6 +18,10 @@
#ifndef UIPC_H
#define UIPC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#define UIPC_CH_ID_AV_CTRL 0
#define UIPC_CH_ID_AV_AUDIO 1
#define UIPC_CH_NUM 2
@@ -116,4 +120,8 @@
*******************************************************************************/
BOOLEAN UIPC_Ioctl(tUIPC_CH_ID ch_id, UINT32 request, void *param);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* UIPC_H */
diff --git a/utils/include/bt_utils.h b/utils/include/bt_utils.h
index fa397f9..9d49044 100644
--- a/utils/include/bt_utils.h
+++ b/utils/include/bt_utils.h
@@ -19,6 +19,10 @@
#ifndef BT_UTILS_H
#define BT_UTILS_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static const char BT_UTILS_MODULE[] = "bt_utils_module";
/*******************************************************************************
@@ -43,4 +47,9 @@
void raise_priority_a2dp(tHIGH_PRIORITY_TASK high_task);
void adjust_priority_a2dp(int start);
#define UNUSED(x) (void)(x)
+
+#ifdef __cplusplus
+}
+#endif
+
#endif /* BT_UTILS_H */