Disclosure of Invention
The embodiment of the invention provides a channel occupying method, a master device and a slave device, which are used for solving the problem that channel resources cannot be fully utilized in the prior art.
The embodiment of the invention provides a channel occupying method, which comprises the following steps:
the method comprises the steps that a main device broadcasts a beacon frame carrying a beacon period in a preset range, wherein the beacon period is used for indicating the time of the main device occupying a channel, and the beacon frame is a broadcast message which does not need to be replied;
and when the main equipment receives a message carrying a network allocation vector in a waiting time slot of the beacon period, the main equipment broadcasts the beacon frame again in the preset range after waiting for the channel occupation time corresponding to the network allocation vector.
Optionally, the method further comprises:
the beacon period comprises an access slot for instructing a slave device to initiate an access request;
and after the master device does not receive the message carrying the network allocation vector in the waiting time slot of the beacon period, the master device waits for receiving the access request sent by the slave device in the access time slot.
Optionally, the method further comprises:
when the received access request is determined to meet the preset condition, the master device allocates a sub-time slot for transmitting data in the data transmission time slot of the beacon period for the slave device, and sends an access success message carrying the sub-time slot to the slave device;
and the master device transmits data with the slave device in the sub-time slot.
Optionally, the method further comprises:
the beacon period further comprises a data transmission slot for instructing an accessed slave device to transmit data;
and the master device transmits data with the accessed slave device in the data transmission time slot after not receiving the message carrying the network allocation vector in the waiting time slot of the beacon period.
Optionally, after the master device transmits data with the accessed slave device in the sub-slot, the method further includes:
the master device judges whether the data which needs to be transmitted with the accessed slave device is transmitted in the data transmission time slot;
if not, the beacon frame is broadcasted within the preset range again.
The embodiment of the invention provides a channel occupying method, which comprises the following steps:
receiving a beacon frame which carries a beacon period and is broadcast by a master device, wherein the beacon period is used for indicating the time of the master device occupying a channel, and the beacon frame is a broadcast message which does not need to be replied; the beacon period comprises an access slot for instructing a slave device to initiate an access request;
the slave device sending an access request to the master device at a first rate during the access slot;
if the slave device does not receive the access success message sent by the master device, after waiting for N beacon periods, sending an access request to the master device at a second rate, wherein the second rate is smaller than the first rate, until receiving the access success message sent by the master device, and the successful access message carries a sub-time slot which is allocated by the master device for the slave device and used for transmitting data in a data transmission time slot of the beacon period;
and the slave device transmits data with the master device in the sub-time slot.
Optionally, the method further comprises:
the beacon period further comprises a data transmission slot for instructing an accessed slave device to transmit data;
and when the slave equipment is accessed slave equipment, transmitting data with the master equipment in the data transmission time slot.
Accordingly, an embodiment of the present invention provides a master device, including:
a sending module, configured to broadcast a beacon frame carrying a beacon period within a preset range, where the beacon period is used to indicate a time when the master device occupies a channel, and the beacon frame is a broadcast message that does not need to be replied;
and the processing module is used for broadcasting the beacon frame again in the preset range after waiting for the channel occupation time corresponding to the network allocation vector when receiving the message carrying the network allocation vector in the waiting time slot of the beacon period.
Optionally, the processing module is further configured to:
the beacon period comprises an access slot for instructing a slave device to initiate an access request;
and after the message carrying the network allocation vector is not received in the waiting time slot of the beacon period, waiting to receive an access request sent by slave equipment in the access time slot.
Optionally, the processing module is further configured to:
when the received access request is determined to meet the preset condition, allocating a sub-time slot for transmitting data in the data transmission time slot of the beacon period for the slave equipment, and sending an access success message carrying the sub-time slot to the slave equipment;
and transmitting data with the slave equipment in the sub-time slot.
Optionally, the processing module is further configured to:
the beacon period further comprises a data transmission slot for instructing an accessed slave device to transmit data;
and after the message carrying the network allocation vector is not received in the waiting time slot of the beacon period, transmitting data with the accessed slave equipment in the data transmission time slot.
Optionally, the processing module is further configured to:
after the sub-time slot and the accessed slave equipment transmit data, judging whether the data which needs to be transmitted with the accessed slave equipment is transmitted in the data transmission time slot;
if not, the beacon frame is broadcasted within the preset range again.
Accordingly, an embodiment of the present invention provides a slave device, including:
a receiving module, configured to receive a beacon frame carrying a beacon period, where the beacon period is used to indicate a time when a main device occupies a channel, and the beacon frame is a broadcast message that does not need to be replied; the beacon period comprises an access slot for instructing a slave device to initiate an access request;
a processing module, configured to send an access request to the master device at a first rate in the access timeslot; if the access success message sent by the master device is not received, after N beacon periods, sending an access request to the master device at a second rate, wherein the second rate is smaller than the first rate, until the access success message sent by the master device is received, and the successful access message carries a sub-time slot which is distributed by the master device for the slave device and used for transmitting data in a data transmission time slot of the beacon period; and transmitting data with the main equipment in the sub time slot.
Optionally, the beacon period further includes a data transmission slot for instructing an accessed slave device to transmit data; the processing module is further configured to transmit data with the master device in the data transmission timeslot.
An embodiment of the present invention provides a computing device, including:
a memory for storing program instructions;
and the processor is used for calling the program instructions stored in the memory and executing the method according to the obtained program.
An embodiment of the present invention provides a computer storage medium, which stores computer-executable instructions for causing a computer to perform any one of the methods described above.
The embodiment of the invention shows that the main equipment broadcasts a beacon frame carrying a beacon period in a preset range, wherein the beacon period is used for indicating the time of the main equipment occupying a channel, and the beacon frame is a broadcast message which does not need to be replied; and when the main equipment receives a message carrying a network allocation vector in a waiting time slot of the beacon period, the main equipment broadcasts the beacon frame again in the preset range after waiting for the channel occupation time corresponding to the network allocation vector. The embodiment of the invention can enable the more distant competition equipment to receive the beacon frame by sending the beacon frame with low speed and high priority to participate in channel competition and sending the beacon frame at low speed, and can wait for the corresponding time according to the beacon period carried in the beacon frame, thereby enabling the main equipment to preferentially use the channel resource. When the main device receives the message carrying the network allocation vector in the waiting time slot, the beacon frame is broadcasted again after waiting for the channel occupation time corresponding to the network allocation vector, and random backoff is not needed for any time, so that compared with a method for randomly backoff for a period of time in a contention mechanism in the prior art, the method provided by the embodiment of the invention improves the success rate of the main device in channel occupation, reduces the probability of collision with other contention devices, and improves the utilization rate of channel resources.
In a specific implementation, the preset range is a wireless coverage range of the master device, and the duration of the waiting time slot of the beacon period is set according to specific situations, for example, the duration of the waiting time slot may be determined according to a distance between the master device and a nearest competing device, or the duration of the waiting time slot may be determined according to a distance between the master device and a nearest slave device. Before broadcasting the beacon frame, the main device firstly closes Clear Channel Assessment (CCA) detection of a device physical layer, so that the main device does not avoid physical link interference of the Channel, so that the main device can send the beacon frame to preempt the Channel whenever the main device needs to levy the Channel, and the success rate of the main device in preempting the Channel is improved. After broadcasting the beacon frame, the master device participates in channel usage right competition with other competing devices according to a Carrier Sense Multiple Access/collision avoidance (CSMA/CA) mechanism, and the competition follows a Distributed Coordination Function (DCF) mechanism. The beacon frame transmitted by the master device is a management frame, and is transmitted at the lowest rate (MCS 0 rate for 11ac system and lowest basic rate for 11b/g/n/a system), and the backoff has high priority. Therefore, after waiting for the channel occupation time corresponding to the network allocation vector, the main device sets the random backoff window to be 0 time period, that is, after waiting for the channel occupation time corresponding to the network allocation vector, the main device does not wait for any random time and broadcasts the beacon frame within the preset range again.
Further, the beacon period further includes an access slot for instructing the slave device to initiate an access request, and the master device completes registration and login of the slave device in the access slot, which specifically includes the following steps, as shown in fig. 3:
step S301, the slave device receives a beacon frame carrying a beacon period broadcasted by the master device, where the beacon period includes an access timeslot for instructing the slave device to initiate an access request.
Step S302, after the master device does not receive the message carrying the network allocation vector in the waiting time slot of the beacon period, the master device waits to receive the access request sent by the slave device in the access time slot.
Step S303, the slave device sends an access request to the master device at a first rate in the access slot.
Step S304, when it is determined that the received access request meets the preset condition, the master device allocates a sub-slot for transmitting data to the slave device in the data transmission slot of the beacon period, and sends an access success message carrying the sub-slot to the slave device.
Step S305, the slave device receives an access success message sent by the master device, and transmits data with the master device in the sub-slot carried in the successful access message.
Specifically, in step S301, a beacon period is used to indicate the time when the master device occupies the channel, and a beacon frame is a broadcast message without reply. And after receiving the beacon frame, the slave equipment analyzes the beacon frame to determine the access time slot of the beacon period. After receiving the beacon frame sent by the master device, the competition device analyzes the beacon frame to determine a beacon period, and then waits for the duration corresponding to the beacon period.
In step S304, when it is determined that the received access request meets the preset condition, the master device allocates a sub-slot for transmitting data to the slave device in an idle slot of the data transmission slot. In a specific implementation, the sub-slot is not carried in the access success message, but the sub-slot in which the slave device transmits data in the data transmission slot is carried in a beacon frame broadcasted next time, so that the master device and the slave device perform data transmission in a next beacon period.
In step S305, since each of the plurality of slave devices transmits an access request to the master device in the access slot, collision of access requests transmitted by the plurality of slave devices inevitably occurs. After the access request is collided, the master device cannot receive the access request of the slave device, so that an access success message cannot be sent to the slave device. In the embodiment of the invention, if the slave device does not receive the access success message sent by the master device in the set period, after waiting for N beacon periods, the slave device sends the access request to the master device at the second rate, wherein the second rate is less than the first rate until receiving the access success message sent by the master device. The first rate and the second rate are preset rates, and N is a random positive integer. And when the rate of the access request sent by the slave equipment reaches the lowest preset rate and the access success message sent by the master equipment is still not received, the access request is sent to the master equipment at the lowest preset rate. The master device determines the access time slot in the beacon period in advance, and sends the access time slot in the beacon period to the slave device when sending the beacon frame to participate in channel competition, so that the master device can send a beacon frame which can be used for preempting the channel and can also appoint the access time slot with the slave device, thereby simplifying the communication between the master device and the slave device and improving the communication efficiency. And secondly, when the access request sent by the slave equipment collides, the random number of beacon periods is retreated, so that the probability of collision of the access request of the slave equipment is reduced, and the access of the slave equipment is ensured.
Optionally, the beacon period further comprises a data transmission slot for instructing an accessed slave device to transmit data. When the accessed slave equipment receives the beacon frame carrying the beacon period, the beacon frame is analyzed, the sub time slot of the transmission data distributed by the master equipment in the data transmission time slot is determined, and then the data is transmitted between the sub time slot and the master equipment. And after the master device does not receive the message carrying the network allocation vector in the waiting time slot of the beacon period, the master device transmits data with each accessed slave device in the data transmission time slot. In a specific implementation, the accessed slave device may be a slave device that has successfully accessed in a beacon period before the current beacon period, or may be a slave device that has successfully accessed in the current beacon period. Data can be transmitted between the master device and each slave device in a Time Division Multiple Access (TDMA) manner, that is, a data transmission timeslot is divided into an uplink timeslot and a downlink timeslot or a slave device sub-timeslot to be distributed to each slave device. Data transmission can also be carried out between the master device and each slave device according to the data flow. The master device and each slave device may also perform data transmission in a token manner or other feasible transmission manners. When allocating the time slot for transmitting data to each slave device, the master device may allocate different numbers of sub-time slots to different slave devices according to Quality of Service (QoS) priorities.
Optionally, after the master device transmits data with the accessed slave device in the sub-time slot, the master device determines whether the data to be transmitted with the accessed slave device is completely transmitted in the data transmission time slot; if not, the beacon frame is broadcasted within the preset range again. In a specific implementation, the master device may determine at the end of the beacon period or before the end of the beacon period. When the master device judges that the data which needs to be transmitted with the accessed slave device cannot be transmitted in the data transmission time slot, the beacon frame is broadcasted in the preset range again without waiting for any random time, so that the master device can capture the channel again, and the smooth transmission of the data of the master device and the slave device is ensured. And when the master equipment judges that the data which needs to be transmitted with the accessed slave equipment can be transmitted in the data transmission time slot, stopping transmitting the beacon frame carrying the beacon period, and enabling the channel to recover free competition so as to ensure that the channel resource is harmoniously used with the surrounding competition equipment.
In order to better explain the embodiment of the present invention, the following describes a flow of a channel occupying method provided by the embodiment of the present invention through a specific implementation scenario, as shown in fig. 4, including the following steps:
step S401, the master device broadcasts a beacon frame carrying a beacon period in a preset range, where the beacon period is used to indicate the time when the master device occupies the channel.
Step S402, when the main device receives the message carrying the network allocation vector in the waiting time slot of the beacon period, the main device broadcasts the beacon frame again in the preset range after waiting for the channel occupation time corresponding to the network allocation vector.
In step S403, after the master device does not receive the message carrying the network allocation vector in the waiting time slot of the beacon period, the master device waits to receive the access request sent by the slave device in the access time slot.
Step S404, after receiving the beacon frame carrying the beacon period broadcast by the master device, the slave device sends an access request to the master device at a first rate in the access timeslot.
Step S405, when it is determined that the received access request meets the preset condition, the master device allocates a sub-slot for transmitting data to the slave device in the data transmission slot of the beacon period, and sends an access success message carrying the sub-slot to the slave device.
Step S406, the master device transmits data with the accessed slave device in the data transmission slot.
In step S407, the master device broadcasts the beacon frame again within the preset range after determining that the data that needs to be transmitted with the accessed slave device cannot be transmitted in the data transmission timeslot.
Step S408, the master device stops broadcasting the beacon frame when it is determined that the data that needs to be transmitted with the accessed slave device can be transmitted in the data transmission timeslot.
The embodiment of the invention shows that the main equipment broadcasts a beacon frame carrying a beacon period in a preset range, wherein the beacon period is used for indicating the time of the main equipment occupying a channel, and the beacon frame is a broadcast message which does not need to be replied; and when the main equipment receives a message carrying a network allocation vector in a waiting time slot of the beacon period, the main equipment broadcasts the beacon frame again in the preset range after waiting for the channel occupation time corresponding to the network allocation vector. The embodiment of the invention can enable the more distant competition equipment to receive the beacon frame by sending the beacon frame with low speed and high priority to participate in channel competition and sending the beacon frame at low speed, and can wait for the corresponding time according to the beacon period carried in the beacon frame, thereby enabling the main equipment to preferentially use the channel resource. When the main device receives the message carrying the network allocation vector in the waiting time slot, the beacon frame is broadcasted again after waiting for the channel occupation time corresponding to the network allocation vector, and random backoff is not needed for any time, so that compared with a method for randomly backoff for a period of time in a contention mechanism in the prior art, the method provided by the embodiment of the invention improves the success rate of the main device in channel occupation, reduces the probability of collision with other contention devices, and improves the utilization rate of channel resources.
Based on the same technical concept, an embodiment of the present invention further provides a master device, as shown in fig. 5, including:
a sending module 501, configured to broadcast a beacon frame carrying a beacon period within a preset range, where the beacon period is used to indicate a time when the master device occupies a channel, and the beacon frame is a broadcast message that does not need to be replied;
the processing module 502 is configured to, when receiving a message carrying a network allocation vector in a waiting time slot of the beacon period, wait for a channel occupation time corresponding to the network allocation vector, and then broadcast the beacon frame again within the preset range.
Optionally, the processing module 502 is further configured to:
the beacon period comprises an access slot for instructing a slave device to initiate an access request;
and after the message carrying the network allocation vector is not received in the waiting time slot of the beacon period, waiting to receive an access request sent by slave equipment in the access time slot.
Optionally, the processing module 502 is further configured to:
when the received access request is determined to meet the preset condition, allocating a sub-time slot for transmitting data in the data transmission time slot of the beacon period for the slave equipment, and sending an access success message carrying the sub-time slot to the slave equipment;
and transmitting data with the slave equipment in the sub-time slot.
Optionally, the processing module 502 is further configured to:
the beacon period further comprises a data transmission slot for instructing an accessed slave device to transmit data;
and after the message carrying the network allocation vector is not received in the waiting time slot of the beacon period, transmitting data with the accessed slave equipment in the data transmission time slot.
Optionally, the processing module 502 is further configured to:
after the sub-time slot and the accessed slave equipment transmit data, judging whether the data which needs to be transmitted with the accessed slave equipment is transmitted in the data transmission time slot;
if not, the beacon frame is broadcasted within the preset range again.
Based on the same technical concept, an embodiment of the present invention further provides a slave device, as shown in fig. 6, including:
a receiving module 601, configured to receive a beacon frame carrying a beacon period, where the beacon period is used to indicate a time when a primary device occupies a channel, and the beacon frame is a broadcast message that does not need to be replied; the beacon period comprises an access slot for instructing a slave device to initiate an access request;
a processing module 602, configured to send an access request to the master device at a first rate in the access timeslot; if the access success message sent by the master device is not received, after N beacon periods, sending an access request to the master device at a second rate, wherein the second rate is smaller than the first rate, until the access success message sent by the master device is received, and the successful access message carries a sub-time slot which is distributed by the master device for the slave device and used for transmitting data in a data transmission time slot of the beacon period; and transmitting data with the main equipment in the sub time slot.
Optionally, the beacon period further includes a data transmission slot for instructing an accessed slave device to transmit data; the processing module 602 is further configured to transmit data with the master device in the data transmission timeslot.
Embodiments of the present invention provide a computing device, which may be specifically a desktop computer, a portable computer, a smart phone, a tablet computer, a Personal Digital Assistant (PDA), and the like. The computing device may include a Central Processing Unit (CPU), memory, input/output devices, etc., the input devices may include a keyboard, mouse, touch screen, etc., and the output devices may include a Display device, such as a Liquid Crystal Display (LCD), a Cathode Ray Tube (CRT), etc.
Memory, which may include Read Only Memory (ROM) and Random Access Memory (RAM), provides the processor with program instructions and data stored in the memory. In embodiments of the present invention, the memory may be used to store program instructions for the channel occupancy method;
and the processor is used for calling the program instruction stored in the memory and executing the channel occupation method according to the obtained program.
An embodiment of the present invention provides a computer storage medium, where a computer-executable instruction is stored, where the computer-executable instruction is used to enable a computer to execute a channel occupying method.
It should be apparent to those skilled in the art that embodiments of the present invention may be provided as a method, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.