Remove RTT feature
authorSeonah Moon <seonah1.moon@samsung.com>
Tue, 25 Aug 2020 07:11:31 +0000 (16:11 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Tue, 25 Aug 2020 07:11:31 +0000 (16:11 +0900)
include/NanHal.h
include/RttConfig.h [deleted file]
include/RttEventCallback.h [deleted file]
include/RttHalEventCallbackHandler.h [deleted file]
include/RttResult.h [deleted file]
src/CMakeLists.txt
src/NanHal.cpp
src/NanServiceProvider.cpp
src/RttConfig.cpp [deleted file]
src/RttHalEventCallbackHandler.cpp [deleted file]

index ccd948019279ef58970141e02f1a7067624fdbc3..d030e31c8f1cb8a3810288111e02eacdd6a9560d 100644 (file)
 #include "FollowupConfig.h"
 #include "DataPathConfig.h"
 #include "DataPathEndConfig.h"
-#include "RttConfig.h"
 
 #include "NanDefinitions.h"
 
 #include "NanEventCallback.h"
 #include "NanHalEventCallbackHandler.h"
 
-#include "RttEventCallback.h"
-#include "RttHalEventCallbackHandler.h"
-
 #include "interface/wifi_hal.h"
 #include "interface/wifi_nan.h"
 
@@ -56,7 +52,6 @@ public:
 
        std::string getWifiInterfaceName();
        NanError registerCallbackHandler(const NanEventCallback& userCallbacks);
-       NanError registerRttCallbackHandler(const RttEventCallback& userCallbacks);
 
        void getCapabilities(void);
 
@@ -80,7 +75,6 @@ public:
        void createDataPathInterface(const std::string& dataPathIfaceName);
        void deleteDataPathInterface(const std::string& dataPathIfaceName);
 
-       void requestRttRange(std::vector<std::shared_ptr<RttConfig>> rttConfigs);
 
 private:
        void loadHalLibrary(std::string libraryPath);
@@ -109,7 +103,6 @@ private:
                        std::shared_ptr<DataPathConfig> config);
        NanDataPathEndRequest *convertDataPathEndConfigToLegacyRequest(
                        std::shared_ptr<DataPathEndConfig> config);
-       wifi_rtt_config *convertRttConfigToLegacyConfig(std::shared_ptr<RttConfig> config);
 
        NanError convertLegacyErrorToNanError(wifi_error error);
 
@@ -119,9 +112,6 @@ private:
        NanHalEventCallbackHandler mEventHandler;
        NanEventCallback mUserCallbacks;
 
-       RttHalEventCallbackHandler mRttEventHandler;
-       RttEventCallback mRttUserCallbacks;
-
        wifi_hal_fn mFunctionTable;
        wifi_handle mWifiHandle;
 
