Bluetooth data processing method

By considering the size and end mode, data type and offset of Bluetooth data in the Bluetooth data processing method, a processing method suitable for different Bluetooth systems is provided, which solves the problem of high cost of Bluetooth system development and maintenance and achieves higher versatility and compatibility.

CN119653344APending Publication Date: 2025-03-18ROYPOW TECH CO LTD
View PDF 8 Cites 0 Cited by

Patent Information

Application Number
CN202510104969.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-22
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

During Bluetooth communication, it is difficult for the prior art to effectively process the large and end modes, data types and offsets of different Bluetooth data, resulting in high cost of Bluetooth system development and maintenance.

Method used

Provides a Bluetooth data processing method, which processes Bluetooth data based on the size and end mode, data type and offset of Bluetooth data, including reading, writing and conversion operations. This method is suitable for data processing of numeric types, string types and timestamp strings.

Benefits of technology

Through this method, the needs of different Bluetooth systems can be met, the universality and compatibility of processing methods can be improved, and development and maintenance costs can be reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119653344A_ABST
    Figure CN119653344A_ABST
Patent Text Reader

Abstract

The invention provides a Bluetooth data processing method. The method comprises the step of processing Bluetooth data based on a big and small end mode, a data type and an offset of the Bluetooth data. Based on the method and the device, the Bluetooth data can be processed based on the big and small end mode, the data type and the offset of the Bluetooth data, so that the requirements of different Bluetooth systems are met, and the universality and the compatibility of the processing method are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing, and in particular to a method for processing Bluetooth data. Background Art

[0002] In the process of Bluetooth communication, the processing of Bluetooth data is particularly important. However, there are many factors that affect the processing of Bluetooth data, and different data are processed in different ways, which brings great costs to the development and maintenance of Bluetooth systems. Summary of the invention

[0003] An embodiment of the present application provides a method for processing Bluetooth data.

[0004] In a first aspect, an embodiment of the present application provides a method for processing Bluetooth data, the method comprising: processing the Bluetooth data based on the big-endian and little-endian modes, data types, and offsets of the Bluetooth data.

[0005] Optionally, the Bluetooth data includes data of a numerical type and a string type and a timestamp string, and the processing of the Bluetooth data includes one or more of the following:

[0006] Read;

[0007] Write;

[0008] Convert.

[0009] Optionally, the reading of numerical data includes:

[0010] Get the original bytes of the data according to the offset and data type of the data;

[0011] Parse the original bytes to get the data according to the big-endian mode of the data.

[0012] Optionally, the writing of numerical data includes:

[0013] Determine the writing position of data according to the offset and data type of the data;

[0014] Write the data to the write location according to the data's big-endian mode.

[0015] Optionally, the conversion of the numeric type data is to convert the data into an ASCII string. Converting the data into an ASCII string includes:

[0016] Get the original bytes of the data according to the offset and data type of the data;

[0017] Convert raw bytes into an ASCII string according to the endianness of the data.

[0018] Optionally, string type data can be read by:

[0019] Get the original bytes of the data according to the offset and data type of the data;

[0020] Parse the raw bytes according to the endianness and encoding type of the data.

[0021] Optionally, string data can be written as follows:

[0022] Determine the writing position of data according to the offset and data type of the data;

[0023] Write the data to the write location according to the data's endianness and encoding type.

[0024] Optionally, the timestamp string is read including:

[0025] Read the raw bytes of the timestamp string according to the offset of the timestamp string;

[0026] Parse the original bytes according to the big-endian mode of the timestamp string to obtain the timestamp string;

[0027] Converts a timestamp string to a timestamp according to the target format.

[0028] Optionally, the timestamp string is written including:

[0029] Determine the writing position of the timestamp string according to the offset of the timestamp string;

[0030] Writes the timestamp string to the write location according to the timestamp string's endianness and encoding type.

[0031] Optionally, the processing of the Bluetooth data is performed based on the first byte array.

[0032] In a second aspect, an embodiment of the present application provides an electronic device, including:

[0033] The processing unit is used to process the Bluetooth data based on the big-endian and small-endian modes, data types and offsets of the Bluetooth data.

[0034] Optionally, the Bluetooth data includes data of a numerical type and a string type and a timestamp string, and the processing of the Bluetooth data includes one or more of the following:

[0035] Read;

[0036] Write;

[0037] Convert.

[0038] Optionally, if the processing of the Bluetooth data is to read data of a numerical type, the processing unit is used to:

[0039] Get the original bytes of the data according to the offset and data type of the data;

[0040] Parse the original bytes to get the data according to the big-endian mode of the data.

[0041] Optionally, if the processing of the Bluetooth data is to write data of a numerical type, the processing unit is used to:

[0042] Determine the writing position of data according to the offset and data type of the data;

[0043] Write the data to the write location according to the data's big-endian mode.

[0044] Optionally, if the processing of the Bluetooth data is to convert the numerical data into an ASCII character string, the processing unit is used to:

[0045] Get the original bytes of the data according to the offset and data type of the data;

[0046] Convert raw bytes into an ASCII string according to the endianness of the data.

[0047] Optionally, if the processing of the Bluetooth data is to read data of a string type, the processing unit is used to:

[0048] Get the original bytes of the data according to the offset and data type of the data;

[0049] Parse the raw bytes according to the endianness and encoding type of the data.

[0050] Optionally, if the processing of the Bluetooth data is to write string type data, the processing unit is used to:

[0051] Determine the writing position of data according to the offset and data type of the data;

[0052] Write the data to the write location according to the data's endianness and encoding type.

[0053] Optionally, if the processing of the Bluetooth data is to read the timestamp string, the processing unit is configured to include:

[0054] Read the raw bytes of the timestamp string according to the offset of the timestamp string;

[0055] Parse the original bytes according to the big-endian mode of the timestamp string to obtain the timestamp string;

[0056] Converts a timestamp string to a timestamp according to the target format.

[0057] Optionally, if the processing of the Bluetooth data is to write a timestamp string, the processing unit is configured to include:

[0058] Determine the writing position of the timestamp string according to the offset of the timestamp string;

[0059] Writes the timestamp string to the write location according to the timestamp string's endianness and encoding type.

[0060] Optionally, the processing of the Bluetooth data is performed based on the first byte array.

[0061] In a third aspect, an embodiment of the present application provides an electronic device comprising a memory, at least one processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method as described in any one of the above-mentioned first aspects is implemented.

[0062] In a fourth aspect, an embodiment of the present application 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 method as described in any one of the above-mentioned first aspects is implemented.

[0063] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on an electronic device, the electronic device executes any one of the methods described in the first aspect.

[0064] Based on the present application, Bluetooth data can be processed based on the big-endian and small-endian modes, data types and offsets of the Bluetooth data, thereby meeting the needs of different Bluetooth systems and helping to improve the versatility and compatibility of the processing method. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for describing the embodiments are briefly introduced below.

[0066] Figure 1 It is a flowchart of the method for processing Bluetooth data provided in an embodiment of the present application.

[0067] Figure 2 This is an example diagram of the method for processing Bluetooth data provided in an embodiment of the present application.

[0068] Figure 3 It is a schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0069] Figure 4 It is a structural schematic diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION

[0070] The technical solution of the embodiment of the present invention will be described below in conjunction with the accompanying drawings in the embodiment of the present invention.

[0071] In the process of Bluetooth communication, the processing of Bluetooth data is particularly important. However, there are many factors that affect the processing of Bluetooth data, and different data are processed in different ways, which brings great costs to the development and maintenance of Bluetooth systems.

[0072] For example, the storage mode of Bluetooth data will affect the processing of Bluetooth data. The storage mode of Bluetooth data can be divided into big-endian mode and little-endian mode. The big-endian and little-endian storage modes of Bluetooth data mainly involve the byte order of Bluetooth data, that is, the storage order of Bluetooth data in memory. Big-endian mode means that the high byte of the data is stored at the low address end, while the low byte is stored at the high address end. Little-endian mode means that the high byte of the data is stored at the high address end, while the low byte is stored at the low address end. The storage mode of Bluetooth data will vary depending on the selected Bluetooth module and development technology. Therefore, in Bluetooth communication, the big-endian and little-endian modes will affect the parsing and assembly of data packets.

[0073] For another example, the data type of Bluetooth data will also affect the processing of Bluetooth data. The data type of Bluetooth data can include numeric type (such as integer) and string type, and numeric type and string type are further divided into signed type and unsigned type. Different types of data have different data lengths, which can be 1 bit (Byte), 2Bytes, 4Bytes, etc.

[0074] Based on this, Figure 1 An embodiment of the present application provides a method for processing Bluetooth data, which may include step S110.

[0075] In step S110, the Bluetooth data is processed based on the big-endian and small-endian modes, data types, and offsets of the Bluetooth data. The big-endian and small-endian modes of the Bluetooth data can be determined based on a prior agreement. For example, the Bluetooth data of the same system can uniformly adopt the big-endian mode or the little-endian mode, or different types of Bluetooth data of the same system can also adopt different big-endian and small-endian modes. The data type of the Bluetooth data can also be determined based on a prior agreement, and the offset of the Bluetooth data can be determined based on the memory where the Bluetooth data is stored. For example, when the Bluetooth data is to be written into the memory, the amount of data before the write position is the offset of the Bluetooth data. For another example, when the Bluetooth data is to be read from the memory, the amount of data before the read position is the offset of the Bluetooth data.

[0076] The big-endian mode can be used to determine the storage order of Bluetooth data in the memory, the data type can be used to determine the byte length occupied by the Bluetooth data in the memory, and the offset can be used to determine the starting position of the Bluetooth data stored in the memory. Therefore, the write position of the data in the memory can be obtained according to the offset and data type of the data. Further, the write order of the data at its write position can be determined according to the big-endian mode of the data. Therefore, based on the big-endian mode, data type and offset of the Bluetooth data, it is possible to accurately determine how to access different Bluetooth data in the memory.

[0077] Optionally, the Bluetooth data may include data of a numerical type and a string type and a timestamp string, and the processing of the Bluetooth data may include one or more of the following: reading; writing; converting. The numerical type and the string type data may further include unsigned type and signed type. For the numerical type, the signed type data may be used to represent a positive number, a negative number or 0, while the unsigned type data may be used to represent a number greater than or equal to 0. For the string type, the signed type data may be used to represent a byte overflow, while the unsigned type data may be used to represent a byte not overflowing. The numerical type data may further include a 1-byte type, a 2-byte type, a 4-byte type, a multi-byte type, etc. according to the byte length. The reading of Bluetooth data may refer to reading Bluetooth data from the memory, and the writing of Bluetooth data may refer to writing Bluetooth data into the memory. The conversion of Bluetooth data may refer to the conversion between different data types, for example, from a numerical type to a string type.

[0078] Exemplarily, the processing of Bluetooth data may be performed based on the first byte array. For example, the first byte array may be a byte array (ByteArray), and the processing of Bluetooth data may be performed based on the method of ByteArray. For example, reading Bluetooth data may be reading data from a ByteArray. For another example, writing Bluetooth data may be writing data into a ByteArray and returning a new ByteArray.

[0079] Based on the present application, Bluetooth data can be processed based on the big-endian and small-endian modes, data types and offsets of the Bluetooth data, thereby meeting the needs of different Bluetooth systems and helping to improve the versatility and compatibility of the processing method.

[0080] It is worth noting that the processing of Bluetooth data can also consider the signed type and encoding type of the Bluetooth data. For example, for Bluetooth data of numeric type, the signed type determines whether the data can be represented as a negative value. For another example, for Bluetooth data of string type, the encoding type determines the conversion relationship between string data and binary data.

[0081] The following is a detailed introduction to the processing of different Bluetooth data.

[0082] Numeric Types

[0083] Optionally, reading of data of numerical type may include: obtaining the original bytes of the data according to the offset and data type of the data; parsing the original bytes according to the big-endian mode of the data to obtain the data. The write position of the data can be obtained according to the offset and data type of the data, thereby obtaining the original bytes of the data. Further, bit operations can be performed according to the big-endian mode to parse the original bytes. For example, when the data adopts the big-endian mode, the original bytes can be parsed according to the high byte at the low address end and the low byte at the high address end. Taking ByteArray as an example, when reading data of numerical type from ByteArray, the original bytes of the byte length corresponding to the data type can be read from the ByteArray starting from the offset, and then the original bytes are parsed according to the big-endian mode. Based on this, data of numerical type can be accurately read.

