Storage medium having stored therein communication program, information processing apparatus, communication system, communication method, and storage medium having communication function

An example of an information processing apparatus performs near field communication with a communication target. An example of a communication target has stored therein main data to be read, identification information, and status information set in accordance with writing of the main data to the communication target. In accordance with the fact that, as a result of the communication target coming close to the information processing apparatus, the information processing apparatus has become capable of performing near field communication with the communication target, the information processing apparatus reads the identification information and the status information from the communication target. Further, the information processing apparatus determines, on the basis of the read identification information and status information, whether or not it is necessary to read the main data.

CROSS REFERENCE TO RELATED APPLICATION

The disclosure of Japanese Patent Application No. 2012-272549, filed on Dec. 13, 2012, is incorporated herein by reference.

FIELD

The technology relates to a storage medium having stored therein a communication program for performing near field communication with a communication target, an information processing apparatus, a communication system, and a communication method for performing near field communication with a communication target, and a storage medium having a communication function for performing near field communication with a communication target.

BACKGROUND AND SUMMARY

Conventionally, there is a technique of performing communication between apparatuses, using near field communication such as NFC (Near Field Communication). In near field communication, in accordance with the fact that a communication target, which is another communication apparatus, has come close to a communication apparatus, the communication target is specified, and communication is started between the communication apparatus and the communication target.

In conventional near field communication, every time any communication target (for example, an NFC tag) comes close to an information processing apparatus (for example, an NFC reader/writer) that communicates, communication is established between the communication target and the information processing apparatus, and data is transmitted and received. Conventionally, there is a case where unnecessary communication is performed for the same communication target, which prevents efficient near field communication.

Therefore, the present application discloses a storage medium having stored therein a communication program capable of efficiently performing near field communication, an information processing apparatus, a communication system, and a communication method that are capable of efficiently performing near field communication, and a storage medium having a communication function capable of efficiently performing near field communication.

An example of a storage medium according to the present specification is a non-transitory computer-readable storage medium having stored therein a communication program to be executed by a computer of an information processing apparatus capable of performing near field communication with a communication target.

The communication target has stored therein main data to be read, identification information unique to each communication target, and status information set in accordance with writing of the main data to the communication target.

The communication program causes the computer to execute reading and determination.

In accordance with the fact that, as a result of the communication target coming close to the information processing apparatus, the information processing apparatus has become capable of performing near field communication with the communication target, the computer reads the identification information and the status information of the communication target from the communication target.

The computer determines, on the basis of the read identification information and status information, whether or not it is necessary to read the main data from the communication target.

It may be determined, on the basis of the read identification information and status information, whether or not the main data from the communication target having become capable of communicating with the information processing apparatus has already been acquired, thereby determining whether or not it is necessary to read the main data from the communication target.

The communication program may further cause the computer to execute: if it has been determined that the main data has already been acquired, not reading the main data from the communication target; and if it has been determined that the main data has not yet been acquired, reading the main data from the communication target.

The communication program may further cause the computer to execute, if the main data has been read from the communication target, saving the read main data in a storage section of the information processing apparatus. If it has been determined that the main data has already been acquired, the main data saved in the storage section is used as the main data read from the communication target.

When the main data is written to the communication target, the main data may be saved in the storage section.

The communication program may further cause the computer to execute saving the read status information in a storage section of the information processing apparatus in association with the identification information with respect to each communication target. Regarding the communication target corresponding to the identification information read from the communication target, if the read status information matches the status information saved in the storage section, it is determined that it is not necessary to read the main data, and if the read status information does not match the status information saved in the storage section, it is determined that it is necessary to read the main data.

The communication program may further cause the computer to execute, when the main data is written to the communication target, updating a content of the status information stored in the communication target.

When an instruction to communicate with the communication target has been given by an application executed by the information processing apparatus, the identification information and the status information may be read from the communication target. Further, when an instruction to communicate with the communication target has been given by an application executed by the information processing apparatus, if it has been determined that the main data has already been acquired, the main data may not be read from the communication target.

When an instruction to read the main data from the communication target has been given by the application, the identification information and the status information may be read from the communication target. Further, when an instruction to read the main data from the communication target has been given by the application, if it has been determined that main data has already been acquired, the main data may not be read from the communication target.

When an instruction to rewrite the main data to the communication target has been given by the application, the identification information and the status information may be read from the communication target. Further, when an instruction to rewrite the main data to the communication target has been given by the application, if it has been determined that the main data has not yet been acquired, the main data to be rewritten may be read from the communication target, and if it has been determined that the main data has already been acquired, the main data may not be read from the communication target.

The status information may be information uniquely set in accordance with the number of times data has been written to the communication target.

The status information may be at least one of counter information indicating the number of times data has been written to the communication target and time information indicating a time when data has been written to the communication target.

A total data size of the identification information and the status information may be smaller than a data size of the main data.

