Method for user-defined protocol equipment to access IoT platform based on Bluetooth BLE
By configuring the product function definition and instruction format table of the device in the cloud, and generating and converting protocol instructions on the vehicle terminal, the problem of hardware suppliers' custom protocol devices is difficult to access the IoT platform, and convenient access to the device and diversified product styles are achieved, improving the user experience.
Patent Information
- Application Number
- CN202311437605.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-31
- Publication Date
- 2025-05-02
AI Technical Summary
In the prior art, devices with customized protocols of hardware vendors are difficult to access the IoT platform, and need to undergo software or hardware modification to parse standard instruction formats, which limits the convenience of device access and the enthusiasm of hardware manufacturers.
By configuring the product function definition of the device and the standard instruction format table in the cloud and the supplier's customized instruction format table, the device establishes a Bluetooth connection with the vehicle terminal, generates a control page and standard protocol instructions, and converts the standard protocol instructions into custom protocol instructions and sends them to the corresponding device to realize the custom protocol access of the device.
It improves the convenience and efficiency of custom protocol devices to access IoT platforms, enhances the enthusiasm of hardware manufacturers to access the platform, enriches the diversity of platform product styles, and improves user experience.
Smart Images

Figure CN119922509A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Bluetooth communication, and more specifically, to a method for a Bluetooth BLE-based custom protocol device to access an IoT platform. Background Art
[0002] Smart devices installed in the car can be connected to the car computer via Bluetooth BLE. After the connection, the car computer sends Bluetooth commands to the device. After receiving the commands, the device executes corresponding actions, thereby realizing the control of the device by the car computer.
[0003] To achieve the above functions, the mainstream solution of the existing IoT platform is as follows:
[0004] First, define the functions of the products to be connected and the corresponding control command protocols (which we call standard protocol commands) on the IoT cloud platform. Manufacturers of such products develop corresponding products according to the standard protocol commands. Then, the vehicle computer downloads the standard protocol command data of the product from the IoT platform, develops the corresponding control buttons and generates the corresponding control commands based on these data. Finally, the device is connected to the vehicle computer via Bluetooth BLE. When the user clicks the control button on the vehicle computer, the application sends the corresponding control command to the corresponding device. After receiving the command, the device parses the command and then executes the corresponding action.
[0005] Based on the above solution, if a product wants to be connected to the IoT platform and be controlled by the vehicle computer, it must be developed according to the standard protocol instructions of the product, otherwise it cannot be connected to the vehicle computer.
[0006] However, many hardware equipment suppliers on the market currently develop their products according to their own instruction data formats (which we call hardware supplier custom protocols). They cannot recognize the standard protocol instructions sent by the vehicle computer, so they cannot be controlled by the vehicle computer, which is what we call being unable to access the IoT vehicle computer platform.
[0007] A product can only access the IoT platform through standard protocol instructions. Devices with custom protocols from hardware vendors need to go through software or even hardware modifications to parse the standard instruction format before they can access the IoT platform. This limits the convenience of devices with custom protocols from hardware vendors accessing the IoT platform, and also dampens the enthusiasm of hardware vendors to access the platform.
[0008] At the same time, there are more and more smart devices in cars, but these devices are produced by different manufacturers. Different manufacturers have their own instruction formats (hardware supplier custom protocols), so it is difficult to connect to the IoT platform. It is difficult to quickly connect devices with hardware suppliers' custom protocols to the IoT platform. Summary of the invention
[0009] The technical problem to be solved by the present invention is to provide a method for accessing an IoT platform with a custom protocol device based on Bluetooth BLE, which improves the efficiency of actual development, in view of the shortcomings of the above technical solutions.
[0010] The present invention provides a method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE, the method comprising the following steps:
[0011] S1, configure the product function definition of the device and the corresponding standard instruction format table and supplier customized instruction format table in the cloud, and send the standard instruction format table and supplier customized instruction format table to the vehicle end;
[0012] S2, the device establishes a Bluetooth connection with the vehicle terminal, the user clicks the control button on the vehicle terminal to generate a control page and a standard protocol instruction according to the product function definition and the standard instruction format table of the vehicle terminal application, and sends the standard protocol instruction to the corresponding device. When the device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the corresponding execution result is returned to the vehicle terminal application. If the execution is not successful, the step S3 operation is performed;
[0013] S3, converting the standard protocol instructions generated by the vehicle computer into custom protocol instructions, and sending the custom protocol instructions to the corresponding device. When the device receives the instructions, it parses and executes them. If the execution is successful, the execution result of the custom device is sent back to the vehicle computer. The vehicle computer converts the execution result into a standard protocol instruction, and the vehicle computer application recognizes that the custom device is executed successfully;
[0014] S4, when both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of successful execution of the standard device and successful execution of the custom device to the user.
[0015] In the method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE described in the present invention; in step S2, if a standard protocol instruction is sent to a standard device, the custom device mark of the standard device is N, then the standard instruction format is used, and the standard protocol instruction is sent directly to it.
[0016] In the method for accessing the IoT platform of a custom protocol device based on Bluetooth BLE described in the present invention; in the step S2, when the standard device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the result of the successful execution is returned to the vehicle-side application.
[0017] In the method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE described in the present invention; when sending a standard protocol instruction to the custom device in step S3, if the custom device mark of the custom device is Y, a custom instruction format is used, and the standard protocol instruction is converted into a custom instruction.
[0018] In the method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE described in the present invention; the conversion logic of converting the standard protocol instruction into a custom instruction in the step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device whose device ID is a custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
[0019] In the method for accessing the IoT platform of a custom protocol device based on Bluetooth BLE described in the present invention; in the step S3, when the custom device receives the converted custom instruction, it parses and executes it; if the custom device executes the instruction successfully, the result of successful execution is returned to the vehicle-side application.
[0020] In the method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE described in the present invention; in step S3, the result returned by the custom device is in a custom instruction format, and the result returned by the custom device needs to be converted into a result returned by a standard device.
[0021] In the method for accessing an IoT platform to a custom protocol device based on Bluetooth BLE described in the present invention; the conversion logic of converting the result returned by the custom device into the result returned by the standard device in the step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device whose device ID is the custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
[0022] In the method for accessing a custom protocol device based on Bluetooth BLE to an IoT platform described in the present invention; in the step S4, the vehicle-side application parses the standard instruction format and identifies that the custom device has been successfully executed; when both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of the successful execution of the standard device and the successful execution of the custom device to the user.
[0023] The method for accessing the IoT platform of a custom protocol device based on Bluetooth BLE of the present invention makes it more convenient for the supplier's custom protocol device to access the IoT platform through this solution, greatly improving the efficiency of product access to the platform, while also increasing the supplier's willingness to access. It transforms the devices that could only access standard protocol instructions in the past into devices that can adapt to access the supplier's custom protocol, greatly enriching the diversity of platform product styles and increasing the access volume of platform devices, so as to achieve the purpose of improving user experience. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 It is a flow chart of an embodiment of a method for connecting a custom protocol device based on Bluetooth BLE to an IoT platform according to the present invention. DETAILED DESCRIPTION
[0025] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0026] It should be noted that the terms "first", "second", etc. 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.
[0027] like Figure 1 The figure is a flow chart of a method embodiment of a method for a custom protocol device based on Bluetooth BLE to access an IoT platform of the present invention. A method for a custom protocol device based on Bluetooth BLE to access an IoT platform is provided, comprising the following steps:
[0028] In step S1, the product function definition of the device and the corresponding standard instruction format table and supplier-defined instruction format table are configured in the cloud, and the standard instruction format table and supplier-defined instruction format table are sent to the vehicle computer;
[0029] In step S2, the device establishes a Bluetooth connection with the vehicle terminal. The user clicks the control button on the vehicle terminal to generate a control page and a standard protocol instruction according to the product function definition and the standard instruction format table for the vehicle terminal application, and sends the standard protocol instruction to the corresponding device. When the device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the corresponding execution result is returned to the vehicle terminal application. If the execution is not successful, step S3 is performed;
[0030] In step S3, the standard protocol instruction generated by the vehicle-side is converted into a custom protocol instruction, and the custom protocol instruction is sent to the corresponding device. When the device receives the instruction, it parses and executes it. If the execution is successful, the execution result of the custom device is sent back to the vehicle-side. The vehicle-side converts the execution result into a standard protocol instruction, and the vehicle-side application recognizes that the custom device is executed successfully.
[0031] In step S4, after both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of successful execution of the standard device and successful execution of the custom device to the user.
[0032] In one embodiment, when sending a standard protocol instruction to a standard device in step S2, if the custom device flag of the standard device is N, a standard instruction format is used and the standard protocol instruction is directly sent to the standard device.
[0033] In one embodiment, in step S2, when the standard device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the result of the successful execution is returned to the vehicle-side application.
[0034] In one embodiment, when sending the standard protocol instruction to the custom device in step S3, if the custom device flag of the custom device is Y, a custom instruction format is used and the standard protocol instruction is converted into a custom instruction.
[0035] In one embodiment, the conversion logic for converting the standard protocol instruction into a custom instruction in step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device with the device ID as the custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
[0036] In one embodiment, in step S3, when the custom device receives the converted custom instruction, it parses and executes it; if the custom device executes the instruction successfully, it returns the result of successful execution to the vehicle-side application.
[0037] In one embodiment, in step S3, the result returned by the custom device is in a custom instruction format, and the result returned by the custom device needs to be converted into a result returned by a standard device.
[0038] In one embodiment, the conversion logic for converting the result returned by the custom device into the result returned by the standard device in step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device whose device ID is the custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
[0039] In one embodiment, in step S4, the vehicle-side application parses the standard instruction format and identifies that the custom device is executed successfully; when both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of the standard device execution success and the custom device execution success to the user.
[0040] Taking fragrance as an example, the product function definition of the fragrance and the corresponding standard protocol instructions are set on the cloud platform; if a fragrance with a custom protocol is connected, the data in the custom instruction format is configured on the corresponding product function.
[0041] Product function definition and standard instruction format table (Function):
[0042]
[0043] Table 1
[0044] The instruction format definition corresponding to the fragrance device (Device):
[0045]
[0046] Table 2
[0047] It should be noted that the ISTHR field in Table 2 marks whether the device is a custom protocol device. If the value is Y, then the instruction format must be set in THRCMD. If it is N, then THRCMD is NULL, and the CMD instruction in Table 1 is used.
[0048] The key codes of standard protocol instructions and vendor-defined instructions are as follows:
[0049]
[0050]
[0051]
[0052] When the user clicks the control button on the control page generated by the vehicle-side application, the vehicle-side application generates a command in a standard format. For example, if the user clicks "Open", the generated command is CE Ox1 EC; the vehicle-side application obtains all connected fragrances, including the custom fragrance T01 and the standard fragrance T02, and sends the standard command CE Ox1 EC to the connected standard fragrance devices and custom fragrances; when sending the standard command CE Ox1 EC to the standard fragrance T02, according to the custom command protocol, isThrid=N of the standard fragrance T02, so the standard command format is used, so the standard command CE Ox1EC is directly sent to it; after receiving the standard command CE Ox1 EC, the standard fragrance T02 parses CE Ox1 EC and executes it; after successful execution, the corresponding result command CE RS Ox1 01EC is returned to the vehicle-side application;
[0053] When sending the standard command CE Ox1 EC to the custom fragrance T01, according to the custom command protocol, isThrid=Y of the custom fragrance T01, then the custom command format is used, and the standard command CE Ox1 EC needs to be converted into the custom command AC O1 CA; the conversion logic is to first find the entity of the command cmd=CE Ox1 EC in the funtionList, and extract the information fid=1 from the entity; then find the device with devId=T01 in the deviceList, and then find the thridCmdList array from the data entity of T01; traverse the thridCmdList array, find the entity with fid=1, and read cmd=AC O1 CA from it; send the command AC O1 CA to the custom fragrance T01; after receiving the command, the custom fragrance T01 parses and executes it; if the custom fragrance T01 executes the command successfully, the return result is AC RS Ox1 Y AC; because the result returned by the custom fragrance T01 is not in the standard command format, it is necessary to convert AC RS Ox1 Y AC into CE RS Ox101EC, and the vehicle-side application parses CE RS Ox1 01EC, identifies that the custom fragrance is executed successfully; after all control instructions are executed and the return results are received, the vehicle-side application returns the results of the successful execution of the standard fragrance T02 and the successful execution of the custom fragrance T01 to the user.
[0054] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0055] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0056] Therefore, the above is only a preferred specific implementation mode of the present invention, and the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by any technician familiar with the technical field within the technical scope disclosed by the present invention should be covered within the protection scope of the present invention. The protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for accessing an IoT platform using a custom protocol device based on Bluetooth BLE, characterized in that: The method comprises the following steps: S1, configure the product function definition of the device and the corresponding standard instruction format table and supplier customized instruction format table in the cloud, and send the standard instruction format table and supplier customized instruction format table to the vehicle end; S2, the device establishes a Bluetooth connection with the vehicle terminal, the user clicks the control button on the vehicle terminal to generate a control page and a standard protocol instruction according to the product function definition and the standard instruction format table of the vehicle terminal application, and sends the standard protocol instruction to the corresponding device. When the device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the corresponding execution result is returned to the vehicle terminal application. If the execution is not successful, the step S3 operation is performed; S3, converting the standard protocol instructions generated by the vehicle computer into custom protocol instructions, and sending the custom protocol instructions to the corresponding device. When the device receives the instructions, it parses and executes them. If the execution is successful, the execution result of the custom device is sent back to the vehicle computer. The vehicle computer converts the execution result into a standard protocol instruction, and the vehicle computer application recognizes that the custom device is executed successfully; S4, when both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of successful execution of the standard device and successful execution of the custom device to the user.
2. The method for accessing the IoT platform by a custom protocol device based on Bluetooth BLE according to claim 1, characterized in that: In step S2, if the standard protocol instruction is sent to the standard device, and the custom device mark of the standard device is N, the standard instruction format is used, and the standard protocol instruction is directly sent to it.
3. The method for accessing the IoT platform by a custom protocol device based on Bluetooth BLE according to claim 2, characterized in that: In step S2, when the standard device receives the standard protocol instruction, it parses and executes it. If the execution is successful, the result of the successful execution is returned to the vehicle-side application.
4. The method for accessing an IoT platform with a custom protocol device based on Bluetooth BLE according to claim 3, characterized in that: When sending the standard protocol instruction to the custom device in step S3, if the custom device mark of the custom device is Y, the custom instruction format is used and the standard protocol instruction is converted into a custom instruction.
5. The method for accessing the IoT platform by a custom protocol device based on Bluetooth BLE according to claim 4, characterized in that: The conversion logic for converting the standard protocol instruction into a custom instruction in step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device whose device ID is a custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
6. The method for accessing the IoT platform by a custom protocol device based on Bluetooth BLE according to claim 5, characterized in that: In step S3, when the custom device receives the converted custom instruction, it parses and executes it; If the custom device executes the command successfully, the result of successful execution is returned to the vehicle-side application.
7. The method for accessing an IoT platform with a custom protocol device based on Bluetooth BLE according to claim 6, characterized in that: In step S3, the result returned by the custom device is in a custom instruction format, and the result returned by the custom device needs to be converted into the result returned by the standard device.
8. The method for accessing the IoT platform by a custom protocol device based on Bluetooth BLE according to claim 7, characterized in that: The conversion logic for converting the result returned by the custom device into the result returned by the standard device in step S3 is as follows: first find the entity of the instruction standard format instruction in the standard instruction format table, and extract the information with the function ID of 1 from the entity; then find the device whose device ID is the custom device in the supplier custom instruction format table, and then find the custom format instruction table array from the data entity of the custom device; traverse the custom format instruction table array, find the entity with the custom device as 1, and read the custom instruction format from it.
9. The method for accessing an IoT platform with a custom protocol device based on Bluetooth BLE according to claim 8, characterized in that: In step S4, the vehicle-side application parses the standard instruction format and identifies that the custom device is executed successfully; when both the standard protocol instruction and the custom protocol instruction are executed, the vehicle-side application returns the results of the standard device execution success and the custom device execution success to the user.
Citation Information
Cited By
Bluetooth connection method, device, equipment, vehicle, system and storage medium
CN120475386A