Card reading and writing method, electronic equipment and storage medium

By obtaining the contact test data between the IC card and the card slot and dynamically adjusting the verification strategy, the reading and writing abnormalities caused by abnormal contact or contamination of the IC card and the card slot are solved, ensuring the successful power purchase.

CN120354866APending Publication Date: 2025-07-22DELIXI GROUP INSTRUMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510499559.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-21
Publication Date
2025-07-22

AI Technical Summary

Technical Problem

During the power purchase process, abnormal contact between the IC card and the power meter slot or contamination leads to abnormal reading and writing, resulting in failure of power purchase.

Method used

By obtaining the contact test data between the IC card and the card slot, dynamically adjusting the verification strategy, and performing card reading and writing card verification operations to ensure that the data is read and written accurately.

Benefits of technology

It improves the success rate of power purchase, avoids power purchase failure caused by abnormal reading and writing, and achieves accurate and reliable data reading and writing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120354866A_ABST
    Figure CN120354866A_ABST
Patent Text Reader

Abstract

The invention provides a card reading and writing method, electronic equipment and a storage medium, and relates to the technical field of power equipment. The method comprises the steps that when it is detected that an integrated circuit (IC) card is inserted into a card slot of an electric energy meter, test data are obtained and used for indicating the contact condition of the IC card and the card slot; determining a verification strategy according to the test data; according to the verification strategy, card reading verification operation is executed, and the card reading verification operation is used for determining whether the electricity purchasing information in the IC card is correctly read or not; when the electricity purchasing information is correctly read, the first electricity purchasing data is written into the electric energy meter and the second electricity purchasing data is written into the IC card according to the electricity purchasing information, so that accurate and reliable data reading and writing are realized, and the condition of electricity purchasing failure caused by reading and writing abnormity is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the technical field of power equipment, and in particular, to a method for reading and writing cards, an electronic device, and a storage medium. Background Art

[0002] A prepaid electricity meter is also known as a fixed-amount electricity meter or an integrated circuit card (IC card) electricity meter. For this electricity meter, users need to purchase electricity first and then recharge it through an IC card before they can use electricity. If the electricity runs out, the power supply will be automatically cut off.

[0003] In the related art, after a user purchases electricity, the purchase information is written into the IC card. The user inserts the IC card into the card slot of the electricity meter. The electricity meter reads the purchase information in the IC card and modifies the relevant data in the electricity meter according to the purchase information. After the modification is completed, the modified relevant data is written back to the IC card, thus completing the electricity purchase process.

[0004] However, in the above process, there may be jitter when inserting the card, abnormal contact between the card surface and the contacts in the card slot, or contamination of the IC card or the card slot, resulting in abnormal reading and writing, and thus the electricity purchase fails. Summary of the Invention

[0005] This application provides a method for reading and writing cards, an electronic device, and a storage medium to solve the problem that when purchasing electricity, there may be jitter when inserting the card, abnormal contact between the card surface and the contacts in the card slot, or contamination of the IC card or the card slot, resulting in abnormal reading and writing, and thus the electricity purchase fails, and to achieve accurate and reliable data reading and writing, and avoid the situation where the electricity purchase fails due to abnormal reading and writing.

[0006] In a first aspect, this application provides a method for reading and writing cards, including: When it is detected that an integrated circuit (IC) card is inserted into the card slot of the electricity meter, obtain test data, where the test data is used to indicate the contact situation between the IC card and the card slot; Determine a verification strategy according to the test data; Execute a card reading verification operation according to the verification strategy, where the card reading verification operation is used to determine whether the purchase information in the IC card is correctly read; When the purchase information is correctly read, write first purchase data to the electricity meter and second purchase data to the IC card according to the purchase information.

[0007] In a possible design, after writing the first purchase data to the electricity meter and the second purchase data to the IC card according to the purchase information, the method further includes: According to the verification policy, perform a card writing verification operation, which is used to determine whether the second electricity purchase data is correctly written to the IC card.

[0008] In a possible design, the test data includes voltage volatility, contact impedance, and bit error rate; the voltage volatility is used to indicate the voltage fluctuation condition when the contacts of the card slot are in contact with the IC card; the contact impedance is used to indicate the impedance when the contacts are in contact with the IC card; the bit error rate is used to indicate the data transmission quality of the communication link between the contacts and the IC card.

[0009] In a possible design, the determining the verification policy according to the test data includes: According to a preset parameter set, perform normalization processing on the voltage volatility, the contact impedance, and the bit error rate respectively to obtain a volatility parameter, an impedance parameter, and a bit error rate parameter; According to a first preset weight, a second preset weight, a third preset weight, the volatility parameter, the impedance parameter, and the bit error rate parameter, obtain a score value; According to the score value, determine the verification policy, and the verification policy includes the number of verification times and the verification mode.

[0010] In a possible design, the determining the verification policy according to the score value includes: When the score value is greater than or equal to a first threshold, determine that the number of verification times is a first preset number, and the verification mode is to only verify the target verification data item in the electricity purchase information; When the score value is greater than or equal to a second threshold and less than the first threshold, determine that the number of verification times is a second preset number, and the verification mode is to first verify the target verification data item in the electricity purchase information. When the verification of the target verification data item in the electricity purchase information fails, separately read the target verification data item for repeated verification; When the score value is less than the second threshold, determine that the number of verification times is a third preset number, and the verification mode is to sequentially verify all data in the electricity purchase information; Wherein, the first preset number is less than the second preset number, and the second preset number is less than the third preset number; when performing the card reading verification operation, the target verification data item is the card reading verification data item in the electricity purchase information; when performing the card writing verification operation, the target verification data item is the card writing verification data item in the electricity purchase information.

[0011] In a possible design, when the score value is greater than or equal to the second threshold and less than the first threshold, the performing the card reading verification operation according to the verification policy includes: Read the electricity purchase information from the IC card; Generate a first verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card reading verification data item; Repeat the first comparison operation for the second preset number of times; When there is one time that meets the condition of correctly reading the electricity purchase information in the comparison operation, determine that the electricity purchase information is correctly read; Wherein, the first comparison operation includes: comparing whether the card reading verification data item is consistent with the first verification data item; When the card reading verification data item is consistent with the first verification data item, determine that the electricity purchase information is correctly read; When the card reading verification data item is inconsistent with the first verification data item, separately read the card reading verification data item from the IC card again, and repeat the comparison of whether the card reading verification data item is consistent with the first verification data item for the fourth preset number of times; When all the fourth preset number of times of comparisons are consistent, determine that the electricity purchase information is correctly read; When there is an inconsistency in the fourth preset number of times of comparisons, determine that the electricity purchase information is not correctly read.

