Communication method and device, storage medium and computer program product
By determining the method for initiating a connection request based on device parameters, the problem of time slot preemption in short-range wireless communication is solved, improving the success rate of communication connections and reducing device power consumption.
Patent Information
- Application Number
- CN202411216758.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-30
- Publication Date
- 2026-03-10
AI Technical Summary
In short-range wireless communication scenarios, when the local device and the remote device initiate communication connection requests simultaneously, time slot contention occurs, reducing the success rate of communication connections.
Based on the device parameters of the peer device and the local device, such as identification number, performance parameters or priority, determine which device should initiate the connection request to avoid simultaneous connection requests.
It improves the success rate of communication connections, avoids the establishment of redundant connections, and reduces device power consumption and resource waste.
Smart Images

Figure CN121645562A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of communication, and particularly relates to a communication method, device, storage medium and computer program product. BACKGROUND
[0002] At present, in a wireless short-distance communication scenario, a local device and a peer device establish a communication connection, and then data transmission between the local device and the peer device is implemented based on the communication connection.
[0003] In the related art, when the local device and the peer device establish a communication connection, the local device initiates a communication connection with the peer device, and the peer device also initiates a communication connection with the local device, which causes the communication connections initiated by the two devices to occupy the same time slot, and thus the success rate of the communication connection between the local device and the peer device is reduced. SUMMARY
[0004] To overcome the problems in the related art, the present disclosure provides a communication method, device, storage medium and computer program product.
[0005] According to a first aspect of an embodiment of the present disclosure, a communication method is provided, comprising:
[0006] obtaining first information output by a peer device; the first information includes a first device parameter identifying the peer device;
[0007] determining, according to the first device parameter and a second device parameter of a local device, a connection request initiated by the local device or the peer device to establish a communication between the local device and the peer device; the second device parameter is used to identify the local device.
[0008] Optionally, the determining, according to the first device parameter and the second device parameter of the local device, the connection request initiated by the local device or the peer device comprises:
[0009] determining, according to a size relationship between the first device parameter and the second device parameter, the connection request initiated by the local device or the peer device.
[0010] Optionally, the determining, according to the first device parameter and the second device parameter of the local device, the connection request initiated by the local device or the peer device comprises:
[0011] in a case where the second device parameter is less than the first device parameter, initiating the connection request.
[0012] Optionally, the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device, comprises:
[0013] In a case where the second device parameter is greater than the first device parameter, receiving the connection request initiated by the peer device.
[0014] Optionally, the second device parameter comprises a second identification number of the local device, and the first device parameter comprises a first identification number of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device, comprises:
[0015] determining, according to the second identification number and the first identification number, whether the connection request is initiated by the local device or the peer device.
[0016] Optionally, the second device parameter comprises a second performance parameter of the local device, and the first device parameter comprises a first performance parameter of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device, comprises:
[0017] determining, according to the second performance parameter and the first performance parameter, whether the connection request is initiated by the local device or the peer device.
[0018] Optionally, the second device parameter comprises a second priority of the local device, and the first device parameter comprises a first priority of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device, comprises:
[0019] determining, according to the second priority and the first priority, whether the connection request is initiated by the local device or the peer device.
[0020] Optionally, the obtaining the first information output by the peer device comprises:
[0021] scanning the first information broadcast by the peer device.
[0022] Optionally, the method further comprises:
[0023] broadcasting second information; the second information comprises the second device parameter.
[0024] According to a second aspect of the embodiments of the present disclosure, a communication apparatus is provided, comprising:
[0025] The acquisition module is configured to acquire first information output by a peer device; the first information carries a first device parameter identifying the peer device;
[0026] The connection module is configured to determine whether to initiate a connection with the peer device according to a size relationship between the first device parameter and a second device parameter; the second device parameter is used to identify the local device.
[0027] According to a third aspect of the embodiments of the present disclosure, a communication apparatus is provided, comprising:
[0028] a processor;
[0029] a memory for storing processor-executable instructions;
[0030] The processor is configured to:
[0031] perform the steps of the communication method provided by the first aspect of the present disclosure.
[0032] According to a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores a computer program. The computer program is executed by a processor to implement the steps of the communication method provided by the first aspect of the present disclosure.
[0033] According to a fifth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, which stores computer program instructions. The computer program instructions are executed by a processor to implement the steps of the communication method provided by the first aspect of the present disclosure.
[0034] The technical solutions provided by the embodiments of the present disclosure can include the following beneficial effects:
[0035] After the local device acquires the first information output by the peer device, the first device parameter of the peer device in the first information and the second device parameter of the local device can be used to determine whether to initiate a connection request by the local device or the peer device, thereby avoiding the time slot occupation problem caused by the local device and the peer device simultaneously initiating a connection request, and increasing the success rate of the communication connection between the local device and the peer device.
[0036] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0037] The accompanying drawings, which are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure and, together with the specification, serve to explain the principles of the present disclosure.
[0038] Figure 1 is a flowchart of a communication method according to an exemplary embodiment.
[0039] Figure 2 is a scenario diagram illustrating a plurality of devices communicating according to an example embodiment.
[0040] Figure 3 is an example schematic diagram illustrating a local device and a peer device establishing a communication connection according to an example embodiment.
[0041] Figure 4 is a schematic diagram illustrating a local device and a peer device simultaneously initiating connection requests and preempting the same time slot according to an example embodiment.
[0042] Figure 5 is a block diagram of a communication apparatus according to an example embodiment.
[0043] Figure 6 is a block diagram of a communication apparatus according to an example embodiment. DETAILED DESCRIPTION
[0044] The example embodiments will be described in detail herein with reference to the accompanying drawings. In the following description, unless otherwise indicated, like numbers in the different drawings represent the same or similar elements. The following example embodiments described in the detailed description section are not meant to be an all-inclusive description of devices and methods consistent with the disclosure. Rather, they are merely example of apparatus and methods consistent with some aspects of the disclosure as detailed in the appended claims.
[0045] The following example embodiments described in the detailed description section are not meant to be an all-inclusive description of devices and methods consistent with the disclosure. Rather, they are merely example of apparatus and methods consistent with some aspects of the disclosure as detailed in the appended claims.
[0046] It should be noted that all the actions of acquiring signals, information or data in the disclosure are carried out in compliance with the corresponding data protection regulations and policies of the country where the device is located, and with the authorization given by the corresponding device owner.
[0047] Figure 1 is a flowchart of a communication method according to an example embodiment, as shown in Figure 1 The communication method is applied in a local device and includes the following steps.
[0048] In step S11, the first information output by the peer device is acquired.
[0049] The first information includes a first device parameter identifying the peer device, and the first device parameter is used to uniquely identify a peer device. For example, the first device parameter can be an identification number, a performance parameter, a priority and a device name of the peer device.
[0050] Optionally, the local device can scan the first information broadcasted by the opposite device, and the first information includes the first device parameter.
[0051] It can be understood that in the wireless short-distance communication scenario, Bluetooth Low Energy (BLE) technology is a commonly used communication technology, which can realize the communication connection between various devices such as mobile phones, tablets (pads), notebook computers, car systems, wireless earphones, sound boxes, air conditioners, watches, etc. Figure 2
[0052] In the wireless short-distance communication scenario, the local device can be any one of various Bluetooth devices such as mobile phones, tablets, notebook computers, car systems, wireless earphones, sound boxes, air conditioners, watches, etc., and the opposite device can also be any one of various Bluetooth devices such as mobile phones, tablets, notebook computers, car systems, wireless earphones, sound boxes, air conditioners, watches, etc.
[0053] When the local device and the opposite device establish a Bluetooth connection, the local device and the opposite device can simultaneously act as a device (Peripheral) that sends broadcast data. If the local device broadcasts second information, the second information includes the second device parameter of the local device, a service identifier, etc., so that the remaining devices scan the second information, which is the broadcast data broadcasted by the local device. If the opposite device broadcasts first information, the first information includes the first device parameter of the opposite device, a service identifier, etc., so that the remaining devices scan the first information, which is the broadcast data broadcasted by the opposite device.
[0054] The local device and the opposite device can also simultaneously act as a device (Central) that scans broadcast data. If the local device scans the first information broadcasted by the remaining opposite devices, the local device can initiate a connection request to the opposite device to establish a communication connection with the opposite device; the remaining opposite devices can also scan the second information broadcasted by the local device to establish a communication connection with the local device.
[0055] In step S12, according to the first device parameter and the second device parameter of the local device, it is determined that a connection request is initiated by the local device or the opposite device to establish communication between the local device and the opposite device.
[0056] Optionally, a ratio between the second device parameter of the local device and the first device parameter of the opposite device can be determined, and in the case that the ratio is less than 1, it is determined that the connection request is initiated by the local device; in the case that the ratio is greater than 1, it is determined that the connection request is initiated by the opposite device.
[0057] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second device parameter of the mobile phone and the first device parameter of the speaker can be determined. If the ratio is less than 1, the connection request is determined to be initiated by the mobile phone; if the ratio is greater than 1, the connection request is determined to be initiated by the speaker.
[0058] Optionally, the ratio between the second device parameter of the local device and the first device parameter of the peer device can be determined. If the ratio is less than 1, it is determined that the peer device will initiate the connection request; if the ratio is greater than 1, it is determined that the local device will initiate the connection request.
[0059] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second device parameter of the mobile phone and the first device parameter of the speaker can be determined. If the ratio is less than 1, the connection request is determined to be initiated by the speaker; if the ratio is greater than 1, the connection request is determined to be initiated by the mobile phone.
[0060] Optionally, the relationship between the second device parameter of the local device and the first device parameter of the remote device can be determined. If the second device parameter of the local device is less than the first device parameter of the remote device, the local device is determined to initiate the connection request; if the second device parameter of the local device is greater than the first device parameter of the remote device, the remote device is determined to initiate the connection request.
[0061] For example, if the local device is a mobile phone and the remote device is a speaker, the relationship between the second device parameter of the mobile phone and the first device parameter of the speaker can be determined. If the second device parameter of the mobile phone is less than the first device parameter of the speaker, the connection request is initiated by the mobile phone; if the second device parameter of the mobile phone is greater than the first device parameter of the speaker, the connection request is initiated by the speaker.
[0062] Optionally, the relationship between the second device parameter of the local device and the first device parameter of the remote device can be determined. If the second device parameter of the local device is less than the first device parameter of the remote device, it is determined that the remote device will initiate the connection request; if the second device parameter of the local device is greater than the first device parameter of the remote device, it is determined that the local device will initiate the connection request.
[0063] For example, if the local device is a mobile phone and the remote device is a speaker, the relationship between the second device parameter of the mobile phone and the first device parameter of the speaker can be determined. If the second device parameter of the mobile phone is less than the first device parameter of the speaker, the connection request is initiated by the speaker; if the second device parameter of the mobile phone is greater than the first device parameter of the speaker, the connection request is initiated by the mobile phone.
[0064] It is understandable that when initiating a connection request, if the local device initiates a connection request, it initiates a connection request for a communication connection between itself and the peer device indicated by the first device parameter, and sends the connection request to the peer device indicated by the first device parameter; if the peer device initiates a connection request, it initiates a connection request for a communication connection between itself and the local device indicated by the second device parameter.
[0065] In some scenarios, please refer to Figure 3 As shown, taking device A as the local device and device B as the remote device as an example, the following steps are performed:
[0066] 1. Device A generates a unique first device parameter: A_ID; Device B generates a unique second device parameter: B_ID; ID is an identity identifier.
[0067] 2. Enable Bluetooth on both Device A and Device B.
[0068] 3. Device A broadcasts a second message, which includes A_ID; Device B broadcasts a first message, which includes B_ID.
[0069] 4. Device A and Device B start scanning.
[0070] 5. Device A receives the first information from Device B, which includes B_ID; Device B receives the second information from Device A, which includes A_ID.
[0071] 6. Device A compares the size of A_ID with B_ID, and device B compares the size of A_ID with B_ID.
[0072] 7. Since A_ID is less than B_ID, device A initiates a connection request to device B; device B does not initiate a connection request to device A.
[0073] Since both the local and remote devices can simultaneously transmit broadcast data and scan for broadcast data, when both devices enable Bluetooth to transmit broadcast data and start scanning, they will scan for each other's broadcast data at the same time and initiate connection requests simultaneously. This results in two connection requests competing for the same time slot, reducing the connection success rate.
[0074] Please see Figure 4As shown, time slots 1 through N are sequentially arranged. The local device sends connection request A to the peer device in time slot 1, and the peer device sends connection request B to the local device in time slot 2. After receiving connection request A from the local device, the peer device sends connection response A to the local device in time slot 2. This results in the peer device needing to send both connection request B and connection response A to the local device in time slot 2. At this time, connection request B and connection response A sent by the peer device will compete for the same time slot 2. Assuming that connection request B successfully competes for time slot 2, but connection response A fails to compete for time slot 2, then connection request A initiated by the local device fails, causing the local device to be unable to establish a communication connection with the peer device.
[0075] Furthermore, after the peer device successfully preempts time slot 2 with connection request B, the local device will send connection response B to itself in time slot 3. The local device will be unable to establish a communication connection with the peer device. That is, after the peer device fails to send connection response A to the local device, the peer device will send connection failure information to itself in time slot 3 to indicate that connection request A failed. At this time, the connection failure information sent by the peer device and the connection response B sent by the local device will preempt the same time slot 3. Assuming that connection response B fails to preempt time slot 3, but the connection failure information successfully preempts time slot 3, then the connection request B initiated by the peer device will also fail, causing the peer device to be unable to establish a communication connection with the local device.
[0076] It is evident that when both the local and remote devices can initiate connection requests simultaneously, it may result in the inability to establish a communication connection between them, thus reducing the success rate of the communication connection between the local and remote devices.
[0077] In this embodiment of the disclosure, after the local device obtains the first information output by the peer device, it can determine whether the connection request should be initiated by the local device or the peer device based on the first device parameters of the peer device and the second device parameters of the local device in the first information.
[0078] In this process, if it is determined that the connection request is initiated by the local device, then the remote device will not initiate a connection request. In this way, the connection response from the remote device to the connection request initiated by the local device will occupy the same time slot exclusively, and will not be preempted by the connection request initiated by the remote device. This allows the connection request initiated by the local device to establish a communication connection with the remote device to succeed, and the local device can successfully establish a communication connection with the remote device, thereby improving the success rate of communication connection.
[0079] Similarly, if it is determined that the connection request is initiated by the peer device, then the local device will not initiate a connection request. In this way, the connection response from the local device to the connection request initiated by the peer device will occupy the same time slot exclusively, and will not be preempted by the connection request initiated by the local device. This allows the connection request initiated by the peer device to establish a communication connection with the local device to succeed, and the peer device to successfully establish a communication connection with the local device, thereby improving the success rate of communication connection.
[0080] Furthermore, if a communication connection is successfully established between the local device and the peer device, and a communication connection is successfully established between the peer device and the local device, two communication connections will be established between the local device and the peer device. On the one hand, data transmission between the local device and the peer device can be completed using a single communication connection link, and establishing an additional communication connection will result in redundancy. On the other hand, establishing an additional communication connection will lead to a waste of resources and increase the power consumption of the local device and the peer device.
[0081] In this embodiment of the disclosure, after determining that a connection request is initiated by the local device or the peer device, a single communication connection exists between the local device and the peer device. This single communication connection is initiated by the local device or the peer device, so no additional redundant communication connection is established, thereby reducing the power consumption of the local device and the peer device and reducing the waste of resources.
[0082] The following describes an exemplary embodiment involved in step S12 above. This exemplary embodiment is used to interpret an exemplary scheme in a scenario where the first device parameter includes a first identifier of the peer device and the second device parameter includes a second identifier of the local device, which includes:
[0083] Based on the second identifier and the first identifier, it is determined whether the connection request was initiated by the local device or the peer device.
[0084] The second identifier is used to uniquely identify a local device, and the first identifier is used to uniquely identify a local device. For example, the identifiers of various devices such as mobile phones, PDAs, laptops, in-vehicle systems, wireless headphones, speakers, air conditioners, and watches are all different. Thus, each device has its own identifier, and both the local device and the peer device can be any of these devices.
[0085] Optionally, the ratio between the second identifier of the local device and the first identifier of the peer device can be determined. If the ratio is less than 1, it is determined that the local device initiates the connection request; if the ratio is greater than 1, it is determined that the peer device initiates the connection request.
[0086] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second identifier of the mobile phone and the first identifier of the speaker can be determined. If the ratio is less than 1, the connection request is initiated by the mobile phone; if the ratio is greater than 1, the connection request is initiated by the speaker.
[0087] Optionally, the ratio between the second identifier of the local device and the first identifier of the peer device can be determined. If the ratio is less than 1, it is determined that the peer device will initiate the connection request; if the ratio is greater than 1, it is determined that the local device will initiate the connection request.
[0088] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second identifier of the mobile phone and the first identifier of the speaker can be determined. If the ratio is less than 1, the connection request is initiated by the speaker; if the ratio is greater than 1, the connection request is initiated by the mobile phone.
[0089] Optionally, the size relationship between the second identifier of the local device and the first identifier of the peer device can be determined. If the second identifier of the local device is less than the first identifier of the peer device, it is determined that the local device will initiate the connection request; if the second identifier of the local device is greater than the first identifier of the peer device, it is determined that the peer device will initiate the connection request.
[0090] For example, if the local device is a mobile phone and the remote device is a speaker, the size relationship between the second identifier of the mobile phone and the first identifier of the speaker can be determined. If the second identifier of the mobile phone is less than the first identifier of the speaker, the connection request is initiated by the mobile phone; if the second identifier of the mobile phone is greater than the first identifier of the speaker, the connection request is initiated by the speaker.
[0091] Optionally, the size relationship between the second identifier of the local device and the first identifier of the peer device can be determined. If the second identifier of the local device is less than the first identifier of the peer device, it is determined that the peer device will initiate the connection request; if the second identifier of the local device is greater than the first identifier of the peer device, it is determined that the local device will initiate the connection request.
[0092] For example, if the local device is a mobile phone and the remote device is a speaker, the size relationship between the second identifier of the mobile phone and the first identifier of the speaker can be determined. If the second identifier of the mobile phone is less than the first identifier of the speaker, it is determined that the speaker will initiate the connection request; if the second identifier of the mobile phone is greater than the first identifier of the speaker, it is determined that the mobile phone will initiate the connection request.
[0093] The above technical solution can determine whether the connection request is initiated by the local device or the remote device based on the relationship between the second identifier of the local device and the first identifier of the remote device, thereby establishing a single communication connection between the local device and the remote device.
[0094] The following describes an exemplary embodiment involving step S12 above. This exemplary embodiment is used to interpret an exemplary solution in a scenario where the first device parameter includes a first performance parameter of the peer device, and the second device parameter includes a second performance parameter of the local device. It includes:
[0095] Based on the second performance parameter and the first performance parameter, it is determined whether the connection request is initiated by the local device or the peer device.
[0096] The second performance parameter can be used to identify the local device. For example, the second performance parameter can be the local device's processor size, memory capacity, graphics processor size, network connection speed, battery life, response time, etc.; the first performance parameter can be used to identify the peer device. For example, the first performance parameter can be the peer device's processor size, memory capacity, graphics processor size, network connection speed, battery life, response time, etc.
[0097] Optionally, the ratio between the second performance parameter of the local device and the first performance parameter of the peer device can be determined. If the ratio is less than 1, it is determined that the local device will initiate the connection request; if the ratio is greater than 1, it is determined that the peer device will initiate the connection request.
[0098] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second performance parameter of the mobile phone and the first performance parameter of the speaker can be determined. If the ratio is less than 1, the connection request is determined to be initiated by the mobile phone; if the ratio is greater than 1, the connection request is determined to be initiated by the speaker.
[0099] Optionally, the ratio between the second performance parameter of the local device and the first performance parameter of the peer device can be determined. If the ratio is less than 1, it is determined that the peer device will initiate the connection request; if the ratio is greater than 1, it is determined that the local device will initiate the connection request.
[0100] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second performance parameter of the mobile phone and the first performance parameter of the speaker can be determined. If the ratio is less than 1, the connection request is determined to be initiated by the speaker; if the ratio is greater than 1, the connection request is determined to be initiated by the mobile phone.
[0101] Optionally, the relationship between the second performance parameter of the local device and the first performance parameter of the remote device can be determined. If the second performance parameter of the local device is less than the first performance parameter of the remote device, it is determined that the local device will initiate the connection request; if the second performance parameter of the local device is greater than the first performance parameter of the remote device, it is determined that the remote device will initiate the connection request.
[0102] For example, if the local device is a mobile phone and the remote device is a speaker, the relationship between the second performance parameter of the mobile phone and the first performance parameter of the speaker can be determined. If the second performance parameter of the mobile phone is less than the first performance parameter of the speaker, the connection request is initiated by the mobile phone; if the second performance parameter of the mobile phone is greater than the first performance parameter of the speaker, the connection request is initiated by the speaker.
[0103] Optionally, the relationship between the second performance parameter of the local device and the first performance parameter of the peer device can be determined. If the second performance parameter of the local device is less than the first performance parameter of the peer device, it is determined that the peer device will initiate the connection request; if the second performance parameter of the local device is greater than the first performance parameter of the peer device, it is determined that the local device will initiate the connection request.
[0104] For example, if the local device is a mobile phone and the remote device is a speaker, the relationship between the second performance parameter of the mobile phone and the first performance parameter of the speaker can be determined. If the second performance parameter of the mobile phone is less than the first performance parameter of the speaker, the connection request is initiated by the speaker; if the second performance parameter of the mobile phone is greater than the first performance parameter of the speaker, the connection request is initiated by the mobile phone.
[0105] The above technical solution can determine whether the connection request is initiated by the local device or the remote device based on the relationship between the second performance parameter of the local device and the first performance parameter of the remote device, thereby establishing a single communication connection between the local device and the remote device.
[0106] The following describes an exemplary embodiment involved in step S12 above. This exemplary embodiment is used to interpret an exemplary scheme in a scenario where the first device parameter includes a first priority of the peer device and the second device parameter includes a second priority of the local device, which includes:
[0107] Based on the second priority and the first priority, it is determined whether the connection request is initiated by the local device or the peer device.
[0108] The second priority is used to uniquely identify a local device, and the first priority is used to uniquely identify a local device. For example, the priorities of various devices such as mobile phones, PDAs, laptops, in-vehicle systems, wireless headphones, speakers, air conditioners, and watches gradually decrease. In this way, each device has its own priority, and both the local device and the peer device can be any of these devices.
[0109] Optionally, the ratio between the second identifier of the local device and the first identifier of the peer device can be determined. If the ratio is less than 1, it is determined that the local device initiates the connection request; if the ratio is greater than 1, it is determined that the peer device initiates the connection request.
[0110] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second priority of the mobile phone and the first priority of the speaker can be determined. If the ratio is less than 1, the connection request is initiated by the mobile phone; if the ratio is greater than 1, the connection request is initiated by the speaker.
[0111] Optionally, the ratio between the second priority of the local device and the first priority of the peer device can be determined. If the ratio is less than 1, it is determined that the peer device will initiate the connection request; if the ratio is greater than 1, it is determined that the local device will initiate the connection request.
[0112] For example, if the local device is a mobile phone and the remote device is a speaker, the ratio between the second priority of the mobile phone and the first priority of the speaker can be determined. If the ratio is less than 1, the speaker will initiate the connection request; if the ratio is greater than 1, the mobile phone will initiate the connection request.
[0113] Optionally, the relative priority between the second priority of the local device and the first priority of the peer device can be determined. If the second priority of the local device is lower than the first priority of the peer device, the local device is determined to initiate the connection request; if the second priority of the local device is higher than the first priority of the peer device, the peer device is determined to initiate the connection request.
[0114] For example, if the local device is a mobile phone and the remote device is a speaker, the relative priority of the mobile phone and the speaker can be determined. If the second priority of the mobile phone is less than the first priority of the speaker, the connection request will be initiated by the mobile phone; if the second priority of the mobile phone is greater than the first priority of the speaker, the connection request will be initiated by the speaker.
[0115] Optionally, the relative priority between the second priority of the local device and the first priority of the peer device can be determined. If the second priority of the local device is lower than the first priority of the peer device, the peer device is determined to initiate the connection request; if the second priority of the local device is higher than the first priority of the peer device, the local device is determined to initiate the connection request.
[0116] For example, if the local device is a mobile phone and the remote device is a speaker, the relative priority of the mobile phone and the speaker can be determined. If the second priority of the mobile phone is less than the first priority of the speaker, the connection request will be initiated by the speaker; if the second priority of the mobile phone is greater than the first priority of the speaker, the connection request will be initiated by the mobile phone.
[0117] The above technical solution can determine whether the connection request should be initiated by the local device or the remote device based on the relationship between the second priority of the local device and the first priority of the remote device, thereby establishing a single communication connection between the local device and the remote device.
[0118] It is understandable that in the above scheme, the scheme executed by the local device can also be executed by the remote device. For example, the remote device obtains the second information output by the local device, which includes a second device parameter identifying the local device; based on the second device parameter of the local device and the first device parameter of the remote device, it determines whether the local device or the remote device should initiate the connection request.
[0119] Optionally, the peer device determines whether the connection request should be initiated by the local device or the peer device based on the relationship between the first device parameter and the second device parameter.
[0120] For example, if the second device parameter is less than the first device parameter, a connection request initiated by the peer device is received.
[0121] For example, if the second device parameter is greater than the first device parameter, a connection request is initiated.
[0122] Figure 5 This is a block diagram illustrating a communication device according to an exemplary embodiment. (Refer to...) Figure 5 The communication device 500 includes: an acquisition module 510 and a connection module 520.
[0123] The acquisition module 510 is configured to acquire first information output by the peer device; the first information carries first device parameters that identify the peer device.
[0124] The connection module 520 is configured to determine whether to initiate a connection with the peer device based on the relationship between the first device parameter and the second device parameter; the second device parameter is used to identify the local device.
[0125] Optionally, the connection module 520 is further configured to determine whether the connection request is initiated by the local device or the peer device based on the size relationship between the first device parameter and the second device parameter.
[0126] Optionally, the connection module 520 is further configured to initiate the connection request if the second device parameter is less than the first device parameter.
[0127] Optionally, the connection module 520 is further configured to receive the connection request initiated by the peer device when the second device parameter is greater than the first device parameter.
[0128] Optionally, the second device parameter includes a second identifier of the local device, and the first device parameter includes a first identifier of the remote device; the connection module 520 includes:
[0129] The first connection submodule is configured to determine, based on the second identifier and the first identifier, whether the connection request is initiated by the local device or the peer device.
[0130] Optionally, the second device parameters include the second performance parameters of the local device, and the first device parameters include the first performance parameters of the remote device; the connection module 520 includes:
[0131] The second connection submodule is configured to determine, based on the second performance parameter and the first performance parameter, whether the connection request is initiated by the local device or the peer device.
[0132] Optionally, the second device parameters include the second priority of the local device, and the first device parameters include the first priority of the remote device; the connection module 520 includes:
[0133] The third connection submodule is configured to determine, based on the second priority and the first priority, whether the connection request is initiated by the local device or the peer device.
[0134] Optionally, the acquisition module 510 is also configured to scan the first information broadcast by the peer device.
[0135] Optionally, the communication device 500 includes:
[0136] The broadcast module is configured to broadcast second information, which includes the second device parameters.
[0137] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.
[0138] This disclosure also provides a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, implement the steps of the communication method provided in this disclosure.
[0139] Figure 6 This is a block diagram illustrating a communication device 600 according to an exemplary embodiment. For example, device 600 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0140] Reference Figure 6 The device 600 may include one or more of the following components: a processing component 602, a memory 604, a power supply component 606, a multimedia component 608, an audio component 610, an input / output interface 612, a sensor component 614, and a communication component 616.
[0141] Processing component 602 typically controls the overall operation of device 600, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 602 may include one or more processors 620 to execute instructions to complete all or part of the steps of the aforementioned communication methods. Furthermore, processing component 602 may include one or more modules to facilitate interaction between processing component 602 and other components. For example, processing component 602 may include a multimedia module to facilitate interaction between multimedia component 608 and processing component 602.
[0142] Memory 604 is configured to store various types of data to support the operation of device 600. Examples of such data include instructions for any application or method operating on device 600, contact data, phonebook data, messages, pictures, videos, etc. Memory 604 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0143] Power supply component 606 provides power to the various components of device 600. Power supply component 606 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 600.
[0144] Multimedia component 608 includes a screen that provides an output interface between the device 600 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 608 includes a front-facing camera and / or a rear-facing camera. When the device 600 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0145] Audio component 610 is configured to output and / or input audio signals. For example, audio component 610 includes a microphone (MIC) configured to receive external audio signals when device 600 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 604 or transmitted via communication component 616. In some embodiments, audio component 610 also includes a speaker for outputting audio signals.
[0146] Input / output interface 612 provides an interface between processing component 602 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, start buttons, and lock buttons.
[0147] Sensor assembly 614 includes one or more sensors for providing status assessments of various aspects of device 600. For example, sensor assembly 614 may detect the on / off state of device 600, the relative positioning of components such as the display and keypad of device 600, changes in the position of device 600 or a component of device 600, the presence or absence of user contact with device 600, the orientation or acceleration / deceleration of device 600, and temperature changes of device 600. Sensor assembly 614 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 614 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 614 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0148] Communication component 616 is configured to facilitate wired or wireless communication between device 600 and other devices. Device 600 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 616 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 616 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0149] In an exemplary embodiment, device 600 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the communication method described above.
[0150] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 604 including instructions, which can be executed by a processor 620 of the device 600 to complete the aforementioned communication method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0151] In another exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program executable by a programmable device, the computer program having a code portion for performing the above-described communication method when executed by the programmable device.
[0152] Those skilled in the art will also understand that the various illustrative logical blocks and steps listed in the embodiments of this application can be implemented by electronic hardware, computer software, or a combination of both. Whether such functionality is implemented through hardware or software depends on the specific application and the overall system design requirements. Those skilled in the art can implement the described functionality using various methods for each specific application, but such implementation should not be construed as exceeding the scope of protection of the embodiments of this application.
[0153] It should be understood that this disclosure is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this disclosure is limited only by the appended claims.
Claims
1. A communication method characterized by comprising: The method comprises: obtaining first information output by a peer device; the first information comprises a first device parameter identifying the peer device; determining, according to the first device parameter and a second device parameter of a local device, whether a connection request is initiated by the local device or the peer device to establish communication between the local device and the peer device; the second device parameter is used to identify the local device.
2. The method of claim 1, wherein, The determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: determining, according to a size relationship between the first device parameter and the second device parameter, whether the connection request is initiated by the local device or the peer device.
3. The method of claim 1, wherein, The determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: in a case where the second device parameter is smaller than the first device parameter, initiating the connection request.
4. The method of claim 1, wherein, The determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: in a case where the second device parameter is greater than the first device parameter, receiving the connection request initiated by the peer device.
5. The method of claim 1, wherein, The second device parameter comprises a second identification number of the local device, and the first device parameter comprises a first identification number of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: determining, according to the second identification number and the first identification number, whether the connection request is initiated by the local device or the peer device.
6. The method of claim 1, wherein, The second device parameter comprises a second performance parameter of the local device, and the first device parameter comprises a first performance parameter of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: determining, according to the second performance parameter and the first performance parameter, whether the connection request is initiated by the local device or the peer device.
7. The method of claim 1, wherein, The second device parameter comprises a second priority of the local device, and the first device parameter comprises a first priority of the peer device; the determining, according to the first device parameter and the second device parameter of the local device, whether the connection request is initiated by the local device or the peer device comprises: determining, according to the second priority and the first priority, whether the connection request is initiated by the local device or the peer device.
8. The method of claim 1, wherein, The obtaining the first information output by the peer device comprises: scanning the first information broadcast by the peer device.
9. The method of claim 1, wherein, The method further comprises: broadcasting second information; the second information comprises the second device parameter.
10. A communications device, characterized by The method comprises: an obtaining module configured to obtain first information output by a peer device; the first information carries a first device parameter identifying the peer device; the first device parameter identifying the peer device. The connection module is configured to determine whether to initiate the connection with the opposite end device according to a size relationship between the first device parameter and a second device parameter, the second device parameter being used to identify the local device.
11. A communications device, characterized by The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-9. The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-9. The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-9. The computer program is executed by the processor to implement the steps of the method according to any one of claims 1-9. 12. A computer readable storage medium having stored thereon a computer program, characterized in that, 13. A computer program product, characterised in that,