Frequency hopping communication method and device, computer equipment and computer readable storage medium

By adopting the frequency hopping communication method in wireless communication, and using direct data transmission of the protocol stack and the hardware driving layer, the problem of poor anti-interference in traditional fixed frequency communication is solved, and wireless communication with high anti-interference and real-time is achieved.

CN119402036APending Publication Date: 2025-02-07SHENZHEN SHUMA ELECTRONICS TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411517432.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-28
Publication Date
2025-02-07

AI Technical Summary

Technical Problem

Traditional fixed frequency communication technology has poor anti-interference when facing signal interference, making it difficult to ensure the real-time and anti-interference of wireless communication.

Method used

The frequency hopping communication method is adopted, and the counterpart device that performs frequency hopping communication with the communication device is determined through the protocol stack, and the channel switching process is performed according to the same frequency hopping communication parameters. The method includes acquiring the data transmitted by the application software layer and transmitting it directly to the hardware driving layer so that the wireless transceiver module can transmit data based on the channel currently switched to.

Benefits of technology

It improves the anti-interference of wireless communications, while ensuring real-time performance. By reducing the waiting time of data in the protocol stack buffer, it reduces the delay and ensures that the hardware driver layer acquires and processes data in a timely manner.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402036A_ABST
    Figure CN119402036A_ABST
Patent Text Reader

Abstract

The invention relates to a frequency hopping communication method and device, computer equipment and a computer readable storage medium. The method is applied to a protocol stack of communication equipment, and comprises the following steps: determining opposite-end equipment which performs frequency hopping communication with the communication equipment; wherein the opposite-end equipment and the communication equipment carry out channel switching processing according to the same frequency hopping communication parameter; acquiring first data transmitted by an application software layer of the communication equipment based on the first interface; the first interface is an interface which is provided for the application software layer by the protocol stack and is used for realizing real-time data transmission; and transmitting the first data to a hardware driving layer of the communication equipment to indicate the hardware driving layer to drive a wireless transceiver module of the communication equipment, so that the wireless transceiver module sends the first data to opposite-end equipment based on the currently switched channel. By adopting the method, the anti-interference performance can be improved while the real-time performance of wireless communication is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of wireless communication technology, and in particular to a frequency hopping communication method, device, computer equipment and computer-readable storage medium. Background Art

[0002] The continuous development of wireless communication technology has made information transmission more flexible and efficient, and promoted the popularization and application of various wireless communication devices and wireless communication networks.

[0003] In traditional fixed-frequency communication technology, a fixed frequency is used for signal transmission, and all communications are carried out at this specific frequency. Although fixed-frequency transmission is fast and has low communication latency, it is easily interfered by signals in a specific frequency band, resulting in poor anti-interference ability of wireless communication. Summary of the invention

[0004] Based on this, it is necessary to provide a frequency hopping communication method, apparatus, computer equipment and computer-readable storage medium that can improve anti-interference performance while ensuring the real-time performance of wireless communication in order to address the above technical problems.

[0005] In a first aspect, the present application provides a frequency hopping communication method, which is applied to a protocol stack of a communication device, and the method includes: Determining a peer device that performs frequency hopping communication with the communication device; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters; Acquiring first data transmitted by the application software layer of the communication device based on a first interface; the first interface is an interface provided by the protocol stack to the application software layer for implementing real-time data transmission; The first data is transmitted to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

[0006] In a second aspect, the present application further provides a frequency hopping communication device, comprising: A determination unit, configured to determine a peer device that performs frequency hopping communication with the communication device; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters; an acquisition unit, configured to acquire first data transmitted by the application software layer of the communication device based on a first interface; the first interface is an interface provided by the protocol stack to the application software layer for implementing real-time data transmission; A communication unit is used to transmit the first data to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

[0007] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method when executing the computer program.

[0008] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program implements the steps in the above method when executed by a processor.

[0009] In a fifth aspect, the present application also provides a computer program product, including a computer program, which implements the steps in the above method when executed by a processor.

[0010] In the above-mentioned frequency hopping communication method, device, computer equipment, storage medium and computer program product, the protocol stack of the communication equipment determines the opposite device that performs frequency hopping communication with the communication equipment; wherein, the opposite device and the communication equipment perform channel switching processing according to the same frequency hopping communication parameters, and the frequency hopping communication has stronger anti-interference performance than the fixed frequency communication, thereby improving the anti-interference performance of wireless communication. The protocol stack provides the application software layer with a first interface for realizing real-time data transmission. For the first data with higher real-time requirements in the application software layer, the protocol stack can obtain the first data transmitted by the application software layer of the communication equipment based on the first interface, and directly transmit the first data to the hardware driver layer of the communication equipment. Because the first data transmitted to the protocol stack through the first interface does not pass through the buffer of the protocol stack, and does not need to wait for the scheduling of the protocol stack in the buffer of the protocol stack, and is directly transmitted to the hardware driver layer by the protocol stack, it can reduce the delay, ensure that the hardware driver layer obtains the first data in time, and then the hardware driver layer can drive the wireless transceiver module of the communication equipment in time, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to, thereby achieving the real-time performance while improving the anti-interference performance of wireless communication. BRIEF DESCRIPTION OF THE DRAWINGS

[0011] Figure 1 A flowchart of a frequency hopping communication method provided in an embodiment of the present application.

[0012] Figure 2 A schematic diagram of data interaction between two communication devices provided in an embodiment of the present application.

[0013] Figure 3 A schematic diagram of frequency hopping synchronization of two communication devices provided in an embodiment of the present application.

[0014] Figure 4 A schematic diagram of data interaction between a communication device and a peer device provided in an embodiment of the present application.

[0015] Figure 5 A system block diagram of a communication device and a peer device provided in an embodiment of the present application.

[0016] Figure 6 A schematic diagram of transmitting data based on a first interface in a communication device provided in an embodiment of the present application.

[0017] Figure 7 A schematic diagram of data processing in a communication device provided in an embodiment of the present application.

[0018] Figure 8 A schematic diagram of setting various state flags in a core state machine provided in an embodiment of the present application.

[0019] Fig. 9 A schematic diagram of a flow chart of a core state machine executing state processing in a protocol stack provided in an embodiment of the present application.

[0020] Fig.10 A structural block diagram of a frequency hopping communication device provided in an embodiment of the present application.

[0021] Fig.11 An internal structure diagram of a computer device provided in an embodiment of the present application.

[0022] Fig.12 An internal structure diagram of another computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.

[0024] In an exemplary embodiment, Figure 1 As shown, a frequency hopping communication method is provided, which is described by taking the method applied to a communication device as an example, and includes the following steps 102 to 106.

[0025] Step 102, determining a peer device that performs frequency hopping communication with the communication device; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters.

