Communication method, device and system and storage medium
By differentiating command types and assigning priorities in Bluetooth communication, the problem of command delay caused by the lack of priority differentiation is solved, achieving high efficiency and stability in real-time control and improving the user's operating experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN MAMMOTION INNOVATION CO LTD
- Filing Date
- 2026-03-20
- Publication Date
- 2026-05-15
AI Technical Summary
In Bluetooth communication, the lack of command priority differentiation causes real-time control commands to have their transmission resources occupied by other functional commands, resulting in delays in command execution on the target mobile device.
By determining the instruction type and assigning a corresponding sending priority, a dynamic priority preemption mechanism is established to suspend the sending of low-priority instructions, ensure that high-priority instructions are sent first, and resume the sending of low-priority instructions in sequence after the high-priority instructions have ended.
It improves the real-time control response efficiency and system stability of target mobile devices, reduces latency issues, and enhances user experience and device reliability.
Smart Images

Figure CN122050123A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to communication methods, devices, systems, and storage media. Background Technology
[0002] In the Bluetooth control system of the target mobile device, the mobile terminal sends various control commands to the control terminal of the target mobile device via Bluetooth communication to realize remote control and management of the target mobile device.
[0003] In related technologies, various commands are treated as having the same priority at the transmission level. When the Bluetooth communication module issues commands, it sends a mixture of various commands to the processing queue of the target mobile device's control terminal. In high-frequency communication scenarios, a large number of command data packets are generated in the Bluetooth communication channel, resulting in a high command processing load on the command parsing and execution module of the target mobile device's control terminal. Furthermore, the lack of priority distinction among various commands causes commands with high real-time control requirements to have their transmission resources occupied by other commands, resulting in a delay in the execution of commands on the target mobile device. Summary of the Invention
[0004] This application provides a communication method, apparatus, system, and storage medium to solve the problem that the lack of instruction priority differentiation at the sending end leads to other functional instructions occupying transmission resources for real-time control instructions, causing delays in the execution of control instructions for the target mobile device.
[0005] In a first aspect, embodiments of this application provide a communication method applied to a terminal device, wherein the terminal device and a target mobile device establish a Bluetooth communication connection, the method comprising: In response to receiving a new instruction, determine the instruction type of the new instruction; Determine the instruction sending priority of the new instruction based on the instruction type; When the transmission priority of the new instruction is higher than that of all other currently untransmitted instructions, the transmission of all other currently untransmitted instructions is paused, and the new instruction is sent to the Bluetooth module of the target mobile device.
[0006] This application embodiment determines the instruction type of a new instruction and assigns a corresponding instruction sending priority based on the instruction type. By comparing the instruction sending priorities, when the instruction sending priority of the new instruction is higher than the instruction sending priorities of all other currently unsent instructions, the transmission of all other currently unsent instructions is paused, and the new instruction is sent to the Bluetooth module of the target mobile device. By establishing a dynamic priority preemption mechanism based on instruction type, instructions with critical or time-sensitive requirements can obtain the highest priority for transmission, thus solving the problem of delayed response caused by communication queue congestion and improving the real-time performance and response efficiency of the target mobile device control.
[0007] In one alternative implementation, the method further includes: Store all remaining unsent instructions into the buffer queue in the order they were received; After a new instruction is sent, if no new instruction is received within a preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other currently unsent instructions, the cached instructions in the cache queue are sent to the Bluetooth module of the target mobile device in sequence based on the cache order.
[0008] This application embodiment temporarily stores all other unsent instructions in a cache queue in sequence. After the high-priority instructions are sent and no subsequent high-priority instructions are involved, the instructions are sent according to the cache order in the cache queue so that the instructions in the cache queue are sent to the Bluetooth module of the target mobile device. By setting a caching mechanism, the sequential execution of instructions is achieved, and the continuity and stability of the communication process are realized at the same time.
[0009] In one alternative implementation, the method further includes: After a new instruction is sent, if the priority of a newly received instruction is higher than the priority of all other unsent instructions within a preset time, the newly received instruction will continue to be sent to the Bluetooth module of the target mobile device until the new instruction is sent. If no new instruction is received within the preset time or the priority of a newly received instruction is not higher than the priority of all other unsent instructions, the cached instructions in the cache queue will be sent to the Bluetooth module of the target mobile device in sequence according to the cache order.
[0010] In this embodiment, after the high-priority command is sent, the system continuously monitors for a preset time to see if a new command is received. If a new command is received, its command type and priority are determined. If the new command has a high priority, it continues to send the new command to the Bluetooth module of the target mobile device until the newly received command is sent and no new command is received within the preset time, or the sending priority of the newly received command is not higher than the sending priority of all other currently unsent commands. Then, all other unsent commands are sent sequentially according to the cache order of the cache queue. By setting a listening window, the system can respond to continuous high-priority commands, ensuring that the system always prioritizes the sending of high-priority commands. This solves the problem of delayed response caused by communication queue congestion, thus enabling the system to meet real-time requirements while maintaining the orderliness and accuracy of the command sending process.
[0011] In one alternative implementation, the method further includes: When the cache queue is detected to be empty, the newly received instruction is sent to the Bluetooth module of the target mobile device.
[0012] In this embodiment of the application, if the cache queue is detected to be empty after responding to a new instruction, the newly received instruction is sent to the Bluetooth module of the target mobile device. By determining whether the queue is empty, the sending process is simplified, thereby improving the efficiency of instruction transmission and the response speed of the system.
[0013] In one optional implementation, the cache instructions in the cache queue are sent to the Bluetooth module of the target mobile device sequentially based on the cache order, including: Based on the cache order, cache instructions in the cache queue are sent to the Bluetooth module of the target mobile device sequentially at preset time intervals.
[0014] In this embodiment of the application, when restoring instructions in the transmission buffer queue, the system not only follows the buffer order of the instructions, but also sends them one by one according to a preset time interval, thereby solving the problems of overload or processing conflicts at the target mobile device receiving end caused by continuous and rapid transmission of instructions, and realizing the stability and reliability of communication.
[0015] In one alternative implementation, determining the instruction type of the new instruction includes: The instruction content of the new instruction is parsed; When the parsing result indicates that the new instruction is related to the movement control of the target mobile device, the instruction type of the new instruction is determined to be a control instruction. If the parsing result indicates that the new instruction is unrelated to the mobile control of the target mobile device, then the instruction type of the new instruction is determined to be a function instruction.
[0016] This application embodiment parses the content of new instructions and distinguishes the instruction type based on whether the parsing result is related to the mobile control of the target mobile device. When the parsing result indicates that the new instruction is related to the mobile control of the target mobile device, the instruction type of the new instruction is determined to be a control instruction. When the parsing result indicates that the new instruction is not related to the mobile control of the target mobile device, the instruction type of the new instruction is determined to be a function instruction. This achieves accurate classification of instruction types and provides a clear and reliable basis for configuring priorities according to instruction types, thereby optimizing the management and control logic of the target mobile device.
[0017] In one optional implementation, the instruction transmission priority of a new instruction is determined based on the instruction type, including: When the instruction type is a control instruction, the instruction sending priority of the new instruction is determined to be the first sending priority; When the instruction type is a function instruction, the instruction sending priority of the new instruction is determined to be the second sending priority, and the first sending priority is higher than the second sending priority.
[0018] This application's embodiments assign different sending priorities to control commands and functional commands based on the command type classification results. Control commands are assigned a higher first sending priority, while functional commands are assigned a lower second priority. This ensures that key commands related to mobile control can be sent first and functional commands can be sent sequentially, thereby achieving real-time and smooth operation and control of the target mobile device, improving the responsiveness of vehicle control commands for the target mobile device, and ensuring the normal execution of functional commands.
[0019] Secondly, embodiments of this application provide a communication device applied to a terminal device, enabling Bluetooth communication between the terminal device and a target mobile device. The device includes: The receiving module is used to determine the instruction type of the new instruction in response to its receipt. The determination module is used to determine the instruction sending priority of a new instruction based on the instruction type. The sending module is used to pause sending all other currently unsent commands and send the new command to the Bluetooth module of the target mobile device when the command sending priority of the new command is higher than the command sending priority of all other currently unsent commands.
[0020] Thirdly, embodiments of this application provide a communication system, which includes: a terminal device and a target mobile device, wherein the terminal device and the target mobile device have a Bluetooth communication connection, and the terminal device includes: The memory and the processor are interconnected and communicate with each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the method described in the first aspect or any of its corresponding embodiments.
[0021] In one alternative implementation, the target mobile device is a lawnmower.
[0022] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer instructions for causing a computer to perform the method described in the first aspect or any corresponding embodiment. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0024] Figure 1This is a schematic diagram illustrating an application scenario according to one or more embodiments of this application; Figure 2 This is a schematic flowchart of a first communication method according to one or more embodiments of this application; Figure 3 This is a second flowchart illustrating a communication method according to one or more embodiments of this application; Figure 4 This is a structural block diagram of a communication device according to one or more embodiments of this application; Figure 5 This is a schematic diagram of the hardware structure of a terminal device according to one or more embodiments of this application. Detailed Implementation
[0025] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0026] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0027] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.
[0028] As one optional application scenario in the embodiments of this application, such as Figure 1 As shown, the communication system may include at least one terminal device and at least one server. Figure 1 The example illustrates that the system includes a target mobile device 101, a terminal device 102, and a server 103, and the target mobile device 101 and the terminal device 102 are connected to the server 103 via a network 110.
[0029] The target mobile device can autonomously execute pending tasks within the target environment without direct human intervention, using its built-in sensors, algorithms, and drive systems.
[0030] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.
[0031] For example, the target mobile device 101 and the terminal device 102 are connected via Bluetooth. The target mobile device 101 may be a lawnmower, and the terminal device 102 is used to execute the communication method. The overall process of the terminal device 102 executing the communication method is detailed in the relevant description of the method embodiment below, and will not be repeated here.
[0032] In traditional Bluetooth control systems for target mobile devices, the mobile terminal sends various commands to the control terminal of the target mobile device via Bluetooth communication to achieve remote control and management of the target mobile device. All vehicle control commands, i.e., commands related to the movement of the target mobile device or functional commands, are usually treated as having the same priority at the transmission level and processed using sequential or concurrent transmission methods. The Bluetooth communication module does not distinguish the importance of command types, but instead sends vehicle control commands mixed with other functional commands to the vehicle-side processing queue.
[0033] In traditional solutions, users often encounter problems such as "no response when pressing forward," "delayed steering," and "sudden vehicle stop" when controlling a lawnmower with their mobile phones. These problems are not caused by hardware failure, but by control failures due to excessively frequent command transmissions and congestion in the command processing queue during Bluetooth communication.
[0034] Taking a lawnmower as an example, a mobile terminal (such as an iOS app) sends various control commands to the lawnmower control unit via Bluetooth communication. These commands include real-time vehicle control commands such as forward, backward, left, and right movements, as well as functional commands such as device status queries, battery information reporting, parameter configuration, and working mode switching. Typically, these commands are continuously sent from the app to the device to enable remote control and management of the lawnmower. However, in complex scenarios, such as when the user is simultaneously controlling the lawnmower's movement while the app is also performing operations like device status synchronization, battery information reading, and map data uploading, a large number of command data packets are generated in the Bluetooth communication channel. These commands simultaneously enter the vehicle's command parsing and execution module, resulting in a high command processing load.
[0035] The Bluetooth vehicle control command transmission mechanism in related technologies has significant shortcomings. First, the lack of priority distinction between vehicle control commands and other function commands at the transmission level leads to real-time control commands being easily "crowded out" by other low-priority commands in high-frequency communication scenarios. Due to the limited bandwidth of Bluetooth communication and the vehicle's processing capabilities, when the number of commands surges in a short period of time, the vehicle cannot parse and execute all commands in a timely manner, resulting in command backlog or even loss.
[0036] Secondly, the vehicle's command processing capabilities are typically limited by the performance of embedded hardware and real-time task scheduling mechanisms. When a large number of non-vehicle control commands are mixed with vehicle control commands entering the processing queue, it can easily cause delays in the execution of real-time control commands. When users send forward, turn, or other operations through the app, the lawnmower may experience slow response, lag, or even no response, severely impacting the user experience.
[0037] In addition, frequent command sending will increase Bluetooth communication power consumption, affect device battery life, and may cause communication instability issues, such as packet loss, retransmission, or connection abnormalities.
[0038] To address the aforementioned issues, this embodiment analyzes the problems of poor real-time performance, response delay, and command congestion caused by the mixed transmission of vehicle control commands and other functional commands in a Bluetooth vehicle control scenario. It focuses on how to classify vehicle control commands and other functional commands, and how to prioritize and schedule different types of commands to ensure that vehicle control commands receive higher transmission priority during communication. A communication method is proposed that introduces a command transmission management mechanism at the terminal device level to prioritize and schedule different types of commands, thereby ensuring that vehicle control commands receive higher transmission priority during communication.
[0039] When the system detects that a user is performing real-time vehicle control operations (such as moving forward, backward, or turning), it will pause sending non-critical functional commands and temporarily store them in the command cache queue. After the vehicle control command is sent, the cached commands will be sent in an orderly manner according to the preset time interval, thereby solving communication congestion, realizing the real-time performance and stability of vehicle control commands, improving the lawnmower's response speed to user operations, and solving the problem of operation failure caused by command backlog.
[0040] In this embodiment, the target mobile device can be a semi-autonomous mobile device or a fully autonomous mobile device, such as any of the devices with target movement functions, such as lawnmower robots, pool robots, and sweeping robots.
[0041] According to an embodiment of this application, a communication method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0042] This embodiment provides a communication method that can be used as described above. Figure 1 The terminal device 102 shown is... Figure 2 This is a schematic flowchart of a first communication method according to an embodiment of this application, as shown below. Figure 2 As shown, the process includes the following steps: Step S201: In response to receiving a new instruction, determine the instruction type of the new instruction.
[0043] It should be noted that a new instruction refers to the most recently received instruction in terms of time. In remote control of a target mobile device via Bluetooth, the terminal device receives a new instruction and analyzes its content using an internal instruction analysis algorithm to determine the instruction type.
[0044] Taking lawnmowers as an example, the new instructions include, but are not limited to, forward, backward, left, and right movements for lawnmowers, which are real-time vehicle control instructions; as well as instructions for equipment status query, battery information reporting, parameter configuration, and working mode switching, which are functional instructions.
[0045] Step S202: Determine the instruction sending priority of the new instruction based on the instruction type.
[0046] It should be noted that command sending priority refers to the priority of the order in which new commands are sent to the target mobile device.
[0047] For example, taking a lawnmower as an example, the priority of sending real-time vehicle control commands such as moving forward, backward, left, and right, and the priority of sending functional commands such as device status query, battery information reporting, parameter configuration, and working mode switching are determined.
[0048] Step S203: When the transmission priority of the new instruction is higher than the transmission priority of all other currently unsent instructions, pause the transmission of all other currently unsent instructions and send the new instruction to the Bluetooth module of the target mobile device.
[0049] It should be noted that for each new instruction received, its instruction sending priority must be determined. When the instruction sending priority of the new instruction is higher than that of all other unsent instructions, the system will pause all other unsent instructions. If the instruction sending priority of the new instruction is not higher than that of all other unsent instructions, the instruction will wait to be sent according to the order in which the instructions were received, and the system will send all unsent instructions in a first-in-first-out order.
[0050] The terminal device and the target mobile device are connected via Bluetooth.
[0051] The communication method provided in this embodiment determines the instruction type of a new instruction and assigns a corresponding instruction sending priority based on the instruction type. By comparing the instruction sending priorities, when the instruction sending priority of the new instruction is higher than the instruction sending priorities of all other currently unsent instructions, the transmission of all other currently unsent instructions is paused, and the new instruction is sent to the Bluetooth module of the target mobile device. By establishing a dynamic priority preemption mechanism based on instruction type, instructions with critical or time-sensitive requirements can obtain the highest priority for transmission, effectively solving the problem of delayed response caused by communication queue congestion, thereby improving the real-time performance and response efficiency of the target mobile device control.
[0052] By optimizing the command scheduling mechanism, control commands are sent and executed with priority, ensuring that every user operation is responded to promptly by the lawnmower. Users experience a smoother and more precise control experience, avoiding safety hazards caused by misoperation. At the same time, reducing the accumulation and repeated transmission of disordered commands also lowers the pressure on Bluetooth communication, improving the overall stability of the system and allowing users to operate the equipment stably even in complex environments.
[0053] This embodiment provides a communication method that can be used as described above. Figure 1 The terminal device 102 shown is... Figure 3 This is a second flowchart illustrating the communication method according to an embodiment of this application, as shown below. Figure 3 As shown, the process includes the following steps: Step S301: In response to receiving a new instruction, determine the instruction type of the new instruction.
[0054] Specifically, step S301 includes: Step S3011: Parse the instruction content of the new instruction.
[0055] It should be noted that parsing the content of a new instruction involves disassembling the original data packet according to the communication protocol and converting it into an internal data structure that the device or system can understand and process. Before parsing the content of a new instruction, it is necessary to check whether the new instruction conforms to the basic data frame format, that is, whether it contains start and end bits. For example, the instruction header is parsed to obtain the instruction parsing result.
[0056] In this embodiment, the instruction content of a new instruction may include multiple control operations, such as a new instruction including moving forward a certain distance and then turning left at a certain angle.
[0057] Step S3012: When the parsing result indicates that the new instruction is related to the mobile control of the target mobile device, determine that the instruction type of the new instruction is a control instruction.
[0058] It should be noted that commands related to the movement control of the target mobile device refer to commands that can drive the target mobile device to move forward, backward, left or right and / or rotate, and perform real-time control operations on the position and / or attitude of the target mobile device.
[0059] Taking a lawnmower as an example, the control commands related to the movement control of a lawnmower include, but are not limited to, forward movement commands (forward commands), backward movement commands (backward commands), left movement commands, right movement commands, left turn commands, and right turn commands.
[0060] Step S3013: When the parsing result shows that the new instruction is unrelated to the mobile control of the target mobile device, determine that the instruction type of the new instruction is a function instruction.
[0061] It should be noted that instructions unrelated to the movement control of the target mobile device refer to instructions for non-real-time operations such as status queries, battery information synchronization, and motion parameter settings of the target mobile device.
[0062] In some alternative implementations, when a target mobile device that is in operation needs to adjust its movement parameters and the adjustment operation needs to be performed immediately by the target mobile device to avoid risks or obstacles, the parameter adjustment instruction is a control instruction; when it is necessary to set the parameters for the next movement task, the parameter setting instruction is a function instruction.
[0063] The communication method provided in this embodiment parses the content of new instructions and distinguishes the instruction type based on whether the parsing result is related to the mobility control of the target mobile device. When the parsing result indicates that the new instruction is related to the mobility control of the target mobile device, the instruction type of the new instruction is determined to be a control instruction. When the parsing result indicates that the new instruction is not related to the mobility control of the target mobile device, the instruction type of the new instruction is determined to be a function instruction. This achieves accurate classification of instruction types and provides a clear and reliable basis for subsequent priority configuration based on instruction type, thereby optimizing the management and control logic of the target mobile device.
[0064] Step S302: Determine the instruction sending priority of the new instruction based on the instruction type.
[0065] Specifically, step S302 includes: Step S3021: When the instruction type is a control instruction, determine the instruction sending priority of the new instruction as the first sending priority.
[0066] In this embodiment, taking a lawnmower as an example, control commands with high timeliness requirements are assigned a first sending priority.
[0067] It should be noted that in this embodiment, all control commands are sent with the highest priority. In some optional implementations of this embodiment, the control commands can be further prioritized to achieve optimized control of the target mobile device. The criteria for further prioritizing control commands can be based on the responsiveness of the control commands in the specific application scenario, such as based on factors like the security risk level and urgency of the control commands.
[0068] Step S3022: When the instruction type is a function instruction, determine the instruction sending priority of the new instruction as the second sending priority, where the first sending priority is higher than the second sending priority.
[0069] Specifically, non-timely operation commands are given a second sending priority so that the lawnmower can complete control commands first and function commands in sequence.
[0070] It should be noted that in this embodiment, all functional instructions are sent with the second priority. In some optional implementations of this embodiment, the functional instructions can be further prioritized to achieve optimized control of the target mobile device.
[0071] It should be noted that, taking a lawnmower as an example, due to the importance of the lawnmower's real-time safety and physical response, in this embodiment, control commands need to be assigned a first sending priority, that is, control commands are the highest priority commands; other functional commands are assigned a second sending priority to optimize the communication channel, thereby solving the problem of communication channel overload while realizing real-time control of the lawnmower's movement.
[0072] The communication method provided in this embodiment assigns different sending priorities to control commands and function commands based on the classification results of command types. Control commands are given a higher first sending priority, while function commands are given a lower second priority. This ensures that key commands related to mobile control can be sent first and function commands can be sent in sequence, thereby achieving real-time and smooth operation and control of the target mobile device, improving the responsiveness of vehicle control commands of the target mobile device, and ensuring the normal execution of function commands.
[0073] Step S303: When the transmission priority of the new command is higher than the transmission priority of all other currently untransmitted commands, pause the transmission of all other currently untransmitted commands and send the new command to the Bluetooth module of the target mobile device. For details, please refer to [link to relevant documentation]. Figure 2 Step S203 of the illustrated embodiment will not be described again here.
[0074] The communication method provided in this embodiment determines the instruction type of a new instruction and assigns a corresponding instruction sending priority based on the instruction type. By comparing the instruction sending priorities, when the instruction sending priority of the new instruction is higher than the instruction sending priorities of all other currently unsent instructions, the transmission of all other currently unsent instructions is paused, and the new instruction is sent to the Bluetooth module of the target mobile device. By establishing a dynamic priority preemption mechanism based on instruction type, instructions with critical or time-sensitive requirements can obtain the highest priority for transmission, effectively solving the problem of delayed response caused by communication queue congestion, thereby improving the real-time performance and response efficiency of the target mobile device control.
[0075] Step S304: Store all remaining unsent instructions into the buffer queue in the order they were received.
[0076] It should be noted that when the system detects that control commands are being continuously sent, other function commands are not sent immediately, but are stored in a buffer queue in sequence and sent after the control commands have finished being sent.
[0077] Step S305: After the new instruction is sent, if no new instruction is received within a preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions, the cached instructions in the cache queue are sent to the Bluetooth module of the target mobile device in sequence based on the cache order.
[0078] It should be noted that after a new command is sent, the system checks whether a new command has been received. If a new command is received, its command type is parsed. If the new command's sending priority is not higher than the sending priority of all other currently unsent commands, the command is first cached in a cache queue. Then, the cached commands in the cache queue are sent to the target mobile device's Bluetooth module in the order they are cached. Alternatively, if no new command is received after the new command is sent, the cached commands in the cache queue are sent to the target mobile device's Bluetooth module in the order they are cached.
[0079] Setting a preset time is beneficial in two ways: firstly, it helps the system determine whether the operation has ended in mixed scenarios of continuous control or single control; secondly, when a new instruction is sent through multiple data packets, it allows a certain time window to determine whether all content has been sent, ensuring that all content of the new instruction has been sent.
[0080] The cache management method for all other unsent instructions cached in the cache queue is a first-in-first-out (FIFO) management method. The cached instructions are stored in the order they are received, and when they are sent, the cached instructions are managed in the order that the stored instructions are sent first, to ensure the correctness of the instruction order.
[0081] The communication method provided in this embodiment temporarily stores all other unsent instructions in a cache queue in sequence. After the high-priority instructions are sent and no subsequent high-priority instructions are involved, the instructions are resumed to be sent according to the cache order of the cache queue so that the instructions in the cache queue are sent to the Bluetooth module of the target mobile device. By setting a caching mechanism, the sequential execution of instructions is achieved, and the continuity and stability of the communication process are realized at the same time.
[0082] Step S306: After the new instruction is sent, if the sending priority of the newly received instruction is higher than the sending priority of all other unsent instructions within a preset time, the newly received instruction will continue to be sent to the Bluetooth module of the target mobile device until the new instruction is sent. If no new instruction is received within the preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions, the cached instructions in the cache queue will be sent to the Bluetooth module of the target mobile device in sequence according to the cache order.
[0083] It should be noted that after a new instruction is sent, it is determined whether a new instruction has been received. If a new instruction is received, the instruction type of the newly received instruction is parsed, and the newly received instruction is sent if the sending priority of the new instruction is higher than the sending priority of all other unsent instructions. All other unsent instructions continue to wait in the buffer queue.
[0084] The communication method provided in this embodiment continuously monitors for new commands within a preset time after the high-priority command is sent. If a new command is received, its command type and priority are determined. If the new command has a high priority, it continues to send the new command to the Bluetooth module of the target mobile device until the newly received command is sent. If no new command is received within the preset time or the sending priority of the newly received command is not higher than the sending priority of all other unsent commands, all other unsent commands are sent sequentially according to the cache order of the cache queue. By setting a listening window, the system can respond to continuous high-priority commands, ensuring that the system always sends high-priority commands first. This solves the problem of delayed response caused by communication queue congestion, thus enabling the system to meet real-time requirements while maintaining the orderliness and accuracy of the command sending process.
[0085] Specifically, step S306 includes: Step a1: Based on the cache order, send the cache instructions in the cache queue to the Bluetooth module of the target mobile device sequentially at preset time intervals.
[0086] It should be noted that after the vehicle control command is sent, the system sends the function commands in the buffer queue sequentially at fixed time intervals to avoid sending too many commands at once. For example, the fixed time interval is 70 milliseconds.
[0087] The communication method provided in this embodiment, when restoring instructions in the transmission buffer queue, not only follows the buffer order of instructions, but also sends them one by one according to a preset time interval, thereby solving the problems of overload or processing conflicts at the target mobile device receiving end caused by continuous and rapid transmission of instructions, and realizing the stability and reliability of communication.
[0088] Step S307: In response to detecting that the cache queue is empty, the newly received instruction is sent to the Bluetooth module of the target mobile device.
[0089] It should be noted that if a new command is received and the buffer queue is detected to be empty, the newly received command will be sent to the Bluetooth module of the target mobile device. Alternatively, if a new command is received after all commands in the buffer queue have been sent, the new command will be sent to the Bluetooth module of the target mobile device.
[0090] The communication method provided in this embodiment, when responding to a new instruction, if the cache queue is detected to be empty, sends the newly received instruction to the Bluetooth module of the target mobile device. By determining whether the queue is empty, the sending process is simplified, thereby improving the efficiency of instruction transmission and the system response speed.
[0091] As a specific application embodiment of this application, the implementation scheme of this embodiment is described using a lawnmower as an example.
[0092] The implementation steps include: listening to user input, determining whether a vehicle control command (control command) is generated, and when a vehicle control command is detected, immediately sending the command to the lawnmower's Bluetooth module, while pausing the sending of function commands and caching the function commands in the cache queue.
[0093] After the control command is sent, if the new command received is also a control command, then control commands will continue to be sent to ensure the real-time operation and control of the lawnmower.
[0094] After control commands are sent, a timer is started to retrieve functional commands from the buffer queue at 70-millisecond intervals and send them sequentially. A first-in, first-out (FIFO) approach is used to manage the buffered commands, ensuring the correct command order. Once all buffered commands have been sent, normal command sending mode resumes. This mechanism guarantees that the Bluetooth communication channel always prioritizes the real-time control needs of the lawnmower.
[0095] The instructions are categorized into two main types: "vehicle control instructions" and "function instructions". Vehicle control instructions include, but are not limited to, instructions for real-time control operations such as moving forward, backward, turning left, and turning right; function instructions include, but are not limited to, instructions for non-real-time operations such as status query, battery information synchronization, and parameter setting.
[0096] Vehicle control commands are given the highest priority. Once a vehicle control command is received, it will immediately enter the sending queue and be sent first.
[0097] When the system detects that it is continuously sending vehicle control commands, other functional commands are no longer sent immediately, but are stored in a buffer queue to wait.
[0098] After the vehicle control command is sent, the system sends the function commands in the buffer queue sequentially at fixed time intervals to avoid sending too many commands at once.
[0099] Cache instructions are managed using a first-in, first-out (FIFO) approach to ensure the correctness of the instruction order.
[0100] The instruction scheduling optimization scheme in this embodiment enables the Bluetooth vehicle control system to maintain good real-time response capabilities even under high instruction load scenarios.
[0101] Test results show that the average response latency of vehicle control commands is significantly reduced, and the vehicle responds more quickly and stably to operations such as forward movement and steering. Simultaneously, because non-critical commands are sent in an orderly, batch manner, the instantaneous load on the Bluetooth communication link is significantly reduced, resulting in a marked decrease in command loss and retransmission rates. The workload of the vehicle-side command processing module also decreases accordingly, improving the overall stability of the system.
[0102] In terms of user experience, operating the lawnmower is smoother, reducing misoperation and safety risks, improving the product's professionalism and reliability, and possessing high engineering application value and patent protection value.
[0103] This embodiment also provides a communication device for implementing the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can refer to a combination of software and / or hardware that performs a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0104] This embodiment provides a communication device, such as... Figure 4 As shown, it includes: The receiving module 401 is used to determine the instruction type of the new instruction in response to receiving a new instruction; The determination module 402 is used to determine the instruction sending priority of a new instruction based on the instruction type; The transmitting module 403 is used to pause the transmission of all other currently untransmitted commands and send the new command to the Bluetooth module of the target mobile device when the command transmission priority of the new command is higher than the command transmission priority of all other currently untransmitted commands.
[0105] In some alternative implementations, the receiving module 401 includes: The parsing unit is used to parse the instruction content of a new instruction.
[0106] The first determining unit is used to determine whether the instruction type of the new instruction is a control instruction when the parsing result indicates that the new instruction is related to the mobile control of the target mobile device.
[0107] The second determining unit is used to determine whether the instruction type of the new instruction is a function instruction when the parsing result indicates that the new instruction is unrelated to the movement control of the target mobile device.
[0108] In some alternative implementations, the determining module 402 includes: The first priority determination unit is used to determine the instruction transmission priority of a new instruction as the first transmission priority when the instruction type is a control instruction.
[0109] The second priority determination unit is used to determine the instruction sending priority of a new instruction as the second sending priority when the instruction type is a function instruction, and the first sending priority is higher than the second sending priority.
[0110] In some alternative embodiments, the device includes: The storage module is used to store all remaining unsent instructions into the buffer queue in the order they were received.
[0111] The cached instruction sending module is used to send the cached instructions in the cache queue to the Bluetooth module of the target mobile device in sequence based on the cache order if no new instruction is received within a preset time after the new instruction is sent or if the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions.
[0112] The first sending module is used to continue sending the newly received instruction to the Bluetooth module of the target mobile device after the new instruction has been sent. If the sending priority of the newly received instruction is higher than the sending priority of all other unsent instructions within a preset time, the module continues to send the newly received instruction to the Bluetooth module of the target mobile device until the new instruction has been sent. If no new instruction is received within the preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions, the module sends the cached instructions in the cache queue to the Bluetooth module of the target mobile device in sequence according to the cache order.
[0113] The second sending module is used to send newly received instructions to the Bluetooth module of the target mobile device in response to detecting that the buffer queue is empty.
[0114] In some alternative implementations, the first transmitting module includes: The transmitting subunit is used to send cached instructions in the cache queue to the Bluetooth module of the target mobile device sequentially according to the cache order and at preset time intervals.
[0115] The communication device provided in this application embodiment can execute the communication method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing the method. Further functional descriptions of the various modules and units described above are the same as those in the corresponding embodiments described above, and will not be repeated here.
[0116] Figure 5 This is a schematic diagram of the structure of a terminal device provided in an embodiment of this application.
[0117] The following is a detailed reference. Figure 5This diagram illustrates a suitable structural design for implementing the terminal device described in the embodiments of this application. The terminal device may include a processor (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes based on a program stored in read-only memory (ROM) 502 or a program loaded from memory 508 into random access memory (RAM) 503. RAM 503 also stores various programs and data required for the operation of the terminal device. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.
[0118] Typically, the following devices can be connected to I / O interface 505: input devices 506 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 507 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 508 including, for example, magnetic tapes, hard disks, etc.; and communication devices 509. Communication device 509 allows the terminal device to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 5 Terminal devices with various means are shown, but it should be understood that it is not required to implement or have all the means shown, and more or fewer means may be implemented or have instead.
[0119] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication device 509, or installed from memory 508, or installed from ROM 502. When the computer program is executed by processor 501, it performs the functions defined in the communication method of embodiments of this application.
[0120] Figure 5 The terminal device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.
[0121] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the communication methods shown in the above embodiments are implemented.
[0122] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.
[0123] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.
Claims
1. A communication method applied to a terminal device, wherein the terminal device and a target mobile device are connected via Bluetooth communication, characterized in that, The method includes: In response to receiving a new instruction, determine the instruction type of the new instruction; Based on the instruction type, determine the instruction sending priority of the new instruction; When the transmission priority of the new instruction is higher than that of all other currently untransmitted instructions, the transmission of all other currently untransmitted instructions is paused, and the new instruction is sent to the Bluetooth module of the target mobile device.
2. The method according to claim 1, characterized in that, The method further includes: Store all remaining unsent instructions into the buffer queue in the order they were received; After the new instruction is sent, if no new instruction is received within a preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions, the cached instructions in the cache queue are sent to the Bluetooth module of the target mobile device in sequence based on the cache order.
3. The method according to claim 2, characterized in that, The method further includes: After the new instruction is sent, if the sending priority of the newly received instruction is higher than the sending priority of all other unsent instructions within a preset time, the newly received instruction will continue to be sent to the Bluetooth module of the target mobile device until the new instruction is sent. If no new instruction is received within the preset time or the sending priority of the newly received instruction is not higher than the sending priority of all other unsent instructions, the cached instructions in the cache queue will be sent to the Bluetooth module of the target mobile device in sequence according to the cache order.
4. The method according to claim 3, characterized in that, The method further includes: When the cache queue is detected to be empty, the newly received instruction is sent to the Bluetooth module of the target mobile device.
5. The method according to claim 3, characterized in that, The step of sending cached instructions from the cache queue to the Bluetooth module of the target mobile device sequentially based on cache order includes: Based on the cache order, cache instructions in the cache queue are sent to the Bluetooth module of the target mobile device sequentially at preset time intervals.
6. The method according to any one of claims 1-5, characterized in that, The step of determining the instruction type of the new instruction includes: The instruction content of the new instruction is parsed; When the parsing result indicates that the new instruction is related to the mobile control of the target mobile device, the instruction type of the new instruction is determined to be a control instruction. If the parsing result indicates that the new instruction is unrelated to the mobile control of the target mobile device, then the instruction type of the new instruction is determined to be a function instruction.
7. The method according to claim 6, characterized in that, The step of determining the instruction sending priority of the new instruction based on the instruction type includes: When the instruction type is a control instruction, the instruction sending priority of the new instruction is determined to be the first sending priority; When the instruction type is a function instruction, the instruction sending priority of the new instruction is determined to be the second sending priority, where the first sending priority is higher than the second sending priority.
8. A communication device applied to a terminal device, wherein the terminal device and a target mobile device are connected via Bluetooth communication, characterized in that, The device includes: A receiving module is configured to determine the instruction type of the new instruction in response to receiving a new instruction; The determining module is used to determine the instruction sending priority of the new instruction based on the instruction type; The sending module is configured to, when the sending priority of the new instruction is higher than the sending priority of all other currently unsent instructions, pause the sending of all other currently unsent instructions and send the new instruction to the Bluetooth module of the target mobile device.
9. A communication system, characterized in that, The communication system includes: a terminal device and a target mobile device, wherein the terminal device and the target mobile device are connected via Bluetooth communication, and the terminal device includes: A memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the method of any one of claims 1 to 7.
10. The communication system according to claim 9, characterized in that, The target mobile device is a lawnmower.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to perform the method of any one of claims 1 to 7.