[APR-2053]wlbt: NAN R2 integration fxes
[GitHub/MotorolaMobilityLLC/hardware-samsung_slsi-scsc_wifibt-wifi_hal.git] / rtt.cpp
diff --git a/rtt.cpp b/rtt.cpp
index fe94c3073d69bf45c6ada1d206ffe0afd881127c..9a1ef3a31ed0af381f667b7faf622cd9ed12ae2d 100755 (executable)
--- a/rtt.cpp
+++ b/rtt.cpp
@@ -32,10 +32,7 @@ typedef enum {
     SLSI_RTT_ATTRIBUTE_TARGET_MAC,
     SLSI_RTT_ATTRIBUTE_TARGET_TYPE,
     SLSI_RTT_ATTRIBUTE_TARGET_PEER,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_WIDTH,
     SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ0,
-    SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ1,
     SLSI_RTT_ATTRIBUTE_TARGET_PERIOD,
     SLSI_RTT_ATTRIBUTE_TARGET_NUM_BURST,
     SLSI_RTT_ATTRIBUTE_TARGET_NUM_FTM_BURST,
@@ -132,7 +129,7 @@ static const strmap_entry_t err_info[] = {
 }*/
 class RttCommand : public WifiCommand
 {
-       int rtt_id;
+    int rtt_id;
     unsigned numTargetDevice;
     int mCompleted;
     int currentIdx;
@@ -154,8 +151,10 @@ public:
     }
 
     RttCommand(wifi_interface_handle iface, int id)
-        : WifiCommand(iface, id)
+        : WifiCommand(iface, id), rtt_id(id), rttParams(NULL)
     {
+        rttHandler.on_rtt_results = NULL;
+        memset(rttResults, 0, sizeof(rttResults));
         currentIdx = 0;
         mCompleted = 0;
         totalCnt = 0;
@@ -201,21 +200,6 @@ public:
                        ALOGI("\trtt_ primary channel_freq %d\n",rttParams[i].channel.center_freq);
             if (result < 0) {
                 return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_WIDTH, rttParams[i].channel.width);
-                       ALOGI("\trtt_channel width:%d\n",rttParams[i].channel.width);
-            if (result < 0) {
-                return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ0, rttParams[i].channel.center_freq0);
-                       ALOGI("\trtt_channel_freq 0:%d\n",rttParams[i].channel.center_freq0);
-            if (result < 0) {
-                return result;
-            }
-               result = request.put_u16(SLSI_RTT_ATTRIBUTE_TARGET_CHAN_FREQ1, rttParams[i].channel.center_freq1);
-                       ALOGI("\trtt_channel_freq 1: %d\n",rttParams[i].channel.center_freq1);
-            if (result < 0) {
-                return result;
             }
             result = request.put_u8(SLSI_RTT_ATTRIBUTE_TARGET_NUM_BURST, rttParams[i].num_burst);
                        ALOGI("\tnum_burst %d\n",rttParams[i].num_burst);
@@ -414,11 +398,11 @@ public:
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_SUCCESS_NUM) {
                                          rtt_result->success_number = (unsigned)nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_NUM_PER_BURST_PEER) {
-                                         rtt_result->number_per_burst_peer = (byte)nl_nested_itr.get_u8();
+                                         rtt_result->number_per_burst_peer = (unsigned char)nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_STATUS) {
                                          rtt_result->status = (wifi_rtt_status)nl_nested_itr.get_u16();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_RETRY_AFTER_DURATION) {
-                                         rtt_result->retry_after_duration = (byte)nl_nested_itr.get_u8();
+                                         rtt_result->retry_after_duration = (unsigned char)nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_TYPE) {
                                          rtt_result->type = (wifi_rtt_type)nl_nested_itr.get_u16();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_RSSI) {
@@ -460,7 +444,7 @@ public:
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_TIMESTAMP_US) {
                                          rtt_result->ts = (wifi_timestamp)nl_nested_itr.get_u32();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_BURST_DURATION_MSN) {
-                                         rtt_result->burst_duration = nl_nested_itr.get_u16();
+                                         rtt_result->burst_duration = nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_NEGOTIATED_BURST_NUM) {
                                          rtt_result->negotiated_burst_num = nl_nested_itr.get_u8();
                                   } else if (nl_nested_itr.get_type() == SLSI_RTT_EVENT_ATTR_LCI) {