[0084] Optionally, writing of data of numerical type may include: determining the write position of the data according to the offset and data type of the data; writing the data to the write position of the data according to the big-endian mode of the data. The write position of the data in the memory can be obtained according to the offset and data type of the data. After obtaining the write position of the data, the data can be written to the memory according to the big-endian mode of the data. For example, when the data adopts the little-endian mode, the high byte can be written to the high address end and the low byte can be written to the low address end. Taking ByteArray as an example, when writing data of numerical type to ByteArray, the initial position of the position to be written is determined according to the offset, the byte length is determined according to the data type, and then the data of the byte length is written to the ByteArray from the initial position according to the big-endian mode, and a new ByteArray is returned. Based on this, data of numerical type can be written accurately.

[0085] Optionally, the conversion of data of numerical type may be to convert the data into an American Standard Code for Information Interchange (ASCII) string. Converting data of numerical type into an ASCII string may include: obtaining the original bytes of the data according to the offset and data type of the data; converting the original bytes into an ASCII string according to the big-endian mode of the data. Taking ByteArray as an example, when converting data of numerical type into an ASCII string based on ByteArray, the original bytes of the byte length corresponding to the data type may be read from the ByteArray starting from the offset (0≤offset≤ByteArray length), and then the original bytes may be parsed according to the big-endian mode. The map operator is then used to convert each element of the data into a character, and all the characters are assembled into a string. Based on this, data of numerical type may be accurately converted into an ASCII string.

[0086] String Type

[0087] Optionally, the reading of string type data may include: obtaining the original bytes of the data according to the offset and data type of the data; parsing the original bytes according to the big-endian mode and encoding type of the data. The encoding type of the string type determines the conversion relationship between the string data and the binary data, and may include: ASCII encoding, Unicode encoding, 8-bit unicode transformation format (8-bit unicode transformation format, UTF-8) encoding, etc. Therefore, after obtaining the original bytes of the string data, the binary data corresponding to the data can be obtained according to the big-endian mode of the data, and then the string can be parsed according to the encoding type. Taking ByteArray as an example, when reading string type data from ByteArray, the original bytes of the byte length corresponding to the data type can be read from the ByteArray from the offset, and then the original bytes can be parsed according to the big-endian mode and encoding type. Based on this, the string type data can be accurately read.

[0088] Optionally, writing of string type data may include: determining the write position of the data according to the offset and data type of the data; writing the data to the write position according to the big-endian mode and encoding type of the data. After determining the write position of the string data, the string can be converted into binary data according to the encoding type, and then the binary data is written to the write position according to the big-endian mode. Taking ByteArray as an example, when writing string type data to ByteArray, the initial position of the position to be written is determined according to the offset, the byte length is determined according to the data type, the string is converted into binary data according to the encoding type, and then the data is written to ByteArray according to the big-endian mode, and a new ByteArray is returned. Based on this, string type data can be written accurately.

[0089] Timestamp string

[0090] Optionally, reading the timestamp string may include: reading the original bytes of the timestamp string according to the offset of the timestamp string; parsing the original bytes according to the big-endian mode of the timestamp string to obtain the timestamp string; and converting the timestamp string into a timestamp according to the target format. It is worth noting that the timestamp string is usually stored in binary format, and its byte length is usually 4 bytes, so the original bytes can be obtained by reading 4 bytes of data after determining the starting position of the timestamp string in the memory according to the offset. After obtaining the original bytes, the original bytes can be parsed according to the big-endian mode to obtain the timestamp string, and the timestamp format needs to be converted after obtaining the timestamp string. As an example, the target format may be year / month / day. Taking ByteArray as an example, when reading the timestamp string from ByteArray, the initial position of the write position is determined according to the offset, 4 bytes of original bytes are obtained, and then the original bytes are parsed according to the big-endian mode and converted to the target format. It is worth noting that the timestamp string obtained by parsing according to the big-endian mode is generally in milliseconds, which can be multiplied by 1000 to obtain the timestamp string in seconds. Based on this, the timestamp string can be accurately read.

[0091] Optionally, writing of the timestamp string may include: determining the write position of the timestamp string according to the offset of the timestamp string; writing the timestamp string to the write position according to the big-endian and small-endian modes and the encoding type of the timestamp string. The timestamp string may be converted into a binary format according to the encoding type before being written into the memory, and then written into the memory according to the big-endian and small-endian modes after being converted into the binary format. Taking ByteArray as an example, when writing the timestamp string into the ByteArray, the initial position of the position to be written is determined according to the offset, the string is converted into binary data according to the encoding type, and then the binary data is written into the ByteArray according to the big-endian and small-endian modes, and a new ByteArray is returned. Based on this, the data of the timestamp string can be accurately written into the memory.

[0092] Combine the following Figure 2 , the method for processing Bluetooth data in an embodiment of the present application is introduced by way of example.

[0093] Figure 2 In, data types include numeric types and string types. Furthermore, numeric type Bluetooth data can be divided into 1-byte type, 2-byte type, 4-byte type, and multi-byte type according to the byte length. The offset size of different types of Bluetooth data is related to the memory data length. For example, the offset of 1-byte type data meets the following conditions: 0≤offset≤memory data length-1 byte. The memory data length here refers to the total length of data that can be stored in the memory. Different types of Bluetooth data may have different big-endian and small-endian modes and signed or unsigned types, and the encoding type of string type Bluetooth data may also be different.

[0094] Therefore, when processing Bluetooth data of numeric type, the data can be parsed according to its big-endian mode, offset, and whether it has a signed type. When processing Bluetooth data of string type, the data can be parsed according to its big-endian mode, offset, encoding type, and whether it has a signed type.

[0095] based on Figure 2 The method shown realizes the rapid positioning and writing of data based on the combination of big and small ends and offset, can meet the development of different Android Bluetooth communication protocols, and has universality and compatibility.

[0096] The method provided in the embodiment of the present application is described in detail above. The device provided in the embodiment of the present application is described in detail below with reference to the accompanying drawings.

[0097] See also Figure 3 , is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4The electronic device 300 shown may include a processing unit 310. The processing unit 310 may be used to process Bluetooth data based on the big-endian and little-endian modes, data types, and offsets of the Bluetooth data.

[0098] Optionally, the Bluetooth data may include data of a numerical type and a string type and a timestamp string, and the processing of the Bluetooth data may include one or more of the following: reading; writing; converting.

[0099] Optionally, if the processing of the Bluetooth data is to read data of a numerical type, the processing unit 310 may be configured to:

[0100] Get the original bytes of the data according to the offset and data type of the data;

[0101] Parse the original bytes to get the data according to the big-endian mode of the data.

[0102] Optionally, if the processing of the Bluetooth data is to write data of a numerical type, the processing unit 310 may be configured to:

[0103] Determine the writing position of data according to the offset and data type of the data;

[0104] Write the data to the write location according to the data's big-endian mode.

[0105] Optionally, if the processing of the Bluetooth data is to convert the numerical data into an ASCII character string, the processing unit 310 may be used to:

[0106] Get the original bytes of the data according to the offset and data type of the data;

[0107] Convert raw bytes into an ASCII string according to the endianness of the data.

[0108] Optionally, if the processing of the Bluetooth data is to read data of a character string type, the processing unit 310 may be configured to:

[0109] Get the original bytes of the data according to the offset and data type of the data;

[0110] Parse the raw bytes according to the endianness and encoding type of the data.

[0111] Optionally, if the processing of the Bluetooth data is to write string type data, the processing unit 310 may be used to:

[0112] Determine the writing position of data according to the offset and data type of the data;

[0113] Write the data to the write location according to the data's endianness and encoding type.

[0114] Optionally, if the processing of the Bluetooth data is to read the timestamp string, the processing unit 310 may be configured to include:

[0115] Read the raw bytes of the timestamp string according to the offset of the timestamp string;

[0116] Parse the original bytes according to the big-endian mode of the timestamp string to obtain the timestamp string;

[0117] Converts a timestamp string to a timestamp according to the target format.

[0118] Optionally, if the processing of the Bluetooth data is to write a timestamp string, the processing unit 310 may be configured to include:

[0119] Determine the writing position of the timestamp string according to the offset of the timestamp string;

[0120] Writes the timestamp string to the write location according to the timestamp string's endianness and encoding type.

[0121] Optionally, the processing of the Bluetooth data may be performed based on the first byte array.

[0122] The present application also provides an electronic device. Figure 4 As shown, the electronic device 400 includes: at least one processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the at least one processor 401. When the processor 401 executes the computer program 403, the method provided in the present application is implemented.

