1 /****************************************************************************** 2 * 3 * Copyright 2014 The Android Open Source Project 4 * Copyright 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 28 #include "bta_api.h" 29 #include "bta_mce_api.h" 30 #include "bta_mce_int.h" 31 #include "bta_sys.h" 32 33 /***************************************************************************** 34 * Constants and types 35 ****************************************************************************/ 36 37 tBTA_MCE_CB bta_mce_cb; 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 bta_mce_enable, /* BTA_MCE_API_ENABLE_EVT */ 48 bta_mce_get_remote_mas_instances, /* BTA_MCE_API_GET_REMOTE_MAS_INSTANCES_EVT 49 */ 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 ******************************************************************************/ bta_mce_sm_execute(BT_HDR * p_msg)62bool bta_mce_sm_execute(BT_HDR* p_msg) { 63 if (p_msg == NULL) return false; 64 65 bool ret = false; 66 uint16_t action = (p_msg->event & 0x00ff); 67 68 /* execute action functions */ 69 if (action < BTA_MCE_NUM_ACTIONS) { 70 (*bta_mce_action[action])((tBTA_MCE_MSG*)p_msg); 71 ret = true; 72 } 73 74 return (ret); 75 } 76