[0026] Exemplarily, the communication device may obtain a peer device address, where the peer device address is used to identify a peer device that performs frequency hopping communication with the communication device.

[0027] In some embodiments, the communication device may store a communication device address and a peer device address. The communication device address is an identifier that uniquely identifies the communication device in frequency hopping communication. The peer device address is an identifier that uniquely identifies the peer device in frequency hopping communication. In frequency hopping communication between a communication device and a peer device, for the communication device, the communication device address is the source address and the peer device address is the destination address, while for the peer device, the peer device address is the source address and the communication device address is the destination address.

[0028] In some embodiments, the peer device in the host mode may send a frequency hopping synchronization packet to the communication device in the slave mode. The frequency hopping communication parameters in the frequency hopping synchronization packet are used to ensure that the sender and receiver of the frequency hopping communication can communicate using the same frequency at the same time point. Furthermore, the peer device and the communication device can implement frequency hopping communication according to the frequency hopping communication parameters in the frequency hopping synchronization packet. In some embodiments, the communication device in the host mode may send a frequency hopping synchronization packet to the peer device in the slave mode. It can be understood that the communication device or the peer device in the host mode runs its own protocol stack in the host mode. And the communication device or the peer device in the slave mode runs its own protocol stack in the slave mode. The main difference between the host mode and the slave mode is frequency hopping synchronization. Specifically, the communication device or the peer device in the host mode acts as the host in the frequency hopping communication, and the communication device or the peer device in the slave mode acts as the slave in the frequency hopping communication. The host can send a frequency hopping synchronization packet to the slave according to the synchronization time interval. The frequency hopping synchronization packet carries the frequency hopping communication parameters. The frequency hopping communication parameters may include at least one of the frequency hopping time interval, the idle timeout time, or the pseudo-random sequence generation seed. After receiving the frequency hopping synchronization packet, the slave sends a synchronization reply packet to the master and establishes a frequency hopping communication connection. After receiving the synchronization reply packet, the master starts to establish a frequency hopping communication connection. After the frequency hopping communication connection between the master and the slave is established, the master and the slave perform channel switching processing according to the same frequency hopping communication parameters to complete the frequency hopping communication function.

[0029] In some embodiments, the protocol stack may include a frequency hopping timer for measuring the frequency hopping time interval and an idle timer for measuring the idle timeout time. It can be understood that the timeout of the frequency hopping timer is used to mark the beginning of a new frequency hopping time interval. The timeout of the idle timer is used to mark that the communication device is in an idle state and has not established a frequency hopping communication connection with the opposite device.

[0030] In some embodiments, Figure 2As shown, a schematic diagram of data interaction between two communication devices is provided. Communication device A operates in the host mode, the communication device address in communication device A is 1, and the address of the opposite device is 2. Communication device B operates in the slave mode, the communication device address in communication device B is 2, and the address of the opposite device is 1. It can be understood that for communication device A, communication device B is the opposite device, and for communication device B, communication device A is the opposite device. The difference between communication device A in the host mode and communication device B in the slave mode is that communication device A sends a frequency hopping synchronization packet or a data packet other than the frequency hopping synchronization packet to communication device B, and communication device B can only send a data packet other than the frequency hopping synchronization packet to communication device A.

[0031] In some embodiments, Figure 3 As shown, a schematic diagram of frequency hopping synchronization of two communication devices is provided. Communication device A operates in the host mode, and communication device B operates in the slave mode. Communication device A and communication device B maintain the default broadcast channel when no connection is established. Communication device A and communication device B perform channel switching processing when the connection is established. Compared with the frequency hopping time slot of communication device B, the time lag of switching to channel x0, channel x1 and channel x2 in the frequency hopping time slot of communication device A is delayed. Communication device A sends a frequency hopping synchronization packet to communication device B. After receiving the frequency hopping synchronization packet, communication device B sets the connected state flag, completes the frequency hopping synchronization after the frequency hopping synchronization time, and switches to channel y0 and channel y1 synchronously with communication device A. Communication device B sends a synchronization reply packet to communication device A, and communication device A sets the connected state flag after receiving the synchronization reply packet. Among them, the frequency hopping synchronization time refers to the time required for the communicating parties to achieve synchronization before switching frequencies. The frequency hopping synchronization time is less than the frequency hopping time interval.

[0032] In some embodiments, after the communication device establishes a frequency hopping communication connection with the peer device, data communication can be performed within the frequency hopping time interval. The frequency hopping time interval refers to the time gap from one frequency to another. The frequency hopping time interval determines the channel dwell time. It can be understood that, ideally, if the next channel is switched immediately at the end of each frequency hopping time interval, and there is no additional channel switching time or delay, then the frequency hopping time interval and the channel dwell time should be equal.

[0033] In some embodiments, due to errors in frequency hopping synchronization between the communication device and the peer device, the frequency hopping time intervals of the communication device and the peer device are not completely consistent. A fixed time window, i.e., a channel transceiver window, is configured within the frequency hopping time interval, and the communication device and the peer device can complete data exchange within the channel transceiver window, which can avoid the influence of the above errors and ensure communication reliability.

[0034] In some embodiments, in order to further ensure the reliability of communication, the data interaction in each channel transceiver window is based on a one-receive-one-send mechanism, and the sender waits for the receiver's reply after sending the data and supports a retransmission mechanism in the next channel transceiver window. Specifically, after sending data, the sender in the communication device and the opposite device will wait for the data reply packet of the receiver in the communication device and the opposite device in the channel transceiver window. If the sender does not receive the data reply packet of the receiver in the channel transceiver window, it is considered that the data transmission has failed. At this time, the sender can determine whether it needs to automatically retransmit in the next channel transceiver window according to the maximum number of retransmissions in its own protocol stack parameters.

[0035] In some embodiments, Figure 4 As shown, a schematic diagram of data interaction between a communication device and a peer device is provided. In the channel transceiver window of channel x2, the communication device sends data packet 0 to the peer device, and the peer device sends a reply packet 0 to the communication device for the received data packet 0. In the channel transceiver window of channel x3, the peer device sends data packet 1 to the peer device, and the communication device sends a reply packet 1 to the communication device for the received data packet 1. In the channel transceiver window of channel x4, the communication device sends data packet 2 to the peer device, and the peer device sends a reply packet 2 to the communication device after receiving data packet 2. However, if data packet 2 is lost or reply packet 2 is lost, the communication device cannot receive reply packet 2 in the channel transceiver window of channel x4. It can be understood that Figure 4 The symbol × under the transmission arrow of packet 2 in the figure indicates that packet 2 is lost. Figure 4 The symbol × on the transmission arrow of reply packet 2 in , represents that reply packet 2 is lost. In the next channel transceiver window, that is, the channel transceiver window of channel x5, the communication device retransmits data packet 2 to the opposite device, and the opposite device sends a reply packet 2 to the communication device in response to data packet 2.

