Home | History | Annotate | Download | only in srvc
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 1999-2013 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 #ifndef SRVC_ENG_INT_H
     20 #define SRVC_ENG_INT_H
     21 
     22 #include "bt_target.h"
     23 #include "gatt_api.h"
     24 #include "srvc_api.h"
     25 
     26 #define SRVC_MAX_APPS                  GATT_CL_MAX_LCB
     27 
     28 #define SRVC_ID_NONE            0
     29 #define SRVC_ID_DIS             1
     30 #define SRVC_ID_MAX             SRVC_ID_DIS
     31 
     32 #define SRVC_ACT_IGNORE     0
     33 #define SRVC_ACT_RSP        1
     34 #define SRVC_ACT_PENDING    2
     35 
     36 typedef struct
     37 {
     38     BOOLEAN         in_use;
     39     UINT16          conn_id;
     40     BOOLEAN         connected;
     41     BD_ADDR         bda;
     42     UINT32          trans_id;
     43     UINT8           cur_srvc_id;
     44 
     45     tDIS_VALUE      dis_value;
     46 
     47 }tSRVC_CLCB;
     48 
     49 
     50 /* service engine control block */
     51 typedef struct
     52 {
     53     tSRVC_CLCB              clcb[SRVC_MAX_APPS]; /* connection link*/
     54     tGATT_IF                gatt_if;
     55     BOOLEAN                 enabled;
     56 
     57 }tSRVC_ENG_CB;
     58 
     59 
     60 
     61 #ifdef __cplusplus
     62 extern "C" {
     63 #endif
     64 
     65 /* Global GATT data */
     66 #if GATT_DYNAMIC_MEMORY == FALSE
     67 GATT_API extern tSRVC_ENG_CB srvc_eng_cb;
     68 #else
     69 GATT_API extern tSRVC_ENG_CB srvc_eng_cb_ptr;
     70 #define srvc_eng_cb (*srvc_eng_cb_ptr)
     71 
     72 #endif
     73 
     74 extern tSRVC_CLCB *srvc_eng_find_clcb_by_conn_id(UINT16 conn_id);
     75 extern tSRVC_CLCB *srvc_eng_find_clcb_by_bd_addr(BD_ADDR bda);
     76 extern UINT16 srvc_eng_find_conn_id_by_bd_addr(BD_ADDR bda);
     77 
     78 
     79 extern void srvc_eng_release_channel (UINT16 conn_id) ;
     80 extern BOOLEAN srvc_eng_request_channel (BD_ADDR remote_bda, UINT8 srvc_id );
     81 extern void srvc_sr_rsp(UINT8 clcb_idx, tGATT_STATUS st, tGATTS_RSP *p_rsp);
     82 extern void srvc_sr_notify(BD_ADDR remote_bda, UINT16 handle, UINT16 len, UINT8 *p_value);
     83 
     84 
     85 #ifdef __cplusplus
     86 }
     87 #endif
     88 #endif
     89