2 * Copyright (c) 2020 Project CHIP Authors
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
9 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 package com.google.chip.chiptool.commissioner.thread;
21 import android.os.Parcel;
22 import android.os.Parcelable;
23 import androidx.annotation.NonNull;
24 import java.net.InetAddress;
25 import java.net.UnknownHostException;
27 public class BorderAgentInfo implements Parcelable {
28 public String discriminator;
29 public String networkName;
30 public byte[] extendedPanId;
31 public InetAddress host;
34 public BorderAgentInfo(
35 @NonNull String discriminator,
36 @NonNull String networkName,
37 @NonNull byte[] extendedPanId,
38 @NonNull InetAddress host,
40 this.discriminator = discriminator;
41 this.networkName = networkName;
42 this.extendedPanId = extendedPanId;
47 protected BorderAgentInfo(Parcel in) {
48 discriminator = in.readString();
49 networkName = in.readString();
50 extendedPanId = in.createByteArray();
52 host = InetAddress.getByAddress(in.createByteArray());
53 } catch (UnknownHostException e) {
59 public void writeToParcel(Parcel dest, int flags) {
60 dest.writeString(discriminator);
61 dest.writeString(networkName);
62 dest.writeByteArray(extendedPanId);
63 dest.writeByteArray(host.getAddress());
68 public int describeContents() {
72 public boolean equals(BorderAgentInfo other) {
73 return this.discriminator.equals(other.discriminator);
76 public static final Creator<BorderAgentInfo> CREATOR =
77 new Creator<BorderAgentInfo>() {
79 public BorderAgentInfo createFromParcel(Parcel in) {
80 return new BorderAgentInfo(in);
84 public BorderAgentInfo[] newArray(int size) {
85 return new BorderAgentInfo[size];