Card switching method for NFC (Near Field Communication) equipment, NFC equipment and storage medium
By using the key control level change signal in the NFC device to activate the selector module, the problem that the NFC device cannot switch virtual cards in the shutdown mode is solved, and the card switching function in the power-on and shutdown mode is realized, simplifying the operation process.
Patent Information
- Application Number
- CN202411726335.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-28
- Publication Date
- 2025-03-18
AI Technical Summary
In existing mobile devices, NFC devices cannot switch virtual cards in shutdown card simulation mode, and users cannot control the switching of virtual cards.
By pressing the key control power supply to output a level change signal to the input port of the NFC controller, the NFC controller receives the level change signal and passes it to the selector module. The selector module determines the identity information of the virtual card currently to be activated based on the event information and sends an activation command to activate the selected card.
It realizes that card switching can be performed in both the NFC device boot card simulation mode and the shutdown card simulation mode, simplifying the card switching method, and users can switch virtual cards through key control.
Smart Images

Figure CN119646790A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of near field communication, and in particular to a card switching method for an NFC device, an NFC device, and a storage medium. Background Art
[0002] Currently, more and more mobile devices are equipped with NFC (Near Field Communication) function. NFC card simulation function is an important application scenario of NFC. This technology allows users to simulate multiple virtual cards on a physical device at the same time, such as bus cards, access cards, bank cards, car keys, etc. Moreover, this technology generally supports power-off card simulation, that is, even if the host device is turned off, you can still swipe the card with a virtual card. The reason why NFC can still swipe the card when the host device is turned off is mainly because the power supply is still supplying power to the NFC chip when the host device is turned off.
[0003] However, in existing mobile devices, the card switching method is relatively complicated. And there is a disadvantage of swiping the card in the shutdown card simulation mode, the user cannot control the switching of the virtual card. Because the host device is turned off, the user cannot switch the card through the human-machine interface. Therefore, in the shutdown mode, only the card that has been activated when the device is turned on can be swiped, and manual intervention is not possible to switch the card. Summary of the invention
[0004] In order to solve the above technical problems, the present disclosure provides a card switching method for an NFC device, an NFC device, and a storage medium, which can perform card switching in both the power-on card simulation mode and the power-off card simulation mode of the NFC device.
[0005] In a first aspect, an embodiment of the present disclosure provides a card switching method for an NFC device, comprising: outputting a level change signal to an input port of an NFC controller by controlling a power supply through a button; the NFC controller receiving the level change signal and transmitting event information to a selector module in the NFC controller based on the level change signal, wherein the event information includes an event type and a button type; the selector module determines identity information of a virtual card to be currently activated based on the event information; the selector module sends an activation instruction, wherein the activation instruction includes the identity information of the virtual card to be currently activated; and the NFC execution environment activates the virtual card to be currently activated based on the activation instruction.
[0006] In some embodiments, the event type includes an active level change signal.
[0007] In some embodiments, it also includes: initializing the selector module, obtaining a list of contactless selectable applications installed in the NFC execution environment, recording the activated applications, and recording the index value of the activated application in the application list as a variable Active_Index, wherein the virtual card corresponds one-to-one to each application in the application list; the selector module recalculates Active_Index based on event information; and the selector module determines the identity information of the virtual card to be activated currently based on the new Active_Index.
[0008] In some embodiments, the NFC device includes two buttons, which are used to generate a positive traversal signal and a negative traversal signal respectively, and the button type includes the positive traversal signal and / or the negative traversal signal; the selector module recalculates the Active_Index based on the event information, including: when the selector module receives the positive traversal signal, the index value of the application in the application list is incremented and the index value of the next application in the application list is selected as the new Active_Index; when the selector module receives the negative traversal signal, the index value of the application in the application list is decremented and the index value of the next application in the application list is selected as the new Active_Index.
[0009] In some embodiments, the NFC device includes a button, which is used to generate a forward traversal signal, and the button type includes a forward traversal signal; the selector module recalculates the Active_Index based on the event information, including: the selector module receives the forward traversal signal, and starts from the index value of the activated application in the application list and increments the index to select the next application in the application list as the new Active_Index.
[0010] In some embodiments, the NFC device includes a button, which is used to generate a random selection signal, and the button type includes a random selection signal; the selector module recalculates the Active_Index based on the event information, including: the selector module receives the random selection signal, excludes the already activated applications, and randomly selects an application in the application list, and the index value of the application in the application list is the new Active_Index.
[0011] In some embodiments, the method further includes: the selector module sends a deactivation instruction, the deactivation instruction includes the identity information of the activated virtual card; and the NFC execution environment changes the state of the activated virtual card to deactivated based on the deactivation instruction.
[0012] In some embodiments, the method further includes: the NFC controller receives the level change signal by software polling the input port or hardware interruption.
[0013] In the second aspect, the present disclosure also provides an NFC device, including: a host device, a button, a switching circuit, a power supply, an NFC controller and an NFC execution environment, the button is set on the host device, and the switching circuit, the power supply, the NFC controller and the NFC execution environment are all set inside the host device; at least one button is connected to the power supply and the input port of the NFC controller through the switching circuit, and at least one button is used to control the power supply to output a level change signal to the input port of the NFC controller; the NFC controller is used to receive the level change signal and to transmit event information to a selector module in the NFC controller based on the level change signal, and the event information includes the event type and the button type; the selector module is used to determine the identity information of the virtual card to be activated currently based on the event information; the selector module is also used to send an activation instruction, and the activation instruction includes the identity information of the virtual card to be activated currently; the NFC execution environment is communicatively connected to the NFC controller, and the NFC execution environment activates the virtual card to be activated currently based on the activation instruction.
[0014] In a third aspect, the present disclosure further provides a computer-readable storage medium storing program instructions, which, when executed, enable a computer to execute the card switching method for an NFC device as described in the present disclosure.
[0015] Compared with the prior art, the technical solution provided by the present invention has the following advantages:
[0016] The card switching method for NFC devices provided by the present disclosure can output a level change signal to the input port of the NFC controller by controlling the power supply through a button, the NFC controller receives the level change signal, and transmits event information to the selector module in the NFC controller based on the level change signal, the selector module determines the identity information of the virtual card to be activated based on the event information, the selector module sends an activation instruction, the activation instruction includes the identity information of the virtual card to be activated, and the NFC execution environment activates the virtual card to be activated based on the activation instruction, thereby realizing the card switching function of the NFC device, and the switching method is simple. In addition, in the card simulation mode of the NFC device when it is turned on and the card simulation mode of the NFC device is turned off, the power supply can be controlled by a button to input a corresponding level change signal to the input port of the NFC controller, thereby realizing the card switching function of the NFC device when it is turned on and the card simulation mode of the NFC device is turned off. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0019] Figure 1 is a structural schematic diagram of an NFC device provided by the present disclosure;
[0020] Figure 2 It is a flowchart of a card switching method for an NFC device provided by the present disclosure;
[0021] Figure 3 It is a flowchart of another card switching method for NFC devices provided by the present disclosure. DETAILED DESCRIPTION
[0022] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0023] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0024] In order to be able to understand the features and technical contents of the embodiments of the present disclosure in more detail, the implementation of the embodiments of the present disclosure is described in detail below in conjunction with the accompanying drawings. The attached drawings are for reference only and are not used to limit the embodiments of the present disclosure. In the following technical description, for the convenience of explanation, a full understanding of the disclosed embodiments is provided through multiple details. However, one or more embodiments can still be implemented without these details. In other cases, to simplify the drawings, well-known structures and devices can be simplified for display.
[0025] The terms "first", "second", etc. in the specification and claims of the embodiments of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the terms used in this way can be interchanged where appropriate for the embodiments of the embodiments of the present disclosure described herein. In addition, the terms "including", "having" and any variations thereof are intended to cover non-exclusive inclusions.
[0026] Unless otherwise stated, the term "plurality" means two or more.
[0027] In the embodiment of the present disclosure, the character " / " indicates that the preceding and following objects are in an "or" relationship. For example, A / B indicates: A or B.
[0028] The term "and / or" is a description of the association relationship between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or, A and B.
[0029] The term "correspondence" may refer to an association relationship or a binding relationship. The correspondence between A and B means that there is an association relationship or a binding relationship between A and B.
[0030] Figure 1 is a schematic diagram of the structure of an NFC device provided by the present disclosure, referring to Figure 1 , the NFC device includes a host device 100, a button 101, a switch circuit 103, a power supply 104, an NFC controller 200 and an NFC execution environment 300, the button 101 is arranged on the host device 100, and the switch circuit 103, the power supply 104, the NFC controller and the NFC execution environment 300 are all arranged inside the host device 100. Optionally, the host device 100 can be a mobile phone, a watch, a wearable device and the like. The host device 100 has an NFC (Near Field Communication) function, and the host device 100 is provided with an NFC controller (NFCController, NFCC) 200 and an NFC execution environment (NFCExecutionEnvironment, NFCEE) 300 and the like.
[0031] The button 101 is a physical button on the host device 100. The switch circuit 103 connects the button 101, the power supply 104 and the input port of the NFC controller 200. It should be noted that: Figure 1 The switch circuit 103 is only for illustration and represents a logical relationship, not an actual physical electronic circuit. The actual physical circuit can be set according to requirements, but the final logical function realized is similar to the schematic diagram, that is, the button 101 can finally generate an input signal on the input port of the NFC controller.
[0032] Optionally, a button 102 may be further provided on the host device 100. The connection method of the button 102 may refer to the connection method of the button 101, and the disclosure will not be repeated here. Of course, in other embodiments of the disclosure, more buttons may be provided on the host device 100.
[0033] Optionally, the input port of the NFC controller can be an IO port, generally a GPIO. The example diagram only shows one input port, but in actual situations there may be multiple input ports to receive different key signals. The NFC controller is responsible for completing the conversion of the RF protocol and forwarding the application data.
[0034] The NFC execution environment 300 is a carrier for implementing virtual cards, and each virtual card exists as an independent application in the NFC execution environment 300. For example, the virtual card can be a bank card, a bus card, a subway card, an access card, an attendance card, a membership card, a parking card, an elevator card, etc.
[0035] Figure 1 4 also exemplarily shows an application scenario of NFC devices, where the card reader device 400 can access the activated applications in the NFC execution environment 300 through a contactless protocol. Exemplarily, the card reader device 400 can be a card reader or a POS machine.
[0036] Figure 2 is a flowchart of a card switching method for an NFC device provided by the present disclosure, with reference to Figure 2 This embodiment provides a card switching method for an NFC device, including:
[0037] Step 501: Control a power source through a button to output a level change signal to an input port of an NFC controller.
[0038] Specifically, as the button is pressed and released, the power supply can be controlled to input a level change signal to the input port of the NFC controller. Exemplarily, when the button is not pressed, the level change signal input to the input port of the NFC controller is a low level, when the button is pressed, the level change signal input to the input port of the NFC controller is a high level, and when the button is released, the level change signal input to the input port of the NFC controller returns to a low level. In addition, in both the power-on card simulation mode and the power-off card simulation mode of the NFC device, the level change signal input to the input port of the NFC controller can be input by pressing and releasing the button.
[0039] Optionally, the button can be reused as the power button or volume adjustment button on the NFC device. The pressing and releasing actions of the volume button can be used as a switch to trigger a high-level pulse equal to the duration of the button press to the input port of the NFC controller. The power button can also be used as the above switch. When the power button is used as the above switch, a short press is required as the trigger event, because a long press of the power button is generally used as a power-on signal for the NFC device.
[0040] Optionally, the event type includes a valid level change signal, and the NFC controller triggers the card replacement action after receiving the valid level change signal. Exemplarily, the expected valid level change signal that triggers the card replacement action can be defined as: the signal state of the input port of the NFC controller is low in the default state; when the signal state changes from low to high, the signal starts; the signal state maintains a high level for more than 10 milliseconds and less than 1000 milliseconds, and the trigger signal in the level change signal is considered to be valid, which can effectively eliminate the burr signal generated by unexpected interference on the input port of the NFC controller.
[0041] Optionally, a timer in the NFC controller may count the high level maintenance time.
[0042] Step 502: The NFC controller receives the level change signal, and transmits event information to a selector module in the NFC controller based on the level change signal, where the event information includes an event type and a key type.
[0043] Specifically, the event type includes a valid level change signal. The key type can be divided into a key action in a single key mode, or a "volume up" key in a dual key mode, or a "volume down" key. Of course, in other embodiments of the present disclosure, in addition to the above exemplary key design, other combination types of key events can also be designed to generate richer signal inputs.
[0044] Optionally, the NFC controller may receive the level change signal by software polling the input port or hardware interrupt.
[0045] Step 503: The selector module determines the identity information of the virtual card to be activated currently based on the event information.
[0046] Specifically, the selector module receives event information, that is, the selector module can obtain the level change signal of the input port of the NFC controller to select the virtual card to be activated currently, and determine the identity information of the virtual card to be activated currently.
[0047] Optionally, each application in the contactless selectable application list installed in the NFC execution environment corresponds to the virtual card one by one, and each application in the application list has an AID (Application Identifier), and the identity information of the virtual card includes the corresponding AID.
[0048] Step 504: the selector module sends an activation instruction, which includes the identity information of the virtual card to be activated.
[0049] Optionally, the selector module sends an activation instruction to the NFC execution environment through the communication interface of the NFC controller, where the activation instruction includes the identity information of the virtual card to be activated.
[0050] Optionally, the NFC controller and the NFC execution environment interact with each other in an application layer protocol manner of APDU instructions.
[0051] Step 505: The NFC execution environment activates the virtual card currently to be activated based on the activation instruction.
[0052] Optionally, the NFC execution environment may activate the virtual card to be activated according to the AID in the APDU activation instruction.
[0053] Optionally, the card reader device may access an application activated in the NFC execution environment via a contactless protocol.
[0054] The card switching method for NFC devices provided by the embodiment of the present disclosure can control the power supply to output a level change signal to the input port of the NFC controller through a button, the NFC controller receives the level change signal, and transmits event information to the selector module in the NFC controller based on the level change signal, the selector module determines the identity information of the virtual card to be activated based on the event information, the selector module sends an activation instruction, the activation instruction includes the identity information of the virtual card to be activated, and the NFC execution environment activates the virtual card to be activated based on the activation instruction, thereby realizing the card switching function of the NFC device, and the switching method is simple. In addition, in the card simulation mode of the NFC device when it is turned on and the card simulation mode when it is turned off, the power supply can be controlled by a button to input a corresponding level change signal to the input port of the NFC controller, thereby realizing the card switching function of the NFC device when it is turned on and the card simulation mode when it is turned off.
[0055] Figure 3 is a flowchart of another card switching method for NFC devices provided by the present disclosure, referring to Figure 3 In some optional embodiments, the card switching method further includes:
[0056] Step 506, the selector module is initialized, obtains a list of contactless selectable applications installed in the NFC execution environment, records activated applications, and records the index value of the activated application in the application list as a variable Active_Index, wherein the virtual card corresponds one-to-one to each application in the application list.
[0057] Specifically, the contactless selectable application list refers to a list of all applications carried in the NFC execution environment that allow contactless access. Activated applications refer to contactless accessible applications that are currently activated in the NFC execution environment. All contactless accessible applications carried in the NFC execution environment have two states, one is activated state and the other is deactivated state. In the activated state, an external card reader device can access the functions provided by the application in a contactless (NFC near-field communication) manner. Applications in the deactivated state cannot be accessed by external card readers temporarily and need to be set to the activated state.
[0058] The process of initializing the above internal data of the selector module is as follows: During the initialization phase, the selector module scans and obtains a list of all contactless selectable applications installed in the NFC execution environment. It also records the applications that have been activated in the current NFC execution environment. The currently activated applications are also in the contactless selectable application list maintained by the selector module. The index value of the currently activated application in the list is recorded by the variable Active_Index.
[0059] In order to achieve normal operation of the selector module, when the NFC device is in the shutdown card emulation mode, the selector module is initialized, obtains the list of contactless selectable applications installed in the NFC execution environment, records the activated applications, and records the index value of the activated application in the application list as the variable Active_Index.
[0060] Step 503 includes step 5031 and step 5032. Among them,
[0061] Step 5031, the selector module recalculates Active_Index based on the event information.
[0062] Specifically, the selector module recalculates Active_Index after receiving the event information.
[0063] Step 5032, the selector module determines the identity information of the virtual card to be activated currently based on the new Active_Index.
[0064] Specifically, the selector module can determine the identity information of the virtual card to be activated after recalculating the new Actived_Index, and then send an activation instruction to the NFC execution environment to set the status of the application in the application list pointed to by the new Actived_Index to the activated status.
[0065] Continue to refer Figure 3 Optionally, in some optional embodiments, the card switching method further includes:
[0066] Step 507, the selector module sends a deactivation instruction, the deactivation instruction includes the identity information of the activated virtual card;
[0067] Step 508: The NFC execution environment changes the state of the activated virtual card to deactivated based on the deactivation instruction.
[0068] Specifically, after the selector module recalculates and obtains the new Actived_Index, it can determine the identity information of the virtual card to be activated, and then send a deactivation instruction to the NFC execution environment, first set the currently activated application to a deactivated state, and then set the state of the application in the application list pointed to by the new Actived_Index to an activated state, thereby realizing the card switching function of the NFC device.
[0069] Optionally, the button may be one or more than one, and different numbers of buttons may select different card switching strategies.
[0070] In some optional embodiments, the NFC device includes two buttons, the two buttons are used to generate a positive traversal signal and a negative traversal signal respectively, and the button type includes the positive traversal signal and / or the negative traversal signal;
[0071] The selector module recalculates Active_Index based on event information including:
[0072] When the selector module receives the forward traversal signal, it starts from the index value of the activated application in the application list and selects the index value of the next application in the application list as the new Active_Index.
[0073] That is, the next application is selected by increasing the index from the index position of the currently activated application. If the index of the currently activated application is at the end of the list, the list starts again from the head.
[0074] Optionally, Active_Index can be calculated according to the following formula: Active_Index = (Actived_Index + 1) % N, where N is the total number of applications in the application list. This allows the index value of the next application in the application list to be selected as the new Active_Index, starting from the index value of the already activated application in the application list. Of course, in other embodiments of the present disclosure, other formulas can be used to calculate Active_Index, so as to select the index value of the next application in the application list as the new Active_Index, starting from the index value of the already activated application in the application list, starting from the index value of the already activated application in the application list, starting from the index value of the already activated application in the application list, and the present disclosure will not elaborate on them one by one.
[0075] When the selector module receives a negative traversal signal, it starts from the index value of the activated application in the application list and selects the index value of the next application in the application list as the new Active_Index.
[0076] That is, the next application is selected by decreasing the index starting from the index position of the currently activated application.
[0077] Optionally, Active_Index can be calculated as follows:
[0078] If Active_Index=0, then Active_Index=N-1;
[0079] If Active_Index≠0, then Active_Index=Active_Index-1; where N is the total number of applications in the application list. This allows the index value of the next application in the application list to be selected as the new Active_Index, starting from the index value of the already activated application in the application list. Of course, in other embodiments of the present disclosure, other formulas can also be used to calculate Active_Index, so as to achieve the index value of the next application in the application list to be selected as the new Active_Index, starting from the index value of the already activated application in the application list ...
[0080] The selector module can thus recalculate Active_Index based on event information in different ways.
[0081] In some optional embodiments, the NFC device includes a button, the button is used to generate a forward traversal signal, and the button type includes a forward traversal signal;
[0082] The selector module recalculates Active_Index based on event information including:
[0083] The selector module receives the forward traversal signal, and selects the index value of the next application in the application list as a new Active_Index, starting from the index value of the activated application in the application list and increasing the index.
[0084] That is, the next application is selected by increasing the index from the index position of the currently activated application. If the index of the currently activated application is at the end of the list, the list starts again from the head.
[0085] Optionally, Active_Index can be calculated according to the following formula: Active_Index = (Actived_Index + 1) % N, where N is the total number of applications in the application list. This allows the index value of the next application in the application list to be selected as the new Active_Index, starting from the index value of the already activated application in the application list. Of course, in other embodiments of the present disclosure, other formulas can be used to calculate Active_Index, so as to select the index value of the next application in the application list as the new Active_Index, starting from the index value of the already activated application in the application list, starting from the index value of the already activated application in the application list, starting from the index value of the already activated application in the application list, and the present disclosure will not elaborate on them one by one.
[0086] In some optional embodiments, the NFC device includes a button, the button is used to generate a random selection signal, and the button type includes a random selection signal;
[0087] The selector module recalculates Active_Index based on event information including:
[0088] The selector module receives the random selection signal, excludes the activated applications, and randomly selects an application in the application list whose index value in the application list is a new Active_Index.
[0089] That is, a new application is randomly selected from the application list, excluding the currently activated application.
[0090] It should be noted that the above embodiments exemplarily illustrate the card selection strategy of the selector module when the NFC device includes one button or two buttons. In other embodiments of the present disclosure, the selector module may also set other card selection strategies. Of course, the NFC device may also include other numbers of buttons. In this case, the selector module may also set other card selection strategies, which will not be described in detail in the present disclosure.
[0091] Continue to refer Figure 1 This embodiment further provides an NFC device, including: a host device 100, a button 101, a switch circuit 103, a power supply 104, an NFC controller 200 and an NFC execution environment 300, wherein the button 101 is disposed on the host device 100, and the switch circuit 103, the power supply 104, the NFC controller 200 and the NFC execution environment 300 are all disposed inside the host device 100;
[0092] At least one button 101 is connected to the power supply 104 and the input port of the NFC controller 200 through the switch circuit 103, and the at least one button 101 is used to control the power supply 104 to output a level change signal to the input port of the NFC controller 200;
[0093] The NFC controller 200 is used to receive the level change signal, and to transmit event information to the selector module 202 in the NFC controller 200 based on the level change signal, where the event information includes an event type and a key type;
[0094] The selector module 202 is used to determine the identity information of the virtual card to be activated currently based on the event information;
[0095] The selector module 202 is also used to send an activation instruction, which includes the identity information of the virtual card to be activated;
[0096] The NFC execution environment 300 is in communication connection with the NFC controller 200 , and the NFC execution environment 300 activates the virtual card currently to be activated based on the activation instruction.
[0097] Specifically, in the NFC device provided by the embodiment of the present disclosure, the power supply 104 can be controlled by the button 101 to output a level change signal to the input port of the NFC controller 200, the NFC controller 200 receives the level change signal, and transmits event information to the selector module 202 in the NFC controller 200 based on the level change signal, the selector module 202 determines the identity information of the virtual card to be activated based on the event information, the selector module 202 sends an activation instruction, the activation instruction includes the identity information of the virtual card to be activated, and the NFC execution environment 300 activates the virtual card to be activated based on the activation instruction, thereby realizing the card switching function of the NFC device, and the switching method is simple. In addition, in the card simulation mode of the NFC device when it is turned on and the card simulation mode of the NFC device is turned off, the power supply 104 can be controlled by the button 101 to input the corresponding level change signal to the input port of the NFC controller 200, thereby realizing the card switching function of the NFC device when it is turned on and the card simulation mode of the NFC device is turned off.
[0098] This embodiment also provides a computer-readable storage medium storing program instructions, which, when executed, enable a computer to execute the card switching method for an NFC device as described in the present disclosure.
[0099] The technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in the embodiment of the present disclosure. The aforementioned storage medium may be a non-transient storage medium, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes.
[0100] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0101] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0102] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.
[0103] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A card switching method for an NFC device, characterized in that: include: The power supply is controlled by a button to output a level change signal to the input port of the NFC controller; The NFC controller receives the level change signal, and transmits event information to a selector module in the NFC controller based on the level change signal, wherein the event information includes an event type and a key type; The selector module determines the identity information of the virtual card to be currently activated based on the event information; The selector module sends an activation instruction, wherein the activation instruction includes identity information of the virtual card currently to be activated; The NFC execution environment activates the virtual card currently to be activated based on the activation instruction.
2. The card switching method according to claim 1, characterized in that: The event type includes a valid level change signal.
3. The card switching method according to claim 1, characterized in that: Also includes: The selector module initializes, obtains a list of all contactless selectable applications installed in the NFC execution environment, records activated applications, and records the index value of the activated application in the application list as a variable Active_Index, wherein the virtual card corresponds to each application in the application list one by one; The selector module recalculates Active_Index based on the event information; The selector module determines the identity information of the virtual card to be currently activated based on the new Active_Index.
4. The card switching method according to claim 3, characterized in that: The NFC device comprises two buttons, the two buttons are used to generate a positive traversal signal and a negative traversal signal respectively, and the button type comprises the positive traversal signal and / or the negative traversal signal; The selector module recalculates Active_Index based on the event information, including: When the selector module receives the forward traversal signal, it selects the next application in the application list with an index value of the activated application in the application list as a new Actived_Index by increasing the index; When the selector module receives the negative traversal signal, it selects the index value of the next application in the application list as a new Active_Index starting from the index value of the activated application in the application list in descending order.
5. The card switching method according to claim 3, characterized in that: The NFC device includes a button, the button is used to generate a forward traversal signal, and the button type includes the forward traversal signal; The selector module recalculates Active_Index based on the event information, including: The selector module receives the forward traversal signal, and selects the index value of the next application in the application list as a new Active_Index, starting from the index value of the activated application in the application list and increasing the index.
6. The card switching method according to claim 3, characterized in that: The NFC device includes a button, the button is used to generate a random selection signal, and the button type includes the random selection signal; The selector module recalculates Active_Index based on the event information, including: The selector module receives the random selection signal, excludes already activated applications, and randomly selects an application in the application list whose index value in the application list is a new Active_Index.
7. The card switching method according to claim 1, characterized in that: Also includes: The selector module sends a deactivation instruction, wherein the deactivation instruction includes identity information of the activated virtual card; The NFC execution environment changes the state of the activated virtual card to deactivated based on the deactivation instruction.
8. The card switching method according to claim 1, characterized in that: Also includes: The NFC controller receives the level change signal by software polling the input port or hardware interruption.
9. An NFC device, characterized in that: include: A host device, a button, a switch circuit, a power supply, an NFC controller and an NFC execution environment, wherein the button is arranged on the host device, and the switch circuit, the power supply, the NFC controller and the NFC execution environment are all arranged inside the host device; At least one of the buttons is connected to the power supply and the input port of the NFC controller through the switch circuit, and at least one of the buttons is used to control the power supply to output a level change signal to the input port of the NFC controller; The NFC controller is used to receive the level change signal, and to transmit event information to a selector module in the NFC controller based on the level change signal, wherein the event information includes an event type and a key type; The selector module is used to determine the identity information of the virtual card to be currently activated based on the event information; The selector module is further used to send an activation instruction, wherein the activation instruction includes the identity information of the virtual card currently to be activated; The NFC execution environment is communicatively connected to the NFC controller, and the NFC execution environment activates the virtual card currently to be activated based on the activation instruction.
10. A computer-readable storage medium storing program instructions, characterized in that: When the program instructions are executed, the computer is used to execute the card switching method for an NFC device according to any one of claims 1 to 8.