1 /****************************************************************************** 2 * 3 * Copyright (C) 2014 The Android Open Source Project 4 * Copyright (C) 2003-2012 Broadcom Corporation 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at: 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 ******************************************************************************/ 19 20 /****************************************************************************** 21 * 22 * This is the main implementation file for the BTA MCE I/F 23 * 24 ******************************************************************************/ 25 26 #include "bta_api.h" 27 #include "bta_sys.h" 28 #include "bta_mce_api.h" 29 #include "bta_mce_int.h" 30 31 /***************************************************************************** 32 ** Constants and types 33 *****************************************************************************/ 34 35 #if BTA_DYNAMIC_MEMORY == FALSE 36 tBTA_MCE_CB bta_mce_cb; 37 #endif 38 39 /* state machine action enumeration list */ 40 #define BTA_MCE_NUM_ACTIONS (BTA_MCE_MAX_INT_EVT & 0x00ff) 41 42 /* type for action functions */ 43 typedef void (*tBTA_MCE_ACTION)(tBTA_MCE_MSG *p_data); 44 45 /* action function list */ 46 const tBTA_MCE_ACTION bta_mce_action[] = 47 { 48 bta_mce_enable, /* BTA_MCE_API_ENABLE_EVT */ 49 bta_mce_get_remote_mas_instances, /* BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT */ 50 }; 51 52 /******************************************************************************* 53 ** 54 ** Function bta_mce_sm_execute 55 ** 56 ** Description State machine event handling function for MCE 57 ** 58 ** 59 ** Returns void 60 ** 61 *******************************************************************************/ 62 BOOLEAN bta_mce_sm_execute(BT_HDR *p_msg) 63 { 64 if(p_msg == NULL) return FALSE; 65 66 BOOLEAN ret = FALSE; 67 UINT16 action = (p_msg->event & 0x00ff); 68 69 /* execute action functions */ 70 if(action < BTA_MCE_NUM_ACTIONS) 71 { 72 (*bta_mce_action[action])((tBTA_MCE_MSG*)p_msg); 73 ret = TRUE; 74 } 75 76 return(ret); 77 } 78