Ganesh Ganapathi Batta | ead3cde | 2013-02-05 15:22:31 -0800 | [diff] [blame] | 1 | /****************************************************************************** |
| 2 | * |
| 3 | * Copyright (C) 2009-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 | |
| 20 | #include "gki.h" |
| 21 | #include "bta_gattc_co.h" |
| 22 | #include "bta_gattc_ci.h" |
| 23 | |
| 24 | #if( defined BLE_INCLUDED ) && (BLE_INCLUDED == TRUE) |
| 25 | #if( defined BTA_GATT_INCLUDED ) && (BTA_GATT_INCLUDED == TRUE) |
| 26 | |
| 27 | |
| 28 | /***************************************************************************** |
| 29 | ** Function Declarations |
| 30 | *****************************************************************************/ |
| 31 | |
| 32 | /******************************************************************************* |
| 33 | ** |
| 34 | ** Function bta_gattc_co_cache_open |
| 35 | ** |
| 36 | ** Description This callout function is executed by GATTC when a GATT server |
| 37 | ** cache is ready to be sent. |
| 38 | ** |
| 39 | ** Parameter server_bda: server bd address of this cache belongs to |
| 40 | ** evt: call in event to be passed in when cache open is done. |
| 41 | ** conn_id: connection ID of this cache operation attach to. |
| 42 | ** to_save: open cache to save or to load. |
| 43 | ** |
| 44 | ** Returns void. |
| 45 | ** |
| 46 | *******************************************************************************/ |
| 47 | void bta_gattc_co_cache_open(BD_ADDR server_bda, UINT16 evt, UINT16 conn_id, BOOLEAN to_save) |
| 48 | { |
| 49 | tBTA_GATT_STATUS status = BTA_GATT_OK; |
| 50 | |
| 51 | /* open NV cache and send call in */ |
| 52 | bta_gattc_ci_cache_open(server_bda, evt, status, conn_id); |
| 53 | } |
| 54 | |
| 55 | /******************************************************************************* |
| 56 | ** |
| 57 | ** Function bta_gattc_co_cache_load |
| 58 | ** |
| 59 | ** Description This callout function is executed by GATT when server cache |
| 60 | ** is required to load. |
| 61 | ** |
| 62 | ** Parameter server_bda: server bd address of this cache belongs to |
| 63 | ** evt: call in event to be passed in when cache save is done. |
| 64 | ** num_attr: number of attribute to be save. |
| 65 | ** attr_index: starting attribute index of the save operation. |
| 66 | ** conn_id: connection ID of this cache operation attach to. |
| 67 | ** Returns |
| 68 | ** |
| 69 | *******************************************************************************/ |
| 70 | void bta_gattc_co_cache_load(BD_ADDR server_bda, UINT16 evt, UINT16 start_index, UINT16 conn_id) |
| 71 | { |
| 72 | UINT16 num_attr = 0; |
| 73 | tBTA_GATTC_NV_ATTR attr[BTA_GATTC_NV_LOAD_MAX]; |
| 74 | tBTA_GATT_STATUS status = BTA_GATT_MORE; |
| 75 | |
| 76 | bta_gattc_ci_cache_load(server_bda, evt, num_attr, attr, status, conn_id); |
| 77 | } |
| 78 | /******************************************************************************* |
| 79 | ** |
| 80 | ** Function bta_gattc_co_cache_save |
| 81 | ** |
| 82 | ** Description This callout function is executed by GATT when a server cache |
| 83 | ** is available to save. |
| 84 | ** |
| 85 | ** Parameter server_bda: server bd address of this cache belongs to |
| 86 | ** evt: call in event to be passed in when cache save is done. |
| 87 | ** num_attr: number of attribute to be save. |
| 88 | ** p_attr: pointer to the list of attributes to save. |
| 89 | ** attr_index: starting attribute index of the save operation. |
| 90 | ** conn_id: connection ID of this cache operation attach to. |
| 91 | ** Returns |
| 92 | ** |
| 93 | *******************************************************************************/ |
| 94 | void bta_gattc_co_cache_save (BD_ADDR server_bda, UINT16 evt, UINT16 num_attr, |
| 95 | tBTA_GATTC_NV_ATTR *p_attr_list, UINT16 attr_index, UINT16 conn_id) |
| 96 | { |
| 97 | tBTA_GATT_STATUS status = BTA_GATT_OK; |
| 98 | |
| 99 | bta_gattc_ci_cache_save(server_bda, evt, status, conn_id); |
| 100 | } |
| 101 | |
| 102 | /******************************************************************************* |
| 103 | ** |
| 104 | ** Function bta_gattc_co_cache_close |
| 105 | ** |
| 106 | ** Description This callout function is executed by GATTC when a GATT server |
| 107 | ** cache is written completely. |
| 108 | ** |
| 109 | ** Parameter server_bda: server bd address of this cache belongs to |
| 110 | ** conn_id: connection ID of this cache operation attach to. |
| 111 | ** |
| 112 | ** Returns void. |
| 113 | ** |
| 114 | *******************************************************************************/ |
| 115 | void bta_gattc_co_cache_close(BD_ADDR server_bda, UINT16 conn_id) |
| 116 | { |
| 117 | /* close NV when server cache is done saving or loading, |
| 118 | does not need to do anything for now on Insight */ |
| 119 | } |
| 120 | |
| 121 | /******************************************************************************* |
| 122 | ** |
| 123 | ** Function bta_gattc_co_cache_reset |
| 124 | ** |
| 125 | ** Description This callout function is executed by GATTC to reset cache in |
| 126 | ** application |
| 127 | ** |
| 128 | ** Parameter server_bda: server bd address of this cache belongs to |
| 129 | ** |
| 130 | ** Returns void. |
| 131 | ** |
| 132 | *******************************************************************************/ |
| 133 | void bta_gattc_co_cache_reset(BD_ADDR server_bda) |
| 134 | { |
| 135 | } |
| 136 | |
| 137 | #endif |
| 138 | #endif |
| 139 | |