Accessory identification method and device and storage medium

Through magnetic detection components, magnetic components of accessories are identified, magnetic characterization data is generated and index tables are matched, which solves the problems of high hardware resource cost and information security of accessories identification, and realizes a low-cost and secure accessory identification method.

CN119067138APending Publication Date: 2024-12-03AAC ACOUSTIC TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411087321.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

The existing accessory identification method requires high hardware resources and is not conducive to ensuring the security of accessory information. In particular, the QR code identification method occupies a large resource and is easily stolen, and the NFC tag card reader consumes high power and costs high.

Method used

Use magnetic detection components to identify accessories, and generate magnetic characterization data by detecting magnetic components in the accessories, and match them with the preset index table to determine the accessory identification information to realize the hidden identification of accessories. Only the electronic device needs to install magnetic detection components. Install magnetic components with accessories.

Benefits of technology

Effectively save hardware resource costs, improve the security of accessories information, and realize the hidden way of accessories identification, avoiding the problems of excessive resource occupation and information theft.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067138A_ABST
    Figure CN119067138A_ABST
Patent Text Reader

Abstract

The invention provides an accessory identification method and device and a storage medium. The method comprises the steps that when it is detected that a target accessory is located at a preset target position of the electronic device, target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field intensity of a magnetic assembly in the target accessory; matching the target magnetic intensity representation data with a preset accessory index table; and determining the accessory identification information corresponding to the matched magnetic intensity representation data range as the identification information of the target accessory. Through the implementation of the scheme, the magnetic field intensity of the magnetic assembly in the target accessory is detected to obtain the magnetic intensity characterization data, the identification information of the target accessory can be obtained by looking up the table according to the magnetic intensity characterization data, the identification information of the accessory can be hidden, the information security of the accessory can be guaranteed, meanwhile, excessive detection devices are not needed, and the cost is reduced. The hardware occupied volume is reduced, and the hardware resource cost is saved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

[0001] The present application relates to the field of electronic technology, and in particular to an accessory identification method, device and storage medium. [Background technology]

[0002] In recent years, the functions of various electronic products have become increasingly rich, and the types of accessories / attachments produced to achieve various functions have also increased. In order to better adapt to the individual differences of different types of accessories, it is necessary to understand the relevant information of each accessory. In the relevant technology, the identification of accessory-related information usually adopts the method of adding a QR code or barcode to the accessory, and the electronic device reads the QR code or barcode information through a camera or a scanner to identify the accessory, or adding an NFC (RFID) tag to the accessory, and the electronic device installs an NFC (RFID) card reader to read the accessory information. The QR code recognition method requires the use of a camera or a scanner, which occupies a large amount of resources and has high requirements for system resources, and the QR code / barcode of the accessory is exposed and easily copied and misused; while the NFC (RFID) tag reading method requires a certain antenna size area for both the electronic device and the accessory, and the card reader on the electronic device side is more expensive, and the card reader consumes more power when it is turned on for a long time, and the user experience may be affected when the card reader is not turned on for a long time. [Summary of the invention]

[0003] The main purpose of this application is to provide an accessory identification method, device and storage medium, which can at least solve the problem that the hardware resource cost required for the accessory identification method in the related art is high or is not conducive to ensuring the security of accessory information.

[0004] To achieve the above-mentioned purpose, the first aspect of the present application provides an accessory identification method, which is applied to an electronic device, wherein the electronic device is provided with a magnetic intensity detection element, and the accessory identification includes: when a target accessory is detected to be located at a preset target position of the electronic device, generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory; wherein the magnetic intensity characterization data includes voltage data; matching the target magnetic intensity characterization data with a preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; and determining the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

