Home | History | Annotate | Download | only in include
      1 /****************************************************************************
      2 **
      3 **  Name:       srvc_api.h
      4 **  Function    this file contains the definitions for the DIS API
      5 **
      6 **
      7 **  Copyright (c) 1999-2011, Broadcom Corp., All Rights Reserved.
      8 **  Broadcom Bluetooth Core. Proprietary and confidential.
      9 **
     10 ******************************************************************************/
     11 #ifndef SRVC_DIS_API_H
     12 #define SRVC_DIS_API_H
     13 
     14 #include "bt_target.h"
     15 #include "gatt_api.h"
     16 #include "gattdefs.h"
     17 
     18 #define DIS_SUCCESS             GATT_SUCCESS
     19 #define DIS_ILLEGAL_PARAM       GATT_ILLEGAL_PARAMETER
     20 #define DIS_NO_RESOURCES        GATT_NO_RESOURCES
     21 typedef UINT8 tDIS_STATUS;
     22 
     23 
     24 /*****************************************************************************
     25 **  Data structure for DIS
     26 *****************************************************************************/
     27 
     28 #define DIS_ATTR_SYS_ID_BIT         0x0001
     29 #define DIS_ATTR_MODEL_NUM_BIT      0x0002
     30 #define DIS_ATTR_SERIAL_NUM_BIT     0x0004
     31 #define DIS_ATTR_FW_NUM_BIT         0x0008
     32 #define DIS_ATTR_HW_NUM_BIT         0x0010
     33 #define DIS_ATTR_SW_NUM_BIT         0x0020
     34 #define DIS_ATTR_MANU_NAME_BIT      0x0040
     35 #define DIS_ATTR_IEEE_DATA_BIT      0x0080
     36 #define DIS_ATTR_PNP_ID_BIT         0x0100
     37 typedef UINT16  tDIS_ATTR_MASK;
     38 
     39 #define DIS_ATTR_ALL_MASK           0xffff
     40 
     41 typedef tDIS_ATTR_MASK tDIS_ATTR_BIT ;
     42 
     43 typedef struct
     44 {
     45     UINT16      len;
     46     UINT8       *p_data;
     47 }tDIS_STRING;
     48 
     49 typedef struct
     50 {
     51     UINT16       vendor_id;
     52     UINT16       product_id;
     53     UINT16       product_version;
     54     UINT8        vendor_id_src;
     55 
     56 }tDIS_PNP_ID;
     57 
     58 typedef union
     59 {
     60     UINT64              system_id;
     61     tDIS_PNP_ID         pnp_id;
     62     tDIS_STRING         data_str;
     63 }tDIS_ATTR;
     64 
     65 #define DIS_MAX_STRING_DATA     7
     66 
     67 typedef struct
     68 {
     69     UINT16                  attr_mask;
     70     UINT64                  system_id;
     71     tDIS_PNP_ID             pnp_id;
     72     UINT8                   *data_string[DIS_MAX_STRING_DATA];
     73 }tDIS_VALUE;
     74 
     75 
     76 typedef void (tDIS_READ_CBACK)(BD_ADDR addr, tDIS_VALUE *p_dis_value);
     77 
     78 /*****************************************************************************
     79 **  Data structure used by Battery Service
     80 *****************************************************************************/
     81 typedef struct
     82 {
     83     BD_ADDR remote_bda;
     84     BOOLEAN need_rsp;
     85     UINT16  clt_cfg;
     86 }tBA_WRITE_DATA;
     87 
     88 #define BA_READ_CLT_CFG_REQ     1
     89 #define BA_READ_PRE_FMT_REQ     2
     90 #define BA_READ_RPT_REF_REQ     3
     91 #define BA_READ_LEVEL_REQ       4
     92 #define BA_WRITE_CLT_CFG_REQ    5
     93 
     94 typedef void (tBA_CBACK)(UINT8 app_id, UINT8 event, tBA_WRITE_DATA *p_data);
     95 
     96 #define BA_LEVEL_NOTIFY         0x01
     97 #define BA_LEVEL_PRE_FMT        0x02
     98 #define BA_LEVEL_RPT_REF        0x04
     99 typedef UINT8   tBA_LEVEL_DESCR;
    100 
    101 typedef struct
    102 {
    103     BOOLEAN         is_pri;
    104     tBA_LEVEL_DESCR     ba_level_descr;
    105     tGATT_TRANSPORT transport;
    106     tBA_CBACK       *p_cback;
    107 
    108 }tBA_REG_INFO;
    109 
    110 typedef union
    111 {
    112     UINT8       ba_level;
    113     UINT16      clt_cfg;
    114     tGATT_CHAR_RPT_REF  rpt_ref;
    115     tGATT_CHAR_PRES     pres_fmt;
    116 }tBA_RSP_DATA;
    117 
    118 /*****************************************************************************
    119 **  External Function Declarations
    120 *****************************************************************************/
    121 #ifdef __cplusplus
    122 extern "C"
    123 {
    124 #endif
    125 /*****************************************************************************
    126 **  Service Engine API
    127 *****************************************************************************/
    128 /*******************************************************************************
    129 **
    130 ** Function         srvc_eng_init
    131 **
    132 ** Description      Initializa the GATT Service engine, register a GATT application
    133 **                  as for a central service management.
    134 **
    135 *******************************************************************************/
    136     GATT_API extern tGATT_STATUS srvc_eng_init (void);
    137 
    138 
    139 /*****************************************************************************
    140 **  DIS Server Function
    141 *****************************************************************************/
    142 
    143 /*******************************************************************************
    144 **
    145 ** Function         DIS_SrInit
    146 **
    147 ** Description      Initializa the Device Information Service Server.
    148 **
    149 *******************************************************************************/
    150     GATT_API extern tDIS_STATUS DIS_SrInit (tDIS_ATTR_MASK dis_attr_mask);
    151 /*******************************************************************************
    152 **
    153 ** Function         DIS_SrUpdate
    154 **
    155 ** Description      Update the DIS server attribute values
    156 **
    157 *******************************************************************************/
    158     GATT_API extern tDIS_STATUS DIS_SrUpdate(tDIS_ATTR_BIT dis_attr_bit, tDIS_ATTR *p_info);
    159 /*****************************************************************************
    160 **  DIS Client Function
    161 *****************************************************************************/
    162 /*******************************************************************************
    163 **
    164 ** Function         DIS_ReadDISInfo
    165 **
    166 ** Description      Read remote device DIS information.
    167 **
    168 ** Returns          void
    169 **
    170 *******************************************************************************/
    171     GATT_API extern BOOLEAN DIS_ReadDISInfo(BD_ADDR peer_bda, tDIS_READ_CBACK *p_cback);
    172 
    173 /*******************************************************************************
    174 **      BATTERY SERVICE API
    175 *******************************************************************************/
    176 /*******************************************************************************
    177 **
    178 ** Function         Battery_Instantiate
    179 **
    180 ** Description      Instantiate a Battery service
    181 **
    182 *******************************************************************************/
    183     GATT_API extern UINT16 Battery_Instantiate (UINT8 app_id, tBA_REG_INFO *p_reg_info);
    184 
    185 /*******************************************************************************
    186 **
    187 ** Function         Battery_Rsp
    188 **
    189 ** Description      Respond to a battery service request
    190 **
    191 *******************************************************************************/
    192     GATT_API extern void Battery_Rsp (UINT8 app_id, tGATT_STATUS st, UINT8 event, tBA_RSP_DATA *p_rsp);
    193 /*******************************************************************************
    194 **
    195 ** Function         Battery_Notify
    196 **
    197 ** Description      Send battery level notification
    198 **
    199 *******************************************************************************/
    200     GATT_API extern void Battery_Notify (UINT8 app_id, BD_ADDR remote_bda, UINT8 battery_level);
    201 
    202 
    203 #ifdef __cplusplus
    204 
    205 }
    206 #endif
    207 
    208 #endif
    209 
    210 
    211