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 #include "common/bt_target.h" 27 #include "bta/bta_api.h" 28 #include "bta/bta_sys.h" 29 #include "bta/bta_sdp_api.h" 30 #include "bta_sdp_int.h" 31 32 #if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE) 33 34 /***************************************************************************** 35 ** Constants and types 36 *****************************************************************************/ 37 38 #if BTA_DYNAMIC_MEMORY == FALSE 39 tBTA_SDP_CB bta_sdp_cb; 40 #else 41 tBTA_SDP_CB *bta_sdp_cb_ptr; 42 #endif 43 44 /* state machine action enumeration list */ 45 #define BTA_SDP_NUM_ACTIONS (BTA_SDP_MAX_INT_EVT & 0x00ff) 46 47 /* type for action functions */ 48 typedef void (*tBTA_SDP_ACTION)(tBTA_SDP_MSG *p_data); 49 50 /* action function list */ 51 const tBTA_SDP_ACTION bta_sdp_action[] = { 52 bta_sdp_enable, /* BTA_SDP_API_ENABLE_EVT */ 53 bta_sdp_search, /* BTA_SDP_API_SEARCH_EVT */ 54 bta_sdp_create_record, /* BTA_SDP_API_CREATE_RECORD_USER_EVT */ 55 bta_sdp_remove_record, /* BTA_SDP_API_REMOVE_RECORD_USER_EVT */ 56 }; 57 58 /******************************************************************************* 59 ** Function bta_sdp_sm_execute 60 ** 61 ** Description State machine event handling function for SDP search 62 ** 63 ** Returns void 64 *******************************************************************************/ bta_sdp_sm_execute(BT_HDR * p_msg)65BOOLEAN bta_sdp_sm_execute(BT_HDR *p_msg) 66 { 67 if (p_msg == NULL) { 68 return FALSE; 69 } 70 71 BOOLEAN ret = FALSE; 72 UINT16 action = (p_msg->event & 0x00ff); 73 74 /* execute action functions */ 75 if (action < BTA_SDP_NUM_ACTIONS) { 76 (*bta_sdp_action[action])((tBTA_SDP_MSG *)p_msg); 77 ret = TRUE; 78 } 79 80 return (ret); 81 } 82 83 #endif /* #if defined(BTA_SDP_INCLUDED) && (BTA_SDP_INCLUDED == TRUE) */ 84