HW layer for the Nucleo board, it only work with old BLE_API

Dependents:   Hello_BLE F446RE-BLE

Fork of X_NUCLEO_IDB0XA1 by ST

Committer:
mridup
Date:
Wed Apr 01 09:02:51 2015 +0000
Revision:
65:f9958b8f2548
Parent:
64:6d7b775c3f6d
Child:
66:8c8813dd8e79
1. GapAdvertisingParams constants usage update; 2. Gap::getAddress() function; 3. BlueNRGGattServer Class update; 4. BlueNRGGap class update; 5. HandleDataWrittenEvent function update from btle.cpp

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mridup 64:6d7b775c3f6d 1 /* mbed Microcontroller Library
mridup 64:6d7b775c3f6d 2 * Copyright (c) 2006-2013 ARM Limited
mridup 64:6d7b775c3f6d 3 *
mridup 64:6d7b775c3f6d 4 * Licensed under the Apache License, Version 2.0 (the "License");
mridup 64:6d7b775c3f6d 5 * you may not use this file except in compliance with the License.
mridup 64:6d7b775c3f6d 6 * You may obtain a copy of the License at
mridup 64:6d7b775c3f6d 7 *
mridup 64:6d7b775c3f6d 8 * http://www.apache.org/licenses/LICENSE-2.0
mridup 64:6d7b775c3f6d 9 *
mridup 64:6d7b775c3f6d 10 * Unless required by applicable law or agreed to in writing, software
mridup 64:6d7b775c3f6d 11 * distributed under the License is distributed on an "AS IS" BASIS,
mridup 64:6d7b775c3f6d 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mridup 64:6d7b775c3f6d 13 * See the License for the specific language governing permissions and
mridup 64:6d7b775c3f6d 14 * limitations under the License.
mridup 64:6d7b775c3f6d 15 */
mridup 64:6d7b775c3f6d 16
mridup 64:6d7b775c3f6d 17
mridup 64:6d7b775c3f6d 18 /**
mridup 64:6d7b775c3f6d 19 ******************************************************************************
mridup 64:6d7b775c3f6d 20 * @file btle.cpp
mridup 64:6d7b775c3f6d 21 * @author STMicroelectronics
mridup 64:6d7b775c3f6d 22 * @brief Implementation BlueNRG Init and helper functions.
mridup 64:6d7b775c3f6d 23 ******************************************************************************
mridup 64:6d7b775c3f6d 24 * @copy
mridup 64:6d7b775c3f6d 25 *
mridup 64:6d7b775c3f6d 26 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
mridup 64:6d7b775c3f6d 27 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
mridup 64:6d7b775c3f6d 28 * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
mridup 64:6d7b775c3f6d 29 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
mridup 64:6d7b775c3f6d 30 * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
mridup 64:6d7b775c3f6d 31 * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
mridup 64:6d7b775c3f6d 32 *
mridup 64:6d7b775c3f6d 33 * <h2><center>&copy; COPYRIGHT 2013 STMicroelectronics</center></h2>
mridup 64:6d7b775c3f6d 34 */
mridup 64:6d7b775c3f6d 35
mridup 64:6d7b775c3f6d 36
mridup 64:6d7b775c3f6d 37 #include "btle.h"
mridup 64:6d7b775c3f6d 38 #include "public/Gap.h"
mridup 64:6d7b775c3f6d 39 #include "public/GapEvents.h"
mridup 64:6d7b775c3f6d 40 #include "BlueNRGGap.h"
mridup 64:6d7b775c3f6d 41 #include "BlueNRGGattServer.h"
mridup 64:6d7b775c3f6d 42 #include "Utils.h"
mridup 64:6d7b775c3f6d 43
mridup 64:6d7b775c3f6d 44 #ifdef __cplusplus
mridup 64:6d7b775c3f6d 45 extern "C" {
mridup 64:6d7b775c3f6d 46 #endif
mridup 64:6d7b775c3f6d 47
mridup 64:6d7b775c3f6d 48
mridup 64:6d7b775c3f6d 49 /* C File Includes ------------------------------------------------------------------*/
mridup 64:6d7b775c3f6d 50 #include "hal_types.h"
mridup 64:6d7b775c3f6d 51 #include "hci.h"
mridup 64:6d7b775c3f6d 52 #include "bluenrg_hci.h"
mridup 64:6d7b775c3f6d 53 #include "gp_timer.h"
mridup 64:6d7b775c3f6d 54 #include "hal.h"
mridup 64:6d7b775c3f6d 55 #include "osal.h"
mridup 64:6d7b775c3f6d 56 #include "hci_internal.h"
mridup 64:6d7b775c3f6d 57 #include "bluenrg_hci_internal.h"
mridup 64:6d7b775c3f6d 58 #include "bluenrg_gap.h"
mridup 64:6d7b775c3f6d 59 #include "sm.h"
mridup 64:6d7b775c3f6d 60 #include <stdio.h>
mridup 64:6d7b775c3f6d 61 #include <string.h>
mridup 64:6d7b775c3f6d 62 //#include "role_type.h"
mridup 64:6d7b775c3f6d 63 #include "debug.h"
mridup 64:6d7b775c3f6d 64
mridup 64:6d7b775c3f6d 65 #ifdef __cplusplus
mridup 64:6d7b775c3f6d 66 }
mridup 64:6d7b775c3f6d 67 #endif
mridup 64:6d7b775c3f6d 68
mridup 64:6d7b775c3f6d 69
mridup 64:6d7b775c3f6d 70 static void btle_handler(/*ble_evt_t * p_ble_evt*/);
mridup 64:6d7b775c3f6d 71 void HCI_Input(tHciDataPacket * hciReadPacket);
mridup 64:6d7b775c3f6d 72
mridup 64:6d7b775c3f6d 73 //#define BDADDR_SIZE 6
mridup 64:6d7b775c3f6d 74 //tHalUint8 bdaddr[BDADDR_SIZE]= {0xaa, 0x00, 0x00, 0xE1, 0x80, 0x02};
mridup 64:6d7b775c3f6d 75
mridup 64:6d7b775c3f6d 76 uint16_t g_gap_service_handle = 0;
mridup 64:6d7b775c3f6d 77 uint16_t g_appearance_char_handle = 0;
mridup 64:6d7b775c3f6d 78 uint16_t g_device_name_char_handle = 0;
mridup 64:6d7b775c3f6d 79
mridup 64:6d7b775c3f6d 80 /* Private variables ---------------------------------------------------------*/
mridup 64:6d7b775c3f6d 81 volatile uint8_t set_connectable = 1;
mridup 65:f9958b8f2548 82 tHalUint8 *bleAddr;
mridup 65:f9958b8f2548 83 Gap::addr_type_t addr_type = Gap::ADDR_TYPE_PUBLIC;
mridup 64:6d7b775c3f6d 84
mridup 64:6d7b775c3f6d 85 /**************************************************************************/
mridup 64:6d7b775c3f6d 86 /*!
mridup 64:6d7b775c3f6d 87 @brief Initialises BTLE and the underlying HW/Device
mridup 64:6d7b775c3f6d 88 @param isSetAddress boolean if address has been set
mridup 64:6d7b775c3f6d 89 @param mosi MOSI Pin
mridup 64:6d7b775c3f6d 90 @param miso MISO Pin
mridup 64:6d7b775c3f6d 91 @param sclk clock Pin
mridup 64:6d7b775c3f6d 92 @returns void
mridup 64:6d7b775c3f6d 93 */
mridup 64:6d7b775c3f6d 94 /**************************************************************************/
mridup 64:6d7b775c3f6d 95 void btle_init(bool isSetAddress, PinName mosi, PinName miso, PinName sclk)
mridup 64:6d7b775c3f6d 96 {
mridup 64:6d7b775c3f6d 97 DEBUG("btle_init>>\n\r");
mridup 65:f9958b8f2548 98
mridup 64:6d7b775c3f6d 99 int ret;
mridup 64:6d7b775c3f6d 100 uint16_t service_handle, dev_name_char_handle, appearance_char_handle;
mridup 64:6d7b775c3f6d 101
mridup 64:6d7b775c3f6d 102 //HAL_Init();
mridup 64:6d7b775c3f6d 103
mridup 64:6d7b775c3f6d 104 /* Configure the User Button in GPIO Mode */
mridup 64:6d7b775c3f6d 105 //BSP_PB_Init(BUTTON_KEY, BUTTON_MODE_GPIO);
mridup 64:6d7b775c3f6d 106
mridup 64:6d7b775c3f6d 107 /* Configure the system clock */
mridup 64:6d7b775c3f6d 108 //SystemClock_Config();
mridup 64:6d7b775c3f6d 109
mridup 64:6d7b775c3f6d 110 /* Delay needed only to be able to acces the JTAG interface after reset
mridup 64:6d7b775c3f6d 111 if it will be disabled later. */
mridup 64:6d7b775c3f6d 112 Clock_Wait(500);
mridup 64:6d7b775c3f6d 113
mridup 64:6d7b775c3f6d 114 /* Initialize the BlueNRG SPI driver */
mridup 64:6d7b775c3f6d 115 BNRG_SPI_Init(D11, D12, D3);
mridup 64:6d7b775c3f6d 116
mridup 64:6d7b775c3f6d 117 /* Initialize the BlueNRG HCI */
mridup 64:6d7b775c3f6d 118 HCI_Init();
mridup 64:6d7b775c3f6d 119
mridup 64:6d7b775c3f6d 120 /* Reset BlueNRG SPI interface */
mridup 64:6d7b775c3f6d 121 BlueNRG_RST();
mridup 64:6d7b775c3f6d 122
mridup 64:6d7b775c3f6d 123 /* The Nucleo board must be configured as SERVER */
mridup 64:6d7b775c3f6d 124 //check if issetAddress is set than set address.
mridup 64:6d7b775c3f6d 125 if(isSetAddress)
mridup 64:6d7b775c3f6d 126 {
mridup 65:f9958b8f2548 127 BlueNRGGap::getInstance().getAddress(&addr_type, bleAddr);
mridup 64:6d7b775c3f6d 128
mridup 64:6d7b775c3f6d 129 tHalUint8 bdaddr[BDADDR_SIZE];
mridup 64:6d7b775c3f6d 130 Osal_MemCpy(bdaddr, bleAddr, BDADDR_SIZE);
mridup 64:6d7b775c3f6d 131
mridup 64:6d7b775c3f6d 132 ret = aci_hal_write_config_data(CONFIG_DATA_PUBADDR_OFFSET,
mridup 64:6d7b775c3f6d 133 CONFIG_DATA_PUBADDR_LEN,
mridup 64:6d7b775c3f6d 134 bdaddr);
mridup 64:6d7b775c3f6d 135 }
mridup 64:6d7b775c3f6d 136
mridup 64:6d7b775c3f6d 137 ret = aci_gatt_init();
mridup 64:6d7b775c3f6d 138 //GAP is always in PERIPHERAL _ROLE as mbed does not support Master role at the moment
mridup 64:6d7b775c3f6d 139 ret = aci_gap_init(GAP_PERIPHERAL_ROLE, &service_handle, &dev_name_char_handle, &appearance_char_handle);
mridup 64:6d7b775c3f6d 140
mridup 64:6d7b775c3f6d 141 g_gap_service_handle = service_handle;
mridup 64:6d7b775c3f6d 142 g_appearance_char_handle = appearance_char_handle;
mridup 64:6d7b775c3f6d 143 g_device_name_char_handle = dev_name_char_handle;
mridup 64:6d7b775c3f6d 144 //Device Name is set from Accumulate Adv Data Payload or through setDeviceName API
mridup 64:6d7b775c3f6d 145 /*ret = aci_gatt_update_char_value(service_handle, dev_name_char_handle, 0,
mridup 64:6d7b775c3f6d 146 strlen(name), (tHalUint8 *)name);*/
mridup 64:6d7b775c3f6d 147
mridup 64:6d7b775c3f6d 148 return;
mridup 64:6d7b775c3f6d 149 }
mridup 64:6d7b775c3f6d 150
mridup 64:6d7b775c3f6d 151 void User_Process()
mridup 64:6d7b775c3f6d 152 {
mridup 64:6d7b775c3f6d 153 if(set_connectable){
mridup 64:6d7b775c3f6d 154 setConnectable();
mridup 64:6d7b775c3f6d 155 set_connectable = FALSE;
mridup 64:6d7b775c3f6d 156 }
mridup 64:6d7b775c3f6d 157 }
mridup 64:6d7b775c3f6d 158
mridup 64:6d7b775c3f6d 159 void setConnectable(void)
mridup 64:6d7b775c3f6d 160 {
mridup 64:6d7b775c3f6d 161 tBleStatus ret;
mridup 64:6d7b775c3f6d 162
mridup 64:6d7b775c3f6d 163 const char local_name[] = {AD_TYPE_COMPLETE_LOCAL_NAME,'B','l','u','e','N','R','G', '1', '2'};
mridup 64:6d7b775c3f6d 164
mridup 64:6d7b775c3f6d 165 /* disable scan response */
mridup 64:6d7b775c3f6d 166 hci_le_set_scan_resp_data(0,NULL);
mridup 64:6d7b775c3f6d 167
mridup 64:6d7b775c3f6d 168
mridup 64:6d7b775c3f6d 169 ret = aci_gap_set_discoverable(ADV_IND, 0, 0, PUBLIC_ADDR, NO_WHITE_LIST_USE,
mridup 64:6d7b775c3f6d 170 8, local_name, 0, NULL, 0, 0);
mridup 64:6d7b775c3f6d 171
mridup 64:6d7b775c3f6d 172 }
mridup 64:6d7b775c3f6d 173
mridup 64:6d7b775c3f6d 174 /**************************************************************************/
mridup 64:6d7b775c3f6d 175 /*!
mridup 64:6d7b775c3f6d 176 @brief Not Used
mridup 64:6d7b775c3f6d 177
mridup 64:6d7b775c3f6d 178 @param[in] void
mridup 64:6d7b775c3f6d 179
mridup 64:6d7b775c3f6d 180 @returns
mridup 64:6d7b775c3f6d 181 */
mridup 64:6d7b775c3f6d 182 /**************************************************************************/
mridup 64:6d7b775c3f6d 183 static void btle_handler()
mridup 64:6d7b775c3f6d 184 {
mridup 64:6d7b775c3f6d 185
mridup 64:6d7b775c3f6d 186 }
mridup 64:6d7b775c3f6d 187
mridup 64:6d7b775c3f6d 188 /*!
mridup 64:6d7b775c3f6d 189 @brief Not Used
mridup 64:6d7b775c3f6d 190
mridup 64:6d7b775c3f6d 191 @param[in] void
mridup 64:6d7b775c3f6d 192
mridup 64:6d7b775c3f6d 193 @returns
mridup 64:6d7b775c3f6d 194 */
mridup 64:6d7b775c3f6d 195 void SPI_Poll(void)
mridup 64:6d7b775c3f6d 196 {
mridup 64:6d7b775c3f6d 197 //HAL_GPIO_EXTI_Callback_Poll(BNRG_SPI_EXTI_PIN);
mridup 64:6d7b775c3f6d 198 return;
mridup 64:6d7b775c3f6d 199 }
mridup 64:6d7b775c3f6d 200
mridup 64:6d7b775c3f6d 201 #ifdef __cplusplus
mridup 64:6d7b775c3f6d 202 extern "C" {
mridup 64:6d7b775c3f6d 203 #endif
mridup 64:6d7b775c3f6d 204
mridup 64:6d7b775c3f6d 205 /**************************************************************************/
mridup 64:6d7b775c3f6d 206 /*!
mridup 64:6d7b775c3f6d 207 @brief Handle HCI Stack Event
mridup 64:6d7b775c3f6d 208
mridup 64:6d7b775c3f6d 209 @param[in] pckt
mridup 64:6d7b775c3f6d 210 Event Packet sent by the stack to be decoded
mridup 64:6d7b775c3f6d 211
mridup 64:6d7b775c3f6d 212 @returns
mridup 64:6d7b775c3f6d 213 */
mridup 64:6d7b775c3f6d 214 /**************************************************************************/
mridup 64:6d7b775c3f6d 215 extern void HCI_Event_CB(void *pckt) {
mridup 64:6d7b775c3f6d 216
mridup 64:6d7b775c3f6d 217 hci_uart_pckt *hci_pckt = (hci_uart_pckt*)pckt;
mridup 64:6d7b775c3f6d 218 hci_event_pckt *event_pckt = (hci_event_pckt*)hci_pckt->data;
mridup 64:6d7b775c3f6d 219
mridup 64:6d7b775c3f6d 220 if(hci_pckt->type != HCI_EVENT_PKT)
mridup 64:6d7b775c3f6d 221 return;
mridup 64:6d7b775c3f6d 222
mridup 64:6d7b775c3f6d 223 switch(event_pckt->evt){
mridup 64:6d7b775c3f6d 224
mridup 64:6d7b775c3f6d 225 case EVT_DISCONN_COMPLETE:
mridup 64:6d7b775c3f6d 226 {
mridup 64:6d7b775c3f6d 227 evt_disconn_complete *evt = (evt_disconn_complete*)event_pckt;
mridup 64:6d7b775c3f6d 228
mridup 64:6d7b775c3f6d 229 BlueNRGGap::getInstance().processDisconnectionEvent(evt->handle, BlueNRGGap::REMOTE_USER_TERMINATED_CONNECTION);
mridup 64:6d7b775c3f6d 230 }
mridup 64:6d7b775c3f6d 231 break;
mridup 64:6d7b775c3f6d 232
mridup 64:6d7b775c3f6d 233 case EVT_LE_META_EVENT:
mridup 64:6d7b775c3f6d 234 {
mridup 64:6d7b775c3f6d 235 evt_le_meta_event *evt = (evt_le_meta_event *)event_pckt->data;
mridup 64:6d7b775c3f6d 236
mridup 64:6d7b775c3f6d 237 switch(evt->subevent){
mridup 64:6d7b775c3f6d 238 case EVT_LE_CONN_COMPLETE:
mridup 64:6d7b775c3f6d 239 {
mridup 64:6d7b775c3f6d 240 evt_le_connection_complete *cc = (evt_le_connection_complete *)evt->data;
mridup 64:6d7b775c3f6d 241
mridup 64:6d7b775c3f6d 242 BlueNRGGap::getInstance().setConnectionHandle(cc->handle);
mridup 64:6d7b775c3f6d 243 BlueNRGGap::ConnectionParams_t connectionParams;
mridup 64:6d7b775c3f6d 244 BlueNRGGap::getInstance().getPreferredConnectionParams(&connectionParams);
mridup 65:f9958b8f2548 245 BlueNRGGap::getInstance().processConnectionEvent(cc->handle, addr_type, bleAddr, (const BlueNRGGap::ConnectionParams_t *)&connectionParams);
mridup 64:6d7b775c3f6d 246 }
mridup 64:6d7b775c3f6d 247 break;
mridup 64:6d7b775c3f6d 248 }
mridup 64:6d7b775c3f6d 249 }
mridup 64:6d7b775c3f6d 250 break;
mridup 64:6d7b775c3f6d 251
mridup 64:6d7b775c3f6d 252 case EVT_VENDOR:
mridup 64:6d7b775c3f6d 253 {
mridup 64:6d7b775c3f6d 254 evt_blue_aci *blue_evt = (evt_blue_aci*)event_pckt->data;
mridup 64:6d7b775c3f6d 255 switch(blue_evt->ecode){
mridup 64:6d7b775c3f6d 256
mridup 64:6d7b775c3f6d 257 case EVT_BLUE_GATT_READ_PERMIT_REQ:
mridup 64:6d7b775c3f6d 258 {
mridup 64:6d7b775c3f6d 259 DEBUG("EVT_BLUE_GATT_READ_PERMIT_REQ_OK\n\r");
mridup 64:6d7b775c3f6d 260 evt_gatt_read_permit_req *pr = (evt_gatt_read_permit_req*)blue_evt->data;
mridup 64:6d7b775c3f6d 261 BlueNRGGattServer::getInstance().Read_Request_CB(pr->attr_handle);
mridup 64:6d7b775c3f6d 262 }
mridup 64:6d7b775c3f6d 263 break;
mridup 64:6d7b775c3f6d 264
mridup 64:6d7b775c3f6d 265 case EVT_BLUE_GATT_ATTRIBUTE_MODIFIED:
mridup 64:6d7b775c3f6d 266 {
mridup 64:6d7b775c3f6d 267 /* this callback is invoked when a GATT attribute is modified
mridup 64:6d7b775c3f6d 268 extract callback data and pass to suitable handler function */
mridup 64:6d7b775c3f6d 269 evt_gatt_attr_modified *evt = (evt_gatt_attr_modified*)blue_evt->data;
mridup 64:6d7b775c3f6d 270 DEBUG("EVT_BLUE_GATT_ATTRIBUTE_MODIFIED\n\r");
mridup 64:6d7b775c3f6d 271 //DEBUG("CharHandle 0x%x, length: 0x%x, Data: 0x%x\n\r",evt->attr_handle, evt->data_length, (uint16_t)evt->att_data[0]);
mridup 64:6d7b775c3f6d 272 DEBUG("CharHandle %d, length: %d, Data: %d\n\r",evt->attr_handle, evt->data_length, (uint16_t)evt->att_data[0]);
mridup 64:6d7b775c3f6d 273
mridup 64:6d7b775c3f6d 274 //Extract the GattCharacteristic from p_characteristics[] and find the properties mask
mridup 64:6d7b775c3f6d 275 GattCharacteristic *p_char = BlueNRGGattServer::getInstance().getCharacteristicFromHandle(evt->attr_handle);
mridup 64:6d7b775c3f6d 276 if(p_char!=NULL) {
mridup 64:6d7b775c3f6d 277 DEBUG("getProperties 0x%x\n\r",p_char->getProperties());
mridup 64:6d7b775c3f6d 278 if((p_char->getProperties() & (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY
mridup 64:6d7b775c3f6d 279 | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_INDICATE))) {
mridup 64:6d7b775c3f6d 280
mridup 64:6d7b775c3f6d 281 //Now Check if data written in Enable or Disable
mridup 64:6d7b775c3f6d 282 if((uint16_t)evt->att_data[0]==1) {
mridup 64:6d7b775c3f6d 283 //DEBUG("Notify ENABLED\n\r");
mridup 64:6d7b775c3f6d 284 BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_UPDATES_ENABLED, evt->attr_handle);
mridup 64:6d7b775c3f6d 285 }
mridup 64:6d7b775c3f6d 286 else {
mridup 64:6d7b775c3f6d 287 //DEBUG("Notify DISABLED\n\r");
mridup 64:6d7b775c3f6d 288 BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_UPDATES_DISABLED, evt->attr_handle);
mridup 64:6d7b775c3f6d 289 }
mridup 64:6d7b775c3f6d 290 }
mridup 64:6d7b775c3f6d 291
mridup 64:6d7b775c3f6d 292 //Check is attr handle property is WRITEABLE, if yes, generate GATT_EVENT_DATA_WRITTEN Event
mridup 64:6d7b775c3f6d 293 if((p_char->getProperties() &
mridup 64:6d7b775c3f6d 294 (GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE_WITHOUT_RESPONSE|
mridup 64:6d7b775c3f6d 295 GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_WRITE))) {
mridup 64:6d7b775c3f6d 296
mridup 65:f9958b8f2548 297 GattCharacteristicWriteCBParams writeParams;
mridup 65:f9958b8f2548 298 writeParams.charHandle=evt->attr_handle;
mridup 65:f9958b8f2548 299 writeParams.op=GattCharacteristicWriteCBParams::GATTS_CHAR_OP_WRITE_REQ;//Where to find this property in BLUENRG?
mridup 65:f9958b8f2548 300 writeParams.len=evt->data_length;
mridup 65:f9958b8f2548 301 writeParams.data=evt->att_data;
mridup 65:f9958b8f2548 302 #if BLUENRG_MS
mridup 65:f9958b8f2548 303 writeParams.offset=evt->offset;//Not used in BlueNRG?
mridup 65:f9958b8f2548 304 #endif
mridup 65:f9958b8f2548 305 BlueNRGGattServer::getInstance().handleDataWrittenEvent(&writeParams);
mridup 65:f9958b8f2548 306
mridup 65:f9958b8f2548 307 //BlueNRGGattServer::getInstance().handleEvent(GattServerEvents::GATT_EVENT_DATA_WRITTEN, evt->attr_handle);
mridup 64:6d7b775c3f6d 308 //Write the actual Data to the Attr Handle? (uint8_1[])evt->att_data contains the data
mridup 64:6d7b775c3f6d 309 if ((p_char->getValueAttribute().getValuePtr() != NULL) && (p_char->getValueAttribute().getInitialLength() > 0)) {
mridup 64:6d7b775c3f6d 310 BlueNRGGattServer::getInstance().updateValue(p_char->getValueAttribute().getHandle(),
mridup 64:6d7b775c3f6d 311 p_char->getValueAttribute().getValuePtr(), p_char->getValueAttribute().getInitialLength(), false /* localOnly */);
mridup 64:6d7b775c3f6d 312 }
mridup 64:6d7b775c3f6d 313 }
mridup 64:6d7b775c3f6d 314 }
mridup 64:6d7b775c3f6d 315 }
mridup 64:6d7b775c3f6d 316 break;
mridup 64:6d7b775c3f6d 317
mridup 64:6d7b775c3f6d 318 //Any cases for Data Sent Notifications?
mridup 64:6d7b775c3f6d 319 case EVT_BLUE_GATT_NOTIFICATION:
mridup 64:6d7b775c3f6d 320 //This is only relevant for Client Side Event
mridup 64:6d7b775c3f6d 321 DEBUG("EVT_BLUE_GATT_NOTIFICATION");
mridup 64:6d7b775c3f6d 322 break;
mridup 64:6d7b775c3f6d 323 case EVT_BLUE_GATT_INDICATION:
mridup 64:6d7b775c3f6d 324 //This is only relevant for Client Side Event
mridup 64:6d7b775c3f6d 325 DEBUG("EVT_BLUE_GATT_INDICATION");
mridup 64:6d7b775c3f6d 326 break;
mridup 64:6d7b775c3f6d 327
mridup 64:6d7b775c3f6d 328 case EVT_BLUE_GATT_PROCEDURE_COMPLETE:
mridup 64:6d7b775c3f6d 329 DEBUG("EVT_BLUE_GATT_PROCEDURE_COMPLETE");
mridup 64:6d7b775c3f6d 330 break;
mridup 64:6d7b775c3f6d 331 }
mridup 64:6d7b775c3f6d 332 }
mridup 64:6d7b775c3f6d 333 break;
mridup 64:6d7b775c3f6d 334 }
mridup 64:6d7b775c3f6d 335
mridup 64:6d7b775c3f6d 336 return ;
mridup 64:6d7b775c3f6d 337 }
mridup 64:6d7b775c3f6d 338
mridup 64:6d7b775c3f6d 339
mridup 64:6d7b775c3f6d 340 #ifdef __cplusplus
mridup 64:6d7b775c3f6d 341 }
mridup 64:6d7b775c3f6d 342 #endif