Home | History | Annotate | Download | only in core
      1 /*
      2  * Copyright (C) 2017 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include "chre/core/wifi_scan_request.h"
     18 
     19 namespace chre {
     20 
     21 WifiScanType getWifiScanTypeForEnum(enum chreWifiScanType enumWifiScanType) {
     22   switch (enumWifiScanType) {
     23     case CHRE_WIFI_SCAN_TYPE_ACTIVE:
     24       return WifiScanType::Active;
     25     case CHRE_WIFI_SCAN_TYPE_ACTIVE_PLUS_PASSIVE_DFS:
     26       return WifiScanType::ActivePlusPassiveDfs;
     27     case CHRE_WIFI_SCAN_TYPE_PASSIVE:
     28       return WifiScanType::Passive;
     29     default:
     30       return WifiScanType::Invalid;
     31   }
     32 }
     33 
     34 WifiScanRequest::WifiScanRequest()
     35     : WifiScanRequest(WifiScanType::Invalid,
     36                       Nanoseconds(UINT64_MAX) /* maxScanAge */,
     37                       DynamicVector<uint32_t>() /* frequencies */,
     38                       DynamicVector<WifiSsid>() /* ssids */) {}
     39 
     40 WifiScanRequest::WifiScanRequest(WifiScanType scanType,
     41                                  const Nanoseconds& maxScanAge,
     42                                  DynamicVector<uint32_t>&& frequencies,
     43                                  DynamicVector<WifiSsid>&& ssids)
     44     : mScanType(scanType),
     45       mMaxScanAge(maxScanAge),
     46       mFrequencies(std::move(frequencies)),
     47       mSsids(std::move(ssids)) {}
     48 
     49 WifiScanType WifiScanRequest::getScanType() const {
     50   return mScanType;
     51 }
     52 
     53 const Nanoseconds& WifiScanRequest::getMaxScanAge() const {
     54   return mMaxScanAge;
     55 }
     56 
     57 const DynamicVector<uint32_t>& WifiScanRequest::getFrequencies() const {
     58   return mFrequencies;
     59 }
     60 
     61 const DynamicVector<WifiSsid>& WifiScanRequest::getSsids() const {
     62   return mSsids;
     63 }
     64 
     65 }  // namespace chre
     66