Resource transmission method and apparatus, and device and storage medium
By sending broadcast messages of different data segments in a cyclic broadcast manner, the problem of being unable to transmit media resources after a communication connection is established is solved, thus achieving effective communication connection and efficient resource transmission.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2025-11-10
- Publication Date
- 2026-07-02
Smart Images

Figure CN2025133820_02072026_PF_FP_ABST
Abstract
Description
Resource transmission methods, apparatus, equipment and storage media
[0001] This application claims priority to Chinese Patent Application No. 2024119839746, filed on December 27, 2024, entitled “Resource Transmission Method, Apparatus, Device and Storage Medium”, the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of Internet technology, specifically to the field of communication technology, and in particular to a resource transmission method, apparatus, device, and storage medium. Background Technology
[0003] Currently, in communication scenarios (such as near-field communication), the broadcaster typically broadcasts the same message continuously at a certain frequency, allowing the broadcast receiver to directly establish a communication connection upon receiving the message. It's clear that with this existing method, a communication connection can be established as long as the two devices can discover each other's messages. However, for media resource transmission scenarios, after establishing a communication connection using this existing method, further information needs to be exchanged between the broadcaster and receiver to determine if media resources can be transmitted between them. If, after establishing the communication connection, it is determined that media resources cannot be transmitted between the broadcaster and receiver, the established communication connection will be invalid. This not only wastes connection and time costs but also affects the success rate and efficiency of resource transmission. Summary of the Invention
[0004] This application provides a resource transmission method, apparatus, device, and storage medium that can establish an effective communication connection, thereby reducing the waste of connection and time costs and improving the success rate and efficiency of resource transmission.
[0005] On one hand, embodiments of this application provide a resource transmission method, the method comprising:
[0006] Obtain N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device;
[0007] In a communication scenario, the N broadcast messages are broadcast, so that the second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that the second device supports the transmission of the media resources with the first device, and then sends a communication connection request to the first device.
[0008] A communication connection is established with the second device that sent the communication connection request, and the media resources are transmitted between the first device and the second device based on the communication connection.
[0009] On the other hand, embodiments of this application provide a resource transmission device, the device comprising:
[0010] The acquisition unit is used to acquire N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device;
[0011] The processing unit is configured to broadcast the N broadcast messages in a communication scenario, so that after determining that the second device in the communication scenario supports the transmission of the media resources with the first device based on the data fragments in the received broadcast messages, the second device sends a communication connection request to the first device.
[0012] The processing unit is further configured to establish a communication connection with the second device that sent the communication connection request, and to transmit the media resources between the first device and the second device based on the communication connection.
[0013] In another aspect, embodiments of this application provide a computer device, the computer device including an input interface and an output interface, the computer device further including:
[0014] Processor and computer storage media;
[0015] The processor is adapted to implement one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are adapted to be loaded by the processor and executed using the resource transfer method mentioned above.
[0016] In another aspect, embodiments of this application provide a computer storage medium storing one or more instructions, which are adapted to be loaded by a processor and executed using the resource transfer method mentioned above.
[0017] In another aspect, embodiments of this application provide a computer program product comprising one or more instructions; when one or more instructions in the computer program product are executed by a processor, they implement the resource transfer method mentioned above.
[0018] In this embodiment, a first device can acquire N broadcast messages, each containing different data fragments. These data fragments in the N broadcast messages indicate the media resources to be transmitted by the first device. Furthermore, the first device can broadcast the N broadcast messages in a communication scenario. A second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that it supports transmitting media resources with the first device before sending a communication connection request to the first device. This allows the first device to establish a valid communication connection with the second device that sent the request, and to transmit media resources between the first and second devices based on this valid connection. This avoids situations where media resources cannot be transmitted after a communication connection is established, reducing connection and time costs and improving the success rate and efficiency of resource transmission. Furthermore, by using N data fragments to construct N broadcast messages, not only can the broadcast message failure due to excessively long data fragments be avoided, thus improving the broadcast success rate, but the uniqueness of each data fragment in the broadcast message is also ensured, preventing duplication during the broadcast of N broadcast messages. This facilitates the second device's identification of the data fragments in each broadcast message, thereby improving the accuracy of the second device's judgment on whether it supports the transmission of media resources with the first device based on the data fragments. This, in turn, improves the accuracy of subsequent communication connection establishment, and further enhances the success rate and efficiency of resource transmission. Attached Figure Description
[0019] Figure 1a is a schematic diagram of a short-range communication scenario provided in an embodiment of this application;
[0020] Figure 1b is a schematic diagram of resource transmission in a short-range communication scenario provided by an embodiment of this application;
[0021] Figure 1c is a schematic diagram of resource transmission in another short-range communication scenario provided by an embodiment of this application;
[0022] Figure 2 is a flowchart illustrating a resource transmission method provided in an embodiment of this application;
[0023] Figure 3a is a schematic diagram of filling the remaining data bits in the data field of a broadcast message according to an embodiment of this application;
[0024] Figure 3b is a schematic diagram of another method for filling the remaining data bits in the data field of a broadcast message according to an embodiment of this application;
[0025] Figure 3c is a schematic diagram of resource transmission between a first device and a second device according to an embodiment of this application;
[0026] Figure 3d is a schematic diagram of resource transfer between a first device and a second device according to another embodiment of this application;
[0027] Figure 4 is a flowchart illustrating a resource transfer method according to another embodiment of this application;
[0028] Figure 5 is a flowchart illustrating a resource transfer method provided in an embodiment of this application;
[0029] Figure 6 is a schematic diagram of a resource transmission device provided in an embodiment of this application;
[0030] Figure 7 is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0031] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0032] This application proposes a resource transmission method. This method establishes an effective communication connection between a broadcast sender (also known as a signal broadcaster, i.e., a device sending broadcast messages) and a broadcast receiver (also known as a signal receiver, i.e., a device receiving broadcast messages) in a communication scenario through a cyclic broadcast approach. Media resources are then transmitted between the broadcast sender and broadcast receiver based on this communication connection. This avoids situations where media resources cannot be transmitted between the broadcast sender and broadcast receiver after a communication connection has been established, thus reducing connection and time costs and improving the success rate and efficiency of resource transmission. Wherein:
[0033] (1) The communication scenario mentioned above refers to a scenario that includes at least two devices and supports communication between the devices; the devices mentioned here can be terminals, servers, or base stations, etc. Among them, terminals can be smartphones, computers (such as tablets, laptops, desktop computers, etc.), smart wearable devices (such as smartwatches, smart glasses), smart voice interaction devices, smart home appliances (such as smart TVs), vehicle terminals, or aircraft, etc.; servers can be independent physical servers, or server clusters or distributed systems composed of multiple physical servers, or cloud servers that provide basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc.; base stations can also be called public mobile communication base stations, which are interface devices for mobile devices (mobile devices) to access the Internet, and are also a form of radio station, referring to radio transceivers that transmit information between mobile devices and mobile devices through mobile communication switching centers in a certain radio coverage area.
[0034] Specifically, the communication scenarios mentioned above can be, for example, short-range communication scenarios. Short-range communication scenarios refer to situations where devices communicate based on near-field communication (NFC) technology. NFC technology here refers to communication technologies applied at close range (i.e., a short-range wireless communication technology), which allows devices to conduct contactless point-to-point rapid data communication and transmission when they are close to each other. The transmission range needs to be determined based on the available transmission distance of the communication technology used. See Figure 1a: NFC technology can be implemented in ways including but not limited to: Bluetooth, NFC (Near Field Communication), and Wi-Fi, etc. Optionally, the communication scenarios mentioned above can also be mobile communication scenarios, which refer to scenarios where devices communicate with each other based on mobile communication technology. The mobile communication technology here can include, but is not limited to, mobile communication based on the 4th generation mobile communication technology (4G), the 5th generation mobile networks (5G), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), and so on.
[0035] (2) The principle of the aforementioned cyclic broadcast method is roughly as follows: In the stage of establishing a communication connection between two devices in a communication scenario (communication connections in one-to-many (one device to multiple devices) and many-to-one (multiple devices to one device) situations can be regarded as a set of one-to-one (one device to one device) communication connections), when broadcasting, the broadcast sender changes the data fragments (also called data content or data information) carried in the broadcast message through certain strategies and rules, so that each broadcast message carries different data fragments, and the data fragments in each broadcast message can coordinate to indicate the media resources to be transmitted by the broadcast sender, thereby enabling the broadcast receiver to read and cache the data fragments in the received broadcast message according to certain rules. Based on the received broadcast message data fragments (which may be data fragments from a single broadcast message or data fragments from at least two broadcast messages (in which case the data fragments may be ordered or unordered)), if they conform to the connection verification rules (used to indicate the data fragments that the broadcast receiver must obtain from the broadcast sender before establishing a communication connection), it is determined that the broadcast sender and broadcast receiver meet the connection establishment conditions. Thus, it is determined that the broadcast receiver supports the transmission of corresponding media resources with the broadcast sender. At this point, the broadcast sender and broadcast receiver can establish a communication connection so that subsequent resource transmission can be carried out based on the established communication connection.
[0036] It is evident that conforming to the connection verification rules set based on the cyclic broadcast method is a necessary condition for establishing a communication connection between two devices in a communication scenario. Furthermore, the cyclic broadcast method in this embodiment can be used as a pre-processing step to establish a communication connection between two devices in a communication scenario (its function is analogous to a Bloom filter). Further, by caching and parsing broadcast messages on the broadcast receiver, devices allowed to establish communication connections (i.e., broadcast receivers that meet the connection establishment conditions with the broadcast sender) can be left in the broadcast sender's connectable list.
[0037] Based on the above principles, a specific implementation process for establishing a communication connection between two devices in a communication scenario using a cyclic broadcast method may include, but is not limited to, s11-s15:
[0038] s11, Initialize broadcast content. The broadcast sender can prepare a broadcast set, which includes N broadcast messages, where N is a positive integer; each broadcast message includes a data fragment, and different broadcast messages include different data fragments. The data fragments in the N broadcast messages in this broadcast set can coordinate to indicate the media resources to be transmitted by the broadcast sender.
[0039] s12, Looping Broadcast. The broadcast sender broadcasts (i.e., sends) various broadcast messages in the broadcast set in a loop according to a certain strategy. Each broadcast selects a broadcast message with different data fragments. A certain interval can be set for each broadcast to ensure that the broadcast receiver has enough time to receive and process the information of the broadcast message.
[0040] s13, Receiver Response. Upon receiving each broadcast message, the broadcast receiver can analyze its validity and significance. If the broadcast receiver identifies valid content (such as data fragments that match the connection verification rules), or if data fragments from one or more broadcast messages received by the broadcast receiver, after integration, match the connection verification rules, then the broadcast receiver can determine that it meets the connection establishment conditions with the broadcast sender. This means that after establishing a communication connection, the broadcast receiver and broadcast sender are likely to successfully transmit media resources. Therefore, the broadcast receiver can respond accordingly based on the data fragments or integrated data fragment content (e.g., perform operations related to preparing for connection establishment).
[0041] s14, Establish a connection. After the broadcast receiver confirms the information required to establish a communication connection (such as obtaining the device identifier or the connection request permission identifier), the broadcast receiver can send a communication connection request to the broadcast sender based on the confirmed information; correspondingly, after receiving the communication connection request, the broadcast sender can confirm and establish a communication connection with the broadcast receiver based on the communication connection request.
[0042] s15, Continuous loop broadcasting or restarting loop broadcasting after disconnection. For a broadcast sender that can establish one-to-many communication connections, after establishing a communication connection with a broadcast receiver, it can continue to send various broadcast messages in the broadcast set to establish communication connections with other broadcast receivers until the number of communication connections it has established reaches the upper limit; for a broadcast sender that can only establish one-to-one communication connections, after completing the establishment of a communication connection with a broadcast receiver, it can restart loop broadcasting when the communication connection is disconnected or needs to be re-established.
[0043] As can be seen, through the above process, the broadcast sender can effectively broadcast different message (data fragment) contents, thereby ensuring that the broadcast receiver can correctly identify and respond to the corresponding broadcast message, thus successfully establishing a communication connection.
[0044] It is understood that the broadcast sender in this application embodiment may be the final resource sender (i.e., the sender (source) of the media resource) or the resource receiver (i.e., the receiver of the media resource); correspondingly, the broadcast receiver may be either the resource receiver or the resource sender. Furthermore, when the broadcast sender is the resource sender, the data fragments in the N broadcast messages of the aforementioned broadcast set, when collaboratively instructing the broadcast sender to transmit media resources, can specifically be used to instruct the broadcast sender to transmit media resources; when the broadcast sender is the resource receiver, the data fragments in the N broadcast messages of the aforementioned broadcast set, when collaboratively instructing the broadcast sender to transmit media resources, can specifically be used to instruct the broadcast sender to receive media resources.
[0045] For example, as shown in Figure 1b, when device A wants to send a media resource A to other devices in a communication scenario (such as a short-range communication scenario), device A can establish a communication connection (such as a Bluetooth connection) with device B in the communication scenario (such as a short-range communication scenario) through a loop broadcast, and send the corresponding media resource A to device B based on the communication connection (such as the Bluetooth connection). In this case, device A is both the broadcast sender and the resource sender, while device B is both the broadcast receiver and the resource receiver. As shown in Figure 1c, when device a wants to obtain a media resource a from other devices in a communication scenario, device a can establish a communication connection with device b in the communication scenario through a loop broadcast, and obtain the corresponding media resource a from receiving device b based on the communication connection (i.e., the media resource a sent by receiving device b through the communication connection). In this case, device a is both the broadcast sender and the resource receiver, while device b is both the broadcast receiver and the resource sender.
[0046] It is worth emphasizing that, in the embodiments of this application, if user information and other related data are involved, when any method embodiment proposed in this application is applied to a specific product or technology, such related data is collected with the user's permission or consent, and the collection, use and processing of such data comply with the relevant laws, regulations and standards of the relevant regions.
[0047] Based on the above description, this application proposes a resource transmission method. In a specific implementation, the resource transmission method can be executed by a first device, which can be a broadcast sender in a communication scenario. Referring to Figure 2, the resource transmission method may include steps S201-S204:
[0048] S201, retrieve N broadcast messages.
[0049] Each broadcast message (i.e., a message transmitted via broadcast) may include specific data content (i.e., a data fragment), and different broadcast messages may include different data fragments. The data fragments in N broadcast messages can be used to indicate the media resources to be transmitted by the first device. It is understood that the first device may be a resource receiver or a resource sender. If the first device is a resource receiver, the data fragments in the N broadcast messages can specifically indicate that the first device is to receive (or acquire) media resources. If the first device is a resource sender, the data fragments in the N broadcast messages can specifically indicate that the first device is to send media resources. Furthermore, the number of media resources indicated by the data fragments in the N broadcast messages can be one or more, without limitation. The media resources mentioned here refer to resources generated based on multimedia technology, such as game resources (e.g., game application installation packages, game items, etc.), video resources (e.g., film and television resources, short video resources, etc.), audio resources, image and text resources, etc.
[0050] It should be noted that the embodiments of this application do not limit the generation method of data segments in N broadcast messages. For example, the indication information of the first device, the indication information of the transmission instruction, and the indication information of the media resource to be transmitted can be obtained, so that different indication information is used as different data segments; or, at least one indication information can be combined and the combined information can be used as a data segment, so that N data segments can be obtained through N combinations. Among them, ① the indication information of the first device can be the device identifier of the first device (such as serial number, device name, etc.), or information generated by encoding the device identifier of the first device; ② the transmission instruction can be a resource sending instruction or a resource receiving instruction, and the indication information of the transmission instruction can be information generated by encoding the transmission instruction, or the instruction content in the transmission instruction; ③ the indication information of the media resource can be the resource identifier of the media resource, or information generated by encoding the resource identifier of the media resource.
[0051] For example, a data fragment in N broadcast messages can be obtained by splitting resource transmission information, which can be used to indicate the media resources to be transmitted by the first device. Furthermore, when the first device is a resource receiver, this resource transmission information can specifically be used to indicate the media resources to be received (or acquired) by the first device; when the first device is a resource sender, this resource transmission information can specifically be used to indicate the media resources to be sent by the first device. Therefore, a data fragment in any broadcast message can be understood as a piece of data obtained by splitting resource transmission information, which can be an identifier, device identifier, status information (information used to indicate the device status of the first device), or a specific instruction, etc.
[0052] For example, resource transmission information is used to indicate that a first device with serial number XS123 and in an idle state is about to transmit media resource A, media resource B, and media resource C. If this resource transmission information is divided into 6 data segments, the first data segment can be the identifier of serial number XS123, the second data segment can be the idle state information, the third data segment can be the specific instruction to transmit media resources, the fourth data segment can be the resource identifier of media resource A, the fifth data segment can be the resource identifier of media resource B, and the sixth data segment can be the resource identifier of media resource C; the resource identifier of any media resource can include, but is not limited to: resource name, resource version number, part of the resource content in the media resource, etc.
[0053] It should be noted that the specific implementation method for splitting resource transmission information in this application embodiment is not limited. For example, the data fragment content in each broadcast message should be compressed as much as possible (e.g., using Huffman coding instead of fixed-length coding), and it is not recommended to split the data granularity too small. This is because, with the same total data size, the smaller the data fragments, the more data fragments there will be. Furthermore, in the application scenario of this application embodiment, the types of data fragments may also increase, leading to an increase in the number of broadcast messages. This increases the complexity of cyclic broadcasting and may also result in data fragments that do not fully occupy the data fields in the broadcast message, thus wasting data fields. Therefore, when splitting resource transmission information, at least one of the following data fragment splitting principles can be followed:
[0054] 1. Content Uniqueness: The data fragments in each of the N broadcast messages can be unique to ensure that they are not repeated in a cyclic broadcast and to facilitate the identification of each broadcast message by the broadcast receiver.
[0055] 2. Appropriate size: The size (length) of the data fragments in each of the N broadcast messages can be suitable for the limitations of the transmission medium (or the transmission protocol corresponding to the communication connection) to ensure that the broadcast is completed within the effective time and avoid timeout or packet loss.
[0056] 3. Information integrity: The data fragments in each of the N broadcast messages can contain enough information so that the broadcast receiver can understand their meaning and process them effectively.
[0057] 4. Sequentiality: If there are dependencies between data segments (such as the identification and processing of one data segment depends on another data segment), the broadcast order between these data segments can be maintained during the cyclic broadcast of N broadcast messages to ensure that the broadcast receiver can correctly reassemble the information.
[0058] 5. With timestamps or sequence numbers: Timestamps or sequence numbers can be added to the data segments of each of the N broadcast messages to help the broadcast receiver determine the order of the data segments and the age of the data segments.
[0059] By following these data segmentation principles, the transmission efficiency and reliability of each broadcast message can be improved, thereby ensuring that a communication connection can be successfully established between the two parties (i.e., the broadcast sender and the broadcast receiver).
[0060] In one optional implementation, each broadcast message includes a data field for storing data fragments within the broadcast message, which may include at least one data bit. If the lengths of the data fragments in different broadcast messages within the same broadcast set are different, the remaining data bits (i.e., data bits that do not store data fragments) in the data field of each broadcast message can be padded to avoid data misidentification due to remaining data bits in the data field, thus preventing data identification errors. Therefore, by padding the remaining data bits in the data field of each broadcast message, the accuracy of subsequent data identification can be improved.
[0061] It is understood that the specific method by which the remaining data bits in the data field contained in any broadcast message are filled in the embodiments of this application is not limited.
[0062] For example, the remaining data bits in the data fields of each broadcast message can be filled with a preset value, such as binary "0" or "1". This avoids affecting the accuracy and difficulty of subsequent data processing due to overly complex preset values while implementing data field filling. Based on this, for the nth broadcast message out of N broadcast messages, if the data fragment in the nth broadcast message does not fill the corresponding data field, the data bits (i.e., the remaining data bits) in the corresponding data field that do not store the data fragment can be filled with a preset value (such as binary "0" or "1"), as shown in Figure 3a; where n∈[1,N].
[0063] For example, redundancy (i.e., error correction codes used to detect and correct errors in the broadcast messages) can be added to cyclic broadcast messages to facilitate error correction and retransmission, thereby improving communication reliability. Based on this, if the data segments in N broadcast messages do not reach their designed length (i.e., the length of the data field), the extra data bits in the data field of each broadcast message (i.e., the data bits that do not store data segments) can be used for this redundancy design. That is, the extra data bits are used to store the data error correction codes corresponding to the redundancy design, thus improving the reusability of the data field while implementing data field filling. Based on this, each broadcast message contains a data field and a check field, with the check field following and adjacent to the data field. The data field stores the data segments in the broadcast message, and the check field stores the data error correction codes. If the data segments in each broadcast message do not fill the corresponding data field, the last H remaining data bits in the data field of each broadcast message are used to co-store (i.e., jointly store) the data error correction codes with the check field in the corresponding broadcast message. Here, the value of H is the minimum number of remaining data bits in the data fields of N broadcast messages; for example, as shown in Figure 3b: suppose there are a total of 3 broadcast messages, the first broadcast message contains 5 remaining data bits in its data field, the second broadcast message contains 3 remaining data bits in its data field, and the third broadcast message contains 2 remaining data bits in its data field, then the value of H can be determined to be 2, so that the last 2 remaining data bits in the data field of each of these 3 broadcast messages are used to store the data error correction code.
[0064] S202, broadcast N broadcast messages in the communication scenario, so that the second device in the communication scenario, after determining that the second device supports the transmission of media resources with the first device based on the data fragments in the received broadcast messages, sends a communication connection request to the first device.
[0065] One specific implementation method for broadcasting N broadcast messages in a communication scenario may include: randomly traversing the N broadcast messages and broadcasting the currently traversed broadcast message in the communication scenario. Alternatively, a message list may be constructed based on the N broadcast messages. This message list may include multiple message elements arranged sequentially, with one message element corresponding to one broadcast message. The same broadcast message may correspond to one or more (i.e., at least two message elements) in the message list, and the broadcast messages corresponding to different message elements may be the same or different. The message elements in the message list are polled according to a preset polling direction, and the broadcast message corresponding to the currently polled message element is broadcast in the communication scenario, thereby ensuring the orderly broadcasting of the broadcast messages.
[0066] The second device can be any device in the communication scenario that receives at least one broadcast message broadcast by the first device; that is, the second device is the broadcast receiver in the communication scenario. After determining, based on the data fragments in the received broadcast message, that the second device supports the transmission of media resources with the first device, it can send a communication connection request to the first device. Specifically, the second device can obtain the information required to establish a communication connection (such as a device identifier or a connection request permission identifier), and construct a communication connection request based on the obtained information, thereby sending the communication connection request to the first device. It is understandable that if the second device determines, based on the data fragments in the received broadcast message, that it does not support the transmission of media resources with the first device, it can prohibit sending communication connection requests to the first device.
[0067] In its implementation, the second device is configured with connection establishment conditions. These conditions indicate the data segments the second device must obtain from the first device before establishing a communication connection. Accordingly, the second device determines that it supports the transmission of media resources with the first device if the connection establishment conditions are met based on the data segments in the received broadcast messages. Specifically, the second device can determine that the connection establishment conditions are met if it receives a broadcast message containing the data segments indicated by the connection establishment conditions. For example, if N broadcast messages contain 6 data segments (data segments 1-6), and the connection establishment conditions indicate that the second device must obtain data segments 2 and 3 from the first device before establishing a communication connection, then the second device can receive at least one broadcast message broadcast by the first device in the communication scenario, and determine that the connection establishment conditions are met if the received broadcast message contains data segments 2 and 3. As can be seen, this implementation allows the second device to determine whether it supports transmitting media resources with the first device by using the built-in connection establishment conditions and the data fragment distribution in the broadcast message received from the first device. This determination method does not require complex operations and can improve the determination efficiency.
[0068] Based on the foregoing, the first device may be a device to receive media resources or a device to send media resources, and the number of media resources to be received or sent by the first device can be one or more (i.e., at least two). Therefore, the options are:
[0069] When the first device is the device to receive media resources, the connection establishment condition can also be used to indicate that the second device must contain the corresponding media resources (i.e., at least one media resource that the first device needs to receive). Based on this, as shown in Figure 3c: if the second device receives a broadcast message containing the data fragment indicated by the connection establishment condition, it can further detect whether the second device contains at least one media resource that the first device needs to receive. If it does, it can be determined that the connection establishment condition between the second device and the first device is met; if it does not, it can be determined that the connection establishment condition between the second device and the first device is not met. This ensures that the second device establishes a communication connection with the first device only when it possesses at least one media resource that the first device needs to receive. This avoids the situation where, after establishing a communication connection, the second device cannot send the corresponding media resources to the first device because it does not contain the media resources required by the first device, thereby improving the success rate of resource transmission.
[0070] When the first device is the device to send media resources, the connection establishment condition can also be used to indicate that the second device supports running the corresponding media resources (i.e., at least one media resource to be sent by the first device). Based on this, as shown in Figure 3d: if the data fragment in the received broadcast message contains the data fragment indicated by the connection establishment condition, the second device can further detect whether it supports running at least one media resource to be sent by the first device (such as supporting playback or installation of the corresponding media resource). If it supports it, it can be determined that the connection establishment condition between the second device and the first device is met; if it does not support it, it can be determined that the connection establishment condition between the second device and the first device is not met. This ensures that the second device establishes a communication connection with the first device only when it can support running at least one media resource to be sent by the first device. This avoids the situation where the second device cannot run the corresponding media resource after the first device sends the media resource based on the established communication connection, thus wasting resource transmission costs and improving the effectiveness of resource transmission.
[0071] Based on the above description, the second device, as a broadcast receiver, can have at least one of the following capabilities: (1) It can receive broadcast messages and process (may involve caching and parsing) different data message contents, and at the same time, it can also have filtering and identification mechanisms to distinguish between valid broadcast messages and invalid broadcast messages; (2) It can have sufficient processing speed to respond to and parse the data fragment contents in different broadcast messages in a timely manner, and integrate and judge whether both parties have met the connection establishment conditions; (3) It can support the use of the same network protocol as the broadcast sender (i.e., the first device) to ensure the compatibility of the transmission protocols of both parties.
[0072] S203, establish a communication connection with the second device that sent the communication connection request.
[0073] In practical implementation, if the first device receives a communication connection request from the second device, it can establish a communication connection with the second device based on the communication technology corresponding to the communication scenario. For example, when the communication scenario is a near-field communication scenario, the corresponding communication technology is near-field communication technology (such as Bluetooth, NFC, or Wi-Fi), then the first device can establish a near-field communication connection with the second device based on this near-field communication technology (such as Bluetooth connection, NFC connection, or Wi-Fi connection). Similarly, when the communication scenario is a mobile communication scenario, the corresponding communication technology is mobile communication technology (such as 4G, 5G, etc.), then the first device can establish a mobile communication connection with the second device based on this mobile communication technology.
[0074] S204, transmitting media resources between a first device and a second device based on a communication connection.
[0075] In a specific implementation, if the first device is the device to receive media resources (i.e., the first device is the resource receiver), then after the first device and the second device establish a communication connection, the second device can send media resources to the first device based on the communication connection. Therefore, a specific implementation of S204 may include: receiving media resources sent by the second device based on the communication connection, as shown in Figure 3c above. If the first device is the device to send media resources (i.e., the first device is the resource sender), then after the first device and the second device establish a communication connection, the first device needs to send media resources to the second device. Therefore, a specific implementation of S204 may include: sending media resources to the second device based on the communication connection, as shown in Figure 3d above.
[0076] In this embodiment, a first device can acquire N broadcast messages, each containing different data fragments. These data fragments in the N broadcast messages indicate the media resources to be transmitted by the first device. Furthermore, the first device can broadcast the N broadcast messages in a communication scenario. A second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that it supports transmitting media resources with the first device before sending a communication connection request to the first device. This allows the first device to establish a valid communication connection with the second device that sent the request, and to transmit media resources between the first and second devices based on this valid connection. This avoids situations where media resources cannot be transmitted after a communication connection is established, reducing connection and time costs and improving the success rate and efficiency of resource transmission. Furthermore, by using N data fragments to construct N broadcast messages, not only can the broadcast message failure due to excessively long data fragments be avoided, thus improving the broadcast success rate, but the uniqueness of each data fragment in the broadcast message is also ensured, preventing duplication during the broadcast of N broadcast messages. This facilitates the second device's identification of the data fragments in each broadcast message, thereby improving the accuracy of the second device's judgment on whether it supports the transmission of media resources with the first device based on the data fragments. This, in turn, improves the accuracy of subsequent communication connection establishment, and further enhances the success rate and efficiency of resource transmission.
[0077] Based on the description of the above method embodiments, this application also proposes another resource transmission method, which can still be executed by the first device. Referring to Figure 4, this resource transmission method may include steps S401-S405:
[0078] S401, retrieve N broadcast messages.
[0079] In this embodiment, each broadcast message may include basic data content and specific data (i.e., data fragments). The specific data (i.e., data fragments) in the N broadcast messages are obtained by splitting resource transmission information, which is used to indicate the media resources to be transmitted by the first device. In the N broadcast messages acquired by the same device (such as the first device), the basic data content in each broadcast message may be the same, while the specific data (i.e., data fragments) in each broadcast message may be changed cyclically according to certain strategies and rules; that is, the specific data (i.e., data fragments) in each broadcast message may be different. Based on this, referring to Figure 5: when the first device executes S401, it can split the resource transmission information into N data fragments, and combine each data fragment with the basic data content to obtain N broadcast messages.
[0080] The basic data content in each broadcast message may include, but is not limited to, at least one of the following:
[0081] (1) A message preamble is a data sequence used to ensure signal stability. A message preamble can be used for automatic gain control (AGC) to automatically adjust the gain of the received signal to maintain the output signal within an appropriate range, avoiding problems such as excessively strong or weak signals. For example, a message preamble can be the first 8 bits of a broadcast message, such as "01010101" or "10101010", or a similar simple and regular alternating sequence. The significance of configuring a message preamble in a broadcast message includes, but is not limited to, the following: 1. Ensuring stable received signal strength and reducing noise interference; 2. Improving the receiver's adaptability to different signal strengths and adapting to environmental changes; 3. Improving sound quality and avoiding distortion or silence in audio resource transmission scenarios, etc.
[0082] (2) Access address, which is the network address of the first device (i.e., the broadcast sender). When a broadcast receiver attempts to receive a broadcast message, it must know the access address of the broadcast message to be received beforehand, and then turn on and tune to the correct frequency based on that access address to achieve message reception. Even if no nearby devices are sending broadcast messages, the broadcast receiver will still receive background radiation. Considering the probability of receiving pure random noise, the probability of receiving a noise sequence that matches the preamble sequence is relatively high, because the message preamble in broadcast messages is usually a simple alternating sequence, such as the "01010101" or "10101010" sequence mentioned above, which is similar to noise. This can easily lead the broadcast receiver to mistakenly believe that the random noise is the message preamble, resulting in the reception of a false message. It can be seen that if the broadcast receiver is always on, it is very likely that a false preamble sequence will be received every few minutes. Based on this, the access address can be configured in the broadcast message to reduce the probability of receiving false messages caused by random noise. In summary, the main functions of an access address include, but are not limited to, the following: 1. Device differentiation – Each device has a unique network address (access address) used to identify and distinguish different devices; 2. Data source identification – In broadcast mode, a broadcast sender can send data to multiple broadcast receivers simultaneously, and the access address helps the broadcast receiver identify the data source; 3. Connection management – When establishing a communication connection, the access address can be used to identify the devices that need to connect, ensuring the correctness of data transmission; 4. Privacy protection – Privacy can be improved by using random addresses.
[0083] (3) The header is the beginning of the data packets in a broadcast message. The main functions of the header include, but are not limited to, the following: 1. Defining the structure of the data packets in the broadcast message, which may include the length and type of fields; 2. Indicating the broadcast type, such as a connection request or scan response, to help the broadcast receiver identify the purpose of the data; 3. Containing the address type of the broadcast sender's network address, facilitating the broadcast receiver's identification of the data source; 4. Indicating the broadcast frequency, impacting power consumption and connection speed; 5. Providing signal strength information to help the broadcast receiver assess the quality of the communication connection; 6. Used for time synchronization and managing various broadcast events. As can be seen, through this information, the header ensures that the broadcast receiver can effectively identify and process the data in the broadcast message, thereby achieving efficient communication.
[0084] (4) Length, which refers to the length of the data segments in the broadcast message, that is, the length of the data segments in the broadcast message corresponds to the length mentioned here. By configuring this length in the broadcast message, the broadcast receiver can accurately identify the data segments in the broadcast message based on this length, thereby improving the accuracy of data segment identification. Optionally, in order to ensure that the broadcast message can be successfully transmitted, the length of the data segments in the broadcast message can be constrained by the transmission protocol corresponding to the communication connection, that is, the length of the data segments does not exceed the maximum length specified by the transmission protocol corresponding to the communication connection.
[0085] (5) Data error correction code, which is a character used to detect and correct errors in the data of a broadcast message. For example, the data error correction code can be a cyclic redundancy check (CRC) code. The CRC code can be used to detect whether errors have occurred during data transmission and to ensure the integrity of the received data. The broadcast receiver can determine whether the data in the received broadcast message has been tampered with or damaged by calculating the CRC value and comparing the calculated CRC value with the CRC value in the broadcast message. It can be seen that the data that passes the CRC check has a certain degree of reliability. Furthermore, by considering adding a certain amount of redundancy in each broadcast message of a cyclic broadcast, error correction and retransmission can be facilitated, thereby improving the reliability of communication.
[0086] Based on the above description, the first device, as the broadcast sender, needs to determine the basic data content and specific data (i.e., data fragments) for each broadcast, and integrate the basic data content and specific data (i.e., data fragments) for each broadcast into a broadcast message to obtain N broadcast messages, so that these broadcast messages (i.e., N broadcast messages) can be sent out according to a certain regularity and frequency based on the cyclic sending mechanism.
[0087] S402 constructs a message list based on N broadcast messages.
[0088] The message list includes multiple message elements arranged sequentially, with each message element corresponding to a broadcast message. For example, a message element can be the broadcast message itself. Alternatively, a message element can be an element that refers to a broadcast message; for instance, it could be a portion of the data in the broadcast message, or a character generated in real-time and associated with a broadcast message, such as character A, character B, etc. Therefore, by using elements that refer to broadcast messages as message elements and constructing the message list, the large storage space occupied by the message list can be avoided.
[0089] In one specific implementation, the first device can use a fair cycle method to broadcast N broadcast messages. A fair cycle means that for each of the N broadcast messages, each broadcast message has an equal weight. The weight of any broadcast message is proportional to the frequency with which it appears during the broadcast of the N broadcast messages. Therefore, a fair cycle ensures that each broadcast message appears with equal frequency during the broadcast of the N broadcast messages.
[0090] Based on this, when constructing a message list based on N broadcast messages, the first device can construct a new list, which is an empty list used to store message elements. A message element is determined for each broadcast message, and the message elements corresponding to each broadcast message are sequentially added to the new list to obtain the message list. In this case, the number of message elements corresponding to each broadcast message in the message list is always one. It should be noted that the embodiments of this application do not limit the order in which the message elements corresponding to each broadcast message are added. For example, a broadcast message can be randomly selected each time, and the message elements of the currently selected broadcast message can be added to the new list; alternatively, the dependencies between data fragments in each broadcast message can be detected, and the message elements corresponding to each broadcast message can be added to the new list sequentially based on the detected dependencies.
[0091] In another specific implementation, the first device can use a non-fair cycle method to broadcast N broadcast messages. The so-called non-fair cycle means that for each of the N broadcast messages, at least two broadcast messages can have unequal weights. The weight of any broadcast message is proportional to the frequency of its occurrence during the broadcast of the N broadcast messages. Therefore, the non-fair cycle ensures that at least two broadcast messages have different frequencies during the broadcast of the N broadcast messages. In this case, the weight of the broadcast messages can be determined based on their importance. For relatively important broadcast messages, their weight and frequency during the broadcast of the N broadcast messages can be higher, while for relatively less important broadcast messages, their weight and frequency during the broadcast of the N broadcast messages can be relatively lower.
[0092] The importance of a broadcast message can be determined based on business experience or the historical usage of the corresponding broadcast message, and this application embodiment does not limit this. Taking a practical application scenario as an example, if the media resource is a game resource, some very old mobile phone models do not support the currently common high-quality new versions of game resources and need to find older versions of game resources that are compatible with their phone performance. However, this type of mobile phone model appears infrequently, so the frequency of mobile phones that have historically used this type of mobile phone signal to obtain older versions of game resources is also low. If the data fragment in a broadcast message represents a game resource version number that is compatible with the old mobile phone model, then there are usually few devices looking for that game resource version number. Therefore, a low weight can be set for this broadcast message, thereby enabling the sending of data fragments containing the game resource version number at a relatively low frequency, that is, sending broadcast messages containing the game resource version number at a relatively low frequency.
[0093] Based on this, when constructing a message list based on N broadcast messages, the first device can construct a new list and obtain the weight of each broadcast message among the N broadcast messages, where at least two broadcast messages have different weights. Then, according to the weight of each broadcast message, the message elements of the corresponding broadcast message are added to the new list to obtain the message list. The number of message elements of any broadcast message in the message list is proportional to the weight of the corresponding broadcast message. In this case, the message list can be called a weighted broadcast message list. For example, suppose there are two broadcast messages: broadcast message A and broadcast message B; broadcast message A has a weight of 3 and its corresponding message element is A, and broadcast message B has a weight of 1 and its corresponding message element is B. Then the constructed message list (i.e., the weighted broadcast message list) can be [A, A, A, B]. As can be seen, by adding the corresponding message elements of a broadcast message to a new list based on the weight of the broadcast message, and thus constructing a message list, the message elements corresponding to the broadcast message can be repeated in the message list. The higher the weight of the broadcast message, the more times the corresponding message element is repeated. This will make the corresponding message element appear more often in subsequent polling, and thus make the corresponding broadcast message be selected (broadcast) more often.
[0094] Optionally, the implementation method of the first device constructing a message list based on N broadcast messages can also be as follows: construct a new list and directly add the message elements of the N broadcast messages to the new list to obtain the message list; in this case, the first device can also obtain the broadcast mode indication information of each broadcast message in the N broadcast messages, and associate and store the broadcast mode indication information of each broadcast message with the message list, so that after polling the message elements from the message list, the corresponding broadcast message can be broadcast according to the broadcast mode indication information of the broadcast message corresponding to the corresponding message element. The broadcast mode indication information of any broadcast message can at least include a weight, which is used to indicate the number of times the corresponding broadcast message is broadcast; optionally, the broadcast mode indication information can also include additional information, which can be used to indicate the broadcast strategy of the broadcast message (such as continuous broadcast, intermittent broadcast, etc.). For example, if the weight in the broadcast mode indication information of a certain broadcast message A is 3, and the additional information indicates continuous broadcast, then after polling the message elements of broadcast message A from the message list, broadcast message A can be broadcast 3 times continuously.
[0095] S403: Poll each message element in the message list according to the preset polling direction.
[0096] The preset polling direction can be a polling direction preset based on actual needs. For example, it can be the direction from the first message element in the message list to the last message element, or the direction from the last message element in the message list to the first message element, and so on. In this embodiment, polling means querying in turn, and one or more (i.e., at least two) message elements can be polled from the message list each time.
[0097] In one specific implementation, the first device may employ a time-based polling mechanism. This polling mechanism instructs that a defined time interval be set, and that a message element be polled from the message list after each such time interval. Based on this, a specific implementation of S403 by the first device may include: obtaining a first time interval, which refers to the duration between two consecutive broadcast messages; and polling each message element in the message list according to a preset polling direction based on the first time interval, polling one message element at a time, i.e., polling one message element from the message list after each of the first time intervals. For example, if the first time interval is 1 millisecond, the first device may poll one message element from the message list according to the preset polling direction, and then poll another message element from the message list according to the preset polling direction after each 1 millisecond.
[0098] It is evident that by employing a time-based polling mechanism to poll the message list, periodic broadcasting of broadcast messages can be achieved (i.e., the time interval between two consecutive broadcast messages is the same). Periodic broadcasting can improve data transmission capabilities, making communication between devices smoother and more stable.
[0099] In another specific implementation, the first device can employ a space-based polling mechanism. This mechanism indicates that, within the same time interval, the total length (or size) of the data to be processed in each broadcast message broadcast within each time interval should be the same or similar, but it is not necessary to limit the broadcast time interval between two consecutive broadcast messages sent within each time interval. The data to be processed refers to the data to be processed, which may at least contain data fragments; optionally, the data to be processed may also include other data (such as data error correction codes, headers, etc. in the broadcast message). Based on this, the specific implementation of S403 by the first device may include: obtaining a second time interval, which refers to the time interval between two consecutive broadcast messages, wherein the total length of the data to be processed in each broadcast message in any group of broadcast messages matches the length threshold (is the same, or is less than the length threshold and the difference between it and the length threshold is less than the minimum length of the data to be processed); polling each message element in the message list according to a preset polling direction based on the second time interval, polling at least one message element each time, and the broadcast messages corresponding to each polled message element constitute a group of broadcast messages.
[0100] For example: the second time interval is 3 milliseconds, the length threshold is 32, the preset polling direction is from the first message element in the message list to the last message element, and the lengths of the data to be processed in the broadcast messages corresponding to each message element in the message list are, in order: 8, 8, 8, 16, 16, 32; then, the first device can poll out the 1st to 4th message elements from the message list according to the preset polling direction, and use the broadcast messages corresponding to the 1st to 4th message elements to form the first group of broadcast messages, so that the sum of the lengths of the data to be processed in each broadcast message in the first group of broadcast messages is 32 (and... (Length threshold matching); After 3 milliseconds, the 5th and 6th message elements can be polled from the message list according to the preset polling direction, and the broadcast messages corresponding to the 5th and 6th message elements are used to form the second group of broadcast messages, so that the total length of the data to be processed in each broadcast message in the second group of broadcast messages is 32; After another 3 milliseconds, the 7th message element can be polled from the message list according to the preset polling direction, and the broadcast messages corresponding to the 7th message element are used to form the third group of broadcast messages, so that the total length of the data to be processed in each broadcast message in the third group of broadcast messages is 32.
[0101] It is evident that by employing a space-based polling mechanism to poll the message list, the total length of the data to be processed in each broadcast message broadcast within each second time interval can be kept the same or similar. This ensures the stability of the total amount of data to be processed received by the broadcast receiver within each second time interval, preventing sudden changes in the amount of data when the broadcast receiver processes the received broadcast messages. This is beneficial for improving the data processing stability of the broadcast receiver.
[0102] In another specific implementation, the first device can employ an event-based polling mechanism. This mechanism indicates that, based on a frequency adjustment trigger event, the polling frequency of the message list is dynamically adjusted, thereby polling the message list based on the adjusted polling frequency. The polling frequency of the message list indicates the interval between two consecutive polling operations in the message list, which can be, for example, the first or second time interval mentioned above. The frequency adjustment processing event refers to an event that triggers the adjustment of the polling frequency, which may include at least one of the following: the number of other devices that have established communication connections with the first device at the present time (i.e., the moment the frequency adjustment trigger event is detected) is greater than a quantity threshold, and the ambient noise intensity of the communication scenario is greater than an intensity threshold, etc. Based on this, a specific implementation of S403 by the first device may include: obtaining a preset polling frequency for the message list and detecting a frequency adjustment trigger event; if a frequency adjustment trigger event is detected, adjusting the polling frequency and, according to a preset polling direction, polling each message element in the message list based on the adjusted polling frequency, polling at least one message element each time.
[0103] For example, a first device (such as a base station) can use a queue data structure to help record other devices that have established communication connections with it. When the number of other devices recorded in the queue exceeds a threshold, it indicates that a large number of communication connections are consuming the first device's processing resources. In this case, a frequency adjustment event can be detected, allowing the polling frequency of the message list to be reduced. Based on the reduced polling frequency, each message element in the message list is polled, slowing down the rate at which message elements are polled from the message list, thus slowing down the rate at which broadcast messages are sent. This reduces the establishment of new communication connections and lowers the processing pressure on the first device. Alternatively, when the ambient noise intensity of the current communication scenario exceeds a threshold, it indicates that the ambient noise is significant, making it difficult for the broadcast receiver to continuously and accurately receive broadcast messages sent by the broadcast sender (i.e., the first device). In this case, a frequency adjustment event can be detected, allowing the polling frequency of the message list to be increased. Based on the increased polling frequency, each message element in the message list is polled, increasing the broadcast message sending frequency (i.e., the broadcast frequency), thereby improving the success rate of the broadcast receiver receiving broadcast messages.
[0104] S404, in the communication scenario, broadcast the broadcast message corresponding to the currently polled message element, so that the second device in the communication scenario, after determining that the second device supports the transmission of media resources with the first device based on the data fragments in the received broadcast message, sends a communication connection request to the first device.
[0105] In specific implementations, if the first device uses a time-based polling mechanism to poll each message element in the message list, the number of message elements polled at the moment is one. In this case, when the first device executes S404, it can directly broadcast the broadcast message corresponding to the currently polled message element in the communication scenario. If the first device uses a space-based or event-based polling mechanism to poll each message element in the message list, the number of currently polled message elements is at least one. In this case, when the first device executes S404, it can sequentially broadcast the broadcast messages corresponding to each currently polled message element in the communication scenario within the second time interval; or, it can integrate the broadcast messages corresponding to each currently polled message element to obtain a new broadcast message, and broadcast the new broadcast message in the communication scenario, thereby reducing the number of broadcasts, reducing transmission pressure, and reducing the complexity of cyclic broadcasting.
[0106] In one optional implementation, after polling all message elements in the message list, the first device can re-polle the message elements in the message list and broadcast the broadcast message corresponding to the currently polled message element in the communication scenario, thereby achieving repeated transmission of each broadcast message and improving the success rate of the second device receiving the broadcast message. Specifically, when re-polling the message elements in the message list, the first device can re-polle the message elements in the message list in the same way as the initial polling (i.e., the specific implementation of S403 mentioned above); or, the first device can also use a randomized polling method to re-polle the message elements in the message list to break the fixed polling order and improve the randomness of broadcast message transmission.
[0107] Specifically, one implementation method for re-polling each message element in the message list using randomized polling may include: s101, randomly shuffling the order of the message elements in the message list to obtain a shuffled message list; s102, polling each message element in the shuffled message list according to a preset polling direction. The specific implementation of s102 is similar to the specific implementation of S403 described above, and will not be described in detail here. Alternatively, another implementation method for re-polling each message element in the message list using randomized polling may include: s201, determining a new polling direction, which is different from the preset polling direction. For example, if the preset polling direction is the direction from the first message element to the last message element in the message list, then the new polling direction could be the direction from the last message element to the first message element in the message list; s202, re-polling each message element in the message list according to the new polling direction. The specific implementation of s202 is similar to the specific implementation of S403 described above, and will not be described in detail here.
[0108] In one optional implementation, during the broadcasting of the nth broadcast message out of N broadcast messages, the first device can also detect the ambient noise intensity of the communication scenario, where n ∈ [1, N]. If the ambient noise intensity is greater than the intensity threshold, it can be determined that the current ambient noise has a significant impact, making it difficult for the second device to accurately receive the nth broadcast message. Therefore, the nth broadcast message can be broadcast K times repeatedly to improve the success rate of the second device receiving the nth broadcast message. Here, K is a positive integer, and the value of K can be determined based on empirical values or based on the preset correspondence between ambient noise intensity and the number of repeated broadcasts.
[0109] It should be noted that S402-S404 described above is one implementation of the first device broadcasting N broadcast messages in a communication scenario, and is not intended to limit the scope of the implementation. For example, the first device can also broadcast the N broadcast messages in a certain order, so that the broadcast messages received by the second device based on this order are more likely to meet the connection establishment conditions. For instance, if the connection establishment condition indicates that the second device needs to receive both data fragment a and data b before establishing a communication connection with the first device, then the first device can prioritize broadcasting the broadcast message containing data fragment a and the broadcast message containing data b when broadcasting N broadcast messages. Therefore, by determining the order in which the broadcast messages are sent, the state of the second device in processing the broadcast messages can be controlled. For example, by broadcasting N broadcast messages in different orders, the second device may receive and process broadcast messages continuously, and determine whether the connection establishment conditions have been met when multiple consecutive broadcast messages are deemed valid. In addition, after the second device meets the connection establishment conditions, it can review the occurrence type of valid broadcast messages, which can be continuous or intermittent.
[0110] In one optional implementation, the first device can also optimize the transmission frequency of broadcast messages (i.e., the broadcast frequency). In general, this involves adjusting the transmission frequency based on average power consumption and response time (i.e., the difference between the time the broadcast message is sent and the time the response is received from the broadcast receiver). Specifically, this involves: 1) setting acceptable average power consumption and a maximum allowable response time; 2) establishing a power consumption model and a response time model based on baseline parameters. The power consumption model analyzes the power consumption of each broadcast, including sending, receiving, and standby states, while the response time model evaluates the average response time of the broadcast receiver after the broadcast message is sent, taking into account network latency and processing time; and 3) developing a frequency adjustment strategy. This involves setting an initial transmission frequency based on the power consumption and response time models, monitoring power consumption and response time in real time, and setting a feedback mechanism to adjust the transmission frequency based on the monitored power consumption and response time. For example, if the response time exceeds the requirement (i.e., the maximum allowable response time), the transmission frequency can be increased; if the power consumption exceeds the upper limit (i.e., acceptable average power consumption), the transmission frequency can be decreased. Furthermore, adaptive algorithms (such as PID control, a control algorithm that combines proportional, integral, and derivative parameters) can be used to automatically adjust the frequency to achieve balance. Additionally, experiments and repeated tests can be conducted in different noise environments to collect data, optimize frequency setting strategies, and ensure that power consumption and response time requirements are met under various conditions.
[0111] Here, we will provide some supplementary explanations regarding the basic framework for the application of adaptive algorithms (PID control) in this context. This basic framework can be roughly summarized as follows:
[0112] 1. Define control objectives. In the context of this application embodiment, the objectives to be considered mainly include the following two: (1) Power consumption P: The objective is to minimize the power consumption during the transmission process; (2) Response time T: The objective is to minimize the delay from transmission to reception.
[0113] 2. Set the error, that is, set the error for calculating the current power consumption and response time:
[0114] {P-error} = {target power consumption} - {current power consumption}
[0115] {T_error} = {target response time} - {current response time}
[0116] 3. PID controller design, specifically the following aspects:
[0117] Ratio (P): Adjusts the transmission frequency and increases or decreases the broadcast interval based on the current power consumption and response time error.
[0118] Integral (I): Accumulate historical errors, taking into account long-term power consumption and response time changes, to prevent steady-state errors.
[0119] Differential (D): Predicts the trend of error changes, reacts quickly, and reduces fluctuations caused by over-adjustment.
[0120] 4. Adjust the transmission frequency: Adjust the transmission frequency of broadcast messages according to the output of the PID controller: if the power consumption is high or the response time is long, increase the transmission interval; otherwise, decrease the transmission interval.
[0121] 5. Implement a feedback mechanism: continuously monitor power consumption and response time, update the input of the PID controller in real time, and ensure that the system can adapt to changes.
[0122] By using the above methods, the energy consumption performance of the first device can be optimized while ensuring communication efficiency.
[0123] S405, establish a communication connection with the second device that sent the communication connection request, and transmit media resources between the first device and the second device based on the communication connection.
[0124] Accordingly, the second device in the communication scenario can receive at least one broadcast message and obtain the internally configured connection establishment conditions. These conditions can indicate: the data segments that the second device needs to obtain from the first device before establishing a communication connection, and that the second device supports running at least one media resource to be sent by the first device. Further, the second device can determine whether the data segments in the received broadcast message contain the data segments indicated by the connection establishment conditions. If not, it determines that the connection establishment conditions between the second and first devices are not met. If they are, it further checks whether the second device supports running at least one media resource to be sent by the first device. If supported, it determines that the connection establishment conditions between the second and first devices are met; otherwise, it determines that the connection establishment conditions between the second and first devices are not met. Further, when it determines that the connection establishment conditions between the second and first devices are met, it can determine that the second device supports transmitting media resources with the first device and send a communication connection request to the first device.
[0125] In this embodiment, the first device establishes a communication connection with the second device through a loop broadcast and transmits media resources based on the communication connection. This can effectively avoid the situation where media resources cannot be transmitted after the communication connection is established, thereby reducing the waste of connection costs and time costs, and improving the success rate and efficiency of resource transmission.
[0126] Based on the description of the above method embodiments, this application also proposes a scheme for realizing near-field communication transmission connections through cyclic broadcasting. In the near-field communication scenario involved in this scheme, each device may include at least one of the following modules: TGPA SDK and system near-field communication module. Wherein:
[0127] 1. The TGPA SDK is a near-field communication component library. Specifically, it can be an SDK (Software Development Kit) component (not limited to the name) integrated into a game application, responsible for implementing a connection establishment method such as loop broadcasting. In the embodiments of this application, when the device acts as a broadcast sender, the TGPA SDK is responsible for specifying the loop rules of the loop broadcast and controlling the modification of data fragments in each broadcast message according to certain rules and patterns. When the device acts as a broadcast receiver, the TGPA SDK is responsible for caching broadcast content and verifying whether the connection establishment conditions are met.
[0128] 2. The system's near-field communication (NFC) module is a module within an operating system (such as Android) that supports NFC functionality and is used to support establishing NFC connections via loop broadcasting. The implementation of this NFC module can be by a device manufacturer (either a pre-implemented open-source solution or a point-to-point support solution for this NFC function). When the broadcast receiver in a near-field communication scenario does not have a game running, the TGPASDK is not present within that receiver. In this case, the broadcast sender in the near-field communication scenario can establish a communication connection and communicate with the system's NFC module within the broadcast receiver.
[0129] Taking the transmitted media resources as game resources as an example, the specific implementation process of this solution is roughly as follows:
[0130] (1) The broadcast sender (i.e. the first device) obtains N broadcast messages, each of which includes a data fragment, and different broadcast messages include different data fragments. The data fragments in the N broadcast messages are obtained by splitting the resource transmission information, which is used to indicate the game resources to be transmitted by the broadcast sender.
[0131] (2) The broadcasting sender broadcasts N broadcast messages in the communication scenario, so that the broadcasting receiver (i.e. the second device) in the communication scenario, based on the data fragments in the received broadcast messages, determines that the connection establishment conditions between the broadcasting receiver and the broadcasting sender are met, and then sends a communication connection request to the broadcasting sender.
[0132] (3) The broadcast sender establishes a communication connection with the broadcast receiver that sent the communication connection request, and transmits the corresponding game resources between the broadcast sender and the broadcast receiver based on the communication connection.
[0133] The relevant technical aspects involved in the above specific implementation process are described below:
[0134] (I) The main modules of the key steps in the above near-field communication transmission connection scheme implemented through cyclic broadcasting are introduced from the perspectives of data flow and control flow:
[0135] (A) Data Flow Level:
[0136] 1. Broadcast content: The broadcaster broadcasts different broadcast messages each time. The processing of each broadcast message can be completed by the TGPA SDK (Near Field Communication Component Function Library) integrated in the game if the broadcast receiver has the game installed, and by the system's near field communication module if the broadcast receiver does not have the game installed.
[0137] 2. Content Cycle: Different broadcast messages are broadcast according to certain rules, forming a fair or unfair cycle. That is, the broadcaster can use either the fair or unfair cycle mentioned above to broadcast N broadcast messages in a communication scenario. Each broadcast sends each message according to a predetermined rule. This predetermined rule can be confirmed by the TGPA SDK (Near Field Communication Component Library) integrated into the game if the broadcaster has a game; otherwise, it can be confirmed by the system's near field communication module.
[0138] 3. Broadcast message reception confirmation: After receiving a broadcast message, the broadcast receiver can parse and confirm the content of the received broadcast message and may return feedback. This process is completed by the TGPA SDK (Near Field Communication Component Function Library) integrated into the game when the broadcast receiver has a game; when the broadcast receiver does not have a game, it is completed by the system's near field communication module.
[0139] (B) Control Flow Level:
[0140] 1. Initialization: The broadcast sender initializes the broadcast settings, determining the loop rules and order of broadcast messages. This process is completed by the TGPA SDK (Near Field Communication Components Library) integrated into the game when the broadcast sender has a game, calling its initialization interface; if the broadcast sender does not have a game, it is completed by the system's near field communication module calling its initialization interface.
[0141] 2. Looping Broadcast: The broadcaster starts periodically broadcasting different broadcast messages in a loop. This process is completed by the TGPA SDK (Near Field Communication Component Library) integrated into the game when the broadcaster has a game; it is completed by the system's near field communication module when the broadcaster does not have a game.
[0142] 3. Receiving and Parsing Broadcast Messages and Requesting Connections: The broadcast receiver monitors the reception of broadcast messages, parses the data fragments in the received broadcast messages, and processes the data fragments. If, based on the data fragments in the received broadcast messages, the broadcast receiver determines that the connection establishment conditions between the broadcast receiver and the broadcast sender are met, it requests a communication connection from the broadcast sender (if the connection establishment conditions are not met, requesting a communication connection is prohibited). This process is completed by the TGPA SDK (Near Field Communication Components Library) integrated into the game when the broadcast receiver has a game; if the broadcast receiver does not have a game, it is completed by the system's near field communication module.
[0143] 4. Establishing a Communication Connection: After successfully meeting the connection establishment conditions, both the broadcast receiver and the broadcast sender confirm the successful communication connection and enter the formal resource transmission phase. This connection establishment process is completed by the TGPA SDK (Near Field Communication Components Library) integrated into the game if the broadcast receiver has a game running; otherwise, it is completed by the system's near field communication module.
[0144] (ii) The buffering mechanism and connection-hitting mechanism of the broadcast receiver in a circular broadcast:
[0145] When the broadcast receiver buffers broadcast messages, the following strategy is adopted:
[0146] 1. Content caching: The broadcast receiver can maintain a cache queue or hash table to store the received broadcast messages; and each time a new broadcast message is received, it can check whether the message content of the new broadcast message already exists in the cache queue or hash table. If it does not exist, the new broadcast message is cached in the cache queue or hash table.
[0147] 2. Time window: A time window can be set (e.g., within a specified duration before the current time) to ensure that broadcast messages received within the time window are cached, thus avoiding cached expired data.
[0148] 3. Capacity Limit: The maximum capacity of the cache can be set, and when the maximum capacity is reached, the cached old broadcast messages will be evicted using the Least Recently Used (LRU) algorithm or the Least Frequently Used (LFU) algorithm.
[0149] 4. Content deduplication: Unique identifiers (such as sequence numbers or hash values) can be used to ensure that the same broadcast message is not cached repeatedly.
[0150] 5. Cyclic Management: The generated broadcast messages are managed cyclically. When a new broadcast message is added to the buffer, it can be decided whether to update or replace the existing broadcast message.
[0151] The above strategies enable broadcast receivers to effectively manage and cache different broadcast messages, thereby ensuring the effectiveness and accuracy of communication.
[0152] When the broadcast receiver is also a resource receiver, after the broadcast receiver integrates and parses the cached broadcast messages, if it determines that at least one data fragment in the broadcast message transmitted by the broadcast sender reflects that it contains the game resources needed by the broadcast receiver, then it can be determined that the connection establishment conditions between the broadcast receiver and the broadcast sender are met, thus allowing the two parties to establish a communication connection. Conversely, when the broadcast receiver is also a resource sender, after the broadcast receiver integrates and parses the cached broadcast messages, if it determines, based on at least one data fragment in the broadcast message transmitted by the broadcast sender, that the broadcast receiver contains the game resources desired by the broadcast sender, then it can be determined that the connection establishment conditions between the broadcast receiver and the broadcast sender are met, thus allowing the two parties to establish a communication connection.
[0153] As can be seen, this application embodiment can achieve mutual filtering between two near-field communication devices before establishing a connection by caching and parsing one or more broadcast messages by the broadcast receiver. This ensures that after the communication connection is established, the resource sender has game resources that meet the needs of the resource receiver. For example, only devices that are allowed to establish a connection are left in the near-field communication connectable list. Devices that are not allowed to establish a communication connection are displayed as unselectable in the connection list.
[0154] Understandably, the process of caching broadcast messages described above can be completed by the TGPA SDK (Near Field Communication Components Library) integrated into the game if the broadcast receiver has a game; and by the system's near field communication module if the broadcast receiver does not have a game.
[0155] (III) The error handling and recovery strategy adopted by the broadcast sender when broadcasting N broadcast messages in a loop:
[0156] (1) Dynamic adjustment mechanism: When certain conditions are met (such as strong interference noise), the transmission frequency of broadcast messages can be increased through the dynamic adjustment mechanism, or the transmission frequency band of interference noise can be avoided (provided that both the broadcast sender and the broadcast receiver support other transmission frequency bands) to transmit broadcast messages.
[0157] (2) Error detection: Error correction codes can be added to broadcast messages using techniques such as CRC check, so that broadcast receivers can use CRC check and other techniques to detect errors in broadcast messages and ensure the correctness and integrity of the data in the received broadcast messages.
[0158] (3) Redundant broadcast: Key information is repeatedly sent in a loop to increase the probability that the broadcast receiver will successfully receive the broadcast message.
[0159] (4) Add a sequence number bit: Each broadcast message can be assigned a sequence number so that the broadcast receiver can use the sequence number to detect lost or duplicate packets.
[0160] (5) Backup mechanism: If critical data is lost, a backup mechanism can be designed so that important information can be recovered through other means (such as caching or history).
[0161] It is evident that the error handling and recovery measures described above for broadcast messages can effectively improve the reliability of data transmission.
[0162] (iv) During the cyclic transmission of N broadcast messages, the following performance optimization measures can be taken to achieve better resource management and scheduling optimization:
[0163] (1) Priority scheduling: For important or urgent broadcast messages, a higher priority can be set to ensure that they are sent and received first.
[0164] (2) Load balancing: When there are multiple broadcast senders in the same area, all of which store the game resources required by the broadcast receiver, the broadcast sender with fewer communication connections can be requested first to establish a communication connection, so as to avoid overloading of a certain node.
[0165] (3) Transmission channel control: By limiting the broadcast rate, transmission channel congestion can be prevented, thereby ensuring stable transmission, especially for one-to-many scenarios (such as a scenario where a base station transmits game resources to multiple devices at the same time).
[0166] (4) Caching mechanism: A cache can be set on the broadcast receiver to store common or repeated broadcast message content, thereby reducing unnecessary parsing of repeated broadcast message content.
[0167] (5) Merging broadcasts: Under certain conditions, at least one broadcast message generated based on data slice splitting can be merged and the merged broadcast message can be broadcast to reduce the number of broadcasts, reduce transmission pressure and the complexity of cyclic broadcasting.
[0168] (6) Time slot scheduling: Time division multiplexing technology can be used to allocate different time slots for broadcasting different broadcast message contents to avoid conflicts.
[0169] (7) Feedback mechanism: The broadcast strategy can be dynamically adjusted through feedback information from the broadcast receiver, such as changing the sending frequency or order of broadcast messages.
[0170] Based on the above description, the near-field communication transmission connection scheme proposed in this application through cyclic broadcasting has the following beneficial effects:
[0171] First, it can help the resource receiver eliminate device interference options that do not meet the requirements for transmitting specific game resources (the game resources that the resource receiver usually needs are the latest version or the version that matches their device conditions), enabling the resource receiver to quickly and accurately connect to a device that meets the transmission conditions and stores the game resources that the user needs.
[0172] Second, during the communication connection establishment phase, device trial and error can be reduced, saving connection costs and time costs for both parties and increasing game users' trust in the near-field communication function. In other words, devices that cannot successfully transmit game resources even if they successfully connect can be filtered out before the communication connection is established. This reduces device trial and error, achieves an effective communication connection, and makes the near-field communication transmission function a powerful aid to the game resource transmission function.
[0173] Third, when the broadcaster is a base station device (e.g., a hardware device specifically designed for transmitting game resources, which may store multiple versions of game resource packages or multiple games), such a base station device, considering cost, has limited transmission resources and a limited number of connections that can be established. Before establishing a communication connection, it filters out near-field communication connection devices that are unlikely to successfully transmit compatible resources after connection through a loop broadcast. This saves costs for both parties, especially in hotspot base stations where users may need to queue for transmission after establishing a communication connection, or even at offline events. In such cases, the loop broadcast filters out transmission devices that do not meet the conditions, preventing users from queuing for or establishing communication connections with unqualified game resource senders, thus saving time. Therefore, for base station devices in near-field communication scenarios, game resources can be utilized and allocated to the maximum extent, improving the effective communication connection rate. When a user needs to transmit game resources, an effective communication connection can be established, and there is a high probability that the required game resources can be successfully transmitted after connection.
[0174] In summary, the embodiments of this application can obtain more preliminary information about the communication connection to be established before the connection is established, enriching the understanding of the connection status and increasing the probability that the communication connection is valid. This means increasing the probability that the two near-field communication devices can successfully transmit compatible game resources after the connection is established. In this way, the near-field communication transmission connection devices of both parties can more effectively coordinate and optimize transmission resources. By adding pre-filtering of the connection, a high-quality channel for transmitting compatible game resources can be opened, ultimately improving the user's game download and update experience. This can be applied to game promotion and operation scenarios such as offline game team formation, e-sports game installation, and offline game location experiences.
[0175] Based on the descriptions of the above method embodiments, this application also discloses a resource transmission device; the resource transmission device may be a computer program (including one or more instructions) running on a computer device, and the resource transmission device may execute each step in any of the above method flows. Referring to Figure 6, the resource transmission device may operate the following units:
[0176] The acquisition unit 601 is used to acquire N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device;
[0177] The processing unit 602 is configured to broadcast the N broadcast messages in a communication scenario, so that after determining that the second device in the communication scenario supports the transmission of the media resources with the first device based on the data fragments in the received broadcast messages, the second device sends a communication connection request to the first device.
[0178] The processing unit 602 is further configured to establish a communication connection with the second device that sent the communication connection request, and to transmit the media resources between the first device and the second device based on the communication connection.
[0179] In one implementation, the second device is configured with connection establishment conditions, which indicate the data fragments that the second device and the first device need to obtain from the first device before establishing a communication connection.
[0180] The second device determines that it supports transmitting the media resources with the first device if it determines that the connection establishment conditions between the second device and the first device are met based on the data fragments in the received broadcast message.
[0181] In another embodiment, the first device is the device to receive the media resource, and the connection establishment condition is further used to indicate that the second device must contain the media resource;
[0182] Accordingly, when the processing unit 602 is used to transmit the media resources between the first device and the second device based on the communication connection, it may specifically be used to: receive the media resources sent by the second device based on the communication connection.
[0183] In another embodiment, the first device is the device to send the media resource, and the connection establishment condition is further used to indicate that the second device supports running the media resource;
[0184] Accordingly, when processing unit 602 is used to transmit the media resources between the first device and the second device based on the communication connection, it may specifically be used to: send the media resources to the second device based on the communication connection.
[0185] In another embodiment, when the processing unit 602 is used to broadcast the N broadcast messages in a communication scenario, it may specifically be used to:
[0186] A message list is constructed based on the N broadcast messages. The message list includes multiple message elements arranged in sequence, and each message element corresponds to one broadcast message.
[0187] The message elements in the message list are polled according to a preset polling direction, and the broadcast message corresponding to the currently polled message element is broadcast in the communication scenario.
[0188] In another implementation, when the processing unit 602 is used to construct a message list based on N broadcast messages, it may specifically be used to:
[0189] Construct a new list, which is an empty list for storing message elements, where each message element is an element used to refer to a broadcast message;
[0190] Obtain the weight of each of the N broadcast messages. The weight of any broadcast message is proportional to the frequency of its occurrence during the broadcast of the N broadcast messages.
[0191] The message elements of each broadcast message are added to the new list in sequence according to the weight of each broadcast message to obtain the message list; wherein the number of message elements of any broadcast message in the message list is proportional to the weight of the corresponding broadcast message.
[0192] In another embodiment, when the processing unit 602 polls each message element in the message list according to a preset polling direction, it may specifically be used to:
[0193] Obtain the first time interval, which refers to the time interval between two consecutive broadcast messages;
[0194] According to the preset polling direction, each message element in the message list is polled based on the first time interval, and one message element is polled at a time.
[0195] In another embodiment, when the processing unit 602 polls each message element in the message list according to a preset polling direction, it may specifically be used to:
[0196] Obtain a second time interval, which refers to the time interval between two consecutive broadcast messages; wherein the total length of the data to be processed in each broadcast message in any group of broadcast messages matches a length threshold, and the data to be processed includes data fragments;
[0197] According to the preset polling direction, each message element in the message list is polled based on the second time interval. At least one message element is polled each time, and the broadcast messages corresponding to each polled message element constitute a set of broadcast messages.
[0198] In another embodiment, when the processing unit 602 broadcasts the broadcast message corresponding to the currently polled message element in the communication scenario, it may specifically be used to:
[0199] During the second time interval, broadcast messages corresponding to each currently polled message element are broadcast sequentially in the communication scenario;
[0200] Alternatively, the broadcast messages corresponding to each of the currently polled message elements can be integrated to obtain a new broadcast message, which can then be broadcast in the communication scenario.
[0201] In another embodiment, when the processing unit 602 polls each message element in the message list according to a preset polling direction, it may specifically be used to:
[0202] Obtain the preset polling frequency for the message list, whereby the polling frequency is used to indicate the interval between two consecutive polling operations performed on the message list;
[0203] The frequency adjustment trigger event is detected, and the frequency adjustment trigger event includes at least one of the following: the number of other devices that have established a communication connection with the first device is greater than a number threshold, and the environmental noise intensity of the communication scenario is greater than an intensity threshold;
[0204] If the frequency adjustment trigger event is detected, the polling frequency is adjusted, and each packet element in the packet list is polled according to the preset polling direction based on the adjusted polling frequency.
[0205] In another implementation, after polling each message element in the message list, the processing unit 602 can also be used to:
[0206] Re-polle each message element in the message list and broadcast the broadcast message corresponding to the currently polled message element in the communication scenario.
[0207] In another embodiment, the processing unit 602 may also be used for:
[0208] During the broadcasting of the nth broadcast message among the N broadcast messages, the environmental noise intensity of the communication scenario is detected, where n∈[1,N];
[0209] If the ambient noise intensity is greater than the intensity threshold, the nth broadcast message is broadcast K times, where K is a positive integer.
[0210] According to another embodiment of this application, the various units in the resource transmission device shown in FIG6 can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This can achieve the same operation without affecting the technical effect of the embodiments of this application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the resource transmission device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0211] According to another embodiment of this application, the resource transfer apparatus shown in FIG6, and the resource transfer method of the embodiments of this application, can be implemented by running a computer program (including one or more instructions) capable of performing the steps involved in the various methods described above on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access storage medium (RAM), and read-only storage medium (ROM). The computer program can be recorded on, for example, a computer-readable storage medium, loaded onto the aforementioned computing device via the computer-readable storage medium, and run therein.
[0212] It is worth noting that, in the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or multiple processors or memory) can be used to implement one or more modules or units. Furthermore, each module or unit can contain a portion of the overall module or unit's functionality.
[0213] In this embodiment, a first device can acquire N broadcast messages, each containing different data fragments. These data fragments in the N broadcast messages indicate the media resources to be transmitted by the first device. Furthermore, the first device can broadcast the N broadcast messages in a communication scenario. A second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that it supports transmitting media resources with the first device before sending a communication connection request to the first device. This allows the first device to establish a valid communication connection with the second device that sent the request, and to transmit media resources between the first and second devices based on this valid connection. This avoids situations where media resources cannot be transmitted after a communication connection is established, reducing connection and time costs and improving the success rate and efficiency of resource transmission. Furthermore, by using N data fragments to construct N broadcast messages, not only can the broadcast message failure due to excessively long data fragments be avoided, thus improving the broadcast success rate, but the uniqueness of each data fragment in the broadcast message is also ensured, preventing duplication during the broadcast of N broadcast messages. This facilitates the second device's identification of the data fragments in each broadcast message, thereby improving the accuracy of the second device's judgment on whether it supports the transmission of media resources with the first device based on the data fragments. This, in turn, improves the accuracy of subsequent communication connection establishment, and further enhances the success rate and efficiency of resource transmission.
[0214] Based on the description of the above method and device embodiments, this application also provides a computer device. Referring to FIG7, the computer device includes at least a processor 701, an input interface 702, an output interface 703, and a computer storage medium 704. The processor 701, input interface 702, output interface 703, and computer storage medium 704 within the computer device can be connected via a bus or other means. The computer storage medium 704 can be stored in the memory of the computer device. The computer storage medium 704 is used to store a computer program, which includes one or more instructions. The processor 701 is used to execute one or more instructions from the computer program stored in the computer storage medium 704. The processor 701 (or CPU (Central Processing Unit)) is the computing and control core of the computer device, adapted to implement one or more instructions, specifically adapted to load and execute one or more instructions to achieve a corresponding method flow or corresponding function.
[0215] In one embodiment, the processor 701 described in this application can be used to perform a series of resource transmissions in a communication scenario, specifically including: acquiring N broadcast messages, where N is a positive integer; different broadcast messages include different data fragments, the data fragments in the N broadcast messages being used to indicate media resources to be transmitted by a first device; broadcasting the N broadcast messages in the communication scenario, causing a second device in the communication scenario to send a communication connection request to the first device after determining, based on the data fragments in the received broadcast messages, that the second device supports transmitting the media resources with the first device; establishing a communication connection with the second device that sent the communication connection request, and transmitting the media resources between the first device and the second device based on the communication connection, etc.
[0216] This application embodiment also provides a computer storage medium (memory), which is a memory device in a computer device used to store computer programs and data. It is understood that the computer storage medium here can include both the built-in storage medium in the computer device and extended storage media supported by the computer device. The computer storage medium provides storage space that stores the operating system of the computer device. Furthermore, the storage space also stores a computer program, which includes one or more instructions suitable for loading and execution by the processor 701. These instructions can be one or more program codes. It should be noted that the computer storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer storage medium located remotely from the aforementioned processor.
[0217] In one embodiment, a processor may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps in the above method embodiments; specifically, one or more instructions in the computer storage medium may be loaded and executed by the processor in the following steps:
[0218] Obtain N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device;
[0219] In a communication scenario, the N broadcast messages are broadcast, so that the second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that the second device supports the transmission of the media resources with the first device, and then sends a communication connection request to the first device.
[0220] A communication connection is established with the second device that sent the communication connection request, and the media resources are transmitted between the first device and the second device based on the communication connection.
[0221] In one implementation, the second device is configured with connection establishment conditions, which indicate the data fragments that the second device and the first device need to obtain from the first device before establishing a communication connection.
[0222] The second device determines that it supports transmitting the media resources with the first device if it determines that the connection establishment conditions between the second device and the first device are met based on the data fragments in the received broadcast message.
[0223] In another embodiment, the first device is the device to receive the media resource, and the connection establishment condition is further used to indicate that the second device must contain the media resource;
[0224] Accordingly, when transmitting the media resources between the first device and the second device based on the communication connection, the one or more instructions can be loaded and specifically executed by the processor: receiving the media resources sent by the second device based on the communication connection.
[0225] In another embodiment, the first device is the device to send the media resource, and the connection establishment condition is further used to indicate that the second device supports running the media resource;
[0226] Accordingly, when transmitting the media resources between the first device and the second device based on the communication connection, the one or more instructions can be loaded and specifically executed by the processor: based on the communication connection, send the media resources to the second device.
[0227] In another implementation, when broadcasting the N broadcast messages in a communication scenario, the one or more instructions can be loaded and executed by the processor:
[0228] A message list is constructed based on the N broadcast messages. The message list includes multiple message elements arranged in sequence, and each message element corresponds to one broadcast message.
[0229] The message elements in the message list are polled according to a preset polling direction, and the broadcast message corresponding to the currently polled message element is broadcast in the communication scenario.
[0230] In another implementation, when constructing a message list based on N broadcast messages, the one or more instructions can be loaded and executed by the processor:
[0231] Construct a new list, which is an empty list for storing message elements, where each message element is an element used to refer to a broadcast message;
[0232] Obtain the weight of each of the N broadcast messages. The weight of any broadcast message is proportional to the frequency of its occurrence during the broadcast of the N broadcast messages.
[0233] The message elements of each broadcast message are added to the new list in sequence according to the weight of each broadcast message to obtain the message list; wherein the number of message elements of any broadcast message in the message list is proportional to the weight of the corresponding broadcast message.
[0234] In another implementation, when polling each message element in the message list according to a preset polling direction, the one or more instructions can be loaded and executed by the processor:
[0235] Obtain the first time interval, which refers to the time interval between two consecutive broadcast messages;
[0236] According to the preset polling direction, each message element in the message list is polled based on the first time interval, and one message element is polled at a time.
[0237] In another implementation, when polling each message element in the message list according to a preset polling direction, the one or more instructions can be loaded and executed by the processor:
[0238] Obtain a second time interval, which refers to the time interval between two consecutive broadcast messages; wherein the total length of the data to be processed in each broadcast message in any group of broadcast messages matches a length threshold, and the data to be processed includes data fragments;
[0239] According to the preset polling direction, each message element in the message list is polled based on the second time interval. At least one message element is polled each time, and the broadcast messages corresponding to each polled message element constitute a set of broadcast messages.
[0240] In another implementation, when broadcasting the broadcast message corresponding to the currently polled message element in the communication scenario, the one or more instructions can be loaded and executed by the processor:
[0241] During the second time interval, broadcast messages corresponding to each currently polled message element are broadcast sequentially in the communication scenario;
[0242] Alternatively, the broadcast messages corresponding to each of the currently polled message elements can be integrated to obtain a new broadcast message, which can then be broadcast in the communication scenario.
[0243] In another implementation, when polling each message element in the message list according to a preset polling direction, the one or more instructions can be loaded and executed by the processor:
[0244] Obtain the preset polling frequency for the message list, whereby the polling frequency is used to indicate the interval between two consecutive polling operations performed on the message list;
[0245] The frequency adjustment trigger event is detected, and the frequency adjustment trigger event includes at least one of the following: the number of other devices that have established a communication connection with the first device is greater than a number threshold, and the environmental noise intensity of the communication scenario is greater than an intensity threshold;
[0246] If the frequency adjustment trigger event is detected, the polling frequency is adjusted, and each packet element in the packet list is polled according to the preset polling direction based on the adjusted polling frequency.
[0247] In another implementation, after polling all message elements in the message list, the one or more instructions can be loaded and executed by the processor:
[0248] Re-polle each message element in the message list and broadcast the broadcast message corresponding to the currently polled message element in the communication scenario.
[0249] In another implementation, the one or more instructions may be loaded and executed by the processor:
[0250] During the broadcasting of the nth broadcast message among the N broadcast messages, the environmental noise intensity of the communication scenario is detected, where n∈[1,N];
[0251] If the ambient noise intensity is greater than the intensity threshold, the nth broadcast message is broadcast K times, where K is a positive integer.
[0252] In this embodiment, a first device can acquire N broadcast messages, each containing different data fragments. These data fragments in the N broadcast messages indicate the media resources to be transmitted by the first device. Furthermore, the first device can broadcast the N broadcast messages in a communication scenario. A second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that it supports transmitting media resources with the first device before sending a communication connection request to the first device. This allows the first device to establish a valid communication connection with the second device that sent the request, and to transmit media resources between the first and second devices based on this valid connection. This avoids situations where media resources cannot be transmitted after a communication connection is established, reducing connection and time costs and improving the success rate and efficiency of resource transmission. Furthermore, by using N data fragments to construct N broadcast messages, not only can the broadcast message failure due to excessively long data fragments be avoided, thus improving the broadcast success rate, but the uniqueness of each data fragment in the broadcast message is also ensured, preventing duplication during the broadcast of N broadcast messages. This facilitates the second device's identification of the data fragments in each broadcast message, thereby improving the accuracy of the second device's judgment on whether it supports the transmission of media resources with the first device based on the data fragments. This, in turn, improves the accuracy of subsequent communication connection establishment, and further enhances the success rate and efficiency of resource transmission.
[0253] It should be noted that, according to one aspect of this application, a computer program product or computer program is also provided, comprising one or more instructions stored in a computer storage medium. A processor of a computer device reads one or more instructions from the computer storage medium and executes the one or more instructions, causing the computer device to perform the methods provided in various optional embodiments of the above-described methods. It should be understood that the above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, equivalent variations made according to the claims of this application are still within the scope of this application.
Claims
1. A resource transmission method, characterized in that, include: Obtain N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device; In a communication scenario, the N broadcast messages are broadcast, so that the second device in the communication scenario, based on the data fragments in the received broadcast messages, determines that the second device supports the transmission of the media resources with the first device, and then sends a communication connection request to the first device. A communication connection is established with the second device that sent the communication connection request, and the media resources are transmitted between the first device and the second device based on the communication connection.
2. The method as described in claim 1, characterized in that, The second device is configured with connection establishment conditions, which indicate the data fragments that the second device and the first device need to obtain from the first device before establishing a communication connection. The second device determines that it supports transmitting the media resources with the first device if it determines that the connection establishment conditions between the second device and the first device are met based on the data fragments in the received broadcast message.
3. The method as described in claim 1 or 2, characterized in that, The first device is the device to receive the media resource, and the connection establishment condition is further used to indicate that the second device must contain the media resource; The transmission of the media resources between the first device and the second device based on the communication connection includes: receiving the media resources sent by the second device based on the communication connection.
4. The method according to any one of claims 1-3, characterized in that, The first device is the device to send the media resource, and the connection establishment condition is also used to indicate that the second device supports running the media resource; The transmission of the media resources between the first device and the second device based on the communication connection includes: sending the media resources to the second device based on the communication connection.
5. The method according to any one of claims 1-4, characterized in that, The broadcasting of the N broadcast messages in the communication scenario includes: A message list is constructed based on the N broadcast messages. The message list includes multiple message elements arranged in sequence, and each message element corresponds to one broadcast message. The message elements in the message list are polled according to a preset polling direction, and the broadcast message corresponding to the currently polled message element is broadcast in the communication scenario.
6. The method according to any one of claims 1-5, characterized in that, The process of constructing a message list based on N broadcast messages includes: Construct a new list, which is an empty list for storing message elements, where each message element is an element used to refer to a broadcast message; Obtain the weight of each of the N broadcast messages. The weight of any broadcast message is proportional to the frequency of its occurrence during the broadcast of the N broadcast messages. The message elements of each broadcast message are added to the new list in sequence according to the weight of each broadcast message to obtain the message list; wherein the number of message elements of any broadcast message in the message list is proportional to the weight of the corresponding broadcast message.
7. The method according to any one of claims 1-6, characterized in that, The step of polling each message element in the message list according to a preset polling direction includes: Obtain the first time interval, which refers to the time interval between two consecutive broadcast messages; According to the preset polling direction, each message element in the message list is polled based on the first time interval, and one message element is polled at a time.
8. The method according to any one of claims 1-7, characterized in that, The step of polling each message element in the message list according to a preset polling direction includes: Obtain a second time interval, which refers to the time interval between two consecutive broadcast messages; wherein the total length of the data to be processed in each broadcast message in any group of broadcast messages matches a length threshold, and the data to be processed includes data fragments; According to the preset polling direction, each message element in the message list is polled based on the second time interval. At least one message element is polled each time, and the broadcast messages corresponding to each polled message element constitute a set of broadcast messages.
9. The method according to any one of claims 1-8, characterized in that, The broadcast message corresponding to the currently polled message element in the communication scenario includes: During the second time interval, broadcast messages corresponding to each currently polled message element are broadcast sequentially in the communication scenario; Alternatively, the broadcast messages corresponding to each of the currently polled message elements can be integrated to obtain a new broadcast message, which can then be broadcast in the communication scenario.
10. The method according to any one of claims 1-9, characterized in that, The step of polling each message element in the message list according to a preset polling direction includes: Obtain the preset polling frequency for the message list, whereby the polling frequency is used to indicate the interval between two consecutive polling operations performed on the message list; The frequency adjustment trigger event is detected, and the frequency adjustment trigger event includes at least one of the following: the number of other devices that have established a communication connection with the first device is greater than a number threshold, and the environmental noise intensity of the communication scenario is greater than an intensity threshold; If the frequency adjustment trigger event is detected, the polling frequency is adjusted, and each packet element in the packet list is polled according to the preset polling direction based on the adjusted polling frequency.
11. The method according to any one of claims 1-10, characterized in that, After polling each message element in the message list, the method further includes: Re-polle each message element in the message list and broadcast the broadcast message corresponding to the currently polled message element in the communication scenario.
12. The method according to any one of claims 1-11, characterized in that, The method further includes: During the broadcasting of the nth broadcast message among the N broadcast messages, the environmental noise intensity of the communication scenario is detected, where n∈[1,N]; If the ambient noise intensity is greater than the intensity threshold, the nth broadcast message is broadcast K times, where K is a positive integer.
13. The method according to any one of claims 1-12, characterized in that, Each broadcast message contains a data field, which is used to store data fragments in the broadcast message; For the nth broadcast message, if the data fragment in the nth broadcast message does not fill the corresponding data field, then each data bit in the corresponding data field that does not store the data fragment is filled with a preset value; where n∈[1,N].
14. The method according to any one of claims 1-13, characterized in that, Each broadcast message contains a data field and a check field, with the check field following and adjacent to the data field. The data field is used to store data fragments in the broadcast message, and the verification field is used to store data error correction codes. If the data fragments in each broadcast message do not fill the corresponding data field, then the last H remaining data bits in the data field contained in each broadcast message are used together with the check field in the corresponding broadcast message to store the data error correction code. The remaining data bits refer to the data bits that have not been stored in the data slices, and the value of H is the minimum number of remaining data bits in the data fields contained in the N broadcast messages.
15. A resource transmission device, characterized in that, include: The acquisition unit is used to acquire N broadcast messages, where N is a positive integer; different broadcast messages include different data segments, and the data segments in the N broadcast messages are used to indicate the media resources to be transmitted by the first device; The processing unit is configured to broadcast the N broadcast messages in a communication scenario, so that after determining that the second device in the communication scenario supports the transmission of the media resources with the first device based on the data fragments in the received broadcast messages, the second device sends a communication connection request to the first device. The processing unit is further configured to establish a communication connection with the second device that sent the communication connection request, and to transmit the media resources between the first device and the second device based on the communication connection.
16. A computer device, comprising an input interface and an output interface, characterized in that, Also includes: Processor and computer storage media; The processor is adapted to implement one or more instructions, the computer storage medium stores one or more instructions, and the one or more instructions are adapted to be loaded by the processor and executed according to any one of claims 1-14.
17. A computer storage medium, characterized in that, The computer storage medium stores one or more instructions, which are adapted to be loaded by a processor and executed by the resource transfer method according to any one of claims 1-14.