It should be noted that the present specification discloses an example of an information processing apparatus including functions equivalent to those of the information processing apparatus according to the above configurations (1) through (13), and discloses an example of a communication system including the communication target (a communication target apparatus) and the information processing apparatus according to the above configurations (1) through (13). Further, the present specification discloses a communication method to be performed by the information processing apparatus according to the above configurations (1) through (13).

In addition, the present specification discloses an example of a storage medium including functions equivalent to those of the communication target according to the above configurations (1) through (13). Here, the storage medium may be in the form of being used mainly as storage means, such as an IC card, or may be in the form of being built into an information processing apparatus (for example, an information processing apparatus having an NFC card emulation function).

These and other objects, features, aspects and advantages of the exemplary embodiments will become more apparent from the following detailed description of the exemplary embodiments when taken in conjunction with the accompanying drawings.

DETAILED DESCRIPTION OF NON-LIMITING EXAMPLE EMBODIMENTS

[1. Configuration of Communication System]

A description is given below of a communication program, an information processing apparatus, a communication system, a communication method, and a storage medium according to an exemplary embodiment. First, the configuration of the communication system is described.FIG. 1is a diagram showing an example of the configuration of the communication system according to the exemplary embodiment. As shown inFIG. 1, a communication system1includes an information processing apparatus2and a communication target3. The information processing apparatus2may be any information processing apparatus capable of performing near field communication with the communication target3.

In the exemplary embodiment, a description is given taking as an example the case where, as exemplary near field communication, communication based on the NFC standard is performed between the information processing apparatus2and the communication target3. Here, “near field communication” as used herein refers to a communication method where radio waves from an apparatus develop an electromotive force (for example, by electromagnetic induction) in another apparatus. The other apparatus can operate by the developed electromotive force (the other apparatus may or may not have a power supply). In near field communication, when the information processing apparatus2and the communication target3have come close to each other (typically, the distance between the information processing apparatus2and the communication target3has become dozen centimeters or less), the information processing apparatus2and the communication target3become capable of communicating with each other. Near field communication in the exemplary embodiment is a communication method also referred to as “contactless communication”. Further, in near field communication in the exemplary embodiment, radio waves continue to be transmitted while the communication between two communication apparatuses is established (a communication target, which is another communication apparatus, is close to a communication apparatus).

The information processing apparatus2may be any information processing apparatus capable of performing near field communication. In the exemplary embodiment, the information processing apparatus2is a handheld (or portable) apparatus such as a handheld game apparatus, a mobile phone, or a smartphone. For example, the information processing apparatus2is a portable device having the function of an NFC reader/writer.

The communication target3may be any apparatus capable of performing near field communication with the information processing apparatus2. In the exemplary embodiment, the communication target3is a storage medium (for example, an IC card) having the function of an NFC tag. The description is given below taking as an example the case where the communication target3is an IC card. The communication target3, however, is not limited to a storage medium such as an IC card, and may be, for example, an information processing apparatus (a portable device) having an NFC card emulation function.

The configuration of the information processing apparatus2is described below. As shown inFIG. 1, the information processing apparatus2includes a communication section11. The communication section11is an antenna used for near field communication. Further, the information processing apparatus2includes a communication chip12. In accordance with an instruction from a CPU13described later, the communication chip12generates a signal (radio waves) to be transmitted from the communication section11. The generated signal is transmitted from the communication section11. The communication chip12is, for example, an NFC chip.

As shown inFIG. 1, the information processing apparatus2includes a CPU13and a memory14. The CPU13is an information processing section for performing various types of information processing performed by the information processing apparatus2. The CPU13performs the various types of information processing using the memory14. It should be noted that although not shown in the figures, the information processing apparatus2may include an input section (a button, a touch panel, and the like) that receives an instruction from a user, and/or a display apparatus that displays an image generated by the various types of information processing.

It should be noted that the information processing apparatus2may include a plurality of apparatuses. For example, in another embodiment, a plurality of apparatuses capable of communicating with each other via a network (a wide-area network and/or a local network) may perform in a dispersed manner at least part of the information processing performed by the information processing apparatus2. Alternatively, for example, the information processing apparatus2may be configured such that an apparatus including the communication section11and the communication chip12is detachably attached to an apparatus including the CPU13and the memory14.

In the exemplary embodiment, in the information processing apparatus2, the CPU13executes at least two types of programs, namely an application program and a communication program (seeFIG. 10). The application program may be a program for executing any application for performing data communication with the communication target (IC card)3. The application program may be, for example, a game program for reading game data from the IC card3and performing game processing using the game data. The communication program is a program for performing near field communication with the IC card3. For example, the communication program is firmware for causing the communication chip12to operate. Although described in detail later, the communication program receives an instruction from an application and causes the communication chip12to perform an operation for communication. It should be noted that if the information processing apparatus2can execute a plurality of application programs, the communication program is used in all the applications in a shared manner. That is, the communication program (a communication control section described later) can receive instructions regarding communication from the plurality of applications.

As shown inFIG. 1, the information processing apparatus2includes a battery16and a power supply IC15. The power supply IC15supplies power from the battery16to components of the information processing apparatus2. In the exemplary embodiment, the power supply IC15supplies power to at least the communication chip12, the CPU13, and the memory14. Thus, a reduction in the power consumption of the communication chip12, the CPU13, and the memory14when near field communication is performed makes it possible to reduce the power consumption of the battery16.

In addition, the IC card3stores identification information17and status information18. The identification information17is information capable of identifying an individual communication target (IC card)3. In other words, the identification information17is information unique to (individually assigned to) each communication target3. In the exemplary embodiment, the identification information17is a UID (Unique ID) in NFC.

The status information18is information set in accordance with the writing of data to the IC card3(information that is changed in accordance with the writing of data). In the exemplary embodiment, the status information18is a counter indicating the number of times data has been written to the IC card3.

In addition, the IC card3stores, as well as the identification information17and the status information18, data (hereinafter referred to as “main data”)19to be read by the information processing apparatus2. The main data19is data that is stored in advance in the IC card3, or written by the other apparatus (including the information processing apparatus2) with which near field communication is performed. The main data19is data indicating information different from the identification information17and the status information18. In the exemplary embodiment, the main data19is used in an application executed by the information processing apparatus2. That is, during the execution of the application, the information processing apparatus2reads the main data19from the IC card3, or writes, to the IC card3, data to be stored as the main data19.

It should be noted that in the exemplary embodiment, data is written to and read from the IC card3with the entirety of the main data19as a unit. That is, when the main data19is read, the entirety of the main data19is read (even if only part of the main data19is required). Further, when data is written to the IC card3(the main data19is rewritten), the entirety of the main data19is rewritten (even if only part of the main data19is rewritten).

[2. Operation of Communication System]

(2-1: Overview of Operation)

Next, with reference toFIGS. 2 through 8, the operation of the communication system1regarding communication is described. It should be noted that as shown inFIGS. 2 through 8, in the exemplary embodiment, the operation of the information processing apparatus2is described by separating an application section21and a communication control section22on the basis of their functions. In the exemplary embodiment, the application section21is the CPU13that executes the application program described above. The communication control section22is achieved by the CPU13that executes the communication program, the communication chip12, and the communication section11. It should be noted that in another embodiment, the information processing performed by the information processing apparatus2may not need to be achieved by two types of programs, namely the application program and the communication program, and may be achieved by a single program.

(Case A: Case Where Communication is Performed for First Time)

In this section, examples of the operation of the communication system1in some cases are described. First, with reference toFIGS. 2 and 3, a description is given of the operation in the case where the information processing apparatus2and the IC card3communicate with each other for the first time (case A).FIG. 2is a diagram showing states before and after the operation of the communication system1in case A.FIG. 3is a diagram showing the flow of the operation of the communication system1in case A. With reference toFIGS. 2 and 3, the case is considered where the information processing apparatus2reads data A, which is the main data19, from the IC card3.

A state (a) shown inFIG. 2is a state before the information processing apparatus2and the IC card3communicate with each other. In the state (a), the IC card3stores “data A” as the main data and stores “n” (n is a natural number) as the value of a counter C, which is the status information. Further, the information processing apparatus2has not communicated with the IC card3in the past. Thus, the information processing apparatus2does not store the main data (the data A) of the IC card3or the status information (the counter C) of the IC card3(seeFIG. 2).

In the state (a), first, the application section21sends the communication control section22an instruction to read data (seeFIG. 3). The communication control section22performs a connection process in accordance with the reading instruction (step S1). The connection process may include any specific content. For example, the communication control section22performs the process of sensing the IC card3present around the communication section11(for example, a polling process), and the process of establishing communication with the sensed IC card3(for example, the process of acquiring information necessary for data communication from the IC card3).

If communication has been established by the connection process, as shown inFIG. 3, the communication control section22performs a determination process (step S2). In the determination process, the communication control section22first reads the identification information and the status information from the IC card3. Thus, in accordance with the fact that, as a result of the IC card3coming close to the information processing apparatus2, the information processing apparatus2has become capable of performing near field communication with the IC card3, the information processing apparatus2(the communication control section22) reads the identification information and the status information of the IC card3from the IC card3(the same applies to cases B through D described later).

On the basis of the read identification information and status information, the communication control section22determines whether or not it is necessary to read the main data from the IC card3. This determination is the process of determining whether or not the main data has already been acquired from the IC card3having become capable of communicating. Although described in detail later, the determination is made on the basis of whether or not the status information acquired when the information processing apparatus2has previously accessed the IC card3matches the status information currently read from the IC card3. It should be noted that the identification information is used to identify the IC card3(described in detail later).

