1 /****************************************************************************** 2 * 3 * Copyright (C) 2014 The Android Open Source Project 4 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This is the main implementation file for the BTA MCE I/F 22 * 23 ******************************************************************************/ 24 25 #include <stdlib.h> 26 27 #include "bta_api.h" 28 #include "bta_sys.h" 29 #include "bta_sdp_api.h" 30 #include "bta_sdp_int.h" 31 32 /***************************************************************************** 33 ** Constants and types 34 *****************************************************************************/ 35 36 #if BTA_DYNAMIC_MEMORY == FALSE 37 tBTA_SDP_CB bta_sdp_cb; 38 #endif 39 40 /* state machine action enumeration list */ 41 #define BTA_SDP_NUM_ACTIONS (BTA_SDP_MAX_INT_EVT & 0x00ff) 42 43 /* type for action functions */ 44 typedef void (*tBTA_SDP_ACTION)(tBTA_SDP_MSG *p_data); 45 46 /* action function list */ 47 const tBTA_SDP_ACTION bta_sdp_action[] = 48 { 49 bta_sdp_enable, /* BTA_SDP_API_ENABLE_EVT */ 50 bta_sdp_search, /* BTA_SDP_API_SEARCH_EVT */ 51 bta_sdp_create_record, /* BTA_SDP_API_CREATE_RECORD_USER_EVT */ 52 bta_sdp_remove_record, /* BTA_SDP_API_REMOVE_RECORD_USER_EVT */ 53 }; 54 55 /******************************************************************************* 56 ** Function bta_sdp_sm_execute 57 ** 58 ** Description State machine event handling function for SDP search 59 ** 60 ** Returns void 61 *******************************************************************************/ bta_sdp_sm_execute(BT_HDR * p_msg)62BOOLEAN bta_sdp_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_SDP_NUM_ACTIONS) 71 { 72 (*bta_sdp_action[action])((tBTA_SDP_MSG*)p_msg); 73 ret = TRUE; 74 } 75 76 return(ret); 77 } 78