CN114928816A - Device connection method, system, terminal device, detection device and storage medium - Google Patents

Device connection method, system, terminal device, detection device and storage medium Download PDF

Info

Publication number
CN114928816A
CN114928816A CN202210453673.7A CN202210453673A CN114928816A CN 114928816 A CN114928816 A CN 114928816A CN 202210453673 A CN202210453673 A CN 202210453673A CN 114928816 A CN114928816 A CN 114928816A
Authority
CN
China
Prior art keywords
data packet
response data
random number
time
detection device
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.)
Granted
Application number
CN202210453673.7A
Other languages
Chinese (zh)
Other versions
CN114928816B (en
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Xhorse Electronics Co Ltd
Original Assignee
Shenzhen Xhorse Electronics Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Shenzhen Xhorse Electronics Co Ltd filed Critical Shenzhen Xhorse Electronics Co Ltd
Priority to CN202210453673.7A priority Critical patent/CN114928816B/en
Publication of CN114928816A publication Critical patent/CN114928816A/en
Application granted granted Critical
Publication of CN114928816B publication Critical patent/CN114928816B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • BPERFORMING OPERATIONS; TRANSPORTING
    • B60VEHICLES IN GENERAL
    • B60CVEHICLE TYRES; TYRE INFLATION; TYRE CHANGING; CONNECTING VALVES TO INFLATABLE ELASTIC BODIES IN GENERAL; DEVICES OR ARRANGEMENTS RELATED TO TYRES
    • B60C23/00Devices 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/02Signalling devices actuated by tyre pressure
    • B60C23/04Signalling devices actuated by tyre pressure mounted on the wheel or tyre
    • B60C23/0408Signalling 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • H04W48/08Access restriction or access information delivery, e.g. discovery data delivery
    • H04W48/10Access restriction or access information delivery, e.g. discovery data delivery using broadcasted information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W76/00Connection management
    • H04W76/10Connection setup
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing 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 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 the delay sending time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction; transmitting the response data packet after the delay transmission duration; the response packet is used for establishing a connection with the terminal device. By adopting the method, the probability of data collision can be reduced.

Description

Device connection method, system, terminal device, detection device and storage medium
Technical Field
The present application relates to the field of communications technologies, and in particular, to a device connection method, system, terminal device, detection apparatus, and storage medium.
Background
The TPMS (Tire Pressure Monitoring System) is widely used in the field of automobile safety at present, and can ensure driving safety by Monitoring the air Pressure of tires during the running of an automobile and alarming the abnormal condition of the air Pressure in time.
In the direct TPMS, the maintenance is difficult due to differences between manufacturers of vehicles of different brands and even between different models of vehicles of the same brand. Therefore, a general-purpose detection device is available. The communication protocol can be modified through the matched terminal equipment, so that the convenience is greatly improved.
In a general TPMS system, a situation where one terminal device is required to establish connection with a plurality of detection devices is often encountered. The traditional communication connection mode is that the terminal equipment sends a connection instruction, and the detection device directly returns a response packet after receiving the connection instruction. In this case, data transmitted by the detection device is likely 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 the delay sending time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
transmitting the response data packet after the delay transmission duration; the response packet is used for establishing a connection with the terminal device.
A device connection method, the method comprising:
sending a broadcast connection instruction;
receiving a response packet in response to the broadcast connection command; the response data packet is sent after the sending time length is delayed; the delay sending time length is determined according to the generated random number and the time window time length;
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 time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
the detection device sends the response data packet after the sending delay 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 to the response data packet based on the analyzed response data packet;
and after the total time length of the time window, the terminal equipment sends the response data packet to 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 executing the computer program.
A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the respective method.
The device connection method, the system, the terminal device, the detection device and the storage medium receive the broadcast connection instruction sent by the terminal device, generate the random number, determine the delay sending time of the response data packet according to the random number and the time window time, and randomly select the time window to send the response data packet based on the random number, so that the sending time of the response data packet has randomness; and sending the response data packet after delaying the sending time length so as to establish connection with the terminal equipment and reduce the probability of the collision of the response data packet sent by the detection device.
Drawings
FIG. 1 is a diagram of an application environment of a device connection method in one embodiment;
FIG. 2 is a flow diagram illustrating a method for device attachment according to one embodiment;
FIG. 3 is a timing diagram illustrating the delay in sending a response packet according to one embodiment;
FIG. 4 is a timing diagram illustrating the occurrence of a data collision in one embodiment;
FIG. 5 is a flow chart illustrating a method of device attachment in another embodiment;
FIG. 6 is a block diagram showing the structure of a detecting apparatus according to an embodiment;
fig. 7 is an internal configuration diagram of a terminal device in one embodiment.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application.
The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only some embodiments of the present application, and not all embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments in the present application without any inventive step are within the scope of protection of the present application.
It should be noted that all directional indicators (such as upper, lower, left, right, front and rear … …) in the embodiments of the present application are only used to explain the relative position relationship between the components, the movement situation, etc. in a specific posture (as shown in the drawings), and if the specific posture is changed, the directional indicator is changed accordingly, and the connection may be a direct connection or an indirect connection.
In addition, descriptions in this application as to "first", "second", etc. are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicit to the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present application.
In one embodiment, as shown in fig. 1, a diagram of an application environment of a device connection method in one embodiment is shown. Fig. 1 includes a detection apparatus 110 and a terminal device 120. The number of the detecting devices 110 is not limited, and may be at least two. The detection device 110 may specifically be a tire pressure detection device. The tire pressure detection device is used in the field of automobile safety, and can be used for monitoring the air pressure condition of a tire in the driving process of an automobile and timely alarming the abnormal air pressure condition to ensure the driving safety. The terminal devices 120 include, but are not limited to, vehicle diagnostic devices, personal computers, laptops, smartphones, tablets, and portable wearable devices. In this case, since the terminal device cannot know the number and ID of the detection apparatuses to be connected in advance, it is impossible to establish connection with a single detection apparatus one by one. When the terminal device sends a broadcast connection instruction (that is, all the detection devices respond), since the detection devices cannot know the existence of other detection devices, the sent response data packets may possibly collide, that is, multiple sensors send response data packets at the same time, so that the terminal device cannot establish connection with the sensors.
The traditional scheme for preventing data collision is mostly a real-time response method. And adopting a real-time response method, when 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 approach is very susceptible to collisions when multiple detection devices transmit rf 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 applied to the detection apparatus 110 in fig. 1 includes:
step 202, receiving a broadcast connection instruction sent by the terminal device.
The broadcast connection command may be a connection command transmitted by a wireless broadcast. The broadcast connection instruction is not specific to a particular object.
Specifically, in response to a trigger instruction for device connection, the terminal device transmits a broadcast connection instruction. In the case where the detection device needs to connect the sensor, the detection device receives a broadcast connection instruction transmitted from the terminal device.
For example, the frame format of the broadcast connection command is:
lead code Synchronization code Data field Check bit EOF
The EOF is End of frame and the frame is over. The communication frequency band for broadcasting the connection instruction is a low-frequency band of 125khz, and the baud rate is 3906bps (byte per second). The data field contains address information of the terminal device.
Step 204, generating a random number.
The random number may be a sequence number of a time window, or may be multi-bit data.
Specifically, the detection apparatus 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. The CCITT-CRC16 algorithm can be specifically adopted. The detection device may algorithmically generate a random number based on the detection apparatus identification and the time handle.
Step 206, determining the delay sending time length of the response data packet according to the random number and the time window time length; the response packet is used in response to the broadcast connection instruction.
Wherein, the duration of each time window may be the same or different. The duration of the duration window is used for representing the duration of the detection device which finishes processing a broadcast connection instruction and sends a response data packet. The delay sending duration refers to how long the detection device needs to delay sending of the response data packet after the terminal device sends the broadcast connection instruction.
Specifically, the detection means generates a response packet in accordance with the broadcast connection instruction. The random number can be a 16-bit number, and remainder is obtained by dividing the random number by a preset number; and determining the delayed sending time length of the response data packet according to the product of the remainder and the time window time length.
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 Tw 3. The generated random number is 3, and the delay transmission time period is Tw1+ Tw 2.
In this embodiment, the terminal device divides the time for receiving the response packet into n time windows with equal length. The detection device determines the delay transmission duration of the response data packet, namely, one of the time windows is randomly selected as a transmission window through an internal random number.
Step 208, sending a response data packet after delaying the sending time length; the transmitted response packet is used to establish a connection with the terminal device.
Specifically, the detection device transmits the response packet after a delay transmission time period elapses from the reception of the broadcast connection instruction. And the terminal equipment receives the response data packet, and sends the response data packet to the corresponding detection device after the total duration of the time window so as to establish the connection between the detection device and the terminal equipment.
The device connection method comprises the steps of receiving a broadcast connection instruction sent by terminal equipment, generating a random number, determining the delay sending time of a response data packet according to the random number and the time window time, and randomly selecting a time window to send the response data packet based on the random number so that the sending time of the response data packet has randomness; and sending the response data packet after delaying the sending time length so as to establish connection with the terminal equipment, reduce the probability of conflict of the response data packet sent by the detection device, improve the equipment connection efficiency and greatly improve the stability during connection.
In one embodiment, generating a random number comprises: acquiring a detection device identifier and a time handle; a random number is generated based on the detection device identification and the time handle.
Wherein each detection means has a unique identification. The detection device identification can be composed of one or more of numbers, letters and characters. The detection device has a sensor therein. Thus, the detection device identification may be a sensor identification. The time handle (handle) is a number associated with a time. The specific time handle may be the number of interrupt wakeups of the detection device.
Specifically, the detection device acquires a detection device identifier and a time handle; and taking the detection device identification and the time handle as seeds for generating random numbers, and generating the random numbers 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 apparatus, the detection apparatus identifier is fixed, and based on the unfixed time handle and the detection apparatus identifier, the randomness of the random number can be improved.
In one embodiment, obtaining a time handle includes: detecting the interruption and awakening times in the operation from the start of the starting; generating a random number based on the detection device identifier and the time handle, comprising: and generating a random number according to the detection device identification and the interrupt awakening times.
Wherein the time handle comprises the number of interrupt wakeup times. The interruption wakeup frequency refers to the interruption wakeup frequency in a time period from the startup to the shutdown of the detection device. The interrupt is any interrupt that can wake up an MCU (micro controller Unit) of the detection apparatus.
For example, the detection device itself has a unique detection device identification of 4 bytes. Each time an interrupt wakes up the MCU from the low power mode, the time handle is incremented by one, with a length of 16 bits. Each time the command to acquire a random number is called, a Cyclic Redundancy Check (CRC) 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 0x 1021.
The following table shows pseudo random numbers calculated by two detection devices four times in succession when the initial values of the time handles are different:
time handle/detection device identification ID_0 ID_1
Time handle of 200 0x591F 0x4BC5
Time handle 201 0x6E2F 0x7CF5
202 time handle 0X377F 0X25A5
Time handle 203 0x004F 0x1295
In this embodiment, for a certain detection device, the detection device identifier is fixed, and the randomness of the random number can be improved based on the detection device identifier and the unfixed interrupt wakeup times.
In one embodiment, determining the delayed transmission duration of the response packet according to the random number and the time window duration comprises: acquiring the time duration of a time window; acquiring the time length required by data processing; and determining the delayed 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 by 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 Tw and the reserved duration is denoted T p And (4) showing. The data transmission time length, i.e. the time length required for the detection device to transmit the response data packet, is T in this embodiment RFsend And (4) showing. The reserved time length may be determined according to the time length of the terminal device processing the response data packet. For example, the reservation duration may be 1-2 milliseconds. The duration required for processing data refers to the duration required for the detection device to process data, and in this embodiment, T is used ERROR And (4) showing.
Specifically, the detection device obtains the time window duration and obtains the duration required by the detection device to process the data. The detection device determines the delay sending time 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 by processing the data SnDealy
T SnDealy =T ERROR +[Num*(T RFsend +T p )]
Num is the remainder of the random number divided by the predetermined number. T is p The presence of (a) provides the terminal device with the time required for parsing and checking. Thus T p The duration of (2) is determined according to the transmission duration and the performance of the terminal equipment, and is generally much less than T RFsend The length of time.
Fig. 3 is a timing diagram illustrating a time duration of delayed transmission of a response packet according to an embodiment. The detection device includes a sensor. Sensor 1, sensor 2 and sensor 3 are different detection devices. In the figure T LFsend Is the time duration required for the terminal device to transmit data. Tw1 is the time window duration for window 1, Tw2 is the time window duration for window 2, Tw3 is the time window duration for window 3, Tw4 is the time window duration for window 4, Tw (n-1) is the time for window n-1Inter-window duration, Twn, is the time window duration of window n. It is understood that Tw1, Tw2, Tw3, Tw4, Tw (n-1) and Twn may or may not be the same. Ts1Delay is the Delay transmission time period of the sensor 1.
Total time T for receiving data by terminal equipment R =T ERROR +n*(T RFsend +T p )。
n is the total number of time windows. T is a unit of ERROR The reason for this is that different detection devices may require different durations of time to process the same connection command, T ERROR Is much smaller than the sensor sending time length T RFsend On the order of a few microseconds. And reserve time T P Often around 1-2 ms, which prevents T ERROR Causing data collision, reserving time T P Also provides the terminal device with time to process the response packet.
In this embodiment, by setting the time length required for processing data, reserving data processing time for the detection apparatus, and according to the sum of the time length required for processing data and the product obtained by the random number and the time window time length, the delay transmission time length can be determined, and sufficient time is left for data processing.
In one embodiment, determining the delayed transmission duration of the response packet according to the random number and the time window duration comprises: taking a remainder obtained by dividing the random number by a preset number; and determining the delayed 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 the time windows. As shown in fig. 3, if n is 16, the preset number may be 16.
Specifically, the detection device takes a remainder obtained by dividing the random number by a preset number, and determines the delay transmission time length of the response data packet according to the product of the remainder and the time window.
In the embodiment, the time duration of a time window is obtained; acquiring the time length required by data processing; taking a remainder obtained by dividing the random number by a preset number; and determining the delayed sending time length of the response data packet according to the product of the remainder and the time window.
In this embodiment, a remainder obtained by dividing the random number by the preset number is obtained, and the delay sending time length of the response data packet is determined according to the product of the remainder and the time window, so that one window can be randomly selected, and the probability of data collision is reduced.
In one embodiment, when a response packet to the response packet sent by the terminal device is not received within the preset receiving duration, the step of receiving the broadcast connection instruction sent by the 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 specifically be equal to the total duration of the time window.
Specifically, when the detection device does not receive a response packet to the response packet sent by the terminal device within a preset receiving duration, it indicates that the response packet sent by the detection device conflicts with other packets, and therefore, a broadcast connection instruction sent by the receiving terminal device is returned; generating a random number; determining the delay sending time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction; and sending the response data packet after delaying the sending time length until the response data packet is successfully connected with the terminal equipment.
FIG. 4 is a timing diagram illustrating the occurrence of a data collision in one embodiment. Ts1Delay is the Delay transmission time period of the sensor 1. Ts2Delay is the Delay transmission duration of sensor 2. Ts3Delay is the Delay transmission time period of the sensor 3. And Ts2Delay is the same duration as Ts3 Delay. If the detection device 2 and the detection device 3 both determine that the transmission window is the window 4, then the data transmitted by the detection device 2 and the detection device 3 collide, and at this time, the terminal device cannot analyze a normal data packet, and abandons the processing of the detection device selecting the same window. In this case, the terminal device retransmits the broadcast connection command so that the detection device 2 and the detection device 3 both establish a connection with the terminal device.
In this embodiment, when a response packet to the response packet sent by the terminal device is not received within the preset receiving duration, which indicates that a data collision occurs, the response packet needs to be sent to the terminal device again to establish a connection.
In one embodiment, a device connection method includes:
and a step (a1) of receiving a broadcast connection instruction transmitted by the terminal device.
And (a2) acquiring the detection device identifier.
And (a3) detecting the wake-up times of the runtime interrupt from the start-up.
And (a4) generating a random number according to the detection device identification and the interrupt awakening times.
And (a5) acquiring the time window duration.
And a step (a6) of acquiring a time period required for processing the data.
And (a7) taking the remainder of the random number divided by the preset number.
And (a8) determining the delayed transmission time length of the response packet according to the product of the remainder and the time window time length, and the sum of the product and the time length required for processing the data. The response packet is used in response to the broadcast connection command.
And (a9) sending the response data packet after delaying the sending time length. The response packet is used to establish a connection with the terminal device.
And (a10), when a response data packet to the response data packet sent by the terminal equipment is not received within the preset receiving duration, returning to the step of executing the broadcast connection instruction sent by the receiving terminal equipment until the terminal equipment is successfully connected.
The device connection method comprises the steps of receiving a broadcast connection instruction sent by terminal equipment, generating a random number, determining the delay sending time of a response data packet according to the random number and the time window time, and randomly selecting a time window to send the response data packet based on the random number so that the sending time of the response data packet has randomness; and sending the response data packet after delaying the sending time length so as to establish connection with the terminal equipment, reduce the probability of conflict of the response data packet sent by the detection device, improve the equipment connection efficiency and greatly improve the stability during connection.
In an embodiment, as shown in fig. 5, a schematic flowchart of a device connection method in another embodiment is shown, and an example in which the method is applied to a terminal device is described, where the method includes:
step 502, a broadcast connection command is sent.
Step 504, receiving a response packet responding to the broadcast connection command; the response packet is transmitted after delaying the transmission duration; the delayed transmission time duration is determined based on the generated random number and the time window time duration.
Step 506, the response packet is parsed, and a response packet of the response packet is generated based on the parsed response packet.
Specifically, the terminal device parses the response packet, and obtains the detection device identifier of the detection device when the response packet conforms to the protocol agreed in advance. And generating a response packet of the response packet based on the parsed response packet.
Step 508, after the total duration of the time window, sending a response packet to the corresponding detection device to establish a connection with the detection device.
The total duration of the time windows refers to the total duration corresponding to the n time windows.
Specifically, after the total duration of the time window elapses from the transmission of the broadcast connection instruction, the terminal device sequentially transmits response packets to the detection devices corresponding to the detection device identifiers according to the sequence of receiving the response packets, so as to establish connection with the detection devices.
In this embodiment, a response packet responding to the broadcast connection instruction is received, and the response packet may be sent based on a random number randomly selected time window, so that the sending time of the response packet is random; the probability of the conflict of response data packets sent by the detection devices is reduced, and a plurality of detection devices can be connected in one-time broadcast connection command, so that the equipment connection efficiency is improved; and analyzing the response data packet, generating a response data packet to the response data packet based on the response data packet, and sending the response data packet to the corresponding detection device after the total time of the time window, namely uniformly sending the response data packet to each detection device after the total time of the time window, so that data collision can be avoided.
In one embodiment, the method further comprises: and when receiving the response data packet with the conflict, returning to the step of sending the broadcast connection instruction so as to establish the connection with the detection device corresponding to the response data packet with the conflict.
In this embodiment, when receiving the response packet that has collided, the response packet that has collided cannot be analyzed to obtain data, and therefore the step of sending the broadcast connection instruction is returned to be executed to establish connection, so that it is possible to ensure that all detection apparatuses can be connected to the terminal device.
It should be understood that, although the respective steps in the flowcharts of fig. 2 and 5 described above are sequentially displayed as indicated by arrows and the respective steps of the step (a1) through the step (a10) are sequentially displayed as indicated by reference numerals, the steps are not necessarily sequentially performed in the order indicated by the arrows or numerals. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2 and 5 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
In an embodiment, as shown in fig. 6, which is a block diagram of a detection apparatus in an embodiment, the apparatus may adopt a software module or a hardware module, or a combination of the two modules to form a part of the detection apparatus, and the apparatus 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 delay sending duration determining module 606, configured to determine a delay sending duration of the response 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 sending module 608, configured to send a response packet after delaying the sending duration; the response packet is used to establish a connection with the terminal device.
The device connecting device receives a broadcast connection instruction sent by the terminal device, generates a random number, determines the delay sending time length of the response data packet according to the random number and the time window time length, and can randomly select the time window to send the response data packet based on the random number, so that the sending time of the response data packet has randomness; and sending the response data packet after delaying the sending time length so as to establish connection with the terminal equipment, reduce the probability of conflict of the response data packet sent by the detection device, improve the equipment connection efficiency and greatly improve the stability during connection.
In one embodiment, the random number generation module 604 is configured to: detecting the interruption and awakening times in the operation from the start of the starting; and generating a random number according to the detection device identification and the interrupt awakening times.
In this embodiment, for a certain detection device, the detection device identifier is fixed, and the randomness of the random number can be improved based on the detection device identifier and the unfixed interrupt wakeup times.
In one embodiment, the delayed transmission duration determination module 606 is configured to: acquiring the time length of a time window; acquiring the time length required by data processing; 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 by processing the data.
In this embodiment, by setting the duration required for processing data, reserving data processing time for the detection apparatus, and according to the sum of the duration required for processing data and the product obtained by the random number and the time window duration, the delay transmission duration can be determined, and sufficient time is left for data processing.
In one embodiment, the delayed transmission duration determination module 606 is configured to: taking a remainder obtained by dividing the random number by a preset number; and determining the delayed sending time length of the response data packet according to the product of the remainder and the time window.
In this embodiment, a remainder obtained by dividing the random number by the preset number is taken, and the delay sending time length of the response data packet is determined according to the product of the remainder and the time window, so that one window can be randomly selected, and the probability of data collision is reduced.
In an embodiment, when a response packet to the response packet sent by the terminal device is not received within the preset receiving duration, the broadcast connection instruction receiving module 602 is configured to receive a broadcast connection instruction sent by the terminal device until the terminal device is successfully connected.
In this embodiment, when a response packet to the response packet sent by the terminal device is not received within the preset receiving duration, which indicates that a data collision occurs, the response packet needs to be sent to the terminal device again to establish a connection.
In one embodiment, there is provided a device connection apparatus, which may be a part of the device connection apparatus using a software module or a hardware module, or a combination of the two, and specifically includes: 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 a broadcast connection instruction sent by the terminal equipment;
the random number generating module is used for generating random numbers;
a delay sending time length determining module, which is used for determining the delay sending time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
a response data packet sending module for sending a response data packet after delaying the sending time; the response packet is used to establish a connection with the terminal device.
In this embodiment, a response packet responding to the broadcast connection instruction is received, and the response packet may be sent based on a random number randomly selected time window, so that the sending time of the response packet is random; the probability of the conflict of response data packets sent by the detection devices is reduced, and a plurality of detection devices can be connected in one-time broadcast connection command, so that the equipment connection efficiency is improved; and analyzing the response data packet, generating a response data packet to the response data packet based on the response data packet, and sending the response data packet to the corresponding detection device after the total time of the time window, namely uniformly sending the response data packet to each detection device after the total time of the time window, so that data collision can be avoided.
For the specific definition of the device connection apparatus, reference may be made to the above definition of the device connection method, which is not described herein again. The respective modules in the above-described device connection apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in hardware or independent of a processor in the computer device, or can be stored in a memory in the computer device in software, so that the processor can call and execute operations corresponding to the 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 time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
the detection device sends a response data packet after delaying the sending time length, and 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 a response data packet to the corresponding detection device so as to establish connection with the detection device.
In the device connection system, the terminal device sends a broadcast connection instruction, the detection device generates a random number and determines the delay sending duration, and a time window can be randomly selected based on the random number to send the response data packet, so that the sending time of the response data packet has randomness; and sending the response data packet after delaying the sending time length so as to establish connection with the terminal equipment, reduce the probability of conflict of the response data packet sent by the detection device, improve the equipment connection efficiency and greatly improve 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 equipment 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 configured to provide computing and control capabilities. The memory of the terminal equipment 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 operating system and the computer program to run on the non-volatile storage medium. The communication interface of the terminal device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication 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, a key, a track ball or a touch pad arranged on the shell of the terminal equipment, an external keyboard, a touch pad or a mouse and the like.
It will be understood by those skilled in the art that the structure shown in fig. 7 is a block diagram of only a part of the structure related to the present application, and does not constitute a limitation to the terminal device to which the present application is applied, and a specific terminal device may include more or less components than those shown in the figure, or combine some components, or have a different arrangement of components.
In one embodiment, a terminal device is provided, comprising a memory and a processor, the memory having stored therein a computer program that, when executed by the processor, performs the steps of the above-described method embodiments.
In one embodiment, a detection apparatus is provided for implementing the steps of the above-described method embodiments.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.
In one embodiment, a computer program product or computer program is provided that includes computer instructions stored in a computer readable storage medium. The computer instructions are read by a processor of the computer device from the computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware related to instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all the equivalent structures or equivalent processes that can be directly or indirectly applied to other related technical fields by using the contents of the specification and the drawings of the present application are also included in the scope of the present application.

Claims (11)

1. A device connection method, the method comprising:
receiving a broadcast connection instruction sent by terminal equipment;
generating a random number;
determining the delay sending time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
transmitting the response data packet after the delay transmission duration; and the sent response data packet is used for establishing connection with the terminal equipment.
2. The method of claim 1, wherein generating the random number comprises:
acquiring a detection device identifier and a time handle;
and generating a random number according to the detection device identification and the time handle.
3. The method of claim 2, wherein obtaining a time handle comprises:
detecting the interrupt and awakening times in the running process from the start of starting up;
the generating a random number according to the detection device identifier and the time handle includes:
and generating a random number according to the detection device identification and the interrupt awakening times.
4. The method of claim 1, wherein determining the delayed transmission duration of the response packet according to the random number and the time window duration comprises:
acquiring the time duration of a time window;
acquiring the time length required by data processing;
and determining the delayed 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 by processing the data.
5. The method of claim 1, wherein determining the delayed transmission duration of the response packet according to the random number and the time window duration comprises:
taking a remainder obtained by dividing the random number by a preset number;
and determining the delayed sending time length of the response data packet according to the product of the remainder and the time window.
6. The method of claim 1, further comprising:
and when the response data packet to the response data packet sent by the terminal equipment is not received within the preset receiving duration, returning to the step of executing the broadcast connection instruction sent by the receiving terminal equipment until the broadcast connection instruction is successfully connected with the terminal equipment.
7. A device connection method, the method comprising:
sending a broadcast connection instruction;
receiving a response packet in response to the broadcast connection command; the response data packet is sent after delaying the sending time length; the delay sending time length is determined according to the generated random number and the time window time length;
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.
8. A device connection system, characterized in that the system comprises 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 time length of the response data packet according to the random number and the time window time length; the response data packet is used for responding to the broadcast connection instruction;
the detection device sends the response data packet after the sending delay 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 to the response data packet based on the analyzed response data packet;
and after the total time length 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.
9. A detection device, characterized in that it is adapted to implement the steps of the method of any one of claims 1 to 6.
10. A terminal device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of claim 7 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 7.
CN202210453673.7A 2022-04-24 2022-04-24 Device connection method, system, terminal device, detection apparatus, and storage medium Active CN114928816B (en)

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 true CN114928816A (en) 2022-08-19
CN114928816B 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 (19)

* Cited by examiner, † Cited by third party
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
DE4333563C1 (en) * 1993-10-01 1994-07-21 Fraunhofer Ges Forschung Data transmitter with automatic transmission error recognition
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
US20030208517A1 (en) * 2002-03-05 2003-11-06 Shunsuke Takagi Random number data generator
WO2009074118A1 (en) * 2007-12-13 2009-06-18 Huawei Technologies Co., Ltd. A method, system and apparatus for merging multiple beacon groups
CN103475747A (en) * 2013-08-21 2013-12-25 广东浩迪创新科技有限公司 Electric energy meter networked system capable of automatically sending address information and sending method thereof
CN103826316A (en) * 2014-02-24 2014-05-28 江苏林洋电子股份有限公司 Micropower wireless self-organized network broadcast communication method
CN108401168A (en) * 2018-03-02 2018-08-14 深圳创维数字技术有限公司 A kind of contention resolution, device, equipment and storage medium
CN108633102A (en) * 2017-03-24 2018-10-09 北京三星通信技术研究有限公司 The sending, receiving method and equipment of upstream data
US20180359778A1 (en) * 2017-06-13 2018-12-13 Mueller International, Llc Broadcast messaging
CN109151160A (en) * 2018-06-26 2019-01-04 Oppo广东移动通信有限公司 Communication means, device, mobile terminal and storage medium
CN110932843A (en) * 2019-11-19 2020-03-27 湖北工业大学 Data communication encryption method for embedded system
CN111464358A (en) * 2020-04-02 2020-07-28 深圳创维-Rgb电子有限公司 Message reporting method and device
CN111654348A (en) * 2020-06-01 2020-09-11 杭州合图物联技术有限公司 Internet of things data transmission method and device, computer equipment and storage medium
CN111935536A (en) * 2020-07-28 2020-11-13 北京达佳互联信息技术有限公司 Live broadcast room request response method, device, equipment and storage medium
CN113066209A (en) * 2021-03-23 2021-07-02 上海银基信息安全技术股份有限公司 Method and device for safe off-line use of digital key and storage medium
CN113377088A (en) * 2021-07-06 2021-09-10 深圳市星卡科技有限公司 Instant communication automobile remote diagnosis and detection method, electronic equipment and storage medium
US11240671B1 (en) * 2020-08-26 2022-02-01 Alipay (Hangzhou) Information Technology Co., Ltd. Bluetooth device connection methods and bluetooth devices
CN114238182A (en) * 2021-12-20 2022-03-25 北京奕斯伟计算技术有限公司 Processor, data processing method and device

Patent Citations (19)

* Cited by examiner, † Cited by third party
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
DE4333563C1 (en) * 1993-10-01 1994-07-21 Fraunhofer Ges Forschung Data transmitter with automatic transmission error recognition
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
US20030208517A1 (en) * 2002-03-05 2003-11-06 Shunsuke Takagi Random number data generator
WO2009074118A1 (en) * 2007-12-13 2009-06-18 Huawei Technologies Co., Ltd. A method, system and apparatus for merging multiple beacon groups
CN103475747A (en) * 2013-08-21 2013-12-25 广东浩迪创新科技有限公司 Electric energy meter networked system capable of automatically sending address information and sending method thereof
CN103826316A (en) * 2014-02-24 2014-05-28 江苏林洋电子股份有限公司 Micropower wireless self-organized network broadcast communication method
CN108633102A (en) * 2017-03-24 2018-10-09 北京三星通信技术研究有限公司 The sending, receiving method and equipment of upstream data
US20180359778A1 (en) * 2017-06-13 2018-12-13 Mueller International, Llc Broadcast messaging
CN108401168A (en) * 2018-03-02 2018-08-14 深圳创维数字技术有限公司 A kind of contention resolution, device, equipment and storage medium
CN109151160A (en) * 2018-06-26 2019-01-04 Oppo广东移动通信有限公司 Communication means, device, mobile terminal and storage medium
CN110932843A (en) * 2019-11-19 2020-03-27 湖北工业大学 Data communication encryption method for embedded system
CN111464358A (en) * 2020-04-02 2020-07-28 深圳创维-Rgb电子有限公司 Message reporting method and device
CN111654348A (en) * 2020-06-01 2020-09-11 杭州合图物联技术有限公司 Internet of things data transmission method and device, computer equipment and storage medium
CN111935536A (en) * 2020-07-28 2020-11-13 北京达佳互联信息技术有限公司 Live broadcast room request response method, device, equipment and storage medium
US11240671B1 (en) * 2020-08-26 2022-02-01 Alipay (Hangzhou) Information Technology Co., Ltd. Bluetooth device connection methods and bluetooth devices
CN113066209A (en) * 2021-03-23 2021-07-02 上海银基信息安全技术股份有限公司 Method and device for safe off-line use of digital key and storage medium
CN113377088A (en) * 2021-07-06 2021-09-10 深圳市星卡科技有限公司 Instant communication automobile remote diagnosis and detection method, electronic equipment and storage medium
CN114238182A (en) * 2021-12-20 2022-03-25 北京奕斯伟计算技术有限公司 Processor, data processing method and device

Also Published As

Publication number Publication date
CN114928816B (en) 2023-06-23

Similar Documents

Publication Publication Date Title
US10382222B2 (en) Method for protecting configuration data from a data bus transceiver, data bus transceiver and data bus system
CN110071789B (en) Ultra-low power consumption passive awakening method and system
US11351820B2 (en) Tire positioning method and apparatus, electronic control unit and tire pressure sensor
WO2018058963A1 (en) Sensing methods for wireless communication devices
Aoudia et al. Analytical and experimental evaluation of wake-up receivers based protocols
US10223319B2 (en) Communication load determining apparatus
CN114375067A (en) Random access method, response method, terminal and network equipment
US20240140146A1 (en) Tire Pressure Sensor Information Processing Method and Apparatus, and Device
JP6342311B2 (en) CAN (Controller Area Network) communication system and error information recording apparatus
CN114928816B (en) Device connection method, system, terminal device, detection apparatus, and storage medium
US8738939B2 (en) System and method for testing WOL function of computers
JP2012175537A (en) Radio communication system, radio transmitter, radio receiver, and radio communication method
US9619310B2 (en) High speed data transmission methods and systems upon error detection
JP2013526225A (en) Method and apparatus for protecting data packets transmitted over an interface
CN113015089B (en) Multi-label time-sharing working method, device, equipment and storage medium
US11516739B2 (en) Communication methods and devices
CN112732606A (en) Information interaction method, system, equipment and computer readable storage medium
CN112039898A (en) Encrypted communication method, encrypted communication device and vehicle
EP3051888B1 (en) Transmission apparatus, reception apparatus, and communication system
US20170070957A1 (en) Wireless communication device, wireless communication method, and computer program
CN113286330B (en) Data transmission method and device
CN115361095B (en) Data transmission method, intelligent key, device, control system and medium
JP5969399B2 (en) Wireless access point for starting communication by signal using dummy identifier, communication starting program and method
CN109286919A (en) BLE equipment and its data packet receiving method, computer readable storage medium
KR102423504B1 (en) Physical layer security method with can bus node id auto-setting, recording medium and device for performing the method

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