Commit e9bfd6a0 by developer4

project skeleton (initial)

Do not use this revision. This is just one of the first steps in creating a project.
parent 97a87ebe
This diff is collapsed. Click to expand it.
[submodule "lib"]
path = lib
url = https://git.d-logic.net/nfc-rfid-reader-sdk/ufr-lib.git
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ufr-apdu-credit_card_reader</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<triggers>clean,full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/MINGW_HOME/delimiter=;
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/MINGW_HOME/operation=replace
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/MINGW_HOME/value=C\:\\mingw-w64\\x86_64-5.1.0-posix-seh-rt_v4-rev0\\mingw64
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/append=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/appendContributed=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/MINGW_HOME/delimiter=;
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/MINGW_HOME/operation=replace
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/MINGW_HOME/value=C\:\\mingw-w64\\i686-5.1.0-posix-dwarf-rt_v4-rev0\\mingw32
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/append=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/appendContributed=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/MINGW_HOME/delimiter=;
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/MINGW_HOME/operation=replace
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/MINGW_HOME/value=C\:\\mingw-w64\\i686-5.1.0-posix-dwarf-rt_v4-rev0\\mingw32
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/append=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/appendContributed=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/MINGW_HOME/delimiter=;
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/MINGW_HOME/operation=replace
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/MINGW_HOME/value=C\:\\mingw-w64\\x86_64-5.1.0-posix-seh-rt_v4-rev0\\mingw64
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/append=true
environment/project/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/appendContributed=true
eclipse.preferences.version=1
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/appendContributed=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/appendContributed=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/appendContributed=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/CPATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/CPATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/C_INCLUDE_PATH/delimiter=;
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/C_INCLUDE_PATH/operation=remove
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/append=true
environment/buildEnvironmentInclude/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1226322284/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369.2075570673/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958.1777558369/appendContributed=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/LIBRARY_PATH/delimiter=;
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/LIBRARY_PATH/operation=remove
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/append=true
environment/buildEnvironmentLibrary/cdt.managedbuild.config.gnu.mingw.exe.release.1272368177.226908958/appendContributed=true
lib @ a964c443
Subproject commit a964c443c5dcf60371f3be82935dfef65b8d589f
/*
* ini.h
*/
#ifndef INI_H_
#define INI_H_
#define APP_VERSION "1.0"
#define EXIT_ON_WRONG_FW_DEPENDENCY
#define MIN_DEPEND_FW_VER_MAJOR 3
#define MIN_DEPEND_FW_VER_MINOR 9
#define MIN_DEPEND_FW_VER_BUILD 39
#define EXIT_ON_WRONG_LIB_DEPENDENCY
#define MIN_DEPEND_LIB_VER_MAJOR 4
#define MIN_DEPEND_LIB_VER_MINOR 0
#define MIN_DEPEND_LIB_VER_BUILD 26
#endif /* INI_H_ */
/*
============================================================================
Project Name: uFR APDU Credit Card Reader Example
Name : main.c
Author : d-logic
Version :
Copyright : 2017.
Description : uFR APDU Credit Card Reader Example in C, (C99)
Dependencies: uFR firmware - min. version 3.9.39
uFRCoder library - min. version 4.0.26
============================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <conio.h>
#include <windows.h>
#include <uFCoder.h>
#include "ini.h"
#include "uFR.h"
#include "utils.h"
//------------------------------------------------------------------------------
#define MAX_BUFF_LEN 256
//------------------------------------------------------------------------------
typedef enum E_MENU_ITEMS {
TOP_MENU_LEVEL, APDU_MENU_LEVEL
} menu_levels_t;
menu_levels_t menu_level = TOP_MENU_LEVEL;
void menu(char key);
void usage(void);
UFR_STATUS NewCardInField(uint8_t sak, uint8_t *uid, uint8_t uid_size);
//------------------------------------------------------------------------------
int main(void) {
char key;
bool card_in_field = false;
uint8_t old_sak = 0, old_uid_size = 0, old_uid[10];
uint8_t sak, uid_size, uid[10];
UFR_STATUS status;
usage();
printf(" --------------------------------------------------\n");
printf(" Please wait while opening uFR NFC reader.\n");
printf(" --------------------------------------------------\n");
status = ReaderOpen();
if (status != UFR_OK) {
printf(" Error while opening device, status is: 0x%08X\n", status);
getchar();
return EXIT_FAILURE;
}
if (!CheckDependencies()) {
ReaderClose();
getchar();
return EXIT_FAILURE;
}
status = ReaderReset();
if (status != UFR_OK) {
printf(" Error while opening device, status is: 0x%08X\n", status);
getchar();
return EXIT_FAILURE;
}
printf(" --------------------------------------------------\n");
printf(" uFR NFC reader successfully opened.\n");
printf(" --------------------------------------------------\n");
do {
while (!_kbhit()) {
status = GetCardIdEx(&sak, uid, &uid_size);
switch (status) {
case UFR_OK:
if (card_in_field) {
if (old_sak != sak || old_uid_size != uid_size || memcmp(old_uid, uid, uid_size)) {
old_sak = sak;
old_uid_size = uid_size;
memcpy(old_uid, uid, uid_size);
NewCardInField(sak, uid, uid_size);
}
} else {
old_sak = sak;
old_uid_size = uid_size;
memcpy(old_uid, uid, uid_size);
NewCardInField(sak, uid, uid_size);
card_in_field = true;
}
break;
case UFR_NO_CARD:
menu_level = TOP_MENU_LEVEL;
card_in_field = false;
status = UFR_OK;
break;
default:
ReaderClose();
printf(" Fatal error while trying to read card, status is: 0x%08X\n", status);
getchar();
return EXIT_FAILURE;
}
Sleep(500);
}
key = _getch();
menu(key);
} while (key != '\x1b');
ReaderClose();
return EXIT_SUCCESS;
}
//------------------------------------------------------------------------------
void menu(char key) {
switch (key) {
case '1':
if (menu_level == APDU_MENU_LEVEL)
ReadSystemFileOnST_M24SR();
break;
case '2':
if (menu_level == APDU_MENU_LEVEL)
ReadNfcCC();
break;
case '3':
if (menu_level == APDU_MENU_LEVEL)
ReadNfcNdef();
break;
case '\x1b':
break;
default:
usage();
break;
}
}
//------------------------------------------------------------------------------
void usage(void) {
switch (menu_level) {
case APDU_MENU_LEVEL:
printf(" -------------------------------------------------------------------\n");
printf(" ISO14443-4 tag detected, choose one of the supported APDU commands:\n");
printf(" -------------------------------------------------------------------\n");
break;
default:
printf(" +------------------------------------------------+\n"
" | uFR APDU Credit Card Reader Example |\n"
" | version "APP_VERSION" |\n"
" +------------------------------------------------+\n");
printf(" When You put ISO14443-4 tag in the reader field,\n"
" You will be prompted for appropriate APDU to send.\n"
"\n"
" For exit, hit escape.\n");
printf(" --------------------------------------------------\n");
break;
}
}
//------------------------------------------------------------------------------
UFR_STATUS NewCardInField(uint8_t sak, uint8_t *uid, uint8_t uid_size) {
UFR_STATUS status;
uint8_t dl_card_type;
status = GetDlogicCardType(&dl_card_type);
if (status != UFR_OK)
return status;
printf(" \a-------------------------------------------------------------------\n");
printf(" Card type: %s, sak = 0x%02X, uid[%d] = ", GetDlTypeName(dl_card_type), sak, uid_size);
print_hex_ln(uid, uid_size, ":");
printf(" -------------------------------------------------------------------\n");
if (dl_card_type == DL_UNKNOWN_ISO_14443_4) {
menu_level = APDU_MENU_LEVEL;
usage();
} else if (menu_level == APDU_MENU_LEVEL) {
menu_level = TOP_MENU_LEVEL;
}
return UFR_OK;
}
//------------------------------------------------------------------------------
void ReadSystemFileOnST_M24SR(void) {
UFR_STATUS status;
size_t response_len;
uint8_t response[MAX_BUFF_LEN];
char *resp = NULL;
uint8_t sw[2];
uint32_t le;
uint16_t *sw16_ptr = (uint16_t *) &sw;
printf(" -------------------------------------------------------------------\n");
printf(" Read file on tag\n");
printf(" -------------------------------------------------------------------\n");
status = SetISO14443_4_Mode();
if (status != UFR_OK) {
printf(" Error while switching into ISO 14443-4 mode, uFR status is: 0x%08X\n", status);
return;
}
printf(" 1. Issuing \"NDEF Tag Application Select\" command:\n"
" [C] 00 A4 04 00 07 D2 76 00 00 85 01 01 00\n");
response_len = MAX_BUFF_LEN;
status = ApduCommand("00 A4 04 00 07 D2760000850101 00", &resp, sw);
if (status != UFR_OK) {
s_block_deselect(100);
printf(" Error while executing APDU command, uFR status is: 0x%08X\n", status);
return;
} else {
if (*sw16_ptr != 0x90) {
s_block_deselect(100);
printf(" Could not continue execution due to an APDU error.\n");
printf(" [SW] ");
print_hex_ln(sw, 2, " ");
return;
}
response_len = strlen(resp);
printf(" APDU command executed: response data length = %d\n", (int) response_len);
printf(" [R] %s\n", resp);
printf(" [SW] ");
print_hex_ln(sw, 2, " ");
printf(" -------------------------------------------------------------------\n");
}
s_block_deselect(100);
}
//------------------------------------------------------------------------------
/*
* uFR.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <stdbool.h>
#include <string.h>
#include <uFCoder.h>
#include "ini.h"
#include "uFR.h"
//------------------------------------------------------------------------------
size_t hex2bin(uint8_t *dst, const char *src) {
size_t dst_len = 0;
char s_tmp[3];
s_tmp[2] = '\0';
while (*src) {
while (((char)*src < '0' || (char)*src > '9')
&& ((char)*src < 'a' || (char)*src > 'f')
&& ((char)*src < 'A' || (char)*src > 'F'))
src++; // skip delimiters, white spaces, etc.
s_tmp[0] = (char) *src++;
// Must be pair of the hex digits:
if (!(*src))
break;
// And again, must be pair of the hex digits:
if (((char)*src < '0' || (char)*src > '9')
&& ((char)*src < 'a' || (char)*src > 'f')
&& ((char)*src < 'A' || (char)*src > 'F'))
break;
s_tmp[1] = (char) *src++;
*dst++ = strtoul(s_tmp, NULL, 16);
dst_len++;
}
return dst_len;
}
//------------------------------------------------------------------------------
UFR_STATUS ApduCommand(sz_ptr apdu, char **response, uint8_t *sw) {
UFR_STATUS status;
status = APDUHexStrTransceive(apdu, response);
if (status)
return status;
if (strlen(*response) % 2)
return UFR_PARAMETERS_ERROR;
if (strlen(*response) >= 4) {
hex2bin(sw, *response + strlen(*response) - 4);
*(*response + strlen(*response) - 4) = '\0';
}
else
return UFR_PARAMETERS_ERROR;
return UFR_OK;
}
//------------------------------------------------------------------------------
bool CheckDependencies(void) {
#if defined(EXIT_ON_WRONG_FW_DEPENDENCY) || defined(EXIT_ON_WRONG_LIB_DEPENDENCY)
uint8_t version_major, version_minor, build;
bool wrong_version = false;
#endif
UFR_STATUS status;
#ifdef EXIT_ON_WRONG_LIB_DEPENDENCY
#endif
#ifdef EXIT_ON_WRONG_FW_DEPENDENCY
wrong_version = false;
status = GetReaderFirmwareVersion(&version_major, &version_minor);
if (status != UFR_OK) {
printf(" Error while checking device version, status is: 0x%08X\n", status);
return false;
}
status = GetBuildNumber(&build);
if (status != UFR_OK) {
printf(" Error while checking device version, status is: 0x%08X\n", status);
return false;
}
if (version_major < MIN_DEPEND_FW_VER_MAJOR) {
wrong_version = true;
} else if (version_major == MIN_DEPEND_FW_VER_MAJOR && version_minor < MIN_DEPEND_FW_VER_MINOR) {
wrong_version = true;
} else if (version_minor == MIN_DEPEND_FW_VER_MINOR && build < MIN_DEPEND_FW_VER_BUILD) {
wrong_version = true;
}
if (wrong_version) {
printf("Wrong uFR NFC reader firmware version (%d.%d.%d).\n"
"Please update uFR firmware to at last %d.%d.%d version.\n", version_major, version_minor, build,
MIN_DEPEND_FW_VER_MAJOR, MIN_DEPEND_FW_VER_MINOR, MIN_DEPEND_FW_VER_BUILD);
return false;
}
#endif
return true;
}
//------------------------------------------------------------------------------
sz_ptr GetDlTypeName(uint8_t dl_type_code) {
switch (dl_type_code) {
case DL_MIFARE_ULTRALIGHT:
return "DL_MIFARE_ULTRALIGHT";
case DL_MIFARE_ULTRALIGHT_EV1_11:
return "DL_MIFARE_ULTRALIGHT_EV1_11";
case DL_MIFARE_ULTRALIGHT_EV1_21:
return "DL_MIFARE_ULTRALIGHT_EV1_21";
case DL_MIFARE_ULTRALIGHT_C:
return "DL_MIFARE_ULTRALIGHT_C";
case DL_NTAG_203:
return "DL_NTAG_203";
case DL_NTAG_210:
return "DL_NTAG_210";
case DL_NTAG_212:
return "DL_NTAG_212";
case DL_NTAG_213:
return "DL_NTAG_213";
case DL_NTAG_215:
return "DL_NTAG_215";
case DL_NTAG_216:
return "DL_NTAG_216";
case DL_MIKRON_MIK640D:
return "DL_MIKRON_MIK640D";
case DL_MIFARE_MINI:
return "DL_MIFARE_MINI";
case DL_MIFARE_CLASSIC_1K:
return "DL_MIFARE_CLASSIC_1K";
case DL_MIFARE_CLASSIC_4K:
return "DL_MIFARE_CLASSIC_4K";
case DL_MIFARE_PLUS_S_2K:
return "DL_MIFARE_PLUS_S_2K";
case DL_MIFARE_PLUS_S_4K:
return "DL_MIFARE_PLUS_S_4K";
case DL_MIFARE_PLUS_X_2K:
return "DL_MIFARE_PLUS_X_2K";
case DL_MIFARE_PLUS_X_4K:
return "DL_MIFARE_PLUS_X_4K";
case DL_MIFARE_DESFIRE:
return "DL_MIFARE_DESFIRE";
case DL_MIFARE_DESFIRE_EV1_2K:
return "DL_MIFARE_DESFIRE_EV1_2K";
case DL_MIFARE_DESFIRE_EV1_4K:
return "DL_MIFARE_DESFIRE_EV1_4K";
case DL_MIFARE_DESFIRE_EV1_8K:
return "DL_MIFARE_DESFIRE_EV1_8K";
case DL_UNKNOWN_ISO_14443_4:
return "DL_GENERIC_ISO_14443_4";
case DL_IMEI_UID:
return "DL_IMEI_UID";
}
return "UNSUPPORTED CARD";
}
//------------------------------------------------------------------------------
/*
* uFR.h
*/
#ifndef UFR_H_
#define UFR_H_
#include "ini.h"
//------------------------------------------------------------------------------
typedef const char * sz_ptr;
//------------------------------------------------------------------------------
UFR_STATUS ApduCommand(sz_ptr apdu, char **response, uint8_t *sw);
size_t hex2bin(uint8_t *dst, const char *src);
bool CheckDependencies(void);
sz_ptr GetDlTypeName(uint8_t dl_type_code);
//------------------------------------------------------------------------------
#endif /* UFR_H_ */
/*
* utils.c
*/
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "ini.h"
#include "utils.h"
//------------------------------------------------------------------------------
void print_ln_len(char symbol, uint8_t cnt) {
for (int i = 0; i < cnt; i++)
printf("%c", symbol);
printf("\n");
}
//------------------------------------------------------------------------------
inline void print_ln(char symbol) {
print_ln_len(symbol, DEFAULT_LINE_LEN);
}
//------------------------------------------------------------------------------
void print_hex(const uint8_t *data, uint32_t len, const char *delimiter) {
for (int i = 0; i < len; i++) {
printf("%02X", data[i]);
if ((delimiter != NULL) && (i < (len - 1)))
printf("%c", *delimiter);
}
}
//------------------------------------------------------------------------------
void print_hex_ln(const uint8_t *data, uint32_t len, const char *delimiter) {
print_hex(data, len, delimiter);
printf("\n");
}
//==============================================================================
/*
* utils.h
*/
#ifndef UTILS_H_
#define UTILS_H_
#define DEFAULT_LINE_LEN 60
void print_ln_len(char symbol, uint8_t cnt);
void print_ln(char symbol);
void print_hex(const uint8_t *data, uint32_t len, const char *delimiter);
void print_hex_ln(const uint8_t *data, uint32_t len, const char *delimiter);
#endif /* UTILS_H_ */
@echo off
set path=..\lib\windows\x86;%path%
ufr-apdu-credit_card_reader.exe
\ No newline at end of file
@echo off
set path=..\lib\windows\x86;%path%
ufr-apdu-credit_card_reader.exe
\ No newline at end of file
@echo off
set path=..\lib\windows\x86_64;%path%
ufr-apdu-credit_card_reader.exe
\ No newline at end of file
@echo off
set path=..\lib\windows\x86_64;%path%
ufr-apdu-credit_card_reader.exe
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment