Home | History | Annotate | Download | only in hl
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 2009-2012 Broadcom Corporation
      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 implementation file for the HeaLth device profile (HL)
     22  *  subsystem call-in functions.
     23  *
     24  ******************************************************************************/
     25 #include "bta_api.h"
     26 #include "btm_api.h"
     27 #include "bta_sys.h"
     28 #include "bta_hl_api.h"
     29 #include "bta_hl_co.h"
     30 #include "bta_hl_int.h"
     31 
     32 /*******************************************************************************
     33 **
     34 ** Function         bta_hl_ci_get_tx_data
     35 **
     36 ** Description      This function is called in response to the
     37 **                  bta_hl_co_get_tx_data call-out function.
     38 **
     39 ** Parameters       mdl_handle -MDL handle
     40 **                  status - BTA_MA_STATUS_OK if operation is successful
     41 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
     42 **                  evt    - evt from the call-out function
     43 **
     44 ** Returns          void
     45 **
     46 *******************************************************************************/
     47 BTA_API extern void bta_hl_ci_get_tx_data(  tBTA_HL_MDL_HANDLE mdl_handle,
     48                                             tBTA_HL_STATUS status,
     49                                             UINT16 evt )
     50 {
     51     tBTA_HL_CI_GET_PUT_DATA  *p_evt;
     52 
     53 #if  (BTA_HL_DEBUG == TRUE)
     54     APPL_TRACE_DEBUG3("bta_hl_ci_get_tx_data mdl_handle=%d status=%d evt=%d\n",
     55                       mdl_handle, status, evt);
     56 #endif
     57 
     58     if ((p_evt = (tBTA_HL_CI_GET_PUT_DATA *)GKI_getbuf(sizeof(tBTA_HL_CI_GET_PUT_DATA))) != NULL)
     59     {
     60         p_evt->hdr.event = evt;
     61         p_evt->mdl_handle =  mdl_handle;
     62         p_evt->status = status;
     63         bta_sys_sendmsg(p_evt);
     64     }
     65 }
     66 
     67 /*******************************************************************************
     68 **
     69 ** Function         bta_hl_ci_put_rx_data
     70 **
     71 ** Description      This function is called in response to the
     72 **                  bta_hl_co_put_rx_data call-out function.
     73 **
     74 ** Parameters       mdl_handle -MDL handle
     75 **                  status - BTA_MA_STATUS_OK if operation is successful
     76 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
     77 **                  evt    - evt from the call-out function
     78 **
     79 ** Returns          void
     80 **
     81 *******************************************************************************/
     82 BTA_API extern void bta_hl_ci_put_rx_data(  tBTA_HL_MDL_HANDLE mdl_handle,
     83                                             tBTA_HL_STATUS status,
     84                                             UINT16 evt )
     85 {
     86     tBTA_HL_CI_GET_PUT_DATA  *p_evt;
     87 #if  (BTA_HL_DEBUG == TRUE)
     88     APPL_TRACE_DEBUG3("bta_hl_ci_put_rx_data mdl_handle=%d status=%d evt=%d\n",
     89                       mdl_handle, status, evt);
     90 #endif
     91 
     92     if ((p_evt = (tBTA_HL_CI_GET_PUT_DATA *)GKI_getbuf(sizeof(tBTA_HL_CI_GET_PUT_DATA))) != NULL)
     93     {
     94         p_evt->hdr.event = evt;
     95         p_evt->mdl_handle =  mdl_handle;
     96         p_evt->status = status;
     97         bta_sys_sendmsg(p_evt);
     98     }
     99 }
    100 
    101 
    102 /*******************************************************************************
    103 **
    104 ** Function         bta_hl_ci_get_echo_data
    105 **
    106 ** Description      This function is called in response to the
    107 **                  bta_hl_co_get_echo_data call-out function.
    108 **
    109 ** Parameters       mcl_handle -MCL handle
    110 **                  status - BTA_MA_STATUS_OK if operation is successful
    111 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
    112 **                  evt    - evt from the call-out function
    113 **
    114 ** Returns          void
    115 **
    116 *******************************************************************************/
    117 BTA_API extern void bta_hl_ci_get_echo_data(  tBTA_HL_MCL_HANDLE mcl_handle,
    118                                               tBTA_HL_STATUS status,
    119                                               UINT16 evt )
    120 {
    121     tBTA_HL_CI_ECHO_DATA  *p_evt;
    122 
    123 #if  (BTA_HL_DEBUG == TRUE)
    124     APPL_TRACE_DEBUG3("bta_hl_ci_get_echo_data mcl_handle=%d status=%d evt=%d\n",
    125                       mcl_handle, status, evt);
    126 #endif
    127 
    128     if ((p_evt = (tBTA_HL_CI_ECHO_DATA *)GKI_getbuf(sizeof(tBTA_HL_CI_ECHO_DATA))) != NULL)
    129     {
    130         p_evt->hdr.event = evt;
    131         p_evt->mcl_handle =  mcl_handle;
    132         p_evt->status = status;
    133         bta_sys_sendmsg(p_evt);
    134     }
    135 }
    136 
    137 /*******************************************************************************
    138 **
    139 ** Function         bta_hl_ci_put_echo_data
    140 **
    141 ** Description      This function is called in response to the
    142 **                  bta_hl_co_put_echo_data call-out function.
    143 **
    144 ** Parameters       mcl_handle -MCL handle
    145 **                  status - BTA_MA_STATUS_OK if operation is successful
    146 **                           BTA_MA_STATUS_FAIL if any errors have occurred.
    147 **                  evt    - evt from the call-out function
    148 **
    149 ** Returns          void
    150 **
    151 *******************************************************************************/
    152 BTA_API extern void bta_hl_ci_put_echo_data(  tBTA_HL_MCL_HANDLE mcl_handle,
    153                                               tBTA_HL_STATUS status,
    154                                               UINT16 evt )
    155 {
    156     tBTA_HL_CI_ECHO_DATA  *p_evt;
    157 
    158 #if  (BTA_HL_DEBUG == TRUE)
    159     APPL_TRACE_DEBUG3("bta_hl_ci_put_echo_data mcl_handle=%d status=%d evt=%d\n",
    160                       mcl_handle, status, evt);
    161 #endif
    162 
    163     if ((p_evt = (tBTA_HL_CI_ECHO_DATA *)GKI_getbuf(sizeof(tBTA_HL_CI_ECHO_DATA))) != NULL)
    164     {
    165         p_evt->hdr.event = evt;
    166         p_evt->mcl_handle =  mcl_handle;
    167         p_evt->status = status;
    168         bta_sys_sendmsg(p_evt);
    169     }
    170 }
    171 
    172