[0012] In a possible design, the writing the first electricity purchase data to the electricity meter and writing the second electricity purchase data to the IC card according to the electricity purchase information includes: When it is determined that the in-card local number in the electricity purchase information is consistent with the in-meter local number in the electricity meter, and the user status in the electricity purchase information is the normal electricity consumption status, and the in-card electricity purchase times in the electricity purchase information is equal to the in-meter electricity purchase times in the electricity meter plus one, write the first electricity purchase data to the electricity meter, so that the in-meter remaining amount in the electricity meter is updated to the sum of the in-meter remaining amount and the electricity purchase amount in the electricity purchase information, and the in-meter electricity purchase times is incremented by one. The first electricity purchase data includes the electricity purchase amount and the in-card electricity purchase times; Generate a power purchase flag bit and a card writing verification data item. The power purchase flag bit is used to indicate whether the IC card has been recharged, and the card writing verification data item is generated according to the updated in-meter remaining amount and the updated in-meter electricity purchase times; Write the second electricity purchase data back to the IC card. The second electricity purchase data includes the power purchase flag bit, the updated in-meter remaining amount, and the card writing verification data item.

[0013] In a possible design, when the scoring value is greater than or equal to the second threshold and less than the first threshold, the performing the card writing verification operation according to the verification strategy includes: Read the electricity purchase information from the IC card; Generate a second verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card writing verification data item; Repeat the second comparison operation for the second preset number of times; When there is one time that meets the condition of correctly reading the electricity purchase information in the second comparison operation, determine that the second electricity purchase data is correctly written to the IC card; Wherein, the second comparison operation includes: comparing whether the card writing verification data item is consistent with the second verification data item; When the card writing verification data item is consistent with the second verification data item, determine that the electricity purchase information is correctly read; When the card writing verification data item is inconsistent with the second verification data item, separately read the card writing verification data item from the IC card again, and repeat the comparison for the fourth preset number of times to determine whether the card writing verification data item is consistent with the second verification data item; When all the comparisons for the fourth preset number of times are consistent, determine that the electricity purchase information is correctly read; When there is an inconsistency in the comparisons for the fourth preset number of times, determine that the second electricity purchase data is not correctly written to the IC card.

[0014] Through the method provided by the first aspect, when it is detected that an integrated circuit (IC) card is inserted into the card slot of the electricity meter, test data is obtained to facilitate knowing the contact situation between the IC card and the card slot according to the test data; according to the test data, a verification strategy is determined, so as to dynamically adjust the verification strategy according to the contact situation between the IC card and the contacts reflected by the test data, making the verification strategy adapt to the actual situation, which helps to improve the accuracy and speed of verification; the card reading verification operation can be performed according to the verification strategy, and the purpose of the card reading verification operation is to determine whether the electricity purchase information in the IC card is read. When the electricity purchase information in the IC card cannot be read or is read incorrectly, an alarm can be given in time or the electricity purchase process can be exited. After it is determined that the electricity purchase information is correctly read, subsequent electricity purchase operations can be performed, thus ensuring the success rate of electricity purchase. When the electricity purchase information is correctly read, according to the electricity purchase information, the first electricity purchase data is written to the electricity meter, and the second electricity purchase data is written to the IC card, thus completing the electricity purchase process, so as to solve the problems that there may be jitter during card insertion, abnormal contact between the card surface and the contacts in the card slot, and contamination of the IC card or the card slot during electricity purchase, resulting in abnormal reading and writing, and thus leading to the failure of electricity purchase, realizing accurate and reliable data reading and writing, and avoiding the situation of abnormal reading and writing leading to the failure of electricity purchase.

[0015] In a second aspect, the present application provides a card reading and writing device, including: a module for executing the method in the first aspect and any possible design of the first aspect.

[0016] For the device provided in the above second aspect and each possible design of the second aspect, the beneficial effects can refer to the beneficial effects brought by the above first aspect and each possible implementation manner of the first aspect, which will not be elaborated here.

[0017] In a third aspect, the present application provides an electronic device, including: a first processor; The first processor is used to execute the computer-executable program or instruction in the memory, so that the electronic device executes the method in the first aspect and any possible design of the first aspect.

[0018] In a fourth aspect, the present application provides an electronic device, including: a memory and a second processor; the memory is used to store program instructions; the second processor is used to call the program instructions in the memory so that the electronic device executes the method in the first aspect and any possible design of the first aspect.

[0019] In a fifth aspect, the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the electronic device is enabled to execute the method in the first aspect and any possible design of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 It is a schematic flowchart of a card reading and writing method provided by an embodiment of the present application.

[0021] Figure 2 It is a schematic flowchart of a card reading and writing method provided by an embodiment of the present application.

[0022] Figure 3 It is a schematic flowchart of a method for determining a verification strategy provided by an embodiment of the present application.

[0023] Figure 4 It is a schematic flowchart of a method for determining a verification strategy provided by an embodiment of the present application.

[0024] Figure 5 It is a schematic flowchart of a method for performing a card reading verification operation provided by an embodiment of the present application.

[0025] Figure 6 It is a schematic flowchart of a method for writing data provided by an embodiment of the present application.

[0026] Figure 7 It is a schematic flowchart of a method for performing a card writing verification operation provided by an embodiment of the present application.

[0027] Figure 8 Schematic structural diagram of a card reading and writing device provided by an embodiment of the present application.

[0028] Figure 9 Schematic structural diagram of an electronic device provided by an embodiment of the present application.

[0029] Figure 10 Schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners

[0030] In the present application, "at least one" means one or more, and "a plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may indicate: A exists alone, A and B exist simultaneously, and B exists alone, where A and B may be singular or plural. The character " / " generally represents an "or" relationship between the associated objects before and after. "At least one (item)" or its similar expression refers to any combination of these items, including any combination of single item (item) or plural items (items). For example, at least one (item) of a alone, b alone, or c alone may represent: a alone, b alone, c alone, the combination of a and b, the combination of a and c, the combination of b and c, or the combination of a, b, and c, where a, b, and c may be single or multiple. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.

[0031] The orientation or positional relationship indicated by terms such as "center", "longitudinal", "transverse", "upper", "lower", "left", "right", "front", "rear", etc. is based on the orientation or positional relationship shown in the drawings, and is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation to the present application.

[0032] The terms "connected" and "coupled" should be understood in a broad sense. For example, the "connection" or "coupling" of a circuit structure may refer not only to a physical connection, but also to an electrical connection or a signal connection. For example, it may be directly connected, that is, a physical connection, or indirectly connected through at least one intermediate element, as long as the circuit is connected. It may also be the internal connection of two elements; the signal connection may refer not only to the signal connection through a circuit, but also to the signal connection through a media medium. For example, radio waves. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific situations.

