1
1
use apdu_dispatch:: app:: { App , CommandView , Result as AppResult } ;
2
2
use apdu_dispatch:: dispatch;
3
3
use apdu_dispatch:: { interchanges, response} ;
4
+ use heapless:: VecView ;
4
5
use hex_literal:: hex;
5
6
use interchange:: Channel ;
6
7
use iso7816:: Status ;
@@ -47,12 +48,12 @@ impl iso7816::App for TestApp1 {
47
48
}
48
49
49
50
// This app echos to Ins code 0x10
50
- impl App < { apdu_dispatch :: response :: SIZE } > for TestApp1 {
51
+ impl App for TestApp1 {
51
52
fn select (
52
53
& mut self ,
53
54
_interface : dispatch:: Interface ,
54
55
_apdu : CommandView < ' _ > ,
55
- _reply : & mut response :: Data ,
56
+ _reply : & mut VecView < u8 > ,
56
57
) -> AppResult {
57
58
Ok ( ( ) )
58
59
}
@@ -63,7 +64,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp1 {
63
64
& mut self ,
64
65
_: dispatch:: Interface ,
65
66
apdu : CommandView < ' _ > ,
66
- reply : & mut response :: Data ,
67
+ reply : & mut VecView < u8 > ,
67
68
) -> AppResult {
68
69
println ! ( "TestApp1::call" ) ;
69
70
match apdu. instruction ( ) . into ( ) {
@@ -79,8 +80,8 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp1 {
79
80
}
80
81
// For measuring the stack burden of dispatch
81
82
0x15 => {
82
- let buf = heapless:: Vec :: new ( ) ;
83
- let addr = ( & buf as * const response :: Data ) as u32 ;
83
+ let buf = heapless:: Vec :: < u8 , { response :: SIZE } > :: new ( ) ;
84
+ let addr = ( & buf as * const VecView < u8 > ) . addr ( ) as u32 ;
84
85
reply. extend_from_slice ( & addr. to_be_bytes ( ) ) . unwrap ( ) ;
85
86
Ok ( ( ) )
86
87
}
@@ -122,12 +123,12 @@ impl iso7816::App for TestApp2 {
122
123
}
123
124
124
125
// This app echos to Ins code 0x20
125
- impl App < { apdu_dispatch :: response :: SIZE } > for TestApp2 {
126
+ impl App for TestApp2 {
126
127
fn select (
127
128
& mut self ,
128
129
_interface : dispatch:: Interface ,
129
130
_apdu : CommandView < ' _ > ,
130
- _reply : & mut response :: Data ,
131
+ _reply : & mut VecView < u8 > ,
131
132
) -> AppResult {
132
133
Ok ( ( ) )
133
134
}
@@ -138,7 +139,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for TestApp2 {
138
139
& mut self ,
139
140
_: dispatch:: Interface ,
140
141
apdu : CommandView < ' _ > ,
141
- reply : & mut response :: Data ,
142
+ reply : & mut VecView < u8 > ,
142
143
) -> AppResult {
143
144
println ! ( "TestApp2::call" ) ;
144
145
match apdu. instruction ( ) . into ( ) {
@@ -174,12 +175,12 @@ impl iso7816::App for PanicApp {
174
175
}
175
176
176
177
// This app echos to Ins code 0x20
177
- impl App < { apdu_dispatch :: response :: SIZE } > for PanicApp {
178
+ impl App for PanicApp {
178
179
fn select (
179
180
& mut self ,
180
181
_interface : dispatch:: Interface ,
181
182
_apdu : CommandView < ' _ > ,
182
- _reply : & mut response :: Data ,
183
+ _reply : & mut VecView < u8 > ,
183
184
) -> AppResult {
184
185
panic ! ( "Dont call the panic app" ) ;
185
186
}
@@ -192,7 +193,7 @@ impl App<{ apdu_dispatch::response::SIZE }> for PanicApp {
192
193
& mut self ,
193
194
_: dispatch:: Interface ,
194
195
_apdu : CommandView < ' _ > ,
195
- _reply : & mut response :: Data ,
196
+ _reply : & mut VecView < u8 > ,
196
197
) -> AppResult {
197
198
panic ! ( "Dont call the panic app" ) ;
198
199
}
0 commit comments