PnoNetwork.java revision a49633f87905530426cbfa6ab9586d282ab5df3f
1/*
2 * Copyright (C) 2016 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
17package com.android.server.wifi.wificond;
18
19import android.os.Parcel;
20import android.os.Parcelable;
21
22/**
23 * PnoNetwork for wificond
24 *
25 * @hide
26 */
27public class PnoNetwork implements Parcelable {
28
29    public boolean isHidden;
30    public byte[] ssid;
31
32    /** public constructor */
33    public PnoNetwork() { }
34
35    /** implement Parcelable interface */
36    @Override
37    public int describeContents() {
38        return 0;
39    }
40
41    /**
42     * implement Parcelable interface
43     * |flag| is ignored.
44     */
45    @Override
46    public void writeToParcel(Parcel out, int flags) {
47        out.writeInt(isHidden ? 1 : 0);
48        out.writeByteArray(ssid);
49    }
50
51    /** implement Parcelable interface */
52    public static final Parcelable.Creator<PnoNetwork> CREATOR =
53            new Parcelable.Creator<PnoNetwork>() {
54        @Override
55        public PnoNetwork createFromParcel(Parcel in) {
56            PnoNetwork result = new PnoNetwork();
57            result.isHidden = in.readInt() != 0 ? true : false;
58            result.ssid = in.createByteArray();
59            return result;
60        }
61
62        @Override
63        public PnoNetwork[] newArray(int size) {
64            return new PnoNetwork[size];
65        }
66    };
67}
68