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
28
#include "
transceiver/protocols.h
"
29
#include "
tech/isodep/isodep_target.h
"
30
31
#ifdef __cplusplus
32
extern
"C"
{
33
#endif
34
35
struct
nfc_tech_iso7816_c_apdu
{
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
44
struct
nfc_tech_iso7816_r_apdu
{
45
ac_buffer_t
dataOut;
46
uint16_t sw;
47
};
48
49
#define ISO7816_RX_BUFFER_SIZE 256
50
51
typedef
struct
nfc_tech_iso7816_c_apdu
nfc_tech_iso7816_c_apdu_t
;
52
typedef
struct
nfc_tech_iso7816_r_apdu
nfc_tech_iso7816_r_apdu_t
;
53
54
typedef
struct
nfc_tech_iso7816
nfc_tech_iso7816_t
;
55
56
typedef
void (*nfc_tech_iso7816_disconnected_cb)(
nfc_tech_iso7816_t
*pIso7816,
void
*pUserData);
57
58
struct
nfc_tech_iso7816_app
;
59
typedef
struct
nfc_tech_iso7816_app
nfc_tech_iso7816_app_t
;
60
61
struct
nfc_tech_iso7816
{
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
69
nfc_tech_iso7816_c_apdu_t
cApdu;
70
nfc_tech_iso7816_r_apdu_t
rApdu;
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];
84
ac_buffer_builder_t
txBldr;
85
86
//Receive buffer
87
uint8_t rxBuf[ISO7816_RX_BUFFER_SIZE];
88
ac_buffer_builder_t
rxBldr;
89
};
90
91
void
nfc_tech_iso7816_init(
nfc_tech_iso7816_t
*pIso7816,
nfc_transceiver_t
*pTransceiver, nfc_tech_iso7816_disconnected_cb disconnectedCb,
void
*pUserData);
92
void
nfc_tech_iso7816_add_app(
nfc_tech_iso7816_t
*pIso7816,
nfc_tech_iso7816_app_t
*pIso7816App);
93
void
nfc_tech_iso7816_connect(
nfc_tech_iso7816_t
*pIso7816);
94
void
nfc_tech_iso7816_disconnect(
nfc_tech_iso7816_t
*pIso7816);
95
nfc_err_t
nfc_tech_iso7816_reply(
nfc_tech_iso7816_t
*pIso7816);
96
97
inline
static
nfc_tech_iso7816_c_apdu_t
*
nfc_tech_iso7816_c_apdu
(
nfc_tech_iso7816_t
*pIso7816)
98
{
99
return
&pIso7816->cApdu;
100
}
101
102
inline
static
nfc_tech_iso7816_r_apdu_t
*
nfc_tech_iso7816_r_apdu
(
nfc_tech_iso7816_t
*pIso7816)
103
{
104
return
&pIso7816->rApdu;
105
}
106
107
#ifdef __cplusplus
108
}
109
#endif
110
111
#endif
/* ISO7816_H_ */
nfc_err_t
int nfc_err_t
Type for NFC errors.
Definition
nfc_errors.h:60
isodep_target.h
nfc_common.h
protocols.h
__ac_buffer_builder
Definition
ac_buffer_builder.h:42
__ac_buffer
Definition
ac_buffer.h:41
__ac_istream
Definition
ac_stream.h:46
__ac_ostream
Definition
ac_stream.h:52
__transceiver
Definition
transceiver.h:142
nfc_tech_iso7816_app
Definition
iso7816_app.h:37
nfc_tech_iso7816_c_apdu
Definition
iso7816.h:35
nfc_tech_iso7816_r_apdu
Definition
iso7816.h:44
nfc_tech_iso7816
Definition
iso7816.h:61
nfc_tech_isodep_target
Definition
isodep_target.h:36
connectivity
nfc
libraries
stack
tech
iso7816
iso7816.h
Generated by
1.9.8