CN113505618B - Method and device for establishing communication connection, storage medium and electronic device - Google Patents

Method and device for establishing communication connection, storage medium and electronic device Download PDF

Info

Publication number
CN113505618B
CN113505618B CN202110833261.1A CN202110833261A CN113505618B CN 113505618 B CN113505618 B CN 113505618B CN 202110833261 A CN202110833261 A CN 202110833261A CN 113505618 B CN113505618 B CN 113505618B
Authority
CN
China
Prior art keywords
remote terminal
data packet
target
target data
determining
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
Application number
CN202110833261.1A
Other languages
Chinese (zh)
Other versions
CN113505618A (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.)
Sunwave Communications Co Ltd
Original Assignee
Sunwave Communications 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 Sunwave Communications Co Ltd filed Critical Sunwave Communications Co Ltd
Priority to CN202110833261.1A priority Critical patent/CN113505618B/en
Publication of CN113505618A publication Critical patent/CN113505618A/en
Application granted granted Critical
Publication of CN113505618B publication Critical patent/CN113505618B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10009Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10009Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves
    • G06K7/10198Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation sensing by radiation using wavelengths larger than 0.1 mm, e.g. radio-waves or microwaves setting parameters for the interrogator, e.g. programming parameters and operating modes

Landscapes

  • Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Electromagnetism (AREA)
  • General Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention provides a method, a device, a storage medium and an electronic device for establishing communication connection, wherein the method comprises the following steps: receiving a target data packet sent by a main device; matching the first media access control address of the remote terminal device with the second media access control address included in the target data packet to obtain a matching result; under the condition that the matching result indicates that the matching is successful, determining a target random value corresponding to the remote terminal equipment; and sending a response message for responding to the target data packet to the master device to establish a communication connection with the master device under the condition that the target random value meets the preset condition. The invention solves the problems that the communication connection between the main equipment and the plurality of remote terminal equipment in the related technology is long, and the channels are occupied for a long time, so that other services are influenced, and improves the efficiency of the communication connection between the main equipment and the plurality of remote terminal equipment.

Description

