1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
41
42
43
46
47
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
79
80
81
82
83
84
85
86
87
88
89
94
95
96
99
100
101
103
104
105
106
111
112
113
119
120
121
122
123
124
130
131
132
133
134
135
136
137
138
139
142
143
144
148
149
150
151
152
153
154
155
156
158
159
160
162
163
164
165
166
167
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
425
426
427
428
429
430
431
432
433
434
435
436
437
441
442
443
444
445
446
447
448
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
491
497
503
505
506
507
508
509
510
511
512
513
514
515
516
517
518
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
558
559
/* ... */
/* ... */
#include "bta/bta_api.h"
#include "bta/bta_sys.h"
#include "bta_dm_int.h"
#if (ESP_COEX_VSC_INCLUDED == TRUE)
#include "stack/btm_api.h"
#endif
#include "osi/allocator.h"
#include <string.h>
#ifdef CONFIG_ESP_COEX_ENABLED
#include "esp_coexist.h"
#endif
/* ... */
#if BTA_DYNAMIC_MEMORY == FALSE
tBTA_DM_CB bta_dm_cb;
tBTA_DM_SEARCH_CB bta_dm_search_cb;
tBTA_DM_DI_CB bta_dm_di_cb;/* ... */
#else
tBTA_DM_CB *bta_dm_cb_ptr;
tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr;
tBTA_DM_DI_CB *bta_dm_di_cb_ptr;
SemaphoreHandle_t deinit_semaphore;/* ... */
#endif
#define BTA_DM_NUM_ACTIONS (BTA_DM_MAX_EVT & 0x00ff)
typedef void (*tBTA_DM_ACTION)(tBTA_DM_MSG *p_data);
const tBTA_DM_ACTION bta_dm_action[BTA_DM_MAX_EVT] = {
bta_dm_enable,
bta_dm_disable,
bta_dm_set_dev_name,
bta_dm_get_dev_name,
#if (ESP_COEX_VSC_INCLUDED == TRUE)
bta_dm_cfg_coex_status,
#endif
bta_dm_send_vendor_hci,
#if (CLASSIC_BT_INCLUDED == TRUE)
bta_dm_config_eir,
bta_dm_set_page_timeout,
bta_dm_get_page_timeout,
bta_dm_set_acl_pkt_types,
#if (ENC_KEY_SIZE_CTRL_MODE != ENC_KEY_SIZE_CTRL_MODE_NONE)
bta_dm_set_min_enc_key_size,
#endif/* ... */
#endif
bta_dm_set_afh_channels,
#if (SDP_INCLUDED == TRUE)
bta_dm_read_rmt_name,
#endif
bta_dm_set_visibility,
bta_dm_acl_change,
bta_dm_add_device,
bta_dm_close_acl,
#if (SMP_INCLUDED == TRUE)
bta_dm_bond,
bta_dm_bond_cancel,
bta_dm_set_pin_type,
bta_dm_pin_reply, /* ... */
#endif
#if (BTA_DM_PM_INCLUDED == TRUE)
bta_dm_pm_btm_status,
bta_dm_pm_timer, /* ... */
#endif
#if (BTA_DM_QOS_INCLUDED == TRUE)
bta_dm_set_qos, /* ... */
#endif
#if (SMP_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED == TRUE)
bta_dm_confirm,
bta_dm_key_req, /* ... */
#endif
bta_dm_set_encryption, /* ... */
#endif
#if (BTM_OOB_INCLUDED == TRUE && SMP_INCLUDED == TRUE)
bta_dm_loc_oob,
bta_dm_oob_reply,
bta_dm_sc_oob_reply,
bta_dm_sc_create_oob_data,
bta_dm_ci_io_req_act,
bta_dm_ci_rmt_oob_act, /* ... */
#endif
#if BLE_INCLUDED == TRUE
#if SMP_INCLUDED == TRUE
bta_dm_add_blekey,
bta_dm_add_ble_device,
bta_dm_ble_passkey_reply,
bta_dm_ble_set_static_passkey,
bta_dm_ble_confirm_reply,
bta_dm_security_grant,/* ... */
#endif
bta_dm_ble_set_bg_conn_type,
bta_dm_ble_set_conn_params,
bta_dm_ble_set_conn_scan_params,
bta_dm_ble_set_scan_params,
bta_dm_ble_set_scan_fil_params,
bta_dm_ble_observe,
bta_dm_ble_scan,
bta_dm_ble_update_conn_params,
/* ... */
bta_dm_ble_set_rand_address,
bta_dm_ble_clear_rand_address,
/* ... */
bta_dm_ble_stop_advertising,
#if BLE_PRIVACY_SPT == TRUE
bta_dm_ble_config_local_privacy,
#endif
bta_dm_ble_config_local_icon,
bta_dm_ble_set_adv_params,
bta_dm_ble_set_adv_params_all,
bta_dm_ble_set_adv_config,
/* ... */
bta_dm_ble_set_adv_config_raw,
bta_dm_ble_set_scan_rsp,
/* ... */
bta_dm_ble_set_scan_rsp_raw,
bta_dm_ble_broadcast,
bta_dm_ble_set_data_length,
bta_dm_ble_set_long_adv,
#if BLE_ANDROID_CONTROLLER_SCAN_FILTER == TRUE
bta_dm_cfg_filter_cond,
bta_dm_scan_filter_param_setup,
bta_dm_enable_scan_filter, /* ... */
#endif
bta_dm_ble_multi_adv_enb,
bta_dm_ble_multi_adv_upd_param,
bta_dm_ble_multi_adv_data,
btm_dm_ble_multi_adv_disable,
bta_dm_ble_setup_storage,
bta_dm_ble_enable_batch_scan,
bta_dm_ble_disable_batch_scan,
bta_dm_ble_read_scan_reports,
bta_dm_ble_track_advertiser,
bta_dm_ble_get_energy_info,
bta_dm_ble_disconnect, /* ... */
#endif
bta_dm_enable_test_mode,
bta_dm_disable_test_mode,
bta_dm_execute_callback,
bta_dm_remove_all_acl,
bta_dm_remove_device,
bta_dm_ble_set_channels,
bta_dm_update_white_list,
bta_dm_clear_white_list,
bta_dm_ble_read_adv_tx_power,
bta_dm_read_rssi,
#if BLE_INCLUDED == TRUE
bta_dm_ble_update_duplicate_exceptional_list,
#endif
#if (BLE_50_FEATURE_SUPPORT == TRUE)
bta_dm_ble_gap_read_phy,
bta_dm_ble_gap_set_prefer_default_phy,
bta_dm_ble_gap_set_prefer_phy,
bta_dm_ble_gap_ext_adv_set_rand_addr,
bta_dm_ble_gap_ext_adv_set_params,
bta_dm_ble_gap_config_ext_adv_data_raw,
bta_dm_ble_gap_start_ext_adv,
bta_dm_ble_gap_ext_adv_set_remove,
bta_dm_ble_gap_ext_adv_set_clear,
bta_dm_ble_gap_periodic_adv_set_params,
bta_dm_ble_gap_periodic_adv_cfg_data_raw,
bta_dm_ble_gap_periodic_adv_enable,
bta_dm_ble_gap_periodic_adv_create_sync,
bta_dm_ble_gap_periodic_adv_sync_cancel,
bta_dm_ble_gap_periodic_adv_sync_terminate,
bta_dm_ble_gap_periodic_adv_add_dev_to_list,
bta_dm_ble_gap_periodic_adv_remove_dev_from_list,
bta_dm_ble_gap_periodic_adv_clear_dev,
bta_dm_ble_gap_set_ext_scan_params,
bta_dm_ble_gap_ext_scan,
bta_dm_ble_gap_set_prefer_ext_conn_params,
NULL,
bta_dm_ble_gap_dtm_enhance_tx_start,
bta_dm_ble_gap_dtm_enhance_rx_start, /* ... */
#endif
#if (BLE_FEAT_PERIODIC_ADV_SYNC_TRANSFER == TRUE)
bta_dm_ble_gap_periodic_adv_recv_enable,
bta_dm_ble_gap_periodic_adv_sync_trans,
bta_dm_ble_gap_periodic_adv_set_info_trans,
bta_dm_ble_gap_set_periodic_adv_sync_trans_params, /* ... */
#endif
#if BLE_INCLUDED == TRUE
bta_dm_ble_gap_dtm_tx_start,
bta_dm_ble_gap_dtm_rx_start,
bta_dm_ble_gap_dtm_stop,
bta_dm_ble_gap_clear_adv,
bta_dm_ble_gap_set_rpa_timeout,
bta_dm_ble_gap_add_dev_to_resolving_list,
bta_dm_ble_gap_set_privacy_mode,
bta_dm_ble_gap_set_csa_support, /* ... */
#endif
}{...};
enum {
BTA_DM_API_SEARCH,
BTA_DM_API_SEARCH_CANCEL,
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DISCOVER,
#endif
BTA_DM_INQUIRY_CMPL,
BTA_DM_REMT_NAME,
#if (SDP_INCLUDED == TRUE)
BTA_DM_SDP_RESULT,
#endif
BTA_DM_SEARCH_CMPL,
#if (SDP_INCLUDED == TRUE)
BTA_DM_FREE_SDP_DB,
#endif
BTA_DM_DISC_RESULT,
BTA_DM_SEARCH_RESULT,
BTA_DM_QUEUE_SEARCH,
#if (SDP_INCLUDED == TRUE)
BTA_DM_QUEUE_DISC,
#endif
BTA_DM_SEARCH_CLEAR_QUEUE,
BTA_DM_SEARCH_CANCEL_CMPL,
BTA_DM_SEARCH_CANCEL_NOTIFY,
#if (SDP_INCLUDED == TRUE)
BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL,
#endif
BTA_DM_DISC_RMT_NAME,
#if (SDP_INCLUDED == TRUE)
BTA_DM_API_DI_DISCOVER,
#endif
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
BTA_DM_CLOSE_GATT_CONN,
#endif
BTA_DM_SEARCH_NUM_ACTIONS
}{ ... };
const tBTA_DM_ACTION bta_dm_search_action[] = {
bta_dm_search_start,
bta_dm_search_cancel,
#if (SDP_INCLUDED == TRUE)
bta_dm_discover,
#endif
bta_dm_inq_cmpl,
bta_dm_rmt_name,
#if (SDP_INCLUDED == TRUE)
bta_dm_sdp_result,
#endif
bta_dm_search_cmpl,
#if (SDP_INCLUDED == TRUE)
bta_dm_free_sdp_db,
#endif
bta_dm_disc_result,
bta_dm_search_result,
bta_dm_queue_search,
#if (SDP_INCLUDED == TRUE)
bta_dm_queue_disc,
#endif
bta_dm_search_clear_queue,
bta_dm_search_cancel_cmpl,
bta_dm_search_cancel_notify,
#if (SDP_INCLUDED == TRUE)
bta_dm_search_cancel_transac_cmpl,
#endif
bta_dm_disc_rmt_name,
#if (SDP_INCLUDED == TRUE)
bta_dm_di_disc
#endif
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
, bta_dm_close_gatt_conn
#endif
}{...};
#define BTA_DM_SEARCH_IGNORE BTA_DM_SEARCH_NUM_ACTIONS
#define BTA_DM_SEARCH_ACTIONS 2
#define BTA_DM_SEARCH_NEXT_STATE 2
#define BTA_DM_SEARCH_NUM_COLS 3
const UINT8 bta_dm_search_idle_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
{BTA_DM_API_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
{BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_API_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#endif
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_FREE_SDP_DB, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#endif
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_API_DI_DISCOVER, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
{BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},/* ... */
#endif
}{...};
const UINT8 bta_dm_search_search_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
{BTA_DM_API_SEARCH_CANCEL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
{BTA_DM_INQUIRY_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
{BTA_DM_REMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
#endif
{BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}
#if BLE_INCLUDED == TRUE && SDP_INCLUDED == TRUE && BTA_GATT_INCLUDED == TRUE && GATTC_INCLUDED == TRUE
, {BTA_DM_CLOSE_GATT_CONN, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_ACTIVE}/* ... */
#endif
}{...};
const UINT8 bta_dm_search_search_cancelling_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
{BTA_DM_QUEUE_SEARCH, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
{BTA_DM_SEARCH_CLEAR_QUEUE, BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_CANCELLING},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_QUEUE_DISC, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
#endif
{BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},
{BTA_DM_SEARCH_CANCEL_TRANSAC_CMPL, BTA_DM_SEARCH_CANCEL_CMPL, BTA_DM_SEARCH_IDLE},/* ... */
#endif
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
#if BLE_INCLUDED == TRUE
, {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING}
#endif
}{...};
const UINT8 bta_dm_search_disc_active_st_table[][BTA_DM_SEARCH_NUM_COLS] = {
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
{BTA_DM_SEARCH_CANCEL_NOTIFY, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_CANCELLING},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
{BTA_DM_DISC_RMT_NAME, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#if (SDP_INCLUDED == TRUE)
{BTA_DM_SDP_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
#endif
{BTA_DM_SEARCH_CMPL, BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IDLE},
{BTA_DM_DISC_RESULT, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE},
{BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE}
#if BLE_INCLUDED == TRUE
, {BTA_DM_SEARCH_IGNORE, BTA_DM_SEARCH_IGNORE, BTA_DM_DISCOVER_ACTIVE}
#endif
}{...};
typedef const UINT8 (*tBTA_DM_ST_TBL)[BTA_DM_SEARCH_NUM_COLS];
const tBTA_DM_ST_TBL bta_dm_search_st_tbl[] = {
bta_dm_search_idle_st_table,
bta_dm_search_search_active_st_table,
bta_dm_search_search_cancelling_st_table,
bta_dm_search_disc_active_st_table
}{...};
/* ... */
void bta_dm_sm_disable(void)
{
bta_sys_deregister( BTA_ID_DM );
}{ ... }
void bta_dm_sm_deinit(void)
{
memset(&bta_dm_cb, 0, sizeof(tBTA_DM_CB));
memset(&bta_dm_search_cb, 0, sizeof(tBTA_DM_SEARCH_CB));
memset(&bta_dm_di_cb, 0, sizeof(tBTA_DM_DI_CB));
#if BTA_DYNAMIC_MEMORY
FREE_AND_RESET(bta_dm_cb_ptr);
FREE_AND_RESET(bta_dm_search_cb_ptr);
FREE_AND_RESET(bta_dm_di_cb_ptr);/* ... */
#endif
}{ ... }
/* ... */
BOOLEAN bta_dm_sm_execute(BT_HDR *p_msg)
{
UINT16 event = p_msg->event & 0x00ff;
APPL_TRACE_EVENT("bta_dm_sm_execute event:0x%x", event);
if (event < BTA_DM_NUM_ACTIONS) {
(*bta_dm_action[event])( (tBTA_DM_MSG *) p_msg);
}{...}
return TRUE;
}{ ... }
void BTA_DmCoexEventTrigger(uint32_t event)
{
switch(event) {
case BTA_COEX_EVT_SCAN_STARTED:
case BTA_COEX_EVT_SCAN_STOPPED:
case BTA_COEX_EVT_SNIFF_ENTER:
case BTA_COEX_EVT_SNIFF_EXIT:
case BTA_COEX_EVT_A2DP_PAUSED_ENTER:
case BTA_COEX_EVT_A2DP_PAUSED_EXIT:
case BTA_COEX_EVT_ACL_CONNECTED:
case BTA_COEX_EVT_ACL_DISCONNECTED:
break;...
case BTA_COEX_EVT_STREAMING_STARTED:
#if (ESP_COEX_VSC_INCLUDED == TRUE)
BTM_ConfigCoexStatus(BTM_COEX_OP_SET, BTM_COEX_TYPE_BT, BTM_COEX_BT_ST_A2DP_STREAMING);
BTM_ConfigCoexStatus(BTM_COEX_OP_CLEAR, BTM_COEX_TYPE_BT, BTM_COEX_BT_ST_A2DP_PAUSED);/* ... */
#endif
break;...
case BTA_COEX_EVT_STREAMING_STOPPED:
#if (ESP_COEX_VSC_INCLUDED == TRUE)
BTM_ConfigCoexStatus(BTM_COEX_OP_CLEAR, BTM_COEX_TYPE_BT, BTM_COEX_BT_ST_A2DP_STREAMING);
BTM_ConfigCoexStatus(BTM_COEX_OP_CLEAR, BTM_COEX_TYPE_BT, BTM_COEX_BT_ST_A2DP_PAUSED);/* ... */
#endif
break;...
default:
break;...
}{...}
}{ ... }
/* ... */
void bta_dm_search_sm_disable(void)
{
bta_sys_deregister( BTA_ID_DM_SEARCH );
}{ ... }
/* ... */
BOOLEAN bta_dm_search_sm_execute(BT_HDR *p_msg)
{
tBTA_DM_ST_TBL state_table;
UINT8 action;
int i;
APPL_TRACE_EVENT("bta_dm_search_sm_execute state:%d, event:0x%x",
bta_dm_search_cb.state, p_msg->event);
state_table = bta_dm_search_st_tbl[bta_dm_search_cb.state];
bta_dm_search_cb.state = state_table[p_msg->event & 0x00ff][BTA_DM_SEARCH_NEXT_STATE];
for (i = 0; i < BTA_DM_SEARCH_ACTIONS; i++) {
if ((action = state_table[p_msg->event & 0x00ff][i]) != BTA_DM_SEARCH_IGNORE) {
(*bta_dm_search_action[action])( (tBTA_DM_MSG *) p_msg);
}{...} else {
break;
}{...}
}{...}
return TRUE;
}{ ... }