It should be noted that the case where the main data has already been acquired is the case where the information processing apparatus2has read in the past the main data stored in the IC card3(case B described later), or the case where the main data stored in the IC card3has been written by the information processing apparatus2in the past (case C described later). In case A, the information processing apparatus2has not acquired the status information of the IC card3(seeFIG. 2), it is determined that the two pieces of status information described above do not match each other. As a result, the communication control section22determines that it is necessary to read the main data.

After the determination process, the communication control section22performs a data reading process (step S3). The data reading process is the process of reading the main data from the IC card3, where necessary, and passing the read data to an application. A state (b) shown inFIG. 2is a state after the data reading process has been performed in the state (a). As described above, in case A, it is determined that it is necessary to read the main data. Thus, in the data reading process, the communication control section22reads the main data (the data A) from the IC card3(seeFIGS. 2 and 3). Then, the communication control section22passes the read main data to the application section21. Further, at this time, the communication control section22saves the identification information, the status information (C=n), and the main data (the data A) that have been read from the IC card3.

By the above operation, in case A, the main data is read from the IC card3and used by the application section21. It should be noted that the application section21deletes the acquired main data at appropriate timing. For example, if processing using the main data has been completed, or if the application has been ended, the application section21deletes the main data. Thus, there is a case where the application section21attempts to acquire again the main data acquired once from the IC card3. On the other hand, the communication control section22saves the main data regardless of whether or not the application section21has deleted the main data (even if the application section21has deleted the main data).

It should be noted that in the exemplary embodiment, the application section21and the communication control section22may transfer data to each other by actually transmitting (outputting) data to the other, or by notifying the other that data to be transferred has been generated. For example, in the data reading process, the communication control section22may notify that the main data has been read (the main data has been stored in a predetermined location in the memory14). Further, if the application section21and the communication control section22save the same data (for example, the “data A” shown inFIG. 2), in practice, each section does not need to separately save the data, and the memory14may save the same data. In this case, the application section21deleting the data means that the application section21stops managing the data stored in the memory14, but does not mean that the data is deleted from the memory14.

(Case B: Case Where Data Has Already Been Read)

Next, with reference toFIGS. 4 and 5, a description is given of the operation in the case where the information processing apparatus2has already acquired (has already read) the main data from the IC card3(case B).FIG. 4is a diagram showing states before and after the operation of the communication system1in case B.FIG. 5is a diagram showing the flow of the operation of the communication system1in case B. In case B, the case is considered where, after the information processing apparatus2has acquired the main data by the operation shown inFIG. 3described above, the application section21sends again the communication control section22an instruction to read data.

A state (c) shown inFIG. 4is a state before the information processing apparatus2and the IC card3communicate with each other. It is assumed that in the state (c), the application section21does not hold the main data (the data A) (has deleted the main data after the state (b)). Meanwhile, in the state (c), the data stored in the communication control section22and the IC card3is the same as that in the state (b).

In the state (c), if the application section21has sent the communication control section22an instruction to read data, the communication control section22performs a connection process similarly to case A (step S1shown inFIG. 5). This establishes communication between the communication control section22and the IC card3. If communication has been established, the communication control section22performs a determination process similarly to case A (step S2shown inFIG. 5). That is, the communication control section22reads the identification information and the status information from the IC card3, and determines whether or not it is necessary to read the main data from the IC card3.

Here, in case B, the currently read status information matches the status information acquired when the communication control section22has previously accessed the IC card3(the status information saved in the communication control section22) (seeFIG. 4). As a result, in the determination process performed in case B, it is determined that it is not necessary to read the main data.

After the determination process, the communication control section22performs a data reading process (step S3in shown inFIG. 5). It should be noted that a state (d) shown inFIG. 4is a state after the data reading process has been performed in the state (c). As described above, in case B, it is determined that it is not necessary to read the main data. Thus, in the data reading process, the communication control section22does not read the main data (the data A) from the IC card3(seeFIGS. 4 and 5). In case B, the main data has been read in the past and is saved, and therefore, it is not necessary to read the main data. Thus, the communication control section22uses the saved main data as the main data read from the IC card3. That is, the saved main data is passed to the application section21. As described above, if the information processing apparatus2has already acquired the main data, the reading of the data from the IC card3is omitted.

It should be noted that either when the result of the determination in the determination process is affirmative or when the result of the determination in the determination process is negative (in either case A or B), any operation may be performed by the information processing apparatus2after the data reading process. For example, after the data reading process, the communication control section22may end the communication with the IC card3and wait for an instruction from the application section21. Alternatively, for example, the communication control section22may repeatedly perform the series of processes of the above steps S1through S3. It should be noted that in this case, in and after the second repetition of the series of processes of the above steps S1through S3, the reading of the data from the IC card3is omitted unless the IC card3is changed.

As described above using cases A and B as examples, in the exemplary embodiment, if the IC card3capable of communicating has appeared (the IC card3has come close to the information processing apparatus2), the information processing apparatus2reads the identification information and the status information and determines, on the basis of the identification information and the status information, whether or not it is necessary to read the main data (step S2). Based on this, if it has been determined that it is not necessary to read the main data, the information processing apparatus2can perform appropriate processing such as the omission of communication. This enables the information processing apparatus2and the IC card3to efficiently communicate with each other.

Specifically, in the exemplary embodiment, if it has been determined that the main data has already been acquired, the communication control section22does not read the main data from the IC card3(case B). If it has been determined the main data has not yet been acquired, the communication control section22reads the main data from the IC card3(case A). This makes it possible to omit the process of reading unnecessary data. This makes it possible to improve the processing speed of an application regarding the reading of data, or reduce the power consumption required for near field communication.

In addition, in the exemplary embodiment, if data (main data) has been read from the IC card3, the communication control section22saves the read data in a storage section of the information processing apparatus2(FIGS. 2 and 3). Then, in the subsequent determination process, if it has been determined that the data has already been acquired from the IC card3, the communication control section22uses, as the data read from the IC card3, the data saved in the storage section (the memory14) (FIGS. 4 and 5). This enables the information processing apparatus2(the application section21) to perform processing using the main data even if omitting the reading of the main data from the IC card3.

(Case C: Case Where Data is Written)

Next, with reference toFIGS. 6 and 7, a description is given of the operation in the case where the information processing apparatus2writes data to the IC card3(case C).FIG. 6is a diagram showing states before and after the operation of the communication system1in case C.FIG. 7is a diagram showing the flow of the operation of the communication system1in case C. In case C, the case is considered where the application section21sends the communication control section22an instruction to write data.

A state (e) shown inFIG. 6is a state before the information processing apparatus2and the IC card3communicate with each other. It is assumed that in the state (e), the data stored in the communication control section22and the IC card3is the same as that in the state (b).

In the state (e), if the application section21has sent the communication control section22an instruction to write data, a connection process (step S1) is performed similarly to the case of the reading instruction.

Here, as described above, in the exemplary embodiment, data is written to (and read from) the IC card3with the entirety of the main data as a unit. That is, when writing data to the IC card3, the communication control section22first reads the main data from the IC card3. Next, the application section21rewrites a necessary portion of the read main data. Finally, the communication control section22writes the data obtained by the rewriting as the main data to the IC card3, so as to replace the read main data.

As described above, in the exemplary embodiment, also when data is written, the process of reading the main data from the IC card3(a data reading process) is performed first. Further, also in the data reading process when data is written, a determination process (step S2) is performed before the data reading process (step S3), in order to omit the reading of the data from the IC card3(seeFIG. 7). That is, after a connection process, the communication control section22performs the determination process (step S2) and the data reading process (step S3) similarly to the case of the reading instruction. It should be noted that in case C, similarly to case B, the status information saved in the communication control section22matches the status information of the IC card3. This enables the communication control section22to omit the reading of the main data. It should be noted that the operation of the data reading process in the case where the status information saved in the communication control section22does not match the status information of the IC card3is similar to that in case A.

As described above, in the exemplary embodiment, even when the information processing apparatus2reads the main data prior to the operation of writing the main data to the IC card3, it is possible to omit the reading of the main data from the IC card3. This enables the communication system1to efficiently perform communication

In case C, when having acquired the main data from the communication control section22, the application section21generates main data obtained by rewriting (“data B” inFIG. 6), using the acquired main data. Further, after the data reading process, the communication control section22performs a data writing process (step S4shown inFIG. 7). It should be noted that a state (f) shown inFIG. 6is a state after the data writing process has been performed in the state (e). When writing new main data, the communication control section22receives from the application section21the main data to be written (the “data B”, which is the main data obtained by the rewriting), and writes the received main data to the IC card3.

In addition, when data is written to the IC card3, the communication control section22updates the content of the status information stored in the IC card3(seeFIGS. 6 and 7). That is, the communication control section22writes the updated status information to the IC card3. In the example shown inFIG. 6, the value of the counter C of the IC card3is incremented by 1 (updated from “n” to “n+1”). This makes it possible to cause the status information18of the IC card3to accurately indicate the number of times data has been written. Further, when the information processing apparatus2reads the main data from the IC card3next, similarly to case B, the status information saved in the communication control section22matches the status information of the IC card3. This enables the communication control section22to omit the reading of the main data.

It should be noted that the status information18is updated not only by the information processing apparatus2, but also by any information processing apparatus that writes data to the IC card3. That is, even if data has been written by another information processing apparatus different from the information processing apparatus2, the status information18of the IC card3is updated. As a result, the status information18accurately indicates the number of times data has been written to the IC card3.

In addition, when data is written to the IC card3, the communication control section22saves the data in the storage section (the memory14). In the example shown inFIG. 6, the communication control section22saves the written data B in the memory14. This enables the information processing apparatus2(the application section21) to perform processing using the main data, even if the information processing apparatus2omits the reading of the main data when reading the main data from the IC card3.

(Case D: Case Where Data Has Been Rewritten by Another Apparatus)

Next, with reference toFIG. 8, a description is given of the operation in the case where the main data of the IC card3has been rewritten by another apparatus (case D).FIG. 8is a diagram showing states before and after the operation of the communication system1in case D. In case D, the case is considered where, after the main data of the IC card3has been acquired by the information processing apparatus2by the operation in case A, the main data of the IC card3is rewritten by another apparatus, and thereafter, the information processing apparatus2reads data from the IC card3again.

A state (g) shown inFIG. 8is a state before the information processing apparatus2and the IC card3communicate with each other. It is assumed that in the state (g), the application section21does not hold the main data (has deleted the main data after the state (b)). In the state (g), the data stored in the communication control section22is the same as that in the state (b). Further, it is assumed that as a result of the main data being rewritten by the other apparatus, the IC card3stores the data B as the main data and stores “n+1” as the value of the counter C, which is the status information.

The flow of the operation of the communication system1in case D is the same as that in case A (FIG. 3). That is, in the state (g), if the application section21has sent the communication control section22an instruction to read data, the communication control section22performs a connection process (step S1) and a determination process (step S2) similarly to the state (a). Here, in case D, the currently read status information (counter C=n+1) does not match the status information acquired when the information processing apparatus2has previously accessed the IC card3(the status information (counter C=n) saved in the communication control section22). As a result, in case D, it is determined that it is necessary to read the main data.

A state (h) shown inFIG. 8is a state after the operation based on a reading instruction has been performed in the state (g). As described above, in case D, it is determined that it is necessary to read the main data. Thus, the operation in a data reading process (step S3) is similar to that in case A (FIGS. 2 and 3). That is, the communication control section22reads the main data from the IC card3and passes the read main data to the application section21(seeFIG. 8). Further, at this time, the communication control section22saves the identification information, the status information (C=n+1), and the main data (the data B) that have been read from the IC card3. Thus, when the information processing apparatus2reads the main data from the IC card3next, similarly to the state (c) shown inFIG. 4, the status information saved in the communication control section22matches the status information of the IC card3. This enables the communication control section22to omit the reading of the main data.

As described above, in the exemplary embodiment, if an instruction to communicate with the IC card3(a reading instruction and/or a writing instruction) has been given by the application (the application section21) to be executed by the information processing apparatus2, the communication control section22reads the identification information and the status information from the IC card3. Then, if it has been determined that data (main data) of the IC card3has already been acquired, the communication control section22does not read the data from the IC card3regardless of the instruction from the application. Thus, in the exemplary embodiment, the application does not need to manage whether or not the data of the IC card3has already been acquired. This facilitates the creation of an application. It should be noted that in the exemplary embodiment, if a reading instruction or a writing instruction has been given as an instruction from the application, it is possible to omit the reading of the data regardless of the instruction from the application. Thus, in the exemplary embodiment, when giving a reading instruction or a writing instruction, the application can easily perform efficient near field communication without performing the above management.

In the exemplary embodiment, the status information18is counter information indicating the number of times data has been written to the IC card3. More specifically, the status information18indicates the total number of times data is written to the IC card3. That is, if data has been written to the IC card3, the status information18of the IC card3is incremented by 1.

It should be noted that the status information18may be any information uniquely set in accordance with the number of times data has been written to the IC card3. For example, in another embodiment, the status information18may be time information (for example, a timestamp) indicating the time when data has been written to the IC card3. If the status information18is the counter information and/or the time information, the information processing apparatus2can easily set the status information18. It should be noted that “uniquely set in accordance with the number of times data has been written” means the indication of a value varied depending on the number of times data has been written, but does not require uniqueness in a strict sense. For example, the status information18may be information substantially uniquely set in accordance with the number of times data has been written, and may be, for example, a hash value or the output value of a CRC (Cyclic Redundancy Check).

In addition, in the exemplary embodiment, the total data size of the identification information17and the status information18is smaller than the data size of the main data. Thus, by reading information (the identification information17and the status information18) having a relatively small data size, the information processing apparatus2can determine whether or not it is necessary to read the main data having a relatively large data size. This makes it possible to significantly reduce the data size of data to be read from the IC card3, if the reading of the main data is omitted.

Next, a determination method in the determination process (step S2) is described. The determination method in the determination process may be any method. In the exemplary embodiment, the determination is made on the basis of whether or not the status information previously read from the IC card3by the information processing apparatus2matches the currently read status information.

Specifically, the communication control section22saves, among the pieces of status information read from the IC card3, the latest status information in the storage section (the memory14) of the information processing apparatus2in association with the identification information with respect to each IC card3. That is, as described above, in any of the following cases (a) through (c), the communication control section22saves the status information newly acquired from the IC card3.(a) the case where the communication control section22does not save the status information of the IC card3(case A)(b) the case where the status information of the IC card3is updated in accordance with the writing of data (case C)(c) the case where the status information saved in the communication control section22is different from the status information of the IC card3(case D)