Method and device for establishing communication connection, storage medium and electronic device
Technical Field
The embodiment of the invention relates to the field of communication, in particular to a method and device for establishing communication connection, a storage medium and an electronic device.
Background
RF (radio frequency) refers specifically to electromagnetic waves having a certain wavelength that can be used for radio communication. RF (Radio Frequency) technology is widely used in a variety of fields, such as: television, radio, mobile phone, radar, automatic identification system, etc. RFID (radio frequency identification) means that a radio frequency identification signal is applied to identify a target object, and the frequency of electric waves used by the RFID technology is 50KHz-5.8GHz. Generally, the communication modes of active RFID are divided into two types: simplex: the working mode that the information can only be sent in one direction between two points generally corresponds to a one-way label; half duplex: the information can be transmitted in two directions between two points, but cannot be transmitted simultaneously. The communication distance of active RFID is more than hundred meters, and is generally 120-150 meters. A schematic diagram of radio frequency communication can be seen in fig. 1.
The basic principle of active RFID is that it receives and transmits data by broadcasting electromagnetic waves at a frequency point (for example, frequency 5 GHz), that is, a device transmits data at a certain frequency, and all devices monitoring the frequency can receive the data in a region with sufficient signal strength. Under the condition that each device has unique ID identification, under the condition that each device can realize broadcasting and receiving data, the main server device can realize point-to-point communication with the remote terminal device under the RFID communication mechanism, so that the operations such as function control and the like are realized. A schematic diagram of the connection between the master device (master server) and the remote terminal device can be seen in fig. 2.
Because all the main equipment and the remote terminal equipment broadcast and receive data through one channel, data interaction relies on a half duplex channel, and the time consumption of single unidirectional transmission of 128 bytes (the limited bottom layer analysis module can only support a maximum of 128 bytes) is about 100ms when the actual measured communication load is time consuming, under the condition that the ID of the remote terminal equipment is known, ID filtering can be carried out on the main equipment and the remote terminal equipment to realize normal receiving and transmitting communication, and the data interaction is completed once in 200 ms. However, when the main device and the remote terminal device are networked for the first time, the main device is unaware of the ID of the remote terminal device, if a random delay response method is adopted, when the number of the far terminal devices hung down is too large, the time for which the main device needs to wait overtime to meet the time delay needs to be increased, namely, the time delay is needed for 100 far terminal devices, which greatly increases the time of the networking search process.
As can be seen from the above, in the related art, there is a problem that it takes a long time for the master device to establish communication connection with a plurality of remote terminal devices, and the channels are occupied for a long time, so that other services are affected.
In view of the above problems in the related art, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the invention provides a method, a device, a storage medium and an electronic device for establishing communication connection, which at least solve the problems that in the related art, the communication connection between a main device and a plurality of remote terminal devices takes a long time, and channels are occupied for a long time, so that other services are influenced.
According to one embodiment of the present invention, there is provided a method of establishing a communication connection, including: receiving a target data packet sent by a main device; matching a first media access control address of the remote terminal device with a second media access control address included in the target data packet to obtain a matching result; under the condition that the matching result indicates that the matching is successful, determining a target random value corresponding to the remote terminal equipment; and sending a response message for responding to the target data packet to the master device so as to establish communication connection with the master device under the condition that the target random value meets the preset condition.
There is also provided, in accordance with an embodiment of the present invention, a method of establishing a communication connection, including: transmitting a target data packet to a remote terminal device to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet to obtain a matching result, and determining a target random value corresponding to the remote terminal device when the matching result indicates that the matching is successful; and receiving a response message which is sent by the remote terminal equipment and is used for responding to the target data packet under the condition that the target random value meets the preset condition, and establishing communication connection with the remote terminal equipment based on the response message.
According to another embodiment of the present invention, there is provided an apparatus for establishing a communication connection, including: the receiving module is used for receiving the target data packet sent by the main equipment; the matching module is used for matching the first media access control address of the remote terminal equipment with the second media access control address included in the target data packet so as to obtain a matching result; the determining module is used for determining a target random value corresponding to the remote terminal equipment under the condition that the matching result indicates that the matching is successful; and the first establishing module is used for sending a response message for responding to the target data packet to the master equipment so as to establish communication connection with the master equipment under the condition that the target random value meets the preset condition.
According to another embodiment of the present invention, there is also provided an apparatus for establishing a communication connection, including: a sending module, configured to send a target data packet to a remote terminal device, so as to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet, so as to obtain a matching result, and determine a target random value corresponding to the remote terminal device when the matching result indicates that the matching is successful; and the second establishing module is used for receiving a response message which is sent by the remote terminal equipment and is used for responding to the target data packet under the condition that the target random value meets the preset condition, and establishing communication connection with the remote terminal equipment based on the response message.
According to yet another embodiment of the present invention, there is also provided a computer-readable storage medium having stored therein a computer program, wherein the computer program when executed by a processor implements the steps of the method as described in any of the above.
According to a further embodiment of the invention, there is also provided an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
According to the invention, the remote terminal equipment receives the target data packet invented by the main equipment, the first media access control address of the remote terminal equipment is matched with the second media access control address included in the target data packet, the target random value corresponding to the remote terminal equipment is determined under the condition that the matching is successful, and the response message for responding to the target data is sent to the main equipment under the condition that the target random value meets the preset condition, so that communication connection is established with the main equipment. Because the remote terminal equipment needs to carry out screening twice when establishing communication connection with the main equipment, namely, if the first media access control address and the second media access control address are successfully matched, whether the target random value of the remote terminal equipment meets the preset condition is determined again, and the response message is sent again when the preset condition is met, the remote terminal equipment does not need to delay response, thus realizing automatic staggered response and avoiding channel blockage. Therefore, the problem that the communication connection between the main equipment and the plurality of remote terminal equipment in the related technology is long in time consumption, and the channels are occupied for a long time so that other services are affected can be solved, and the efficiency of establishing the communication connection between the main equipment and the plurality of remote terminal equipment is improved.
Drawings
FIG. 1 is a schematic diagram of a related art radio frequency communication;
FIG. 2 is a schematic diagram of a connection relationship between a main device and a remote terminal device in the related art;
fig. 3 is a block diagram of a hardware structure of a mobile terminal of a method of establishing a communication connection according to an embodiment of the present invention;
Fig. 4 is a flow chart of a method of establishing a communication connection in accordance with an embodiment of the present invention;
FIG. 5 is a second flowchart of a method of establishing a communication connection according to an embodiment of the present invention;
Fig. 6 is a flow chart of a method of establishing a communication connection in accordance with a specific embodiment of the present invention;
Fig. 7 is a block diagram of an apparatus for establishing a communication connection according to an embodiment of the present invention;
fig. 8 is a block diagram of a second configuration of an apparatus for establishing a communication connection according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings in conjunction with the embodiments.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order.
In the active antenna project, the main device and the remote terminal device rely on a half duplex channel based on RF communication, when the main server device (i.e. the main device) sends networking search data packets, all devices in a link are in a monitoring state, and answer the main server device to cause bus competition, in order to relieve the phenomenon that the channel is seriously occupied, other devices in the link need to answer the main server device in a time sharing manner, when the number of the underhung remote terminal devices is extremely small, the random delay answer networking search effect is still good, but when the number of the underhung remote terminal devices is increased, the time required to wait overtime is greatly increased for completing the main server device in the search process, the efficiency is extremely low, the user experience feeling is extremely poor, and the long-time occupation of the channel seriously influences other functional services.
In view of the above problems in the related art, the following embodiments are proposed to shorten the time of the search process, and to realize quick search of a large number of devices.
The method embodiments provided in the embodiments of the present application may be performed in a mobile terminal, a computer terminal or similar computing device. Taking the operation on a mobile terminal as an example, fig. 3 is a block diagram of a hardware structure of a mobile terminal according to a method for establishing a communication connection according to an embodiment of the present application. As shown in fig. 3, the mobile terminal may include one or more (only one is shown in fig. 3) processors 102 (the processor 102 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may further include a transmission device 106 for communication functions and an input-output device 108. It will be appreciated by those skilled in the art that the structure shown in fig. 3 is merely illustrative and not limiting on the structure of the mobile terminal described above. For example, the mobile terminal may also include more or fewer components than shown in fig. 3, or have a different configuration than shown in fig. 3.
The memory 104 may be used to store computer programs, such as software programs of application software and modules, such as computer programs corresponding to the method of establishing a communication connection in the embodiments of the present invention, and the processor 102 executes the computer programs stored in the memory 104 to perform various functional applications and data processing, i.e., implement the above-described method. Memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory remotely located relative to the processor 102, which may be connected to the mobile terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, simply referred to as a NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is configured to communicate with the internet wirelessly.
In this embodiment, a method for establishing a communication connection is provided, fig. 4 is a flowchart of a method for establishing a communication connection according to an embodiment of the present invention, and as shown in fig. 4, the flowchart includes the following steps:
Step S402, receiving a target data packet sent by a main device;
Step S404, matching the first MAC address of the remote terminal device with the second MAC address included in the target data packet to obtain a matching result;
Step S406, determining a target random value corresponding to the remote terminal equipment under the condition that the matching result indicates that the matching is successful;
Step S408, in a case where it is determined that the target random value satisfies a predetermined condition, sending a response message for responding to the target data packet to the master device, so as to establish a communication connection with the master device.
In the above embodiment, the remote terminal device may be managed by the search group network under the condition that the master device and the remote terminal device are networked for the first time or the master device does not know the ID of the remote terminal device. The master device may send the target data packet to all the remote terminal devices through broadcasting, after the remote terminal device receives the target data packet, the remote terminal device may match its own first media access control address, that is, the MAC with the second media access control address included in the target data packet, and in case of successful matching, the remote terminal device may generate a random number, determine a target random value corresponding to the remote terminal device according to the random number, and send a response message to the master device in case that the target random value meets a predetermined condition. Only the remote terminal equipment with the target random value meeting the preset condition can send the response message to the main equipment, so that a large number of remote terminal equipment can stagger the response, channel blockage is avoided, and networking efficiency is improved.
In the above embodiment, the target data packet may be a search packet, and the structure of the target data packet may be referred to in table 1.
TABLE 1
Type Mac1 Mac2 Data Mode Crc
1byte 4byte 4byte 116byte 1byte 2byte
Wherein, type: a packet type; mac: a remote terminal device unique ID; data: data content; mode: the remote terminal device defines a random number value range (integer) according to the Mode; crc: a 16bit crc check value.
The second MAC address included in the target packet may be mac1+mac2, and MAC2 may be 32 bits, where initially, each of MAC1 and MAC2 is 0, and before the target packet is sent, the master device may set sequentially the mac2 included in the packet, so as to obtain the target packet.
Alternatively, the execution subject of the above steps may be a remote terminal device.
According to the invention, the remote terminal equipment receives the target data packet invented by the main equipment, the first media access control address of the remote terminal equipment is matched with the second media access control address included in the target data packet, the target random value corresponding to the remote terminal equipment is determined under the condition that the matching is successful, and the response message for responding to the target data is sent to the main equipment under the condition that the target random value meets the preset condition, so that communication connection is established with the main equipment. Because the remote terminal equipment needs to carry out screening twice when establishing communication connection with the main equipment, namely, if the first media access control address and the second media access control address are successfully matched, whether the target random value of the remote terminal equipment meets the preset condition is determined again, and the response message is sent again when the preset condition is met, the remote terminal equipment does not need to delay response, thus realizing automatic staggered response and avoiding channel blockage. Therefore, the problem that the communication connection between the main equipment and the plurality of remote terminal equipment in the related technology is long in time consumption, and the channels are occupied for a long time so that other services are affected can be solved, and the efficiency of establishing the communication connection between the main equipment and the plurality of remote terminal equipment is improved.
In an exemplary embodiment, matching the first mac address of the remote terminal device with the second mac address included in the target packet to obtain a matching result includes: performing bit-wise and operation on the first MAC address and the second MAC address to obtain an operation result; under the condition that the operation result is a first numerical value, determining that the matching result is successful; and determining that the matching result is matching failure under the condition that the operation result is other values except the first value. In this embodiment, after receiving the target data packet, the remote terminal device may perform bitwise and operation on the first MAC of the local device and the second MAC included in the target data packet, and when the operation result is 1, determine that the matching result is successful, and when the operation result is not 1, determine that the matching result is failed. Wherein the first value may be 1 (or other value, which the present invention is not limited to), and the first MAC may be 8 bytes MacAddr. The remote terminal device can match MacAddr bits with Mac1+Mac2 bits in the search packet to obtain a matching result.
In an exemplary embodiment, determining the target random value corresponding to the remote terminal device includes: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value. In this embodiment, the Mode value in the target packet may represent the number of cycles, and different numbers of cycles correspond to different random number ranges, where the correspondence between the number of cycles and the random number range may be referred to in table 2.
TABLE 2
The broadcast search packet sent by the master device follows the following rules: the broadcasting searching packet is sent by two layers of circulation, the outer layer of circulation is 9 times, the Mode is sequentially equal to 1,2 and 3..9, the inner layer of circulation is sequentially set with 32 bit bits of Mac2, and 256 wheels, 86 wheels, 52 wheels, 16 wheels, 6 wheels, 4 wheels, 3 wheels, 2 wheels and 1 wheel are correspondingly sent one by one. When Mode is 1, MAC2 may be set sequentially in order from back to front, that is, the last position 1 of MAC2 is sent 256 rounds, then the last position 1 of MAC2 is set at the last position 0, 256 rounds are sent … … until MAC2 is set.
In the above embodiment, the target values are determined according to the random number ranges, and different random number ranges correspond to different target values. The remote terminal device may generate a random number in the range of [0, 255], and since the random number ranges corresponding to different cycle numbers are different, it is necessary to divide the random number generated by the remote terminal device by the target value so that the obtained target random value falls within the random number range corresponding to the current cycle number. That is, when the random number range corresponding to the current cycle number is [0, 255], when the random number range corresponding to the current cycle number is [0, 85], the target value is 3, when the random number range corresponding to the current cycle number is [0, 51], the target value is 5, when the random number range corresponding to the current cycle number is [0, 15], the target value is 17, when the random number range corresponding to the current cycle number is [0,5], the target value is 51, when the random number range corresponding to the current cycle number is [0,3], the target value is 85, when the random number range corresponding to the current cycle number is [0,2], the target value is 127.5, when the random number range corresponding to the current cycle number is [0,1], the target value is 255, and when the random number range corresponding to the current cycle number is 1.
After receiving the target data packet, the remote terminal device may first determine the current cycle number included in the target data packet, determine a random number range corresponding to the current cycle number, determine a target value according to the random number range, and determine the random value generated by the remote terminal device and the target value as a target random value. And when the target random value meets the preset condition, sending a response message to the main device.
In an exemplary embodiment, before sending a response message to the master device for responding to the target data packet, the method further comprises: determining that the target random value meets the predetermined condition when the target random value is a second value; in the case where the target random value is a value other than the second value, it is determined that the target random value does not satisfy the predetermined condition. In this embodiment, the second value may be 1 (this value is only an exemplary illustration, but may be other values, which is not limited in this disclosure), and when the target random value is the second value, it is determined that the target random value satisfies the predetermined condition, and when the target random value is not the second value, it is determined that the target random value does not satisfy the predetermined condition.
In one exemplary embodiment, matching the first media access control address of the remote terminal device with the second media access control address included in the target data packet includes: verifying a verification value included in the target data packet to obtain a verification result; and matching the first media access control address with the second media access control address under the condition that the checking result indicates that the checking is successful. In this embodiment, after receiving the target data packet, the remote terminal device may verify the CRC value included in the target data packet, and match the first mac address with the second mac address when the verification result indicates that the verification is successful. That is, after receiving the broadcast search packet, the remote terminal device in the link checks the CRC value to ensure that the whole search packet is not abnormal, and then performs two layers of filtering: firstly matching 8 bytes MacAddr of the machine with Mac1+Mac2 in the search packet according to bits, if matching is successful, carrying out next-layer filtering, sequentially calculating random values in the corresponding random number interval according to the value of Mode, and if the random values are equal to 1, then filtering is successful. Both layers of filtering are successful, reporting is performed, and unsuccessful discarding is performed, so that response is staggered, channel blocking is avoided, and efficiency is greatly improved.
In this embodiment, there is also provided a method for establishing a communication connection, and fig. 5 is a flowchart of a method for establishing a communication connection according to an embodiment of the present invention, as shown in fig. 5, where the flowchart includes the following steps:
Step S502, a target data packet is sent to a remote terminal device to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet to obtain a matching result, and a target random value corresponding to the remote terminal device is determined under the condition that the matching result indicates that the matching is successful;
Step S504, receiving a response message sent by the remote terminal device and used for responding to the target data packet if the target random value meets the predetermined condition, and establishing a communication connection with the remote terminal device based on the response message.
In the above embodiment, the remote terminal device may be managed by the search group network under the condition that the master device and the remote terminal device are networked for the first time or the master device does not know the ID of the remote terminal device. The master device may send the target data packet to all the remote terminal devices through broadcasting, after the remote terminal device receives the target data packet, the remote terminal device may match its own first media access control address, that is, the MAC with the second media access control address included in the target data packet, and in case of successful matching, the remote terminal device may generate a random number, determine a target random value corresponding to the remote terminal device according to the random number, and send a response message to the master device in case that the target random value meets a predetermined condition. Only the remote terminal equipment with the target random value meeting the preset condition can send the response message to the main equipment, so that a large number of remote terminal equipment can stagger the response, channel blockage is avoided, and networking efficiency is improved.
In the above embodiment, the target data packet may be a search packet, and the structure of the target data packet may be referred to in table 1. The second MAC address included in the target packet may be mac1+mac2, and MAC2 may be 32 bits, where initially, each of MAC1 and MAC2 is 0, and before the target packet is sent, the master device may set sequentially the mac2 included in the packet, so as to obtain the target packet.
In the above embodiment, after receiving the target data packet, the remote terminal device may perform bitwise and operation on the first MAC of the local device and the second MAC included in the target data packet, and when the operation result is 1, determine that the matching result is successful, and when the operation result is not 1, determine that the matching result is failed. Wherein the first MAC may be 8 bytes MacAddr. The remote terminal device can match MacAddr bits with Mac1+Mac2 bits in the search packet to obtain a matching result.
Alternatively, the execution subject of the above steps may be a master device.
According to the invention, the target data packet is sent to the remote terminal equipment, after the remote terminal equipment receives the target data packet invented by the main equipment, the first media access control address of the remote terminal equipment is matched with the second media access control address included in the target data packet, under the condition that the matching is successful, the target random value corresponding to the remote terminal equipment is determined, under the condition that the target random value meets the preset condition, the response message for responding to the target data is sent to the main equipment, so that communication connection is established with the main equipment. Because the remote terminal equipment needs to carry out screening twice when establishing communication connection with the main equipment, namely, if the first media access control address and the second media access control address are successfully matched, whether the target random value of the remote terminal equipment meets the preset condition is determined again, and the response message is sent again when the preset condition is met, the remote terminal equipment does not need to delay response, thus realizing automatic staggered response and avoiding channel blockage. Therefore, the problem that the communication connection between the main equipment and the plurality of remote terminal equipment in the related technology is long in time consumption, and the channels are occupied for a long time so that other services are affected can be solved, and the efficiency of establishing the communication connection between the main equipment and the plurality of remote terminal equipment is improved.
In one exemplary embodiment, transmitting the target data packet to the remote terminal device includes: determining the cycle number of the target data packet sent to the remote terminal equipment in a circulating way; and sending the target data packet to the remote terminal equipment in a circulating way according to the circulating times. In this embodiment, the master device may cycle to send the target data packet to the remote terminal device. Firstly, determining the cycle times of the main equipment for transmitting the target data packet to the remote terminal equipment, and transmitting the target data packet to the remote terminal equipment according to the cycle times. The number of cycles may be represented by Mode in the target packet. The number of cycles may be 9 (this value is only an exemplary illustration, and may be 8 times, 10 times, etc.), as the invention is not limited in this regard. That is, the number of times of sending the target packet to the remote terminal device is cyclically 9 times is indicated by the Mode, for example, when the 5 th sending is performed, the Mode value is 5.
In an exemplary embodiment, cyclically transmitting the target data packet to the remote terminal device according to the cycle number includes: determining a random number range corresponding to each cycle based on the cycle times; determining the repeated times of repeated transmission of the target data packet in each cyclic operation based on the random number range; and repeatedly sending the target data packet to the remote terminal equipment according to the repetition times in each circulation operation. In this embodiment, the Mode value in the target packet may represent the number of cycles, and different numbers of cycles correspond to different random number ranges, where the correspondence between the number of cycles and the random number range may be referred to in table 2. The broadcast search packet sent by the master device follows the following rules: the broadcast search packet is transmitted by two layers of circulation, the outer layer of circulation is circulated for 9 times (corresponding to the circulation times), the Mode is sequentially equal to 1,2, 3..9, the inner layer of circulation is sequentially set with 32 bit bits of Mac2, 256 wheels, 86 wheels, 52 wheels, 16 wheels, 6 wheels, 4 wheels, 3 wheels, 2 wheels and 1 wheel (corresponding to the repetition times) are transmitted in a one-to-one correspondence manner. That is, different random number ranges correspond to different repetition times. When Mode is 1, the random number range is [0,255], the repetition number is 256, when Mode is 2, the random number range is [0,85], and the repetition number is 86 … …
In an exemplary embodiment, before the target data packet is sent to the remote terminal device in the cycle number, the method further includes: setting the third media access control address included in the data packet to be transmitted in a predetermined order in sequence before transmitting the target data packet to the remote terminal device in each cycle; and determining the set data packet as the target data packet. In this embodiment, before each time a target data packet is sent to a remote terminal device, the target data packet needs to be determined, that is, the third mac address in the data packet to be sent is set in sequence according to a predetermined sequence, and the set data packet is determined to be the target data packet. For example, when Mode is 1, MAC2 may be set sequentially in order from back to front, i.e., the last position 1 of MAC2 is sent 256 times, then the last position 1 of MAC2 is sent 0, and 256 times are sent … … until MAC2 is set.
In the above embodiment, the master device may send the target data packet in a cycle at a fixed time interval (the fixed time interval may be 10ms (this value is merely illustrative, and the time interval may also be 5ms, 15ms, etc.), which is not limited in this aspect of the present invention). The master device may also transmit the target data packet periodically at non-fixed time intervals while transmitting the target data packet, e.g., the master device may dynamically adjust the time intervals according to channel communication quality or the number of received response messages. And acquiring the target data packet sent in a mode of sequentially increasing or decreasing the time interval.
The method for establishing a communication connection is described in connection with the following embodiments:
fig. 6 is a flowchart of a method for establishing a communication connection, according to an embodiment of the present invention, as shown in fig. 6, the flowchart including:
in step S602, the master device issues a broadcast search packet every 10 ms.
In step S604, the remote terminal device receives the search packet.
Step S606, it is determined whether the packet type is a search packet, and if the determination result is yes, step S608 is executed, and if the determination result is no, step S610 is executed.
Step S608, the check packet CRC determines whether it is correct, and if yes, step S612 is executed, and if no, step S614 is executed.
In step S610, other data packets are not search packets.
Step S612, determining MACAddr whether the bit matches, if yes, executing step S616, and if no, executing step S618.
In step S614, the packet is abnormal and discarded.
Step S616, whether the random number is equal to 1 is determined according to the Mode value, and if yes, step S620 is executed, and if no, step S618 is executed.
Step S618, the search packet is received in a loop.
Step S620, reporting the master device.
In step S622, when the master device transmits the search packet for the first time, mode is 1, and when the master device transmits the search packet again, the master device determines whether Mode is less than or equal to 9, and if yes, the 32-bit bits of the MAC2 are sequentially set to transmit the corresponding number of rounds.
It should be noted that, steps S602 and S622 are operations performed by the master device, and steps S604 to S620 are operations performed by the remote terminal device.
In the foregoing embodiment, the broadcasting mode based on RF communication searches for a large number of terminal devices and the local area network broadcasting networking searches for a large number of terminal devices, so that under the mechanism with broadcasting communication, a large number of terminal devices can be efficiently searched, networking is successful, networking speed is improved, and channel blocking is avoided.
The number of the large-batch remote sub-devices hung under one main server device is not fixed, and the remote sub-devices can be searched for in a group management way by combining a Filter algorism (Filter algorism) algorithm with a random number under the condition that the ID of the remote sub-devices is unknown. In contrast to network communication UDP broadcasting and multicasting communication mechanisms, in the field of Internet of things in which central service equipment such as intelligent security, medical treatment, transportation, network communication and the like are combined with terminal equipment, the scheme can be adopted to carry out mass networking searching on the terminal equipment under the condition of a half-duplex communication mechanism with only one channel, so that the load of a communication channel is greatly reduced, and the efficiency is greatly improved. In network communication, under the condition of a broadcast communication mechanism, all the fields of the Internet of things adopting a terminal server and a large quantity of terminal equipment structures can be used for networking search management equipment through the scheme. The mass networking searching of terminal equipment can be efficiently realized through the mechanism of broadcasting and the double-layer filtering, and the application prospect is very wide.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The embodiment also provides a device for establishing communication connection, which is used for implementing the foregoing embodiments and preferred embodiments, and is not described in detail. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. While the means described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware, is also possible and contemplated.
Fig. 7 is a block diagram of an apparatus for establishing a communication connection according to an embodiment of the present invention, as shown in fig. 7, the apparatus includes:
A receiving module 72, configured to receive a target data packet sent by the master device;
A matching module 74, configured to match a first mac address of a remote terminal device with a second mac address included in the target packet, so as to obtain a matching result;
a determining module 76, configured to determine a target random value corresponding to the remote terminal device if the matching result indicates that the matching is successful;
A first establishing module 78, configured to send a response message to the master device for responding to the target data packet, in case it is determined that the target random value meets a predetermined condition, so as to establish a communication connection with the master device.
In an exemplary embodiment, the matching module 74 may be configured to match the first mac address of the remote terminal device with the second mac address included in the target data packet, so as to obtain a matching result: performing bit-wise and operation on the first MAC address and the second MAC address to obtain an operation result; under the condition that the operation result is a first numerical value, determining that the matching result is successful; and determining that the matching result is matching failure under the condition that the operation result is other values except the first value.
In one exemplary embodiment, the determining module 76 may implement determining the target random value corresponding to the remote terminal device by: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value.
In an exemplary embodiment, the apparatus may be configured to determine, before sending a response message to the master device for responding to the target data packet, that the target random value meets the predetermined condition if the target random value is a second value; in the case where the target random value is a value other than the second value, it is determined that the target random value does not satisfy the predetermined condition.
In an exemplary embodiment, the matching module 74 may be configured to match the first mac address of the remote terminal device with the second mac address included in the target data packet by: verifying a verification value included in the target data packet to obtain a verification result; and matching the first media access control address with the second media access control address under the condition that the checking result indicates that the checking is successful.
Fig. 8 is a block diagram ii of an apparatus for establishing a communication connection according to an embodiment of the present invention, as shown in fig. 8, the apparatus includes:
A sending module 82, configured to send a target data packet to a remote terminal device, so as to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet, so as to obtain a matching result, and determine a target random value corresponding to the remote terminal device when the matching result indicates that the matching is successful;
a second establishing module 84, configured to receive a response message sent by the remote terminal device and used for responding to the target data packet if the target random value meets the predetermined condition, and establish a communication connection with the remote terminal device based on the response message.
In an exemplary embodiment, the sending module 82 may implement sending the target data packet to the remote terminal device by: determining the cycle number of the target data packet sent to the remote terminal equipment in a circulating way; and sending the target data packet to the remote terminal equipment in a circulating way according to the circulating times.
In an exemplary embodiment, the sending module 82 may implement sending the target data packet to the remote terminal device according to the cycle number loop by: determining a random number range corresponding to each cycle based on the cycle times; determining the repeated times of repeated transmission of the target data packet in each cyclic operation based on the random number range; and repeatedly sending the target data packet to the remote terminal equipment according to the repetition times in each circulation operation.
In an exemplary embodiment, the apparatus may be configured to sequentially set, before the target data packet is transmitted to the remote terminal device in each cycle according to the cycle number, a third medium access control address included in a data packet to be transmitted in a predetermined order before the target data packet is transmitted to the remote terminal device in each cycle; and determining the set data packet as the target data packet.
It should be noted that each of the above modules may be implemented by software or hardware, and for the latter, it may be implemented by, but not limited to: the modules are all located in the same processor; or the above modules may be located in different processors in any combination.
Embodiments of the present invention also provide a computer readable storage medium having a computer program stored therein, wherein the computer program when executed by a processor implements the steps of the method described in any of the above.
In one exemplary embodiment, the computer readable storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory RAM), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing a computer program.
An embodiment of the invention also provides an electronic device comprising a memory having stored therein a computer program and a processor arranged to run the computer program to perform the steps of any of the method embodiments described above.
In an exemplary embodiment, the electronic apparatus may further include a transmission device connected to the processor, and an input/output device connected to the processor.
Specific examples in this embodiment may refer to the examples described in the foregoing embodiments and the exemplary implementation, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the modules or steps of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than that shown or described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple modules or steps of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only of the preferred embodiments of the present invention and is not intended to limit the present invention, but various modifications and variations can be made to the present invention by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (12)

1. A method of establishing a communication connection, comprising:
Receiving a target data packet sent by a main device;
Matching a first media access control address of the remote terminal device with a second media access control address included in the target data packet to obtain a matching result;
Under the condition that the matching result indicates that the matching is successful, determining a target random value corresponding to the remote terminal equipment;
Transmitting a response message for responding to the target data packet to the master device to establish a communication connection with the master device under the condition that the target random value is determined to meet a predetermined condition;
The determining the target random value corresponding to the remote terminal device comprises the following steps: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value.
2. The method of claim 1, wherein matching the first mac address of the remote terminal device with the second mac address included in the target packet to obtain a matching result comprises:
performing bit-wise and operation on the first MAC address and the second MAC address to obtain an operation result;
Under the condition that the operation result is a first numerical value, determining that the matching result is successful;
and determining that the matching result is matching failure under the condition that the operation result is other values except the first value.
3. The method of claim 1, wherein prior to sending a response message to the master device for responding to the target data packet, the method further comprises:
determining that the target random value meets the predetermined condition when the target random value is a second value;
In the case where the target random value is a value other than the second value, it is determined that the target random value does not satisfy the predetermined condition.
4. The method of claim 1, wherein matching a first media access control address of a remote terminal device with a second media access control address included in the target data packet comprises:
verifying a verification value included in the target data packet to obtain a verification result;
and matching the first media access control address with the second media access control address under the condition that the checking result indicates that the checking is successful.
5. A method of establishing a communication connection, comprising:
Transmitting a target data packet to a remote terminal device to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet to obtain a matching result, and determining a target random value corresponding to the remote terminal device when the matching result indicates that the matching is successful;
receiving a response message sent by the remote terminal device and used for responding to the target data packet under the condition that the target random value meets a preset condition, and establishing communication connection with the remote terminal device based on the response message;
the remote terminal device determines a target random value corresponding to the remote terminal device by the following method: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value.
6. The method of claim 5, wherein transmitting the target data packet to the remote terminal device comprises:
determining the cycle number of the target data packet sent to the remote terminal equipment in a circulating way;
and sending the target data packet to the remote terminal equipment in a circulating way according to the circulating times.
7. The method of claim 6, wherein cyclically transmitting the target data packet to the remote terminal device according to the number of cycles comprises:
determining a random number range corresponding to each cycle based on the cycle times;
determining the repeated times of repeated transmission of the target data packet in each cyclic operation based on the random number range;
and repeatedly sending the target data packet to the remote terminal equipment according to the repetition times in each circulation operation.
8. The method of claim 6, wherein prior to transmitting the target data packet to the remote terminal device in the cycle number of cycles, the method further comprises:
setting the third media access control address included in the data packet to be transmitted in a predetermined order in sequence before transmitting the target data packet to the remote terminal device in each cycle;
and determining the set data packet as the target data packet.
9. An apparatus for establishing a communication connection, comprising:
The receiving module is used for receiving the target data packet sent by the main equipment;
The matching module is used for matching the first media access control address of the remote terminal equipment with the second media access control address included in the target data packet so as to obtain a matching result;
the determining module is used for determining a target random value corresponding to the remote terminal equipment under the condition that the matching result indicates that the matching is successful;
The first establishing module is used for sending a response message for responding to the target data packet to the master device so as to establish communication connection with the master device under the condition that the target random value meets the preset condition;
The determining module determines a target random value corresponding to the remote terminal device by the following method: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value.
10. An apparatus for establishing a communication connection, comprising:
A sending module, configured to send a target data packet to a remote terminal device, so as to instruct the remote terminal device to match a first media access control address of the remote terminal device with a second media access control address included in the target data packet, so as to obtain a matching result, and determine a target random value corresponding to the remote terminal device when the matching result indicates that the matching is successful;
The second establishing module is used for receiving a response message which is sent by the remote terminal equipment and used for responding to the target data packet under the condition that the target random value meets the preset condition, and establishing communication connection with the remote terminal equipment based on the response message;
the remote terminal device determines a target random value corresponding to the remote terminal device by the following method: determining the current circulation times included in the target data packet, wherein the current circulation times are used for indicating the times of sending the target data packet in a current circulation mode; determining a random number range corresponding to the current cycle number; determining a target value based on the range of random numbers; and determining the ratio of the random value generated by the remote terminal equipment to the target value as the target random value.
11. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program, wherein the computer program, when being executed by a processor, realizes the steps of the method as claimed in any one of claims 1 to 4 or the steps of the method as claimed in any one of claims 5 to 8.
12. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to run the computer program to perform the method of any of the claims 1 to 4 or to perform the method of any of the claims 5 to 8.
CN202110833261.1A 2021-07-22 2021-07-22 Method and device for establishing communication connection, storage medium and electronic device Active CN113505618B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110833261.1A CN113505618B (en) 2021-07-22 2021-07-22 Method and device for establishing communication connection, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110833261.1A CN113505618B (en) 2021-07-22 2021-07-22 Method and device for establishing communication connection, storage medium and electronic device

