srvc_battery_int.h revision 3d6accfcc0bdc5c7a8713320c9bb069cbf253348
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#ifdef __cplusplus 27extern "C" { 28#endif 29 30#ifndef BA_MAX_INT_NUM 31#define BA_MAX_INT_NUM 4 32#endif 33 34#define BATTERY_LEVEL_SIZE 1 35 36 37typedef struct 38{ 39 UINT8 app_id; 40 UINT16 ba_level_hdl; 41 UINT16 clt_cfg_hdl; 42 UINT16 rpt_ref_hdl; 43 UINT16 pres_fmt_hdl; 44 45 tBA_CBACK *p_cback; 46 47 UINT16 pending_handle; 48 UINT8 pending_clcb_idx; 49 UINT8 pending_evt; 50 51}tBA_INST; 52 53typedef struct 54{ 55 tBA_INST battery_inst[BA_MAX_INT_NUM]; 56 UINT8 inst_id; 57 BOOLEAN enabled; 58 59}tBATTERY_CB; 60 61/* Global GATT data */ 62#if GATT_DYNAMIC_MEMORY == FALSE 63extern tBATTERY_CB battery_cb; 64#else 65extern tBATTERY_CB *battery_cb_ptr; 66#define battery_cb (*battery_cb_ptr) 67#endif 68 69 70extern BOOLEAN battery_valid_handle_range(UINT16 handle); 71 72extern UINT8 battery_s_write_attr_value(UINT8 clcb_idx, tGATT_WRITE_REQ * p_value, 73 tGATT_STATUS *p_status); 74extern 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