In the exemplary embodiment, the communication control section22saves as a status information table a set of the identification information and the status information that have been read from the IC card3.FIG. 9is a diagram showing an example of the status information table. As shown inFIG. 9, in the status information table, the identification information indicating an IC card3and the status information (counter information) of the IC card3are stored in association with each other with respect to each IC card3.

If the identification information and the status information have been read from the IC card3in the determination process, the communication control section22determines whether or not the read status information matches the saved status information of the IC card3corresponding to the read identification information. In the exemplary embodiment, the communication control section22determines whether or not the value of the read status information matches the value of the status information associated with the read identification information in the status information table. It should be noted that if the read identification information is not included in the status information table, the communication control section22determines that the read status information and the saved status information do not match each other.

If the read status information and the saved status information match each other, the communication control section22determines that it is not necessary to read the main data. If, on the other hand, the read status information and the saved status information do not match each other, the communication control section22determines that it is necessary to read the main data. This makes it possible to easily determine whether or not it is necessary to read the main data.

It should be noted that in any of the above cases (a) through (c), a set of the identification information and the status information is updated and saved. In the exemplary embodiment, the communication control section22updates the content of the status information table. That is, a set of new identification information and new status information is newly added to the status information table. At this time, if the same identification information as the new identification information is already included in the status information table, a set of the older identification information and the older status information is deleted. This enables the communication control section22to save, among the pieces of status information read from the IC card3, the latest status information in the memory14in association with the identification information with respect to each IC card3.

[3. Details of Information Processing Performed by Communication System]

(3-1: Data Used in Information Processing)

With reference toFIGS. 10 and 12, a description is given below of an example of specific processing performed by the communication system1(the information processing apparatus2) in the exemplary embodiment.FIG. 10is a diagram showing an example of a data area set in the memory14of the information processing apparatus2in the exemplary embodiment. As shown inFIG. 10, the memory14of the information processing apparatus2has a program storage area31and a processing data storage area34.

In the program storage area31, various programs to be executed by the information processing apparatus2are stored. In the exemplary embodiment, in the program storage area31, the application program32and the communication program33described above are stored. It should be noted thatFIG. 10shows only one type of application program. Alternatively, the information processing apparatus2may store a plurality of types of application programs. It should be noted that the application program32(the communication program33likewise) may be stored in advance in a storage device in the information processing apparatus2, or may be acquired from a storage medium attachable to and detachable from the information processing apparatus2and stored in the memory14, or may be acquired from another apparatus via a network such as the Internet and stored in the memory14. The CPU13executes a program (the application program32and/or the communication program33) stored in the memory14.

In the processing data storage area34, various types of data to be used in the information processing performed by the information processing apparatus2(information processing shown inFIGS. 11 and 12) are stored. In the exemplary embodiment, in the processing data storage area34, at least identification information data35, status information data36, status information table data37, and saved data38are stored.

The identification information data35is data indicating the identification information described above, read from the IC card3. The status information data36is data indicating the status information described above, read from the IC card3. The status information table data37is data indicating the status information table described above, saved in the information processing apparatus2. The saved data38is the main data of the IC card3, saved in the information processing apparatus2. That is, the main data read from the IC card3or the main data written to the IC card3is stored as the saved data38in the memory14. It should be noted that althoughFIG. 10shows only one type of saved data38, the saved data38is stored in the memory14with respect to each IC card3with which the information processing apparatus2has communicated in the past. Further, the status information table data37and the saved data38may be stored in a storage device that holds stored contents even if the information processing apparatus2is powered off.

(3-2: Specific Example of Information Processing)

Next, with reference toFIGS. 11 and 12, the detailed flow of the information processing according to the exemplary embodiment is described.FIG. 11is a flow chart showing an example of the flow of the information processing (a reading instruction process) performed by the information processing apparatus2(the CPU13) when the reading instruction has been given in the exemplary embodiment. In the exemplary embodiment, a series of processes shown inFIG. 11are performed by the CPU13executing the communication program33. Further, the reading instruction process may be started at any timing. In the exemplary embodiment, the reading instruction process is started in accordance with the fact that the reading instruction (regarding near field communication) has been given by an application.

It should be noted that the processes of all the steps in the flow chart shown inFIGS. 11 and 12are merely illustrative. Thus, the processing order of the steps may be changed, or another process may be performed in addition to (or instead of) the processes of all the steps, so long as similar results are obtained. Further, in the exemplary embodiment, descriptions are given on the assumption that the CPU13performs the processes of all the steps in the flow chart. Alternatively, a processor or a dedicated circuit other than the CPU13may perform the processes of some of the steps in the flow chart.

In the exemplary embodiment, first, in step S11, the CPU13performs the connection process described above (step S1shown inFIG. 2and the like). This establishes near field communication between the information processing apparatus2and the IC card3. In the subsequent step S12, the CPU13acquires the identification information and the status information from the IC card3(step S2shown inFIGS. 3, 5, and 7). At this time, the CPU13stores data of the acquired identification information as the identification information data35in the memory14, and stores data of the acquired status information as the status information data36in the memory14.

