wifi_scan_request.cc 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. #include "chre/core/wifi_scan_request.h"
  17. namespace chre {
  18. WifiScanType getWifiScanTypeForEnum(enum chreWifiScanType enumWifiScanType) {
  19. switch (enumWifiScanType) {
  20. case CHRE_WIFI_SCAN_TYPE_ACTIVE:
  21. return WifiScanType::Active;
  22. case CHRE_WIFI_SCAN_TYPE_ACTIVE_PLUS_PASSIVE_DFS:
  23. return WifiScanType::ActivePlusPassiveDfs;
  24. case CHRE_WIFI_SCAN_TYPE_PASSIVE:
  25. return WifiScanType::Passive;
  26. default:
  27. return WifiScanType::Invalid;
  28. }
  29. }
  30. WifiScanRequest::WifiScanRequest()
  31. : WifiScanRequest(WifiScanType::Invalid,
  32. Nanoseconds(UINT64_MAX) /* maxScanAge */,
  33. DynamicVector<uint32_t>() /* frequencies */,
  34. DynamicVector<WifiSsid>() /* ssids */) {}
  35. WifiScanRequest::WifiScanRequest(WifiScanType scanType,
  36. const Nanoseconds& maxScanAge,
  37. DynamicVector<uint32_t>&& frequencies,
  38. DynamicVector<WifiSsid>&& ssids)
  39. : mScanType(scanType),
  40. mMaxScanAge(maxScanAge),
  41. mFrequencies(std::move(frequencies)),
  42. mSsids(std::move(ssids)) {}
  43. WifiScanType WifiScanRequest::getScanType() const {
  44. return mScanType;
  45. }
  46. const Nanoseconds& WifiScanRequest::getMaxScanAge() const {
  47. return mMaxScanAge;
  48. }
  49. const DynamicVector<uint32_t>& WifiScanRequest::getFrequencies() const {
  50. return mFrequencies;
  51. }
  52. const DynamicVector<WifiSsid>& WifiScanRequest::getSsids() const {
  53. return mSsids;
  54. }
  55. } // namespace chre