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 <stddef.h> 27 #include "bta_api.h" 28 #include "bta_sys.h" 29 #include "bta_mce_api.h" 30 #include "bta_mce_int.h" 31 32 /***************************************************************************** 33 ** Constants and types 34 *****************************************************************************/ 35 36 #if BTA_DYNAMIC_MEMORY == FALSE 37 tBTA_MCE_CB bta_mce_cb; 38 #endif 39 40 /* state machine action enumeration list */ 41 #define BTA_MCE_NUM_ACTIONS (BTA_MCE_MAX_INT_EVT & 0x00ff) 42 43 /* type for action functions */ 44 typedef void (*tBTA_MCE_ACTION)(tBTA_MCE_MSG *p_data); 45 46 /* action function list */ 47 const tBTA_MCE_ACTION bta_mce_action[] = 48 { 49 bta_mce_enable, /* BTA_MCE_API_ENABLE_EVT */ 50 bta_mce_get_remote_mas_instances, /* BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT */ 51 }; 52 53 /******************************************************************************* 54 ** 55 ** Function bta_mce_sm_execute 56 ** 57 ** Description State machine event handling function for MCE 58 ** 59 ** 60 ** Returns void 61 ** 62 *******************************************************************************/ bta_mce_sm_execute(BT_HDR * p_msg)63BOOLEAN bta_mce_sm_execute(BT_HDR *p_msg) 64 { 65 if(p_msg == NULL) return FALSE; 66 67 BOOLEAN ret = FALSE; 68 UINT16 action = (p_msg->event & 0x00ff); 69 70 /* execute action functions */ 71 if(action < BTA_MCE_NUM_ACTIONS) 72 { 73 (*bta_mce_action[action])((tBTA_MCE_MSG*)p_msg); 74 ret = TRUE; 75 } 76 77 return(ret); 78 } 79