[0005] According to a second aspect of the present application, there is provided an accessory identification device, which is applied to an electronic device, wherein the electronic device is provided with a magnetic intensity detection element, and the accessory identification device comprises: a generation module, which is used to generate target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory when the target accessory is detected to be located at a preset target position of the electronic device; wherein the magnetic intensity characterization data comprises voltage data; a matching module, which is used to match the target magnetic intensity characterization data with a preset accessory index table; wherein the accessory index table comprises a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; and a determination module, which is used to determine the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

[0006] The third aspect of the present application provides an electronic device, including: a memory and a processor, wherein the processor is used to execute a computer program stored in the memory, and when the processor executes the computer program, it implements the steps of the accessory identification method provided in the first aspect of the present application.

[0007] The fourth aspect of 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 steps of the accessory identification method provided in the first aspect of the present application are implemented.

[0008] As can be seen from the above, according to the accessory identification method, device and storage medium provided by the present application, when the target accessory is detected to be located at the preset target position of the electronic device, target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory; wherein the magnetic intensity characterization data includes voltage data; the target magnetic intensity characterization data is matched with the preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; the accessory identification information corresponding to the matched magnetic intensity characterization data range is determined as the identification information of the target accessory. Through the implementation of the present application, the magnetic field strength of the magnetic component in the accessory is detected to obtain the corresponding magnetic intensity characterization data, and then the identification information of the accessory can be obtained by looking up the table according to the magnetic intensity characterization data, so that the identification information of the accessory can be hidden, which is conducive to ensuring the security of the accessory information. At the same time, compared with the relevant technology, it does not require too many hardware resources, and only requires the electronic device to be equipped with a magnetic intensity detection element and the accessory to be equipped with a magnetic component, which effectively saves the cost of hardware resources.

Brief Description of the Drawings

[0009] 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, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0010] Figure 1 A schematic diagram of the basic flow of an accessory identification method provided in an embodiment of the present application;

[0011] Figure 2 A detailed flowchart of an accessory identification method provided in an embodiment of the present application;

[0012] Figure 3 A schematic diagram of a magnetic intensity detection principle provided in an embodiment of the present application;

[0013] Figure 4 A schematic diagram of a first type of accessory identification provided in an embodiment of the present application;

[0014] Figure 5 A schematic diagram of a second accessory identification provided in an embodiment of the present application;

[0015] Figure 6 A schematic diagram of a third type of accessory identification provided in an embodiment of the present application;

[0016] Figure 7 A schematic diagram of a module of an accessory identification device provided in one embodiment of the present application;

[0017] Figure 8 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application. [Specific implementation method]

[0018] In order to make the purpose, features, and advantages of the invention of this application more obvious and easy to understand, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this application.

[0019] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the embodiments of the present application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.

[0020] In order to solve the problem that the hardware resource cost required for the accessory identification method in the related art is high or not conducive to ensuring the security of accessory information, the first embodiment of the present application provides an accessory identification method, which is applied to an electronic device, and the electronic device is provided with a magnetic detection element. The magnetic detection element can be an integrated element of the electronic device itself, or an additional element installed during detection. The magnetic detection element can be a Hall sensor or other sensors with magnetic field strength detection function. This embodiment is described by taking a linear Hall sensor as an example. Figure 1 This is a basic flow chart of the accessory identification method provided in this embodiment. The accessory identification method includes steps 101 to 103:

[0021] Step 101: When it is detected that a target accessory is located at a preset target position of an electronic device, target magnetic intensity characterization data is generated based on a magnetic intensity detection element responding to the magnetic field intensity of a magnetic component in the target accessory.

[0022] Specifically, this embodiment performs accessory identification based on magnetic field strength detection, and a linear Hall sensor may be used for magnetic strength detection, such as Figure 2 The figure shows a schematic diagram of the structure of the magnetic intensity detection principle, in which when the position of the magnet 10 changes, the magnetic field strength detected by the Hall sensor 20 will also change, and the output magnetic intensity characterization data will also change accordingly. Therefore, magnetic components such as magnets can be set in different accessories, so that when different accessories are located at the set position of the electronic device, the distance between the magnetic components in different accessories and the linear Hall sensor is different, or the relative position with the linear Hall sensor is different, so that the linear Hall sensor can output different magnetic intensity characterization data, and the magnetic intensity characterization data can be voltage data or current data, etc. This embodiment is explained by taking voltage data as an example, for example Figure 3 In the accessory identification diagram shown in FIG. 1 , if the magnet 10 in the first accessory 1 is located to the left of the (linear) Hall sensor 20 of the electronic device 2 and the distance from the linear Hall sensor 20 is 2 mm, the linear Hall sensor 20 detects that the magnetic field strength is -2.5 GS and outputs a voltage value of 500 mV; Figure 4 In the second accessory 3, the magnet 10 is located above the linear Hall sensor 20 of the electronic device 2, and the distance between the magnet 10 and the linear Hall sensor 20 is 0 mm. Then the linear Hall sensor 20 detects that the magnetic field strength is 0 GS and outputs a voltage value of 1500 mV. Figure 5In the third accessory 4, the magnet 10 is located to the right of the linear Hall sensor 20 of the electronic device 2, and the distance from the linear Hall sensor 20 is 3mm. Then the linear Hall sensor 20 detects that its magnetic field strength is 3GS, and outputs a voltage value of 3000mV. Among them, the linear Hall sensor can be integrated with an analog-to-digital converter (ADC), so that the voltage value representing the magnetic field strength can be directly obtained. If the ADC is not integrated, the digital voltage data can be obtained by analog-to-digital conversion through the ADC. In addition, in order to prevent the detection data from being interfered by other magnetic substances, physical anti-magnetic interference means can be used in conjunction with the detection to ensure the accuracy of the detection data.

[0023] In some implementations of the present embodiment, before generating target magnetic strength characterization data based on the magnetic strength detection element responding to the magnetic field strength of the magnetic component in the target accessory, it also includes: detecting the magnetic field strength of the magnetic component in the target accessory in real time based on the magnetic strength detection element to obtain corresponding first voltage data; if the first voltage data is within a preset voltage threshold range, it is determined that the target accessory is located at a preset target position of the electronic device.

[0024] Specifically, in this embodiment, a fixed position can be set on the electronic device, and when detection is required, the target accessory is placed in the fixed position so that different accessories have the same reference point. This embodiment uses a linear Hall sensor to detect whether each accessory is in the fixed position, and can detect the magnetic field strength of each magnet in the accessories required for the relevant scene at the fixed position in advance, and output the corresponding voltage value, so as to obtain a voltage threshold range. When accessory identification is required, the magnetic field strength of the magnet in the target accessory is detected in real time. When the voltage value representing the magnetic field strength is within the voltage threshold range, it is determined that it is in the preset fixed position of the electronic device. At the same time, this embodiment only performs subsequent matching on the acquired magnetic strength characterization data when the target accessory is in the fixed position, and matches it with the voltage threshold range, and can screen out the magnetic strength characterization data that does not belong to the target, thereby improving the accuracy of subsequent matching data.

[0025] In some other implementations of this embodiment, before generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory, it also includes: obtaining reference magnetic intensity characterization data based on the magnetic intensity detection element detecting the magnetic field strength of the reference magnetic component in the reference accessory at the target position; if the reference magnetic intensity characterization data satisfies the magnetic intensity characterization data range associated with the reference magnetic component, generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory.

[0026] Specifically, in this embodiment, in order to ensure the accuracy and reliability of the detected magnetic intensity characterization data, the linear Hall sensor can also be calibrated before performing the magnetic intensity detection, that is, a reference accessory is selected, and a magnetic intensity detection is performed on a reference magnetic component in the reference accessory based on the linear Hall sensor, and then the reference magnetic intensity characterization data output by the linear Hall sensor is matched with the magnetic intensity characterization data range associated with the reference magnetic component. If the reference magnetic intensity characterization data is within the magnetic intensity characterization data range, it is determined that the verification is successful, and the subsequent operation of generating target magnetic intensity characterization data in response to the magnetic field strength of the magnetic component in the target accessory can be executed.