diff --git a/include/RttConfig.h b/include/RttConfig.h
deleted file mode 100644 (file)
index a30bb5b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include "NanConfig.h"
-#include "NanDefinitions.h"
-
-NAN_NAMESPACE_BEGIN
-
-typedef enum {
-       RTT_TYPE_1_SIDED = 0,
-       RTT_TYPE_2_SIDED,
-       RTT_TYPE_MAX
-} RttType;
-
-typedef enum {
-       RTT_DEVICE_TYPE_AP = 0,
-       RTT_DEVICE_TYPE_STA,
-       RTT_DEVICE_TYPE_P2P_GO,
-       RTT_DEVICE_TYPE_P2P_CLIENT,
-       RTT_DEVICE_TYPE_NAN,
-       RTT_DEVICE_TYPE_MAX
-} RttDeviceType;
-
-typedef struct {
-       uint32_t width;
-       uint32_t centerFreq;
-       uint32_t centerFreq0;
-       uint32_t centerFreq1;
-} RttChannelInfo;
-
-class RttConfig : public NanConfig
-{
-public:
-       uint8_t addr[NAN_MAC_ADDR_LEN];
-       RttType rttType; // wifi_rtt_type
-       RttDeviceType deviceType; // rtt_peer_type
-       RttChannelInfo channel;
-       uint32_t burstPeriod;
-       uint32_t numBurst;
-       uint32_t numFramesPerBurst;
-       uint32_t numRetriesPerRttFrame;
-       uint32_t numRetriesPerFtmr;
-       uint32_t burstDuration;
-
-       bool requestLCI;
-       bool requestLCR;
-
-       uint32_t preamble;      // wifi_rtt_preamble
-       uint32_t bandwidth; // wifi_rtt_bw
-
-       virtual ~RttConfig() {}
-
-       void setDefaultValues();
-       static std::shared_ptr<RttConfig> createDefaultConfig();
-
-       inline const char *convertRttTypeToString(int type);
-       inline const char *convertDeviceTypeToString(int type);
-       void logConfigurations();
-};
-
-NAN_NAMESPACE_END
diff --git a/include/RttEventCallback.h b/include/RttEventCallback.h
deleted file mode 100644 (file)
index 9e3d08f..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <functional>
-
-#include "RttResult.h"
-#include "NanError.h"
-
-NAN_NAMESPACE_BEGIN
-
-struct RttEventCallback {
-       std::function<void(uint16_t, std::vector<RttResult>)> on_notify_rtt_results;
-};
-
-NAN_NAMESPACE_END
diff --git a/include/RttHalEventCallbackHandler.h b/include/RttHalEventCallbackHandler.h
deleted file mode 100644 (file)
index b30d420..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __RTT_HAL_EVENT_CALLBACK_HANDLER_H__
-#define __RTT_HAL_EVENT_CALLBACK_HANDLER_H__
-
-#include "RttEventCallback.h"
-#include "NanDefinitions.h"
-
-#include "interface/rtt.h"
-
-NAN_NAMESPACE_BEGIN
-
-class RttHalEventCallbackHandler
-{
-public:
-       RttHalEventCallbackHandler();
-       virtual ~RttHalEventCallbackHandler();
-
-       void registerUserCallbacks(const RttEventCallback& userCallbacks);
-       wifi_rtt_event_handler getRttEventHandler();
-
-private:
-       wifi_rtt_event_handler mCallbacks;
-};
-
-NAN_NAMESPACE_END
-
-#endif
diff --git a/include/RttResult.h b/include/RttResult.h
deleted file mode 100644 (file)
index 18d1145..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#include <stdint.h>
-
-#include "NanDefinitions.h"
-#include "NanError.h"
-
-NAN_NAMESPACE_BEGIN
-
-class RttResult
-{
-public:
-       // TODO
-       uint8_t addr[8];
-       uint32_t numMeasurement;
-};
-
-NAN_NAMESPACE_END
index 442ce8d053943002f159a7b242545818cfd8b1bc..1498533d67435465d869996ccb1e3d9deed7e859 100644 (file)
@@ -44,8 +44,6 @@ SET(SRCS
        ${CMAKE_SOURCE_DIR}/src/FollowupConfig.cpp
        ${CMAKE_SOURCE_DIR}/src/DataPathConfig.cpp
        ${CMAKE_SOURCE_DIR}/src/DataPathEndConfig.cpp
-       ${CMAKE_SOURCE_DIR}/src/RttConfig.cpp
-       ${CMAKE_SOURCE_DIR}/src/RttHalEventCallbackHandler.cpp
        ${CMAKE_SOURCE_DIR}/src/TlvUtils.cpp
        ${CMAKE_SOURCE_DIR}/src/main.cpp
        ${CMAKE_SOURCE_DIR}/interface/generated-code.c
index 7c82f5c682e07e44f2ac2cf167bfe1887c557cba..eb36f3bfdbeb1943008988ea8dd76211229c6f35 100644 (file)
 #include "PublishConfig.h"
 #include "NanLog.h"
 #include "NanUtils.h"
-#include "RttEventCallback.h"
 
 #include "interface/wifi_hal.h"
 #include "interface/wifi_nan.h"
-#include "interface/rtt.h"
 
 using namespace std;
 NAN_NAMESPACE_USE;
@@ -124,13 +122,6 @@ NanError NanHal::registerCallbackHandler(const NanEventCallback& userCallbacks)
        return NAN_ERROR_NONE;
 }
 
-NanError NanHal::registerRttCallbackHandler(const RttEventCallback& userCallbacks)
-{
-       mRttEventHandler.registerUserCallbacks(userCallbacks);
-       mRttUserCallbacks = userCallbacks;
-       return NAN_ERROR_NONE;
-}
-
 void NanHal::getCapabilities(void)
 {
        __NAN_LOG_FUNC_ENTER__;
@@ -560,36 +551,6 @@ void NanHal::deleteDataPathInterface(const std::string& dataPathIfaceName)
        __NAN_LOG_FUNC_EXIT__;
 }
 
