CN114928816B - Device connection method, system, terminal device, detection apparatus, and storage medium - Google Patents
Device connection method, system, terminal device, detection apparatus, and storage medium Download PDFInfo
- Publication number
- CN114928816B CN114928816B CN202210453673.7A CN202210453673A CN114928816B CN 114928816 B CN114928816 B CN 114928816B CN 202210453673 A CN202210453673 A CN 202210453673A CN 114928816 B CN114928816 B CN 114928816B
- Authority
- CN
- China
- Prior art keywords
- data packet
- response data
- detection device
- duration
- random number
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/06—Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
-
- B—PERFORMING OPERATIONS; TRANSPORTING
- B60—VEHICLES IN GENERAL
- B60C—VEHICLE TYRES; TYRE INFLATION; TYRE CHANGING; CONNECTING VALVES TO INFLATABLE ELASTIC BODIES IN GENERAL; DEVICES OR ARRANGEMENTS RELATED TO TYRES
- B60C23/00—Devices for measuring, signalling, controlling, or distributing tyre pressure or temperature, specially adapted for mounting on vehicles; Arrangement of tyre inflating devices on vehicles, e.g. of pumps or of tanks; Tyre cooling arrangements
- B60C23/02—Signalling devices actuated by tyre pressure
- B60C23/04—Signalling devices actuated by tyre pressure mounted on the wheel or tyre
- B60C23/0408—Signalling devices actuated by tyre pressure mounted on the wheel or tyre transmitting the signals by non-mechanical means from the wheel or tyre to a vehicle body mounted receiver
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W48/00—Access restriction; Network selection; Access point selection
- H04W48/08—Access restriction or access information delivery, e.g. discovery data delivery
- H04W48/10—Access restriction or access information delivery, e.g. discovery data delivery using broadcasted information
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W76/00—Connection management
- H04W76/10—Connection setup
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D30/00—Reducing energy consumption in communication networks
- Y02D30/70—Reducing energy consumption in communication networks in wireless communication networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Mechanical Engineering (AREA)
- Computer Security & Cryptography (AREA)
- Multimedia (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
The application relates to a device connection method, a device connection system, a terminal device, a detection device and a storage medium. The method comprises the following steps: receiving a broadcast connection instruction sent by terminal equipment; generating a random number; determining delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction; transmitting the response data packet after the delay transmission time length; the response data packet is used for establishing connection with the terminal equipment. By adopting the method, the probability of data collision can be reduced.
Description
Technical Field
The present disclosure relates to the field of communications technologies, and in particular, to a device connection method, a system, a terminal device, a detection apparatus, and a storage medium.
Background
TPMS (Tire Pressure Monitoring System ) is widely used in the automobile safety field at present, and the running safety is ensured by monitoring the air pressure condition of the tire in the running process of the automobile and alarming the abnormal air pressure condition in time.
In the direct TPMS, since automobile manufacturers of various brands even detection devices used by different vehicle types of the same brands are different, maintenance difficulties are large. Therefore, a general-purpose type detecting device has been developed. The communication protocol can be modified through the terminal equipment matched with the communication protocol, so that the convenience is greatly improved.
In a general-purpose TPMS system, there is often a case where one terminal device is required to establish connection with a plurality of detection devices. In the traditional communication connection mode, the terminal equipment sends a connection instruction, and the detection device directly returns a response packet after receiving the connection instruction. In this case, the data transmitted by the detection device is liable to collide.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a device connection method, system, terminal device, detection apparatus, and storage medium capable of reducing the probability of data collision.
A device connection method, the method comprising:
receiving a broadcast connection instruction sent by terminal equipment;
generating a random number;
determining delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
transmitting the response data packet after the delay transmission time length; the response data packet is used for establishing connection with the terminal equipment.
A device connection method, the method comprising:
transmitting a broadcast connection instruction;
receiving a response data packet responding to the broadcast connection instruction; the response data packet is sent after delaying the sending time; the delay sending duration is determined according to the generated random number and the time window duration;
analyzing the response data packet, and generating a response data packet for the response data packet based on the analyzed response data packet;
and after the total duration of the time window, sending the response data packet to the corresponding detection device so as to establish connection with the detection device.
A device connection system, the system comprising a detection apparatus and a terminal device, wherein:
the terminal equipment sends a broadcast connection instruction;
the detection device generates a random number;
the detection device determines the delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
the detection device sends the response data packet after the delay sending time, wherein the response data packet is used for establishing connection with the terminal equipment;
the terminal equipment analyzes the response data packet and generates a response data packet for the response data packet based on the analyzed response data packet;
and after the total duration of the time window, the terminal equipment sends the response data packet to the corresponding equipment so as to establish connection with the detection device.
A detection apparatus for carrying out the steps of the methods.
A terminal device comprising a memory storing a computer program and a processor implementing the steps of the methods when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the respective method.
According to the device connection method, the system, the terminal device, the detection device and the storage medium, the broadcast connection instruction sent by the terminal device is received, the random number is generated, the delay sending duration of the response data packet is determined according to the random number and the time window duration, and the response data packet can be sent by randomly selecting the time window based on the random number, so that the sending time of the response data packet has randomness; and after the delay sending time, sending the response data packet so as to establish connection with the terminal equipment, and reducing the probability of conflict of the response data packet sent by the detection device.
Drawings
FIG. 1 is an application environment diagram of a device connection method in one embodiment;
FIG. 2 is a flow diagram of a method of device connection in one embodiment;
FIG. 3 is a timing diagram of the time delay transmission duration of a response packet in one embodiment;
FIG. 4 is a timing diagram of data collision in one embodiment;
FIG. 5 is a flow chart of a method of device connection in another embodiment;
FIG. 6 is a block diagram of a detection device in one embodiment;
fig. 7 is an internal structural diagram of a terminal device in one embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without undue burden, are within the scope of the present application.
It should be noted that all directional indicators (such as up, down, left, right, front, and rear … …) in the embodiments of the present application are merely used to explain the relative positional relationship, movement conditions, etc. between the components in a specific posture (as shown in the drawings), if the specific posture is changed, the directional indicators correspondingly change, and the connection may be a direct connection or an indirect connection.
In addition, descriptions such as those related to "first," "second," and the like, are provided for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated in this application. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be regarded as not exist and not within the protection scope of the present application.
In one embodiment, as shown in fig. 1, an application environment diagram of a device connection method in one embodiment is shown. Fig. 1 includes a detection device 110 and a terminal device 120. The number of the detecting devices 110 is not limited, and may be at least two. The detecting device 110 may specifically be a tire pressure detecting device. The tire pressure detection device is used in the field of automobile safety, and ensures the running safety by monitoring the air pressure condition of the tire in the running process of the automobile and alarming the abnormal air pressure condition in time. Terminal devices 120 include, but are not limited to, vehicle diagnostic devices, personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices. In this case, since the terminal apparatus cannot know in advance the number and IDs of the detection devices that need to be connected, it is impossible to establish a connection with a single detection device one by one. When the terminal sends a broadcast connection instruction (i.e. all the detection devices respond), the detection devices cannot know the existence of other detection devices, and the sent response data packets are likely to collide, i.e. a plurality of sensors send response data packets at the same time, so that the terminal equipment cannot establish connection with the sensors.
Conventional schemes for preventing data collision are mostly real-time response methods. When the real-time response method is adopted and the scene is faced, the terminal equipment sends a connection instruction, and the detection device directly sends a response packet after receiving the connection instruction. This method is very susceptible to collisions when multiple detection devices transmit radio frequency data simultaneously. A flow diagram of a device connection method as in fig. 2 is therefore presented.
In one embodiment, as shown in fig. 2, a device connection method is applied to the detection apparatus 110 in fig. 1, and includes:
and 202, receiving a broadcast connection instruction sent by the terminal equipment.
The broadcast connection instruction may specifically be a connection instruction transmitted by a wireless broadcast manner. The broadcast connection instruction is not directed to a particular object.
Specifically, in response to a trigger instruction for device connection, the terminal device transmits a broadcast connection instruction. And under the condition that the detection device needs to be connected with the sensor, the detection device receives a broadcast connection instruction sent by the terminal equipment.
For example, the frame format of the broadcast connection instruction is:
preamble code | Synchronous code | Data field | Check bit | EOF |
Where EOF is End of frame, end of frame. The communication band of the broadcast connection instruction is a low frequency band of 125khz (kilohertz), and the baud rate is 3906bps (bit per second). The data field contains address information of the terminal device.
The random number may be a sequence number of a time window or multi-bit data.
Specifically, the detection device may directly generate the random number through the random number generation module. The random number generation unit may be a hardware unit. Alternatively, the detection device generates a random number by an algorithm. Specifically, the CCITT-CRC16 algorithm can be adopted. The detection device may algorithmically generate a random number based on the detection device identification and the time handle.
Wherein, the duration of each time window can be the same or different. The duration window duration is used for characterizing the duration that the detection device finishes processing one broadcast connection instruction and sends a response data packet. The delay transmission duration refers to how long the detection device needs to delay transmitting the response data packet after the terminal device transmits the broadcast connection instruction.
Specifically, the detection device generates a response packet according to the broadcast connection instruction. The random number can be a 16-bit number, and the remainder is obtained by dividing the random number by a preset number; and determining the delay sending duration of the response data packet according to the product of the remainder and the time window duration.
Alternatively, each time window duration may be different. For example, window 1 corresponds to time window duration Tw1, window 2 corresponds to time window duration Tw2, and window 3 corresponds to time window duration Tw3. The generated random number is 3, and then the delay transmission period is tw1+tw2.
In this embodiment, the terminal device divides the time for receiving the response packet into n time windows of equal length. The detection device determines the delay sending duration of the response data packet, namely, one of the time windows is randomly selected as a sending window through the internal random number.
Specifically, after a delay transmission period has elapsed since the reception of the broadcast connection instruction, the detection device transmits the response packet. And the terminal equipment receives the response data packet, and after the total duration of the time window, the response data packet is sent to the corresponding detection device so as to establish the connection between the detection device and the terminal equipment.
According to the equipment connection method, the broadcast connection instruction sent by the terminal equipment is received, the random number is generated, the delay sending duration of the response data packet is determined according to the random number and the time window duration, and the response data packet can be sent by randomly selecting the time window based on the random number, so that the sending time of the response data packet has randomness; and after the delay sending time, sending the response data packet so as to establish connection with the terminal equipment, reducing the probability of conflict of the response data packet sent by the detection device, improving the equipment connection efficiency and greatly improving the stability during connection.
In one embodiment, generating the random number includes: acquiring a detection device identifier and a time handle; and generating a random number according to the detection device identification and the time handle.
Wherein each detection device has a unique identification. The detection device identification can be composed of one or more of numbers, letters and characters. The detection device is provided with a sensor. Thus, the detection device identification may be a sensor identification. The time handle (handle) is a number that is related to time. The specific time handle may be the number of interrupt wakeups of the detecting means.
Specifically, the detection device acquires a detection device identifier and a time handle; the detection device identification and the time handle are used as seeds for generating random numbers, and the random numbers are generated by adopting algorithms such as CCITT-CRC16 and the like according to the detection device identification and the time handle.
In this embodiment, for a certain detection device, the detection device identifier is fixed, and based on the time handle and the detection device identifier, which are not fixed, the randomness of the random number can be improved.
In one embodiment, obtaining the time handle includes: detecting the number of interrupt awakening times during operation from the start-up; generating a random number based on the detection device identification and the time handle, comprising: and generating a random number according to the detection device identification and the interrupt wakeup times.
Wherein the time handle includes interrupt wakeup times. The interrupt wakeup times are the interrupt wakeup times of the detection device in a period from startup to shutdown. The interrupt is any interrupt that can wake up the MCU (Microcontroller Unit, micro control unit) of the detection device.
For example, the detection device itself has a unique detection device identification of 4 bytes. Each time there is an interrupt to wake up the MCU from the low power mode, the time handle is incremented by one, and the time handle length is 16bits. Each time a command to acquire a random number is invoked, the CRC (Cyclic Redundancy Check ) result of the detection device identification is calculated using the time handle as an initial value, where the CRC has a width of 16bits and a polynomial of 0x1021.
The following table is a pseudo-random number obtained by four consecutive computations by two detection devices under the condition that initial values of time handles are different:
time handle/detection device identification | ID_0 | ID_1 |
Time handle=200 | 0x591F | 0x4BC5 |
Time handle = 201 | 0x6E2F | 0x7CF5 |
Time handle = 202 | 0X377F | 0X25A5 |
Time handle = 203 | 0x004F | 0x1295 |
In this embodiment, for a certain detection device, the detection device identifier is fixed, and based on the detection device identifier and the number of interrupt awakenings that are not fixed, the randomness of the random number can be improved.
In one embodiment, determining the delayed transmission duration of the response data packet based on the random number and the time window duration includes: acquiring the time window duration; acquiring the time length required for processing the data; and determining the delay sending time length of the response data packet according to the product of the random number and the time window time length and the sum of the product and the time length required for processing the data.
The time window duration comprises a data sending duration and a reserved duration. In this embodiment, the time window duration is denoted by Tw, and the reserved duration is denoted by T p And (3) representing. The data transmission duration is the duration required by the detection device to transmit the response data packet, and in this embodiment, T is used RFsend And (3) representing. The reserved time period may be determined according to a time period for the terminal device to process the response data packet. For example, the reservation duration may be 1-2 milliseconds. The time required for processing the data refers to the time required for the detection device to process the data, in this embodiment, T is used ERROR And (3) representing.
Specifically, the detection device acquires the time window duration and the duration required by the detection device to process the data. The detection device determines the delay transmission time length T of the response data packet according to the product of the random number and the time window time length, the sum of the product and the time length required for processing the data SnDealy 。
T SnDealy =T ERROR +[Num*(T RFsend +T p )]
Num is the remainder of the random number divided by the preset number. T (T) p The presence of (c) provides the terminal device with the time required for parsing and checking. Thus T is p The duration of (2) is determined according to the transmission duration and the performance of the terminal equipment, and is generally much smaller than T RFsend Is a time period of (2).
As shown in fig. 3, a timing diagram of the delay transmission duration of the response packet in one embodiment is shown. The detection means comprise a sensor. Sensor 1, sensor 2 and sensor 3 are different detection means. T in the figure LFsend Is the time period required for the terminal device to transmit data. Tw1 is the time window duration of window 1, tw2 is the time window duration of window 2, tw3 is the time window duration of window 3, tw4 is the time window duration of window 4, tw (n-1) is the time window duration of window n-1, tw is the time window duration of window n. It will be appreciated that Tw1, tw2, tw3, tw4, tw (n-1) and Tw n may be the same or different. Ts1Delay is the Delay transmission duration of the sensor 1.
Total duration T of data received by the terminal device R =T ERROR +n*(T RFsend +T p )。
n is the total number of time windows. T (T) ERROR The reason for this is that different detecting devices need different time lengths when processing the same connection instruction, T ERROR The size of (2) is much smaller than the sensor transmission duration T RFsend On the order of a few microseconds. While the reserved time T P Often around 1-2 ms, which prevents T ERROR Cause data collision, reserve time T P The presence of (c) also provides the terminal device with time to process the response data packet.
In this embodiment, the delay transmission duration can be determined by setting the duration required for processing the data, reserving the data processing time for the detection device, and according to the sum of the duration required for processing the data and the product obtained by the random number and the time window duration, leaving enough time for data processing.
In one embodiment, determining the delayed transmission duration of the response data packet based on the random number and the time window duration includes: taking the remainder obtained by dividing the random number by a preset number; and determining the delay sending time length of the response data packet according to the product of the remainder and the time window.
The preset number may specifically be the total number of time windows. As shown in fig. 3, if n=16, the preset number may be 16.
Specifically, the detecting device takes the remainder obtained by dividing the random number by the preset number, and determines the delay transmission duration of the response data packet according to the product of the remainder and the time window.
In this embodiment, the time window duration is obtained; acquiring the time length required for processing the data; taking the remainder obtained by dividing the random number by a preset number; and determining the delay sending time length of the response data packet according to the product of the remainder and the time window.
In this embodiment, the remainder obtained by dividing the random number by the preset number is taken, and the delay transmission duration of the response data packet is determined according to the product of the remainder and the time window, so that a window can be randomly selected, and the probability of data collision is reduced.
In one embodiment, when the response data packet sent by the terminal device to the response data packet is not received within the preset receiving duration, the step of executing the broadcast connection instruction sent by the receiving terminal device is returned until the terminal device is successfully connected.
The preset receiving time length refers to a time length set in the detection device. The preset receiving duration may be specifically equal to the total duration of the time window.
Specifically, when the detection device does not receive the response data packet to the response data packet sent by the terminal device within the preset receiving time, it is indicated that the response data packet sent by the detection device collides with other data packets, so that a broadcast connection instruction sent by the receiving terminal device is returned to be executed; generating a random number; determining delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction; and after the delay sending time, sending a response data packet until the response data packet is successfully connected with the terminal equipment.
FIG. 4 is a timing diagram illustrating the occurrence of data collisions in one embodiment. Ts1Delay is the Delay transmission duration of the sensor 1. Ts2Delay is the Delay transmission duration of the sensor 2. Ts3Delay is the Delay transmission duration of the sensor 3. And the duration of Ts2Delay is the same as the duration of Ts3 Delay. If the detection device 2 and the detection device 3 both determine that the transmission window is the window 4, the data transmitted by the detection device 2 and the data transmitted by the detection device 3 collide, and at this time, the terminal device cannot analyze the normal data packet, and the processing of the detection device selecting the same window is abandoned. In this case the broadcast connection instruction is retransmitted by the terminal device so that both the detecting means 2 and the detecting means 3 establish a connection with the terminal device.
In this embodiment, when the response data packet sent by the terminal device to the response data packet is not received within the preset receiving duration, which indicates that a data collision occurs, the response data packet needs to be sent to the terminal device again to establish a connection.
In one embodiment, a device connection method includes:
and (a 1) receiving a broadcast connection instruction sent by the terminal equipment.
And (a 2) acquiring the identification of the detection device.
And (a 3) detecting the interrupt awakening times during operation from the start-up.
And (a 4) generating a random number according to the detection device identification and the interrupt wakeup times.
Step (a 5), obtaining the time window duration.
And (a 6) acquiring the time length required for processing the data.
And (a 7) taking the remainder obtained by dividing the random number by the preset number.
And (a 8) determining the delay sending duration of the response data packet according to the product of the remainder and the time window duration, and the sum of the product and the duration required for processing the data. The response packet is used for responding to the broadcast connection instruction.
And (a 9) transmitting the response data packet after delaying the transmission time period. The response data packet is used to establish a connection with the terminal device.
And (a 10) when the response data packet of the response data packet sent by the terminal equipment is not received within the preset receiving time, returning to the step of executing the broadcast connection instruction sent by the receiving terminal equipment until the terminal equipment is successfully connected.
According to the equipment connection method, the broadcast connection instruction sent by the terminal equipment is received, the random number is generated, the delay sending duration of the response data packet is determined according to the random number and the time window duration, and the response data packet can be sent by randomly selecting the time window based on the random number, so that the sending time of the response data packet has randomness; and after the delay sending time, sending the response data packet so as to establish connection with the terminal equipment, reducing the probability of conflict of the response data packet sent by the detection device, improving the equipment connection efficiency and greatly improving the stability during connection.
In one embodiment, as shown in fig. 5, a flowchart of a method for connecting devices in another embodiment is illustrated, where the method is applied to a terminal device, and includes:
In step 506, the response packet is parsed, and a response packet for the response packet is generated based on the parsed response packet.
Specifically, the terminal device analyzes the response data packet, and obtains the detection device identifier of the detection device when the response data packet accords with a pre-agreed protocol. And generating a response data packet of the response data packet based on the parsed response data packet.
The total time length of the time windows refers to the total time length corresponding to the n time windows.
Specifically, after the total duration of the time window passes after the broadcast connection instruction is sent, the terminal equipment sequentially sends response data packets to the detection device corresponding to the detection device identifier according to the sequence of receiving the response data packets so as to establish connection with the detection device.
In this embodiment, a response data packet for responding to the broadcast connection instruction is received, and the response data packet may be sent by randomly selecting a time window based on a random number, so that the sending time of the response data packet has randomness; the probability of response data packet collision sent by the detection device is reduced, and in one broadcast connection command, a plurality of detection devices can be connected, so that the equipment connection efficiency is improved; analyzing the response data packet, generating a response data packet for the response data packet based on the response data packet, and after the total time length of the time window, transmitting the response data packet to the corresponding detection device, namely uniformly transmitting the response data packet to each detection device after the total time length of the time window, so that data collision can be avoided.
In one embodiment, the method further comprises: when the response data packet with the conflict is received, the step of sending the broadcast connection instruction is returned to be executed so as to establish the connection of the detection device corresponding to the response data packet with the conflict.
In this embodiment, when the response packet with the collision is received, the response packet with the collision cannot be parsed to obtain data, so that the step of sending the broadcast connection instruction is performed in a return manner to establish a connection, and it can be ensured that all the detection devices can be connected with the terminal device.
It should be understood that, although the steps of the flowcharts of fig. 2 and 5 are shown in sequence as indicated by the arrows, and the steps of steps (a 1) to (a 10) are shown in sequence as indicated by the numerals, these steps are not necessarily performed in sequence as indicated by the arrows or numerals. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps in fig. 2 and 5 may include a plurality of steps or stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the execution of the steps or stages is not necessarily sequential, but may be performed in turn or alternately with at least a portion of the steps or stages in other steps or other steps.
In one embodiment, as shown in fig. 6, a block diagram of a detection device in one embodiment, where the detection device may use a software module or a hardware module, or a combination of both, to form a part of the detection device, where the detection device specifically includes: a broadcast connection instruction receiving module 602, a random number generating module 604, a delay transmission duration determining module 606, and a response packet transmitting module 608, wherein:
a broadcast connection instruction receiving module 602, configured to receive a broadcast connection instruction sent by a terminal device;
a random number generation module 604 for generating a random number;
a delayed transmission duration determining module 606, configured to determine a delayed transmission duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
a response packet transmitting module 608, configured to transmit a response packet after delaying the transmission time period; the response data packet is used to establish a connection with the terminal device.
The device connecting device receives the broadcast connection instruction sent by the terminal device, generates the random number, determines the delay sending duration of the response data packet according to the random number and the time window duration, and can randomly select the time window based on the random number to send the response data packet, so that the sending time of the response data packet has randomness; and after the delay sending time, sending the response data packet so as to establish connection with the terminal equipment, reducing the probability of conflict of the response data packet sent by the detection device, improving the equipment connection efficiency and greatly improving the stability during connection.
In one embodiment, the random number generation module 604 is configured to: detecting the number of interrupt awakening times during operation from the start-up; and generating a random number according to the detection device identification and the interrupt wakeup times.
In this embodiment, for a certain detection device, the detection device identifier is fixed, and based on the detection device identifier and the number of interrupt awakenings that are not fixed, the randomness of the random number can be improved.
In one embodiment, the delayed transmission duration determination module 606 is configured to: acquiring the time window duration; acquiring the time length required for processing the data; and determining the delay sending time length of the response data packet according to the product of the random number and the time window time length and the sum of the product and the time length required for processing the data.
In this embodiment, the delay transmission duration can be determined by setting the duration required for processing the data, reserving the data processing time for the detection device, and according to the sum of the duration required for processing the data and the product obtained by the random number and the time window duration, leaving enough time for data processing.
In one embodiment, the delayed transmission duration determination module 606 is configured to: taking the remainder obtained by dividing the random number by a preset number; and determining the delay sending time length of the response data packet according to the product of the remainder and the time window.
In this embodiment, the remainder obtained by dividing the random number by the preset number is taken, and the delay transmission duration of the response data packet is determined according to the product of the remainder and the time window, so that a window can be randomly selected, and the probability of data collision is reduced.
In one embodiment, when the response packet sent by the terminal device for the response packet is not received within the preset receiving duration, the broadcast connection instruction receiving module 602 is configured to receive the broadcast connection instruction sent by the terminal device until the connection with the terminal device is successful.
In this embodiment, when the response data packet sent by the terminal device to the response data packet is not received within the preset receiving duration, which indicates that a data collision occurs, the response data packet needs to be sent to the terminal device again to establish a connection.
In one embodiment, a device connection apparatus is provided, which may employ a software module or a hardware module, or a combination of both, as part of the device connection apparatus, the apparatus specifically comprising: the device comprises a broadcast connection instruction sending module, a response data packet receiving module, a delay sending duration determining module and a response data packet sending module, wherein:
the broadcast connection instruction receiving module is used for receiving the broadcast connection instruction sent by the terminal equipment;
the random number generation module is used for generating random numbers;
the delay sending duration determining module is used for determining the delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
the response data packet sending module is used for sending a response data packet after delaying the sending time length; the response data packet is used to establish a connection with the terminal device.
In this embodiment, a response data packet for responding to the broadcast connection instruction is received, and the response data packet may be sent by randomly selecting a time window based on a random number, so that the sending time of the response data packet has randomness; the probability of response data packet collision sent by the detection device is reduced, and in one broadcast connection command, a plurality of detection devices can be connected, so that the equipment connection efficiency is improved; analyzing the response data packet, generating a response data packet for the response data packet based on the response data packet, and after the total time length of the time window, transmitting the response data packet to the corresponding detection device, namely uniformly transmitting the response data packet to each detection device after the total time length of the time window, so that data collision can be avoided.
The specific definition of the device connection apparatus may be referred to the definition of the device connection method hereinabove, and will not be described herein. The respective modules in the above-described device connection apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a communication connection system, the system comprising a detection device and a terminal device, wherein:
the terminal equipment sends a broadcast connection instruction;
the detection device generates a random number;
the detection device determines the delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
the detection device transmits a response data packet after delaying the transmission time, wherein the response data packet is used for establishing connection with the terminal equipment;
the terminal equipment analyzes the response data packet and generates a response data packet for the response data packet based on the analyzed response data packet;
after the total duration of the time window, the terminal equipment sends a response data packet to the corresponding detection device so as to establish connection with the detection device.
According to the equipment connection system, the terminal equipment sends the broadcast connection instruction, the detection device generates the random number and determines the delay sending duration, and the response data packet can be sent by randomly selecting a time window based on the random number, so that the sending time of the response data packet has randomness; and after the delay sending time, sending the response data packet so as to establish connection with the terminal equipment, reducing the probability of conflict of the response data packet sent by the detection device, improving the equipment connection efficiency and greatly improving the stability during connection.
In one embodiment, a terminal device is provided, the internal structure of which may be as shown in fig. 7. The terminal device comprises a processor, a memory, a communication interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the terminal device is adapted to provide computing and control capabilities. The memory of the terminal device comprises a nonvolatile 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 computer programs in the non-volatile storage media. The communication interface of the terminal device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a device connection method. The display screen of the terminal equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the terminal equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the terminal equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 7 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the terminal device to which the present application is applied, and that a particular terminal device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, a terminal device is provided, comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method embodiments described above when executing the computer program.
In one embodiment, a detection device is provided for implementing the steps of the method embodiments described above.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, implements the steps of the method embodiments described above.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the steps of the method embodiments described above.
Those skilled in the art will appreciate that implementing all or part of the above described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a non-transitory computer readable storage medium, which when executed may comprise the steps of the above described embodiments of the methods. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.
Claims (9)
1. A method of device connection, the method comprising:
detecting the number of interrupt awakening times during operation from the start-up;
receiving a broadcast connection instruction sent by terminal equipment;
acquiring a detection device identifier;
generating a random number according to the detection device identification and the interrupt wakeup times;
determining delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
transmitting the response data packet after the delay transmission time length; and the sent response data packet is used for establishing connection with the terminal equipment.
2. The method of claim 1, wherein determining the delayed transmission duration of the response packet based on the random number and the time window duration comprises:
acquiring the time window duration;
acquiring the time length required for processing the data;
and determining the delay sending time length of the response data packet according to the product of the random number and the time length of the time window, and the sum of the product and the time length required for processing the data.
3. The method of claim 1, wherein determining the delayed transmission duration of the response packet based on the random number and the time window duration comprises:
taking the remainder obtained by dividing the random number by a preset number;
and determining the delay sending time length of the response data packet according to the product of the remainder and the time window.
4. The method of claim 1, the method further comprising:
and when the response data packet sent by the terminal equipment to the response data packet is not received within the preset receiving time, returning to the step of executing the broadcast connection instruction sent by the receiving terminal equipment until the terminal equipment is successfully connected.
5. A method of device connection, the method comprising:
transmitting a broadcast connection instruction;
receiving a response data packet responding to the broadcast connection instruction; the response data packet is sent after delaying the sending time; the delay sending duration is determined according to the generated random number and the time window duration; the random number is generated by the corresponding detection device according to the identification of the detection device and the interrupt wakeup times; the interrupt awakening times are from the start-up, and the detection device detects the interrupt awakening times during operation;
analyzing the response data packet, and generating a response data packet of the response data packet based on the analyzed response data packet;
and after the total duration of the time window, sending the response data packet to the corresponding detection device so as to establish connection with the detection device.
6. A device connection system, characterized in that the system comprises a detection means and a terminal device, wherein:
the detection device detects the interrupt awakening times during operation from the start-up;
the terminal equipment sends a broadcast connection instruction;
the detection device acquires a detection device identifier and generates a random number according to the detection device identifier and the interrupt wakeup times;
the detection device determines the delay sending duration of the response data packet according to the random number and the time window duration; the response data packet is used for responding to the broadcast connection instruction;
the detection device sends the response data packet after the delay sending time, wherein the response data packet is used for establishing connection with the terminal equipment;
the terminal equipment analyzes the response data packet and generates a response data packet for the response data packet based on the analyzed response data packet;
and after the total duration of the time window, the terminal equipment sends the response data packet to the corresponding detection device so as to establish connection with the detection device.
7. A detection device comprising a memory and a processor, the memory storing a computer program, characterized in that the device implements the steps of the method of any one of claims 1 to 4 when the computer program is executed.
8. A terminal device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of claim 5 when executing the computer program.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210453673.7A CN114928816B (en) | 2022-04-24 | 2022-04-24 | Device connection method, system, terminal device, detection apparatus, and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210453673.7A CN114928816B (en) | 2022-04-24 | 2022-04-24 | Device connection method, system, terminal device, detection apparatus, and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114928816A CN114928816A (en) | 2022-08-19 |
CN114928816B true CN114928816B (en) | 2023-06-23 |
Family
ID=82806910
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210453673.7A Active CN114928816B (en) | 2022-04-24 | 2022-04-24 | Device connection method, system, terminal device, detection apparatus, and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114928816B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE4333563C1 (en) * | 1993-10-01 | 1994-07-21 | Fraunhofer Ges Forschung | Data transmitter with automatic transmission error recognition |
CN110932843A (en) * | 2019-11-19 | 2020-03-27 | 湖北工业大学 | Data communication encryption method for embedded system |
CN113066209A (en) * | 2021-03-23 | 2021-07-02 | 上海银基信息安全技术股份有限公司 | Method and device for safe off-line use of digital key and storage medium |
Family Cites Families (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4598285A (en) * | 1983-05-27 | 1986-07-01 | At&T Bell Laboratories | Scheme for reducing transmission delay following collision of transmissions in communication networks |
US6112323A (en) * | 1998-06-29 | 2000-08-29 | Microsoft Corporation | Method and computer program product for efficiently and reliably sending small data messages from a sending system to a large number of receiving systems |
JP3695409B2 (en) * | 2002-03-05 | 2005-09-14 | ソニー株式会社 | Random number data generation circuit |
CN101459444B (en) * | 2007-12-13 | 2010-08-25 | 华为技术有限公司 | Multiple beacon group combining method, system and apparatus |
CN103475747B (en) * | 2013-08-21 | 2017-04-12 | 广东浩迪创新科技有限公司 | Address information sending method of electric energy meter networked system capable of automatically sending address information |
CN103826316A (en) * | 2014-02-24 | 2014-05-28 | 江苏林洋电子股份有限公司 | Micropower wireless self-organized network broadcast communication method |
CN108633102B (en) * | 2017-03-24 | 2021-08-24 | 北京三星通信技术研究有限公司 | Method and equipment for sending and receiving uplink data |
US10560968B2 (en) * | 2017-06-13 | 2020-02-11 | Mueller International, Llc | Broadcast messaging |
CN108401168B (en) * | 2018-03-02 | 2021-04-06 | 深圳创维数字技术有限公司 | Conflict resolution method, device, equipment and storage medium |
CN109151160B (en) * | 2018-06-26 | 2021-04-13 | Oppo广东移动通信有限公司 | Communication method, communication device, mobile terminal and storage medium |
CN111464358B (en) * | 2020-04-02 | 2021-08-20 | 深圳创维-Rgb电子有限公司 | Message reporting method and device |
CN111654348B (en) * | 2020-06-01 | 2022-10-18 | 杭州合图物联技术有限公司 | Internet of things data transmission method and device, computer equipment and storage medium |
CN111935536B (en) * | 2020-07-28 | 2022-07-08 | 北京达佳互联信息技术有限公司 | Live broadcast room request response method, device, equipment and storage medium |
CN111935693B (en) * | 2020-08-26 | 2022-05-06 | 支付宝(杭州)信息技术有限公司 | Bluetooth device connection method and Bluetooth device |
CN113377088B (en) * | 2021-07-06 | 2023-12-19 | 深圳市星卡科技股份有限公司 | Instant messaging automobile remote diagnosis detection method, electronic equipment and storage medium |
CN114238182B (en) * | 2021-12-20 | 2023-10-20 | 北京奕斯伟计算技术股份有限公司 | Processor, data processing method and device |
-
2022
- 2022-04-24 CN CN202210453673.7A patent/CN114928816B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
DE4333563C1 (en) * | 1993-10-01 | 1994-07-21 | Fraunhofer Ges Forschung | Data transmitter with automatic transmission error recognition |
CN110932843A (en) * | 2019-11-19 | 2020-03-27 | 湖北工业大学 | Data communication encryption method for embedded system |
CN113066209A (en) * | 2021-03-23 | 2021-07-02 | 上海银基信息安全技术股份有限公司 | Method and device for safe off-line use of digital key and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114928816A (en) | 2022-08-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7415624B2 (en) | System and method for saving power in a wireless network by reducing power to a wireless station for a time interval if a received packet fails an integrity check | |
US10904121B2 (en) | Data packet transmission method and device | |
CN108449198A (en) | A kind of method, system and the storage device of OTA upgradings | |
Aoudia et al. | Analytical and experimental evaluation of wake-up receivers based protocols | |
CN113645600A (en) | Data transmission method, device, terminal and storage medium | |
CN114928816B (en) | Device connection method, system, terminal device, detection apparatus, and storage medium | |
CN112653668B (en) | Data interaction method and device, computer equipment and storage medium | |
US11849398B2 (en) | Communication methods and devices | |
JP2013526225A (en) | Method and apparatus for protecting data packets transmitted over an interface | |
US10548081B2 (en) | Wireless communication device and wireless communication method using a carrier sensing technique | |
CN113645577A (en) | Wireless communication method, device, equipment and readable storage medium | |
US20220397605A1 (en) | Detection method and apparatus of communication chip, and device and medium | |
CN114500323B (en) | Communication state detection method, master station, slave station, and readable storage medium | |
JP5969399B2 (en) | Wireless access point for starting communication by signal using dummy identifier, communication starting program and method | |
CN113286330B (en) | Data transmission method and device | |
EP3051888B1 (en) | Transmission apparatus, reception apparatus, and communication system | |
CN110677877A (en) | Wireless management frame sending method and device, AP (access point) equipment and storage medium | |
CN111935834B (en) | Data transmission method, device, computer equipment and storage medium | |
CN109286919A (en) | BLE equipment and its data packet receiving method, computer readable storage medium | |
KR102672174B1 (en) | Techniques for reducing uplink feedback latency for virtual reality devices in multi-user deployments | |
CN118764543A (en) | Inter-process communication method and device, electronic equipment, storage medium and vehicle-mounted platform | |
CN115633411A (en) | Device connection method, system, sensor, terminal device and storage medium | |
CN117992201A (en) | Interrupt information processing method, electronic device, and readable storage medium | |
CN117255314A (en) | Communication processing method and electronic equipment | |
CN114861691A (en) | Information sending and acquiring method and device, label, reader-writer, medium and equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |