None

Fork of cc3000_hostdriver_mbedsocket by Martin Kojtal

Revision:
14:28c8bbbea025
Parent:
0:615c697c33b0
Child:
17:14b6a3a2b622
--- a/cc3000_event.cpp	Wed Oct 02 15:00:07 2013 +0000
+++ b/cc3000_event.cpp	Wed Oct 02 15:26:41 2013 +0000
@@ -44,6 +44,61 @@
 
 namespace mbed_cc3000 {
 
+#if CC3000_DEBUG == 1
+const char *HCI_EVENT_STR[] =
+{
+    "Socket",
+    "Bind",
+    "Send",
+    "Recv",
+    "Accept",
+    "Listen",
+    "Connect",
+    "BSD Select",
+    "Set Socket Options",
+    "Get Socket Options",
+    "Close Socket",
+    "Unknown",
+    "Recv From",
+    "Write",
+    "Send To",
+    "Get Hostname",
+    "mDNS Advertise"
+};
+
+const char *HCI_NETAPP_STR[] =
+{
+    "DHCP",
+    "Ping Sent",
+    "Ping Report",
+    "Ping Stop",
+    "IP Config",
+    "ARP Flush",
+    "Unknown",
+    "Set Debug level",
+    "Set Timers"
+};
+
+// from 0-7
+const char *HCI_MISC_STR[] =
+{
+    "BASE - Error?",
+    "Connecting",
+    "Disconnect",
+    "Scan Param",
+    "Connect Policy",
+    "Add Profile",
+    "Del Profile",
+    "Get Scan Res",
+    "Event Mask",
+    "Status Req",
+    "Config Start",
+    "Config Stop",
+    "Config Set Prefix",
+    "Config Patch",
+};
+#endif
+
 cc3000_event::cc3000_event(cc3000_simple_link &simplelink, cc3000_hci &hci, cc3000_spi &spi, cc3000 &cc3000)
     : socket_active_status(SOCKET_STATUS_INIT_VAL), _simple_link(simplelink), _hci(hci), _spi(spi), _cc3000(cc3000) {
 
@@ -121,6 +176,28 @@
     }
 }
 
+void cc3000_event::hci_event_debug_print ( uint16_t hciEventNo )
+{
+#if CC3000_DEBUG == 1
+    if (( hciEventNo > HCI_CMND_SOCKET_BASE) && ( hciEventNo <= HCI_CMND_MDNS_ADVERTISE))
+    {
+        DBG_HCI("Event Received : 0x%04X - %s", hciEventNo, HCI_EVENT_STR[hciEventNo-HCI_CMND_SOCKET]);
+    }
+    else if ((hciEventNo > HCI_CMND_NETAPP_BASE) && ( hciEventNo <= HCI_NETAPP_SET_TIMERS))
+    {
+        DBG_HCI("Event Received : 0x%04X - %s", hciEventNo, HCI_NETAPP_STR[hciEventNo-HCI_NETAPP_DHCP]);
+    }
+    else if (hciEventNo < HCI_CMND_WLAN_CONFIGURE_PATCH+1)
+    {
+        DBG_HCI("Event Received : 0x%04X - %s", hciEventNo, HCI_MISC_STR[hciEventNo]);
+    }
+    else
+    {
+        DBG_HCI("Event Received : 0x%04X", hciEventNo);
+    }
+#endif
+}
+
 uint8_t *cc3000_event::hci_event_handler(void *ret_param, uint8_t *from, uint8_t *fromlen) {
     uint8_t *received_data, argument_size;
     uint16_t length;
@@ -148,6 +225,8 @@
                 {
                     STREAM_TO_UINT8(received_data, HCI_DATA_LENGTH_OFFSET, length);
 
+                    hci_event_debug_print( received_op_code );
+                    
                     switch(received_op_code)
                     {
                     case HCI_CMND_READ_BUFFER_SIZE: