Bluetooth chip adaptation method, device, equipment, medium and product
By introducing the adaptation layer and standardized interface, it solves the compilation problem of the Bluetooth chip when the protocol stack changes, realizes flexible switching of the protocol stack and reduces costs, and solves the problem of high R&D and maintenance costs in the existing technology.
Patent Information
- Application Number
- CN202410848877.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-27
- Publication Date
- 2024-10-08
AI Technical Summary
When the protocol stack of existing Bluetooth chips changes, the upper-layer application needs to recompile the code, resulting in increased R&D and maintenance costs, and it is impossible to achieve flexible switching of the protocol stack.
Introduce the concept of adaptation layer, obtain the target library file through a standardized interface, and call the target Bluetooth protocol stack through the target library file to realize the connection between the Bluetooth chip and the vehicle Bluetooth chip. The library file is only adjusted in the adaptation layer without recompiling the entire program. .
It achieves the decoupling of upper-layer applications and protocol stack software, supports flexible switching of protocol stacks when using Bluetooth chips, and reduces R&D and maintenance costs.
Smart Images

Figure CN118748848A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a Bluetooth chip adaptation method, device, equipment, medium and product. Background Art
[0002] The same Bluetooth chip can be adapted through different protocol stacks, and different protocol stack software defines different calling interfaces for upper-layer applications. Upper-layer applications need to adapt to different protocol stack software and maintain multiple sets of codes.
[0003] The upper-layer application and the protocol stack software are highly coupled. When the protocol stack supplier changes, the corresponding protocol stack software also changes. Accordingly, the upper-layer application also needs to modify its code to adapt to the new protocol stack software. Flexible switching of the protocol stack cannot be achieved, and R&D and maintenance costs are greatly increased. Summary of the invention
[0004] The present invention provides a Bluetooth chip adaptation method, device, equipment, medium and product, which realizes flexible switching of protocol stack when the Bluetooth chip is applied and reduces R&D and maintenance costs.
[0005] In a first aspect, an embodiment of the present disclosure provides a Bluetooth chip adaptation method, including:
[0006] Obtaining a chip adaptation request for a target vehicle-mounted Bluetooth chip, and determining a standardized interface corresponding to the chip adaptation request;
[0007] Accessing the corresponding adaptation layer based on the standardized interface and determining a target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request;
[0008] Calling a target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file;
[0009] The target Bluetooth protocol stack is connected to the target vehicle-mounted Bluetooth chip.
[0010] In a second aspect, an embodiment of the present disclosure provides a Bluetooth chip adapter device, including:
[0011] An adaptation interface determination module, which acquires a chip adaptation request for a target vehicle-mounted Bluetooth chip and determines a standardized interface corresponding to the chip adaptation request;
[0012] A library file adaptation module, which accesses the corresponding adaptation layer based on the standardized interface and determines the target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request;
[0013] A protocol stack adaptation module, which calls a target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file;
[0014] A Bluetooth chip connection module is connected to the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack.
[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, including:
[0016] at least one processor; and
[0017] a memory communicatively connected to at least one processor; wherein,
[0018] The memory stores a computer program that can be executed by at least one processor, and the computer program is executed by at least one processor so that the at least one processor can execute a Bluetooth chip adaptation method provided by the first aspect embodiment above.
[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a processor to implement a Bluetooth chip adaptation method provided in the embodiment of the first aspect above when executed.
[0020] In a fifth aspect, an embodiment of the present disclosure provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the computer program implements a Bluetooth chip adaptation method provided in the embodiment of the first aspect.
[0021] A Bluetooth chip adaptation method, device, equipment, medium and product of an embodiment of the present invention obtains a chip adaptation request for a target vehicle-mounted Bluetooth chip, and determines a standardized interface corresponding to the chip adaptation request; based on the standardized interface, the corresponding adaptation layer is accessed and a target library file of the adaptation layer is determined, wherein the target library file is loaded or updated based on the chip adaptation request; the target Bluetooth protocol stack corresponding to the chip adaptation request is called through the target library file; and the target vehicle-mounted Bluetooth chip is connected through the target Bluetooth protocol stack. The above technical scheme introduces the concept of an adaptation layer, and loads library files in the adaptation layer. When the Bluetooth protocol stack changes, only the corresponding adjustments to the library files need to be made in the adaptation layer without recompiling the entire program, and the upper-layer application does not need to be modified, thereby realizing the decoupling of the upper-layer application and the protocol stack software, and realizing the flexible switching of the protocol stack when the Bluetooth chip is applied, thereby reducing the R&D and maintenance costs.
[0022] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0024] Figure 1 is a flow chart of a Bluetooth chip adaptation method provided by Embodiment 1 of the present invention;
[0025] Figure 2 This is a schematic diagram of the overall interaction involved in a Bluetooth chip adaptation method provided in the first embodiment of the present invention;
[0026] Figure 3 is a flow chart of a Bluetooth chip adaptation method provided by Embodiment 2 of the present invention;
[0027] Figure 4 It is a schematic diagram of the selection of a standardized interface involved in a Bluetooth chip adaptation method provided in the second embodiment of the present invention;
[0028] Figure 5 It is a schematic diagram of the selection of an adaptation layer library file involved in a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention;
[0029] Figure 6 is a schematic diagram of an adaptation layer application involved in a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention;
[0030] Figure 7 is a schematic diagram of the structure of a Bluetooth chip adapter device provided in Embodiment 3 of the present invention;
[0031] Figure 8 It is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0032] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only 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 should fall within the scope of protection of the present invention.
[0033] It should be noted that the terms "first", "second" and "target" in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0034] Embodiment 1
[0035] Figure 1 This is a flowchart of a Bluetooth chip adaptation method provided in Example 1 of the present invention. This embodiment is applicable to the situation where the Bluetooth protocol stack is adapted for the target vehicle-mounted Bluetooth chip. The method can be executed by a Bluetooth chip adaptation device, and the Bluetooth chip adaptation device can be implemented in the form of hardware and / or software.
[0036] like Figure 1 As shown, the method includes:
[0037] S101: Obtain a chip adaptation request for a target vehicle-mounted Bluetooth chip, and determine a standardized interface corresponding to the chip adaptation request.
[0038] In this embodiment, the target vehicle-mounted Bluetooth chip can be understood as a Bluetooth chip to be adapted and connected, and the target vehicle-mounted Bluetooth chip is applied to the vehicle. The chip adaptation request can be understood as a request for protocol stack adaptation for the target vehicle-mounted Bluetooth chip, and the chip adaptation request includes at least one of the Bluetooth function, Bluetooth specification, Bluetooth version and required Bluetooth protocol stack type required by the client, or directly includes a specified Bluetooth protocol stack. The chip adaptation request is obtained through the upper-layer application, and the upper-layer application can be understood as an application that interacts with the user. The standardized interface can be understood as an application programming interface (Application Programming Interface, API) used to connect to the library file of the calling protocol stack software. In this embodiment, the standardized interface is connected to the adaptation layer, which defines the interaction method between the upper-layer application and the adaptation layer.
[0039] Specifically, a chip adaptation request for protocol stack adaptation for a target vehicle-mounted Bluetooth chip issued by a client is obtained, and based on the Bluetooth function, Bluetooth version, protocol stack type and other information contained in the chip adaptation request, a target Bluetooth protocol stack that meets the above content is determined, or when the chip adaptation request directly includes a specified Bluetooth protocol stack, the specified Bluetooth protocol stack is used as the target Bluetooth protocol stack, and the target Bluetooth protocol stack is the Bluetooth protocol stack to be connected and driven with the target vehicle-mounted Bluetooth chip in this embodiment. Each Bluetooth protocol stack has its predefined standardized interface. After the target Bluetooth protocol stack is determined, the standardized interface corresponding to the target Bluetooth protocol stack is determined based on the correspondence between each Bluetooth protocol stack and each standardized interface.
[0040] S102: Access the corresponding adaptation layer based on the standardized interface and determine the target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request.
[0041] In this embodiment, the adaptation layer can be understood as a layer for connecting upper-layer applications and protocol stack software. The adaptation layer usually includes necessary library files and configurations to support specific Bluetooth protocol stacks and functions. The target library file can be understood as a library file corresponding to the chip adaptation request and the standardized interface contained in the adaptation layer. The target library file at least includes the Bluetooth protocol stack code that can implement the functions required by the chip adaptation request or the Bluetooth protocol stack code specified by the chip adaptation request. The library file at least includes a shared library (so library) and a Java archive file (Jar library).
[0042] Specifically, based on the standardized interface, the adaptation layer matching the type of the standardized interface is accessed. For example, when the standardized interface is a native interface, the adaptation layer corresponding to the native interface is accessed, and the target library file corresponding to the chip adaptation request and the standardized interface is loaded or updated in the adaptation layer. The target library file is determined as follows: based on the language type and content of the chip adaptation request, the target library file matching the language type and content of the chip adaptation request is determined from the library file set. The target library file can be a so library, a jar library or other types of library files, and this embodiment does not limit this.
[0043] When the target vehicle-mounted Bluetooth chip has not been connected to any Bluetooth protocol stack, the target library file is directly loaded in the adaptation layer; when the target vehicle-mounted Bluetooth chip is currently connected to a Bluetooth protocol stack, the library file corresponding to the chip adaptation request is used as the target library file, and the adaptation layer library file is updated.
[0044] The above technical solution loads the target library file into the memory by means of dynamic loading or static linking, so that the adaptation layer can respond to the request of the upper layer application according to the functions provided by the standardized interface.
[0045] S103: calling a target Bluetooth protocol stack corresponding to the chip adaptation request through a target library file.
[0046] In this embodiment, the target Bluetooth protocol stack can be understood as a Bluetooth protocol stack that meets the requirements of the chip adaptation request, such as a Bluetooth protocol stack that meets at least one of the Bluetooth function, Bluetooth specification, Bluetooth version and Bluetooth protocol stack type included in the chip adaptation request, or can be understood as a Bluetooth protocol stack directly specified by the chip adaptation request.
[0047] Specifically, the target library file contains multiple Bluetooth protocol stack codes. The target Bluetooth protocol stack is known when the chip adaptation request is obtained. Therefore, the target Bluetooth protocol stack code is directly called from the target library file.
[0048] S104, connecting to the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack.
[0049] In this embodiment, the corresponding protocol stack software is connected through the interface corresponding to the target Bluetooth protocol stack, and the protocol stack software is used as a driver to connect to the target vehicle-mounted Bluetooth chip to implement the call of the target vehicle-mounted Bluetooth chip.
[0050] Figure 2 FIG. 1 is a schematic diagram of the overall interaction involved in a Bluetooth chip adaptation method provided in Embodiment 1 of the present invention. Figure 2 As shown, the upper layer application uses the target library file of the adaptation layer, calls the target Bluetooth protocol stack through the target library file, and connects with the Bluetooth chip through the protocol stack software of the target Bluetooth protocol stack to achieve the adaptation and calling of the Bluetooth chip.
[0051] A Bluetooth chip adaptation method provided by an embodiment of the present invention includes obtaining a chip adaptation request for a target vehicle-mounted Bluetooth chip, and determining a standardized interface corresponding to the chip adaptation request; accessing the corresponding adaptation layer based on the standardized interface and determining a target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request; calling a target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file; and connecting with the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack. The above technical solution introduces the concept of an adaptation layer, and loads library files in the adaptation layer. When adding, modifying or replacing library files due to changes in the protocol stack, only corresponding adjustments to the library files need to be made in the adaptation layer without recompiling the entire program, and the upper-layer application does not need to be modified, thereby realizing the decoupling of the upper-layer application and the protocol stack software, and realizing flexible switching of the protocol stack when the Bluetooth chip is applied, thereby reducing R&D and maintenance costs.
[0052] Embodiment 2
[0053] Figure 3It is a flowchart of a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention. This embodiment is a further optimization of any of the above embodiments and can be applied to the situation where the Bluetooth protocol stack is adapted for the target vehicle-mounted Bluetooth chip. The method can be executed by a Bluetooth chip adaptation device, and the Bluetooth chip adaptation device can be implemented in the form of hardware and / or software.
[0054] like Figure 3 As shown, the method includes:
[0055] S201: Obtain a chip adaptation request for a target vehicle-mounted Bluetooth chip.
[0056] S202: Determine the target Bluetooth protocol stack corresponding to the chip adaptation request.
[0057] In this embodiment, the chip adaptation request includes at least one of the Bluetooth function, Bluetooth specification, Bluetooth version and required Bluetooth protocol stack type required by the client, or directly includes a specified Bluetooth protocol stack. Therefore, the matching Bluetooth protocol stack can be determined directly based on the requirements corresponding to the chip adaptation request.
[0058] Specifically, when the chip adaptation request includes the required Bluetooth function, Bluetooth specification, Bluetooth version and Bluetooth protocol stack type, determine a Bluetooth protocol stack that matches the required Bluetooth function, Bluetooth specification, Bluetooth version and Bluetooth protocol stack type, and determine the Bluetooth protocol stack as the target Bluetooth protocol stack; or, when the chip adaptation request includes a specified Bluetooth protocol stack, determine the specified Bluetooth protocol stack as the target Bluetooth protocol stack.
[0059] S203: Determine a standardized interface corresponding to the chip adaptation request based on a predefined correspondence between the target Bluetooth protocol stack and the standardized interface.
[0060] In this embodiment, the standardized interface includes at least a native interface, an extended interface and a custom interface, wherein the native interface is a native interface generated by Google, the extended interface is a native interface that adds specific functions based on the native interface, and the custom interface is a brand-new native interface related to the functions corresponding to the actual needs of the user. Different Bluetooth protocol stack suppliers, some suppliers adapt to the native interface, some suppliers already have mature custom interfaces, and some suppliers have made their own extended interfaces based on the native interface. Different Bluetooth protocol stacks come from different protocol stack suppliers. There is a predefined two-to-two correspondence between the Bluetooth protocol stack, the supplier, and the standardized interface.
[0061] Specifically, based on the protocol stack supply attribute of the target Bluetooth protocol stack, the protocol stack supplier of the target Bluetooth protocol stack is determined, and then the standardized interface corresponding to the protocol stack supplier is determined.
[0062] Figure 4 FIG. 1 is a schematic diagram of a standardized interface selection involved in a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention. Figure 4 As shown, the upper layer application accesses the adaptation layer through a standardized interface, and the standardized interface is one of the native interface (GoogleNative), the extended interface (Google+Custom Native) and the custom interface (Custom Native).
[0063] S204: Access the corresponding adaptation layer based on the standardized interface, and determine the target library file corresponding to the chip adaptation request.
[0064] Figure 5 Schematic diagram of the selection of an adaptation layer library file involved in a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention; Figure 5 As shown, taking the library file as the so library as an example, the upper-layer application determines the corresponding adaptation layer based on the standardized interface. Figure 5 The three adaptation layers shown are respectively a native adaptation layer (libbluetooth_jni.so) corresponding to the native interface, an extended adaptation layer corresponding to the extended interface, and a custom adaptation layer corresponding to the custom interface. The corresponding adaptation layer is determined based on the type of the standardized interface.
[0065] Specifically, when the standardized interface is a native interface, the native adaptation layer is accessed through the native interface, wherein the native adaptation layer is used to store the protocol stack library file of the protocol stack supplier corresponding to the native interface; when the standardized interface is an extended interface, the extended adaptation layer is accessed through the extended interface, wherein the extended adaptation layer is used to store the protocol stack library file of the protocol stack supplier corresponding to the extended interface; when the standardized interface is a custom interface, the custom adaptation layer is accessed through the custom interface, wherein the custom adaptation layer is used to store the protocol stack library file of the protocol stack supplier corresponding to the custom interface. After accessing the corresponding adaptation layer, the target library file to be loaded or updated is determined based on the target Bluetooth protocol stack corresponding to the chip adaptation request.
[0066] Optionally, determine the target library file corresponding to the chip adaptation request, including:
[0067] S2041. Determine a target Bluetooth protocol stack corresponding to the chip adaptation request.
[0068] In this embodiment, determining the content of the target Bluetooth protocol stack corresponding to the chip adaptation request is consistent with the above step S202, which will not be described in detail herein.
[0069] S2042: Determine from the library file set a target library file that corresponds to the language of the chip adaptation request and contains a target Bluetooth protocol stack code.
[0070] In this embodiment, the chip adaptation request may correspond to a C-based language, such as C or C++, or may correspond to a Java Virtual Machine language (JVM), such as Java, Kotlin, Scala, Groovy, etc. When the chip adaptation request is in a C-based language, a shared library (so library) containing the code of the target Bluetooth protocol stack is determined from the library file set as the target library file; when the chip adaptation request is in a Java virtual machine language, a Java archive file (Jar library) containing the code of the target Bluetooth protocol stack is determined from the library file set as the target library file.
[0071] Figure 6 is a schematic diagram of an adaptation layer application involved in a Bluetooth chip adaptation method provided in Embodiment 2 of the present invention; Figure 6 As shown, if the library file is directly determined to be the so library, but the language corresponding to the chip adaptation request is the Java virtual machine language, the Java Native Interface (JNI) calls the Java code to form a target library file in the language corresponding to the chip adaptation request.
[0072] S205: Determine whether the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack.
[0073] In this embodiment, it is determined whether the target vehicle-mounted Bluetooth chip is currently driven by the Bluetooth protocol stack, or whether the adaptation layer accessed based on the standardized interface contains a library file. If so, it is determined that the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack. Otherwise, the target vehicle-mounted Bluetooth chip is not applying the Bluetooth protocol stack.
[0074] S206: If the target vehicle-mounted Bluetooth chip is not using the Bluetooth protocol stack, load the target library file in the adaptation layer.
[0075] In this embodiment, if the target vehicle-mounted Bluetooth chip is not using the Bluetooth protocol stack, then the target library file corresponding to the chip adaptation request (or the target Bluetooth protocol stack) can be directly loaded in the adaptation layer.
[0076] S207: If the target vehicle-mounted Bluetooth chip is applying a Bluetooth protocol stack, update the target library file in the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request.
[0077] In this embodiment, if the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack, the chip adaptation request at this time can be understood as a protocol stack replacement request, and it is necessary to determine whether the target library file needs to be updated in the adaptation layer based on the target Bluetooth protocol stack to be applied based on the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip.
[0078] Optionally, if the target vehicle-mounted Bluetooth chip is applying a Bluetooth protocol stack, the target library file is updated in the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request, including:
[0079] S2071. If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have the same protocol stack supply attribute, the current library file currently used by the adaptation layer is used as the target library file.
[0080] In this embodiment, the current Bluetooth protocol stack can be understood as the Bluetooth protocol stack currently used by the Bluetooth chip. The protocol stack supply attribute can be understood as the attribute information used to characterize the source supplier of the Bluetooth protocol stack. When the protocol stack supply attributes of two Bluetooth protocol stacks are consistent, it indicates that the two Bluetooth protocol stacks are derived from the same protocol stack supplier. The current library file can be understood as the library file corresponding to the current Bluetooth protocol stack used by the adaptation layer when the target vehicle-mounted Bluetooth chip uses the current Bluetooth protocol stack at the current moment.
[0081] Specifically, the same protocol stack supplier may use the same library file. Therefore, if the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have the same protocol stack supply attribute, it indicates that the current Bluetooth protocol stack and the target Bluetooth protocol stack are from the same protocol stack supplier. At this time, the current library file currently used by the adaptation layer also includes the code of the target Bluetooth protocol stack, which can implement the call of the target Bluetooth protocol stack. Therefore, when the current Bluetooth protocol stack and the target Bluetooth protocol stack have the same protocol stack supply attribute, the current library file currently used by the adaptation layer is directly used as the target library file, assuming that the update of the library file has been completed, and there is no need to actually update the library file.
[0082] S2072: If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have different protocol stack supply attributes, update the current library file currently used by the adaptation layer to the target library file corresponding to the target Bluetooth protocol stack.
[0083] In this embodiment, if the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have different protocol stack supply attributes, it indicates that the current Bluetooth protocol stack and the target Bluetooth protocol stack are from different protocol stack suppliers, and different protocol stack suppliers provide different library files, and the current library file currently used by the adaptation layer cannot implement the call of the target Bluetooth protocol stack code. Therefore, when the current Bluetooth protocol stack and the target Bluetooth protocol stack have different protocol stack supply attributes, the current library file currently being used by the adaptation layer is deleted, and the target library file corresponding to the chip adaptation request (or the target Bluetooth protocol stack) determined in step S204 is loaded to implement the update of the library file in the adaptation layer.
[0084] S208. Calling a target Bluetooth protocol stack corresponding to the chip adaptation request through a target library file.
[0085] S209: calling the target protocol stack software of the target Bluetooth protocol stack through the protocol stack interface provided by the target Bluetooth protocol stack, and connecting with the target vehicle-mounted Bluetooth chip through the target protocol stack software.
[0086] In this embodiment, the target protocol stack software can be understood as the protocol stack software corresponding to the target Bluetooth protocol stack, which is used to achieve connection with and drive the target vehicle-mounted Bluetooth chip.
[0087] Specifically, the target protocol stack software of the target Bluetooth protocol stack is connected through the protocol stack interface provided by the target Bluetooth protocol stack, and the target protocol stack software is called to connect with the target vehicle-mounted Bluetooth chip, so as to call and drive the target Bluetooth chip through the target protocol stack software. Among them, the protocol stack interface provided by the target Bluetooth protocol stack is related to the language corresponding to the chip adaptation request. When the language corresponding to the chip adaptation request is a C-based language, the target Bluetooth protocol stack provides a C / C++ interface. When the language corresponding to the chip adaptation request is a Java virtual machine language, the target Bluetooth protocol stack provides a Java / kotlin interface.
[0088] like Figure 6 As shown, the corresponding interface is called based on the language type of the target library file. When the target library file is an so library, the target Bluetooth protocol stack is called through the C++ interface, and the target protocol stack software is called through the C / C++ interface of the target Bluetooth protocol stack; when the target library file is a jar library determined after calling back to the Java layer based on JNI, the target Bluetooth protocol stack is called through Java, and the target protocol stack software is called through the Java / Kotlin interface of the target Bluetooth protocol stack.
[0089] A Bluetooth chip adaptation method provided by an embodiment of the present invention includes obtaining a chip adaptation request for a target vehicle-mounted Bluetooth chip; determining a target Bluetooth protocol stack corresponding to the chip adaptation request; determining a standardized interface corresponding to the chip adaptation request based on a predefined correspondence between the target Bluetooth protocol stack and the standardized interface; accessing a corresponding adaptation layer based on the standardized interface, and determining a target library file corresponding to the chip adaptation request; determining whether the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack; if the target vehicle-mounted Bluetooth chip is not applying the Bluetooth protocol stack, loading the target library file in the adaptation layer; if the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack, updating the target library file in the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request; calling the target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file; calling the target protocol stack software of the target Bluetooth protocol stack through the protocol stack interface provided by the target Bluetooth protocol stack, and connecting with the target vehicle-mounted Bluetooth chip through the target protocol stack software. The above technical solution introduces the concept of an adaptation layer and loads library files in the adaptation layer. When changes in the protocol stack cause the addition, modification or replacement of library files, it is only necessary to make corresponding adjustments to the library files in the adaptation layer without recompiling the entire program. The upper-layer application does not need to be modified, thereby achieving decoupling of the upper-layer application and the protocol stack software, and realizing flexible switching of the protocol stack when the Bluetooth chip is used, thereby reducing R&D and maintenance costs.
[0090] Embodiment 3
[0091] Figure 7 Schematic diagram of the structure of a Bluetooth chip adapter device provided by Embodiment 3 of the present invention. Figure 7 As shown, the device comprises:
[0092] The adaptation interface determination module 31 acquires a chip adaptation request for a target vehicle-mounted Bluetooth chip and determines a standardized interface corresponding to the chip adaptation request;
[0093] A library file adaptation module 32, which accesses the corresponding adaptation layer based on the standardized interface and determines the target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request;
[0094] The protocol stack adaptation module 33 calls the target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file;
[0095] The Bluetooth chip connection module 34 is connected to the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack.
[0096] The Bluetooth chip adapter device adopted in the technical solution introduces the concept of adaptation layer and loads library files in the adaptation layer. When the library files are added, modified or replaced due to changes in the protocol stack, it is only necessary to make corresponding adjustments to the library files in the adaptation layer without recompiling the entire program. The upper-layer application does not need to be modified, thus realizing the decoupling of the upper-layer application and the protocol stack software, realizing the flexible switching of the protocol stack when the Bluetooth chip is applied, and reducing the R&D and maintenance costs.
[0097] Optionally, the adaptation interface determination module 31 is specifically configured to:
[0098] Determining a target Bluetooth protocol stack corresponding to the chip adaptation request;
[0099] Based on the predefined correspondence between the target Bluetooth protocol stack and the standardized interface, a standardized interface corresponding to the chip adaptation request is determined.
[0100] Optionally, the library file adaptation module 32 includes:
[0101] A library file determination unit, configured to access the corresponding adaptation layer based on the standardized interface and determine a target library file corresponding to the chip adaptation request;
[0102] A protocol stack occupancy confirmation unit, used to determine whether the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack;
[0103] A library file loading unit, used for loading the target library file in the adaptation layer if the target vehicle-mounted Bluetooth chip is not applying the Bluetooth protocol stack;
[0104] The library file updating unit is used to update the target library file at the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request if the target vehicle-mounted Bluetooth chip is applying the Bluetooth protocol stack.
[0105] Optional, library file identification unit, specifically used for:
[0106] Determining a target Bluetooth protocol stack corresponding to the chip adaptation request;
[0107] A target library file corresponding to the language of the chip adaptation request and containing the target Bluetooth protocol stack code is determined from the library file set.
[0108] Optional, library file update unit, specifically used for:
[0109] If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have the same protocol stack provisioning attribute, the current library file currently used by the adaptation layer is used as the target library file;
[0110] If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip has different protocol stack supply attributes from the target Bluetooth protocol stack corresponding to the chip adaptation request, the current library file currently used by the adaptation layer is updated to the target library file corresponding to the target Bluetooth protocol stack.
[0111] Optionally, the Bluetooth chip connection module 34 is specifically used to: call the target protocol stack software of the target Bluetooth protocol stack through the protocol stack interface provided by the target Bluetooth protocol stack, and connect with the target vehicle-mounted Bluetooth chip through the target protocol stack software.
[0112] The Bluetooth chip adaptation device provided in the embodiment of the present invention can execute the Bluetooth chip adaptation method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0113] Embodiment 4
[0114] Figure 8 : is a structural schematic diagram of an electronic device provided in Embodiment 4 of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0115] like Figure 8 As shown, the electronic device 40 includes at least one processor 41, and a memory connected to the at least one processor 41, such as a read-only memory (ROM) 42, a random access memory (RAM) 43, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 41 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 42 or the computer program loaded from the storage unit 48 to the random access memory (RAM) 43. In the RAM 43, various programs and data required for the operation of the electronic device 40 can also be stored. The processor 41, the ROM 42, and the RAM 43 are connected to each other through a bus 44. An input / output (I / O) interface 45 is also connected to the bus 44.
[0116] A number of components in the electronic device 40 are connected to the I / O interface 45, including: an input unit 46, such as a keyboard, a mouse, etc.; an output unit 47, such as various types of displays, speakers, etc.; a storage unit 48, such as a disk, an optical disk, etc.; and a communication unit 49, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 49 allows the electronic device 40 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0117] The processor 41 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 41 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 41 executes the various methods and processes described above, such as a Bluetooth chip adaptation method.
[0118] In some embodiments, the Bluetooth chip adaptation method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 48. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 40 via the ROM 42 and / or the communication unit 49. When the computer program is loaded into the RAM 43 and executed by the processor 41, one or more steps of the Bluetooth chip adaptation method described above may be performed. Alternatively, in other embodiments, the processor 41 may be configured to perform the Bluetooth chip adaptation method in any other appropriate manner (e.g., by means of firmware).
[0119] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0120] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0121] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0122] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0123] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0124] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0125] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0126] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A Bluetooth chip adaptation method, It is characterized in that include: Obtaining a chip adaptation request for a target vehicle-mounted Bluetooth chip, and determining a standardized interface corresponding to the chip adaptation request; Accessing the corresponding adaptation layer based on the standardized interface and determining a target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request; Calling a target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file; The target Bluetooth protocol stack is connected to the target vehicle-mounted Bluetooth chip.
2. The method according to claim 1, It is characterized in that The determining of a standardized interface corresponding to the chip adaptation request includes: Determining a target Bluetooth protocol stack corresponding to the chip adaptation request; Based on the predefined correspondence between the target Bluetooth protocol stack and the standardized interface, a standardized interface corresponding to the chip adaptation request is determined.
3. The method according to claim 1, It is characterized in that The step of accessing the corresponding adaptation layer based on the standardized interface and determining the target library file of the adaptation layer includes: Accessing the corresponding adaptation layer based on the standardized interface, and determining a target library file corresponding to the chip adaptation request; Determine whether the target vehicle-mounted Bluetooth chip is applying a Bluetooth protocol stack; If the target vehicle-mounted Bluetooth chip is not using the Bluetooth protocol stack, loading the target library file in the adaptation layer; If the target vehicle-mounted Bluetooth chip is applying a Bluetooth protocol stack, the target library file is updated at the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request.
4. The method according to claim 3, It is characterized in that The determining of the target library file corresponding to the chip adaptation request includes: Determining a target Bluetooth protocol stack corresponding to the chip adaptation request; A target library file corresponding to the language of the chip adaptation request and containing the target Bluetooth protocol stack code is determined from the library file set.
5. The method according to claim 3, It is characterized in that If the target vehicle-mounted Bluetooth chip is applying a Bluetooth protocol stack, updating the target library file in the adaptation layer according to the current Bluetooth protocol stack being applied by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request includes: If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip and the target Bluetooth protocol stack corresponding to the chip adaptation request have the same protocol stack provisioning attribute, the current library file currently used by the adaptation layer is used as the target library file; If the current Bluetooth protocol stack being used by the target vehicle-mounted Bluetooth chip has different protocol stack supply attributes from the target Bluetooth protocol stack corresponding to the chip adaptation request, the current library file currently used by the adaptation layer is updated to the target library file corresponding to the target Bluetooth protocol stack.
6. The method according to claim 1, It is characterized in that The connecting with the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack includes: The target protocol stack software of the target Bluetooth protocol stack is called through the protocol stack interface provided by the target Bluetooth protocol stack, and is connected to the target vehicle-mounted Bluetooth chip through the target protocol stack software.
7. A Bluetooth chip adapter device, It is characterized in that include: An adaptation interface determination module, which acquires a chip adaptation request for a target vehicle-mounted Bluetooth chip and determines a standardized interface corresponding to the chip adaptation request; A library file adaptation module, which accesses the corresponding adaptation layer based on the standardized interface and determines the target library file of the adaptation layer, wherein the target library file is loaded or updated based on the chip adaptation request; A protocol stack adaptation module, which calls a target Bluetooth protocol stack corresponding to the chip adaptation request through the target library file; A Bluetooth chip connection module is connected to the target vehicle-mounted Bluetooth chip through the target Bluetooth protocol stack.
8. An electronic device, It is characterized in that include: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute a Bluetooth chip adaptation method according to any one of claims 1 to 6.
9. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement a Bluetooth chip adaptation method according to any one of claims 1 to 6 when executed.
10. A computer program product, It is characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the computer program implements a Bluetooth chip adaptation method according to any one of claims 1 to 6.
Citation Information
Cited By
Bluetooth chip adaptation method and apparatus, device, medium, and product
WO2026001147A1
