Home | History | Annotate | Download | only in srvc
      1 /******************************************************************************
      2  *
      3  *  Copyright (C) 1999-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 #ifndef SRVC_BATTERY_INT_H
     20 #define SRVC_BATTERY_INT_H
     21 
     22 #include "bt_target.h"
     23 #include "srvc_api.h"
     24 #include "gatt_api.h"
     25 
     26 #ifndef BA_MAX_INT_NUM
     27 #define BA_MAX_INT_NUM     4
     28 #endif
     29 
     30 #define BATTERY_LEVEL_SIZE      1
     31 
     32 
     33 typedef struct
     34 {
     35     UINT8           app_id;
     36     UINT16          ba_level_hdl;
     37     UINT16          clt_cfg_hdl;
     38     UINT16          rpt_ref_hdl;
     39     UINT16          pres_fmt_hdl;
     40 
     41     tBA_CBACK       *p_cback;
     42 
     43     UINT16          pending_handle;
     44     UINT8           pending_clcb_idx;
     45     UINT8           pending_evt;
     46 
     47 }tBA_INST;
     48 
     49 typedef struct
     50 {
     51     tBA_INST                battery_inst[BA_MAX_INT_NUM];
     52     UINT8                   inst_id;
     53     BOOLEAN                 enabled;
     54 
     55 }tBATTERY_CB;
     56 
     57 #ifdef __cplusplus
     58 extern "C" {
     59 #endif
     60 
     61 /* Global GATT data */
     62 #if GATT_DYNAMIC_MEMORY == FALSE
     63 GATT_API extern tBATTERY_CB battery_cb;
     64 #else
     65 GATT_API extern tBATTERY_CB *battery_cb_ptr;
     66 #define battery_cb (*battery_cb_ptr)
     67 #endif
     68 
     69 
     70 extern BOOLEAN battery_valid_handle_range(UINT16 handle);
     71 
     72 extern UINT8 battery_s_write_attr_value(UINT8 clcb_idx, tGATT_WRITE_REQ * p_value,
     73                                  tGATT_STATUS *p_status);
     74 extern UINT8 battery_s_read_attr_value (UINT8 clcb_idx, UINT16 handle, tGATT_VALUE *p_value, BOOLEAN is_long, tGATT_STATUS* p_status);
     75 
     76 
     77 
     78 #ifdef __cplusplus
     79 }
     80 #endif
     81 #endif
     82