Publications (2)

Publication Number Publication Date
CN113505618A CN113505618A (en) 2021-10-15
CN113505618B true CN113505618B (en) 2024-06-25

Family

ID=78013582

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110833261.1A Active CN113505618B (en) 2021-07-22 2021-07-22 Method and device for establishing communication connection, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN113505618B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109691215A (en) * 2016-09-09 2019-04-26 华为技术有限公司 Communication means and its user equipment, the network equipment
CN110012550A (en) * 2018-01-05 2019-07-12 中国移动通信有限公司研究院 A kind of accidental access method, terminal and base station

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5940002A (en) * 1997-10-10 1999-08-17 Ut Automotive Dearborn, Inc. Security system with random number remote communication
KR102215127B1 (en) * 2014-05-26 2021-02-15 주식회사 윌러스표준기술연구소 Wireless communication method for simultaneous data transmission and reception and wireless communication apparatus using same
CN109041086B (en) * 2018-09-28 2020-10-20 新华三技术有限公司 Configuration method and device of OpenFlow instance
US20210392642A1 (en) * 2018-10-31 2021-12-16 Zhicong Kong Ventilated, stackable, pressing molds
CN110808861A (en) * 2019-11-07 2020-02-18 高新兴物联科技有限公司 Single terminal test configuration method, device and platform thereof
CN111405042B (en) * 2020-03-16 2022-05-10 北京奇艺世纪科技有限公司 Electronic device discovery method and device, storage medium and electronic device
CN112867140A (en) * 2021-01-05 2021-05-28 珠海格力电器股份有限公司 Communication method and device of Internet of things equipment
CN113037833A (en) * 2021-03-04 2021-06-25 北京安华金和科技有限公司 Data processing method and device, storage medium and electronic equipment

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109691215A (en) * 2016-09-09 2019-04-26 华为技术有限公司 Communication means and its user equipment, the network equipment
CN110012550A (en) * 2018-01-05 2019-07-12 中国移动通信有限公司研究院 A kind of accidental access method, terminal and base station