[0036] In some embodiments, the communication device may include at least one of an Internet of Things device, a terminal, a server, a personal computer, a CNC machine, or a wireless probe, etc. The peer device may include at least one of an Internet of Things device, a terminal, a server, a personal computer, a CNC machine, or a wireless probe, etc.

[0037] Step 104: Acquire first data transmitted by the application software layer of the communication device based on the first interface; the first interface is an interface provided by the protocol stack to the application software layer for implementing real-time data transmission.

[0038] Among them, the application software layer is responsible for the implementation of business logic programs. For example, the application software layer can realize the sending, receiving, processing of application-related data, and the establishment and management of connections with peer devices. The first interface belongs to the application program interface provided by the protocol stack. The protocol stack is between the application software layer and the hardware driver layer. The application program interface provided by the protocol stack is an interface used by the application software layer. The application program interface shields the details of the underlying data communication and repackages the functional interface that the application software layer needs to use. The application software layer does not interact directly with the hardware driver layer. It uses the application program interface provided by the protocol stack to complete the transmission of application software layer related data, and then the protocol stack completes the scheduling and management of data transmission between the application software layer and the hardware driver layer. For the developers of the application software layer, there is no need to consider the details of the hardware driver layer. They only need to configure the protocol stack parameters to use the underlying wireless communication functions, which reduces the development cost.

[0039] For example, the application software layer can call the first interface provided by the protocol stack for the first data with high real-time performance, and transmit the first data to the protocol stack through the first interface. The protocol stack can obtain the first data transmitted by the application software layer in response to the calling operation of the application software layer on the first interface.

[0040] Step 106: transmit the first data to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

[0041] Among them, the hardware driver layer is responsible for interacting with the underlying operating hardware in the hardware layer, and encapsulates interfaces related to the underlying operating hardware, such as wireless transceiver modules, serial ports, timers and other hardware-related interfaces. The interfaces related to the wireless transceiver module may include at least one of a wireless data transceiver interface, a wireless event notification interface or a communication parameter configuration interface. The hardware layer is mainly composed of peripherals such as a microcontroller, a wireless transceiver module, a timer and a serial port. The wireless transceiver module is the core of the device's ability to communicate wirelessly, and is used to modulate data into radio frequency data, which is then transmitted to the air medium through the antenna in the form of electromagnetic waves. The wireless transceiver module is also used to demodulate the radio frequency data received by the antenna from the air medium into data that can be recognized by the communication device.

[0042] Exemplarily, the protocol stack may format and encapsulate the first data to obtain the encapsulated first data. The encapsulated first data is transmitted to the hardware driver layer of the communication device. The hardware driver layer may drive the wireless transceiver module of the communication device to transmit the first data to the currently switched channel through the antenna. The opposite device may obtain the first data based on the currently switched channel.

[0043] In some embodiments, the hardware driver layer can drive the wireless transceiver module of the communication device to modulate the first data into first radio frequency data and transmit the first radio frequency data through the antenna. The opposite device can receive the first radio frequency data and demodulate the first radio frequency data to obtain the first data.

[0044] In some embodiments, the peer device may send a first reply packet for the first data to the communication device. When the wireless transceiver module of the communication device receives the first reply packet, the hardware driver layer of the communication device issues a data reception notification. The protocol stack of the communication device obtains the first reply packet received by the wireless transceiver module from the hardware driver layer in response to the data reception notification.

[0045] In some embodiments, the application software layer may call the data reading interface provided by the protocol stack in a polling manner to read the first reply packet from the data receiving and sending buffer.

[0046] In some embodiments, the application software layer may continue to call the first interface to retransmit the first data to the protocol stack if the first reply packet is not successfully read within a preset time period.

[0047] In some embodiments, frequency hopping communication is a spread spectrum communication mode, and its working principle refers to a communication mode in which the carrier frequency of the transmission signal of the transmitter and receiver is discretely changed according to a predetermined rule. Specifically, in frequency hopping communication, the transmitter and receiver use a pseudo-random sequence to control the hopping of the carrier frequency, thereby realizing multi-frequency frequency shift keying. Frequency hopping communication parameters may include a frequency hopping time interval and a pseudo-random sequence. The protocol stack can generate a frequency hopping instruction according to a pseudo-random sequence when the previous frequency hopping time interval ends, that is, when the current frequency hopping time interval begins, and transmit the frequency hopping instruction to the wireless transceiver module through the hardware driver layer, so that the wireless transceiver module adjusts the carrier signal output by itself according to the carrier frequency in the frequency hopping instruction, and selects the corresponding channel according to the carrier frequency in the frequency hopping instruction to obtain the channel currently switched to. Among them, the frequency hopping time interval of the channel currently switched to is the current frequency hopping time interval. It can be understood that the carrier signal output by the wireless transceiver module is used to modulate the data to be sent to the opposite device to obtain the modulated radio frequency data. The wireless transceiver module transmits the modulated radio frequency data to the channel currently switched to in the form of electromagnetic waves through its own antenna. Specifically, the wireless transceiver module may use a carrier signal to modulate the encapsulated first data to obtain first radio frequency data, and transmit the first radio frequency data to the currently switched channel in the form of electromagnetic waves through its own antenna.

[0048] In the above frequency hopping communication method, the protocol stack of the communication device determines the opposite device that performs frequency hopping communication with the communication device; wherein the opposite device and the communication device perform channel switching processing according to the same frequency hopping communication parameters, and the frequency hopping communication has stronger anti-interference performance than the fixed frequency communication, thereby improving the anti-interference performance of wireless communication. The protocol stack provides the application software layer with a first interface for realizing real-time data transmission. For the first data with higher real-time requirements in the application software layer, the protocol stack can obtain the first data transmitted by the application software layer of the communication device based on the first interface, and directly transmit the first data to the hardware driver layer of the communication device. Because the first data transmitted to the protocol stack through the first interface does not pass through the buffer of the protocol stack, and does not need to wait for the scheduling of the protocol stack in the buffer of the protocol stack, and is directly transmitted to the hardware driver layer by the protocol stack, it can reduce the delay, ensure that the hardware driver layer obtains the first data in time, and then the hardware driver layer can drive the wireless transceiver module of the communication device in time, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to, thereby achieving the real-time performance while improving the anti-interference performance of wireless communication.

