Communication method and device, electronic equipment and storage medium
Through time-sharing processing and task priority management in terminal devices, the problem of low multi-task channel utilization rate of wireless devices is solved, and more efficient channel utilization and task response are achieved.
Patent Information
- Application Number
- CN202510448803.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-07-04
AI Technical Summary
In the prior art, there is no specific solution to how to reasonably switch channels to multi-tasking of wireless devices to improve channel utilization.
After obtaining the initial task set at the terminal, time-sharing processing is performed based on the total number of tasks to form a time slice, and at the beginning of each time slice, access point type tasks and workstation type tasks that need to be awakened are added to the candidate set, and the target task is determined based on the number of executions and priority.
Avoid time slice allocation of dormant tasks, improve channel utilization, reduce transmission delay, and ensure early response of tasks with high priority.
Smart Images

Figure CN120264477A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of wireless communication technologies, and particularly relates to a communication method, apparatus, electronic device, and storage medium. Background Art
[0002] With the rapid development of Internet of Things technologies, as a key information transmission tool, wireless devices often need to be compatible with multiple different types of tasks, such as connecting to a router to access the Internet, local area network streaming, p2p screen mirroring, sharing a hotspot, etc. In response to the demand for multiple tasks, the Multi-Channel Concurrency (MCC) strategy realizes the execution of multiple tasks by switching different channels through a time-sharing mechanism. However, there is currently no specific solution for how to reasonably allocate time to each task to improve the utilization rate of channels. Summary of the Invention
[0003] The purpose of the embodiments of this application is to provide a communication method, apparatus, electronic device, and storage medium, which can improve the utilization rate of channels.
[0004] In a first aspect, the embodiments of this application provide a communication method, which is executed by a terminal and includes: The terminal obtains an initial task set to be executed, and the initial task set includes at least two data transmission tasks; wherein, the at least two data transmission tasks include at least one of a workstation type task and an access point type task, the workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point; Based on the total number of tasks in the initial task set, time-sharing processing is performed on the channel where the terminal is located to obtain at least two time slices for task allocation; At the beginning of the i-th time slice, a candidate task set is obtained based on the initial task set, and the candidate task set only includes all the access point type tasks and the workstation type tasks that need to be awakened in the initial task set; wherein, 1 ≤ i ≤ N, and i is a positive integer, and N is the total number of tasks in the initial task set; The terminal executes a target task within the i-th time slice; wherein, the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
[0005] In a second aspect, the embodiments of this application provide a communication apparatus, which is applied to a terminal, and the apparatus includes: An acquisition module, configured to acquire an initial task set to be executed, where the initial task set includes at least two data transmission tasks; wherein, the at least two data transmission tasks include at least one of a workstation type task and an access point type task, the workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point; A time-sharing module, configured to perform time-sharing processing on the channel where the terminal is located based on the total number of tasks in the initial task set, to obtain at least two time slices for task allocation; A screening module, configured to obtain a candidate task set based on the initial task set at the beginning of the i-th time slice, where the candidate task set only includes all the access point type tasks and the workstation type tasks that need to be woken up in the initial task set; wherein, 1≤i≤N, and i is a positive integer, and N is the total number of tasks in the initial task set; A communication module, configured to execute a target task within the i-th time slice; wherein, the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
[0006] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a computer program stored on the memory and executable on the processor. When the computer program is executed by the processor, the steps of the communication method described in the first aspect are implemented.
[0007] In a fourth aspect, an embodiment of the present application provides a readable storage medium, where a program or instruction is stored on the readable storage medium. When the program or instruction is executed by a processor, the steps of the communication method described in the first aspect are implemented.
[0008] In a fifth aspect, an embodiment of the present application provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor, and the processor is configured to run a program or instruction to implement the communication method described in the first aspect.
[0009] In a sixth aspect, an embodiment of the present application provides a computer program product, which is stored in a storage medium and is executed by at least one processor to implement the communication method described in the first aspect.
[0010] In the embodiment of the present application, at the beginning of a certain time slice, all access point type tasks and workstation type tasks that need to be woken up are added to the candidate task set, and the target task to be executed is determined from the candidate task set based on the execution times and priorities. Through the above process, it is possible to avoid allocating time slices to workstation type tasks in the sleep state, the time-sharing mechanism is more optimized and reasonable, the utilization rate of the channel can be improved, the transmission delay caused by improper time slice allocation can be reduced, and tasks with higher priorities can be executed and responded earlier. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 is a schematic flowchart of a communication method provided by an embodiment of the present application; Figure 2 is another schematic flowchart of a communication method provided by an embodiment of the present application; Figure 3 is a schematic flowchart of a wireless device listening for beacon frames provided by an embodiment of the present application; Figure 4 is another schematic flowchart of a communication method provided by an embodiment of the present application; Figure 5 is a schematic structural diagram of a communication device provided by an embodiment of the present application; Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application; Figure 7 is a schematic structural diagram of another electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0012] Next, the technical solutions in the embodiments of the present application will be clearly described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art belong to the scope of protection of the present application.
[0013] The terms "first", "second", etc. in the specification of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. generally belong to the same category, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification means at least one of the connected objects, and the character " / " generally represents an "or" relationship between the associated objects before and after.
[0014] The following will, in conjunction with the accompanying drawings, elaborate in detail on the electronic device and display control method provided in the embodiments of the present application through specific embodiments and their application scenarios.
[0015] Figure 1 Shown is a communication method provided in the embodiments of the present application, which is executed by a terminal. As Figure 1 shown, the method includes the following steps.
[0016] S102: The terminal obtains an initial task set to be executed, and the initial task set includes at least two data transmission tasks.
[0017] Among them, the above-mentioned at least two data transmission tasks include at least one of a workstation type task and an access point type task. The workstation type task indicates that the terminal acts as a workstation for data transmission, and the access point type task indicates that the terminal acts as a wireless access point for data transmission.
[0018] In the embodiments of the present application, the number of data transmission tasks in the initial task set is not specifically limited. For example, it can be 10, 50, or 100, etc.
[0019] In the embodiments of the present application, the terminal executing the above communication method can work as an AP (Access Point), such as working as a router, or can work as a STA (Station), such as working as a mobile terminal. In different data transmission tasks, the working role of the terminal is different. Therefore, different data transmission tasks can be classified as workstation type or access point type.
[0020] S104: Perform time-sharing processing on the channel where the terminal is located based on the total number of tasks in the initial task set to obtain at least two time slices for task allocation.
[0021] In the embodiments of the present application, the number of channels where the terminal is located can be multiple, and the specific number is not limited. For example, it can be 2, 5, or 10, etc.
[0022] Among them, time-sharing processing means dividing time into multiple time-sharing periods, and the same processing flow is executed in each time-sharing period. The time-sharing period can be set to a specific value according to needs, such as 50 ms or 100 ms, etc., and is not specifically limited. For example, if the time-sharing period is 100 ms, then time-sharing processing means executing the same processing flow every 100 ms.
[0023] In the embodiments of the present application, in any one of the multiple divided time-sharing periods, the time-sharing period can be divided into multiple time slices, and each time slice is used to allocate to a data transmission task.
[0024] Among them, the number of time slices within a time-sharing period is determined according to the total number of tasks in the initial task set. For example, if the time-sharing period is T and the total number of tasks in the initial task set is N, then the time-sharing period T can be divided into T / N time slices.
[0025] S106: At the beginning of the i-th time slice, obtain a candidate task set based on the initial task set. The candidate task set only includes all access point type tasks and workstation type tasks that need to be awakened in the initial task set.
[0026] Among them, 1 ≤ i ≤ N, and i is a positive integer, and N is the total number of tasks in the initial task set.
[0027] In the embodiments of this application, there are multiple time-sharing periods, and there are also multiple time slices within each time-sharing period. The same processing flow is repeated in sequence for each time-sharing period, and the same processing flow is repeated in sequence for each time slice within each time-sharing period. Therefore, taking the current time slice i to be allocated (any time slice within the current time-sharing period) within the current time-sharing period (any time-sharing period) as an example, the steps of the above communication method are described, and no further statement will be made later.
[0028] In one implementation manner, before the above terminal executes the target task within the i-th time slice, it may further include: Read the current working state of the workstation type task in the initial task set. If the current working state of the workstation type task is the wake-up state, add the workstation type task to the candidate task set.
[0029] It is worth mentioning that the access point type tasks in the initial task set can also be added to the candidate task set, so that a candidate task set only including all access point type tasks and workstation type tasks that need to be awakened can be obtained.
[0030] In another implementation manner, before the above terminal executes the target task within the i-th time slice, it may further include: For the data transmission tasks of the workstation type in the initial task set, read the current working state of the data transmission tasks. If the current working state of the data transmission tasks is the sleep state, delete the data transmission tasks based on the initial task set and retain the remaining data transmission tasks, so as to obtain the candidate task set.
[0031] In one embodiment, the working state of the above workstation-type task is a bitmap with 2 digits. Among them, one bit represents whether the terminal has data to send or has no data to send, and the other bit represents whether there is data of the wireless access point to receive or there is no data of the wireless access point to receive. When the two bits indicate that there is data to send or there is data of the wireless access point to receive, the corresponding working state is the wake-up state. When the two bits indicate that there is no data to send and there is no data of the wireless access point to receive, the corresponding working state is the sleep state.
[0032] Among them, the working state of the above workstation-type task can be updated in real time by listening to beacon frames. Exemplarily, the updated result can be recorded in the task working state set, so that the latest working state can be obtained by reading this task working state set.
[0033] S108: The terminal executes the target task in the i-th time slice, and the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
[0034] Among them, before the above terminal executes the target task in the i-th time slice, it may further include: Determine the target task in the candidate set based on the execution times and priorities of the data transmission tasks.
[0035] In one embodiment, the above determining the target task in the candidate set based on the execution times and priorities of the data transmission tasks may include: Determine the data transmission task with the least execution times based on the candidate set; among the data transmission tasks with the least execution times, use the data transmission task with the highest priority as the target task.
[0036] It is worth mentioning that the above data transmission task with the least execution times refers to the data transmission task with the least execution times in the current time-sharing period.
[0037] Among them, the above data transmission task with the least execution times may be one or more, and is not specifically limited. The data transmission task with the highest priority is one.
[0038] In the embodiments of the present application, each data transmission task corresponds to a unique priority, and different data transmission tasks can be identified through the priority.
[0039] In the embodiments of the present application, one channel executes one data transmission task. Among them, the channel used by the data transmission task has been determined when it is generated. Therefore, it can be understood that each data transmission task has a corresponding channel, that is, there is a definite corresponding relationship between the data transmission task and the channel.
[0040] In an embodiment of the present application, after the terminal executes a target task within the i-th time slice, the following may further be included: Determine whether there is a data transmission task that has been executed and completed. If so, delete the data transmission task that has been executed and completed from the initial task set and the candidate task set.
[0041] In an embodiment of the present application, when i is equal to N, after the terminal executes a target task within the i-th time slice, the following may further be included: If there is a new data transmission task, add the new data transmission task to the initial task set, and reset the execution times of all data transmission tasks in the initial task set to zero.
[0042] Wherein, i being equal to N represents the end of the current time-sharing period, and then the next time-sharing period starts, and the same processing flow continues to be executed.
[0043] In an embodiment of the present application, the terminal supports a first wireless path and a second wireless path. The target task is executed by the first wireless path, and the second wireless path is used to monitor beacon frames.
[0044] In an embodiment of the present application, both the first wireless path and the second wireless path are used for wireless data transmission. Among them, the second wireless path alternately operates in a sleep state and a wake-up state.
[0045] In one implementation, the first wireless path may support multiple modulation methods, which are not specifically limited. For example, it may support a modulation method of 1KQAM (1 Kilo Quadrature Amplitude Modulation, 1024-order quadrature amplitude modulation), or support a modulation method of 256-QAM, or support a modulation method of 4KQAM, etc.
[0046] In one implementation, the second wireless path supports modulation methods of OFDM (Orthogonal Frequency Division Multiplexing), DSSS (Direct Sequence Spread Spectrum), or CCK (Complementary Code Keying).
[0047] In the method provided by the embodiment of the present application, at the beginning of a certain time slice, all access point type tasks and workstation type tasks that need to be woken up are added to the candidate task set, and the target task to be executed is determined from the candidate task set based on the execution times and priorities. Through the above process, it is possible to avoid allocating time slices to the workstation type tasks in the sleep state, the time-sharing mechanism is more optimized and reasonable, the utilization rate of the channel can be improved, the transmission delay caused by improper time slice allocation can be reduced, and the tasks with higher priorities can be executed and responded earlier.
[0048] Figure 2 Another communication method provided by the embodiment of the present application is shown, which is executed by a terminal. As Figure 2 shown, the method includes the following steps.
[0049] S202: The terminal obtains an initial task set to be executed, and the initial task set includes at least two data transmission tasks.
[0050] In the embodiment of the present application, the data transmission task refers to a task of sending data or receiving data, and does not include the task of listening to beacon frames.
[0051] Among them, the above at least two data transmission tasks include at least one of workstation type tasks and access point type tasks. The workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point.
[0052] For example, connecting to a router to access the Internet, local area network streaming, etc. belong to the workstation type; P2P Go, personal hotspot, etc. belong to the access point type.
[0053] In the embodiment of the present application, the above initial task set can be expressed as follows: . Among them, is a workstation type task, is an access point type task.
[0054] S204: Perform time sharing on the channel where the terminal is located based on the total number of tasks in the initial task set to obtain at least two time slices for task allocation.
[0055] For example, if the total number of tasks in the initial task set is N, within a time-sharing period T, T can be evenly divided into N time slices, and each data transmission task is allocated one time slice. That is to say, each data transmission task can be allocated an execution time of T / N.
[0056] S206: At the beginning of the i-th time slice, obtain a candidate task set based on the initial task set. The candidate task set only includes all access point type tasks and the workstation type tasks that need to be woken up in the initial task set.
[0057] Wherein, 1≤i≤N, i is a positive integer, and N is the total number of tasks in the initial task set.
[0058] In the embodiment of the present application, the data transmission task of the access point type needs to process the data requests sent from other devices in real time and needs to be awakened at least once within a time-sharing period. Therefore, when allocating each time slice in the current time-sharing period, the access point type tasks are added to the candidate task set.
[0059] In the embodiment of the present application, for the workstation type tasks in the initial task set, if the current working state of the workstation type task is the awakened state, the workstation type task is added to the candidate task set.
[0060] Since the candidate task set does not include the workstation type tasks in the sleep state, it can be ensured that such tasks are not allocated time slices, thereby avoiding the situation of low channel utilization rate and unreasonable time slice allocation caused by allocating time slices to the sleep state tasks, realizing reasonable scheduling, resource optimization, improving the channel utilization rate, and reducing the transmission delay.
[0061] In the embodiment of the present application, the working state of the above workstation type task is a bitmap with 2 digits. Among them, one bit represents whether the terminal has data to send or has no data to send, and the other bit represents whether there is data to receive from the wireless access point or there is no data to receive from the wireless access point. In the case where the two bits represent that there is data to send or there is data to receive from the wireless access point, the corresponding working state is the awakened state.
[0062] This way of using a bitmap to represent the working state can cover various combined states of terminal transceiver, and can identify all working states with less resources, which is simple and efficient.
[0063] Exemplarily, the 0th bit can represent whether the terminal has data to send or has no data to send, and the 1st bit can represent whether there is data to receive from the wireless access point or there is no data to receive from the wireless access point. Alternatively, the 0th bit can represent whether there is data to receive from the wireless access point or there is no data to receive from the wireless access point, and the 1st bit can represent whether the terminal has data to send or has no data to send. The embodiment of the present invention does not make specific limitations on this.
[0064] For example, the task working state set is S . Among them, it includes n working states , corresponding to n workstation type tasks. It is a bitmap with 2 bits. When the 0th bit is 1, it indicates that the terminal has data to send; when the 0th bit is 0, it indicates that the terminal has no data to send. When the 1st bit is 1, it indicates that the terminal needs to receive data sent by the wireless access point; when the 1st bit is 0, it indicates that the terminal does not need to receive data, that is, the wireless access point has no data to send. Therefore, when is 0, the corresponding workstation type task is in the sleep state. When is 1, 2, or 3, the corresponding workstation type task is in the wake-up state.
[0065] In one implementation, the working state of the above workstation type task can be updated in real time by listening to beacon frames.
[0066] In the embodiments of the present application, the principle for the STA to listen to beacon frames is as follows: After the STA enters the power-saving mode, the AP caches the data sent to the STA during the sleep period of the STA. The STA wakes up regularly and listens to the beacon frames sent by the AP to check whether there is cached data in the TIM (Traffic Indication Map) of the beacon frame. If the TIM indicates which STAs have cached data through the AID (Association ID), these STAs send PS-Poll (Power Save-Poll) frames to request data. After receiving the PS-Poll frame, the AP distributes the cached data to the corresponding STA according to the AID in the received PS-Poll frame. After receiving the data, the STA re-enters the sleep mode. Among them, the AID is a unique identifier assigned by the AP to each associated STA.
[0067] Figure 3 shows a schematic flow diagram of a wireless device listening to beacon frames provided by the embodiments of the present application. As Figure 3 shown, the wireless device with AID = 1 listens to beacon frames during the listening wake-up time and is in the sleep state at other times. When the router indicates in the TIM of a beacon frame through AID = 1 that the wireless device has data to receive, the wireless device sends a PS-Poll frame to request the data. After receiving the PS-Poll frame, the AP distributes the cached data to the wireless device. After receiving the data, the wireless device re-enters the sleep state.
[0068] S208: Determine the data transmission task with the least number of executions based on the candidate set.
[0069] Among them, the least number of executions mentioned above means the least number of executions within the current time-sharing period.
[0070] In the embodiments of the present application, the data transmission task with the least number of executions in the current time-sharing period may be one or more, and there is no specific limitation. For the convenience of recording, the number of executions of the task may also be represented in the form of a set. For example, the number of executions of each data transmission task in the current time-sharing period may be represented as: set C . In this set C, are the number of executions of the workstation type tasks respectively, are the number of executions of the access point type tasks respectively.
[0071] This method of determining the data transmission task with the least number of executions can enable as many data transmission tasks as possible to obtain scheduling opportunities fairly, allocate time slices more reasonably, and greatly improve the utilization rate of the channel.
[0072] S210: Among the data transmission tasks with the least number of executions, the data transmission task with the highest priority is used as the target task.
[0073] Among them, the current time slice, that is, the i-th time slice, can be allocated to the target task.
[0074] In the embodiments of the present application, each data transmission task corresponds to a unique priority, and different data transmission tasks can be identified through the priority. Among them, the priority of the data transmission task can be set as a positive integer. For example, the smaller the value, the higher the priority, or the larger the value, the higher the priority. The embodiments of the present invention do not make specific limitations on this.
[0075] This method of determining the target task with the highest priority can ensure that the task with the highest priority obtains the allocation of time slices first, can be executed and responded earlier, ensure that more important and urgent tasks can be executed first, and realize the reasonable scheduling of tasks.
[0076] In the embodiments of the present application, the priority set of the data transmission task can be represented as follows: P . In this set P, are the priorities of the workstation type tasks respectively, are the priorities of the access point type tasks respectively.
[0077] S212: The terminal executes the target task in the i-th time slice.
[0078] In the embodiments of the present application, the terminal supports a first wireless path and a second wireless path. The target task is executed by the first wireless path, and the second wireless path is used to listen for beacon frames.
[0079] Among them, both the first wireless path and the second wireless path are used for wireless data transmission. The second wireless path alternates between a sleep state and a wake state due to listening to beacon frames. Therefore, compared with the method where both wireless paths are always in a working state, one of the wireless paths alternates between a sleep state and a wake state, greatly reducing power consumption.
[0080] Based on this method, the second wireless path can be implemented using a circuit with a lower cost than the first wireless path, such as designing a baseband and front-end circuit with a lower cost. Compared with the method where both wireless paths use the same cost, it can greatly save hardware costs, reduce power consumption, and be more power-saving.
[0081] In one implementation, the first wireless path can support multiple modulation methods, such as supporting modulation methods of 1KQAM, 4KQAM, or 256-QAM. The second wireless path can support modulation methods of OFDM, DSSS, or CCK. Among them, the circuit costs of 1KQAM, 4KQAM, or 256-QAM are higher, and the circuit costs of OFDM, DSSS, or CCK are lower. The real-time request for data transceiver is realized through the high-cost first wireless path, and the listening of beacon frames is realized through the low-cost second wireless path. The combination of the two achieves the effects of reasonable design, cost saving, and power consumption reduction.
[0082] S214: Determine whether there is a data transmission task that has been completed. If so, delete the completed data transmission task from the initial task set and the candidate task set.
[0083] This method of deleting the completed data transmission task can update the initial task set and the candidate task set in a timely manner, ensuring the effectiveness and accuracy of subsequent task allocation.
[0084] S216: When i is equal to N, if there is a new data transmission task, add the new data transmission task to the initial task set and reset the execution times of all data transmission tasks in the initial task set to zero.
[0085] This method of adding a new data transmission task in a new time-sharing period realizes the dynamic allocation of data transmission tasks, ensures the timely allocation of new data transmission tasks, and improves the processing efficiency.
[0086] Figure 4 Shows another schematic diagram of the communication method flow provided by the embodiment of the present application. As Figure 4As shown, there are an initial task set Q, a task working status set S, a task execution count set C, and a task priority set P. Among them, the priorities in set P are sorted according to actual requirements. The sleep-wake status of the data transfer tasks of STA in set S is updated in real time. All counts in set C are set to 0 before the tasks start. Define a variable Ntemp to represent the current remaining number of tasks. The initial value of Ntemp is set to the number N of data transfer tasks in set Q during initialization. Define i as the time slice serial number in the current time-sharing period.
[0087] First, when the i-th time slice starts, retain all data transfer tasks of the AP type and delete the data transfer tasks in the sleep state of the STA type to obtain a new set Q1. Among them, deleting the data transfer tasks in the sleep state of the STA type can also be understood as retaining the data transfer tasks that need to be woken up. Whether a data transfer task is in the sleep state can be judged by whether the value in set S is 0. If it is 0, it represents the sleep state; if it is non-0, it represents the wake state.
[0088] Secondly, select the data transfer task with the least execution count in the current time-sharing period from set Q1 to obtain a new set Q2. The purpose of this step is to enable all data transfer tasks to obtain scheduling opportunities as fairly as possible. Select the data transfer task with the highest priority in set Q2 as the target task to obtain the execution permission for the i-th time slice. In this i-th time slice, switch the corresponding channel to execute the target task. When each data transfer task obtains a time slice, its corresponding execution count staCount or apCount needs to be incremented by 1, that is, the execution count is incremented by 1.
[0089] After a time slice is executed, check whether there is any data transfer task that has ended. If so, delete the information of this task from all sets, and Ntemp is subtracted by the number of ended tasks. Then, judge whether set Q is empty. If Q is empty, it means that there are no data transfer tasks that need to be executed currently, and then exit. If Q is not empty, continue with the allocation process of the next time slice until the count of time slices reaches N.
[0090] When the count of time slices has reached N, this round of time-sharing period has ended. Judge whether there are new data transfer tasks added. If so, add the information such as the newly added data transfer tasks, their priorities, working statuses, and execution counts to each set to obtain the updated sets Q, S, C, and P. And update the total number of tasks N, and clear all execution counts in set C. Then, the wireless device starts the process of the next time-sharing period.
[0091] In the method provided by the embodiment of the present application, at the beginning of a certain time slice, all access point type tasks and workstation type tasks that need to be woken up are added to the candidate task set, and the target task to be executed is determined from the candidate task set based on the execution times and priorities. Through the above process, it is possible to avoid allocating time slices to workstation type tasks in the sleep state, the time-sharing mechanism is more optimized and reasonable, the utilization rate of the channel can be improved, the transmission delay caused by improper time slice allocation can be reduced, the anti-interference ability is stronger, and tasks with higher priorities can be executed and responded earlier.
[0092] The above is the communication method provided by the embodiment of the present invention. Based on the same idea, the embodiment of the present invention also provides a communication device, as Figure 5 shown. The communication device includes: an acquisition module 501, a time-sharing module 502, a screening module 503, and a communication module 504.
[0093] The acquisition module 501 is used to acquire an initial task set to be executed. The initial task set includes at least two data transmission tasks. The at least two data transmission tasks include at least one of a workstation type task and an access point type task. The workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point.
[0094] The time-sharing module 502 is used to perform time sharing on the channel where the terminal is located based on the total number of tasks in the initial task set to obtain at least two time slices for task allocation.
[0095] The screening module 503 is used to, at the beginning of the i-th time slice, obtain a candidate task set based on the initial task set. The candidate task set only includes all access point type tasks and workstation type tasks that need to be woken up in the initial task set; where 1 ≤ i ≤ N, and i is a positive integer, and N is the total number of tasks in the initial task set.
[0096] The communication module 504 is used to execute the target task within the i-th time slice; where the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
[0097] In the embodiment of the present application, the screening module 503 is specifically used for: Determining the target task in the candidate set based on the execution times and priorities of the data transmission tasks.
[0098] In one implementation manner, the above device further includes: A determination module, used to determine the data transmission task with the least execution times based on the candidate set, and among the data transmission tasks with the least execution times, take the data transmission task with the highest priority as the target task.
[0099] In the embodiments of the present application, the screening module 503 is specifically configured to: Read the current working status of the workstation type tasks in the initial task set; If the current working status of the workstation type task is the wake-up status, add the workstation type task to the candidate task set.
[0100] In one implementation, the working status of the above workstation type task is a bitmap with 2 digits. Among them, one bit represents whether the terminal has data to send or no data to send, and the other bit represents whether there is data of the wireless access point to receive or no data of the wireless access point to receive. When the two bits represent that there is data to send or there is data of the wireless access point to receive, the corresponding working status is the wake-up status.
[0101] In the embodiments of the present application, the above device further includes: A deletion module, configured to, after executing the target task in the i-th time slice, determine whether there is a data transmission task that has been executed and completed. If so, delete the data transmission task that has been executed and completed from the initial task set and the candidate task set.
[0102] In the embodiments of the present application, the above device further includes: An addition module, configured to, when i is equal to N, after executing the target task in the i-th time slice, if there is a new data transmission task, add the new data transmission task to the initial task set, and reset the execution times of all data transmission tasks in the initial task set to zero.
[0103] In the embodiments of the present application, the terminal supports a first wireless path and a second wireless path. The target task is executed by the first wireless path, and the second wireless path is used to listen for beacon frames.
[0104] In one implementation, the second wireless path supports modulation methods such as OFDM, DSSS, or CCK.
[0105] The above device provided by the embodiments of the present application can execute the method provided by any of the above method embodiments. For the detailed process, refer to the description in the method embodiments, which will not be elaborated here.
[0106] The above device provided by the embodiments of the present application, at the beginning of a certain time slice, adds all access point type tasks and workstation type tasks that need to be woken up to the candidate task set, and determines the target task to be executed from the candidate task set based on the execution times and priorities. Through the above process, it is possible to avoid allocating time slices to workstation type tasks in the sleep state, the time-sharing mechanism is more optimized and reasonable, the utilization rate of the channel can be improved, the transmission delay caused by improper time slice allocation can be reduced, and tasks with higher priorities can be executed and responded earlier.
[0107] Optionally, as Figure 6 shown, an embodiment of the present application further provides an electronic device 600, including a processor 601 and a memory 602. A program or instruction that can run on the processor 601 is stored on the memory 602. When the program or instruction is executed by the processor 601, each step of the above method embodiments is implemented, and the same technical effects can be achieved. To avoid repetition, details are not described herein again.
[0108] It should be noted that the electronic devices in the embodiments of the present application include the above-mentioned mobile electronic devices and non-mobile electronic devices.
[0109] Figure 7 A schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. As Figure 7 shown, the electronic device 700 includes, but is not limited to: a radio frequency unit 701, a network module 702, an audio output unit 703, an input unit 704, a sensor 705, a display unit 706, a user input unit 707, an interface unit 708, a memory 709, and a processor 710, etc.
[0110] Those skilled in the art can understand that the electronic device 700 may further include a power source (such as a battery) for supplying power to each component. The power source can be logically connected to the processor 710 through a power management system, so as to manage functions such as charging, discharging, and power consumption management through the power management system. Figure 7 The structure of the electronic device shown in does not limit the electronic device. The electronic device may include more or fewer components than shown, or combine some components, or have different component arrangements, which are not described herein again.
[0111] Among them, the processor 710 is used for the terminal to obtain an initial task set to be executed. The initial task set includes at least two data transmission tasks. Among them, at least two data transmission tasks include at least one of a workstation type task and an access point type task. The workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point. The channel where the terminal is located is time-division processed based on the total number of tasks in the initial task set to obtain at least two time slices for task allocation. At the beginning of the i-th time slice, a candidate task set is obtained based on the initial task set. The candidate task set only includes all the access point type tasks and the workstation type tasks that need to be awakened in the initial task set. Where 1≤i≤N, and i is a positive integer, and N is the total number of tasks in the initial task set.
[0111] The radio frequency unit 701 is used to execute a target task within the i-th time slice. The target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
[0112] In some embodiments, the processor 710 is configured to determine the data transmission task with the least number of executions based on the candidate set; among the data transmission tasks with the least number of executions, the data transmission task with the highest priority is taken as the target task.
[0113] In some embodiments, the processor 710 is configured to read the current working state of the workstation type tasks in the initial task set; if the current working state of the workstation type tasks is the wake-up state, the workstation type tasks are added to the candidate task set.
[0114] Wherein, the working state of the workstation type tasks is a bitmap with 2 bits. One bit represents whether the terminal has data to send or no data to send, and the other bit represents whether there is data from the wireless access point to receive or no data from the wireless access point to receive. In the case where both bits represent that there is data to send or there is data from the wireless access point to receive, the corresponding working state is the wake-up state.
[0115] In one implementation, the above-mentioned processor 710 is further configured to: Determine whether there is a data transmission task that has been executed and completed. If so, the data transmission task that has been executed and completed is deleted from the initial task set and the candidate task set.
[0116] In one implementation, the above-mentioned processor 710 is further configured to: When i is equal to N, after executing the target task in the i-th time slice, if there is a new data transmission task, the new data transmission task is added to the initial task set, and the number of executions of all data transmission tasks in the initial task set is reset to zero.
[0117] Wherein, the terminal supports the first wireless path and the second wireless path. The target task is executed by the first wireless path, and the second wireless path is used to listen for beacon frames.
[0118] In one implementation, the second wireless path supports modulation methods such as OFDM, DSSS, or CCK.
[0119] The above-mentioned electronic device provided by the embodiments of the present application, at the beginning of a certain time slice, adds all access point type tasks and workstation type tasks that need to be woken up to the candidate task set, and determines the target task to be executed from the candidate task set based on the number of executions and priorities. Through the above process, it is possible to avoid allocating time slices to the workstation type tasks in the sleep state, the time-sharing mechanism is more optimized and reasonable, the utilization rate of the channel can be improved, the transmission delay caused by improper time slice allocation can be reduced, and the tasks with high priorities can be executed and responded earlier.
[0120] It should be understood that in the embodiments of the present application, the input unit 704 may include a Graphics Processing Unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes the image data of static pictures or videos obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 706 may include a display panel 7061, and the display panel 7061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also referred to as a touch screen. The touch panel 7071 may include two parts: a touch detection device and a touch controller. The other input devices 7072 may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be elaborated herein.
[0121] The memory 709 can be used to store software programs and various data. The memory 709 mainly includes a first storage area for storing programs or instructions and a second storage area for storing data. Among them, the first storage area can store an operating system, applications or instructions required for at least one function (such as a sound playback function, an image playback function, etc.). In addition, the memory 709 may include a volatile memory or a non-volatile memory, or the memory 709 may include both a volatile memory and a non-volatile memory. Among them, the non-volatile memory may be a Read-Only Memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an Electrically EPROM (EEPROM), or a flash memory. The volatile memory may be a Random Access Memory (RAM), a Static RAM (SRAM), a Dynamic RAM (DRAM), a Synchronous DRAM (SDRAM), a Double Data Rate SDRAM (DDR SDRAM), an Enhanced SDRAM (ESDRAM), a Synch link DRAM (SLDRAM), and a Direct Rambus RAM (DRRAM). The memory 709 in the embodiments of the present application includes, but is not limited to, these and any other suitable types of memories.
[0122] The processor 710 may include one or more processing units; optionally, the processor 710 integrates an application processor and a modem processor. Among them, the application processor mainly processes operations related to the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication signals, such as a baseband processor. It can be understood that the above-mentioned modem processor may not be integrated into the processor 710 either.
[0123] The embodiments of the present application further provide a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, it implements each process of the above-mentioned method embodiments and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0124] Among them, the processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory ROM, random access memory RAM, magnetic disks, or optical discs, etc.
[0125] The embodiments of the present application further provide a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run a program or instruction to implement each process of the above-mentioned method embodiments and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0126] It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, system chip, chip system, or system-on-chip, etc.
[0127] The embodiments of the present application provide a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement each process of the above-mentioned method embodiments and can achieve the same technical effect. To avoid repetition, it will not be elaborated here.
[0128] It should be noted that in this text, the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising one..." does not exclude the existence of additional identical elements in the process, method, article or device comprising that element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, but may also include performing functions in a substantially simultaneous manner or in the reverse order according to the functions involved. For example, the described methods may be performed in an order different from that described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0129] From the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to enable a terminal (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present application.
[0130] The embodiments of the present application have been described above with reference to the accompanying drawings. However, the present application is not limited to the above specific embodiments. The above specific embodiments are merely illustrative and not restrictive. Those of ordinary skill in the art, under the inspiration of the present application and without departing from the purpose of the present application and the scope protected by the claims, can still make many forms, all of which fall within the protection scope of the present application.
Claims
1. A communication method, performed by a terminal, characterized in that Including: The terminal obtains an initial task set to be executed, where the initial task set includes at least two data transmission tasks; among them, the at least two data transmission tasks include at least one of a workstation type task and an access point type task. The workstation type task indicates that the terminal performs data transmission as a workstation, and the access point type task indicates that the terminal performs data transmission as a wireless access point; Perform time-sharing processing on the channel where the terminal is located based on the total number of tasks in the initial task set to obtain at least two time slices for task allocation; At the beginning of the i-th time slice, obtain a candidate task set based on the initial task set. The candidate task set only includes all the access point type tasks and the workstation type tasks that need to be awakened in the initial task set; where 1≤i≤N, and i is a positive integer, and N is the total number of tasks in the initial task set; The terminal executes a target task within the i-th time slice; where the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
2. The method according to claim 1, wherein Before the terminal executes the target task within the i-th time slice, the method further includes: Determine the data transmission task with the least number of executions based on the candidate set; Among the data transmission tasks with the least number of executions, use the data transmission task with the highest priority as the target task.
3. The method according to claim 1, wherein The obtaining of the candidate task set based on the initial task set includes: Read the current working state of the workstation type task in the initial task set; If the current working state of the workstation type task is the wake-up state, add the workstation type task to the candidate task set.
4. The method according to claim 3, characterized in that, The working state of the workstation type task is a bitmap with 2 bits. One bit represents whether the terminal has data to send or no data to send, and the other bit represents whether there is data from a wireless access point to receive or no data from a wireless access point to receive. In the case where both bits represent that there is data to send or there is data from a wireless access point to receive, the corresponding working state is the wake-up state.
5. The method according to claim 1, wherein After the terminal executes the target task within the i-th time slice, the method further includes: Determine whether there is a data transmission task that has been executed and completed; If so, delete the data transmission task that has been executed and completed from the initial task set and the candidate task set.
6. The method according to claim 1, characterized in that When i is equal to N, after the terminal executes the target task within the i-th time slice, the method further includes: If there is a new data transmission task, add the new data transmission task to the initial task set and reset the execution times of all data transmission tasks in the initial task set to zero.
7. The method according to claim 1, wherein The terminal supports a first wireless path and a second wireless path. The target task is executed by the first wireless path, and the second wireless path is used to listen for beacon frames.
8. The method according to claim 7, characterized in that, The second wireless path supports modulation methods such as orthogonal frequency division multiplexing (OFDM), direct sequence spread spectrum (DSSS), or complementary code keying (CCK).
9. A communication device, characterized in that, Applied to a terminal, the device includes: An acquisition module, configured to acquire an initial task set to be executed, where the initial task set includes at least two data transmission tasks; wherein, the at least two data transmission tasks include at least one of a workstation type task and an access point type task, the workstation type task indicates that the terminal acts as a workstation for data transmission, and the access point type task indicates that the terminal acts as a wireless access point for data transmission; A time-sharing module, configured to perform time-sharing processing on the channel where the terminal is located based on the total number of tasks in the initial task set, to obtain at least two time slices for task allocation; A screening module, configured to, at the start of the i-th time slice, obtain a candidate task set based on the initial task set, where the candidate task set only includes all the access point type tasks and the workstation type tasks that need to be woken up in the initial task set; wherein, 1 ≤ i ≤ N, and i is a positive integer, and N is the total number of tasks in the initial task set; A communication module, configured to execute a target task within the i-th time slice; wherein, the target task is determined based on the execution times and priorities of each task to be executed in the candidate task set.
10. An electronic device, characterized in that, Comprising a processor, a memory, and a computer program stored on the memory and executable on the processor, where when the computer program is executed by the processor, the steps of the communication method according to any one of claims 1-8 are implemented.
11. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the communication method according to any one of claims 1-8 are implemented.
12. A computer program product, characterized in that, Comprising a computer program, and when the computer program is executed by a processor, the steps of the communication method according to any one of claims 1-8 are implemented.