- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用 ACR122 读卡器简单地读取 ISO 14443-2B ST SRx 卡内容。
我已经使用 Libnfc 和适当的阅读器驱动程序设置了我的环境。
现在我已经设法编写了一个代码,可以简单地读取卡 UID 并将其打印出来。根本没有文档,我完全不知道从哪里开始阅读卡片内容。任何线索或代码片段?
这是我所做的:
// To compile this simple example:
// $ gcc -o quick_start_example1 quick_start_example1.c -lnfc
// ./quick_start_example1
#include <stdlib.h>
#include <nfc/nfc.h>
void print_nfc_target(const nfc_target *pnt, bool verbose)
{
char *s;
str_nfc_target(&s, pnt, verbose);
printf("%s", s);
nfc_free(s);
}
int main(int argc, const char *argv[])
{
nfc_device *pnd;
nfc_target nt;
// Allocate only a pointer to nfc_context
nfc_context *context;
// Initialize libnfc and set the nfc_context
nfc_init(&context);
if (context == NULL) {
printf("Unable to init libnfc (malloc)\n");
exit(EXIT_FAILURE);
}
// Display libnfc version
const char *acLibnfcVersion = nfc_version();
(void)argc;
printf("%s uses libnfc %s\n", argv[0], acLibnfcVersion);
// Open, using the first available NFC device
pnd = nfc_open(context, NULL);
if (pnd == NULL) {
printf("ERROR: %s\n", "Unable to open NFC device.");
exit(EXIT_FAILURE);
}
// Set opened NFC device to initiator mode
if (nfc_initiator_init(pnd) < 0) {
nfc_perror(pnd, "nfc_initiator_init");
exit(EXIT_FAILURE);
}
printf("NFC reader: %s opened\n", nfc_device_get_name(pnd));
nfc_target ant[1];
nfc_modulation nm;
nm.nmt = NMT_ISO14443B;
nm.nbr = NBR_106;
nfc_initiator_list_passive_targets(pnd,nm,ant,1);
printf("%s\n",nfc_strerror(pnd)); // print Success
nfc_target ant2[1];
nfc_modulation nm2;
nm2.nmt = NMT_ISO14443B2SR;
nm2.nbr = NBR_106;
int res = 0;
int n = 0;
res = nfc_initiator_list_passive_targets(pnd, nm2, ant2, 1);
printf("%s\n",nfc_strerror(pnd)); // print Success
// printf("Cart identifier: %s\n", nt.nti.nsi.abtUID);
for (n = 0; n < res; n++) {
print_nfc_target(&ant2[n], true);
printf("\n");
}
// Close NFC device
nfc_close(pnd);
// Release the context
nfc_exit(context);
exit(EXIT_SUCCESS);
}
PS:由于已知错误 (http://www.libnfc.org/community/topic/1044/problem-with-init-of-iso14443b/),我列出了目标的 2 倍
最佳答案
我写了一个小帮助程序来使用 LibNFC 读取 ST SRx 标签:
https://github.com/Depau/nfc-st-srx/
它仍然需要一些更改来写入它们,但它确实成功地读取了它们。
关于nfc - Libnfc 如何读取NFC卡内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26875875/
我是 NFC 新手,我想将支持 NFC 的安卓手机作为 NFC 标签,并使用 NFC 阅读器读取其数据。如果您能建议我已经构建的用于发送数据的 NFC 应用程序或我应该使用哪种 NFC 读取器硬件,那
我使用ACR122U工具验证Mifare 1K NFC标签时总是失败,但是我可以用Android手机读写这个标签。 ACR122U Load Authentication Keys 90 00 6
我对 NFC 标准的概述有一些问题。 我所知道的是: ISO/IEC 14443是感应卡的标准,使用 RFID 作为通信协议(protocol); ISO/IEC 18092 (NFCIP-1) 是
我正在尝试实现一个基于通用 NFC 标签的授权系统。我想解决的问题之一是标签克隆。我读过一些文献,通过使用在制造过程中写在标签上的只读标签 ID 来确保标签的真实性。此 ID 由所有者签名并写在标签上
我想为使用 RFID 实现多项功能的系统提案指定设备。它可能会在未来扩展到包括交易,所以我正在努力寻找合适的技术来使用。 计划是使用被动卡。 HF/NFC 卡/读卡器以相同的频率运行,但它们可以互换使
我有一个 ACR122U 阅读器,可以读取很多标签,但不能读取 ICODE SLIX SL2S2002 标签。为什么会这样?我已经在移动设备上尝试过该标签,它被识别出来了。 最佳答案 ICODE SL
NFC Host Card Emulation mode摆脱了本地安全元件 (SE),并通过利用存储在云中的 SE 来促进支付,使用 cooperation几个参与方,例如商家、服务、提供商、发卡机构
Mifare (S50) 1K NFC 卡有 16 个扇区,每个扇区有 4 个 block ,每个 block 保存 16 字节数据。 每个扇区的最后一个 block 是扇区尾部,其中 KeyA 和
我创建的系统存在一些问题。 在登录屏幕等特定页面上,我接受 NFC 卡刷卡以读取 ID 并让用户登录 但是,当用户在未编码 NFC 的页面上扫描卡时,Android 设备会自动最小化我的应用程序并显示
我正在尝试使用 NFC 从血糖仪读取数据,目前在 Android 上,还没有尝试过 iOS(没有带 NFC 的手机)。 我正在使用 react-native-nfc-manager 作为库和它附带的示
这个问题专门针对 MIFARE Ultralight C/EV1,或 MIFARE DESFire EV1,甚至 NTAG 卡。我想实现一个 token 系统,这样每次普通用户读取其中一张卡片时,他们
考虑一名员工使用 NFC 安卓设备通过读取固定在墙上的非接触式 javacard 来报告他的位置,每个人都可以访问。 员工用智能手机扫描javacard,只发送时间戳 非接触式 javacard 接收
有没有办法让 NFC 应用程序读取标签,而不是可以在手机上下载的所有其他应用程序? 通常,如果有多个应用程序可以读取给定标签,系统会提示用户打开哪个应用程序。我想跳过这一步,让我的应用程序自动打开。
我想让我的安卓设备充当 NFC 标签。是否可以使用 NFC 设备作为 NFC 标签?我怎样才能做到这一点?我已经完成了读/写标签,设备之间的光束数据。 最佳答案 这可能是可行的,具体取决于您的 NFC
如果我有 NFC 读取器/写入器设备,我能否让它检测我的支持 NFC 的 Android 手机,以便我可以将数据从我的手机传输到该设备?我在 Stackoverflow 上找到了一些与卡模拟相关的链接
我在 SO 上看到很多关于 NFC 的问题,我遇到的最接近的问题是 Can an Android NFC phone act as an NFC tag? 然而,这个问题是一年多前提出的,当时 Gal
我有一台搭载 Android 4.2 的 Android 平板电脑。此平板电脑没有 NFC 硬件。但是我有一个外部 USB 读卡器:ACR 1252U , 带有 Android library .不幸
据我目前了解,NFC 手机将充当 NFC 阅读器,从 NFC 标签读取数据。现在我的问题是,我们可以改变这个吗?我们能否让 Android NFC 手机充当 NFC 读取器从中获取数据的标签? 感谢您
我被搜索了有关 NFC SIM 卡的信息,发现 such explanations关于他们在这里和那里: For those who want to use near field communicat
Core NFC 是否适用于 iPad? 综上所述,iPad does have NFC chips ,但 Core NFC documentation不说它支持它。 Note Reading NFC
我是一名优秀的程序员,十分优秀!