[0033] Exemplarily, the present application provides a method, apparatus, electronic device, computer-readable storage medium, and computer program product for reading and writing cards. Before officially purchasing electricity, test data reflecting the contact situation between the IC card and the card slot is obtained, and a verification strategy is determined based on the test data. Then, according to the verification strategy, a card reading verification operation is performed. When the electricity purchase information is correctly read, the electricity purchase is carried out, thereby achieving accurate and reliable data reading and writing and avoiding the situation of abnormal reading and writing resulting in electricity purchase failure.

[0034] Among them, the method for reading and writing cards can be executed by an electronic device, or can be executed by a card reading and writing device in the electronic device. The card reading and writing device can be implemented by a combination of software and / or hardware. For example, the card reading and writing device can be an application (APP), a web page, a public account, etc. Or, the card reading and writing device can be a control chip in an electric energy meter.

[0035] Among them, the electronic device can be an electric energy meter, a server, a desktop computer, a mobile phone, a tablet computer, a laptop computer, a wearable device, a vehicle-mounted device, or an augmented reality (AR) / virtual reality (VR) device, etc. For the sake of simplicity of description, the embodiments of the present application are described by taking the execution by the card reading and writing device as an example.

[0036] Next, in combination with Figures 1 to 7 , the method for reading and writing cards provided by the embodiments of the present application will be described.

[0037] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of a method for reading and writing cards provided by an embodiment of the present application. As Figure 1 shown, the method includes: S101. When the card reading and writing device detects that the integrated circuit (IC) card is inserted into the card slot of the electric energy meter, obtain test data.

[0038] Among them, the test data is used to indicate the contact situation between the IC card and the card slot.

[0039] In some examples, the test data includes voltage volatility, contact impedance, and bit error rate; the voltage volatility is used to indicate the voltage fluctuation situation of the contacts in the card slot when contacting the IC card; the contact impedance is used to indicate the impedance of the contacts when contacting the IC card; the bit error rate is used to indicate the data transmission quality of the communication link between the contacts and the IC card.

[0040] Among them, voltage sensors can be set in the card slot to collect the contact voltages in the card slot in real time. The card reading and writing device obtains multiple contact voltages from the voltage sensors and calculates the voltage volatility according to the multiple contact voltages.

[0041] Specifically, the card reading and writing device can calculate the voltage volatility through the following formula (1).

[0042] Formula (1); Wherein, is the voltage volatility, is the peak-to-peak value of the contact voltage fluctuation, is the average contact voltage.

[0043] Wherein, the peak-to-peak value of the contact voltage fluctuation is the voltage with the largest value among multiple contact voltages, and the average contact voltage is the average value of multiple contact voltages.

[0044] In some examples, the card reading and writing device can collect the contact voltage 10 times to obtain 10 contact voltages, thereby improving the accuracy of the voltage volatility of the calculated contact impedance.

[0045] Based on this, the card reading and writing device can know the contact stability between the IC card and the card slot according to the voltage volatility. If the voltage volatility is greater, it indicates that the contact stability is worse.

[0046] Wherein, the contact impedance between the card slot and the IC card can be detected by setting a four-wire impedance detection circuit in the electric energy meter to separate the paths of current injection and voltage measurement.

[0047] As a feasible implementation method, the card reading and writing device can obtain the voltage difference between multiple current contacts from the four-wire impedance detection circuit and calculate the contact impedance according to the voltage difference between multiple current contacts.

[0048] As another feasible method, the four-wire impedance detection circuit can directly calculate the contact impedance according to the voltage difference between multiple current contacts. The card reading and writing device can obtain the contact impedance from the four-wire impedance detection circuit.

[0049] Wherein, the card reading and writing device or the four-wire impedance detection circuit can calculate the contact impedance through the following formula (2).

[0050] Formula (2); Wherein, is the contact impedance, is the output of the constant current source, is the voltage difference between current contacts.

[0051] In some examples, the card reading and writing device or the four-wire impedance detection circuit can collect the voltage difference between current contacts 10 times to obtain 10 voltage differences between current contacts and calculate the impedance, thereby improving the accuracy of the calculated contact impedance.

[0052] Based on this, the card reader / writer device can learn about the oxidation or contamination of the contacts in the card slot according to the contact impedance. The greater the contact impedance, the more serious the oxidation or contamination of the contacts in the card slot.

[0053] Among them, before reading and writing the IC card, the card reader / writer device can send test data packets to count the transmission error ratio of the test data packets and obtain the bit error rate.

[0054] Among them, the test data packet can be 3-byte, 24-bit data, such as 0xAA, 0x55.

[0055] Among them, the card reader / writer device can calculate the bit error rate through the following formula three.

[0056] Formula three; Among them, is the bit error rate, is the total number of transmitted bits in the test data packet, is the number of error bits in the total transmitted bits.

[0057] Based on this, the card reader / writer device learns about the data transmission quality of the communication link between the contacts and the IC card through the bit error rate. The higher the bit error rate, the worse the data transmission quality.

[0058] S102. The card reader / writer device determines the verification strategy according to the test data.

[0059] The card reader / writer device can learn about the contact situation between the IC card and the card slot according to the test data. Thus, different verification strategies can be determined based on the contact situation between the IC card and the card slot to adapt to different contact situations between the IC card and the card slot.

[0060] In some examples, the card reader / writer device can determine different verification strategies from two dimensions of the number of verifications and the verification mode based on the contact situation between the IC card and the card slot. For example, when the card slot is severely contaminated or aged, the contact situation between the IC card and the card slot is poor. Then the card reader / writer device can perform multiple verifications, and the verification mode is to verify all data, so as to ensure the accuracy of verification. When the card slot is slightly oxidized or there is environmental interference, the contact situation between the IC card and the card slot is better than that in the case of severe contamination or aging. Then the card reader / writer device can reduce the number of verifications and adopt the standard verification method to perform verification according to the existing verification method. When the contacts of the card slot are clean and the IC card is a new card, the card reader / writer device can perform 1 verification and can adopt the fast verification mode to verify less data, so as to improve the verification speed.

[0061] Based on this, the card reading and writing device can determine different verification strategies according to the test data, and dynamically adjust the verification strategy according to the contact situation between the IC card and the contacts reflected by the test data, so that the verification strategy adapts to the actual situation, which helps to improve the accuracy and speed of verification.

[0062] S103. The card reading and writing device performs a card reading verification operation according to the verification strategy.

[0063] Among them, the card reading verification operation is used to determine whether the electricity purchase information in the IC card is correctly read.

[0064] After determining the verification strategy, the card reading and writing device can perform a card reading verification operation according to the verification strategy. The purpose of the card reading verification operation is to determine whether the electricity purchase information in the IC card is read. When the electricity purchase information in the IC card cannot be read or is read incorrectly, the card reading and writing device can alarm in time or exit the electricity purchase process. After correctly reading the electricity purchase information, the card reading and writing device can perform subsequent electricity purchase operations to ensure the success rate of electricity purchase.

[0065] S104. When the card reading and writing device correctly reads the electricity purchase information, it writes the first electricity purchase data to the electricity meter and the second electricity purchase data to the IC card according to the electricity purchase information.

[0066] Among them, the electricity purchase information may include: user status, in-card local number, electricity purchase amount, in-card electricity purchase times, and read (write) card verification data items. The electricity purchase information can be 15-byte data. Among them, the user status can be 1 byte, the in-card local number can be 6 bytes, the electricity purchase amount can be 4 bytes, the in-card electricity purchase times can be 2 bytes, and the read (write) card verification data item can be 2 bytes.

[0067] In some examples, the electricity purchase information further includes an electricity purchase flag bit, and the electricity purchase flag bit can be 1 byte.

[0068] When the electricity purchase information is correctly read, the card reading and writing device can write the first electricity purchase data to the electricity meter according to the electricity purchase information, thus completing the electricity purchase. The first electricity purchase data is, for example, the electricity purchase times, the electricity purchase amount, etc. After completing the electricity purchase, the card reading and writing device also needs to write the second electricity purchase data to the IC card to ensure that the IC card has been used and cannot be used again until the next recharge.

[0069] In the embodiment of the present application, when the card reader / writer device detects that an integrated circuit (IC) card is inserted into the card slot of the electricity meter, it acquires test data to know the contact situation between the IC card and the card slot according to the test data. The card reader / writer device determines a verification strategy based on the test data, and thus dynamically adjusts the verification strategy according to the contact situation between the IC card and the contacts reflected by the test data, so that the verification strategy adapts to the actual situation, which helps to improve the accuracy and speed of verification. The card reader / writer device can perform a card reading verification operation according to the verification strategy. The purpose of the card reading verification operation is to determine whether the electricity purchase information in the IC card is read. When the electricity purchase information in the IC card cannot be read or is read incorrectly, an alarm can be given in time or the electricity purchase process can be exited. After it is determined that the electricity purchase information is correctly read, the card reader / writer device can perform subsequent electricity purchase operations, thus ensuring the success rate of electricity purchase. When the card reader / writer device correctly reads the electricity purchase information, it writes the first electricity purchase data into the electricity meter and the second electricity purchase data into the IC card according to the electricity purchase information, thereby completing the electricity purchase process, so as to solve the problems that there may be jitter during card insertion, abnormal contact between the card surface and the contacts in the card slot, and contamination of the IC card or the card slot during electricity purchase, resulting in abnormal reading and writing, and thus electricity purchase failure, and realize accurate and reliable data reading and writing, and avoid the situation of electricity purchase failure caused by abnormal reading and writing.

[0070] Based on the above exemplary description, after S104, as Figure 2 shown, the card reader / writer device can also perform a card writing verification operation.

[0071] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a card reader / writer method provided by an embodiment of the present application. As Figure 2 shown, after S104, the method further includes: S105. Perform a card writing verification operation according to the verification strategy.

[0072] Among them, the card writing verification operation is used to determine whether the second electricity purchase data is correctly written into the IC card.

[0073] After writing the second electricity purchase data into the IC card, the card reader / writer device can use the verification strategy determined in S102 and perform the card writing verification operation again to determine whether the second electricity purchase data is correctly written into the IC card, ensure the accuracy of the writing operation, thereby improving the security of electricity purchase, and avoiding abnormal situations caused by writing mistakes.

[0074] Based on the above exemplary description, the card reader / writer device can determine the verification strategy according to the test data in the following Figure 3 shown manner.

[0075] Please refer to Figure 3 , Figure 3Schematic diagram of a method for determining a verification strategy provided by an embodiment of the present application. As Figure 3 shown, the method includes: S201. The card reader / writer device normalizes the voltage volatility, contact impedance, and bit error rate respectively according to a preset parameter set to obtain a volatility parameter, an impedance parameter, and a bit error rate parameter.

[0076] Among them, the preset parameter set includes: the minimum value of the voltage volatility, the maximum value of the voltage volatility, the maximum value of the contact impedance, the minimum value of the contact impedance, and the bit error rate threshold.

[0077] Among them, the card reader / writer device can normalize the voltage volatility through the following formula four.

[0078] Formula four; Among them, is the volatility parameter, is the minimum value of the voltage volatility, is the maximum value of the voltage volatility.

[0079] Among them, the card reader / writer device can normalize the contact impedance through the following formula five.

[0080] Formula five; Among them, is the impedance parameter, is the minimum value of the contact impedance, is the maximum value of the contact impedance.

[0081] Among them, the card reader / writer device can normalize the bit error rate through the following formula six.

[0082] Formula six; Among them, is the bit error rate parameter, is the bit error rate threshold, is the maximum value operation.

[0083] In some examples, the values of the parameters in the preset parameter set can be as shown in Table 1 below: Table 1

[0084] Based on this, the card reader / writer device can obtain the volatility parameter, the impedance parameter, and the bit error rate parameter according to the results of the normalization process of each test data, so as to process different data into data with a unified dimension, thereby improving the accuracy of determining the verification strategy according to the test data.

[0085] S202. The card reader / writer device obtains a score value based on a first preset weight, a second preset weight, a third preset weight, a volatility parameter, an impedance parameter, and an error rate parameter.

[0086] In some examples, the card reader / writer device may calculate the score value according to Formula VII as follows.

[0087] Formula VII; where, is the score value, is the first preset weight, is the second preset weight, is the third preset weight.

[0088] Among them, the first preset weight can be 0.4, the second preset weight can be 0.3, and the third preset weight is 0.3.

[0089] Based on this, the card reader / writer device can score from three aspects of the volatility parameter, the impedance parameter, and the error rate parameter to obtain a score value. The size of the score value can reflect the contact situation between the IC card and the card slot. For example, the larger the score value, the better the contact between the IC card and the card slot, and in this case, the scenario is more likely to be a new card or a scenario with clean contacts; when the score value is medium, the contact situation between the IC card and the card slot is also medium, and in this case, the scenario may be a scenario of slight oxidation or environmental interference; the smaller the score value, the worse the contact between the IC card and the card slot, and in this case, the scenario may be a scenario of severe pollution or aging. In this way, the card reader / writer device can accurately know the contact situation between the IC card and the card slot according to the score value, thereby improving the accuracy of determining the verification strategy. Further, it helps to improve the speed and accuracy of verification.

[0090] S203. The card reader / writer device determines a verification strategy according to the score value.

[0091] Among them, the verification strategy includes the number of verifications and the verification mode.

[0092] The card reader / writer device can determine different verification strategies based on the score value from two dimensions of the number of verifications and the verification mode. For example, when the score value is higher than a threshold, the card reader / writer device can perform multiple verifications, and the verification mode adopts the method of verifying all data, so as to ensure the accuracy of verification. When the score value is lower than a threshold and higher than another threshold, the card reader / writer device can reduce the number of verifications and adopt the standard verification method to perform verification according to the existing verification method. When the score value is lower than another threshold, the card reader / writer device can perform 1 verification, and can adopt the fast verification mode to verify less data, so as to improve the verification speed.

[0093] Based on the above exemplary description, the card reader / writer device can pass the following Figure 4In the manner shown, determine the verification strategy according to the scoring value.

[0094] Please refer to Figure 4 , Figure 4 which is a schematic flow chart of a method for determining a verification strategy provided by an embodiment of the present application. As Figure 4 shown, the method includes: S301. The card reader / writer device determines the relationship between the scoring value and the first threshold and the second threshold.

[0095] When the scoring value is greater than or equal to the first threshold, the card reader / writer device executes S302; when the scoring value is greater than or equal to the second threshold and less than the first threshold, the card reader / writer device executes S303; when the scoring value is less than the second threshold, the card reader / writer device executes S304.

[0096] Among them, the first threshold can be 0.8, and the second threshold can be 0.5.

[0097] S302. The card reader / writer device determines that the verification times is the first preset number of times, and the verification mode is to only verify the target verification data item in the power purchase information.

[0098] Among them, when performing the card reading verification operation, the target verification data item is the card reading verification data item in the power purchase information; when performing the card writing verification operation, the target verification data item is the card writing verification data item in the power purchase information.

[0099] Specifically, after the card reader / writer device reads the power purchase information from the IC card, the card reader / writer device can obtain the target verification data item in the power purchase information, generate a first data item according to the preset verification algorithm, and compare the first data item with the target verification data item for the first preset number of times. If there is a comparison result that the first data item is consistent with the target verification data item once, it is determined that the power purchase information is correctly read or the second power purchase data is correctly written to the IC card. If the first preset number of times of comparison are all inconsistent, then the card reader / writer device can inform the user that the card reading fails, or the writing fails, so that the user can know the card reading or writing situation and handle the exception in time.

[0100] S303. The card reader / writer device determines that the verification times is the second preset number of times, and the verification mode is to first verify the target verification data item in the power purchase information, and when the verification of the target verification data item in the power purchase information fails, separately read the target verification data item for repeated verification.

[0101] Specifically, after the card reader / writer device reads the power purchase information from the IC card, the card reader / writer device can obtain the target verification data item in the power purchase information, generate the first data item according to the preset verification algorithm, and compare the first data item with the target verification data item for a second preset number of times. If there is a comparison result that the first data item is consistent with the target verification data item once, it is determined that the power purchase information is correctly read or the second power purchase data is correctly written to the IC card. If the comparisons for the second preset number of times are all inconsistent, then the card reader / writer device can separately read the target verification data item for repeated verification. If there is a consistent comparison once, it is determined that the power purchase information is correctly read or the second power purchase data is correctly written to the IC card. If the comparisons are all inconsistent, the user is informed that the card reading fails, or the writing fails, so that the user can know the card reading or writing situation and handle the abnormality in time.

[0102] S304. The card reader / writer device determines that the verification times is the third preset number of times, and the verification mode is to sequentially verify all the data in the power purchase information.

[0103] Specifically, the card reader / writer device can sequentially read each data item according to each data item in the power purchase information. When the first data item is read, the first data item is compared for a third preset number of times. If the comparisons for the third preset number of times are all consistent, the next data item is continued to be read until all the data items are verified. If all the data items are consistent, it is determined that the power purchase information is correctly read or the second power purchase data is correctly written to the IC card. If there is an inconsistent data item, the user is informed that the card reading fails, or the writing fails, so that the user can know the card reading or writing situation and handle the abnormality in time.

[0104] Among them, the first preset number of times is less than the second preset number of times, and the second preset number of times is less than the third preset number of times.

[0105] Among them, the first preset number of times can be 1 time. The second preset number of times can be 2 times, and the third preset number of times can be 4 times.

[0106] Based on this, the card reader / writer device can dynamically adjust the verification strategy according to the different scoring values, making the verification strategy more suitable for the current contact situation between the IC card and the card slot, and improving the verification speed and accuracy.

[0107] Based on the above exemplary description, when the scoring value is greater than or equal to the second threshold and less than the first threshold, the card reader / writer device can Figure 5 perform the card reading verification operation according to the verification strategy in the following

[0108] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of a method for performing a card reading verification operation provided in an embodiment of the present application. As Figure 5As shown, the method includes: S401. The card reader / writer device reads the electricity purchase information from the IC card.

[0109] S402. The card reader / writer device generates a first verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card reading verification data item.

[0110] Among them, the preset verification algorithm should be consistent with the card reading verification data item generated in the electricity purchase information of the IC card.

[0111] S403. The card reader / writer device repeats the first comparison operation for a second preset number of times.

[0112] Among them, the first comparison operation includes: comparing whether the card reading verification data item is consistent with the first verification data item; When the card reading verification data item is consistent with the first verification data item, it is determined that the electricity purchase information is correctly read; When the card reading verification data item is inconsistent with the first verification data item, the card reading verification data item is separately read from the IC card again, and the comparison of whether the card reading verification data item is consistent with the first verification data item is repeated for a fourth preset number of times; When the comparison is consistent for the fourth preset number of times, it is determined that the electricity purchase information is correctly read; When there is an inconsistency in the comparison for the fourth preset number of times, it is determined that the electricity purchase information is not correctly read.

[0113] Among them, the fourth preset number of times can be 4 times. When the card reading verification data item is inconsistent with the first verification data item, each time the card reading verification data item is separately read from the IC card and compared with the first verification data item and is consistent, the register count1 is incremented by 1. If count1 = 4, it is determined that the comparison is consistent for the fourth preset number of times.

[0114] S404. The card reader / writer device determines whether there is a time when the condition of correctly reading the electricity purchase information in the comparison operation is met.

[0115] When there is a time when the condition of correctly reading the electricity purchase information in the comparison operation is met, the card reader / writer device executes S405; when there is no time when the condition of correctly reading the electricity purchase information in the comparison operation is met, the card reader / writer device executes S406.

[0116] S405. The card reader / writer device determines that the electricity purchase information is correctly read.

[0117] S406. The card reader / writer device determines that the card reading fails.

[0118] When the card reading fails, the card reader / writer device can prompt the user that the card reading fails in the form of alarm or outputting text, so that the user can know the card reading situation and improve the user experience.

[0119] Based on the above exemplary description, the card reading and writing device can Figure 6 write the first power purchase data to the electricity meter and the second power purchase data to the IC card according to the power purchase information in the following

[0120] Please refer to Figure 6 , Figure 6 which is a schematic flowchart of a method for writing data provided by an embodiment of the present application. As Figure 6 shown, the method includes: S501. The card reading and writing device determines whether the in-card local number in the power purchase information is the same as the in-meter local number in the electricity meter, and the user status in the power purchase information is the normal power consumption status, and the in-card power purchase times in the power purchase information is equal to the in-meter power purchase times in the electricity meter plus one.

[0121] When it is determined that the in-card local number in the power purchase information is the same as the in-meter local number in the electricity meter, and the user status in the power purchase information is the normal power consumption status, and the in-card power purchase times in the power purchase information is equal to the in-meter power purchase times in the electricity meter plus one, the card reading and writing device executes S502; when it is determined that the in-card local number in the power purchase information is not the same as the in-meter local number in the electricity meter, or the user status in the power purchase information is not the normal power consumption status, or the in-card power purchase times in the power purchase information is not equal to the in-meter power purchase times in the electricity meter plus one, the card reading and writing device executes S505.

[0122] Based on this, the card reading and writing device writes the first power purchase data to the electricity meter only after determining that the IC card and the electricity meter match, which can ensure the security of power purchase.

[0123] S502. The card reading and writing device writes the first power purchase data to the electricity meter, so that the in-meter remaining amount in the electricity meter is updated to the sum of the in-meter remaining amount and the power purchase amount in the power purchase information, and the in-meter power purchase times is incremented by one.

[0124] Among them, the first power purchase data includes the power purchase amount and the in-card power purchase times.

[0125] S503. The card reading and writing device generates a power purchase flag bit and a write card verification data item.

[0126] Among them, the power purchase flag bit is used to indicate whether the IC card has been recharged.

[0127] Among them, the write card verification data item is generated according to the updated in-meter remaining amount and the updated in-meter power purchase times.

[0128] S504. The card reading and writing device writes the second power purchase data back to the IC card.

[0129] Among them, the second electricity purchase data includes an electricity purchase flag bit, the remaining amount in the table after update, and a card writing verification data item.

[0130] Among them, the electricity purchase flag bit can be 1 byte, the remaining amount in the table after update can be 4 bytes, and the card writing verification data item can be 2 bytes.

[0131] S505. The card reading and writing device determines that the electricity purchase fails.

[0132] Based on the above exemplary description, when the scoring value is greater than or equal to the second threshold and less than the first threshold, the card reading and writing device can perform a card writing verification operation according to the verification policy in the following Figure 7 shown manner.

[0133] Please refer to Figure 7 , Figure 7 , which is a schematic flowchart of a method for performing a card writing verification operation provided by an embodiment of the present application. As Figure 7 shown, the method includes: S601. The card reading and writing device reads the electricity purchase information from the IC card.

[0134] S602. The card reading and writing device generates a second verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card writing verification data item.

[0135] S603. The card reading and writing device repeatedly performs the second comparison operation for a second preset number of times.

[0136] Among them, the second comparison operation includes: comparing whether the card writing verification data item is consistent with the second verification data item; When the card writing verification data item is consistent with the second verification data item, it is determined that the electricity purchase information is correctly read; When the card writing verification data item is inconsistent with the second verification data item, the card writing verification data item is separately read from the IC card again, and the comparison of whether the card writing verification data item is consistent with the second verification data item is repeated for a fourth preset number of times; When the comparison is consistent for the fourth preset number of times, it is determined that the electricity purchase information is correctly read; When there is an inconsistency in the comparison for the fourth preset number of times, it is determined that the second electricity purchase data is not correctly written into the IC card.

[0137] Among them, the fourth preset number can be 4 times. When the card writing verification data item is inconsistent with the second verification data item, each time the card writing verification data item is separately read from the IC card and is consistent with the second verification data item, the register count2 is incremented by 1. If count2 = 4, it is determined that the comparison is consistent for the fourth preset number of times.

[0138] S604. The card reader / writer device determines whether there is a condition that the purchase electricity information is correctly read in the second comparison operation once.

[0139] When there is a condition that the purchase electricity information is correctly read in the second comparison operation once, the card reader / writer device executes S605; when there is no condition that the purchase electricity information is correctly read in the second comparison operation once, the card reader / writer device executes S606.

[0140] S605. The card reader / writer device determines that the second purchase electricity data is correctly written to the IC card.

[0141] S606. The card reader / writer device determines that the write fails.

[0142] When the write fails, the card reader / writer device can prompt the user that the card writing fails in the form of alarm or outputting text, so that the user can know the card reading situation and improve the user experience.

[0143] Based on the above exemplary description, if the lowest read / write speed of the currently most commonly used I2C memory card is 100 kbps, for the operation of reading one byte, according to the I2C basic protocol process, 20 bit operations are required, and the reading time of one byte data during card reading is about 200 us. If the purchase electricity information is 15-byte data, according to the above method, the longest time for executing the card reading verification operation is about: 15 bytes × 4 × 200 us = 12 ms, and the shortest time is about: 15 bytes × 200 us = 3 ms.

[0144] When the card reader / writer device writes the second purchase electricity data to the IC card, if the second purchase electricity data is 7 bytes, the longest time for writing the card is about: (7 bytes + 2 bytes × 4) × 2 × 200 us = 6 ms, and the shortest time is about: (7 bytes + 2 bytes) × 200 us = 1.4 ms.

[0145] In summary, the maximum continuous time for the user to purchase electricity is about 12 ms + 6 ms = 18 ms. Adding the internal data processing time of the single-chip microcomputer of the electric energy meter, the longest time is about 22 ms. On the basis of ensuring the accuracy and safety of electricity purchase, the electricity purchase speed is greatly improved.

[0146] Figure 8 The following is a schematic structural diagram of a card reader / writer device provided by an embodiment of the present application. As Figure 8 shown, the device includes: an acquisition module 101, a determination module 102, a verification module 103, and a purchase electricity module 104.

[0147] The acquisition module 101 is configured to obtain test data when detecting that an integrated circuit (IC) card is inserted into the card slot of the electric energy meter, and the test data is used to indicate the contact situation between the IC card and the card slot; Determination module 102, configured to determine a verification policy according to test data; First verification module 103, configured to perform a card reading verification operation according to the verification policy, where the card reading verification operation is used to determine whether the electricity purchase information in the IC card is correctly read; Electricity purchase module 104, configured to, when the electricity purchase information is correctly read, write first electricity purchase data to the electricity meter and write second electricity purchase data to the IC card according to the electricity purchase information.

[0148] In some examples, the device includes: a second verification module.

[0149] The second verification module is configured to, after writing the first electricity purchase data to the electricity meter and writing the second electricity purchase data to the IC card according to the electricity purchase information, perform a card writing verification operation according to the verification policy, where the card writing verification operation is used to determine whether the second electricity purchase data is correctly written to the IC card.

[0150] In some examples, the test data includes voltage volatility, contact impedance, and bit error rate; the voltage volatility is used to indicate the voltage fluctuation condition of the contacts of the card slot when contacting the IC card; the contact impedance is used to indicate the impedance of the contacts when contacting the IC card; the bit error rate is used to indicate the data transmission quality of the communication link between the contacts and the IC card.

[0151] In some examples, the determination module 102 is specifically configured to: Perform normalization processing on the voltage volatility, contact impedance, and bit error rate respectively according to a preset parameter set to obtain a volatility parameter, an impedance parameter, and a bit error rate parameter; Obtain a score value according to a first preset weight, a second preset weight, a third preset weight, the volatility parameter, the impedance parameter, and the bit error rate parameter; Determine a verification policy according to the score value, where the verification policy includes the number of verification times and the verification mode.

[0152] In some examples, the determination module 102 is specifically configured to: When the score value is greater than or equal to a first threshold, determine that the number of verification times is a first preset number, and the verification mode is to only verify the target verification data items in the electricity purchase information; When the score value is greater than or equal to a second threshold and less than the first threshold, determine that the number of verification times is a second preset number, and the verification mode is to first verify the target verification data items in the electricity purchase information, and when the verification of the target verification data items in the electricity purchase information fails, separately read the target verification data items for repeated verification; When the score value is less than the second threshold, determine that the number of verification times is a third preset number, and the verification mode is to sequentially verify all data in the electricity purchase information; Wherein, the first preset number of times is less than the second preset number of times, and the second preset number of times is less than the third preset number of times; when performing the card reading verification operation, the target verification data item is the card reading verification data item in the power purchase information; when performing the card writing verification operation, the target verification data item is the card writing verification data item in the power purchase information.

[0153] In some examples, the first verification module 103 is specifically configured to read the power purchase information from the IC card when the score value is greater than or equal to the second threshold and less than the first threshold; Generate a first verification data item according to a preset verification algorithm and other data in the power purchase information except the card reading verification data item; Repeat the first comparison operation for the second preset number of times; When there is one time that meets the condition of correctly reading the power purchase information in the comparison operation, it is determined that the power purchase information is correctly read; Wherein, the first comparison operation includes: comparing whether the card reading verification data item is consistent with the first verification data item; When the card reading verification data item is consistent with the first verification data item, it is determined that the power purchase information is correctly read; When the card reading verification data item is inconsistent with the first verification data item, the card reading verification data item is separately read again from the IC card, and the comparison of whether the card reading verification data item is consistent with the first verification data item is repeated for the fourth preset number of times; When all the comparisons for the fourth preset number of times are consistent, it is determined that the power purchase information is correctly read; When there is an inconsistency in the comparisons for the fourth preset number of times, it is determined that the power purchase information is not correctly read.

[0154] In some examples, the power purchase module 104 is specifically configured to write the first power purchase data into the electric energy meter when it is determined that the in-card station number in the power purchase information is consistent with the in-meter station number in the electric energy meter, and the user status in the power purchase information is the normal power consumption status, and the in-card power purchase times in the power purchase information is equal to the in-meter power purchase times in the electric energy meter plus one, so that the in-meter remaining amount in the electric energy meter is updated to the sum of the in-meter remaining amount and the power purchase amount in the power purchase information, and the in-meter power purchase times is incremented by one. The first power purchase data includes the power purchase amount and the in-card power purchase times; Generate a power purchase flag bit and a card writing verification data item. The power purchase flag bit is used to indicate whether the IC card has been recharged, and the card writing verification data item is generated according to the updated in-meter remaining amount and the updated in-meter power purchase times; Write the second power purchase data into the IC card in reverse. The second power purchase data includes the power purchase flag bit, the updated in-meter remaining amount, and the card writing verification data item.

[0155] In some examples, the second verification module is specifically configured to read the electricity purchase information from the IC card when the scoring value is greater than or equal to the second threshold and less than the first threshold; generate a second verification data item according to a preset verification algorithm and other data in the electricity purchase information except the write card verification data item; repeat the second comparison operation for a second preset number of times; when there is one time that meets the condition of correctly reading the electricity purchase information in the second comparison operation, determine that the second electricity purchase data is correctly written to the IC card; wherein, the second comparison operation includes: comparing whether the write card verification data item is consistent with the second verification data item; when the write card verification data item is consistent with the second verification data item, determine that the electricity purchase information is correctly read; when the write card verification data item is inconsistent with the second verification data item, separately re-read the write card verification data item from the IC card, and repeat the comparison for a fourth preset number of times to determine whether the write card verification data item is consistent with the second verification data item; when the comparisons for the fourth preset number of times are all consistent, determine that the electricity purchase information is correctly read; when there is an inconsistency in the comparisons for the fourth preset number of times, determine that the second electricity purchase data is not correctly written to the IC card.

[0156] Figure 9 The figure is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 9 shown, the electronic device may include: a first processor 201 and a memory 202. A computer program is stored in the memory 202. When the first processor 201 executes the computer program, the read and write card method shown in the embodiment of the present application is implemented. Figures 1 to 7 shown.

[0157] Figure 10 The figure is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As Figure 10 shown, the electronic device may include: a second processor 301. When the second processor 301 executes the computer executable program or instruction in the memory to execute the computer program, the read and write card method shown in the embodiment of the present application is implemented. Figures 1 to 7 shown.

[0158] Another embodiment of the present application further provides a computer-readable storage medium. A computer program is stored on the computer-readable storage medium. When the computer program is executed by a processor, the read and write card method shown in the embodiment of the present application can be implemented. Figures 1 to 7 shown.

[0159] Another embodiment of the present application further provides a computer program product, including: execution instructions, the execution instructions are stored in a readable storage medium, at least one processor of the electronic device can read the execution instructions from the readable storage medium, and the at least one processor executes the execution instructions to enable the electronic device to implement the embodiments of the present application Figures 1 to 7 The read-write card method shown in