Also Published As

Publication number Publication date
CN113505618A (en) 2021-10-15

Similar Documents

Publication Publication Date Title
CN111885115B (en) Device binding changing method and device
EP3751936B1 (en) Carrier set determination method and device, storage medium and electronic device
CN112737845B (en) Binding method and device of intelligent equipment, storage medium and electronic device
US20230216700A1 (en) Pairing multiple devices into a designated group for a communication session
CN109121096B (en) Method and apparatus for determining broadcast nodes in a mesh network
CN111884875A (en) Offline device determination method and device
CN105898867A (en) Paging method and device for coverage range enhanced MTC UE
CN112437454A (en) Data transmission method and device, storage medium and electronic device
CN113505618B (en) Method and device for establishing communication connection, storage medium and electronic device
CN113613251B (en) Information synchronization method and system, storage medium and electronic device
CN110087226B (en) Flow statistical method and device, storage medium and electronic device
CN115250542A (en) Communication method and device
EP2999285A1 (en) Method for transmitting signal in device to device proximity service, base station and user equipment
CN113132157B (en) Equipment configuration method and device, storage medium and electronic device
CN110391923B (en) Method for processing multicast message and network equipment
Liu et al. Topology-transparent distributed multicast and broadcast scheduling in mobile ad hoc networks
CN109845346B (en) Method for awakening wireless device, transmitting device and receiving device
CN115767531A (en) Bluetooth authentication method, device, electronic device and storage medium
CN112188562B (en) Multicast scheduling method and device for relay base station, storage medium and electronic device
CN117640021B (en) Feedback method and device of acknowledgement frame, storage medium and electronic device
CN107784006B (en) Data processing method and device
CN113453207B (en) Identity type determining method and device, storage medium and electronic device
CN113485735B (en) Equipment upgrading method and device, storage medium and electronic device
CN115297178B (en) Message sending method and device, storage medium and electronic device
CN113132986B (en) Method and device for realizing mesh network of WiFi based on DPP protocol, and storage medium

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