This function detects that it has been scanned by the NFC reader.

Syntax

int IsNFCConnect(
  struct date_struct *stDate, 
  struct time_struct *stTime
);

Parameters

stDate
[out] Specifies a pointer to the date_struct structure that stores the date when the NFC was detected.
stTime
[out] Specifies a pointer to the time_struct structure that stores the time when the NFC was detected.

Return value

Returns TRUE if scanned by an NFC reader, FALSE otherwise.
ValueDescription
TRUE Scanned by the NFC reader.
FALSE Not scanned by the NFC reader.

Remarks

This function returns the result detected before it is called.
The detection information is cleared when this function is called.

Requirements

Header file:
lib.h
Library file:
libSTARTUPOPH5000.a

Sample

#include <stdio.h>
#include "lib.h"

void main( void )
{
    int ret;
    struct date_struct stDate;
    struct time_struct stTime;
    ret = IsNFCConnect(&stDate, &stTime);
    printf("Clear nfc info:%d.\r\n", ret);
    printf("Touch NFC reader.\r\n%d/%02d/%02d %02d:%02d:%02d\r\n",
        stDate.da_year, stDate.da_mon, stDate.da_day,
        stTime.ti_hour, stTime.ti_min, stTime.ti_sec);
    for ( ;; ){
        if (IsNFCConnect(&stDate, &stTime) == TRUE){
            printf("Touch NFC reader.\r\n%d/%02d/%02d %02d:%02d:%02d\r\n",
                stDate.da_year, stDate.da_mon, stDate.da_day,
                stTime.ti_hour, stTime.ti_min, stTime.ti_sec);
            Sound(TSTANDARD, VHIGH, SMEDIUM, 0);
        }
        Idle();
    }
}

Last updated: 2020/10/08