In step S13, the CPU13determines whether or not it is necessary to read the main data from the IC card3(step S2shown inFIGS. 3, 5, and 7). That is, the CPU13reads the identification information data35, the status information data36, and the status information table data37from the memory14, and makes the determination using the read pieces of data35through37. It should be noted that in the exemplary embodiment, the determination is made by the method described in the above “2-3: Determination Method”. If the determination is affirmative in the above step S13, that is, if it has been determined that it is necessary to read the main data, a series of processes shown in steps S14through S16are performed. If, on the other hand, the determination is negative in the above step S13, that is, if it has been determined that it is not necessary to read the main data, the process of step S17is performed.

In step S14, the CPU13reads the main data from the IC card3(step S3shown inFIGS. 3 and 7). In the subsequent step S15, the CPU13passes the read main data to the application (step S3shown inFIGS. 3 and 7). This enables the application to perform information processing using the main data of the IC card3.

In step S16, the CPU13saves the data acquired in steps S12and S14. That is, the CPU13stores the main data acquired in step S14, as the saved data38in the memory14. Further, the status information table is updated so as to include a set of the identification information and the status information that have been acquired in step S12. Specifically, the CPU13updates the status information table data37on the basis of the identification information data35and the status information data36that are stored in the memory14. After step S16, the CPU13ends the reading instruction process shown inFIG. 11.

On the other hand, in step S17, the CPU13passes the saved main data to the application, as the main data stored in the IC card3(step S3shown inFIG. 5). That is, the CPU13notifies the application that the main data is stored as the saved data38in the memory14. Alternatively, the CPU13reads the saved data38from the memory14and outputs the saved data38to the application. After step S17, the CPU13ends the reading instruction process shown inFIG. 11.

Next, a description is given of information processing performed by the information processing apparatus2(the CPU13) when the writing instruction has been given (a writing instruction process).FIG. 12is a flow chart showing an example of the flow of the writing instruction process performed by the information processing apparatus2(the CPU13) in the exemplary embodiment. In the exemplary embodiment, a series of processes shown inFIG. 12are performed by the CPU13executing the communication program33. Further, the writing instruction process may be started at any timing. In the exemplary embodiment, the writing instruction process is started in accordance with the fact that the writing instruction (regarding near field communication) has been given by an application.

Also in the writing instruction process, the processes of steps S11through S13are performed similarly to the reading instruction process described above. Further, if the result of the determination is affirmative in step S13, the processes of steps S14and S15are performed similarly to the reading instruction process. It should be noted that in the writing instruction process, the process of step S16is not performed. If, on the other hand, the result of the determination is negative in step S13, the process of step S17is performed similarly to the reading instruction process described above. In the writing instruction process, after step S15or S17, the CPU13performs the process of step S21described later.

In step S21, the CPU13writes data to the IC card3(step S4shown inFIG. 7). That is, in the writing instruction process, the application generates data obtained by rewriting, using the data passed from the application in step S15or S17. In step S21, the CPU13writes to the IC card3the main data rewritten by the application. In the subsequent step S22, the CPU13updates the content of the status information stored in the IC card3(step S4shown inFIG. 7).

In step S23, the CPU13saves the pieces of information acquired in step S12and the data written in step S22(seeFIGS. 6 and 7). The process of saving the identification information and the status information that have been acquired in step S12is the same as that in step S16. Further, the CPU13stores, as the saved data38in the memory14, the main data written to the IC card3in step S22. After step S23, the CPU13ends the writing instruction process shown inFIG. 12.

As described above, in the exemplary embodiment, if a reading instruction or a writing instruction has been given, it is possible to omit the reading of the data from the IC card3. It should be noted that in another embodiment, an instruction given by an application is not only the reading instruction or the writing instruction, but also an instruction including any content. Based on the communication method according to the exemplary embodiment, in any case where the operation of reading data (main data) from the IC card3in accordance with an instruction is performed, the reading of the data from the IC card3may be omitted. Thus, it is possible to efficiently perform communication.

In the above embodiment, data is read from and written to the communication target (IC card)3with the entirety of the main data as a unit. Here, in another embodiment, data may be read from and written to the communication target3with respect to a plurality of predetermined units. In other words, the communication target3may store a plurality of pieces of main data, each of which is a unit of reading and writing data. In this case, the identification information and the status information may be set with respect to each predetermined unit (with respect to each piece of main data). This enables the information processing apparatus2to determine, with respect to a plurality of units of storage, whether or not the pieces of main data have already been acquired.

As described above, the exemplary embodiment can be used as, for example, a portable device that performs near field communication with a communication target, a communication program to be executed by a portable device, and the like in order, for example, to efficiently perform near field communication with a communication target.