1/*
2 * Copyright (C) 2017 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 */
16package android.hardware.nfc@1.1;
17
18import @1.0::NfcEvent;
19
20enum NfcEvent : @1.0::NfcEvent {
21    /** In case of an error, HCI network needs to be re-initialized */
22    HCI_NETWORK_RESET = 7
23};
24
25enum Constant : uint8_t {
26    UNSUPPORTED_CONFIG = 0xFF,
27};
28
29/**
30 * Vendor Specific Proprietary Protocol & Discovery Configuration.
31 * Set to UNSUPPORTED_CONFIG if not supported.
32 * discovery* fields map to "RF Technology and Mode" in NCI Spec
33 * protocol* fields map to "RF protocols" in NCI Spec
34 */
35struct ProtocolDiscoveryConfig {
36    uint8_t protocol18092Active;
37    uint8_t protocolBPrime;
38    uint8_t protocolDual;
39    uint8_t protocol15693;
40    uint8_t protocolKovio;
41    uint8_t protocolMifare;
42    uint8_t discoveryPollKovio;
43    uint8_t discoveryPollBPrime;
44    uint8_t discoveryListenBPrime;
45};
46
47/* Presence Check Algorithm as per ISO/IEC 14443-4 */
48enum PresenceCheckAlgorithm : uint8_t {
49    /** Lets the stack select an algorithm */
50    DEFAULT = 0,
51    /** ISO-DEP protocol's empty I-block */
52    I_BLOCK = 1,
53    /**
54     * Type - 4 tag protocol iso-dep nak presence check command is sent waiting for
55     * response and notification.
56     */
57    ISO_DEP_NAK = 2
58};
59
60struct NfcConfig {
61    /** If true, NFCC is using bail out mode for either Type A or Type B poll. */
62    bool nfaPollBailOutMode;
63
64    PresenceCheckAlgorithm presenceCheckAlgorithm;
65
66    ProtocolDiscoveryConfig nfaProprietaryCfg;
67
68    /** Default off-host route. 0x00 if there aren't any. Refer to NCI spec. */
69    uint8_t defaultOffHostRoute;
70
71    /**
72     * Default off-host route for Felica. 0x00 if there aren't any. Refer to
73     * NCI spec.
74     */
75    uint8_t defaultOffHostRouteFelica;
76
77    /** Default system code route. 0x00 if there aren't any. Refer NCI spec */
78    uint8_t defaultSystemCodeRoute;
79
80    /** Default power state for system code route. 0x00 if there aren't any. Refer NCI spec */
81    uint8_t defaultSystemCodePowerState;
82
83    /**
84     * Default route for all remaining protocols and technology which haven't
85     * been configured.
86     * Device Host(0x00) is the default. Refer to NCI spec.
87     * */
88    uint8_t defaultRoute;
89
90    /** Pipe ID for eSE. 0x00 if there aren't any. */
91    uint8_t offHostESEPipeId;
92
93    /** Pipe ID for UICC. 0x00 if there aren't any. */
94    uint8_t offHostSIMPipeId;
95
96    /** Extended APDU length for ISO_DEP. If not supported default length is 261 */
97    uint32_t maxIsoDepTransceiveLength;
98
99    /** list of white listed host ids, as per ETSI TS 102 622 */
100    vec<uint8_t> hostWhitelist;
101};
102