• 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 android.nfc;
17 
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.IntDef;
21 import android.annotation.SystemApi;
22 import android.nfc.cardemulation.CardEmulation;
23 
24 import java.lang.annotation.Retention;
25 import java.lang.annotation.RetentionPolicy;
26 
27 /**
28  * Class to represent an entry of routing table. This class is abstract and extended by
29  * {@link RoutingTableTechnologyEntry}, {@link RoutingTableProtocolEntry},
30  * {@link RoutingTableAidEntry} and {@link RoutingTableSystemCodeEntry}.
31  *
32  * @hide
33  */
34 @FlaggedApi(Flags.FLAG_NFC_OEM_EXTENSION)
35 @SystemApi
36 public abstract class NfcRoutingTableEntry {
37     private final int mNfceeId;
38     private final int mType;
39     private final int mRouteType;
40 
41     /**
42      * AID routing table type.
43      */
44     public static final int TYPE_AID = 0;
45     /**
46      * Protocol routing table type.
47      */
48     public static final int TYPE_PROTOCOL = 1;
49     /**
50      * Technology routing table type.
51      */
52     public static final int TYPE_TECHNOLOGY = 2;
53     /**
54      * System Code routing table type.
55      */
56     public static final int TYPE_SYSTEM_CODE = 3;
57 
58     /**
59      * Possible type of this routing table entry.
60      * @hide
61      */
62     @IntDef(prefix = "TYPE_", value = {
63             TYPE_AID,
64             TYPE_PROTOCOL,
65             TYPE_TECHNOLOGY,
66             TYPE_SYSTEM_CODE
67     })
68     @Retention(RetentionPolicy.SOURCE)
69     public @interface RoutingTableType {}
70 
71     /** @hide */
NfcRoutingTableEntry(int nfceeId, @RoutingTableType int type, @CardEmulation.ProtocolAndTechnologyRoute int routeType)72     protected NfcRoutingTableEntry(int nfceeId, @RoutingTableType int type,
73             @CardEmulation.ProtocolAndTechnologyRoute int routeType) {
74         mNfceeId = nfceeId;
75         mType = type;
76         mRouteType = routeType;
77     }
78 
79     /**
80      * Gets the NFCEE Id of this entry.
81      * @return an integer of NFCEE Id.
82      */
getNfceeId()83     public int getNfceeId() {
84         return mNfceeId;
85     }
86 
87     /**
88      * Get the type of this entry.
89      * @return an integer defined in {@link RoutingTableType}
90      */
91     @RoutingTableType
getType()92     public int getType() {
93         return mType;
94     }
95 
96     /**
97      * Get the route type of this entry.
98      * @return an integer defined in
99      * {@link android.nfc.cardemulation.CardEmulation.ProtocolAndTechnologyRoute}
100      */
101     @CardEmulation.ProtocolAndTechnologyRoute
getRouteType()102     public int getRouteType() {
103         return mRouteType;
104     }
105 }
106