Move examples into src/examples subdirectory.
Change examples names to nfc-* (or nfcip-*).
This commit is contained in:
parent
de537473a0
commit
6aae96e1e1
18 changed files with 37 additions and 33 deletions
31
src/examples/nfcip-target.c
Normal file
31
src/examples/nfcip-target.c
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
#include <stdio.h>
|
||||
#include "libnfc.h"
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
byte_t abtRecv[MAX_FRAME_LEN];
|
||||
size_t szRecvBits;
|
||||
byte_t send[] = "Hello Mars!";
|
||||
dev_info *pdi = nfc_connect(NULL);
|
||||
|
||||
if (!pdi || !nfc_target_init(pdi, abtRecv, &szRecvBits)) {
|
||||
printf("unable to connect or initialize\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!nfc_target_receive_dep_bytes(pdi, abtRecv, &szRecvBits)) {
|
||||
printf("unable to receive data\n");
|
||||
return 1;
|
||||
}
|
||||
abtRecv[szRecvBits] = 0;
|
||||
printf("Received: %s\n", abtRecv);
|
||||
printf("Sending : %s\n", send);
|
||||
|
||||
if (!nfc_target_send_dep_bytes(pdi, send, 11)) {
|
||||
printf("unable to send data\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
nfc_disconnect(pdi);
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue