rtt/rtt_controller_impl.cpp \
scanning/channel_settings.cpp \
scanning/hidden_network.cpp \
+ scanning/pno_network.cpp \
scanning/scan_result.cpp \
scanning/single_scan_settings.cpp \
scanning/scan_utils.cpp \
--- /dev/null
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * 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 "wificond/scanning/pno_network.h"
+
+#include <android-base/logging.h>
+
+#include "wificond/parcelable_utils.h"
+
+using android::status_t;
+
+namespace com {
+namespace android {
+namespace server {
+namespace wifi {
+namespace wificond {
+
+status_t PnoNetwork::writeToParcel(::android::Parcel* parcel) const {
+ // This redundant writing of vector length is needed by Java side parsing.
+ // See writeToPracel() in wificond/scanning/scan_result.cpp for detailed
+ // explanation.
+ RETURN_IF_FAILED(parcel->writeInt32(ssid_.size()));
+ RETURN_IF_FAILED(parcel->writeByteVector(ssid_));
+ return ::android::OK;
+}
+
+status_t PnoNetwork::readFromParcel(const ::android::Parcel* parcel) {
+ int32_t ignored = 0;
+ RETURN_IF_FAILED(parcel->readInt32(&ignored));
+ RETURN_IF_FAILED(parcel->readByteVector(&ssid_));
+ return ::android::OK;
+}
+
+} // namespace wificond
+} // namespace wifi
+} // namespace server
+} // namespace android
+} // namespace com
--- /dev/null
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * 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 WIFICOND_SCANNING_PNO_NETWORK_H_
+#define WIFICOND_SCANNING_PNO_NETWORK_H_
+
+#include <vector>
+
+#include <binder/Parcel.h>
+#include <binder/Parcelable.h>
+
+namespace com {
+namespace android {
+namespace server {
+namespace wifi {
+namespace wificond {
+
+class PnoNetwork : public ::android::Parcelable {
+ public:
+ PnoNetwork() = default;
+ bool operator==(const PnoNetwork& rhs) const {
+ return ssid_ == rhs.ssid_;
+ }
+ ::android::status_t writeToParcel(::android::Parcel* parcel) const override;
+ ::android::status_t readFromParcel(const ::android::Parcel* parcel) override;
+
+ std::vector<uint8_t> ssid_;
+};
+
+} // namespace wificond
+} // namespace wifi
+} // namespace server
+} // namespace android
+} // namespace com
+
+#endif // WIFICOND_SCANNING_PNO_NETWORK_H_
#include "wificond/scanning/channel_settings.h"
#include "wificond/scanning/hidden_network.h"
+#include "wificond/scanning/pno_network.h"
#include "wificond/scanning/single_scan_settings.h"
using ::com::android::server::wifi::wificond::ChannelSettings;
using ::com::android::server::wifi::wificond::HiddenNetwork;
+using ::com::android::server::wifi::wificond::PnoNetwork;
using ::com::android::server::wifi::wificond::SingleScanSettings;
using std::vector;
EXPECT_EQ(scan_settings, scan_settings_copy);
}
+TEST_F(ScanSettingsTest, PnoNetworkParcelableTest) {
+ PnoNetwork pno_network;
+ pno_network.ssid_ =
+ vector<uint8_t>(kFakeSsid, kFakeSsid + sizeof(kFakeSsid));
+
+ Parcel parcel;
+ EXPECT_EQ(::android::OK, pno_network.writeToParcel(&parcel));
+
+ PnoNetwork pno_network_copy;
+ parcel.setDataPosition(0);
+ EXPECT_EQ(::android::OK, pno_network_copy.readFromParcel(&parcel));
+
+ EXPECT_EQ(pno_network, pno_network_copy);
+}
+
+
} // namespace wificond
} // namespace android