[0027] Furthermore, in some implementations of the present embodiment, when the number of target magnetic intensity characterization data is multiple, the target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory, including: obtaining multiple target magnetic intensity characterization data based on the magnetic intensity detection element detecting the magnetic field strength of the magnetic component in the target accessory when the target accessory is in different orientations; and / or, according to a preset number of detections, and based on the magnetic intensity detection element detecting the magnetic field strength of the magnetic component in the target accessory in the same orientation, obtaining multiple target magnetic intensity characterization data.

[0028] Specifically, in the present embodiment, when the target accessory is in a preset fixed position, the magnetic intensity characterization data detected may be one or more, that is, a detection is performed based on the linear Hall sensor to obtain one magnetic intensity characterization data; and in order to improve the accuracy of the detection, multiple detections may be performed to obtain multiple magnetic intensity characterization data, wherein, when multiple magnetic intensity characterization data need to be obtained, the magnetic intensity of the magnetic component in the same orientation may be detected a preset number of times based on the linear Hall sensor, or the magnetic intensity of the magnetic component may be detected from multiple orientations, or the two methods may be combined for detection, wherein the target accessories in multiple orientations are all in preset fixed positions, and the target accessories may be rotated by a preset angle.

[0029] Step 102: Match the target magnetic intensity characterization data with a preset accessory index table.

[0030] Specifically, in this embodiment, when the magnetic characterization data detected when the target accessory is located at a preset fixed position of the electronic device is obtained, the magnetic characterization data can be queried in a preset accessory index table, wherein the accessory index table contains a mapping relationship between the magnetic characterization data range and the accessory identification information, for example, the magnetic characterization data range of [498, 502] corresponds to the first accessory.

[0031] In some implementations of this embodiment, when the number of target magnetic intensity characterization data is multiple, the target magnetic intensity characterization data is matched with a preset accessory index table, including: screening multiple target voltage data to obtain multiple first target voltage data; calculating the average of the multiple first target voltage data to obtain second target voltage data; matching the second target voltage data with the preset accessory index table.

[0032] Specifically, in this embodiment, when the number of magnetic intensity characterization data detected when the acquired target accessory is located at a preset fixed position of the electronic device is multiple, the acquired magnetic intensity characterization data can be screened to select a preset number of target magnetic intensity characterization data or select target magnetic intensity characterization data with high reference, and then the screened first target magnetic intensity characterization data are averaged to obtain second target magnetic intensity characterization data, and finally the second target magnetic intensity characterization data is queried in the preset accessory index table; alternatively, the screened first target magnetic intensity characterization data can be directly matched with the accessory index table respectively, and the range of magnetic intensity characterization data that appears the most times in the matching result shall prevail.

[0033] Furthermore, in some implementations of the present embodiment, multiple target voltage data are screened to obtain multiple first target voltage data, including: calculating the sum of the absolute values ​​of the differences between each target voltage data and the remaining target voltage data to obtain multiple absolute value sums; comparing the sum of each absolute value with a preset threshold value; if there is a target absolute value sum greater than the threshold, removing the corresponding target voltage data to obtain multiple first target voltage data.

[0034] Specifically, in this embodiment, in order to ensure the referenceability of the mean value calculation result, data with large differences from other target magnetic intensity characterization data can be screened out from multiple target magnetic intensity characterization data. For example, each target magnetic intensity characterization data is subtracted from the remaining target magnetic intensity characterization data, and then the absolute values ​​of the differences corresponding to each target magnetic intensity characterization data are summed to obtain the sum of multiple difference absolute values, and then the sum of the difference absolute values ​​is compared with a preset threshold, and finally the target magnetic intensity characterization data corresponding to the sum of the difference absolute values ​​greater than the threshold is removed; or the target magnetic intensity characterization data corresponding to the largest target absolute value sum among the sums of the difference absolute values ​​is removed.

[0035] Furthermore, in some other implementations of this embodiment, after matching the target magnetic intensity characterization data with the preset accessory index table, it also includes: if the target magnetic intensity characterization data does not match the corresponding magnetic intensity characterization data range in the accessory index table, outputting a prompt message that the target accessory is in an abnormal state.

[0036] Specifically, in this embodiment, if the corresponding magnetic characterization data range is not matched in the accessory index table, it means that the accessory may be damaged or the detected magnetic characterization data is abnormal (such as interfered by other magnetic objects, etc.), then a prompt message indicating that the accessory is in an abnormal state can be output to remind relevant personnel to conduct abnormal troubleshooting.

[0037] Step 103: Determine the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

[0038] Specifically, in this embodiment, when the magnetic intensity characterization data detected when the target accessory is located at a fixed position of the electronic device matches the corresponding magnetic intensity characterization data range in the accessory index table, the accessory identification information corresponding to the magnetic intensity characterization data range can be determined as the identification information of the target accessory. For example, when the magnetic intensity characterization data range [1498, 1502] is matched in the accessory index table according to the voltage value 1500mV, the target accessory is determined to be the second accessory mentioned above. Similarly, any normal accessory connected can be identified according to different voltage values. Therefore, the accessory identification method based on magnetic detection provided in this embodiment can detect whether an accessory is connected and identify different types of accessories; moreover, both the magnetic detection element and the magnetic component can be installed in a hidden manner, so that the accessory-related information cannot be easily stolen, which is conducive to ensuring the security of the accessory information; at the same time, the hardware implementation of the identification method is simple, and only requires setting a magnetic detection element on the electronic device side and a magnetic component on the accessory side. The overall cost is low and does not require too much volume; furthermore, the judgment accuracy of magnetic detection elements such as Hall sensors is high (can reach + / -0.05mm), so that a variety of accessories can be identified in a smaller size.

[0039] Based on the technical solution of the embodiment of the present application, when it is detected that the target accessory is located at the preset target position of the electronic device, the target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory; wherein the magnetic intensity characterization data includes voltage data; the target magnetic intensity characterization data is matched with the preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; the accessory identification information corresponding to the matched magnetic intensity characterization data range is determined as the identification information of the target accessory. Through the implementation of the solution of the present application, the magnetic field strength of the magnetic component in the accessory is detected to obtain the corresponding magnetic intensity characterization data, and then the identification information of the accessory can be obtained by looking up the table according to the magnetic intensity characterization data, so that the identification information of the accessory can be hidden by the identification method, which is conducive to ensuring the security of the accessory information. At the same time, compared with the relevant technology, it does not require too many hardware resources, and only requires the electronic device to be equipped with a magnetic intensity detection element and the accessory to be equipped with a magnetic component, which effectively saves the cost of hardware resources.

[0040] Figure 6 The method in is a detailed accessory identification method provided by an embodiment of the present application, and the accessory identification method includes:

[0041] Step 601: Detect the magnetic field strength of the magnetic component in the target accessory in real time to obtain corresponding first magnetic strength characterization data;

[0042] Step 602: If the first magnetic intensity characterization data is within a preset threshold range, determining that the target accessory is located at a preset target position of the electronic device;

[0043] Step 603, generating a plurality of second magnetic intensity characterization data in response to the magnetic field intensity of the magnetic component in the target accessory;

[0044] Step 604, screening the plurality of second magnetic intensity characterization data to obtain a plurality of third magnetic intensity characterization data;

[0045] Step 605, calculating the average of a plurality of third target magnetic intensity characterization data to obtain target magnetic intensity characterization data;

[0046] Step 606, matching the target magnetic intensity characterization data with the preset accessory index table;

[0047] Step 607: Determine the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

[0048] It should be understood that the size of the serial number of each step in this embodiment does not mean the order of execution of the steps. The execution order of each step should be determined by its function and internal logic, and should not constitute a sole limitation on the implementation process of the embodiment of this application.

[0049] Based on the above technical scheme of the embodiment of the present application, by real-time detection of the magnetic field strength of the magnetic component in the target accessory, when the voltage value characterizing the magnetic field strength is within the preset voltage threshold range, it is determined that the target accessory is in a preset fixed position of the electronic device, and multiple voltage values ​​detected by the target accessory at the fixed position are obtained, and then the obtained voltage values ​​are screened to select a preset number of target voltage values ​​or select target voltage values ​​with high reference, and then the average of the screened target voltage values ​​is calculated, and finally the target voltage average is queried in the preset accessory index table. If the corresponding voltage range is matched in the accessory index table, the accessory identification information corresponding to the voltage range can be determined as the identification information of the target accessory. Through the implementation of the scheme of the present application, it is possible to detect whether an accessory is connected and identify different types of accessories; and, since both the magnetic detection element and the magnetic component can be installed in a hidden manner, the accessory-related information cannot be easily stolen, which is conducive to ensuring the security of the accessory information; at the same time, the hardware implementation of the identification method is simple, and only requires the magnetic detection element to be set on the electronic device side and the magnetic component to be set on the accessory side. The overall cost is low and does not require too much volume; furthermore, the judgment accuracy of magnetic detection elements such as Hall sensors is high, and a variety of accessories can be identified in a smaller size.

[0050] Figure 7 An accessory identification device provided in an embodiment of the present application is applied to an electronic device. The accessory identification device mainly includes:

[0051] The generating module 701 is used to generate target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field intensity of the magnetic component in the target accessory when the target accessory is detected to be located at a preset target position of the electronic device; wherein the magnetic intensity characterization data includes voltage data;

[0052] A matching module 702 is used to match the target magnetic intensity characterization data with a preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information;

[0053] The determination module 703 is used to determine the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

[0054] In some implementations of the present embodiment, before executing the function of generating target magnetic strength characterization data based on the magnetic strength detection element responding to the magnetic field strength of the magnetic component in the target accessory, the generation module is also used to: detect the magnetic field strength of the magnetic component in the target accessory in real time based on the magnetic strength detection element to obtain corresponding first voltage data; if the first voltage data is within a preset voltage threshold range, it is determined that the target accessory is located at a preset target position of the electronic device.

[0055] In some other implementations of this embodiment, before executing the function of generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory, the generation module is also used to: obtain reference magnetic intensity characterization data based on the magnetic intensity detection element detecting the magnetic field strength of the reference magnetic component in the reference accessory at the target position; if the reference magnetic intensity characterization data satisfies the magnetic intensity characterization data range associated with the reference magnetic component, then generate the target magnetic intensity characterization data in response to the magnetic field strength of the magnetic component in the target accessory.

[0056] Furthermore, in some implementations of the present embodiment, the number of target magnetic intensity characterization data is multiple, and the generation module is specifically used to: obtain multiple target magnetic intensity characterization data based on the magnetic intensity detection element detecting the magnetic field strength of the magnetic component in the target accessory when the target accessory is in different orientations; and / or, according to a preset number of detections, detect the magnetic field strength of the magnetic component in the target accessory in the same orientation to obtain multiple target magnetic intensity characterization data.

[0057] In some implementations of this embodiment, when the number of target magnetic intensity characterization data is multiple, the matching module is specifically used to: screen multiple target voltage data to obtain multiple first target voltage data; calculate the average of the multiple first target voltage data to obtain the second target voltage data; match the second target voltage data with the preset accessory index table.

