Home | History | Annotate | Download | only in srvc
      1 /******************************************************************************
      2  *
      3  *  Copyright 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   bool in_use;
     38   uint16_t conn_id;
     39   bool connected;
     40   RawAddress bda;
     41   uint32_t trans_id;
     42   uint8_t cur_srvc_id;
     43 
     44   tDIS_VALUE dis_value;
     45 
     46 } tSRVC_CLCB;
     47 
     48 /* service engine control block */
     49 typedef struct {
     50   tSRVC_CLCB clcb[SRVC_MAX_APPS]; /* connection link*/
     51   tGATT_IF gatt_if;
     52   bool enabled;
     53 
     54 } tSRVC_ENG_CB;
     55 
     56 /* Global GATT data */
     57 extern tSRVC_ENG_CB srvc_eng_cb;
     58 
     59 extern tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(uint16_t conn_id);
     60 extern tSRVC_CLCB* srvc_eng_find_clcb_by_bd_addr(const RawAddress& bda);
     61 extern uint16_t srvc_eng_find_conn_id_by_bd_addr(const RawAddress& bda);
     62 
     63 extern void srvc_eng_release_channel(uint16_t conn_id);
     64 extern bool srvc_eng_request_channel(const RawAddress& remote_bda,
     65                                      uint8_t srvc_id);
     66 extern void srvc_sr_rsp(uint8_t clcb_idx, tGATT_STATUS st, tGATTS_RSP* p_rsp);
     67 extern void srvc_sr_notify(const RawAddress& remote_bda, uint16_t handle,
     68                            uint16_t len, uint8_t* p_value);
     69 
     70 #endif
     71