Loading system/btif/include/btif_common.h +16 −12 Original line number Diff line number Diff line Loading @@ -34,10 +34,12 @@ *******************************************************************************/ #define ASSERTC(cond, msg, val) \ do { \ if (!(cond)) { \ LOG_ERROR(LOG_TAG, "### ASSERT : %s %s line %d %s (%d) ###", __FILE__, \ __func__, __LINE__, msg, val); \ } __func__, __LINE__, (msg), (val)); \ } \ } while (0) /* Calculate start of event enumeration; id is top 8 bits of event */ #define BTIF_SIG_START(id) ((id) << 8) Loading Loading @@ -73,12 +75,14 @@ extern bt_callbacks_t* bt_hal_cbacks; #define HAL_CBACK(P_CB, P_CBACK, ...) \ do { \ if ((P_CB) && (P_CB)->P_CBACK) { \ BTIF_TRACE_API("HAL %s->%s", #P_CB, #P_CBACK); \ (P_CB)->P_CBACK(__VA_ARGS__); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ } } \ } while (0) /** * BTIF events for requests that require context switch to btif task Loading system/btif/include/btif_storage.h +5 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,11 @@ * Constants & Macros *******************************************************************************/ #define BTIF_STORAGE_FILL_PROPERTY(p_prop, t, l, p_v) \ (p_prop)->type = t; \ (p_prop)->len = l; \ (p_prop)->val = (p_v); do { \ (p_prop)->type = (t); \ (p_prop)->len = (l); \ (p_prop)->val = (p_v); \ } while (0) /******************************************************************************* * Functions Loading system/btif/src/btif_av.cc +10 −8 Original line number Diff line number Diff line Loading @@ -100,13 +100,15 @@ static alarm_t* av_open_on_rc_timer = NULL; /* both interface and media task needs to be ready to alloc incoming request */ #define CHECK_BTAV_INIT() \ do { \ if (((bt_av_src_callbacks == NULL) && (bt_av_sink_callbacks == NULL)) || \ (btif_av_cb.sm_handle == NULL)) { \ BTIF_TRACE_WARNING("%s: BTAV not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ BTIF_TRACE_EVENT("%s", __func__); \ } } \ } while (0) /* Helper macro to avoid code duplication in the state machine handlers */ #define CHECK_RC_EVENT(e, d) \ Loading system/btif/src/btif_gatt_client.cc +19 −15 Original line number Diff line number Diff line Loading @@ -69,20 +69,24 @@ extern const btgatt_callbacks_t* bt_gatt_callbacks; *******************************************************************************/ #define CLI_CBACK_IN_JNI(P_CBACK, ...) \ do { \ if (bt_gatt_callbacks && bt_gatt_callbacks->client->P_CBACK) { \ BTIF_TRACE_API("HAL bt_gatt_callbacks->client->%s", #P_CBACK); \ do_in_jni_thread(Bind(bt_gatt_callbacks->client->P_CBACK, __VA_ARGS__)); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ } } \ } while (0) #define CHECK_BTGATT_INIT() \ do { \ if (bt_gatt_callbacks == NULL) { \ LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ LOG_VERBOSE(LOG_TAG, "%s", __func__); \ } } \ } while (0) #define BLE_RESOLVE_ADDR_MSB \ 0x40 /* bit7, bit6 is 01 to be resolvable random \ Loading system/btif/src/btif_gatt_server.cc +9 −7 Original line number Diff line number Diff line Loading @@ -61,12 +61,14 @@ extern bt_status_t do_in_jni_thread(const base::Closure& task); ***********************************************************************************/ #define CHECK_BTGATT_INIT() \ do { \ if (bt_gatt_callbacks == NULL) { \ LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ LOG_VERBOSE(LOG_TAG, "%s", __func__); \ } } \ } while (0) /************************************************************************************ * Static variables Loading Loading
system/btif/include/btif_common.h +16 −12 Original line number Diff line number Diff line Loading @@ -34,10 +34,12 @@ *******************************************************************************/ #define ASSERTC(cond, msg, val) \ do { \ if (!(cond)) { \ LOG_ERROR(LOG_TAG, "### ASSERT : %s %s line %d %s (%d) ###", __FILE__, \ __func__, __LINE__, msg, val); \ } __func__, __LINE__, (msg), (val)); \ } \ } while (0) /* Calculate start of event enumeration; id is top 8 bits of event */ #define BTIF_SIG_START(id) ((id) << 8) Loading Loading @@ -73,12 +75,14 @@ extern bt_callbacks_t* bt_hal_cbacks; #define HAL_CBACK(P_CB, P_CBACK, ...) \ do { \ if ((P_CB) && (P_CB)->P_CBACK) { \ BTIF_TRACE_API("HAL %s->%s", #P_CB, #P_CBACK); \ (P_CB)->P_CBACK(__VA_ARGS__); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ } } \ } while (0) /** * BTIF events for requests that require context switch to btif task Loading
system/btif/include/btif_storage.h +5 −3 Original line number Diff line number Diff line Loading @@ -28,9 +28,11 @@ * Constants & Macros *******************************************************************************/ #define BTIF_STORAGE_FILL_PROPERTY(p_prop, t, l, p_v) \ (p_prop)->type = t; \ (p_prop)->len = l; \ (p_prop)->val = (p_v); do { \ (p_prop)->type = (t); \ (p_prop)->len = (l); \ (p_prop)->val = (p_v); \ } while (0) /******************************************************************************* * Functions Loading
system/btif/src/btif_av.cc +10 −8 Original line number Diff line number Diff line Loading @@ -100,13 +100,15 @@ static alarm_t* av_open_on_rc_timer = NULL; /* both interface and media task needs to be ready to alloc incoming request */ #define CHECK_BTAV_INIT() \ do { \ if (((bt_av_src_callbacks == NULL) && (bt_av_sink_callbacks == NULL)) || \ (btif_av_cb.sm_handle == NULL)) { \ BTIF_TRACE_WARNING("%s: BTAV not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ BTIF_TRACE_EVENT("%s", __func__); \ } } \ } while (0) /* Helper macro to avoid code duplication in the state machine handlers */ #define CHECK_RC_EVENT(e, d) \ Loading
system/btif/src/btif_gatt_client.cc +19 −15 Original line number Diff line number Diff line Loading @@ -69,20 +69,24 @@ extern const btgatt_callbacks_t* bt_gatt_callbacks; *******************************************************************************/ #define CLI_CBACK_IN_JNI(P_CBACK, ...) \ do { \ if (bt_gatt_callbacks && bt_gatt_callbacks->client->P_CBACK) { \ BTIF_TRACE_API("HAL bt_gatt_callbacks->client->%s", #P_CBACK); \ do_in_jni_thread(Bind(bt_gatt_callbacks->client->P_CBACK, __VA_ARGS__)); \ } else { \ ASSERTC(0, "Callback is NULL", 0); \ } } \ } while (0) #define CHECK_BTGATT_INIT() \ do { \ if (bt_gatt_callbacks == NULL) { \ LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ LOG_VERBOSE(LOG_TAG, "%s", __func__); \ } } \ } while (0) #define BLE_RESOLVE_ADDR_MSB \ 0x40 /* bit7, bit6 is 01 to be resolvable random \ Loading
system/btif/src/btif_gatt_server.cc +9 −7 Original line number Diff line number Diff line Loading @@ -61,12 +61,14 @@ extern bt_status_t do_in_jni_thread(const base::Closure& task); ***********************************************************************************/ #define CHECK_BTGATT_INIT() \ do { \ if (bt_gatt_callbacks == NULL) { \ LOG_WARN(LOG_TAG, "%s: BTGATT not initialized", __func__); \ return BT_STATUS_NOT_READY; \ } else { \ LOG_VERBOSE(LOG_TAG, "%s", __func__); \ } } \ } while (0) /************************************************************************************ * Static variables Loading