[0058] Furthermore, in some implementations of the present embodiment, when the matching module performs the function of screening multiple target voltage data to obtain multiple first target voltage data, it is specifically used to: calculate the sum of the absolute values ​​of the differences between each target voltage data and the remaining target voltage data to obtain multiple absolute value sums; compare the sum of each absolute value with a preset threshold value respectively; if there is a target absolute value sum greater than the threshold, remove the corresponding target voltage data to obtain multiple first target voltage data.

[0059] Furthermore, in some implementations of this embodiment, the accessory identification device also includes: an output module, which is used to output a prompt message that the target accessory is in an abnormal state if the target magnetic intensity characterization data does not match the corresponding magnetic intensity characterization data range in the accessory index table.

[0060] It should be noted that the accessory identification methods in the aforementioned embodiments can all be implemented based on the accessory identification device provided in this embodiment. Ordinary technical personnel in the relevant field can clearly understand that for the convenience and conciseness of description, the specific working process of the accessory identification device described in this embodiment can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0061] Based on the technical solution of the above-mentioned embodiment of the present application, when it is detected that the target accessory is located at the preset target position of the electronic device, the target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory; wherein the magnetic intensity characterization data includes voltage data; the target magnetic intensity characterization data is matched with the preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; the accessory identification information corresponding to the matched magnetic intensity characterization data range is determined as the identification information of the target accessory. Through the implementation of the solution of the present application, the magnetic field strength of the magnetic component in the accessory is detected to obtain the corresponding magnetic intensity characterization data, and then the identification information of the accessory can be obtained by looking up the table according to the magnetic intensity characterization data, so that the identification information of the accessory can be hidden, which is conducive to ensuring the security of the accessory information. At the same time, compared with the relevant technology, it does not require too many hardware resources, and only requires the electronic device to be equipped with a magnetic intensity detection element and the accessory to be equipped with a magnetic component, which effectively saves the cost of hardware resources.

[0062] Figure 8 This is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application. The electronic device can be used to implement the accessory identification method in the aforementioned embodiment, mainly including:

[0063] The memory 801, the processor 802, and the computer program 803 stored in the memory 801 and executable on the processor 802, the memory 801 and the processor 802 are connected by communication. When the processor 802 executes the computer program 803, the method in the aforementioned embodiment is implemented. The number of processors may be one or more. The electronic device may be a mobile phone, a computer, a household appliance, etc., and the corresponding accessories may be headphones, a charger, a motor, etc.

[0064] The memory 801 may be a high-speed random access memory (RAM) memory, or a non-volatile memory, such as a disk memory. The memory 801 is used to store executable program codes, and the processor 802 is coupled to the memory 801 .

[0065] Furthermore, the embodiment of the present application also provides a computer-readable storage medium, which may be disposed in the above-mentioned electronic device. The computer-readable storage medium may be the above-mentioned Figure 8 Memory in the illustrated embodiment.

[0066] The computer readable storage medium stores a computer program, and when the program is executed by the processor, the accessory identification method in the aforementioned embodiment is implemented. Furthermore, the computer storable medium can also be a U disk, a mobile hard disk, a read-only memory (ROM), a RAM, a magnetic disk or an optical disk, and other media that can store program codes.

[0067] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.

[0068] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical modules, that is, they may be located in one place or distributed on multiple network modules. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0069] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0070] If the integrated module is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a readable storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned readable storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.

[0071] It should be noted that, for the convenience of description, the aforementioned method embodiments are all described as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described action sequence, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.

[0072] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0073] The above is a description of the accessory identification method, device and storage medium provided in this application. For technicians in this field, according to the ideas of the embodiments of this application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on this application.

Claims

1. A method for identifying an accessory, characterized in that: Applied to an electronic device, the electronic device is provided with a magnetic detection element, and the accessory identification method includes: When it is detected that the target accessory is located at a preset target position of the electronic device, target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field intensity of the magnetic component in the target accessory; wherein the magnetic intensity characterization data includes voltage data; Matching the target magnetic intensity characterization data with a preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; The accessory identification information corresponding to the matched magnetic intensity characterization data range is determined as the identification information of the target accessory.

