Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / src / android / CHIPTool / app / src / main / java / com / google / chip / chiptool / commissioner / thread / ThreadNetworkInfo.java
1 /*
2  *   Copyright (c) 2020 Project CHIP Authors
3  *   All rights reserved.
4  *
5  *   Licensed under the Apache License, Version 2.0 (the "License");
6  *   you may not use this file except in compliance with the License.
7  *   You may obtain a copy of the License at
8  *
9  *       http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *   Unless required by applicable law or agreed to in writing, software
12  *   distributed under the License is distributed on an "AS IS" BASIS,
13  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *   See the License for the specific language governing permissions and
15  *   limitations under the License.
16  *
17  */
18
19 package com.google.chip.chiptool.commissioner.thread;
20
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 import androidx.annotation.NonNull;
24
25 public class ThreadNetworkInfo implements Parcelable {
26
27   @NonNull private final String networkName;
28
29   @NonNull private final byte[] extendedPanId;
30
31   public ThreadNetworkInfo(@NonNull String networkName, @NonNull byte[] extendedPanId) {
32     this.networkName = networkName;
33     this.extendedPanId = extendedPanId;
34   }
35
36   protected ThreadNetworkInfo(Parcel in) {
37     networkName = in.readString();
38     extendedPanId = in.createByteArray();
39   }
40
41   public String getNetworkName() {
42     return networkName;
43   }
44
45   public byte[] getExtendedPanId() {
46     return extendedPanId;
47   }
48
49   public static final Creator<ThreadNetworkInfo> CREATOR =
50       new Creator<ThreadNetworkInfo>() {
51         @Override
52         public ThreadNetworkInfo createFromParcel(Parcel in) {
53           return new ThreadNetworkInfo(in);
54         }
55
56         @Override
57         public ThreadNetworkInfo[] newArray(int size) {
58           return new ThreadNetworkInfo[size];
59         }
60       };
61
62   @Override
63   public int describeContents() {
64     return 0;
65   }
66
67   @Override
68   public void writeToParcel(Parcel parcel, int flags) {
69     parcel.writeString(networkName);
70     parcel.writeByteArray(extendedPanId);
71   }
72
73   @Override
74   public String toString() {
75     return String.format(
76         "{name=%s, extendedPanId=%s}", networkName, CommissionerUtils.getHexString(extendedPanId));
77   }
78 }