A Bluetooth name truncation method, device, equipment and storage medium
By obtaining and truncating the byte length of the Bluetooth device name, and deleting incomplete characters in combination with the encoding strategy, the problem of garbled characters caused by the byte length limit of the Bluetooth device name in the vehicle software is solved, and the device name is displayed normally.
Patent Information
- Application Number
- CN202310154916.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-22
- Publication Date
- 2024-10-11
- Estimated Expiration
- 2043-02-22
AI Technical Summary
The name of the Bluetooth device was truncated due to byte length restrictions during the development process of the car-machine software, causing the human-computer interaction interface to display garbled characters. In particular, incomplete characters appeared after multi-byte characters were truncated, causing garbled characters.
By obtaining the byte length of the Bluetooth device name, it will be truncated if it exceeds the preset threshold, encoded based on the encoding strategy, determine the character type, and delete incomplete multi-byte type characters to update the device name to ensure display integrity.
It solves the problem of garbled characters caused by truncation of Bluetooth device names, realizes the normal display of device names, and ensures the integrity and accuracy of the human-computer interaction interface display.
Smart Images

Figure CN116033412B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a Bluetooth name truncation method, device, equipment and medium. Background Art
[0002] Since the Bluetooth module is affected by existing technologies, during the development of vehicle software, the Bluetooth module has some restrictions on the length of the received Bluetooth device name. If the byte length corresponding to the Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module, some bytes in the Bluetooth device name will be truncated, so that only the string consisting of the byte length of the Bluetooth device name limited by the Bluetooth module is displayed.
[0003] However, due to different character encoding formats, the number of bytes occupied by Chinese, English or other symbol characters is different. If the multi-byte characters in the Bluetooth device name are directly truncated, incomplete words may appear (that is, the bytes corresponding to the characters are truncated by the byte length threshold preset by the Bluetooth module), resulting in the situation where the Bluetooth device name string displayed on the human-computer interaction interface is garbled. Summary of the invention
[0004] The embodiments of the present invention provide a Bluetooth name truncation method, apparatus, device and storage medium, aiming to solve the problem of garbled display on a human-computer interaction interface caused by truncated multi-byte characters in a Bluetooth device name in the prior art.
[0005] In a first aspect, an embodiment of the present invention provides a Bluetooth name truncation method, which includes:
[0006] Get the name of the Bluetooth device and the byte length corresponding to the Bluetooth device name;
[0007] If it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name;
[0008] Encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result;
[0009] Based on the encoding result, the character type of each character in the truncated Bluetooth device name is determined. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, the character is deleted from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
[0010] In a second aspect, an embodiment of the present invention provides a Bluetooth name truncation device, which includes:
[0011] An acquiring unit, used to acquire a Bluetooth device name and acquire a byte length corresponding to the Bluetooth device name;
[0012] a truncation unit, configured to, if it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncate the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name;
[0013] An encoding unit, used for encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result;
[0014] A verification and updating unit is used to determine the character type of each character in the truncated Bluetooth device name based on the encoding result. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, the character is deleted from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
[0015] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the Bluetooth name truncation method described in the first aspect when executing the computer program.
[0016] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the Bluetooth name truncation method described in the first aspect.
[0017] The embodiment of the present invention provides a method, apparatus, device and storage medium for truncating a Bluetooth name, including obtaining a Bluetooth device name, and obtaining a byte length corresponding to the Bluetooth device name; if it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name; encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result; determining the character type of each character in the truncated Bluetooth device name based on the encoding result, if it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character has not passed, deleting the character from the truncated Bluetooth device name to obtain an updated Bluetooth device name. The invention solves the problem of garbled display of human-computer interaction interface caused by truncated multi-byte type characters in the Bluetooth device name, thereby realizing the normal display of the Bluetooth device name. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.
[0019] Figure 1 A schematic diagram of a flow chart of a Bluetooth name truncation method provided by an embodiment of the present invention;
[0020] Figure 2 A schematic block diagram of a Bluetooth name truncation device provided by an embodiment of the present invention;
[0021] Figure 3 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0022] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0023] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.
[0024] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0025] It should be further understood that the term "and / or" used in the present description and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0026] See also Figure 1 , Figure 1 The flowchart of the Bluetooth name truncation method provided by the embodiment of the present invention is shown in FIG. The Bluetooth name truncation method is applied to a vehicle terminal, and the method can be executed on a vehicle-mounted Bluetooth device. Figure 1 As shown, the method includes steps S110 to S140.
[0027] S110: Obtain a Bluetooth device name, and obtain a byte length corresponding to the Bluetooth device name.
[0028] In this embodiment, the technical solution is described with the vehicle terminal as the execution subject. In addition, due to the limitations of the existing Bluetooth modules themselves, some Bluetooth modules have the problem of limiting the byte length of the searched Bluetooth device name, so that the Bluetooth device name may be displayed in garbled characters in the human-computer interaction interface. In the specific implementation, first, the Bluetooth module on the vehicle terminal and the vehicle-mounted Bluetooth device are set to be in the open state, so that the Bluetooth module on the vehicle terminal can search for the vehicle-mounted Bluetooth device and pair it with it. Among them, the vehicle terminal can specifically be a smart phone, a tablet computer, a portable computer, etc. The vehicle-mounted Bluetooth device can specifically be a vehicle-mounted Bluetooth audio, a vehicle-mounted Bluetooth headset, etc. When the Bluetooth module on the vehicle terminal is successfully connected to the vehicle-mounted Bluetooth device, the Bluetooth device name is obtained through the Bluetooth module on the vehicle terminal, and the byte length corresponding to the Bluetooth device name is read accordingly, so that the byte length corresponding to the obtained Bluetooth device name can be compared with the byte length threshold preset by the Bluetooth module.
[0029] In one embodiment, step S110 includes:
[0030] The byte lengths of the characters in the Bluetooth device name are obtained and summed to obtain the byte length corresponding to the Bluetooth device name.
[0031] In this embodiment, in order to enable the Bluetooth module on the vehicle terminal to read the byte length corresponding to the Bluetooth device name, the Bluetooth module reads the Bluetooth device name based on a specific character encoding, thereby obtaining the byte length of each character in the Bluetooth device name, and summing the byte lengths of each character in the Bluetooth device name to obtain the sum of the byte lengths corresponding to the Bluetooth device name, thereby more accurately obtaining the byte length corresponding to the Bluetooth device name.
[0032] In one embodiment, after step S110, the method further includes:
[0033] If it is determined that the byte length corresponding to the Bluetooth device name does not exceed a preset byte length threshold, the Bluetooth device name is displayed.
[0034] In this embodiment, after obtaining the sum of the byte lengths of each character of the Bluetooth device name, firstly, by judging whether the sum of the byte lengths corresponding to each character of the Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module, the situation where the sum of the byte lengths corresponding to each character of the Bluetooth device name does not exceed the byte length threshold preset by the Bluetooth module is excluded. In specific implementation, when it is determined that the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name does not exceed the byte length threshold preset by the Bluetooth module on the vehicle terminal, since the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name is within the range of the byte length threshold preset by the Bluetooth module on the vehicle terminal, there is no situation where the vehicle-mounted Bluetooth device name is garbled on the human-computer interaction interface, and therefore, the Bluetooth module on the vehicle terminal does not need to process the vehicle-mounted Bluetooth device name, and can directly obtain the vehicle-mounted Bluetooth device name and display the vehicle-mounted Bluetooth device name on the human-computer interaction interface.
[0035] S120: If it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name.
[0036] In this embodiment, since the byte length threshold preset by the Bluetooth module of the vehicle terminal will limit the byte length of the Bluetooth device name, when the sum of the byte lengths corresponding to each character of the Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal, the character string of the Bluetooth device name is truncated. However, after the Bluetooth device name is truncated, the problem of garbled characters may appear in the human-computer interaction interface. In specific implementation, after obtaining the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name, the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name is determined by judging whether it exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal. At this time, when it is determined that the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal, the vehicle-mounted Bluetooth device name obtained by the Bluetooth module on the vehicle terminal will be truncated by the byte length threshold preset by the Bluetooth module on the vehicle terminal, so that the Bluetooth module on the vehicle terminal obtains the truncated Bluetooth device name. Thus, the truncated Bluetooth device name is obtained, so that the character type of each character in the truncated Bluetooth device name can be subsequently checked for integrity.
[0037] In one embodiment, truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name includes:
[0038] Get the byte length of the jth character in the Bluetooth device name; wherein the initial value of j is 1, and the value range of j is [1, M], where M is the total number of characters in the Bluetooth device name;
[0039] Obtaining the historical cumulative character byte length, summing the byte length of the j-th character with the historical cumulative character byte length to update the historical cumulative character byte length; wherein, when j=1, the initial value of the historical cumulative character byte length is 0;
[0040] If it is determined that the historical cumulative character byte length does not exceed the byte length threshold, retain the jth character;
[0041] If it is determined that the historical cumulative character byte length exceeds the byte length threshold, the character content of the j-th character having a length corresponding to the difference between the historical cumulative character byte length and the byte length threshold is deleted, and concatenated with the 1st character to the j-th character in sequence to obtain a truncated Bluetooth device name;
[0042] Increment j by 1 to update the value of j;
[0043] If it is determined that j does not exceed M, return to the step of obtaining the byte length of the jth character in the Bluetooth device name;
[0044] If it is determined that j exceeds M, the first character to the Mth character are obtained and sequentially concatenated to obtain a truncated Bluetooth device name.
[0045] In this embodiment, after the judgment of whether the sum of the byte lengths corresponding to the characters of the Bluetooth device name exceeds the preset byte length threshold has been completed. When it is determined that the byte lengths corresponding to the characters of the Bluetooth device name exceed the preset byte length threshold, the Bluetooth module of the vehicle terminal obtains the byte length of the jth character in the Bluetooth device name by traversing to obtain the truncated Bluetooth device name, wherein the initial value of j is 1, and its value range is [1, M], and M is the total number of characters in the Bluetooth device name; and by obtaining the historical cumulative character byte length, the byte length of the jth character is summed with the historical cumulative character byte length, thereby updating the historical cumulative character byte length; by judging whether the historical cumulative character byte length exceeds the byte length threshold, when it is determined that the historical cumulative character byte length does not exceed the byte length threshold, the jth character is retained; when it is determined that the historical cumulative character byte length exceeds the byte length threshold, the character content in the jth character with the length corresponding to the difference between the historical cumulative character byte length and the byte length threshold is deleted, and concatenated with the first character to the jth character in sequence to obtain the truncated Bluetooth device name. In addition, j is incremented by 1 to update the value of j in real time, and it is determined whether j exceeds the total number of characters M in the Bluetooth device name. When it is determined that j does not exceed M, the step of obtaining the byte length of the jth character in the Bluetooth device name is returned; when it is determined that j exceeds M, the 1st character to the Mth character are obtained in sequence to obtain the truncated Bluetooth device name. Thus, by looping through the byte length corresponding to each character in the Bluetooth device name, and judging the obtained historical cumulative character byte length with the byte length threshold, the position information of the character where the vehicle-mounted Bluetooth device name is truncated can be obtained while obtaining the truncated Bluetooth device name.
[0046] S130: Encode the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result.
[0047] In this embodiment, since the byte lengths corresponding to Chinese, Arabic numerals, English and other characters are different in different character encodings, and the Bluetooth device name is usually a mixture of multiple characters, in order to ensure that the characters of the Bluetooth device name paired with the Bluetooth module on the vehicle terminal do not appear garbled, it is necessary to ensure that each character in the Bluetooth device name is a complete character (that is, the byte length corresponding to the character is not truncated). Therefore, after determining that the byte length corresponding to the Bluetooth device name exceeds the preset byte length threshold, the Bluetooth module on the vehicle terminal obtains a truncated Bluetooth device name, and before displaying the truncated Bluetooth device name on the human-computer interaction interface, it is necessary to encode the truncated Bluetooth device name obtained by the Bluetooth module on the vehicle terminal according to the preset encoding strategy, and convert the character encoding format of the truncated Bluetooth device name, so that the truncated Bluetooth device name composed of multiple characters can obtain the encoding result of the byte length corresponding to each character of the truncated Bluetooth device name based on the preset encoding strategy.
[0048] In one embodiment, step S130 includes:
[0049] The truncated Bluetooth device name is encoded using a Unicode encoding strategy corresponding to the encoding strategy to obtain an encoding result.
[0050] In this embodiment, Unicode is a unified code, which is an industry standard in the field of computer science. Unicode is created to solve the limitations of traditional character encoding schemes. It sets a unified and unique binary code for each character in each language to meet the requirements of text conversion and processing across languages and platforms.
[0051] However, for multi-byte character strings or character strings composed of multiple characters in the Bluetooth device name, in order to obtain the number of bytes of each character in the string, UTF-8 is generally used for character encoding. Among them, UTF-8 is a coding method of Unicode. When the code point range is between 0 and 127, that is, the coding format is 0xxx xxxx, it represents English or numeric characters, and the byte length corresponding to the character is 1; when the code point range is between 2048 and 65535, that is, the coding format is 1110xxxx 10xxxxxx 10xxxxxx, it represents Chinese characters, and the byte length corresponding to the character is 3. In practical applications, when the truncated string only includes Chinese and English, only these two numerical ranges can be judged. If other types of characters need to be processed, the UTF-8 coding table can be referred to to increase other judgment numerical ranges. In specific implementation, the truncated Bluetooth device name is extracted by traversing each character and converting it into the Unicode coding format, so as to obtain the number of bytes corresponding to each character of the truncated Bluetooth device name after encoding according to the coding result, so as to subsequently determine the character type of each character in the truncated Bluetooth device name.
[0052] S140. Determine the character type of each character in the truncated Bluetooth device name based on the encoding result. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, delete the character from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
[0053] In this embodiment, the encoding of each character of the truncated Bluetooth device name has been completed before, and after the number of bytes corresponding to each character of the truncated Bluetooth device name is obtained through the encoding result, the character type of each character is determined according to the number of bytes corresponding to each character of the truncated Bluetooth device name. When it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character has not passed (that is, the byte length corresponding to the character is truncated, so that it constitutes an incomplete character), the remaining bytes after the character is truncated are discarded, that is, the character is deleted from the truncated Bluetooth device name. For example, a Chinese character occupying 3 bytes is truncated by 2 bytes or 1 byte, so that the truncated Bluetooth device name containing the Chinese character is displayed as garbled in the human-computer interaction interface. Therefore, in order to avoid abnormalities in the Bluetooth device name in the human-computer interaction interface, the remaining 1 byte or 2 bytes after the Chinese character is truncated are discarded. Therefore, by discarding the incomplete characters in the truncated Bluetooth device name, the complete characters in front of the incomplete characters are retained, and then the updated Bluetooth device name is obtained.
[0054] In one embodiment, step S140 includes:
[0055] Obtaining the i-th character type of the i-th character in the truncated Bluetooth device name; wherein the initial value of i is 1, and the value range of i is [1, N], where N is the total number of characters in the truncated Bluetooth device name;
[0056] If it is determined that the i-th character type is a single-byte type, retaining the i-th character in the truncated Bluetooth device name;
[0057] If it is determined that the type of the i-th character is a multi-byte type, then the integrity verification result of the i-th character is obtained;
[0058] If it is determined that the integrity verification result of the i-th character is that the integrity verification passes, the i-th character in the truncated Bluetooth device name is retained;
[0059] If it is determined that the integrity verification result of the i-th character is that the integrity verification fails, deleting the i-th character in the truncated Bluetooth device name;
[0060] Increase i by 1 to update the value of i;
[0061] If it is determined that i does not exceed N, returning to the step of obtaining the i-th character type of the i-th character in the truncated Bluetooth device name;
[0062] If it is determined that i exceeds N, the characters from the 1st character to the Nth character included in the truncated Bluetooth device name are sequentially obtained and the characters are used to form the updated Bluetooth device name.
[0063] In this embodiment, after the number of bytes corresponding to each character of the truncated Bluetooth device name is obtained, in order to obtain the byte type and integrity verification result corresponding to each character of the truncated Bluetooth device name, the byte number of each character is divided into single-byte type and multi-byte type, and the i-th character type of the i-th character in the truncated Bluetooth device name is obtained by traversal; wherein the value range of i is [1, N], and N is the total number of characters in the truncated Bluetooth device name. When it is determined that the i-th character type is a single-byte type, the i-th character in the truncated Bluetooth device name is retained; when it is determined that the i-th character type is a multi-byte type, the integrity verification result of the i-th character is obtained; if it is determined that the integrity verification result of the i-th character is that the integrity check passes, the i-th character in the truncated Bluetooth device name is retained; if it is determined that the integrity verification result of the i-th character is that the integrity check fails, the i-th character in the truncated Bluetooth device name is deleted; in addition, i is increased by 1 to update the value of i in real time; when it is determined that i does not exceed the total number of characters N in the truncated Bluetooth device name, it returns to execute the acquisition of the truncated Bluetooth device name. the step of determining the i-th character type of the i-th character in the name; when it is determined that i exceeds the total number of characters N in the truncated Bluetooth device name, sequentially obtaining the retained characters from the 1st character to the N-th character included in the truncated Bluetooth device name, thereby determining by traversal whether the character type corresponding to each character in the truncated Bluetooth device name is a multi-byte type; if the character is a multi-byte type, judging the integrity verification result of the character to determine whether to retain or delete the character, and then obtaining the updated Bluetooth device name to ensure that the updated Bluetooth device name obtained is not displayed as garbled characters in the human-computer interaction interface of the vehicle terminal.
[0064] In one embodiment, if it is determined that the i-th character type is a multi-byte type, obtaining the integrity verification result of the i-th character includes:
[0065] If it is determined that the i-th character type is a multi-byte type, obtaining the i-th encoding sub-result corresponding to the i-th character in the encoding result;
[0066] If it is determined that the i-th encoding sub-result is a complete encoding result, then the integrity verification result of the i-th character is integrity check passed;
[0067] If it is determined that the i-th encoding sub-result is not a complete encoding result, the integrity verification result of the i-th character is that the integrity check fails.
[0068] In this embodiment, after determining that the character type of the current character is a multi-byte type, it is necessary to obtain the integrity verification result of the current character; in specific implementation, if it is determined that the i-th character type is a multi-byte type, then the i-th encoding sub-result corresponding to the i-th character in the encoding result is obtained; if it is determined that the i-th encoding sub-result is a complete encoding result, then the integrity verification result of the i-th character is that the integrity check passed; if it is determined that the i-th encoding sub-result is not a complete encoding result, then the integrity verification result of the i-th character is that the integrity check failed, thereby judging whether the i-th character is a complete character through the above steps so that it can be retained or deleted later, thereby ensuring the normal display of the Bluetooth device name after the update.
[0069] The method solves the problem of garbled characters displayed on the human-computer interaction interface due to incomplete characters in the Bluetooth device name, and realizes the normal display of the Bluetooth device name.
[0070] The embodiment of the present invention further provides a Bluetooth name truncation device, which is used to execute any embodiment of the aforementioned Bluetooth name truncation method. Figure 2 , Figure 2 It is a schematic block diagram of a Bluetooth name truncation device provided by an embodiment of the present invention.
[0071] like Figure 2 As shown, the Bluetooth name truncation device 100 includes: an acquisition unit 110 , a truncation unit 120 , an encoding unit 130 , and a verification and update unit 140 .
[0072] The acquisition unit 110 is used to acquire the Bluetooth device name and acquire the byte length corresponding to the Bluetooth device name.
[0073] In this embodiment, the technical solution is described with the vehicle terminal as the execution subject. In addition, due to the limitations of the existing Bluetooth modules themselves, some Bluetooth modules have the problem of limiting the byte length of the searched Bluetooth device name, so that the Bluetooth device name may be displayed in garbled characters in the human-computer interaction interface. In the specific implementation, first, the Bluetooth module on the vehicle terminal and the vehicle-mounted Bluetooth device are set to be in the open state, so that the Bluetooth module on the vehicle terminal can search for the vehicle-mounted Bluetooth device and pair it with it. Among them, the vehicle terminal can specifically be a smart phone, a tablet computer, a portable computer, etc. The vehicle-mounted Bluetooth device can specifically be a vehicle-mounted Bluetooth audio, a vehicle-mounted Bluetooth headset, etc. When the Bluetooth module on the vehicle terminal is successfully connected to the vehicle-mounted Bluetooth device, the Bluetooth device name is obtained through the Bluetooth module on the vehicle terminal, and the byte length corresponding to the Bluetooth device name is read accordingly, so that the byte length corresponding to the obtained Bluetooth device name can be compared with the byte length threshold preset by the Bluetooth module.
[0074] In one embodiment, the acquisition unit 110 includes:
[0075] The byte lengths of the characters in the Bluetooth device name are obtained and summed to obtain the byte length corresponding to the Bluetooth device name.
[0076] In this embodiment, in order to enable the Bluetooth module on the vehicle terminal to read the byte length corresponding to the Bluetooth device name, the Bluetooth module reads the Bluetooth device name based on a specific character encoding, thereby obtaining the byte length of each character in the Bluetooth device name, and summing the byte lengths of each character in the Bluetooth device name to obtain the sum of the byte lengths corresponding to the Bluetooth device name, thereby more accurately obtaining the byte length corresponding to the Bluetooth device name.
[0077] In one embodiment, the obtaining unit 110 further includes:
[0078] The display unit is used to display the Bluetooth device name if it is determined that the byte length corresponding to the Bluetooth device name does not exceed a preset byte length threshold.
[0079] In this embodiment, after obtaining the sum of the byte lengths of each character of the Bluetooth device name, firstly, by judging whether the sum of the byte lengths corresponding to each character of the Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module, the situation where the sum of the byte lengths corresponding to each character of the Bluetooth device name does not exceed the byte length threshold preset by the Bluetooth module is excluded. In specific implementation, when it is determined that the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name does not exceed the byte length threshold preset by the Bluetooth module on the vehicle terminal, since the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name is within the range of the byte length threshold preset by the Bluetooth module on the vehicle terminal, there is no situation where the vehicle-mounted Bluetooth device name is garbled on the human-computer interaction interface, and therefore, the Bluetooth module on the vehicle terminal does not need to process the vehicle-mounted Bluetooth device name, and can directly obtain the vehicle-mounted Bluetooth device name and display the vehicle-mounted Bluetooth device name on the human-computer interaction interface.
[0080] The truncation unit 120 is configured to truncate the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name if it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold.
[0081] In this embodiment, since the byte length threshold preset by the Bluetooth module of the vehicle terminal will limit the byte length of the Bluetooth device name, when the sum of the byte lengths corresponding to each character of the Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal, the character string of the Bluetooth device name is truncated. However, after the Bluetooth device name is truncated, the problem of garbled characters may appear in the human-computer interaction interface. In specific implementation, after obtaining the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name, the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name is determined by judging whether it exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal. At this time, when it is determined that the sum of the byte lengths corresponding to each character of the vehicle-mounted Bluetooth device name exceeds the byte length threshold preset by the Bluetooth module on the vehicle terminal, the vehicle-mounted Bluetooth device name obtained by the Bluetooth module on the vehicle terminal will be truncated by the byte length threshold preset by the Bluetooth module on the vehicle terminal, so that the Bluetooth module on the vehicle terminal obtains the truncated Bluetooth device name. Thus, the truncated Bluetooth device name is obtained, so that the character type of each character in the truncated Bluetooth device name can be subsequently checked for integrity.
[0082] In one embodiment, the truncation unit 120 includes:
[0083] Get the byte length of the jth character in the Bluetooth device name; wherein the initial value of j is 1, and the value range of j is [1, M], where M is the total number of characters in the Bluetooth device name;
[0084] Obtaining the historical cumulative character byte length, summing the byte length of the j-th character with the historical cumulative character byte length to update the historical cumulative character byte length; wherein, when j=1, the initial value of the historical cumulative character byte length is 0;
[0085] If it is determined that the historical cumulative character byte length does not exceed the byte length threshold, retain the jth character;
[0086] If it is determined that the historical cumulative character byte length exceeds the byte length threshold, the character content of the j-th character having a length corresponding to the difference between the historical cumulative character byte length and the byte length threshold is deleted, and concatenated with the 1st character to the j-th character in sequence to obtain a truncated Bluetooth device name;
[0087] Increment j by 1 to update the value of j;
[0088] If it is determined that j does not exceed M, return to the step of obtaining the byte length of the jth character in the Bluetooth device name;
[0089] If it is determined that j exceeds M, the first character to the Mth character are obtained and sequentially concatenated to obtain a truncated Bluetooth device name.
[0090] In this embodiment, after the judgment of whether the sum of the byte lengths corresponding to the characters of the Bluetooth device name exceeds the preset byte length threshold has been completed. When it is determined that the byte lengths corresponding to the characters of the Bluetooth device name exceed the preset byte length threshold, the Bluetooth module of the vehicle terminal obtains the byte length of the jth character in the Bluetooth device name by traversing to obtain the truncated Bluetooth device name, wherein the initial value of j is 1, and its value range is [1, M], and M is the total number of characters in the Bluetooth device name; and by obtaining the historical cumulative character byte length, the byte length of the jth character is summed with the historical cumulative character byte length, thereby updating the historical cumulative character byte length; by judging whether the historical cumulative character byte length exceeds the byte length threshold, when it is determined that the historical cumulative character byte length does not exceed the byte length threshold, the jth character is retained; when it is determined that the historical cumulative character byte length exceeds the byte length threshold, the character content in the jth character with the length corresponding to the difference between the historical cumulative character byte length and the byte length threshold is deleted, and concatenated with the first character to the jth character in sequence to obtain the truncated Bluetooth device name. In addition, j is incremented by 1 to update the value of j in real time, and it is determined whether j exceeds the total number of characters M in the Bluetooth device name. When it is determined that j does not exceed M, the step of obtaining the byte length of the jth character in the Bluetooth device name is returned; when it is determined that j exceeds M, the 1st character to the Mth character are obtained in sequence to obtain the truncated Bluetooth device name. Thus, by looping through the byte length corresponding to each character in the Bluetooth device name, and judging the obtained historical cumulative character byte length with the byte length threshold, the position information of the character where the vehicle-mounted Bluetooth device name is truncated can be obtained while obtaining the truncated Bluetooth device name.
[0091] The encoding unit 130 is used to encode the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result.
[0092] In this embodiment, since the byte lengths corresponding to Chinese, Arabic numerals, English and other characters are different in different character encodings, and the Bluetooth device name is usually a mixture of multiple characters, in order to ensure that the characters of the Bluetooth device name paired with the Bluetooth module on the vehicle terminal do not appear garbled, it is necessary to ensure that each character in the Bluetooth device name is a complete character (that is, the byte length corresponding to the character is not truncated). Therefore, after determining that the byte length corresponding to the Bluetooth device name exceeds the preset byte length threshold, the Bluetooth module on the vehicle terminal obtains a truncated Bluetooth device name, and before displaying the truncated Bluetooth device name on the human-computer interaction interface, it is necessary to encode the truncated Bluetooth device name obtained by the Bluetooth module on the vehicle terminal according to the preset encoding strategy, and convert the character encoding format of the truncated Bluetooth device name, so that the truncated Bluetooth device name composed of multiple characters can obtain the encoding result of the byte length corresponding to each character of the truncated Bluetooth device name based on the preset encoding strategy.
[0093] In one embodiment, the encoding unit 130 includes:
[0094] The encoding result obtaining unit is used to encode the truncated Bluetooth device name using a Unicode encoding strategy corresponding to the encoding strategy to obtain an encoding result.
[0095] In this embodiment, Unicode is a unified code, which is an industry standard in the field of computer science. Unicode is created to solve the limitations of traditional character encoding schemes. It sets a unified and unique binary code for each character in each language to meet the requirements of text conversion and processing across languages and platforms.
[0096] However, for multi-byte character strings or character strings composed of multiple characters in the Bluetooth device name, in order to obtain the number of bytes of each character in the string, UTF-8 is generally used for character encoding. Among them, UTF-8 is a coding method of Unicode. When the code point range is between 0 and 127, that is, the coding format is 0xxx xxxx, it represents English or numeric characters, and the byte length corresponding to the character is 1; when the code point range is between 2048 and 65535, that is, the coding format is 1110xxxx 10xxxxxx 10xxxxxx, it represents Chinese characters, and the byte length corresponding to the character is 3. In practical applications, when the truncated string only includes Chinese and English, only these two numerical ranges can be judged. If other types of characters need to be processed, the UTF-8 coding table can be referred to to increase other judgment numerical ranges. In specific implementation, the truncated Bluetooth device name is extracted by traversing each character and converting it into the Unicode coding format, so as to obtain the number of bytes corresponding to each character of the truncated Bluetooth device name after encoding according to the coding result, so as to subsequently determine the character type of each character in the truncated Bluetooth device name.
[0097] The inspection and updating unit 140 is used to determine the character type of each character in the truncated Bluetooth device name based on the encoding result. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, the character is deleted from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
[0098] In this embodiment, the encoding of each character of the truncated Bluetooth device name has been completed before, and after the number of bytes corresponding to each character of the truncated Bluetooth device name is obtained through the encoding result, the character type of each character is determined according to the number of bytes corresponding to each character of the truncated Bluetooth device name. When it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character has not passed (that is, the byte length corresponding to the character is truncated, so that it constitutes an incomplete character), the remaining bytes after the character is truncated are discarded, that is, the character is deleted from the truncated Bluetooth device name. For example, a Chinese character occupying 3 bytes is truncated by 2 bytes or 1 byte, so that the truncated Bluetooth device name containing the Chinese character is displayed as garbled in the human-computer interaction interface. Therefore, in order to avoid abnormalities in the Bluetooth device name in the human-computer interaction interface, the remaining 1 byte or 2 bytes after the Chinese character is truncated are discarded. Therefore, by discarding the incomplete characters in the truncated Bluetooth device name, the complete characters in front of the incomplete characters are retained, and then the updated Bluetooth device name is obtained.
[0099] In one embodiment, the verification and updating unit 140 includes:
[0100] A character type acquisition unit, used to acquire the i-th character type of the i-th character in the truncated Bluetooth device name; wherein the initial value of i is 1, and the value range of i is [1, N], where N is the total number of characters in the truncated Bluetooth device name;
[0101] A single-byte type unit, used for retaining the i-th character in the truncated Bluetooth device name if it is determined that the i-th character type is a single-byte type;
[0102] A multi-byte type unit, used to obtain the integrity verification result of the i-th character if it is determined that the i-th character type is a multi-byte type;
[0103] A character retaining unit, configured to retain the i-th character in the truncated Bluetooth device name if it is determined that the integrity verification result of the i-th character is passed;
[0104] A character deleting unit, configured to delete the i-th character in the truncated Bluetooth device name if it is determined that the integrity verification result of the i-th character is that the integrity verification fails;
[0105] An updating unit, used to increase i by 1 and update the value of i;
[0106] an execution unit, configured to return to the step of obtaining the i-th character type of the i-th character in the truncated Bluetooth device name if it is determined that i does not exceed N;
[0107] The Bluetooth device name updating unit is used for, if it is determined that i exceeds N, sequentially acquiring the reserved characters from the 1st character to the Nth character included in the truncated Bluetooth device name and forming the updated Bluetooth device name.
[0108] In this embodiment, after the number of bytes corresponding to each character of the truncated Bluetooth device name is obtained, in order to obtain the byte type and integrity verification result corresponding to each character of the truncated Bluetooth device name, the byte number of each character is divided into single-byte type and multi-byte type, and the i-th character type of the i-th character in the truncated Bluetooth device name is obtained by traversal; wherein the value range of i is [1, N], and N is the total number of characters in the truncated Bluetooth device name. When it is determined that the i-th character type is a single-byte type, the i-th character in the truncated Bluetooth device name is retained; when it is determined that the i-th character type is a multi-byte type, the integrity verification result of the i-th character is obtained; if it is determined that the integrity verification result of the i-th character is that the integrity check passes, the i-th character in the truncated Bluetooth device name is retained; if it is determined that the integrity verification result of the i-th character is that the integrity check fails, the i-th character in the truncated Bluetooth device name is deleted; in addition, i is increased by 1 to update the value of i in real time; when it is determined that i does not exceed the total number of characters N in the truncated Bluetooth device name, it returns to execute the acquisition of the truncated Bluetooth device name. the step of determining the i-th character type of the i-th character in the name; when it is determined that i exceeds the total number of characters N in the truncated Bluetooth device name, sequentially obtaining the retained characters from the 1st character to the N-th character included in the truncated Bluetooth device name, thereby determining by traversal whether the character type corresponding to each character in the truncated Bluetooth device name is a multi-byte type; if the character is a multi-byte type, judging the integrity verification result of the character to determine whether to retain or delete the character, and then obtaining the updated Bluetooth device name to ensure that the updated Bluetooth device name obtained is not displayed as garbled characters in the human-computer interaction interface of the vehicle terminal.
[0109] In one embodiment, the multi-byte type unit includes:
[0110] an encoding sub-result obtaining unit, for obtaining an i-th encoding sub-result corresponding to the i-th character in the encoding result if it is determined that the i-th character type is a multi-byte type;
[0111] A complete encoding result unit, configured to determine that if it is determined that the i-th encoding sub-result is a complete encoding result, then the integrity verification result of the i-th character is integrity verification passed;
[0112] The incomplete encoding result unit is used to determine that if the i-th encoding sub-result is an incomplete encoding result, the integrity verification result of the i-th character is integrity check failure.
[0113] In this embodiment, after determining that the character type of the current character is a multi-byte type, it is necessary to obtain the integrity verification result of the current character; in specific implementation, if it is determined that the i-th character type is a multi-byte type, then the i-th encoding sub-result corresponding to the i-th character in the encoding result is obtained; if it is determined that the i-th encoding sub-result is a complete encoding result, then the integrity verification result of the i-th character is that the integrity check passed; if it is determined that the i-th encoding sub-result is not a complete encoding result, then the integrity verification result of the i-th character is that the integrity check failed, thereby judging whether the i-th character is a complete character through the above steps so that it can be retained or deleted later, thereby ensuring the normal display of the Bluetooth device name after the update.
[0114] The device solves the problem of garbled characters displayed on the human-computer interaction interface due to incomplete characters in the Bluetooth device name, and realizes the normal display of the Bluetooth device name.
[0115] The above-mentioned Bluetooth name truncation device can be implemented in the form of a computer program, and the computer program can be used in the following manner: Figure 3 Runs on the computer device shown.
[0116] See also Figure 3 , Figure 3 5 is a schematic block diagram of a computer device provided by an embodiment of the present invention. The computer device 500 is a server, which can be an independent server or a server cluster composed of multiple servers.
[0117] The computer device 500 includes a processor 502 , a memory, and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .
[0118] The non-volatile storage medium 503 may store an operating system 5031 and a computer program 5032. When the computer program 5032 is executed, the processor 502 may execute a Bluetooth name truncation method.
[0119] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .
[0120] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute the Bluetooth name truncation method.
[0121] The network interface 505 is used for network communication, such as providing data information transmission, etc. Those skilled in the art will understand that Figure 3The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present invention, and does not constitute a limitation on the computer device 500 to which the solution of the present invention is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0122] The processor 502 is used to run a computer program 5032 stored in the memory to implement the Bluetooth name truncation method disclosed in the embodiment of the present invention.
[0123] Those skilled in the art will understand that Figure 3 The embodiment of the computer device shown in the figure does not constitute a limitation on the specific composition of the computer device. In other embodiments, the computer device may include more or fewer components than those shown in the figure, or combine certain components, or arrange the components differently.
[0124] It should be understood that in the embodiment of the present invention, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0125] In another embodiment of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium may be a non-volatile computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the Bluetooth name truncation method disclosed in the embodiment of the present invention is implemented.
[0126] Those skilled in the art can clearly understand that, for the convenience and simplicity of description, the specific working process of the above-described equipment, devices and units can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here. Those of ordinary skill in the art can appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to the function. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present invention.
[0127] In the several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. Units with the same function may also be combined into one unit. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or units, or may be an electrical, mechanical or other form of connection.
[0128] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present invention.
[0129] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0130] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially 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. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), disk or optical disk and other media that can store program codes.
[0131] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A Bluetooth name truncation method, characterized in that: include: Get the name of the Bluetooth device and the byte length corresponding to the Bluetooth device name; If it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name; Encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result; Based on the encoding result, the character type of each character in the truncated Bluetooth device name is determined. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, the character is deleted from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
2. The Bluetooth name truncation method according to claim 1, characterized in that: The determining the character type of each character in the truncated Bluetooth device name based on the encoding result, if it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, then deleting the character from the truncated Bluetooth device name to obtain an updated Bluetooth device name, including: Obtaining the i-th character type of the i-th character in the truncated Bluetooth device name; wherein the initial value of i is 1, and the value range of i is [1, N], where N is the total number of characters in the truncated Bluetooth device name; If it is determined that the i-th character type is a single-byte type, retaining the i-th character in the truncated Bluetooth device name; If it is determined that the type of the i-th character is a multi-byte type, then the integrity verification result of the i-th character is obtained; If it is determined that the integrity verification result of the i-th character is that the integrity verification passes, the i-th character in the truncated Bluetooth device name is retained; If it is determined that the integrity verification result of the i-th character is that the integrity verification fails, deleting the i-th character in the truncated Bluetooth device name; Increase i by 1 to update the value of i; If it is determined that i does not exceed N, returning to the step of obtaining the i-th character type of the i-th character in the truncated Bluetooth device name; If it is determined that i exceeds N, the characters from the 1st character to the Nth character included in the truncated Bluetooth device name are sequentially obtained and the characters are used to form the updated Bluetooth device name.
3. The Bluetooth name truncation method according to claim 2, characterized in that: If it is determined that the i-th character type is a multi-byte type, obtaining the integrity verification result of the i-th character includes: If it is determined that the i-th character type is a multi-byte type, obtaining the i-th encoding sub-result corresponding to the i-th character in the encoding result; If it is determined that the i-th encoding sub-result is a complete encoding result, then the integrity verification result of the i-th character is integrity check passed; If it is determined that the i-th encoding sub-result is not a complete encoding result, the integrity verification result of the i-th character is that the integrity check fails.
4. The Bluetooth name truncation method according to claim 1, characterized in that: The obtaining the byte length corresponding to the Bluetooth device name includes: The byte lengths of the characters in the Bluetooth device name are obtained and summed to obtain the byte length corresponding to the Bluetooth device name.
5. The Bluetooth name truncation method according to claim 1, characterized in that: The step of truncating the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name includes: Get the byte length of the jth character in the Bluetooth device name; wherein the initial value of j is 1, and the value range of j is [1, M], where M is the total number of characters in the Bluetooth device name; Obtaining the historical cumulative character byte length, summing the byte length of the j-th character with the historical cumulative character byte length to update the historical cumulative character byte length; wherein, when j=1, the initial value of the historical cumulative character byte length is 0; If it is determined that the historical cumulative character byte length does not exceed the byte length threshold, retain the jth character; If it is determined that the historical cumulative character byte length exceeds the byte length threshold, the character content of the j-th character having a length corresponding to the difference between the historical cumulative character byte length and the byte length threshold is deleted, and concatenated with the 1st character to the j-th character in sequence to obtain a truncated Bluetooth device name; Increment j by 1 to update the value of j; If it is determined that j does not exceed M, return to the step of obtaining the byte length of the jth character in the Bluetooth device name; If it is determined that j exceeds M, the first character to the Mth character are obtained and sequentially concatenated to obtain a truncated Bluetooth device name.
6. The Bluetooth name truncation method according to claim 1, characterized in that: The step of encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result includes: The truncated Bluetooth device name is encoded using a Unicode encoding strategy corresponding to the encoding strategy to obtain an encoding result.
7. The Bluetooth name truncation method according to claim 1, characterized in that: After obtaining the Bluetooth device name and obtaining the byte length corresponding to the Bluetooth device name, the method further includes: If it is determined that the byte length corresponding to the Bluetooth device name does not exceed a preset byte length threshold, the Bluetooth device name is displayed.
8. A Bluetooth name truncation device, characterized in that: include: An acquiring unit, used to acquire a Bluetooth device name and acquire a byte length corresponding to the Bluetooth device name; a truncation unit, configured to, if it is determined that the byte length corresponding to the Bluetooth device name exceeds a preset byte length threshold, truncate the Bluetooth device name based on the byte length threshold to obtain a truncated Bluetooth device name; An encoding unit, used for encoding the truncated Bluetooth device name based on a preset encoding strategy to obtain an encoding result; A verification and updating unit is used to determine the character type of each character in the truncated Bluetooth device name based on the encoding result. If it is determined that the character type of a character in the truncated Bluetooth device name is a multi-byte type and it is determined that the integrity check of the character fails, the character is deleted from the truncated Bluetooth device name to obtain an updated Bluetooth device name.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the Bluetooth name truncation method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor executes the Bluetooth name truncation method according to any one of claims 1 to 7.