[0160] In several embodiments provided by the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed.

[0161] Those skilled in the art can understand that although some embodiments herein include certain features included in other embodiments, the combination of features of different embodiments means that it is within the scope of the present application and forms different embodiments. For example, in the claims, any one of the claimed embodiments can be used in any combination.

[0162] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for reading and writing cards, characterized in that, The method includes: When it is detected that an integrated circuit (IC) card is inserted into the card slot of the electricity meter, obtaining test data, where the test data is used to indicate the contact condition between the IC card and the card slot; Determining a verification strategy according to the test data; Performing a card reading verification operation according to the verification strategy, where the card reading verification operation is used to determine whether the electricity purchase information in the IC card is correctly read; When the electricity purchase information is correctly read, writing first electricity purchase data to the electricity meter and writing second electricity purchase data to the IC card according to the electricity purchase information.

2. The method according to claim 1, wherein After writing the first electricity purchase data to the electricity meter and writing the second electricity purchase data to the IC card according to the electricity purchase information, the method further includes: Performing a card writing verification operation according to the verification strategy, where the card writing verification operation is used to determine whether the second electricity purchase data is correctly written to the IC card.

3. The method according to claim 2, wherein The test data includes a voltage volatility rate, a contact impedance, and an error rate; the voltage volatility rate is used to indicate the voltage fluctuation condition of the contacts of the card slot when contacting the IC card; the contact impedance is used to indicate the impedance of the contacts when contacting the IC card; the error rate is used to indicate the data transmission quality of the communication link between the contacts and the IC card.

4. The method according to claim 3, characterized in that The determining a verification strategy according to the test data includes: Performing normalization processing on the voltage volatility rate, the contact impedance, and the error rate respectively according to a preset parameter set to obtain a volatility parameter, an impedance parameter, and an error rate parameter; Obtaining a score value according to a first preset weight, a second preset weight, a third preset weight, the volatility parameter, the impedance parameter, and the error rate parameter; Determining the verification strategy according to the score value, where the verification strategy includes the number of verification times and a verification mode.

5. The method according to claim 4, wherein The determining the verification strategy according to the score value includes: When the score value is greater than or equal to a first threshold, determining that the number of verification times is a first preset number, and the verification mode is to only verify the target verification data item in the electricity purchase information; When the score value is greater than or equal to a second threshold and less than the first threshold, determining that the number of verification times is a second preset number, and the verification mode is to first verify the target verification data item in the electricity purchase information, and when the verification of the target verification data item in the electricity purchase information fails, separately read the target verification data item for repeated verification; When the score value is less than the second threshold, determining that the number of verification times is a third preset number, and the verification mode is to sequentially verify all data in the electricity purchase information; Wherein, the first preset number is less than the second preset number, and the second preset number is less than the third preset number; when performing the card reading verification operation, the target verification data item is the card reading verification data item in the electricity purchase information; when performing the card writing verification operation, the target verification data item is the card writing verification data item in the electricity purchase information.

6. The method according to claim 5, wherein When the score value is greater than or equal to the second threshold and less than the first threshold, the performing a card reading verification operation according to the verification strategy includes: Read the electricity purchase information from the IC card; Generate a first verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card reading verification data item; Repeat the first comparison operation the second preset number of times; When there is one time that meets the condition of correctly reading the electricity purchase information in the comparison operation, determine that the electricity purchase information is correctly read; Wherein, the first comparison operation includes: comparing whether the card reading verification data item is consistent with the first verification data item; When the card reading verification data item is consistent with the first verification data item, determine that the electricity purchase information is correctly read; When the card reading verification data item is inconsistent with the first verification data item, separately read the card reading verification data item from the IC card again, and repeat the comparison of whether the card reading verification data item is consistent with the first verification data item the fourth preset number of times; When all the fourth preset number of times of comparisons are consistent, determine that the electricity purchase information is correctly read; When there is an inconsistency in the fourth preset number of times of comparisons, determine that the electricity purchase information is not correctly read.

7. The method according to claim 5, characterized in that When the score value is greater than or equal to the second threshold and less than the first threshold, according to the verification strategy, perform a card writing verification operation, including: Read the electricity purchase information from the IC card; Generate a second verification data item according to a preset verification algorithm and other data in the electricity purchase information except the card writing verification data item; Repeat the second comparison operation the second preset number of times; When there is one time that meets the condition of correctly reading the electricity purchase information in the second comparison operation, determine that the second electricity purchase data is correctly written to the IC card; Wherein, the second comparison operation includes: comparing whether the card writing verification data item is consistent with the second verification data item; When the card writing verification data item is consistent with the second verification data item, determine that the electricity purchase information is correctly read; When the card writing verification data item is inconsistent with the second verification data item, separately read the card writing verification data item from the IC card again, and repeat the comparison of whether the card writing verification data item is consistent with the second verification data item the fourth preset number of times; When all the fourth preset number of times of comparisons are consistent, determine that the electricity purchase information is correctly read; When there is an inconsistency in the fourth preset number of times of comparisons, determine that the second electricity purchase data is not correctly written to the IC card.

8. The method according to any one of claims 1 to 7, characterized in that The writing of the first electricity purchase data to the electricity meter and the second electricity purchase data to the IC card according to the electricity purchase information includes: When it is determined that the in-card local number in the electricity purchase information is consistent with the in-meter local number in the electricity meter, and the user status in the electricity purchase information is the normal electricity consumption status, and the in-card electricity purchase times in the electricity purchase information is equal to the in-meter electricity purchase times in the electricity meter plus one, write the first electricity purchase data to the electricity meter, so that the in-meter remaining amount in the electricity meter is updated to the sum of the in-meter remaining amount and the purchase amount in the electricity purchase information, and the in-meter electricity purchase times is incremented by one. The first electricity purchase data includes the purchase amount and the in-card electricity purchase times; Generate a power purchase flag bit and a card writing verification data item. The power purchase flag bit is used to indicate whether the IC card has been fully charged. The card writing verification data item is generated based on the updated remaining amount in the table and the updated power purchase times in the table. Write the second power purchase data back into the IC card. The second power purchase data includes the power purchase flag bit, the updated remaining amount in the table, and the card writing verification data item.

9. An electronic device, characterized in that, Comprising: A first processor; The first processor is configured to execute computer-executable programs or instructions in a memory, so that the electronic device executes the card reading and writing method according to any one of claims 1-8.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable programs or instructions, and the computer-executable programs or instructions are configured to execute the card reading and writing method according to any one of claims 1-8.