CN108521646B - Near field communication method, device and computer readable storage medium - Google Patents

Near field communication method, device and computer readable storage medium Download PDF

Info

Publication number
CN108521646B
CN108521646B CN201810292000.1A CN201810292000A CN108521646B CN 108521646 B CN108521646 B CN 108521646B CN 201810292000 A CN201810292000 A CN 201810292000A CN 108521646 B CN108521646 B CN 108521646B
Authority
CN
China
Prior art keywords
data
nfc
nfc card
card
basic information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810292000.1A
Other languages
Chinese (zh)
Other versions
CN108521646A (en
Inventor
谢跃书
殷光成
黄亮东
彭振
王彦兵
谭永明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuhai Geehy Semiconductor Co Ltd
Original Assignee
Zhuhai Geehy Semiconductor Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuhai Geehy Semiconductor Co Ltd filed Critical Zhuhai Geehy Semiconductor Co Ltd
Priority to CN201810292000.1A priority Critical patent/CN108521646B/en
Publication of CN108521646A publication Critical patent/CN108521646A/en
Application granted granted Critical
Publication of CN108521646B publication Critical patent/CN108521646B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • H04B5/40Near-field transmission systems, e.g. inductive or capacitive transmission systems characterised by components specially adapted for near-field transmission
    • H04B5/48Transceivers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • H04B5/70Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes
    • H04B5/77Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes for interrogation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/02Services making use of location information
    • H04W4/021Services related to particular areas, e.g. point of interest [POI] services, venue services or geofences
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/11Allocation or use of connection identifiers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • H04W76/14Direct-mode setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention provides a near field communication method, a near field communication device and a computer readable storage medium, and relates to the technical field of communication. On one hand, the embodiment of the invention obtains the basic information of a first NFC card, wherein the first NFC card is an NFC card which is away from the NFC reader within a specified range; therefore, whether the first NFC card is an NFC card for the NFC reader-writer to operate or not is judged according to the basic information of the first NFC card; if the first NFC card is judged to be the NFC card executed by the NFC reader-writer to operate, acquiring data of the first NFC card; and then, according to the basic information and the data, performing a data reading operation or a data writing operation on the first NFC card. Therefore, the technical scheme provided by the embodiment of the invention can improve the stability of data communication connection and improve the efficiency of data transmission.

Description

Near field communication method, device and computer readable storage medium
[ technical field ] A method for producing a semiconductor device
The present invention relates to the field of communications technologies, and in particular, to a near field communication method, an apparatus, and a computer-readable storage medium.
[ background of the invention ]
Near Field Communication (NFC) is a short-range Communication technology, which combines a contactless radio frequency identification technology and a wireless technology, and in recent years, with the development of the NFC technology, many mobile terminals integrate an NFC function, and the mobile terminals perform identification and data interaction with compatible devices in a short distance through the NFC technology, so that operations such as identity identification, mobile payment, information interaction, and the like can be quickly implemented.
The speed of communication transmission of the NFC technology is tens of bits per second, and if the capacity of data transmitted by two devices performing near field communication is relatively large, the communication time of the two devices performing NFC communication is increased accordingly. Due to the characteristics of simple communication protocol and non-contact communication of the NFC technology, when the mobile terminal with NFC transmits data to the NFC card, the data communication connection between the mobile terminal and the current NFC card can be disconnected at any time, the NFC card connected with the mobile terminal in data communication can be replaced at will, the mobile terminal and the NFC card connected with the mobile terminal in data communication are unstable, when the data transmitted by the mobile terminal in near field communication and the NFC card is large, the data transmission is easy to be abnormal, and the data transmission efficiency is low.
[ summary of the invention ]
In view of this, embodiments of the present invention provide a near field communication method, an apparatus, and a computer-readable storage medium, which can manage data communication connection with a connected NFC card, improve stability of data communication connection, and improve efficiency of data transmission.
In one aspect, an embodiment of the present invention provides a near field communication method, applied to an NFC (near field communication) reader, including:
acquiring basic information of a first NFC card, wherein the first NFC card is an NFC card which is far away from the NFC reader and is within a specified range;
judging whether the first NFC card is an NFC card for the NFC reader to execute operation or not according to the basic information of the first NFC card;
if the first NFC card is judged to be the NFC card executed by the NFC reader-writer to operate, acquiring data of the first NFC card;
and executing a data reading operation or a data writing operation on the first NFC card according to the basic information and the data.
As to the above-mentioned aspect and any possible implementation manner, there is further provided an implementation manner, where the determining whether the first NFC card is an NFC card that the NFC reader performs an operation includes: comparing whether the basic information of the first NFC card is the same as the basic information of the NFC card operated by the NFC reader-writer to obtain a comparison result;
and if the comparison result is the same, determining that the first NFC card is the NFC card operated by the NFC reader-writer, and if the comparison result is different, determining that the first NFC card is not the NFC card operated by the NFC reader-writer.
In the aspect and any possible implementation manner described above, there is further provided an implementation manner, before the determining whether the first NFC card is an NFC card on which the NFC reader/writer performs an operation, the method includes:
and acquiring basic information of the NFC card operated by the NFC reader-writer from a first position.
As to the above-mentioned aspect and any possible implementation manner, there is further provided an implementation manner, where if the basic information of the first NFC card is compared with the basic information of the NFC card executed by the NFC reader/writer to be different, the method further includes:
judging whether the basic information of the NFC card executing the operation stored by the NFC reader-writer is empty;
and if the basic information of the NFC card for executing the operation stored by the NFC reader-writer is judged to be null, determining that the first NFC card is the NFC card for executing the operation by the NFC card reader-writer, and taking the basic information of the first NFC card as the basic information of the NFC card for executing the operation by the NFC reader-writer.
The above-described aspects and any possible implementations further provide an implementation, and the method further includes:
judging whether the data reading operation or the data writing operation performed on the first NFC card is finished or not;
and if the data reading operation or the data writing operation of the first NFC card is judged to be finished, deleting the basic information of the NFC card operated by the NFC reader-writer in the first position, and generating a specified identifier, wherein the specified identifier is used for representing that the basic information of the NFC card operated by the NFC reader-writer is empty.
The aspect and any possible implementation manner described above further provide an implementation manner, where performing a read data operation or a write data operation on the first NFC card includes:
displaying the progress of the data reading operation or the data writing operation and data corresponding to the data reading operation or the data writing operation;
the judging whether the data reading operation or the data writing operation performed on the first NFC card is finished comprises: and judging whether the progress of the display data reading operation or the data writing operation reaches a preset threshold, if so, determining that the first NFC card executes the data reading operation or the data writing operation is finished, and if not, determining that the first NFC card executes the data reading operation or the data writing operation is not finished.
The above-described aspects and any possible implementations further provide an implementation, the method including:
establishing a card object and a data object corresponding to the first NFC card according to the basic information and data of the first NFC card;
and executing a read data operation or a write data operation based on the card object and the data object.
The above-described aspects and any possible implementation further provide an implementation in which the card object includes at least one or more of data description information, data length information, available memory pages, and data available memory space.
As with the above-described aspect and any possible implementation, there is further provided an implementation in which the performing a read data operation based on the card object and the data object includes:
acquiring the storage address of the data object according to the data description information,
and reading the data corresponding to the data object based on the storage address.
The above-described aspect and any possible implementation further provide an implementation in which performing a write operation based on the card object and the data object includes:
configuring a storage address for the data object according to the data length and the available storage page;
and writing the data corresponding to the data object based on the storage address.
The above aspects and any possible implementations further provide an implementation, the method including;
judging whether the data corresponding to the data object exceeds the available storage space of the data;
if the judgment result is that the alarm signal exceeds the preset threshold, sending a prompt message;
and if the data object is judged not to be exceeded, the step of writing the data corresponding to the data object based on the storage address is executed.
In yet another aspect, an embodiment of the present invention provides a near field communication device, which includes
The first acquisition unit is used for acquiring basic information of a first NFC card, and the first NFC card is an NFC card which is far away from the NFC reader and is within a specified range;
the judgment unit is used for judging whether the first NFC card is an NFC card for the NFC reader-writer to execute operation or not according to the basic information of the first NFC card;
a second obtaining unit, configured to obtain data of the first NFC card if it is determined that the first NFC card is an NFC card on which the NFC reader executes an operation;
and the processing unit executes data reading operation or data writing operation on the first NFC card according to the basic information and the data.
In yet another aspect, the present invention provides a computer-readable storage medium, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the near field communication method of any one of the foregoing.
According to the technical scheme provided by the embodiment of the invention, when the first NFC card and the NFC reader-writer can realize near field communication, the basic information of the first NFC card is acquired, and the data of the first NFC card is triggered to be acquired only when the first NFC card is judged to be the NFC card locked by the NFC reader-writer (namely the NFC card for executing operation by the NFC reader-writer) through judging whether the first NFC card is the NFC card locked by the NFC reader-writer, so that the first NFC card is executed with reading operation or writing operation. The invention utilizes the basic information of the NFC card to identify whether the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation or not, and carries out data communication only when the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation, thereby realizing the management of data communication connection with the connected NFC card, improving the stability of data communication connection and improving the efficiency of data transmission.
[ description of the drawings ]
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart of a near field communication method according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of another near field communication method provided in the embodiment of the present invention;
fig. 3 is a schematic flow chart of a near field communication method according to another embodiment of the present invention;
fig. 4 is a flowchart illustrating a near field communication method according to an embodiment of the present invention;
fig. 5 is a diagram illustrating another exemplary flow of a near field communication method according to an embodiment of the present invention;
fig. 6 is a schematic structural diagram of a near field communication device according to an embodiment of the present invention.
[ detailed description ] embodiments
For better understanding of the technical solutions of the present invention, the following detailed descriptions of the embodiments of the present invention are provided with reference to the accompanying drawings.
It should be understood that the described embodiments are only some embodiments of the invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terminology used in the embodiments of the invention is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in the examples of the present invention and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be understood that the term "and/or" as used herein is merely one type of association that describes an associated object, meaning that three relationships may exist, e.g., a and/or B may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" herein generally indicates that the former and latter related objects are in an "or" relationship.
It should be understood that although the terms first, second, etc. may be used herein to describe locations in embodiments of the invention, these locations should not be limited by these terms. These terms are only used to distinguish one location from another. For example, a first location may also be referred to as a second location, and similarly, a second location may also be referred to as a first location, without departing from the scope of embodiments of the present invention.
The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
An embodiment of the present invention provides a near field communication method, which is applied to an NFC (near field communication) reader, please refer to fig. 1, which is a schematic flow diagram of the method provided in the embodiment of the present invention, and as shown in the drawing, the method includes the following steps:
102. and acquiring basic information of a first NFC card, wherein the first NFC card is an NFC card which is far away from the NFC reader within a specified range.
The basic information includes information such as capacity, type, creation time, card identification, data abstract, check code of data, data name and the like of the NFC card.
The designated range is a range in which the NFC card and the NFC card reader can implement near field communication, and the designated range is a range specified by the near field communication technology, for example, NFC operates at 13.56MHZ, and requires a communication distance within a range of 20 cm.
The storage space of the NFC card is divided into a boot area, a data storage page area, a data description area and a data area.
The boot area is used for storing basic information of the NFC card, and the basic information comprises information such as capacity, type, creation time, card identification, data abstract, check code of data, data name and the like of the NFC card.
The data storage page area indicates the use condition of the storage page of the NFC card, represents a linked list structure of the page stored by file data, the address sequence stored by each item in the storage page area is consistent with an item number (0 item is at 0 offset, 1 item is at 2 offset, and 2 items are at 4 offset), each item is in one-to-one correspondence with the corresponding storage page, so that the storage page volume only needs to store the page number of the next page through the mapping relation of the offset, the item number and the page number, and the allocation use condition of the page can be indicated;
and the data description area is used for describing information of the stored files, each item of the data description area corresponds to the file description of one file stored in the card, and the content of the data description area is the file information and the initial page number of the file.
And the data area is used for storing written data contents and occupies most of the pages of the FLASH storage area.
104. And judging whether the first NFC card is an NFC card for the NFC reader-writer to execute operation or not according to the basic information of the first NFC card.
In a possible embodiment, whether the first NFC card is an NFC card executed by the NFC reader-writer is determined, first, whether the first NFC card is the NFC card executed by the NFC reader-writer is determined by comparing whether basic information of the first NFC card is the same as basic information of the NFC card executed by the NFC reader-writer, and if the comparison result is the same, it is determined that the first NFC card is the NFC card executed by the NFC reader-writer, and if the comparison result is different, it is determined that the first NFC card is not the NFC card executed by the NFC reader-writer.
It should be noted here that before the first NFC card is attached to the NFC reader and establishes the near field communication with the NFC reader, the NFC reader does not perform a data reading (writing) operation on any NFC card, or has completed the data reading (writing) operation, that is, the NFC reader is in an idle state, and the basic information of the NFC card performing the operation stored by the NFC reader is empty, and in this case, the execution main body may use the first NFC card as the NFC card performing the operation to perform a reading operation or a writing operation on the first NFC card, based on which, when the basic information of the first NFC card is compared with the basic information of the NFC card performing the operation by the NFC reader, it is further determined whether the basic information of the NFC card performing the operation stored by the NFC reader is empty, and if so (i.e., it is determined that the basic information of the NFC card performing the operation stored by the NFC reader is empty), it is determined that the first NFC card is the NFC reader performing the operation, the basic information of the first NFC card is used as the basic information of the NFC card operated by the NFC reader; if not, determining that the first NFC card is not the NFC card operated by the NFC reader-writer.
Since the basic information of the NFC card includes a large amount of content, in order to improve the efficiency of near field communication and increase the processing speed, when comparing whether the basic information of the first NFC card is the same as the basic information of the NFC card operated by the NFC reader, the basic information of the first NFC card and the basic information of the NFC card operated by the NFC reader may be compared by comparing whether the basic information of the first NFC card is the same as the specific sub-information in the basic information of the NFC card operated by the NFC reader. For example, each NFC card has a unique identifier (e.g., an ID number of the NFC card), and a corresponding comparison result is obtained by comparing whether the ID number of the first NFC card is the same as the ID number of the NFC card operated by the NFC reader, and if the comparison result is that the ID number of the first NFC card is the same as the ID number of the NFC card operated by the NFC reader, it is determined that the first NFC card is the NFC card operated by the NFC reader; if not, further judging whether the ID number of the NFC card which is stored by the NFC reader and executes the operation is empty, if so, determining that the first NFC card is the NFC card which is executed by the NFC reader and storing the ID number of the first NFC card as the ID number of the NFC card which is executed by the NFC reader and executes the operation; if not, determining that the first NFC card is not the NFC card operated by the NFC reader-writer, and displaying the result that the first NFC card is not the NFC card operated by the NFC reader-writer.
106. And if the first NFC card is judged to be the NFC card operated by the NFC reader-writer, acquiring the data of the first NFC card.
It should be noted that the obtaining of the data of the first NFC card may be performed at any time before performing the data reading operation or the data writing operation, but in order to further improve the efficiency of the near field communication, in the embodiment of the present invention, when it is determined that the first NFC card is an NFC card in which the NFC reader performs an operation, the execution main body is triggered to obtain the data of the first NFC card; if the first NFC card is determined not to be the NFC card executed by the NFC reader, the execution main body does not need to execute the operation on the first NFC card, that is, the execution main body does not process the data of the first NFC card. Therefore, compared with the mode of directly triggering to acquire the first NCF card, the situation that the acquired first NFC card is not processed when the first NFC card is determined not to be the NFC card operated by the NFC reader-writer can be avoided, so that the time required for the execution main to execute the near field communication method is shortened, and the efficiency is improved.
108. And performing a data reading operation or a data writing operation on the first NFC card according to the basic information and the data.
According to the technical scheme provided by the embodiment of the invention, when the first NFC card and the NFC reader-writer can realize near field communication, the basic information of the first NFC card is acquired, and the data of the first NFC card is triggered and acquired only when the first NFC card is judged to be the NFC card locked by the NFC reader-writer (namely the NFC card executed by the NFC reader-writer) through judging whether the first NFC card is the NFC card locked by the NFC reader-writer, so that the first NFC card is executed with reading operation or writing operation. The invention utilizes the basic information of the NFC card to identify whether the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation or not, and carries out data communication only when the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation, thereby realizing the management of data communication connection with the connected NFC card, improving the stability of data communication connection and improving the efficiency of data transmission.
In an implementation manner of the present invention, before the first NFC card is close to the NFC reader-writer and establishes near field communication with the NFC reader-writer, the NFC reader-writer performs a data reading (writing) operation on another NFC card, but for some reasons, when the data reading (writing) operation is not performed on the another NFC card, communication between the NFC reader-writer and the another NFC card is interrupted, and in order to continue the data reading (writing) operation on the another NFC card, the execution main body may store the basic information of the another NFC card in the first location, so that the execution main body may obtain the basic information of the NFC card on which the NFC reader-writer performs the operation, and then the step 104 is implemented by comparing the basic information of the first NFC card with the basic information of the NFC card on which the NFC reader-writer performs the operation. That is, the basic information of the NFC card operated by the NFC reader/writer needs to be acquired from the first location before step 104 is implemented by using the basic information of the NFC card.
Further, in order to enable the executing entity to perform operations on other NFC cards in addition to the NFC card that is currently locked (i.e., the NFC reader is currently executing an operating NFC card) to perform read data operations or write data operations on the NFC card, therefore, to achieve this purpose, an embodiment of the present invention provides another implementation manner, and as shown in fig. 2, the method includes:
110. and judging whether the data reading operation or the data writing operation performed on the first NFC card is finished or not. If the data reading operation or the data writing operation on the first NFC card is determined to be finished, step 112 is executed, otherwise step 108 is executed.
112. And deleting the basic information of the NFC card operated by the NFC reader-writer in the first position, and generating a specified identifier.
And the designated identification is used for representing the basic information of the NFC card which is stored in the NFC reader and executes the operation.
In order to facilitate a user to understand a situation that the execution main body performs a data reading operation or a data writing operation, and improve user experience, the present invention provides a feasible embodiment in which, when the data reading operation or the data writing operation is performed on the first NFC card, the execution main body displays a process of the data reading operation or the data writing operation and data corresponding to the data reading operation or the data writing operation.
In addition, in this feasible embodiment, for the implementation of determining whether the data reading operation or the data writing operation performed on the first NFC card is finished, the following may be implemented: and judging whether the progress of displaying the data reading operation or the data writing operation reaches a preset threshold, wherein the preset threshold is mainly used for representing the relation between the quantity of the read (written) data and the quantity of the unread (written) data of the execution main body, if so, determining that the data reading operation or the data writing operation of the first NFC card is finished, and if not, determining that the data reading operation or the data writing operation of the first NFC card is not finished.
Specifically, the form of the preset threshold may include, but is not limited to: is the percentage of the amount of data that has been read (written) to the total amount of data that needs to be read (written) by the executing agent; alternatively, the percentage of the amount of unread (write) data to the total amount of data that needs to be read (written) by the executing agent; alternatively, it can also be characterized by the amount of unread (written) data.
If the preset threshold is in the form of the percentage of the number of the read (written) data to the total number of the data needing to be read (written) by the executing main body, the preset threshold for the executing main body to execute the data reading operation or the data writing operation to be finished is judged to be 100%, if the progress of the data reading (writing) operation is displayed to be 100%, the data reading (writing) operation is represented to be finished, the data reading (writing) operation executed by the first NFC card is determined to be finished, and if the progress of the data reading (writing) operation is displayed to be smaller than 100%, the data reading (writing) operation is represented to be not finished, and the data reading operation or the data writing operation executed by the first NFC card is determined to be not finished.
If the preset threshold is in the form of the percentage of the quantity of unread (written) data to the total quantity of data to be read (written) by the execution main body, the preset threshold for the execution main body to execute the data reading operation or the data writing operation is judged to be 0%, if the progress for displaying the data reading (writing) operation is 0%, the data reading (writing) operation is represented to be completed, the data reading (writing) operation executed by the first NFC card is determined to be completed, if the progress for displaying the data reading (writing) operation is greater than 0%, the data reading (writing) operation is represented to be not completed, and the data reading operation or the data writing operation executed by the first NFC card is determined to be not completed.
If the form of the preset threshold is the quantity of unread (write) data, the preset threshold for executing the data reading operation or the data writing operation of the main body to be finished is judged to be 0, if the progress for displaying the data reading (writing) operation is 0, the data reading (writing) operation is represented to be finished, the data reading (writing) operation of the first NFC card is determined to be finished, if the progress for displaying the data reading (writing) operation is larger than 0, the data reading (writing) operation is represented to be not finished, and the data reading operation or the data writing operation of the first NFC card is determined to be not finished.
In another implementation manner of the present invention, as shown in fig. 3, the execution body may further perform the following steps to implement a data reading (writing) operation on the first NFC card:
202. and establishing a card object and a data object corresponding to the first NFC card according to the basic information and data of the first NFC card.
The card object is established according to basic information of the first NFC card, and at least one or more of data description information, data length information, available memory pages and available memory space of data are packaged in the card object.
It should be noted that the communication protocol specifies the format of the storage space of the storage device, where the commonly used specified formats include FAT32 and FAT16, the NFC card adopts a FAT16 format, and in order to avoid an abnormality in data reading (writing) operation due to the storage space format not conforming to the specification of the communication protocol, in an embodiment of the present invention, before establishing a card object and a data object corresponding to the first NFC card, it is determined whether the storage space of the first NFC card is the specified format, if so, a step of establishing the card object and the data object corresponding to the first NFC card is triggered, and if not, the storage space of the first NFC card is formatted. The storage space comprises a guide area, a data storage page area, a data description area and a data area.
204. Based on the card object and the data object, a read data operation or a write data operation is performed.
It should be added that, in order to improve the efficiency of the read (write) data operation and reduce the error rate of the read (write) data operation, before the read data operation or the write data operation is performed, the execution main body may first determine whether to perform the read data operation or the write data operation, and then perform the corresponding read or write operation on the data. Based on the idea, the executing the data reading operation or the data writing operation based on the card object and the data object comprises the following steps: and generating a data monitoring instruction and a data read-write list based on the established card object and the data object, so as to respond to the data monitoring instruction and execute data reading operation or data writing operation on the data in the data read-write list according to the data read-write list.
Based on the card object and the data object, executing a process of reading data operation: the execution main body firstly obtains data description information corresponding to the card object according to the established card object, and obtains the number of data storage pages occupied by data read by the execution main body and a data starting storage page based on the data description information, wherein the data storage pages comprise data storage page items, the data storage page items comprise partial addresses for storing the data and next data storage pages corresponding to the data object, so that the execution main body obtains storage addresses corresponding to the data object based on the data storage starting pages and the data storage page items, and further the execution main body can read the data corresponding to the data object based on the obtained storage addresses. In order to know whether data is read completely, after the data storage page item is obtained, whether the content in the data storage page item is valid may be determined first, for example, whether the data storage page in the data storage page item is less than or equal to the maximum data storage page corresponding to the card object may be determined, if so, the content in the data storage page item is determined to be valid, the execution main body may execute the data corresponding to the data object based on the acquired storage address, and otherwise, the execution main body obtains an indication indicating end, and stops reading the data.
Wherein, based on the card object and the data object, the process of writing data operation is executed: the execution main body firstly obtains the data length and the available storage page of the card object according to the established card object, generates a data storage page configuration scheme based on the data length and the available storage page, configures a storage address for the data object, obtains a data start storage page corresponding to the data storage page configuration scheme, writes data corresponding to the data object based on the storage address, and in addition, after completing the data writing operation, the execution main body generates corresponding data storage page information and data description page information according to the data storage configuration scheme and writes the two information into a data storage page area and a data description area respectively in order to facilitate reading the written data. In order to improve the data writing efficiency, before acquiring a data start storage page corresponding to the data storage page configuration scheme, whether data corresponding to the data object exceeds a data available storage space or not may be judged; if the judgment result is that the data is over, sending prompt information to inform a user that the storage space is insufficient and the data cannot be stored; and if the data object does not exceed the preset data storage page configuration scheme, executing a step of obtaining a data initial storage page corresponding to the data storage page configuration scheme, and writing data corresponding to the data object based on the storage address.
The near field communication method provided by the embodiment of the present invention is further described in detail by two specific application examples in conjunction with a specific execution device.
Example 1
Fig. 4 is a flowchart of a near field communication method according to an embodiment of the present invention. Referring to fig. 4, the near field communication method in this example includes:
step 10: and the NFC card reader polls the NFC card ID attached to the bottom layer, judges whether the attached NFC card ID exists or not, and stores the current attached NFC card ID when the NFC card is attached to the NFC card reader.
Step 20: judging whether the ID number of the current approaching card is the same as the ID number of the current transaction operation card (namely the NFC card currently operated by the NFC reader), and if so, executing the step 30; if not, executing step 40;
step 30: polling a small data block of the file in the read-write file queue, judging whether the read-write file NFC card is interrupted, and if the read-write file NFC card is interrupted, executing the step 10 again; if not, go to step 50;
step 40: judging whether the ID number of the current transaction operation card is empty, if not, prompting that the current close card is inconsistent with the card in operation; if the ID number of the operation card is null, executing step 60;
step 50: storing the progress of reading and writing data, displaying the progress on an upper layer, displaying contents when a file is read and written, simultaneously judging whether all read-write operations are finished, and if so, clearing the ID number of the current transaction operation card to be null; otherwise, re-executing step 30;
step 60: acquiring the NFC card object and the read-write object, requesting to monitor the read-write file, saving the current NFC card ID number as the current transaction operation card ID number, and executing the step 30.
Example two:
fig. 5 is a diagram illustrating another flow chart of a near field communication method according to an embodiment of the present invention. Referring to fig. 5, the near field communication method in this example includes:
step 1: acquiring basic information of the card and inputting and outputting streams. Judging whether the storage space is in a standardized format, if not, formatting the storage space of the NFC card, wherein the storage space comprises a guide area, a storage page area, a file description area and a file data area; if yes, executing step 2;
step 2: establishing a card object and a read-write object, requesting to monitor a read-write file by an upper layer, setting an upper layer buffer read-write file list, judging whether to execute read operation or write operation, and executing a step 3 if the read operation is executed; if the write operation is executed, executing step 7;
and step 3: obtaining a file initial storage page according to the file description;
and 4, step 4: reading the file data of the offset position corresponding to the storage page, judging whether the content of the storage page item is normal, and if so, executing the step 5; otherwise, executing step 6;
and 5: acquiring the content of the storage page item, namely the next storage page number, and returning to the step 4;
step 6: stopping reading the file when the file is finished or other identifiers exist;
and 7: according to the file length and the available storage pages, a file storage page scheme is arranged, whether the available storage data space is exceeded or not is judged, and if the available storage data space is exceeded, the upper layer prompts the file to exceed the capacity of the card; otherwise, executing step 8;
and 8: obtaining a file initial storage page according to a storage page distribution scheme;
and step 9: writing file data of the offset position corresponding to the file storage page, judging whether the file is written completely, and executing the step 10 if the file is written completely; otherwise, executing step 11;
step 10: writing the file storage page area according to the file storage page allocation scheme, and writing the file description area according to the file storage page allocation scheme;
step 11: and obtaining the next storage page according to the storage page allocation scheme, and returning to execute the step 9.
Note that, the NFC reader according to the embodiment of the present invention may include, but is not limited to, a Personal Computer (PC), a Personal Digital Assistant (PDA), a wireless handheld device, a Tablet Computer (Tablet Computer), a mobile phone, an MP3 player, an MP4 player, and the like, which can implement near field communication.
The embodiment of the invention further provides an embodiment of a device for realizing the steps and the method in the embodiment of the method.
Please refer to fig. 6, which is a block diagram illustrating an apparatus according to an embodiment of the present invention. As shown, the apparatus comprises:
the card management module 610 is configured to acquire basic information of a first NFC card, where the first NFC card is an NFC card within a specified range from an NFC reader, determine whether the first NFC card is an NFC card for the NFC reader to perform operations according to the basic information of the first NFC card, and acquire data of the first NFC card if it is determined that the first NFC card is an NFC card for the NFC reader to perform operations.
Specifically, the card management module 610 may include a card information reading unit, a card object management unit, and a card status monitoring unit. The card information reading unit is used for reading basic information of the card, and the card object management unit is used for managing objects, such as card approaching to the NFC card reader, card leaving from the NFC card reader, card changing and the like, executing management of connection stability and card identification and locking management. The card state monitoring unit is used for monitoring the read-write operation of the file.
And the read-write module 620 is configured to perform a read data operation or a write data operation on the first NFC card according to the basic information and the data.
Specifically, the read/write module 620 may include a read/write management unit, a physical addressing IO management unit, a read queue, and a write queue. The read-write management unit is used for managing the read-write operation of the data. And the physical addressing IO management unit is used for converting a physical addressing mode into a file storage management mode. The read queue and the write queue are respectively used for reading and writing data. And the read-write management unit, the physical addressing IO management unit, the read queue and the write queue in the read-write module are matched with each other, so that the data reading operation or the data writing operation is executed on the first NFC card according to the basic information and the data.
Since each unit in the present embodiment is capable of the above-mentioned near field communication method, reference may be made to the above-mentioned related description of the near field communication method in the present embodiment, which is not described in detail.
Embodiments of the present invention further provide a computer-readable storage medium having stored thereon a computer program, which when executed by a processor, performs any of the near field communication methods described above.
According to the technical scheme provided by the embodiment of the invention, when the first NFC card and the NFC reader-writer can realize near field communication, the basic information of the first NFC card is acquired, and the data of the first NFC card is triggered to be acquired only when the first NFC card is judged to be the NFC card locked by the NFC reader-writer (namely the NFC card for executing operation by the NFC reader-writer) through judging whether the first NFC card is the NFC card locked by the NFC reader-writer, so that the first NFC card is executed with reading operation or writing operation. The invention utilizes the basic information of the NFC card to identify whether the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation or not, and carries out data communication only when the NFC card which is close to the NFC reader-writer at present is the NFC card for carrying out data reading and writing operation, thereby realizing the management of data communication connection with the connected NFC card, improving the stability of data communication connection and improving the efficiency of data transmission.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the embodiments provided in the present invention, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions in actual implementation, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) or a Processor (Processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (11)

1. A near field communication method is applied to an NFC (near field communication) reader-writer, and comprises the following steps:
acquiring basic information of a first NFC card, wherein the first NFC card is an NFC card which is far away from the NFC reader and is within a specified range;
judging whether the first NFC card is an NFC card for the NFC reader to execute operation or not according to the basic information of the first NFC card;
if the first NFC card is judged to be the NFC card executed by the NFC reader-writer to operate, acquiring data of the first NFC card;
according to the basic information and the data, performing data reading operation or data writing operation on the first NFC card;
the judging whether the first NFC card is the NFC card for the NFC reader-writer to execute the operation comprises the following steps: comparing whether the basic information of the first NFC card is the same as the basic information of the NFC card operated by the NFC reader-writer to obtain a comparison result;
if the comparison result is the same, determining that the first NFC card is the NFC card executed by the NFC reader-writer to operate, and if the comparison result is different, determining that the first NFC card is not the NFC card executed by the NFC reader-writer to operate;
if the basic information of the first NFC card is not the same as the basic information of the NFC card operated by the NFC reader-writer, the method further comprises the following steps:
judging whether the basic information of the NFC card executing the operation stored by the NFC reader-writer is empty;
and if the basic information of the NFC card for executing the operation stored by the NFC reader-writer is judged to be null, determining that the first NFC card is the NFC card for executing the operation by the NFC card reader-writer, and taking the basic information of the first NFC card as the basic information of the NFC card for executing the operation by the NFC reader-writer.
2. The method according to claim 1, wherein before the determining whether the first NFC card is an NFC card on which the NFC reader/writer performs operations, the method comprises:
and acquiring basic information of the NFC card operated by the NFC reader-writer from a first position.
3. The method of claim 1, further comprising:
judging whether the data reading operation or the data writing operation performed on the first NFC card is finished or not;
and if the data reading operation or the data writing operation of the first NFC card is judged to be finished, deleting the basic information of the NFC card operated by the NFC reader, and generating an appointed identification, wherein the appointed identification is used for representing that the basic information of the NFC card operated by the NFC reader is empty.
4. The method of claim 3, wherein the performing a read data operation or a write data operation on the first NFC card comprises:
displaying the progress of the data reading operation or the data writing operation and data corresponding to the data reading operation or the data writing operation;
the judging whether the data reading operation or the data writing operation performed on the first NFC card is finished comprises: and judging whether the progress of the display data reading operation or the data writing operation reaches a preset threshold, if so, determining that the first NFC card executes the data reading operation or the data writing operation is finished, and if not, determining that the first NFC card executes the data reading operation or the data writing operation is not finished.
5. The method according to claim 1, characterized in that it comprises:
establishing a card object and a data object corresponding to the first NFC card according to the basic information and data of the first NFC card;
and executing a read data operation or a write data operation based on the card object and the data object.
6. The method of claim 5, wherein the card object includes therein at least one or more of data description information, data length information, available memory pages, and data available memory space.
7. The method of claim 6, wherein performing a read data operation based on the card object and the data object comprises:
acquiring the storage address of the data object according to the data description information,
and reading the data corresponding to the data object based on the storage address.
8. The method of claim 6, wherein performing a write operation based on the card object and the data object comprises:
configuring a storage address for the data object according to the data length and the available storage page;
and writing the data corresponding to the data object based on the storage address.
9. The method of claim 8, wherein the method comprises:
judging whether the data corresponding to the data object exceeds the available storage space of the data;
if the judgment result is that the alarm signal exceeds the preset threshold, sending a prompt message;
and if the data object is judged not to be exceeded, the step of writing the data corresponding to the data object based on the storage address is executed.
10. A near field communication apparatus, characterized in that the apparatus comprises:
the first acquisition unit is used for acquiring basic information of a first NFC card, and the first NFC card is an NFC card which is away from an NFC reader in a specified range;
the judgment unit is used for judging whether the first NFC card is an NFC card for the NFC reader-writer to execute operation or not according to the basic information of the first NFC card;
a second obtaining unit, configured to obtain data of the first NFC card if it is determined that the first NFC card is an NFC card on which the NFC reader executes an operation;
the processing unit is used for executing data reading operation or data writing operation on the first NFC card according to the basic information and the data;
the judgment unit is specifically configured to compare whether the basic information of the first NFC card is the same as the basic information of the NFC card executed by the NFC reader, and obtain a comparison result; if the comparison result is the same, determining that the first NFC card is the NFC card executed by the NFC reader-writer to operate, and if the comparison result is different, determining that the first NFC card is not the NFC card executed by the NFC reader-writer to operate; if the basic information of the first NFC card is different from the basic information of the NFC card executed by the NFC reader-writer, judging whether the basic information of the NFC card executed by the NFC reader-writer is empty or not; and if the basic information of the NFC card for executing the operation stored by the NFC reader-writer is judged to be null, determining that the first NFC card is the NFC card for executing the operation by the NFC card reader-writer, and taking the basic information of the first NFC card as the basic information of the NFC card for executing the operation by the NFC reader-writer.
11. A computer-readable storage medium, comprising a computer program which, when executed by a processor, implements the method of any one of claims 1-9.
CN201810292000.1A 2018-03-30 2018-03-30 Near field communication method, device and computer readable storage medium Active CN108521646B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810292000.1A CN108521646B (en) 2018-03-30 2018-03-30 Near field communication method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810292000.1A CN108521646B (en) 2018-03-30 2018-03-30 Near field communication method, device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN108521646A CN108521646A (en) 2018-09-11
CN108521646B true CN108521646B (en) 2021-09-03

Family

ID=63431155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810292000.1A Active CN108521646B (en) 2018-03-30 2018-03-30 Near field communication method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN108521646B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112711955B (en) * 2020-04-08 2024-08-13 深圳市文鼎创数据科技有限公司 NFC information transmission method, NFC information transmission device and terminal

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101333892A (en) * 2008-07-29 2008-12-31 宁波高新区瑞奥光电技术有限公司 Safety processing method of RFID system for door lock
CN103544510A (en) * 2013-09-30 2014-01-29 小米科技有限责任公司 Information processing method, information processing device and mobile terminal
CN107589904A (en) * 2016-07-08 2018-01-16 中兴通讯股份有限公司 The reading/writing method and device of SD card

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4887627B2 (en) * 2005-01-19 2012-02-29 日本電気株式会社 RFID reading system, RFID reading method, RFID reader, RFID reading management apparatus, RFID reader control program and computer-readable information recording medium, and RFID reading management apparatus control program and computer recording the same Possible information recording media
CN101546369B (en) * 2008-03-28 2010-12-22 华为技术有限公司 Radio frequency identification method and system, radio-frequency signal answering method, reader-writer and tag
CN101430755A (en) * 2008-11-13 2009-05-13 王新锋 Label recognition anti-collision processing method in radio frequency recognition technology
CN102244530B (en) * 2010-05-10 2013-12-18 国民技术股份有限公司 Near field communication method and system
CN102750561B (en) * 2012-06-07 2015-08-12 中国科学技术大学 A kind of method of efficient active safety radio frequency identification authentication
KR102032247B1 (en) * 2013-01-15 2019-10-15 삼성전자 주식회사 Method and apparatus for operating near field communication function in a portable terminal
CN103455913B (en) * 2013-08-26 2017-09-19 天地融科技股份有限公司 NFC payment, device, system and mobile terminal

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101333892A (en) * 2008-07-29 2008-12-31 宁波高新区瑞奥光电技术有限公司 Safety processing method of RFID system for door lock
CN103544510A (en) * 2013-09-30 2014-01-29 小米科技有限责任公司 Information processing method, information processing device and mobile terminal
CN107589904A (en) * 2016-07-08 2018-01-16 中兴通讯股份有限公司 The reading/writing method and device of SD card

Also Published As

Publication number Publication date
CN108521646A (en) 2018-09-11

Similar Documents

Publication Publication Date Title
US10185944B2 (en) POS peripherals controlling device, mobile host device, and control method thereof
EP2744296B1 (en) Method and terminal for managing rfid card
US8341361B2 (en) Method for storing data as well as a transponder, a read/write-device, a computer readable medium including a program element and such a program element adapted to perform this method
CN109559226A (en) Block chain transaction execution method, system and electronic equipment and storage medium
CN106155596B (en) Data writing method and device
KR20170004400A (en) Method for payment using short range communication and electronic device thereof
US9514067B2 (en) Interface arbitration for a wired tag
EP2704021A1 (en) SRAM handshake
CN112926710A (en) NFC analog card switching method, mobile terminal and computer readable storage medium
CN104915696A (en) Android-platform-based NFC writing and reading method
CN103092648B (en) A kind of image upgrade method, system and subscriber equipment and personal computer
CN108521646B (en) Near field communication method, device and computer readable storage medium
JP2018152130A (en) Communication device and communication system
CN106331169A (en) Method for reporting loss of mobile terminal and cloud customer terminal, cloud server, mobile terminal
CN108038403B (en) Card reading method based on NFC technology and client
CN108008908A (en) The method and apparatus of data in a kind of management and control SD card
CN102938804B (en) Method and device for managing contact information
CN114580451A (en) Antenna parameter configuration method and device, storage medium and electronic equipment
CN112418944A (en) Coupon transfer method and device, electronic equipment and storage medium
CN106094207B (en) The right management method of virtual reality system and virtual reality glasses
CN107454953B (en) EMV (empirical mode decomposition) implementation method and device
CN218630803U (en) House card distributing device and house card distributing device
CN109101436A (en) Data dynamic addressing storage method and device, storage medium and terminal equipment
CN103684547A (en) Apparatus and method for providing data transmission/reception in a terminal using near field communication
CN109886050B (en) Card information acquisition method and device, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20190710

Address after: 519060 Guangwan Street, Xiangzhou District, Zhuhai City, Guangdong Province, 83, 01, 1st, 3rd, 4th, 5th, 6th, 7th and 8th floors

Applicant after: Zhuhai APEX Microelectronics Co., Ltd.

Address before: 519060 Zhuhai City, Guangdong Province, 3883 Zhuhai Avenue 3883 01 Building 2, 7 Building B District, 02, 03, 04 Building 1, 2, 3, 4, 5, 05

Applicant before: Nasida Limited by Share Ltd

TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200508

Address after: 519000 room 105-68710, No. 6, Baohua Road, Hengqin New District, Zhuhai City, Guangdong Province (centralized office area)

Applicant after: Zhuhai Jihai Semiconductor Co., Ltd

Address before: 519060 Guangwan Street, Xiangzhou District, Zhuhai City, Guangdong Province, 83, 01, 1st, 3rd, 4th, 5th, 6th, 7th and 8th floors

Applicant before: APEX MICROELECTRONICS Co.,Ltd.

GR01 Patent grant
GR01 Patent grant