[0049] In some embodiments, the method also includes: obtaining second data transmitted by the application software layer based on the second interface; the second interface is an interface provided by the protocol stack to the application software layer for realizing non-real-time data transmission; determining the channel transceiver window within the frequency hopping time interval of the channel currently switched to; transmitting the second data to the hardware driver layer within the channel transceiver window to instruct the hardware driver layer to drive the wireless transceiver module, so that the wireless transceiver module sends the second data to the opposite device based on the channel currently switched to.

[0050] Exemplarily, the application program interface provided by the protocol stack to the application software layer includes a first interface and a second interface. For the second data with low real-time performance, the application software layer can call the second interface provided by the protocol stack and transmit the second data to the protocol stack through the second interface. The protocol stack can obtain the second data transmitted by the application software layer in response to the calling operation of the application software layer on the second interface. The core state machine in the protocol stack can perform channel switching processing when the previous frequency hopping time interval ends, that is, when the current frequency hopping time interval begins, to obtain the channel currently switched to. It can be understood that the frequency hopping time interval of the channel currently switched to is the current frequency hopping time interval. Determine the channel transceiver window within the current frequency hopping time interval. The protocol stack can format the second data within the channel transceiver window and transmit the encapsulated second data to the hardware driver layer.

[0051] In some embodiments, the communication device may be a numerical control machine, and the peer device may be a wireless probe. The second data may be an upgrade package. The wireless probe may be upgraded according to the upgrade package.

[0052] In some embodiments, the communication device may be a wireless probe, and the peer device may be a numerical control machine. The second data may be measurement data. The numerical control machine may determine the processing state of the workpiece according to the measurement data.

[0053] In some embodiments, the wireless transceiver module can use the carrier signal to modulate the encapsulated second data to obtain the second radio frequency data, and transmit the second radio frequency data to the currently switched channel in the form of electromagnetic waves through its own antenna. The opposite device can receive the second radio frequency data based on the currently switched channel.

[0054] In this embodiment, the protocol stack obtains the second data with low real-time performance transmitted by the application software layer based on the second interface; and determines the channel transceiver window within the frequency hopping time interval of the channel currently switched to. Since errors will occur when the communication device and the opposite device are synchronized during frequency hopping, resulting in the frequency hopping time intervals of the communication device and the opposite device being not completely consistent, in order to ensure the communication reliability between the communication device and the opposite device, data is not sent directly after frequency hopping, but after the channel transceiver window is monitored, the second data is transmitted to the hardware driver layer within the channel transceiver window to instruct the hardware driver layer to drive the wireless transceiver module, so that the wireless transceiver module sends the second data to the opposite device based on the channel currently switched to, which can ensure the stable transmission of the second data with low real-time performance and improve the communication reliability.

[0055] In some embodiments, obtaining the second data transmitted by the application software layer based on the second interface includes: in response to the application software layer's calling operation on the second interface, writing the second data transmitted by the application software layer into a data transceiver buffer in the protocol stack; transmitting the second data to the hardware driver layer within the channel transceiver window includes: obtaining the second data from the data transceiver buffer within the channel transceiver window, and sending the second data to the hardware driver layer.

[0056] The data transceiver buffer is a memory space integrated in the protocol stack, which is used to store data to be transmitted to the hardware driver layer and the data to be transmitted to the application software layer. The data in the data transceiver buffer is scheduled by the core state machine of the protocol stack for transmission. The developers of the application software layer cannot directly access the data transceiver buffer, but can only read and write the data transceiver buffer indirectly through the application program interface provided by the protocol stack.

[0057] Exemplarily, the application software layer transmits the second data with low real-time performance to the protocol stack by calling the second interface. When the second interface is called by the application software layer, the protocol stack can copy the second data transmitted by the application software layer to the data transceiver buffer of the protocol stack through the second interface to wait for the scheduling of the core state machine. The protocol stack can call the core state machine within the channel transceiver window to read the second data to be sent from the data transceiver buffer and send the second data to the hardware driver layer.

[0058] In this embodiment, in response to the application software layer's call operation on the second interface, the second data transmitted by the application software layer is written into the data transceiver buffer in the protocol stack; the second data is temporarily stored in the data transceiver buffer, and after the channel transceiver interface arrives, the second data is promptly obtained from the data transceiver buffer within the channel transceiver window, and the second data is sent to the hardware driver layer. Compared with the method of obtaining the second data from the application software layer based on the second interface after the channel transceiver window arrives, the data transmission speed is faster.

[0059] In some embodiments, the frequency hopping communication parameters include a pseudo-random sequence; determining the channel transceiver window within the frequency hopping time interval of the channel currently switched to includes: when the frequency hopping timer in the protocol stack times out, calling the core state machine in the protocol stack to perform channel switching processing according to the pseudo-random sequence, obtaining the channel currently switched to, and starting the delayed send timer in the protocol stack; wherein the timeout of the frequency hopping timer is used to mark the beginning of the frequency hopping time interval of the channel currently switched to; obtaining the second data from the data transceiver buffer within the channel transceiver window includes: when the delayed send timer times out, obtaining the second data from the data transceiver buffer through the core state machine; wherein the timeout of the delayed send timer is used to mark the beginning of the channel transceiver window within the frequency hopping time interval.

[0060] Exemplarily, the protocol stack includes a core timer. Both the frequency hopping timer and the delayed sending timer belong to the core timer. The core timer is composed of various different timers and is the heart of the protocol stack operation. When the corresponding timer times out, the core state machine is dynamically called for processing, so that the protocol stack changes from static to dynamic scheduling. In order to facilitate the unified management of each independent timer by the protocol stack, a timer chain list is configured in the protocol stack, and the timeout processing of the timer is completed in the callback interface of the timer chain list. It can be understood that the timer chain list includes a node corresponding to each timer, and the callback interface of the timer chain list can notify the timer of the timeout of the core state machine. In the case of the frequency hopping timer in the timer chain list timing out, it means that the previous frequency hopping time interval ends and enters the current frequency hopping time interval. The event of the frequency hopping timer timeout is notified through the callback interface of the timer chain list. At this time, the protocol stack can call the core state machine to perform channel switching processing according to the pseudo-random sequence to obtain the channel currently switched to, and the frequency hopping time interval of the channel currently switched to is the current frequency hopping time interval. In the case where there is second data to be sent in the data transceiver buffer, the delayed sending timer in the timer chain list is turned on. When the delayed send timer in the timer linked list times out, it represents the beginning of the channel transmit and receive window within the current frequency hopping time interval. The delayed send timer timeout event is notified through the callback interface of the timer linked list. At this time, the protocol stack can read the second data from the data transmit and receive buffer through the core state machine.

[0061] In some embodiments, when the frequency hopping timer times out, if there is a connected state flag, the core state machine performs channel switching processing according to the frequency hopping communication parameters. When the noise power of the channel currently switched to does not exceed the noise threshold and there is no send data flag in the core state machine, if there is a second data to be sent in the data transceiver buffer, the send data flag is set and the delayed send timer is started. It can be understood that the communication device and the opposite device randomly hop in the pseudo-random sequence agreed by both parties, that is, switch channels, which can avoid communication abnormalities caused by high-power noise in a certain channel in a certain time period. The risk of data being eavesdropped by the outside world can also be reduced through frequency hopping communication, ensuring security and anti-interference. Among them, the connected state flag is used to mark that the frequency hopping communication between the communication device and the opposite device is in a connected state. The send data flag is used to mark that the core state machine is in a state of sending data. When the frequency hopping timer times out, that is, when entering the current frequency hopping time interval, the send data flag still exists, indicating that the core state machine failed to send data in the previous frequency hopping time interval, and it is necessary to determine whether to retransmit in the current frequency hopping time interval according to the maximum number of retransmissions, and the second data in the data transceiver buffer cannot be sent.

[0062] In some embodiments, the peer device may send a second reply packet for the second data to the communication device. When the protocol stack obtains the second reply packet for the second data from the hardware driver layer, it may clear the data sending flag, indicating that the second data is successfully sent within the current frequency hopping time interval.

[0063] In some embodiments, clearing the send data flag may be, but is not limited to, setting the send data flag in the core state machine to 0. Setting the send data flag may be, but is not limited to, setting the send data flag in the core state machine to 1.

[0064] In this embodiment, when the frequency hopping timer in the protocol stack times out, it represents the beginning of the current frequency hopping time interval, and the core state machine in the protocol stack is called to perform channel switching processing according to a pseudo-random sequence to obtain the channel currently switched to. The current frequency hopping time interval is the frequency hopping time interval of the channel currently switched to. The delayed sending timer in the protocol stack is turned on; when the delayed sending timer times out, it represents the beginning of the channel transceiver window in the frequency hopping time interval of the channel currently switched to, and the second data is obtained from the data transceiver buffer through the core state machine. The frequency hopping timer and the delayed sending timer can accurately locate the beginning of the channel transceiver window corresponding to the channel currently switched to, and ensure that the second data in the data transceiver buffer is transmitted to the hardware driver layer within the channel transceiver window corresponding to the channel currently switched to, thereby ensuring that the wireless transceiver module can send the second data to the hardware driver layer based on the channel currently switched to, thereby improving communication reliability.

[0065] In some embodiments, the hardware driver layer is used to send a data reception notification to the protocol stack when the wireless transceiver module receives the third data; the method also includes: when the data reception notification is obtained, calling the core state machine to obtain the third data received by the wireless transceiver module from the hardware driver layer; parsing the application data in the third data through the core state machine; writing the application data to the data transceiver buffer of the protocol stack to instruct the application software layer to read the application data from the data transceiver buffer.

[0066] Exemplarily, the antenna of the wireless transceiver module can receive the third radio frequency data, and the third data is obtained through demodulation of the wireless transceiver module. When the wireless transceiver module in the hardware driver layer obtains the third data, the wireless notification callback function is called to send a data reception notification to the protocol stack. The protocol stack can respond to the data reception notification by calling the core state machine to obtain the third data from the hardware driver layer. The protocol stack can format the third data through the core state machine to obtain the application data in the third data, and write the application data to the data transceiver buffer of the protocol stack through the core state machine. The application software layer can call the data reading interface provided by the protocol stack to read the application data from the data transceiver buffer.

[0067] In some embodiments, the communication device may be a wireless probe, and the peer device may be a numerical control machine. The application data in the third data may be used to upgrade the application software layer. The application software layer may be upgraded according to the application data.

[0068] In this embodiment, when a data reception notification is obtained, the core state machine is called to obtain the third data received by the wireless transceiver module from the hardware driver layer; the application data in the third data is parsed by the core state machine; the application data is written to the data transceiver buffer of the protocol stack to instruct the application software layer to read the application data from the data transceiver buffer. For the developer of the application software layer, it is only necessary to access the data transceiver buffer of the protocol stack to obtain the application data sent by the opposite device, without having to pay attention to the underlying communication details, thereby reducing development costs.

[0069] In some embodiments, the communication device includes a wireless probe; the opposite device includes a CNC machine; obtaining first data transmitted by the application software layer of the communication device based on the first interface includes: obtaining collision data transmitted by the application software layer of the wireless probe based on the first interface; the collision data is generated in the application software layer when the wireless probe collides with an obstacle; wherein the CNC machine is used to adjust the working state according to the received collision data.

[0070] Exemplarily, the first data may include collision data. The application software layer may generate collision data when the wireless probe collides with an obstacle. Since the collision may damage the wireless probe, the collision data is high real-time data and needs to be notified to the CNC machine in a timely manner. The application software layer may call the first interface to transmit the collision data to the protocol stack. The protocol stack may obtain the collision data in response to the application software layer's call operation on the first interface, format the collision data, and transmit the packaged collision data to the hardware driver layer to instruct the hardware driver layer to drive the wireless transceiver module to modulate the packaged collision data into collision radio frequency data, and transmit the collision radio frequency data through the antenna of the wireless transceiver module.

[0071] In some embodiments, the receiving board on the CNC machine can receive the collision radio frequency data, demodulate the collision radio frequency data to obtain the packaged collision data, and format the packaged collision data to obtain the collision data. The receiving board on the CNC machine can communicate with the main control module of the CNC machine through a serial port, and transmit the collision data to the main control module of the CNC machine to instruct the main control module to adjust the working state of the CNC machine.

[0072] In some embodiments, the CNC machine may stop working upon receiving collision data.

[0073] In some embodiments, the CNC machine may change the direction of movement of the workpiece upon receiving collision data.

[0074] In this embodiment, since the wireless probe will be damaged when it collides with an obstacle, the collision data generated by the application software layer in this case needs to be notified to the CNC machine in a timely manner. By obtaining the collision data transmitted by the application software layer of the wireless probe based on the first interface, there is no need to wait for the scheduling of the core state machine. The wireless transceiver module is directly driven by the hardware driver layer to send the collision data to the CNC machine. The CNC machine then adjusts its working state according to the received collision data, which can timely avoid further damage to the wireless probe by obstacles on the CNC machine.

[0075] In some embodiments, a CNC machine in host mode is used to send a frequency hopping synchronization packet to a wireless probe in slave mode; the method also includes: obtaining the frequency hopping synchronization packet received by the wireless receiving module from the hardware driver layer; determining the frequency hopping communication parameters in the frequency hopping synchronization packet; and performing frequency hopping communication with the CNC machine according to the frequency hopping communication parameters.