[0123] Exemplarily, the computer program 403 may be divided into one or more modules / units, one or more modules / units are stored in the memory 402, and executed by the processor 401 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program in the electronic device 400.

[0124] Those skilled in the art will understand that Figure 4 It is only an example of the electronic device 400 and does not constitute a limitation of the electronic device. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 400 may also include input and output devices, network access devices, buses, etc.

[0125] The processor 401 may be a central processing unit (CPU), or 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. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0126] The memory 402 may be an internal storage unit of the electronic device 400, such as a hard disk or memory of the electronic device 400. The memory 402 may also be an external storage device of the electronic device 400, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 400. Further, the memory 402 may also include both an internal storage unit of the electronic device 400 and an external storage device. The memory 402 is used to store computer programs and other programs and data required by the electronic device 400. The memory 402 may also be used to temporarily store data that has been output or is to be output.

[0127] The electronic device 400 provided in this embodiment can execute the above method embodiment, and its implementation principle and technical effect are similar, which will not be repeated here.

[0128] An embodiment of the present application further provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.

[0129] An embodiment of the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[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 computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above method embodiments, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by the processor, the steps of the above method embodiments can be implemented. Among them, the computer program includes computer program code, which can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the camera / electronic device, recording medium, computer memory, ROM (read-only memory), RAM (random access memory), CD-ROM (compact disc read-only memory), magnetic tape, floppy disk and optical data storage device. The computer-readable storage medium mentioned in the present application can be a non-volatile storage medium, in other words, a non-transient storage medium.

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

[0132] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed 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 be beyond the scope of this application.

[0133] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units 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 units, which can be electrical, mechanical or other forms.

[0134] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0135] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0136] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0137] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0138] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for processing Bluetooth data, characterized in that: include: The Bluetooth data is processed based on the big-endian and small-endian modes, data types and offsets of the Bluetooth data.

2. The method according to claim 1, characterized in that The Bluetooth data includes data of a numerical type and a string type and a timestamp string, and the processing of the Bluetooth data includes one or more of the following: Read; Write; Convert.

3. The method according to claim 2, characterized in that The reading of the data of the numerical type includes: Obtaining the original bytes of the data according to the offset and data type of the data; The data is obtained by parsing the original bytes according to the big-endian and little-endian modes of the data.

4. The method according to claim 2, characterized in that: The writing of the data of the numerical type includes: Determine a write position of the data according to an offset and a data type of the data; The data is written into the write location according to the big-endian and little-endian modes of the data.

5. The method according to claim 2, characterized in that: The conversion of the numerical data is to convert the data into an American Standard Code for Information Interchange (ASCII) string, and the conversion of the data into an ASCII string includes: Obtaining the original bytes of the data according to the offset and data type of the data; The original bytes are converted into the ASCII string according to the big-endian and small-endian modes of the data.

6. The method according to claim 2, characterized in that The reading of the string type data includes: Obtaining the original bytes of the data according to the offset and data type of the data; The raw bytes are parsed according to the big-endian and small-endian modes and the encoding type of the data.

7. The method according to claim 2, characterized in that The writing of the string type data includes: Determine a write position of the data according to an offset and a data type of the data; The data is written into the write location according to the big-endian and small-endian modes and the encoding type of the data.

8. The method according to claim 2, characterized in that: The reading of the timestamp string includes: Read the original bytes of the timestamp string according to the offset of the timestamp string; Parsing the original bytes according to the big-endian and little-endian modes of the timestamp string to obtain the timestamp string; Converts the timestamp string to a timestamp according to the target format.

9. The method according to claim 2, characterized in that: The writing of the timestamp string includes: Determine a writing position of the timestamp string according to an offset of the timestamp string; The timestamp character string is written into the write position according to the big-endian and small-endian modes and the encoding type of the timestamp character string.

10. The method according to any one of claims 1 to 9, characterized in that The processing of the Bluetooth data is performed based on the first byte array.

Citation Information

Patent Citations

  • Bluetooth equipment

    CN111556478A

  • Bluetooth equipment and firmware upgrading method and system thereof

    CN112291766A

  • Intelligent electric energy meter system based on Bluetooth communication and communication method thereof

    CN112399394A

  • Batch file processing method and device, electronic equipment and storage medium

    CN112925752A

  • Motion interaction method and system

    CN116736974A