• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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 package com.android.nfc.utils;
17 
18 import android.os.Parcel;
19 import android.os.Parcelable;
20 
21 public class CommandApdu implements Parcelable {
22     public static final Parcelable.Creator<CommandApdu> CREATOR =
23             new Parcelable.Creator<>() {
24                 @Override
25                 public CommandApdu createFromParcel(Parcel source) {
26                     String apdu = source.readString();
27                     boolean reachable = source.readInt() != 0;
28                     return new CommandApdu(apdu, reachable);
29                 }
30 
31                 @Override
32                 public CommandApdu[] newArray(int size) {
33                     return new CommandApdu[size];
34                 }
35             };
36     private String mApdu;
37     private boolean mReachable;
38 
CommandApdu(String apdu, boolean reachable)39     public CommandApdu(String apdu, boolean reachable) {
40         mApdu = apdu;
41         mReachable = reachable;
42     }
43 
isReachable()44     public boolean isReachable() {
45         return mReachable;
46     }
47 
getApdu()48     public String getApdu() {
49         return mApdu;
50     }
51 
52     @Override
describeContents()53     public int describeContents() {
54         return 0;
55     }
56 
57     @Override
writeToParcel(Parcel dest, int flags)58     public void writeToParcel(Parcel dest, int flags) {
59         dest.writeString(mApdu);
60         dest.writeInt(mReachable ? 1 : 0);
61     }
62 }
63 
64