refactoring. add ability to produce command specific apdu codes
This commit is contained in:
1 parent
788e712a6c
commit
43577b3db4
3 files changed
+15
-13
No files matched your search
@@ -329,6 +329,14 @@ const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2) {
|
||||
return APDUCodeTable[0].Description; //empty string
|
||||
}
|
||||
|
||||
const char *GetSpecificAPDUCodeDesc(const APDUSpcCodeDescription_t *desc, const size_t desclen, uint16_t code) {
|
||||
for (int i = 0; i < desclen; i++) {
|
||||
if (desc[i].Code == code)
|
||||
return desc[i].Description;
|
||||
}
|
||||
return GetAPDUCodeDescription(code >> 8, code & 0xff);
|
||||
}
|
||||
|
||||
int APDUDecode(uint8_t *data, int len, APDU_t *apdu) {
|
||||
ExtAPDUHeader_t *hapdu = (ExtAPDUHeader_t *)data;
|
||||
|
||||
|
||||
@@ -38,6 +38,13 @@ typedef struct {
|
||||
const APDUCode_t *GetAPDUCode(uint8_t sw1, uint8_t sw2);
|
||||
const char *GetAPDUCodeDescription(uint8_t sw1, uint8_t sw2);
|
||||
|
||||
typedef struct {
|
||||
const uint16_t Code;
|
||||
const char *Description;
|
||||
} APDUSpcCodeDescription_t;
|
||||
|
||||
const char *GetSpecificAPDUCodeDesc(const APDUSpcCodeDescription_t *desc, const size_t desclen, uint16_t code);
|
||||
|
||||
typedef struct {
|
||||
uint8_t CLA;
|
||||
uint8_t INS;
|
||||
|
||||
Reference in new issue
Block a user