Mbed OS Reference
Loading...
Searching...
No Matches
iso7816.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2014-2018, ARM Limited, All Rights Reserved
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * 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, WITHOUT
13 * 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 * \file iso7816.h
19 * \copyright Copyright (c) ARM Ltd 2014
20 * \author Donatien Garnier
21 */
22
23#ifndef ISO7816_H_
24#define ISO7816_H_
25
26#include "stack/nfc_common.h"
27
30
31#ifdef __cplusplus
32extern "C" {
33#endif
34
36 uint8_t cla;
37 uint8_t ins;
38 uint8_t p1;
39 uint8_t p2;
40 ac_buffer_t dataIn;
41 size_t maxRespLength;
42};
43
45 ac_buffer_t dataOut;
46 uint16_t sw;
47};
48
49#define ISO7816_RX_BUFFER_SIZE 256
50
53
55
56typedef void (*nfc_tech_iso7816_disconnected_cb)(nfc_tech_iso7816_t *pIso7816, void *pUserData);
57
60
62 nfc_tech_isodep_target_t isoDepTarget;
63
64 nfc_tech_iso7816_app_t *pAppList;
65 nfc_tech_iso7816_app_t *pSelectedApp;
66
67 bool disconnected;
68
71
72 bool responseReady;
73
74 nfc_tech_iso7816_disconnected_cb disconnectedCb;
75 void *pUserData;
76
77 ac_buffer_t hist; //Historical bytes
78
79 ac_istream_t inputStream;
80 ac_ostream_t outputStream;
81
82 //PDU buffer (tx)
83 uint8_t txBuf[2];
85
86 //Receive buffer
87 uint8_t rxBuf[ISO7816_RX_BUFFER_SIZE];
89};
90
91void nfc_tech_iso7816_init(nfc_tech_iso7816_t *pIso7816, nfc_transceiver_t *pTransceiver, nfc_tech_iso7816_disconnected_cb disconnectedCb, void *pUserData);
92void nfc_tech_iso7816_add_app(nfc_tech_iso7816_t *pIso7816, nfc_tech_iso7816_app_t *pIso7816App);
93void nfc_tech_iso7816_connect(nfc_tech_iso7816_t *pIso7816);
94void nfc_tech_iso7816_disconnect(nfc_tech_iso7816_t *pIso7816);
95nfc_err_t nfc_tech_iso7816_reply(nfc_tech_iso7816_t *pIso7816);
96
98{
99 return &pIso7816->cApdu;
100}
101
103{
104 return &pIso7816->rApdu;
105}
106
107#ifdef __cplusplus
108}
109#endif
110
111#endif /* ISO7816_H_ */
int nfc_err_t
Type for NFC errors.
Definition: nfc_errors.h:60