Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00026 #ifdef HAVE_CONFIG_H
00027 #include "config.h"
00028 #endif // HAVE_CONFIG_H
00029
00030 #include <stdio.h>
00031 #include <nfc/nfc.h>
00032
00033 #define MAX_FRAME_LEN 264
00034
00035 int main(int argc, const char *argv[])
00036 {
00037 byte_t abtRecv[MAX_FRAME_LEN];
00038 size_t szRecvBits;
00039 byte_t send[] = "Hello Mars!";
00040 nfc_device_t *pnd = nfc_connect(NULL);
00041
00042 if (!pnd || !nfc_target_init(pnd, abtRecv, &szRecvBits)) {
00043 printf("unable to connect or initialize\n");
00044 return 1;
00045 }
00046
00047 if (!nfc_target_receive_dep_bytes(pnd, abtRecv, &szRecvBits)) {
00048 printf("unable to receive data\n");
00049 return 1;
00050 }
00051 abtRecv[szRecvBits] = 0;
00052 printf("Received: %s\n", abtRecv);
00053 printf("Sending : %s\n", send);
00054
00055 if (!nfc_target_send_dep_bytes(pnd, send, 11)) {
00056 printf("unable to send data\n");
00057 return 1;
00058 }
00059
00060 nfc_disconnect(pnd);
00061 return 0;
00062 }