[rdkb][common][hal][Refactor getRadioSupportedStandards for single Wiphy]

[Description]
Refactor getRadioSupportedStandards for single Wiphy.

[Release-log]
N/A

Change-Id: Ifb2c839cdeb666ee1208b5f4c4ba87ed2c4e3bdc
diff --git a/src/wifi/wifi_hal.c b/src/wifi/wifi_hal.c
index 1cd5e0b..56983a8 100644
--- a/src/wifi/wifi_hal.c
+++ b/src/wifi/wifi_hal.c
@@ -1785,21 +1785,34 @@
     char buf[128]={0};
     char temp_output[128] = {0};
     wifi_band band;
-    int phyId = 0;
+    int phyId = 0, band_remap = 0, range_remap = 0;;
 
     WIFI_ENTRY_EXIT_DEBUG("Inside %s:%d\n",__func__, __LINE__);
-    if (NULL == output_string) 
+    if (NULL == output_string)
         return RETURN_ERR;
 
     band = wifi_index_to_band(radioIndex);
-    if (band == band_2_4) {
-        strcat(temp_output, "b,g,");
-    } else if (band == band_5) {
-        strcat(temp_output, "a,");
+    switch (band) {
+        case band_2_4:
+            band_remap = 1;
+            range_remap = 2;
+            strcat(temp_output, "b,g,");
+        break;
+        case band_5:
+            band_remap = 2;
+            range_remap = 4;
+            strcat(temp_output, "a,");
+        break;
+        case band_6:
+            band_remap = 4;
+            range_remap = 4;
+        break;
     }
     phyId = radio_index_to_phy(radioIndex);
     // ht capabilities
-    snprintf(cmd, sizeof(cmd),  "iw phy%d info | grep '[^PHY|MAC|VHT].Capabilities' | head -n 1 | cut -d ':' -f2 | sed 's/^.//' | tr -d '\\n'", phyId);
+    snprintf(cmd, sizeof(cmd),
+             "iw phy%d info | grep 'Band \\|[^PHY|MAC|VHT].Capabilities' | sed -n '/Band %d/,/Band %d/{/Band %d/n;/Band %d/b;p}' | head -n 1 | cut -d ':' -f2 | sed 's/^.//' | tr -d '\\n'",
+             phyId, band_remap, range_remap, band_remap, range_remap);
     _syscmd(cmd, buf, sizeof(buf));
     if (strlen(buf) >= 4 && strncmp(buf, "0x00", 4) != 0) {
         strcat(temp_output, "n,");
@@ -1807,7 +1820,9 @@
 
     // vht capabilities
     if (band == band_5) {
-        snprintf(cmd, sizeof(cmd),  "iw phy%d info | grep 'VHT Capabilities' | cut -d '(' -f2 | cut -c1-10 | tr -d '\\n'", phyId);
+        snprintf(cmd, sizeof(cmd),
+                 "iw phy%d info | grep 'Band \\|VHT Capabilities' | sed -n '/Band %d/,/Band %d/{/Band %d/n;/Band %d/b;p}' | cut -d '(' -f2 | cut -c1-10 | tr -d '\\n'",
+                 phyId, band_remap, range_remap, band_remap, range_remap);
         _syscmd(cmd, buf, sizeof(buf));
         if (strlen(buf) >= 10 && strncmp(buf, "0x00000000", 10) != 0) {
             strcat(temp_output, "ac,");
@@ -1815,14 +1830,18 @@
     }
 
     // he capabilities
-    snprintf(cmd, sizeof(cmd),  "iw phy%d info | grep 'HE MAC Capabilities' | head -n 2 | tail -n 1 | cut -d '(' -f2 | cut -c1-6 | tr -d '\\n'", phyId);
+    snprintf(cmd, sizeof(cmd),
+             "iw phy%d info | grep 'Band \\|HE MAC Capabilities' | sed -n '/Band %d/,/Band %d/{/Band %d/n;/Band %d/b;p}' | head -n 2 | tail -n 1 | cut -d '(' -f2 | cut -c1-6 | tr -d '\\n'",
+             phyId, band_remap, range_remap, band_remap, range_remap);
     _syscmd(cmd, buf, sizeof(buf));
     if (strlen(buf) >= 6 && strncmp (buf, "0x0000", 6) != 0) {
         strcat(temp_output, "ax,");
     }
 
     // eht capabilities
-    snprintf(cmd, sizeof(cmd),  "iw phy%d info | grep 'EHT MAC Capabilities' | head -n 2 | tail -n 1 | cut -d '(' -f2 | cut -c1-6 | tr -d '\\n'", phyId);
+    snprintf(cmd, sizeof(cmd),
+             "iw phy%d info | grep 'Band \\|EHT MAC Capabilities' | sed -n '/Band %d/,/Band %d/{/Band %d/n;/Band %d/b;p}' | head -n 2 | tail -n 1 | cut -d '(' -f2 | cut -c1-6 | tr -d '\\n'",
+             phyId, band_remap, range_remap, band_remap, range_remap);
     _syscmd(cmd, buf, sizeof(buf));
     if (strlen(buf) >= 6 && strncmp (buf, "0x0000", 6) != 0) {
         strcat(temp_output, "be,");