-//void NanHal::requestRttRange(vector<std::shared_ptr<RttConfig>> rttConfigs, uint32_t numConfigs)
-void NanHal::requestRttRange(std::vector<std::shared_ptr<RttConfig>> rttConfigs)
-{
-       __NAN_LOG_FUNC_ENTER__;
-       wifi_error ret = WIFI_ERROR_NONE;
-       //NanError error = NAN_ERROR_NONE;
-       std::vector<wifi_rtt_config> configs;
-
-       for (std::shared_ptr<RttConfig> & rttConfig : rttConfigs) {
-               wifi_rtt_config *config = convertRttConfigToLegacyConfig(rttConfig);
-               if (config == nullptr) {
-                       NAN_LOGE("Failed to convert from RttConfig to wifi_rtt_config");
-                       // TODO: Error handling
-                       __NAN_LOG_FUNC_EXIT__;
-                       return;
-               }
-               configs.push_back(*config);
-       }
-
-       uint16_t transactionId = nextTransactionId();
-       wifi_rtt_event_handler callbacks = mRttEventHandler.getRttEventHandler();
-
-       // TODO: implement event handler
-       ret = mFunctionTable.wifi_rtt_range_request(transactionId,
-                       getWifiIfaceHandle(mWifiInterfaceName),
-                       configs.size(), configs.data(), callbacks);
-
-       __NAN_LOG_FUNC_EXIT__;
-}
-
 void NanHal::runEventLoop()
 {
        NAN_LOGI("Run NAN event loop");
@@ -1152,36 +1113,6 @@ NanDataPathEndRequest *NanHal::convertDataPathEndConfigToLegacyRequest(std::shar
        return ndpEndReq;
 }
 
-wifi_rtt_config *NanHal::convertRttConfigToLegacyConfig(std::shared_ptr<RttConfig> config)
-{
-       wifi_rtt_config *rttConfig = (wifi_rtt_config *)calloc(1, sizeof(wifi_rtt_config));
-
-       if (!rttConfig) {
-               NAN_LOGE("Out of memory");
-               return nullptr;
-       }
-
-       memcpy(&rttConfig->addr, config->addr, NAN_MAC_ADDR_LEN);
-       rttConfig->type = (wifi_rtt_type)config->rttType;
-       rttConfig->peer = (rtt_peer_type)config->deviceType;
-       
-       //rttConfig->channel;
-       rttConfig->burst_period = config->burstPeriod;
-
-       rttConfig->num_burst = config->numBurst;
-       rttConfig->num_frames_per_burst = config->numFramesPerBurst;
-       rttConfig->num_retries_per_rtt_frame = config->numRetriesPerRttFrame; 
-       rttConfig->num_retries_per_ftmr = config->numRetriesPerFtmr;
-
-       rttConfig->LCI_request = config->requestLCI;
-       rttConfig->LCR_request = config->requestLCR;
-       rttConfig->burst_duration = config->burstDuration;
-       rttConfig->preamble = (wifi_rtt_preamble)config->preamble;
-       rttConfig->bw = (wifi_rtt_bw)config->bandwidth;
-
-       return rttConfig;
-}
-
 NanError NanHal::convertLegacyErrorToNanError(wifi_error error)
 {
        switch (error)
index 6e5f30027a64e00f9a016633be75a389660b422d..329101e443689c4d22dccb5ec89749aee1bcc7b3 100644 (file)
@@ -52,7 +52,6 @@ void NanServiceProvider::init()
 void NanServiceProvider::registerCallbacks()
 {
        NanEventCallback callbacks;
-       RttEventCallback rttCallbacks;
 
        callbacks.on_notify_enable_response
                = [=](uint16_t transactionId, NanError error) {
@@ -159,14 +158,7 @@ void NanServiceProvider::registerCallbacks()
                        receiveSessionTerminatedEvent(subscribeId, error);
                };
 
-       rttCallbacks.on_notify_rtt_results
-               = [=](uint16_t rttId, std::vector<RttResult> results) {
-                       // TODO
-                       NAN_LOGI("rtt results callback");
-               };
-
        mHal->registerCallbackHandler(callbacks);
-       mHal->registerRttCallbackHandler(rttCallbacks);
 }
 
 void NanServiceProvider::setEnabled(bool enabled)
diff --git a/src/RttConfig.cpp b/src/RttConfig.cpp
deleted file mode 100644 (file)
index 52cc46b..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "RttConfig.h"
-#include "NanLog.h"
-#include "NanUtils.h"
-
-NAN_NAMESPACE_USE;
-
-void RttConfig::setDefaultValues()
-{
-       rttType = RTT_TYPE_1_SIDED;
-       deviceType = RTT_DEVICE_TYPE_AP;
-
-//     channel.width = 0;
-//     channel.center_freq = 0;
-//     channel.center_freq0 = 0;
-//     channel.center_freq1 = 0;
-
-       burstPeriod = 0;
-       numBurst = 0;
-       numFramesPerBurst = 8; // NAN: 5, Others: 8
-       numRetriesPerRttFrame = 0;
-       numRetriesPerFtmr = 0;
-       burstDuration = 15;
-
-       requestLCI = false;
-       requestLCR = false;
-
-       preamble = 0x2; // WIFI_RTT_PREAMBLE_HT
-       bandwidth = 0x04; // WIFI_RTT_BW_20
-}
-
-std::shared_ptr<RttConfig> RttConfig::createDefaultConfig()
-{
-       std::shared_ptr<RttConfig> config(new RttConfig);
-       config->setDefaultValues();
-       return config;
-}
-
-const char *RttConfig::convertRttTypeToString(int type)
-{
-       switch (type) {
-               case RTT_TYPE_1_SIDED:
-                       return "1-sided";
-               case RTT_TYPE_2_SIDED:
-                       return "2-sided";
-               case RTT_TYPE_MAX:
-               default:
-                       return "Unknown Type";
-       }
-    return "Unknown Type";
-}
-
-const char *RttConfig::convertDeviceTypeToString(int type)
-{
-       switch (type) {
-               case RTT_DEVICE_TYPE_AP:
-                       return "AP";
-               case RTT_DEVICE_TYPE_STA:
-                       return "Station";
-               case RTT_DEVICE_TYPE_P2P_GO:
-                       return "P2P GO";
-               case RTT_DEVICE_TYPE_P2P_CLIENT:
-                       return "P2P Client";
-               case RTT_DEVICE_TYPE_NAN:
-                       return "NAN";
-               case RTT_DEVICE_TYPE_MAX:
-               default:
-                       return "Unknown Type";
-       }
-       return "Unknown Type";
-}
-
-void RttConfig::logConfigurations()
-{
-       NAN_LOGD("RttConfig");
-       NAN_LOGD("\t- peer address: %x:%x:%x:%x:%x:%x",
-                       addr[0], addr[1], addr[2], addr[3], addr[4], addr[5]);
-       NAN_LOGD("\t- rtt type: %s", convertRttTypeToString(rttType));
-       NAN_LOGD("\t- peer type: %s", convertDeviceTypeToString(deviceType));
-       NAN_LOGD("\t- burst info: period[%d] num[%d] frames per burst[%d] \
-                       retries per rtt[%d] retries per ftmr[%d] duration[%d]",
-                       burstPeriod, numBurst, numFramesPerBurst,
-                       numRetriesPerRttFrame, numRetriesPerFtmr, burstDuration);
-       NAN_LOGD("\t- requestLCI: %s", requestLCI ? "yes" : "no");
-       NAN_LOGD("\t- requestLCR: %s", requestLCR ? "yes" : "no");
-       NAN_LOGD("\t- preamble: %x", preamble);
-       NAN_LOGD("\t- bandwidth: %x", bandwidth);
-}
diff --git a/src/RttHalEventCallbackHandler.cpp b/src/RttHalEventCallbackHandler.cpp
deleted file mode 100644 (file)
index cccdf9f..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <functional>
-#include <vector>
-#include <glib.h>
-
-#include "RttHalEventCallbackHandler.h"
-#include "RttEventCallback.h"
-#include "RttResult.h"
-
-#include "NanLog.h"
-
-#include "interface/wifi_hal.h"
-#include "interface/rtt.h"
-
-NAN_NAMESPACE_USE;
-
-/* Callbacks for NAN Interface */
-std::function<void(uint16_t, std::vector<RttResult>)> on_notify_rtt_results;
-
-void onRttResults(wifi_request_id id, unsigned num_results, wifi_rtt_result *rtt_result[])
-{
-       __NAN_LOG_FUNC_ENTER__;
-       // attachEventSource();
-       __NAN_LOG_FUNC_EXIT__;
-}
-
-void raiseRttResultsEvent()
-{
-       __NAN_LOG_FUNC_ENTER__;
-       if (!on_notify_rtt_results)
-               return;
-
-//     on_notify_rtt_results(req_id, results);
-
-       __NAN_LOG_FUNC_EXIT__;
-}
-
-// Public methods
-RttHalEventCallbackHandler::RttHalEventCallbackHandler()
-{
-       __NAN_LOG_FUNC_ENTER__;
-
-       mCallbacks.on_rtt_results = onRttResults;
-
-       __NAN_LOG_FUNC_EXIT__;
-}
-
-RttHalEventCallbackHandler::~RttHalEventCallbackHandler()
-{
-       __NAN_LOG_FUNC_ENTER__;
-       __NAN_LOG_FUNC_EXIT__;
-}
-
-void RttHalEventCallbackHandler::registerUserCallbacks(const RttEventCallback& userCallbacks)
-{
-       __NAN_LOG_FUNC_ENTER__;
-
-       on_notify_rtt_results = userCallbacks.on_notify_rtt_results;
-
-       __NAN_LOG_FUNC_EXIT__;
-}
-
-wifi_rtt_event_handler RttHalEventCallbackHandler::getRttEventHandler()
-{
-       return mCallbacks;
-}