2. The accessory identification method according to claim 1, characterized in that: Before generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field intensity of the magnetic component in the target accessory, the method further includes: Based on the magnetic intensity detection element, the magnetic field intensity of the magnetic component in the target accessory is detected in real time to obtain corresponding first voltage data; If the first voltage data is within a preset voltage threshold range, it is determined that the target accessory is located at a preset target position of the electronic device.

3. The accessory identification method according to claim 1, characterized in that: After matching the target magnetic intensity characterization data with the preset accessory index table, the method further includes: If the target magnetic intensity characterization data does not match the corresponding magnetic intensity characterization data range in the accessory index table, a prompt message indicating that the target accessory is in an abnormal state is output.

4. The accessory identification method according to claim 1, characterized in that: The number of the target magnetic intensity characterization data is multiple, and the matching of the target magnetic intensity characterization data with a preset accessory index table includes: Screening a plurality of target voltage data to obtain a plurality of first target voltage data; Calculating an average of the plurality of first target voltage data to obtain second target voltage data; The second target voltage data is matched with a preset accessory index table.

5. The accessory identification method according to claim 4, characterized in that: The screening of the plurality of target voltage data to obtain a plurality of first target voltage data includes: Calculating the sum of the absolute values ​​of the differences between each target voltage data and the remaining target voltage data to obtain a plurality of sums of absolute values; Comparing the sum of the absolute values ​​with a preset threshold value respectively; If there is a sum of target absolute values ​​greater than the threshold, the corresponding target voltage data is removed to obtain a plurality of first target voltage data.

6. The accessory identification method according to claim 4, characterized in that: The magnetic intensity detection element includes a Hall sensor, and the target magnetic intensity characterization data is generated based on the magnetic intensity detection element responding to the magnetic field intensity of the magnetic component in the target accessory, including: Based on the Hall sensor detecting the magnetic field strength of the magnetic component in the target accessory when the target accessory is in different orientations, a plurality of target magnetic intensity characterization data are obtained; And / or, according to a preset number of detections, and based on the Hall sensor, the magnetic field strength of the magnetic components in the target accessory at the same orientation is detected to obtain a plurality of target magnetic strength characterization data.

7. The accessory identification method according to any one of claims 1 to 6, characterized in that: Before generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field intensity of the magnetic component in the target accessory, the method further includes: Based on the magnetic intensity detection element detecting the magnetic field intensity of the reference magnetic component in the reference accessory at the target position, obtaining reference magnetic intensity characterization data; If the reference magnetic intensity characterization data meets the magnetic intensity characterization data range associated with the reference magnetic component, the step of generating target magnetic intensity characterization data based on the magnetic intensity detection element responding to the magnetic field strength of the magnetic component in the target accessory is performed.

8. An accessory identification device, characterized in that: Applied to an electronic device, the electronic device is provided with a magnetic detection element, and the accessory identification device comprises: A generating module, configured to generate target magnetic intensity characterization data based on the magnetic intensity of the magnetic component in the target accessory in response to the magnetic intensity of the magnetic intensity detection element when the target accessory is detected to be located at a preset target position of the electronic device; wherein the magnetic intensity characterization data includes voltage data; A matching module, used to match the target magnetic intensity characterization data with a preset accessory index table; wherein the accessory index table includes a mapping relationship between the magnetic intensity characterization data range and the accessory identification information; The determination module is used to determine the accessory identification information corresponding to the matched magnetic intensity characterization data range as the identification information of the target accessory.

9. An electronic device, characterized in that: The device comprises a memory and a processor, wherein: The processor is used to execute the computer program stored in the memory; When the processor executes the computer program, the steps of the accessory identification method described in any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the accessory identification method described in any one of claims 1 to 7 are implemented.