Added support for obtaining BLE device name by parsing advertising data.

Fork of BLE_BlueNRG by Mridupawan Das

Revision:
3:9c4c13795643
Parent:
2:a2b623661316
Child:
4:fa5b5693c1b5
--- a/btle/src/btle.cpp	Mon Jul 21 08:28:47 2014 +0000
+++ b/btle/src/btle.cpp	Mon Jul 21 14:10:22 2014 +0000
@@ -35,7 +35,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <stm32l0xx_bluenrg_shield_bsp.h>
-//#include "sensor_service.h"
 #include "role_type.h"
 #include "debug.h"
 
@@ -151,14 +150,57 @@
 extern "C" {
 #endif
 
-extern void HCI_Event_CB(void *ptr) {
-    int a=3;
-    int b=5;
+extern void HCI_Event_CB(void *pckt) {
+    
+    hci_uart_pckt *hci_pckt = (hci_uart_pckt*)pckt;
+    hci_event_pckt *event_pckt = (hci_event_pckt*)hci_pckt->data;
     
-    int sum = a+b;
+    if(hci_pckt->type != HCI_EVENT_PKT)
+    return;
+
+    switch(event_pckt->evt){
+        
+        case EVT_DISCONN_COMPLETE:
+            {
+              //GAP_DisconnectionComplete_CB();
+            }
+            break;
+        
+        case EVT_LE_META_EVENT:
+            {
+                evt_le_meta_event *evt = (evt_le_meta_event *)event_pckt->data;
+              
+                switch(evt->subevent){
+                    case EVT_LE_CONN_COMPLETE:
+                        {
+                            //evt_le_connection_complete *cc = (void *)evt->data;
+                            //GAP_ConnectionComplete_CB(cc->peer_bdaddr, cc->handle);
+                        }
+                        break;
+                    }
+            }
+            break;
+        
+        case EVT_VENDOR:
+            {
+                evt_blue_aci *blue_evt = (evt_blue_aci*)event_pckt->data;
+                switch(blue_evt->ecode){
+    
+                    case EVT_BLUE_GATT_READ_PERMIT_REQ:
+                        {
+                            //evt_gatt_read_permit_req *pr = (void*)blue_evt->data;                    
+                            //Read_Request_CB(pr->attr_handle);                    
+                        }
+                    break;
+            }
+        }
+        break;
+    }    
     
     return ;
-    }
+}
+
+
 #ifdef __cplusplus
     }
 #endif
\ No newline at end of file