[APR-2987]wlbt: NAN datapath logs

print command and event names

Change-Id: I2a8ba3361b2bdd649e4c6c952055e566ea3139cc
SCSC-Bug-Id: HOST-11235
Signed-off-by: Jaya Prakash Sangaru <j.sangaru@samsung.com>
diff --git a/nan_data.h b/nan_data.h
index 4b93d97..5cd3bd7 100755
--- a/nan_data.h
+++ b/nan_data.h
@@ -49,5 +49,6 @@
     int getResponseTransactionId(NanResponseMsg *res);
     static int putSecurityInfo(u32 cipher, NanSecurityKeyInfo *key_info, u32 scid_len,
                                u8 *scid, WifiRequest *request);
+    static const u8 *getCmdName(int cmd);
 };
 #endif
diff --git a/wifi_nan.cpp b/wifi_nan.cpp
index 8ef1ebf..ebb0762 100755
--- a/wifi_nan.cpp
+++ b/wifi_nan.cpp
@@ -72,6 +72,38 @@
         unregisterVendorHandler(GOOGLE_OUI, SLSI_NAN_EVENT_NDP_END);
     }
 
+    static const u8 *getEventName(int event) {
+        switch(event) {
+        case SLSI_NAN_EVENT_RESPONSE:
+            return (const u8 *)"SLSI_NAN_EVENT_RESPONSE";
+        case SLSI_NAN_EVENT_PUBLISH_TERMINATED:
+            return (const u8 *)"SLSI_NAN_EVENT_PUBLISH_TERMINATED";
+        case SLSI_NAN_EVENT_MATCH:
+            return (const u8 *)"SLSI_NAN_EVENT_MATCH";
+        case SLSI_NAN_EVENT_MATCH_EXPIRED:
+            return (const u8 *)"SLSI_NAN_EVENT_MATCH_EXPIRED";
+        case SLSI_NAN_EVENT_SUBSCRIBE_TERMINATED:
+            return (const u8 *)"SLSI_NAN_EVENT_SUBSCRIBE_TERMINATED";
+        case SLSI_NAN_EVENT_FOLLOWUP:
+            return (const u8 *)"SLSI_NAN_EVENT_FOLLOWUP";
+        case SLSI_NAN_EVENT_DISCOVERY_ENGINE:
+            return (const u8 *)"SLSI_NAN_EVENT_DISCOVERY_ENGINE";
+        case SLSI_NAN_EVENT_DISABLED:
+            return (const u8 *)"SLSI_NAN_EVENT_DISABLED";
+        case SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS:
+            return (const u8 *)"SLSI_NAN_EVENT_TRANSMIT_FOLLOWUP_STATUS";
+        case SLSI_NAN_EVENT_NDP_REQ:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_REQ";
+        case SLSI_NAN_EVENT_NDP_CFM:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_CFM";
+        case SLSI_NAN_EVENT_NDP_END:
+            return (const u8 *)"SLSI_NAN_EVENT_NDP_END";
+        default:
+            return (const u8 *)"UNKNOWN event";
+        }
+        return (const u8 *)"UNKNOWN event";
+    }
+
     int processResponse(WifiEvent &reply, NanResponseMsg *response) {
         NanCapabilities *capabilities = &response->body.nan_capabilities;
         nlattr *vendor_data = reply.get_attribute(NL80211_ATTR_VENDOR_DATA);
@@ -1286,7 +1318,7 @@
         int id = event.get_vendor_id();
         int subcmd = event.get_vendor_subcmd();
 
-        ALOGI("NAN %s Id = 0x%x, subcmd = 0x%x", __func__, id, subcmd);
+        ALOGI("NAN %s Id = 0x%x, subcmd = %s(0x%x)", __func__, id, getEventName(subcmd), subcmd);
 
         switch(subcmd) {
         case SLSI_NAN_EVENT_MATCH:
@@ -1384,7 +1416,7 @@
         int result;
         WifiRequest request(familyId(), ifaceId());
 
-        ALOGI("NAN DATA-PATH req subcmd:0x%x transaction_id:%d", subcmd, id);
+        ALOGI("NAN DATA-PATH req subcmd:%s(0x%x) transaction_id:%d", datacmd.getCmdName(subcmd), subcmd, id);
 
         result = datacmd.getDataPathNLMsg(id, data, subcmd, request);
         if (result != WIFI_SUCCESS) {
@@ -1392,11 +1424,11 @@
         }
         result = requestResponse(request);
         if (result != WIFI_SUCCESS) {
-            ALOGE("failed DATA-PATH req; result = %d", result);
+            ALOGE("NAN DATA-PATH req subcmd:%s(0x%x)...failed(%d)", datacmd.getCmdName(subcmd), subcmd, result);
             unregisterNanEvents();
         } else {
             datacmd.requestSuccess(id, data, subcmd);
-            ALOGD("NAN DATA-PATH req(subcmd:0x%x)...success", subcmd);
+            ALOGD("NAN DATA-PATH req subcmd:%s(0x%x)...success", datacmd.getCmdName(subcmd), subcmd);
         }
         return result;
     }
diff --git a/wifi_nan_data_path.cpp b/wifi_nan_data_path.cpp
index a5a31bf..fbc48df 100755
--- a/wifi_nan_data_path.cpp
+++ b/wifi_nan_data_path.cpp
@@ -422,4 +422,22 @@
         CHECK_WIFI_STATUS_RETURN_FAIL(result, "enable:Failed to put scid");
     }
     return result;
+}
+
+const u8 *NanDataCommand::getCmdName(int cmd){
+    switch(cmd) {
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_CREATE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INTERFACE_DELETE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_REQUEST_INITIATOR";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_INDICATION_RESPONSE";
+    case SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END:
+        return (const u8 *)"SLSI_NL80211_VENDOR_SUBCMD_NAN_DATA_END";
+    default:
+        return (const u8 *)"UNKNOWN CMD";
+    }
+    return (const u8 *)"UNKNOWN CMD";
 }
\ No newline at end of file