Embodiments of this application relate to the field of communication technologies, and in particular, to a communication method, a terminal device, and a storage medium.
A wireless fidelity (wireless fidelity, Wi-Fi) technology is a widely used wireless network transmission technology. Currently, many application scenarios of a Wi-Fi service are a device to device (device to device, D2D) transmission mode between two peer user nodes. In Wi-Fi peer-to-peer communication, two devices establish a D2D link on a channel with a maximum bandwidth supported by the two devices, and exchange of service data is directly completed between the two devices. Generally, a service target with a high throughput and a low delay is required.
Wi-Fi communication uses a carrier sense multiple access with collision avoidance (carrier sense multiple access with collision avoidance, CSMA/CA) mechanism. When a plurality of Wi-Fi D2D links exist at the same time, the plurality of Wi-Fi D2D links work at the same time by using the CSMA/CA mechanism, causing frequent air interface contention and collision, and resulting in a long delay of the Wi-Fi service.
Embodiments of this application provide a communication method, a terminal device, and a storage medium. The terminal device selects a narrow bandwidth channel, so as to reduce a probability of contending for a transmission resource with another terminal device on a same channel, and reduce a service transmission delay.
According to a first aspect, a communication method is provided, including: A first terminal device receives a first operation of a user, and the first terminal device performs a Wi-Fi P2P service in response to the first operation, where the first terminal device uses a first channel to perform the Wi-Fi P2P service, a bandwidth of the first channel is a maximum bandwidth supported by the first terminal device, and the maximum bandwidth is 80 MHz or 160 MHz; and when detecting that a signal-to-noise ratio and/or a channel load of the first channel meet a first preset condition, the first terminal device switches from the first channel to a second channel to perform the Wi-Fi P2P service, where a bandwidth of the second channel is 20 MHz or 40 MHz.
The communication method provided in the first aspect may be applied to a scenario in which a plurality of pairs of terminal devices simultaneously perform a Wi-Fi P2P service. Compared with that a plurality of pairs of terminal devices simultaneously occupy one relatively high bandwidth channel, a large bandwidth channel may be divided into a plurality of narrow bandwidth channels for use. The terminal device selects a narrow bandwidth channel based on a signal-to-noise ratio and/or a channel load of a channel, so as to reduce a probability of contending for a transmission resource with another terminal device on a same channel, reduce channel interference, and reduce a transmission delay of performing the Wi-Fi P2P service by the terminal device. In addition, concurrent communication between a plurality of pairs of terminal devices is implemented, and a throughput of an entire system is increased.
In a possible implementation, the second channel is a part of the first channel. Channel utilization is improved by selecting the second channel with a narrow bandwidth in a frequency range of the first channel to perform the Wi-Fi P2P service.
In a possible implementation, frequency ranges of the second channel and the first channel do not overlap. By selecting the second channel that does not overlap the frequency range of the first channel to perform the Wi-Fi P2P service, channel interference is further reduced, and a throughput of an entire system is increased.
In a possible implementation, a signal-to-noise ratio and/or a channel load of the second channel meet a second preset condition.
In a possible implementation, the method further includes: When detecting that a signal-to-noise ratio and/or a channel load of the second channel meet the first preset condition, and a signal-to-noise ratio and/or a channel load of a third channel meet a second preset condition, the first terminal device switches from the second channel to the third channel to perform the Wi-Fi P2P service, where a bandwidth of the third channel is 20 MHz or 40 MHz. The terminal device selects another narrow bandwidth channel based on the signal-to-noise ratio and/or the channel load of the channel to perform the Wi-Fi P2P service, which further reduces channel interference, and reduces the transmission delay of performing the Wi-Fi P2P service by the terminal device.
In a possible implementation, frequency ranges of the second channel and the third channel do not overlap. By selecting the third channel that does not overlap the frequency range of the second channel to perform the Wi-Fi P2P service, channel interference is further reduced, and a throughput of an entire system is increased.
In a possible implementation, the method further includes: When detecting that a signal-to-noise ratio and/or a channel load of the second channel meet the first preset condition, and a signal-to-noise ratio and/or a channel load of a fourth channel meet a second preset condition, the first terminal device switches from the second channel to the fourth channel to perform the Wi-Fi P2P service, where a bandwidth of the fourth channel is the maximum bandwidth. The terminal device reselects a high bandwidth channel based on the signal-to-noise ratio and/or the channel load of the channel to perform the Wi-Fi P2P service, thereby improving performance of the Wi-Fi P2P service.
In a possible implementation, the fourth channel and the first channel are a same channel.
In a possible implementation, the method further includes: The first terminal device receives first information broadcast by a second terminal device, where the second terminal device is another terminal device that performs the Wi-Fi P2P service in a Wi-Fi network except the first terminal device, and the first information is used to indicate a channel used by the second terminal device. The first terminal device may determine, by receiving the first information, a quantity of established Wi-Fi peer-to-peer communication links in each channel, and a quantity or a quantity of pairs of terminal devices that perform the Wi-Fi P2P service in each channel, so as to determine an idle degree of each channel, and provide an accurate basis for subsequently switching a channel by the first terminal device.
In a possible implementation, the first information is carried in a beacon frame broadcast by the second terminal device, or the first information is carried in a Bluetooth broadcast frame broadcast by the second terminal device.
In a possible implementation, the method further includes: The first terminal device obtains, based on the first information, a quantity of terminal devices that perform the Wi-Fi P2P service on the second channel; and if the first terminal device determines that the quantity of terminal devices that perform the Wi-Fi P2P service on the second channel is greater than or equal to a first threshold, and a quantity of terminal devices that perform the Wi-Fi P2P service on a fifth channel is less than the first threshold, the first terminal device switches from the second channel to the fifth channel to perform the Wi-Fi P2P service. The terminal device selects an idle channel to perform the Wi-Fi P2P service, which reduces a probability of contending for a transmission resource with another terminal device on a same channel, and reduces a transmission delay of performing the Wi-Fi P2P service by the terminal device.
In a possible implementation, the method further includes: The first terminal device broadcasts second information, where the second information is used to indicate a channel used by the first terminal device.
In a possible implementation, the Wi-Fi P2P service is a projection service or a file sharing service.
In a possible implementation, the first channel and the second channel are Wi-Fi 5G channels.
According to a second aspect, an apparatus is provided, including: a unit or a means (means) configured to perform the steps in the first aspect.
According to a third aspect, a terminal device apparatus is provided, including a processor, configured to be connected to a memory, and configured to invoke a program stored in the memory, so as to perform the method provided in the first aspect. The memory may be located inside or outside the apparatus. There are one or more processors, and there are one or more memories.
According to a fourth aspect, a program is provided, where the program is used to perform the method in the first aspect when being executed by a processor.
According to a fifth aspect, an embodiment of this application provides a computer-readable storage medium. The computer-readable storage medium stores instructions. When the instructions run on a computer or a processor, the method provided in the first aspect is implemented.
According to a sixth aspect, an embodiment of this application provides a program product, where the program product includes a computer program, the computer program is stored in a readable storage medium, at least one processor of a device may read the computer program from the readable storage medium, and the at least one processor executes the computer program so that the device implements the method provided in the first aspect.
The following describes embodiments of this application with reference to accompanying drawings.
A communication method provided in an embodiment of this application may be applied to a scenario in which a plurality of pairs of terminal devices perform Wi-Fi peer-to-peer communication in an environment. For example,
It should be noted that the application scenario is not limited in this embodiment of this application. Optionally, the application scenario may be a closed environment, for example, the conference scenario shown in
It should be noted that, in this embodiment of this application, a name, a type, a quantity of terminal devices in the application scenario and a quantity of terminal devices that perform Wi-Fi peer-to-peer communication are not limited. For example, the terminal device may also be referred to as user equipment (user equipment, UE), a mobile station (mobile station, MS), a terminal or a mobile terminal (mobile terminal, MT), and may be a device that provides voice/data connectivity to a user, for example, a handheld device or a vehicle-mounted device that has a wireless connection function. Currently, some examples of the terminal device are: a mobile phone (mobile phone), a tablet computer, a laptop computer, a palmtop computer, a mobile internet device (mobile internet device, MID), a wearable device, a virtual reality (virtual reality, VR) device, an augmented reality (augmented reality, AR) device, a wireless terminal in industrial control (industrial control), a wireless terminal in self-driving (self-driving), a wireless terminal in remote medical surgery (remote medical surgery), a wireless terminal in a smart grid (smart grid), a wireless terminal in transportation safety (transportation safety), a wireless terminal in a smart city (smart city), or a wireless terminal in a smart home (smart home).
It should be noted that, in this embodiment of this application, a Wi-Fi P2P service implemented by the terminal device through Wi-Fi peer-to-peer communication is not limited. For example, the terminal device is configured to perform wireless projection presentation, or a file is shared between two mobile phones. With reference to
With reference to
It should be noted that in this embodiment of this application, a communication protocol standard and version that are used for Wi-Fi peer-to-peer communication are not limited. For example, the communication protocol may include but is not limited to a Wi-Fi 5 standard or a Wi-Fi 6 standard.
It should be noted that this embodiment of this application sets no limitation on an implementation in which two terminal devices perform Wi-Fi peer-to-peer communication. Optionally, in an implementation, the two terminal devices may work in a Wi-Fi peer-to-peer (peer-to-peer, P2P) mode. Optionally, in another implementation, one terminal device may work in an access point (access point, AP) mode, and the other terminal device may work in a STA mode. For example, in
The following briefly describes several working modes of Wi-Fi.
1. AP Mode and STA Mode
In wireless local area networks (wireless local area networks, WLAN), an AP may work in an AP mode as a primary device, and another device connected to the WLAN network may be referred to as a STA. The AP manages and controls the STA to form a wireless network. The AP mode may also be referred to as a master mode (master mode), and the STA mode may also be referred to as a slave mode. For example, with reference to
2. Wi-Fi P2P Mode
Wi-Fi P2P is also referred to as Wi-Fi Direct, and may implement direct communication between two devices without an AP. For example, with reference to
In the Wi-Fi P2P mode, there are two roles, respectively referred to as a group owner (group owner, GO) and a client (client). After initiating a P2P connection, two terminal devices perform P2P GO/Client negotiation. After P2P GO/Client negotiation is completed, one terminal device serves as a GO, and the other terminal device serves as a client. Determining of the GO or the client is not related to an initiator or a receiver of a P2P connection in the two terminal devices. For example, a terminal device 1 actively initiates a P2P connection to a terminal device 2, the terminal device 1 is an initiator of the P2P connection, and the terminal device 2 is a receiver of the P2P connection. In an implementation, the terminal device 1 may be a GO, and the terminal device 2 may be a client. In another implementation, the terminal device 1 may be a client, and the terminal device 2 may be a GO.
In an application scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication, in an implementation, each pair of terminal devices may establish a D2D link on a Wi-Fi channel with a maximum bandwidth supported. For example, the maximum bandwidth may be 80 MHz or 160 MHz, a channel may include but is not limited to: 5170-5330 MHz and 5490-5650 MHz, and a bandwidth of the channel is 160 MHz. In this scenario, there are a plurality of D2D links on a same channel. For example, with reference to
When there are a plurality of D2D links on a same channel, contention for a transmission resource is involved. Currently, a CSMA/CA mechanism is used for Wi-Fi communication. In the CSMA/CA mechanism, a transmit end device first detects whether the channel is idle. If the transmit end device determines that the channel is not idle, the transmit end device continues to wait. If the transmit end device determines that the channel is idle, the transmit end device sends data after waiting for a random period of time. After receiving the data sent by the transmit end device, if it is determined that the data is correct, a receive end device sends an acknowledge character (acknowledge character, ACK) frame to the transmit end device after waiting for a time interval. A random time for waiting by the transmit end device and a time interval for waiting by the receive end device are not limited. For example, the CSMA/CA mechanism includes but is not limited to the following interframe space (interframe space, IFS): short interframe space (short interframe space, SIFS), long interframe space (long interframe space, LIFS), point coordination function interframe space (PCF interframe space, PIFS), distributed coordination function interframe space (DCF interframe space, DIFS), or extended interframe space (extended interframe space, EIFS).
The following provides an example description of the CSMA/CA mechanism with reference to
It can be learned that in a scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication, a plurality of D2D links work on a same high bandwidth channel at the same time, frequent transmission resource contention and collision may occur when the CSMA/CA mechanism is used, and even a case in which the terminal device always cannot obtain an air interface sending opportunity may occur, thereby increasing a transmission delay of a Wi-Fi P2P service and increasing channel interference.
An embodiment of this application provides a communication method, and a high bandwidth channel may be divided into a plurality of narrow bandwidth channels for use. A terminal device selects a relatively idle narrowband channel to transmit Wi-Fi P2P service data, thereby reducing a probability of contending for a transmission resource with another terminal device on a same channel, and reducing channel interference. In a scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication, concurrent communication of the plurality of pairs of terminal devices can be implemented, which reduces a transmission delay of performing a Wi-Fi P2P service by each pair of terminal devices, and increases a throughput of an entire system.
It should be noted that a division manner of a narrowband channel and a bandwidth of the narrowband channel are not limited in this embodiment of this application. For example, the bandwidth of the narrowband channel may include but is not limited to 80 MHz, 40 MHz, or 20 MHz. For example,
The following uses a scenario shown in
Specific embodiments are used below to describe in detail the technical solutions of this application. The following several specific embodiments may be combined with each other, and a same or similar concept or process may not be described repeatedly in some embodiments.
S901: The first terminal device receives a service triggering operation of a user.
The service triggering operation of the user is used to trigger the first terminal device to perform a target service, and the target service is implemented based on Wi-Fi peer-to-peer communication performed by the first terminal device and the second terminal device. A specific implementation of the service triggering operation and a type of the target service are not limited in this embodiment. Optionally, the service triggering operation of the user may include but is not limited to at least one of the following: a tap operation, a double-tap operation, or a slide operation that is performed by the user on a touch display of the first terminal device, or a voice input operation of the user. For example, refer to a related operation of the user in
S902: The first terminal device determines a target channel in a plurality of candidate channels based on channel usage information of the plurality of candidate channels in response to the service triggering operation.
The plurality of candidate channels may have a plurality of bandwidths, there is at least one candidate channel of each bandwidth, and the channel usage information may be used to indicate an idle degree of a candidate channel.
A quantity of candidate channels and a bandwidth of a candidate channel are not limited in this embodiment. With reference to
Because there are a plurality of candidate channels that have a plurality of bandwidths, the first terminal device may select a relatively idle target channel from the plurality of candidate channels based on channel usage information of each candidate channel. The target channel may be a channel with a relatively high bandwidth, for example, a 160 MHz channel, or may be a narrowband channel with a relatively narrow bandwidth, for example, a channel of 20 MHz or 40 MHz. In a scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication, the first terminal device selects a relatively idle target channel, which avoids that a plurality of pairs of terminal devices occupies a same channel, reduces a probability that terminal devices on a same channel contend for a transmission resource, and reduces channel interference.
S903: The first terminal device establishes a Wi-Fi peer-to-peer communication link between the first terminal device and the second terminal device on the target channel.
S904: The first terminal device performs a target service based on the Wi-Fi peer-to-peer communication link between the first terminal device and the second terminal device.
An existing procedure of establishing a D2D link between terminal devices that perform Wi-Fi peer-to-peer communication may be used. This is not limited in this embodiment. For example, the first terminal device and the second terminal device may work in a Wi-Fi P2P mode.
It can be learned that in the communication method provided in this embodiment, to perform the target service in response to the service triggering operation of the user, the first terminal device first needs to establish a Wi-Fi peer-to-peer communication link to the second terminal device. The first terminal device may select the target channel from the plurality of candidate channels to establish the link. The plurality of candidate channels include a plurality of channels with a plurality of bandwidths. The first terminal device may select a relatively idle target channel based on the channel usage information of each candidate channel, and perform the target service based on the Wi-Fi peer-to-peer communication link established on the target channel. The communication method provided in this embodiment may be applied to a scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication. Compared with a scenario in which a plurality of pairs of terminal devices simultaneously occupy one high bandwidth channel, a high bandwidth channel may be divided into a plurality of narrow bandwidth channels for use. Based on idle degrees of channels of various bandwidths, the terminal device selects a relatively idle channel to transmit service data, thereby reducing a probability of contending for a transmission resource with another terminal device on a same channel, reducing channel interference, implementing concurrent communication of a plurality of pairs of terminal devices, reducing a transmission delay of performing a service by each pair of terminal devices, and increasing a throughput of an entire system.
Optionally, the communication method provided in this embodiment may further include the following steps:
The first terminal device obtains service information of the target service.
Correspondingly, in S902, that the first terminal device determines the target channel in the plurality of candidate channels based on the channel usage information of the plurality of candidate channels may include the following steps:
The first terminal device determines the target channel in the plurality of candidate channels based on the service information and the channel usage information.
Specifically, the service information of the target service may be used to determine a bandwidth of a channel required by the target service. The first terminal device determines the target channel based on the service information and the channel usage information of the plurality of candidate channels, and may select a relatively idle target channel on a premise that a target service throughput requirement is met, thereby reducing a probability that terminal devices on a same channel contend for a transmission resource, reducing channel interference, reducing a transmission delay of performing a service by each pair of terminal devices, and increasing a system throughput.
Optionally, the service information may include but is not limited to at least one of the following: a service name, a service type, a data packet type, a data packet size, a data transmission rate, a Wi-Fi standard, a quantity of antenna streams, a preset channel bandwidth corresponding to a service, a minimum channel bandwidth corresponding to a service or a maximum quantity of established Wi-Fi peer-to-peer communication links on a channel. This is not limited in this embodiment. For example, different service types may correspond to different channels with different bandwidths. For example, a wireless projection service generally has a relatively high delay requirement. A minimum channel bandwidth corresponding to the wireless projection service may be 20 MHz, and a corresponding preset channel bandwidth may be 40 MHz or 80 MHz. For example, both a minimum channel bandwidth and a preset channel bandwidth corresponding to the file sharing service may be 20 MHz. Optionally, the Wi-Fi standard may include but is not limited to Wi-Fi 5 or Wi-Fi 6.
Optionally, the channel usage information may include but is not limited to at least one of the following: channel quality information, a quantity of terminal devices on a channel that perform a Wi-Fi P2P service, a quantity of pairs of terminal devices on a channel that perform a Wi-Fi P2P service, or a quantity of established Wi-Fi peer-to-peer communication links on a channel. Optionally, the channel quality information may include but is not limited to at least one of the following: background noise, a signal-to-noise ratio, signal spectrum information, channel estimated throughput, or a channel busy ratio.
For example, with reference to
It should be noted that different content of the channel usage information can be obtained in different manners and defined differently. For example, the channel estimated throughput may be determined based on a signal-to-noise ratio (signal noise ratio, SNR) of a channel. For example, the channel busy ratio may be defined as channel busy duration/total measurement time, expressed in percentage. For another example, in a Wi-Fi communication protocol, a channel busy ratio may be defined as Channel Load=Integer ((channel busy time/(Measurement Duration×1024))×255). Integer represents a rounding operation, channel busy time represents the channel busy duration, and Measurement Duration represents measurement duration. For definitions, refer to the protocol. Optionally, in an implementation, the first terminal device may obtain the signal spectrum information by using a power spectral density (power spectral density, PSD) scanning capability of a Wi-Fi chip, to obtain distribution of each frequency of a signal in frequency domain. For example,
Optionally, the communication method provided in this embodiment may further include the following steps:
The first terminal device receives first channel announcement information broadcast by a third terminal device, where the first channel announcement information is used to indicate a channel occupied by a Wi-Fi peer-to-peer communication link established by the third terminal device.
For ease of description, another terminal device that performs Wi-Fi peer-to-peer communication different from the first terminal device and the second terminal device in the application scenario may be referred to as the third terminal device. The first terminal device may learn of, by receiving the first channel announcement information broadcast by the third terminal device, a quantity of established Wi-Fi peer-to-peer communication links on the channel. The following provides example descriptions of the first channel announcement information with reference to
A name of the first channel announcement information, specific content included in the first channel announcement information, and a broadcast manner are not limited in this embodiment.
Optionally, in an implementation, the first channel announcement information may be carried in a beacon frame (beacon frame) broadcast by the third terminal device. For example, the first channel announcement information may be carried in a vendor IE (vendor information element) field in the beacon frame. For example, Table 1 shows a structure of the vendor IE in the beacon frame. As shown in Table 1, byte numbers may be 0-8. A value of a field Element ID is DD, which represents the vendor IE in the beacon frame. A value of a field Length corresponding to a byte 1 is 7, which represents 7 bytes whose byte numbers are 2-8. A field OUI is used to distinguish between different vendors. A value of a field Feature ID is 0x20, which represents that the vendor IE carries “channel announcement information”, which may also be referred to as “D2D channel information notification”. A field Tag represents a tag number, and a value of a field Length corresponding to a byte 7 is 1, which represents a byte whose byte number is 8. A field channel and bandwidth info is used to indicate a channel and a bandwidth that are used by a D2D link established by a terminal device.
Optionally, in another implementation, the first channel announcement information may be carried in a Bluetooth broadcast frame broadcast by the third terminal device. For example, Table 2 shows a structure of a Bluetooth low energy (Bluetooth low energy, BLE) broadcast frame. As shown in Table 2, the BLE broadcast frame may include the following fields: a header, an address, a length, and data. The data field may occupy 30 bytes, and is used to carry channel announcement information. For details, refer to descriptions of the field channel and bandwidth info in Table 1. Principles are similar, and details are not described herein again. It should be noted that the first channel announcement information and the Bluetooth broadcast frame are not limited in Table 2.
Optionally, the communication method provided in this embodiment may further include the following steps:
The first terminal device broadcasts second channel announcement information. The second channel announcement information is used to indicate a channel occupied by a Wi-Fi peer-to-peer communication link established by the first terminal device.
For the second channel announcement information, refer to the foregoing related description of the first channel announcement information. Principles are similar, and details are not described herein again.
Optionally, in S902, that the first terminal device determines the target channel in the plurality of candidate channels based on the channel usage information of the plurality of candidate channels may include the following steps:
The first terminal device determines at least one first channel in the plurality of candidate channels based on the channel usage information. Channel usage information of the first channel meets a first preset condition.
The first terminal device determines the target channel in the at least one first channel.
When specific content of the channel usage information is different, a corresponding first preset condition may be different. Optionally, the first preset condition may include at least one of the following conditions:
A channel estimated throughput is greater than or equal to a first preset value.
A channel busy ratio of a channel is less than a second preset value.
A signal-to-noise ratio of a channel is greater than or equal to a third preset value.
A quantity of established Wi-Fi peer-to-peer communication links on a channel is less than a fourth preset value.
A quantity of pairs of terminal devices that perform a Wi-Fi P2P service on a channel is less than the fourth preset value.
A quantity of terminal devices that perform a Wi-Fi P2P service on a channel is less than twice of the fourth preset value.
A maximum amplitude of a frequency component of a signal is less than a fifth preset value.
Optionally, the first preset condition may further include that background noise of the channel is less than a sixth preset value.
In this embodiment, names and specific values of the first preset value to the sixth preset value are not limited, and a quantity of conditions included in the first preset condition is not limited. For example, the first preset condition may include that the quantity of established Wi-Fi peer-to-peer communication links on a channel is less than the fourth preset value, and the background noise of the channel is less than the sixth preset value.
Optionally, the first terminal device determines the target channel in the at least one first channel. In an implementation, the target channel may be a channel with a maximum bandwidth in the at least one first channel. Optionally, if there are a plurality of channels with a maximum bandwidth, the target channel may be any channel with the maximum bandwidth. An example is used for description. It is assumed that the channel usage information includes a channel busy ratio of the channel, and the first preset condition includes that the channel busy ratio of the channel is less than the second preset value. Three first channels are determined from candidate channels based on the first preset condition, which are respectively 36/20 MHz, 149/20 MHz, and 52/40 MHz. The first terminal device may determine the first channel 52/40 MHz as the target channel. In this implementation, the channel with the maximum bandwidth in the at least one first channel is determined as the target channel, which further meets a throughput requirement of the target service, and further shortens a transmission delay of the target service.
Optionally, the first terminal device determines the target channel in the at least one first channel. In an implementation, the target channel may be a channel with a minimum bandwidth in the at least one first channel. Optionally, if there are a plurality of channels with a minimum bandwidth, the target channel may be any channel with the minimum bandwidth. An example is used for description. It is assumed that the channel usage information includes a channel busy ratio of the channel, and the first preset condition includes that the channel busy ratio of the channel is less than the second preset value. Four first channels are determined from the candidate channels based on the first preset condition, which are respectively 36/20 MHz, 40/20 MHz, 52/40 MHz, and 149/80 MHz. The first terminal device may determine the first channel 40/20 MHz as the target channel. In this implementation, the channel with the minimum bandwidth in the at least one first channel is determined as the target channel. In a scenario in which a plurality of pairs of terminal devices simultaneously perform Wi-Fi peer-to-peer communication, an idle channel is reserved for a subsequent Wi-Fi peer-to-peer communication link established by another terminal device, and subsequent frequent channel switching by the first terminal device caused by a gradual increase in a quantity of established Wi-Fi peer-to-peer communication links is avoided.
Optionally, the first terminal device determines the target channel in the at least one first channel. In still another implementation, if the channel usage information includes at least one of background noise of the channel, a channel busy ratio of the channel, a quantity of established Wi-Fi peer-to-peer communication links on the channel, or an amplitude of a frequency component of a signal, the target channel may be a channel with a minimum channel usage information value in the at least one first channel. If the channel usage information includes the channel estimated throughput, the target channel may be a channel with a maximum channel usage information value in the at least one first channel. Optionally, if there are a plurality of channels with the minimum value or the maximum value, the target channel may be any channel with the minimum value or the maximum value. An example is used for description. It is assumed that the channel usage information includes the quantity of established Wi-Fi peer-to-peer communication links on a channel, and the first preset condition includes that the quantity of established Wi-Fi peer-to-peer communication links on a channel is less than the fourth preset value. Three first channels are determined from the candidate channels based on the first preset condition, which are respectively 36/20 MHz, 52/40 MHz, and 149/80 MHz, and quantities of established Wi-Fi peer-to-peer communication links on each channel are respectively 0, 1, and 0. The first terminal device may determine the first channel 149/80 MHz as the target channel. In this implementation, a channel whose channel usage information value is the minimum or the maximum in the at least one first channel is determined as the target channel, which ensures that the target channel is a relatively idle channel, further reduces a probability that the first terminal device contends for a transmission resource with another terminal device on the target channel, reduces channel interference, and further reduces a transmission delay of the target service.
Optionally, the first terminal device determines the target channel in the at least one first channel. In still another implementation, a bandwidth of the first channel may be a preset channel bandwidth corresponding to the target service, and the target channel is any channel in the at least one first channel. An example is used for description. It is assumed that the target service is a wireless projection service, and a corresponding preset channel bandwidth is 20 MHz or 40 MHz. Three first channels are determined from the candidate channels based on the first preset condition, which are respectively 36/20 MHz, 52/40 MHz, and 149/20 MHz. The first terminal device may determine the first channel 36/20 MHz as the target channel.
It should be noted that the foregoing implementations of determining the target channel in the at least one first channel may be combined with each other. For example, the target channel may be a channel with a maximum bandwidth and a minimum channel usage information value in the at least one first channel. For another example, the target channel may be a channel with a minimum channel usage information value in the at least one first channel and with the preset channel bandwidth corresponding to the target service.
The following uses the conference scenario shown in
Optionally, for Example 1, refer to
Optionally, for Example 2, refer to
Optionally, for Example 3, refer to
Optionally, for Example 4, refer to
Optionally, for Example 5, refer to
S1701: The first terminal device obtains channel usage information of a plurality of candidate channels.
The plurality of candidate channels may have a plurality of bandwidths, there is at least one candidate channel of each bandwidth, and the channel usage information may be used to indicate an idle degree of a candidate channel.
For the candidate channel, the channel usage information, and an implementation of obtaining the channel usage information, refer to related descriptions in the embodiment shown in
S1702: If the first terminal device determines that channel usage information of a target channel meets a second preset condition and that there is a second channel meeting a first preset condition in the plurality of candidate channels, the first terminal device switches a Wi-Fi peer-to-peer communication link between the first terminal device and the second terminal device from the target channel to a second channel.
The target channel is a channel currently occupied by the Wi-Fi peer-to-peer communication link between the first terminal device and the second terminal device.
For the first preset condition, refer to related descriptions in the embodiment shown in
It can be learned that in the communication method provided in this embodiment, after establishing the Wi-Fi peer-to-peer communication link to the second terminal device on the target channel, the first terminal device may continue to obtain channel usage information of each candidate channel. If the first terminal device determines, based on the channel usage information of each candidate channel, that a currently occupied target channel is relatively busy and there is a relatively idle second channel in another channel, the first terminal device may switch from the target channel to the second channel, which reduces a probability that the first terminal device contends for a transmission resource with another terminal device on the second channel, reduces channel interference, reduces a transmission delay of performing a service by the first terminal device, and increases a throughput of an entire system.
When specific content of the channel usage information is different, a corresponding second preset condition may be different. Optionally, the second preset condition may include at least one of the following conditions:
A channel estimated throughput is less than a seventh preset value.
A channel busy ratio of a channel is greater than or equal to an eighth preset value.
A signal-to-noise ratio of a channel is less than a ninth preset value.
A quantity of established Wi-Fi peer-to-peer communication links on a channel is greater than or equal to a tenth preset value.
A quantity of pairs of terminal devices that perform a Wi-Fi P2P service on a channel is greater than or equal to the tenth preset value.
A quantity of terminal devices that perform a Wi-Fi P2P service on a channel is greater than or equal to twice of the tenth preset value.
A maximum amplitude of a frequency component of a signal is greater than or equal to an eleventh preset value.
Optionally, the second preset condition may further include that background noise of a channel is greater than or equal to a twelfth preset value.
Names and specific values of the seventh preset value to the twelfth preset value are not limited in this embodiment.
Optionally, there may be one or more channels that meet the first preset condition in a plurality of candidate channels. If there are a plurality of channels that meet the first preset condition in the plurality of candidate channels, for an implementation of determining the second channel from the plurality of channels that meet the first preset condition, refer to related descriptions of determining, by the first terminal device, the target channel in the at least one first channel in the embodiment shown in
The following uses the conference scenario shown in
Optionally, for Example 6, refer to
Optionally, for Example 7, refer to
Optionally, for Example 8, refer to
Optionally, for Example 9, refer to
S2201: The first terminal device and/or the second terminal device obtain channel usage information of a plurality of candidate channels.
The plurality of candidate channels may have a plurality of bandwidths, there is at least one candidate channel of each bandwidth, and the channel usage information may be used to indicate an idle degree of a candidate channel.
For the candidate channel, the channel usage information, and an implementation of obtaining the channel usage information, refer to related descriptions in the embodiment shown in
This embodiment sets no limitation on execution time of obtaining channel usage information of a plurality of candidate channels by the first terminal device and obtaining channel usage information of a plurality of candidate channels by the second terminal device.
S2202: The first terminal device and/or the second terminal device determine, based on the channel usage information, whether to switch a channel.
In this embodiment, any one of the first terminal device and the second terminal device may determine, based on the channel usage information, whether channel switching needs to be performed, and then the first terminal device initiates a channel switching procedure. For a determining condition for determining whether to switch a channel, refer to descriptions of S1702 in the embodiment shown in
Optionally, in an implementation, the first terminal device determines to switch a channel, and the first terminal device may directly initiate a channel switching procedure. After S2202, the communication method provided in this embodiment may further include the following steps:
S2204: The first terminal device sends switch indication information to the second terminal device. The switch indication information is used to notify the second terminal device to perform channel switching. Correspondingly, the second terminal device receives the switch indication information sent by the first terminal device.
A name of the switch indication information and specific content included in the switch indication information are not limited in this embodiment. For example, the switch indication information may be a management frame (action frame) that carries a channel switch announcement (channel switch announcement, CSA) and that is specified in a Wi-Fi protocol, and the frame may include agreed switching time.
S2205: The second terminal device sends switch response information to the first terminal device. The switch response information is used to indicate that the second terminal device receives the switch indication information. Correspondingly, the first terminal device receives the switch response information sent by the second terminal device.
Then, the first terminal device and the second terminal device may switch from a current channel to a specified channel.
A name of the switch response information and specific content included in the switch response information are not limited in this embodiment. For example, the switch response information may be an ACK specified in the Wi-Fi protocol.
Optionally, in another implementation, the second terminal device determines to switch a channel. In this case, the second terminal device needs to notify the first terminal device to initiate switching. After S2202, the communication method provided in this embodiment may further include the following steps:
S2203: The second terminal device sends switch request information to the first terminal device. The switch request information is used to notify the first terminal device to initiate channel switching. Correspondingly, the first terminal device receives the switch request information sent by the second terminal device.
A name of the switch request information and specific content included in the switch request information are not limited in this embodiment. For example, the switch request information may include but is not limited to agreed switching time or channel information of a specified channel switched to.
S2204: The first terminal device sends switch indication information to the second terminal device.
S2205: The second terminal device sends switch response information to the first terminal device.
It can be understood that, to implement the foregoing functions, the terminal device includes corresponding hardware and/or software modules for implementing each function. With reference to example algorithm steps described in embodiments disclosed in this specification, this application can be implemented in a form of hardware or a combination of hardware and computer software. Whether a function is performed by hardware or hardware driven by computer software depends on a particular application and a design constraint of the technical solutions. A person of ordinary skill in the art may use different methods to implement the described functions for each particular application with reference to embodiments, but it should not be considered that the implementation goes beyond the scope of this application.
In this embodiment of this application, the terminal device may be divided into function modules based on the foregoing method example. For example, function modules may be divided corresponding to functions, or two or more functions may be integrated into one processing module. The foregoing integrated module may be implemented in a hardware form. It should be noted that, in embodiments of this application, division into the modules is an example and is merely logical function division, and may be other division in an actual implementation.
When function modules are divided corresponding to functions,
The receiving module 2301 is configured to receive a service triggering operation of a user.
The processing module 2302 is configured to determine a target channel in a plurality of candidate channels based on channel usage information of the plurality of candidate channels in response to the service triggering operation. The plurality of candidate channels may have a plurality of bandwidths, there is at least one candidate channel of each bandwidth, and the channel usage information may be used to indicate an idle degree of a candidate channel.
The processing module 2302 is further configured to: establish a Wi-Fi peer-to-peer communication link to a second terminal device on the target channel, and perform a target service based on the Wi-Fi peer-to-peer communication link to the second terminal device.
It should be noted that, all related content of steps in the foregoing method embodiments may be cited in function descriptions of corresponding functional modules. Details are not described herein again.
The processing module may be a processor or a controller. The processing module may implement or execute logical blocks, modules, and circuits in various examples described with reference to content disclosed in this application. The processor may also be a combination for implementing computing functions, for example, a combination including one or more microprocessors, and a combination of digital signal processing (digital signal processing, DSP) and a microprocessor. The storage module may be a memory. A communication module may be specifically a device that interacts with another electronic device, such as a radio frequency circuit, a Bluetooth chip, or a Wi-Fi chip.
An embodiment of this application further provides a terminal device.
As shown in
It can be understood that the structure shown in this embodiment of this application does not constitute a specific limitation on the terminal device 100. In some other embodiments of this application, the terminal device 100 may include more or fewer components than those shown in the figure, combine some components, split some components, or have different component arrangements. The components shown in the figure may be implemented by using hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (Application Processor, AP), a modem processor, a graphics processing unit (Graphics Processing Unit, GPU), an image signal processor (Image Signal Processor, ISP), a controller, a memory, a video codec, a digital signal processor (Digital Signal Processor, DSP), a baseband processor, and/or a neural-network processing unit (Neural-network Processing Unit, NPU). Different processing units may be independent devices, or may be integrated into one or more processors.
The controller may be a nerve center and a command center of the terminal device 100. The controller may generate an operation control signal based on an instruction operation code and a time sequence signal, to complete control of instruction fetching and instruction execution.
A memory may be further disposed in the processor 110, and is configured to store instructions and data. In some embodiments, the memory in the processor 110 is a cache. The memory may store instructions or data that has been used or is cyclically used by the processor 110. If the processor 110 needs to use the instructions or the data again, the processor may directly invoke the instructions or the data from the memory. This avoids repeated access, reduces waiting time of the processor 110, and improves system efficiency.
In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (Inter-Integrated Circuit, I2C) interface, an inter-integrated circuit sound (Inter-Integrated circuit Sound, I2S) interface, a pulse code modulation (Pulse Code Modulation, PCM) interface, a universal asynchronous receiver/transmitter (Universal Asynchronous Receiver/Transmitter, UART) interface, a mobile industry processor interface (Mobile Industry Processor Interface, MIPI), a general-purpose input/output (General-Purpose Input/Output, GPIO) interface, a subscriber identity module (Subscriber Identity Module, SIM) interface, a universal serial bus (Universal Serial Bus, USB) interface, and/or the like.
The I2C interface is a two-way synchronization serial bus, and includes one serial data line (Serial Data Line, SDA) and one serial clock line (Serial Clock Line, SCL). In some embodiments, the processor 110 may include a plurality of groups of I2C buses. The processor 110 may be separately coupled to the touch sensor 180K, a charger, a flashlight, the camera 193, and the like through different I2C bus interfaces. For example, the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, to implement a touch function of the terminal device 100.
The I2S interface may be used for audio communication. In some embodiments, the processor 110 may include a plurality of groups of I2S buses. The processor 110 may be coupled to the audio module 170 through the I2S bus, to implement communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the I2S interface, to implement a function of answering a call by using a Bluetooth headset.
The PCM interface may also be used for audio communication, and analog signal sampling, quantization, and coding. In some embodiments, the audio module 170 may be coupled to the wireless communication module 160 through a PCM bus interface. In some embodiments, the audio module 170 may alternatively transmit an audio signal to the wireless communication module 160 through the PCM interface, to implement a function of answering a call by using a Bluetooth headset. Both the I2S interface and the PCM interface may be used for audio communication.
The UART interface is a universal serial data bus, and is used for asynchronous communication. The bus may be a two-way communication bus. The bus converts to-be-transmitted data between serial communication and parallel communication. In some embodiments, the UART interface is usually used to connect the processor 110 to the wireless communication module 160. For example, the processor 110 communicates with a Bluetooth module in the wireless communication module 160 through the UART interface, to implement a Bluetooth function. In some embodiments, the audio module 170 may transmit an audio signal to the wireless communication module 160 through the UART interface, to implement a function of playing music by using a Bluetooth headset.
The MIPI interface may be configured to connect the processor 110 to a peripheral component such as the display 194 or the camera 193. The MIPI interface includes a camera serial interface (Camera Serial Interface, CSI), a display serial interface (Display Serial Interface, DSI), and the like. In some embodiments, the processor 110 communicates with the camera 193 through the CSI, to implement a photographing function of the terminal device 100. The processor 110 communicates with the display 194 through the DSI, to implement a display function of the terminal device 100.
The GPIO interface may be configured by using software. The GPIO interface may be configured as a control signal, or may be configured as a data signal. In some embodiments, the GPIO interface may be configured to connect the processor 110 to the camera 193, the display 194, the wireless communication module 160, the audio module 170, the sensor module 180, or the like. The GPIO interface may be further configured as the I2C interface, the I2S interface, the UART interface, the MIPI interface, or the like.
The USB interface 130 is an interface that conforms to a USB standard specification, and may be specifically a mini USB interface, a micro USB interface, a USB Type C interface, or the like. The USB interface 130 may be configured to connect to a charger to charge the terminal device 100, or may be configured to transmit data between the terminal device 100 and a peripheral device, or may be configured to connect to a headset, to play audio by using the headset. The interface may be further configured to connect to another terminal device, such as an AR device.
It can be understood that an interface connection relationship between modules shown in this embodiment of this application is merely a schematic description, and does not constitute a structure limitation on the terminal device 100. In some other embodiments of this application, the terminal device 100 may alternatively use an interface connection manner different from that in the foregoing embodiment, or use a combination of a plurality of interface connection manners.
The charging management module 140 is configured to receive charging input from the charger. The charger may be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive a charging input from a wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive a wireless charging input through a wireless charging coil of the terminal device 100. The charging management module 140 may further supply power to the terminal device by using the power management module 141 while charging the battery 142.
The power management module 141 is configured to connect to the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives an input of the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, an external memory, the display 194, the camera 193, the wireless communication module 160, and the like. The power management module 141 may be configured to monitor parameters such as a battery capacity, a battery cycle count, and a battery state of health (electric leakage and impedance). In some other embodiments, the power management module 141 may alternatively be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 may also be disposed in a same component.
A wireless communication function of the terminal device 100 may be implemented by using the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
The antenna 1 and the antenna 2 are configured to transmit and receive an electromagnetic wave signal. Each antenna in the terminal device 100 may be configured to cover one or more communication bands. Different antennas may be further multiplexed, to improve antenna utilization. For example, the antenna 1 may be multiplexed as a diversity antenna in a wireless local area network. In some other embodiments, an antenna may be used in combination with a tuning switch.
The mobile communication module 150 may provide a wireless communication solution, including 2G/3G/4G/5G, which is applied to the terminal device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (Low Noise Amplifier, LNA), and the like. The mobile communication module 150 may receive an electromagnetic wave through the antenna 1, perform processing such as filtering or amplification on the received electromagnetic wave, and transmit the electromagnetic wave to the modem processor for demodulation. The mobile communication module 150 may further amplify a signal modulated by the modem processor, and convert the signal into an electromagnetic wave for radiation through the antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 may be disposed in a same device as at least some modules of the processor 110.
The modem processor may include a modulator and a demodulator. The modulator is configured to modulate a to-be-sent low-frequency baseband signal into a medium-high frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. Then, the demodulator transmits the low-frequency baseband signal obtained through demodulation to the baseband processor for processing. The baseband processor processes the low-frequency baseband signal, and then transfers an obtained signal to the application processor. The application processor outputs a sound signal by using an audio device (which is not limited to the speaker 170A, the receiver 170B, and the like), or displays an image or a video on the display 194. In some embodiments, the modem processor may be an independent component. In some other embodiments, the modem processor may be independent of the processor 110, and is disposed in the same device as the mobile communication module 150 or another functional module.
The wireless communication module 160 may provide a wireless communication solution that is applied to the terminal device 100, and that includes a wireless local area network (Wireless Local Area Networks, WLAN) (for example, a wireless fidelity (Wireless Fidelity, Wi-Fi) network), Bluetooth (Bluetooth, BT), a global navigation satellite system (Global Navigation Satellite System, GNSS), frequency modulation (Frequency Modulation, FM), a near field communication (Near Field Communication, NFC) technology, an infrared (Infrared, IR) technology, or the like. The wireless communication module 160 may be one or more components integrating at least one communication processor module. The wireless communication module 160 receives an electromagnetic wave through the antenna 2, performs frequency modulation and filtering processing on an electromagnetic wave signal, and sends a processed signal to the processor 110. The wireless communication module 160 may further receive a to-be-sent signal from the processor 110, perform frequency modulation and amplification on the signal, and convert the signal into an electromagnetic wave for radiation through the antenna 2.
In some embodiments, the antenna 1 and the mobile communication module 150 in the terminal device 100 are coupled, and the antenna 2 and the wireless communication module 160 in the terminal device 100 are coupled, so that the terminal device 100 can communicate with a network and another device by using a wireless communication technology. The wireless communication technology may include a global system for mobile communications (Global System for Mobile Communications, GSM), a general packet radio service (General Packet Radio Service, GPRS), code division multiple access (Code Division Multiple Access, CDMA), wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA), time division-synchronous code division multiple access (Time Division-Synchronous Code Division Multiple Access, TD-SCDMA), long term evolution (Long Term Evolution, LTE), BT, a GNSS, a WLAN, NFC, FM, an IR technology, and/or the like. The GNSS may include a global positioning system (Global Positioning System, GPS), a global navigation satellite system (Global Navigation Satellite System, GNSS), a BeiDou navigation satellite system (BeiDou Navigation Satellite System, BDS), a quasi-zenith satellite system (Quasi-Zenith Satellite System, QZSS), and/or satellite based augmentation systems (Satellite Based Augmentation Systems, SBAS).
The terminal device 100 may implement a display function through the GPU, the display 194, the application processor, and the like. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. The GPU is configured to: perform mathematical and geometric calculation, and render an image. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
The display 194 is configured to display an image, a video, or the like. The display 194 includes a display panel. The display panel may be a liquid crystal display (Liquid Crystal Display, LCD), an organic light-emitting diode (Organic Light-Emitting Diode, OLED), an active-matrix organic light emitting diode (Active-Matrix Organic Light Emitting Diode, AMOLED), a flexible light-emitting diode (Flex Light-Emitting Diode, FLED), a mini-LED, a micro-LED, a micro-OLED, a quantum dot light emitting diode (Quantum Dot Light Emitting Diode, QLED), or the like. In some embodiments, the terminal device 100 may include one or N displays 194, where N is a positive integer greater than 1.
The terminal device 100 can implement a photographing function by using the ISP, the camera 193, the video codec, the GPU, the display 194, the application processor, and the like.
The ISP is configured to process data fed back by the camera 193. For example, during photographing, a shutter is pressed, and light is transmitted to a photosensitive element of the camera through a lens. An optical signal is converted into an electrical signal, and the photosensitive element of the camera transmits the electrical signal to the ISP for processing, to convert the electrical signal into a visible image. The ISP may further perform algorithm optimization on noise, brightness, and complexion of the image. The ISP may further optimize parameters such as exposure and a color temperature of a photographing scenario. In some embodiments, the ISP may be disposed in the camera 193.
The camera 193 is configured to capture a static image or a video. An optical image of an object is generated through the lens, and is projected onto the photosensitive element. The photosensitive element may be a charge coupled device (Charge Coupled Device, CCD) or a complementary metal-oxide-semiconductor (Complementary Metal-Oxide-Semiconductor, CMOS) phototransistor. The photosensitive element converts an optical signal into an electrical signal, and then transmits the electrical signal to the ISP for converting the electrical signal into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format, for example, RGB or YUV. In some embodiments, the terminal device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
The digital signal processor is configured to process a digital signal, and may process another digital signal in addition to the digital image signal. For example, when the terminal device 100 selects a frequency, the digital signal processor is configured to perform Fourier transform on frequency energy.
The video codec is configured to: compress or decompress a digital video. The terminal device 100 may support one or more video codecs. Therefore, the terminal device 100 may play or record videos in a plurality of coding formats, for example, moving picture experts group (Moving Picture Experts Group, MPEG)-1, MPEG-2, MPEG-3, and MPEG-4.
The NPU is a neural-network (Neural-Network, NN) computing processor. The NPU quickly processes input information with reference to a structure of a biological neural network, for example, a transfer mode between human brain neurons, and may further continuously perform self-learning. Applications such as intelligent cognition of the terminal device 100, for example, image recognition, facial recognition, speech recognition, and text understanding, may be implemented through the NPU.
The external memory interface 120 may be used to connect to an external storage card, for example, a micro SD card, to extend a storage capability of the terminal device 100. The external storage card communicates with the processor 110 through the external memory interface 120, to implement a data storage function. For example, files such as music and a video are stored in the external storage card.
The internal memory 121 may be configured to store computer-executable program code. The executable program code includes instructions. The processor 110 implements various function applications and data processing of the terminal device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. The program storage area may store an operating system, an application required by at least one function (for example, a sound playing function or an image playing function), and the like. The data storage area may store data (such as audio data and an address book) and the like that are created during use of the terminal device 100. In addition, the internal memory 121 may include a high-speed random access memory, and may further include a nonvolatile memory, for example, at least one magnetic disk storage device, a flash memory device, or a universal flash storage (Universal Flash Storage, UFS).
The terminal device 100 may implement an audio function, for example, music playing and recording, through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headset jack 170D, the application processor, and the like.
The audio module 170 is configured to convert digital audio information into an analog audio signal output, and is also configured to convert an analog audio input into a digital audio signal. The audio module 170 may be further configured to: code and decode an audio signal. In some embodiments, the audio module 170 may be disposed in the processor 110, or some functional modules of the audio module 170 are disposed in the processor 110.
The speaker 170A, also referred to as a “loudspeaker”, is configured to convert an audio electrical signal into a sound signal. The terminal device 100 may be used to listen to music or answer a hands-free call by using the speaker 170A.
The receiver 170B, also referred to as an “earpiece”, is configured to convert an electrical audio signal into a sound signal. When a call is answered or audio information is listened to by using the terminal device 100, the receiver 170B may be put close to a human ear to listen to a voice.
The microphone 170C, also referred to as a “mike” or a “mic”, is configured to convert a sound signal into an electrical signal. When making a call or sending speech information, a user may place the mouth of the user near the microphone 170C to make a sound, to input a sound signal to the microphone 170C. The terminal device 100 may be disposed with at least one microphone 170C. In some other embodiments, two microphones 170C may be disposed in the terminal device 100, to collect a sound signal and further implement a noise reduction function. In some other embodiments, three, four, or more microphones 170C may alternatively be disposed in the terminal device 100, to collect a sound signal, implement noise reduction, identify a sound source, implement a directional recording function, and the like.
The headset jack 170D is configured to connect to a wired headset. The headset jack 170D may be the USB interface 130 or a 3.5 mm open mobile terminal platform (Open Mobile Terminal Platform, OMTP) standard interface or a cellular telecommunications industry association of the USA (Cellular Telecommunications Industry Association of the USA, CTIA) standard interface.
The pressure sensor 180A is configured to sense a pressure signal, and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor 180A may be disposed on the display 194. There are a plurality of types of pressure sensors 180A, such as a resistive pressure sensor, an inductive pressure sensor, and a capacitive pressure sensor. The capacitive pressure sensor may include at least two parallel plates made of conductive materials. When a force is applied to the pressure sensor 180A, capacitance between electrodes changes. The terminal device 100 determines strength of the pressure based on a change of the capacitance. When a touch operation is performed on the display 194, the terminal device 100 detects intensity of the touch operation through the pressure sensor 180A. The terminal device 100 may also calculate a touch location based on a detection signal of the pressure sensor 180A. In some embodiments, touch operations that are performed at a same touch location but have different touch operation intensity may correspond to different operation instructions. For example, when a touch operation whose touch operation intensity is less than a first pressure threshold is performed on a Messages icon, an instruction for viewing an SMS message is executed. When a touch operation whose touch operation intensity is greater than or equal to the first pressure threshold is performed on the Messages icon, an instruction for creating a new SMS message is executed.
The gyro sensor 180B may be configured to determine a motion gesture of the terminal device 100. In some embodiments, an angular velocity of the terminal device 100 around three axes (that is, axes x, y, and z) may be determined by using the gyro sensor 180B. The gyro sensor 180B may be configured to implement image stabilization during photographing. For example, when the shutter is pressed, the gyro sensor 180B detects an angle at which the terminal device 100 jitters, calculates, based on the angle, a distance for which a lens module needs to compensate, and allows the lens to cancel the jitter of the terminal device 100 through reverse motion, to implement image stabilization. The gyro sensor 180B may be further used in a navigation scenario and a motion-sensing game scenario.
The barometric pressure sensor 180C is configured to measure barometric pressure. In some embodiments, the terminal device 100 calculates an altitude based on a value of the barometric pressure measured by the barometric pressure sensor 180C, to assist in positioning and navigation.
The magnetic sensor 180D includes a Hall sensor. The terminal device 100 may detect, by using the magnetic sensor 180D, opening and closing of a flip leather cover. In some embodiments, when the terminal device 100 is a flip phone, the terminal device 100 may detect opening and closing of the flip cover based on the magnetic sensor 180D. Further, a feature such as automatic unlocking upon opening of the flip cover is set based on a detected opening or closing state of the flip cover.
The acceleration sensor 180E may detect accelerations in various directions (usually on three axes) of the terminal device 100. When the terminal device 100 is still, a magnitude and a direction of gravity can be detected. The acceleration sensor 180E may be further configured to identify a posture of the terminal device, and is used in an application such as switching between landscape mode and portrait mode or a pedometer.
The distance sensor 180F is configured to measure a distance. The terminal device 100 may measure a distance by using an infrared ray or laser. In some embodiments, in a photographing scenario, the terminal device 100 may measure a distance by using the distance sensor 180F, to implement quick focusing.
The optical proximity sensor 180G may include, for example, a light-emitting diode (LED) and an optical detector, for example, a photodiode. The light-emitting diode may be an infrared light-emitting diode. The terminal device 100 emits infrared light outward by using the light-emitting diode. The terminal device 100 detects infrared reflected light from a nearby object by using the photodiode. When sufficient reflected light is detected, the terminal device 100 may determine that there is an object near the terminal device 100. When insufficient reflected light is detected, the terminal device 100 may determine that there is no object near the terminal device 100. The terminal device 100 may detect, by using the optical proximity sensor 180G, that a user holds the terminal device 100 in proximity to an ear to perform a call, so as to automatically turn off a screen to save electricity. The optical proximity sensor 180G may also be used in a leather case mode or a pocket mode to automatically unlock or lock the screen.
The ambient light sensor 180L is configured to sense ambient light brightness. The terminal device 100 may adaptively adjust brightness of the display 194 based on the sensed ambient light brightness. The ambient light sensor 180L may also be configured to automatically adjust a white balance during photographing. The ambient light sensor 180L may also cooperate with the optical proximity sensor 180G to detect whether the terminal device 100 is in a pocket, to avoid an accidental touch.
The fingerprint sensor 180H is configured to collect a fingerprint. The terminal device 100 may use a feature of the collected fingerprint to implement fingerprint-based unlocking, application lock access, fingerprint-based photographing, fingerprint-based call answering, and the like.
The temperature sensor 180J is configured to detect a temperature. In some embodiments, the terminal device 100 executes a temperature processing policy based on the temperature detected by the temperature sensor 180J. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the terminal device 100 degrades performance of a processor near the temperature sensor 180J, to reduce power consumption for thermal protection. In some other embodiments, when the temperature is lower than another threshold, the terminal device 100 heats the battery 142, so as to avoid abnormal shutdown of the terminal device 100 due to a low temperature. In some other embodiments, when the temperature is less than still another threshold, the terminal device 100 boosts an output voltage of the battery 142 to avoid abnormal shutdown due to a low temperature.
The touch sensor 180K is also referred to as a “touch panel”. The touch sensor 180K may be disposed on the display 194, and the touch sensor 180K and the display 194 form a touchscreen. The touch sensor 180K is configured to detect a touch operation performed on or near the touch sensor. The touch sensor may transfer the detected touch operation to the application processor to determine a type of a touch event. A visual output related to the touch operation may be provided through the display 194. In some other embodiments, the touch sensor 180K may alternatively be disposed on a surface of the terminal device 100 at a location different from a location of the display 194.
The bone conduction sensor 180M may obtain a vibration signal. In some embodiments, the bone conduction sensor 180M may obtain a vibration signal of a vibration bone of a human vocal-cord part. The bone conduction sensor 180M may also be in contact with a human pulse, and receive a blood pressure beating signal. In some embodiments, the bone conduction sensor 180M may alternatively be disposed in the headset, to constitute a bone conduction headset. The audio module 170 may obtain a voice signal through parsing based on the vibration signal that is of the vibration bone of the vocal-cord part and that is obtained by the bone conduction sensor 180M, to implement a voice function. The application processor may parse heart rate information based on the blood pressure beating signal obtained by the bone conduction sensor 180M, to implement a heart rate detection function.
The button 190 includes a power button, a volume button, and the like. The button 190 may be a mechanical button, or may be a touch button. The terminal device 100 may receive button input to generate button signal input related to user setting and function control of the terminal device 100.
The motor 191 may generate a vibration prompt. The motor 191 may be configured to produce an incoming call vibration prompt and a touch vibration feedback. For example, touch operations performed on different applications (for example, photographing and audio playing) may correspond to different vibration feedback effects. For touch operations performed on different areas of the display 194, the motor 191 may also correspond to different vibration feedback effects. Different application scenarios (for example, time reminding, information receiving, an alarm clock, and a game) may also correspond to different vibration feedback effects. A touch vibration feedback effect may be further customized.
The indicator 192 may be an indicator light, and may be configured to indicate a charging status and a power change, or may be configured to indicate a message, a missed call, a notification, and the like.
The SIM card interface 195 is configured to connect to a SIM card. The SIM card may be inserted into the SIM card interface 195 or removed from the SIM card interface 195, to implement contact with or separation from the terminal device 100. The terminal device 100 may support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 may support a nano-SIM card, a micro-SIM card, a SIM card, and the like. A plurality of cards may be simultaneously inserted into a same SIM card interface 195. The plurality of cards may be of a same type or of different types. The SIM card interface 195 is compatible with different types of SIM cards. The SIM card interface 195 is also compatible with an external storage card. The terminal device 100 interacts with a network through the SIM card, to implement functions such as calling and data communication. In some embodiments, the terminal device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card may be embedded in the terminal device 100, and cannot be separated from the terminal device 100.
The terminal device provided in this embodiment may perform the foregoing method embodiments, and an implementation principle and a technical effect thereof are similar. Details are not described herein again.
An embodiment of this application further provides a computer-readable storage medium. The computer-readable storage medium stores computer instructions. When the computer instructions run on an electronic device, a terminal device performs the foregoing related method steps to implement the method in the foregoing embodiment.
An embodiment of this application further provides a computer program product. When the computer program product runs on a computer, the computer performs the foregoing related steps, so as to implement the method in the foregoing embodiment.
It should also be understood that the term “and/or” used in this application refers to any combination of one or more of associated listed items and all possible combinations, and includes these combinations. The terms “first”, “second”, “third”, and the like are used only to distinguish between descriptions, and should not be understood to indicate or imply relative importance.
Finally, it should be noted that the foregoing embodiments are merely intended for describing the technical solutions of this application other than limiting this application. Although this application is described in detail with reference to the foregoing embodiments, persons of ordinary skill in the art should understand that they may still make modifications to the technical solutions described in the foregoing embodiments or make equivalent replacements to some or all technical features thereof, without departing from the scope of the technical solutions of embodiments of this application.
Number | Date | Country | Kind |
---|---|---|---|
202010888823.8 | Aug 2020 | CN | national |
This application is a national stage of International Application No. PCT/CN2021/111306 filed on Aug. 6, 2021, which claims priority to Chinese Patent Application No. 202010888823.8 filed on Aug. 28, 2020. Both of the aforementioned applications are hereby incorporated by reference in their entireties.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/CN2021/111306 | 8/6/2021 | WO |