[0076] Exemplarily, the CNC machine can send a frequency hopping synchronization packet to the wireless probe. After the protocol stack of the wireless probe obtains the frequency hopping synchronization packet from the hardware driver layer, it sets a connected status flag, indicating that the wireless probe has established a frequency hopping communication connection with the CNC machine. The protocol stack of the wireless probe can generate a synchronization reply packet for the frequency hopping synchronization packet, and transmit the synchronization reply packet to the hardware driver layer to instruct the hardware driver layer to drive the wireless transceiver module to send a synchronization reply packet to the CNC machine. The CNC machine can determine to establish a frequency hopping communication connection with the wireless probe after receiving the synchronization reply packet. The protocol stack of the wireless probe can format parse the frequency hopping synchronization packet and obtain the frequency hopping communication parameters in the frequency hopping synchronization packet. The frequency hopping communication parameters may include a pseudo-random sequence. The wireless probe can perform channel switching processing according to the pseudo-random sequence, and interact with the CNC machine based on the channel currently switched to.

[0077] In some embodiments, the first data may include frequency hopping communication parameters. The CNC machine may obtain the frequency hopping communication parameters in the first data and send a frequency hopping synchronization packet including the frequency hopping communication parameters to the wireless probe, thereby enabling the wireless probe to control the frequency hopping communication of the CNC machine and improving flexibility.

[0078] In some embodiments, the collision data may include frequency hopping communication parameters. After the wireless probe collides with an obstacle, it may affect the measurement of the wireless probe to a certain extent. At this time, collision data including frequency hopping communication parameters can be generated. The frequency hopping communication parameters in the collision data specify a shorter frequency hopping time interval than the historical frequency hopping communication parameters. After the subsequent frequency hopping synchronization between the wireless probe and the CNC machine, frequency hopping communication with a shorter frequency hopping time interval can be achieved. Then, the measurement data in the application software layer of the wireless probe can be sent to the CNC machine more timely through the second interface, ensuring that the CNC machine can promptly discover problems that occur in the measurement of the wireless probe and ensure the measurement efficiency of the wireless probe.

[0079] In this embodiment, the CNC machine in the host mode sends a frequency hopping synchronization packet to the wireless probe in the slave mode. Then, the protocol stack of the wireless probe obtains the frequency hopping synchronization packet received by the wireless receiving module from the hardware driver layer; determines the frequency hopping communication parameters in the frequency hopping synchronization packet; and performs frequency hopping communication with the CNC machine according to the frequency hopping communication parameters, thereby realizing the adjustment of the frequency hopping communication between the CNC machine in the host mode and the wireless probe in the slave mode, and can ensure that the CNC machine uniformly controls the frequency hopping communication of at least one wireless probe installed thereon, thereby ensuring the frequency hopping communication efficiency between the CNC machine and at least one wireless probe.

[0080] In some embodiments, Figure 5As shown, a system block diagram of a communication device and a peer device is provided. The communication device and the peer device include an application software layer, a protocol stack, a hardware driver layer, a hardware layer and an antenna. The application software layer can realize data processing, data transmission and data reception. The application program interface provided by the protocol stack supports the application software layer to access the data transceiver buffer in the protocol stack. The timer timeout in the core timer will change the state in the core state machine. The core state machine, core timer and data transceiver buffer in the protocol stack are simple to implement and occupy less resources, and can be transplanted and used in small microcomputers or resource-constrained systems. The hardware driver layer includes driver interfaces such as wireless transceiver modules, serial ports and timers, which can drive peripherals such as wireless transceiver modules, serial ports and timers in the hardware layer. The antenna of the wireless transceiver module is used to receive data from the air medium. The wireless data generated by the application software layer in the communication device or the peer device is transmitted to the protocol stack, and then transmitted to the hardware driver layer after being encapsulated by the protocol stack. The hardware driver layer drives the wireless transceiver module and transmits the wireless data to the air medium through the antenna of the wireless transceiver module. The antenna of the wireless transceiver module in the communication device or the opposite device receives the wireless data from the air medium. After demodulation by the wireless transceiver module, the hardware driver layer notifies the protocol stack, and the protocol stack transmits the wireless data in the hardware driver layer to the application software layer.

[0081] In some embodiments, Figure 6 As shown, a schematic diagram of data transmission based on a first interface in a communication device is provided. The first data generated by data processing in the application software layer is transmitted to the protocol stack through the first interface, without passing through the data transceiver buffer in the protocol stack and without calling the core state machine, and is directly transmitted to the hardware driver layer to drive the wireless transceiver module to send the first data through the antenna.

[0082] In some embodiments, Figure 7As shown, a schematic diagram of data processing in a communication device is provided. Application-related data refers to data related to the application software layer, including first data and second data to be sent by the application software layer, and application data in the third data to be received by the application software layer. For application-related data to be sent by the application software layer, the application software layer calls the application program interface provided by the protocol stack to transmit the application-related data to the protocol stack. After the protocol stack completes the format encapsulation, the wireless data transceiver interface is called to send the format-encapsulated application-related data to the hardware driver layer. The hardware driver layer drives the wireless transceiver module in the hardware layer to send the format-encapsulated application-related data through the antenna. For application-related data to be received by the application software layer, the antenna of the wireless transceiver module can demodulate the received data to obtain the format-encapsulated application-related data. The hardware driver layer sends a data reception notification to the protocol stack through the wireless event notification interface. The protocol stack calls the wireless data transceiver interface to obtain the format-encapsulated application-related data from the hardware driver layer. After the protocol stack performs format parsing on the format-encapsulated application-related data, the application-related data is obtained, and the application-related data is transmitted to the application software layer through the application program interface.

[0083] In some embodiments, the data transceiver buffer includes a data sending buffer and a data receiving buffer. The data in the data sending buffer is application-related data to be sent to the peer device. The data in the data receiving buffer is application-related data received from the peer device.

[0084] In some embodiments, Figure 8 As shown, a schematic diagram of setting each state flag in the core state machine is provided. The core state machine can set the frequency hopping flag when the frequency hopping timer times out, and set the frequency hopping flag bit to 1. The frequency hopping flag is used to indicate that the protocol stack enters the frequency hopping processing state. The protocol stack of the communication device in the host mode includes a synchronization timer. The core state machine can set the send synchronization packet flag when the synchronization timer times out, and set the send synchronization packet flag bit to 1. The send synchronization packet flag is used to indicate that the protocol stack enters the state of sending the frequency hopping synchronization packet. The core state machine can set the idle flag when the idle timer times out, and set the idle flag bit to 1. The idle flag is used to indicate that the protocol stack enters the idle state. The core state machine can set the delayed send flag when the delayed send timer times out, and set the delayed send flag bit to 1. The delayed send flag is used to indicate that the protocol stack is in the channel transceiver window corresponding to the channel currently switched to. When the core state machine receives a data reception notification, it sets the data reception flag and sets the data reception flag bit to 1. The data reception flag is used to indicate that the wireless transceiver module of the protocol stack receives data.

[0085] In some embodiments, the core state machine is a core function integrated into the protocol stack, which is equivalent to the brain of the protocol stack and is responsible for processing various status flags in the protocol stack, format encapsulation and format parsing of wireless data, and sending and receiving wireless data. Fig. 9 As shown, a flow chart of the core state machine execution state processing in the protocol stack is provided. First, the protocol stack parameters are configured. The protocol stack parameters determine the basic operation and control properties of the protocol stack, which may include at least one of the working mode, source address, target address, number of channels, channel range, wireless packet length, frequency hopping interval or maximum number of retransmissions.

[0086] After configuring the protocol stack parameters, the core state machine in the protocol stack performs state processing. When the idle timer times out, the idle timer is reset and the idle flag is set and the connected state flag is cleared. Specifically, the idle flag bit is set to 1 and the connected state flag bit is set to 0.

[0087] There is a synchronization timer in the protocol stack in host mode. The core state machine can determine whether it is running in host mode. If so, when the synchronization timer times out, the synchronization timer is reset and the send synchronization packet flag is set. Specifically, the send synchronization packet flag bit is set to 1.

[0088] The core state machine can reset the frequency hopping timer and set the frequency hopping flag and the permission to send flag when the frequency hopping timer times out. Specifically, the frequency hopping flag bit is set to 1 and the permission to send flag bit is set to 1. The core state machine can determine whether there is a connected state flag. Specifically, it is determined whether the connection state flag bit is equal to 1. If so, the connected state flag exists, otherwise the connected state flag does not exist. In the case where there is no connected flag, the default broadcast channel is switched. If there is a send synchronization packet flag, the send synchronization packet flag is cleared, the delayed send timer is started, and the frequency hopping synchronization packet is waited for. In the case of a connected state flag, the channel switching process is performed according to a pseudo-random sequence. The core state machine can perform field strength detection on the channel currently switched to determine the noise power of the channel currently switched to. In the case where the noise power exceeds the noise threshold, the permission to send flag is cleared and the channel currently switched to is recorded. Specifically, the permission to send flag bit is set to 0. It can be understood that the absence of the permission to send flag means that the channel currently switched to is not allowed to send. In the case where the noise power does not exceed the noise threshold, it is determined whether there is a send data flag. Specifically, it is determined whether the send data flag is equal to 1. If so, there is a send data flag, otherwise there is no send data flag. In the case of the send data flag, the send data failure flag is set. Specifically, the send data failure flag is set to 1. The send data failure flag is used to mark the last failure to send data. If there is no send data flag, the send processing is performed to determine whether there is a send synchronization packet flag. Specifically, it is determined whether the send synchronization packet flag is 1. If so, there is a send synchronization packet flag, otherwise there is no send synchronization packet flag. In the case of the send synchronization packet flag, the send synchronization packet flag is cleared and the delay send timer is turned on to wait for the frequency hopping synchronization packet to be sent. Specifically, the send synchronization packet flag is set to 0. In the case of the absence of the send synchronization packet flag, it is determined whether there is a send data failure flag. Specifically, it is determined whether the send data failure flag is 1. If so, there is a send data failure flag, otherwise there is no send data failure flag. In the case of the send data failure flag, the retransmission count value is +1 and the send data failure flag is cleared. Specifically, the send data failure flag is set to 0. Determine whether the retransmission count value is less than the maximum number of retransmissions. If so, set the send data flag and start the delay send timer, waiting for the data retransmission packet to be sent. Otherwise, clear the retransmission count value and issue a data transmission failure notification. The data retransmission packet refers to the data packet that failed to be sent last time. In the absence of the send data flag, determine whether there is data to be sent in the data transceiver buffer. In the case that there is data to be sent in the data transceiver buffer, set the send data flag and clear the retransmission count value, start the delay send timer, and wait for the data packet to be sent. The data packet refers to the data to be sent in the data transceiver buffer.

[0089] The core state machine can set the data reception flag when receiving the data reception notification. Specifically, the data reception flag is set to 1. The data reception notification is issued by calling the wireless notification callback function when the wireless transceiver module obtains the third data in the hardware driver layer. The core state machine can obtain the third data received by the wireless transceiver module. The third data is formatted. For the application data in the third data, the idle timer is reset and the application data is written to the data transceiver buffer, and a reply packet is sent for the application data. For the data retransmission packet in the third data, the idle timer is reset, and it is determined whether the data retransmission packet is the previous application data. If so, a reply packet is sent for the data retransmission packet, otherwise, the application data in the data retransmission packet is written to the wireless transceiver buffer and a reply packet is sent for the data retransmission packet. For the frequency hopping synchronization packet in the third data, the idle timer is reset and frequency hopping synchronization is performed, and a reply packet is sent for the frequency hopping synchronization packet. For the reply packet in the data retransmission packet, the idle timer is reset and the send data flag is cleared. The invalid packet in the third data is directly discarded.

[0090] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0091] Based on the same inventive concept, the embodiment of the present application also provides a frequency hopping communication device for implementing the frequency hopping communication method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more frequency hopping communication device embodiments provided below can refer to the limitations on the frequency hopping communication method above, and will not be repeated here.

[0092] In an exemplary embodiment, Fig.10 As shown, a frequency hopping communication device 1000 is provided, comprising: a determination unit 1002, an acquisition unit 1004 and a communication unit 1006, wherein: A determination unit, used to determine a peer device with which the communication device performs frequency hopping communication; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters; An acquisition unit, configured to acquire first data transmitted by an application software layer of a communication device based on a first interface; the first interface is an interface provided by a protocol stack to the application software layer for implementing real-time data transmission; The communication unit is used to transmit first data to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

[0093] In some embodiments, the acquisition unit 1004 is used to acquire the second data transmitted by the application software layer based on the second interface; the second interface is an interface provided by the protocol stack to the application software layer for realizing non-real-time data transmission; the communication unit 1006 is used to determine the channel transceiver window within the frequency hopping time interval of the channel currently switched to; the second data is transmitted to the hardware driver layer within the channel transceiver window to instruct the hardware driver layer to drive the wireless transceiver module, so that the wireless transceiver module sends the second data to the opposite device based on the channel currently switched to.

[0094] In some embodiments, the acquisition unit 1004 is used to write the second data transmitted by the application software layer into the data transceiver buffer in the protocol stack in response to the application software layer's calling operation on the second interface; the communication unit 1006 is used to obtain the second data from the data transceiver buffer within the channel transceiver window and send the second data to the hardware driver layer.

[0095] In some embodiments, the frequency hopping communication parameters include a pseudo-random sequence; the communication unit 1006 is used to call the core state machine in the protocol stack to perform channel switching according to the pseudo-random sequence when the frequency hopping timer in the protocol stack times out, obtain the current switched channel, and start the delayed send timer in the protocol stack; wherein the timeout of the frequency hopping timer is used to mark the beginning of the frequency hopping time interval of the current switched channel; when the delayed send timer times out, the second data is obtained from the data send and receive buffer through the core state machine; wherein the timeout of the delayed send timer is used to mark the beginning of the channel send and receive window within the frequency hopping time interval.

[0096] In some embodiments, the hardware driver layer is used to send a data reception notification to the protocol stack when the wireless transceiver module receives the third data; the communication unit 1006 is used to call the core state machine to obtain the third data received by the wireless transceiver module from the hardware driver layer when the data reception notification is obtained; parse the application data in the third data through the core state machine; write the application data to the data transceiver buffer of the protocol stack to instruct the application software layer to read the application data from the data transceiver buffer.

[0097] In some embodiments, the communication device includes a wireless probe; the opposite device includes a CNC machine; the acquisition unit 1004 is used to acquire collision data transmitted by the application software layer of the wireless probe based on the first interface; the collision data is generated in the application software layer when the wireless probe collides with an obstacle; wherein the CNC machine is used to adjust the working state according to the received collision data.

[0098] In some embodiments, the CNC machine in the host mode is used to send a frequency hopping synchronization packet to the wireless probe in the slave mode; the communication unit 1006 is used to obtain the frequency hopping synchronization packet received by the wireless receiving module from the hardware driver layer; determine the frequency hopping communication parameters in the frequency hopping synchronization packet; and perform frequency hopping communication with the CNC machine according to the frequency hopping communication parameters.

[0099] Each unit in the frequency hopping communication device can be implemented in whole or in part by software, hardware, or a combination thereof. Each unit can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute the operations corresponding to each unit.

[0100] In an exemplary embodiment, a computer device is provided. The computer device may be a wireless probe, and its internal structure diagram may be as shown in FIG. Fig.11 As shown. The computer device includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a frequency hopping communication method is implemented.

[0101] In an exemplary embodiment, another computer device is provided. The computer device may be a numerical control machine, and its internal structure diagram may be as shown in FIG. Fig.12As shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit and an input device. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be implemented through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a frequency hopping communication method is implemented. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.

[0102] Those skilled in the art will understand that Fig.11 or Fig.12 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0103] In one embodiment, a computer device is further provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above method embodiments when executing the computer program.

[0104] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0105] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0107] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0108] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A frequency hopping communication method, characterized in that: A protocol stack applied to a communication device, the method comprising: Determining a peer device that performs frequency hopping communication with the communication device; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters; Acquiring first data transmitted by the application software layer of the communication device based on a first interface; the first interface is an interface provided by the protocol stack to the application software layer for implementing real-time data transmission; The first data is transmitted to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

2. The method according to claim 1, characterized in that The method further comprises: Acquiring second data transmitted by the application software layer based on a second interface; the second interface is an interface provided by the protocol stack to the application software layer for implementing non-real-time data transmission; Determine a channel transceiver window within a frequency hopping time interval of the channel currently switched to; The second data is transmitted to the hardware driver layer within the channel transceiver window to instruct the hardware driver layer to drive the wireless transceiver module, so that the wireless transceiver module sends the second data to the opposite device based on the channel currently switched to.

3. The method according to claim 2, characterized in that The acquiring, based on the second interface, the second data transmitted by the application software layer comprises: In response to the calling operation of the application software layer on the second interface, writing the second data transmitted by the application software layer into the data receiving and sending buffer in the protocol stack; The transmitting the second data to the hardware driver layer within the channel transceiver window comprises: The second data is obtained from the data receiving and transmitting buffer within the channel receiving and transmitting window, and the second data is sent to the hardware driver layer.

4. The method according to claim 3, characterized in that The frequency hopping communication parameter includes a pseudo-random sequence; and determining the channel transceiver window within the frequency hopping time interval of the channel currently switched to includes: When the frequency hopping timer in the protocol stack times out, the core state machine in the protocol stack is called to perform channel switching processing according to the pseudo-random sequence to obtain the channel currently switched to, and the delayed sending timer in the protocol stack is started; wherein the timeout of the frequency hopping timer is used to mark the beginning of the frequency hopping time interval of the channel currently switched to; The acquiring the second data from the data transceiver buffer within the channel transceiver window comprises: When the delayed sending timer times out, the second data is obtained from the data receiving and sending buffer through the core state machine; wherein the timeout of the delayed sending timer is used to mark the beginning of the channel receiving and sending window within the frequency hopping time interval.

5. The method according to claim 1, characterized in that The hardware driver layer is used for sending a data reception notification to the protocol stack when the wireless transceiver module receives the third data; The method further comprises: In case of obtaining the data reception notification, calling the core state machine to obtain the third data received by the wireless transceiver module from the hardware driver layer; Parsing the application data in the third data by the core state machine; The application data is written into a data receiving and sending buffer of the protocol stack to instruct the application software layer to read the application data from the data receiving and sending buffer.

6. The method according to any one of claims 1 to 5, characterized in that: The communication device includes a wireless probe; the opposite device includes a numerical control machine; and the first data transmitted by the application software layer of the communication device obtained based on the first interface includes: Acquiring collision data transmitted by the application software layer of the wireless probe based on the first interface; the collision data is generated in the application software layer when the wireless probe collides with an obstacle; Wherein, the numerical control machine is used to adjust the working state according to the received collision data.

7. The method according to claim 6, characterized in that The CNC machine in the host mode is used to send a frequency hopping synchronization packet to the wireless probe in the slave mode; the method also includes: Acquire the frequency hopping synchronization packet received by the wireless receiving module from the hardware driver layer; Determining frequency hopping communication parameters in the frequency hopping synchronization packet; Perform frequency hopping communication with the numerical control machine according to the frequency hopping communication parameters.

8. A frequency hopping communication device, characterized in that: The device comprises: A determination unit, configured to determine a peer device that performs frequency hopping communication with the communication device; wherein the peer device and the communication device perform channel switching processing according to the same frequency hopping communication parameters; an acquisition unit, configured to acquire first data transmitted by the application software layer of the communication device based on a first interface; the first interface is an interface provided by the protocol stack to the application software layer for implementing real-time data transmission; A communication unit is used to transmit the first data to the hardware driver layer of the communication device to instruct the hardware driver layer to drive the wireless transceiver module of the communication device, so that the wireless transceiver module sends the first data to the opposite device based on the channel currently switched to.

9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.