Data transmission method and device, electronic equipment and storage medium
By configuring dedicated and shared bandwidth between the USB host and slave devices to transmit different types of service streams, the problem of not being able to meet the real-time control requirements of multiple devices in the existing technology is solved, and efficient and orderly data transmission is achieved.
Patent Information
- Application Number
- CN202511768138.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2025-12-30
- Estimated Expiration
- 2045-11-28
AI Technical Summary
Existing USB data transfer methods cannot meet the real-time control requirements of multiple external devices, and the abstraction of the transfer method into a composite device results in high software overhead, affecting processing efficiency and time.
By configuring dedicated bandwidth and shared bandwidth between the USB host and slave devices, different types of service flows can be transmitted respectively. Dedicated bandwidth is matched with high-priority devices, and shared bandwidth is used for low-priority devices. Service flows of high-priority devices are transmitted through dedicated bandwidth, while service flows of low-priority devices are transmitted through shared bandwidth.
It enables real-time data transmission between the host and multiple external devices, reducing communication difficulty and resource consumption, and ensuring the orderliness and efficiency of data transmission.
Smart Images

Figure CN121239652A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data transmission, and more particularly to a data transmission method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the widespread application of streaming technology in the USB (Universal Serial Bus) transmission field, the host end (i.e., the master) can transmit different service streams to the device end (i.e., the slave) according to different control units to achieve the control purpose of various devices.
[0003] In existing technologies, a USB host abstracts multiple external devices into a composite device and switches the composite device interface according to different operation targets. After the USB slave switches to the target device, it receives the corresponding data to control different external devices. Alternatively, the USB host abstracts external devices into a fixed device class and establishes a software protocol before data transmission. Before sending the data stream, it inserts fields such as data type and data length and guides the USB slave to control the corresponding external device according to the parsing result.
[0004] However, the above-mentioned transmission method, which is abstracted as a composite device, can only control one external device at a time, and cannot meet the real-time control requirements of multiple external devices. On the other hand, the transmission method, which is abstracted as a fixed device, not only greatly increases the software overhead, but also affects the processing efficiency and processing time of the entire USB system. Summary of the Invention
[0005] This invention provides a data transmission method, apparatus, electronic device, and storage medium to solve the problem of low data transmission efficiency between a USB host and a USB slave.
[0006] According to one aspect of the present invention, a data transmission method is provided, applied to a host, comprising:
[0007] In response to acquiring data to be transmitted, the first service flow in the data to be transmitted, whose receiving object is a first type of device, is configured in the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device;
[0008] The second service flow in the data to be transmitted, whose receiving object is a second type of device, is configured in the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device;
[0009] The data to be transmitted is sent to the slave device via the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device.
[0010] The step of configuring the first service flow, in which the receiving object is a first type of device, in the data to be transmitted to the corresponding dedicated bandwidth includes: configuring the first service flow and the device identifier of the first type of device to the corresponding dedicated bandwidth.
[0011] The second type of device includes instantaneous devices and time-consuming devices, with the instantaneous devices having a higher priority than the time-consuming devices.
[0012] Before acquiring the data to be transmitted, the process further includes configuring a first input endpoint, a second input endpoint, a first output endpoint, and a second output endpoint through an abstract class; wherein, the first output endpoint is used by the host to send first configuration information to the slave; the second output endpoint is used by the host to send transmission data to the slave; the first input endpoint is used by the slave to send second configuration information to the host; and the second input endpoint is used by the slave to send transmission data to the host.
[0013] After configuring the first input endpoint, the second input endpoint, the first output endpoint, and the second output endpoint through an abstract class, the method further includes: configuring dedicated bandwidth and shared bandwidth according to user configuration information, and sending the configuration result as first configuration information to the slave device, or configuring dedicated bandwidth and shared bandwidth according to second configuration information sent by the slave device; wherein the first configuration information and the second configuration information include the identifier and required bandwidth of each first type of device, and the identifier of each second type of device.
[0014] After configuring the first input endpoint, second input endpoint, first output endpoint, and second output endpoint through an abstract class, the method further includes: if the digit occupancy rate of the first dedicated bandwidth is determined to be less than a preset occupancy threshold based on historical transmission records, bandwidth reduction processing is performed on the first dedicated bandwidth; if the data delay frequency of the second dedicated bandwidth is determined to be greater than a preset frequency threshold based on historical transmission records, bandwidth expansion processing is performed on the second dedicated bandwidth; and the bandwidth update result is sent to the slave device through the second configuration information; wherein the bandwidth update result includes bandwidth reduction result and / or bandwidth expansion result.
[0015] According to another aspect of the present invention, a data transmission apparatus is provided, applied to a host computer, comprising:
[0016] A dedicated bandwidth configuration module is used to, in response to the acquisition of data to be transmitted, configure the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device;
[0017] The shared bandwidth configuration module is used to configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device.
[0018] The data transmission execution module is used to send the data to be transmitted to the slave device through the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device.
[0019] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0020] At least one processor; and
[0021] A memory communicatively connected to the at least one processor; wherein,
[0022] The memory stores a computer program that can be executed by the at least one processor, which enables the at least one processor to perform the data transmission method described in any embodiment of the present invention.
[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the data transmission method described in any embodiment of the present invention.
[0024] According to another aspect of the present invention, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the data transmission method described in any embodiment of the present invention.
[0025] The technical solution of this invention, after acquiring the data to be transmitted, configures a first service flow whose receiving object is a first type of device in the data to be transmitted on a corresponding dedicated bandwidth; configures a second service flow whose receiving object is a second type of device on a shared bandwidth; finally, through the dedicated bandwidth and the shared bandwidth, the first service flow is sent to the corresponding first type of device, and the second service flow is sent to the corresponding second type of device. This not only achieves real-time data transmission between the host and multiple external devices, but also avoids the defects of controlling different external devices by defining various data packets through software protocols, reduces the communication difficulty between the host and slave devices, reduces the resource consumption during data transmission, and ensures orderly data transmission even when service flow exceeds bandwidth.
[0026] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0027] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 This is a flowchart of a data transmission method provided according to Embodiment 1 of the present invention;
[0029] Figure 2 This is a flowchart of another data transmission method provided according to Embodiment 2 of the present invention;
[0030] Figure 3 This is a flowchart of another data transmission method provided according to Embodiment 3 of the present invention;
[0031] Figure 4 This is a schematic diagram of a data transmission device according to Embodiment 4 of the present invention;
[0032] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the data transmission method of this invention. Detailed Implementation
[0033] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0034] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0035] Example 1
[0036] Figure 1 This is a flowchart of a data transmission method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where different types of service flows are configured according to dedicated bandwidth and shared bandwidth. This method can be executed by the data transmission device in any embodiment of the present invention. The data transmission device can be implemented in hardware and / or software, and can be configured in a USB host (i.e., the host end). Figure 1 As shown, the method includes:
[0037] S101. In response to obtaining the data to be transmitted, the first service flow in the data to be transmitted, whose receiving object is a first type of device, is configured in the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device.
[0038] The USB host and USB slave are connected via a USB interface, which is pre-divided into dedicated bandwidth and shared bandwidth. The dedicated bandwidth refers to the bandwidth exclusively used by a specific type 1 device. No other type 2 device or other type 1 device has the right to use this bandwidth. The dedicated bandwidth is matched one-to-one with the type 1 device, meaning that each dedicated bandwidth provides data transmission service to only one type 1 device, and each type 1 device can only transmit data through one dedicated bandwidth.
[0039] According to the USB Stream protocol, the host allocates a service stream to each type of Type 1 and Type 2 device. At the same time, the host calculates the specific bandwidth occupied by the dedicated bandwidth corresponding to the current Type 1 device based on its transmission rate. For example, 256KB of dedicated bandwidth is allocated to the audio device in Type 1 devices, and 512KB of dedicated bandwidth is allocated to the microphone device in Type 2 devices. The bandwidth occupied by the dedicated bandwidth is always reserved for use by Type 1 devices at any time, thereby ensuring the real-time transmission of data by Type 1 devices.
[0040] The first type of devices can be pre-configured according to the specific application scenarios of the USB host and USB slave. For example, in the smart security scenario, devices such as cameras, video recorders and alarms can be defined as first type devices; in the smart furniture scenario, devices such as fresh air systems, smart sensor lights and smart TVs can be defined as first type devices; in the smart office scenario, devices such as printers, scanners and fax machines can be defined as first type devices.
[0041] Specifically, to ensure that the service flow matches the external device, the bandwidth in the USB interface can be pre-divided. For example, the first 256KB is matched with device A of type 1, the second 256KB with device B of type 1, and the third 256KB with device C of type 1. When device A and device C of type 1 have data transmission, the corresponding service flow is configured in the first 256KB and the third 256KB respectively, while the second 256KB is left empty. For example, all bits in the second 256KB are 0. In this way, the USB slave device can determine which type 1 device's service flow is included in the current data transmission based on the distribution of the service flow.
[0042] Accordingly, when the USB host obtains the data to be transmitted through the host computer or other devices, it parses and obtains the service flow in the data to be transmitted. The service flow may include the service flow of one or more first type devices, that is, the first service flow. Each first service flow is matched with the corresponding dedicated bandwidth and sent to the USB slave through the dedicated bandwidth; if there is no dedicated channel for the first service flow, the data is kept empty.
[0043] Optionally, in this embodiment of the invention, configuring the first service flow whose receiving object is a first type of device in the data to be transmitted to the corresponding dedicated bandwidth includes: configuring the first service flow and the device identifier of the first type of device to the corresponding dedicated bandwidth. Specifically, after obtaining the first service flow, the device identifier of the corresponding first type of device can be added to each first service flow, so that the first service flow sent by the USB host is actually a combination of "device identifier + first service flow".
[0044] After acquiring the transmission data, the USB slave device can determine which external device the current service flow belongs to based on the device identifier. At the same time, the device identifier can also determine the bandwidth value corresponding to that external device. Then, it sends the data of a specified number of bits after the device identifier to the external device. Thus, when configuring the transmission data, the USB host does not need to configure empty data or configure according to the bandwidth position. It can connect each first service flow sequentially and distinguish them by the device identifier. This ensures the orderly transmission of the first service flow, reduces the configuration complexity of the transmission data, and improves the data transmission efficiency.
[0045] S102. Configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device.
[0046] The second type of device is an external device with lower real-time requirements for data transmission. Its priority is lower than that of the first type of device. Unlike the first type of device, the service flow of the second type of device does not have dedicated bandwidth. Instead, all the service flows of the second type of device share the shared bandwidth. The second service flow with current transmission needs is configured in the shared bandwidth. Therefore, even if the addition of a new second type of device causes the shared bandwidth to exceed the bandwidth limit, it will not affect the use of the dedicated bandwidth of the first type of device.
[0047] Specifically, since multiple secondary service flows share bandwidth, and each secondary service flow does not have a fixed data location, the USB host needs to attach a corresponding device identifier to each secondary service flow. This allows the USB slave to directly obtain the corresponding secondary service flow based on the parsed device identifier. Similarly, after obtaining the transmission data, the USB slave can determine which secondary device the current secondary service flow belongs to based on the device identifier. It can also determine the bandwidth value corresponding to that device based on the device identifier, and then send the specified number of bits of data after the device identifier to the external device.
[0048] If the number of second service streams to be sent at the current moment is too large and the shared bandwidth cannot meet the transmission requirements of all second service streams at the same time, some second service streams can be configured in the shared bandwidth, and then the above-mentioned partial second service streams can be sent first. The remaining second service streams can be sent again after a one-transmission cycle. In this way, when multiple second service streams exceed the transmission bandwidth of the USB interface, the delayed transmission of some transmission data is achieved, ensuring the orderly transmission of the second service streams.
[0049] Optionally, in this embodiment of the invention, the second type of device includes instantaneous devices and time-consuming devices, with the instantaneous devices having a higher priority than the time-consuming devices. Specifically, instantaneous devices refer to external devices with short communication times that do not require continuous data transmission via the USB interface, such as smart lights, smart refrigerators, and printers; time-consuming devices refer to external devices with longer communication times that require continuous data transmission via the USB interface. Typically, as long as the host computer of the USB device is not turned off, the USB interface needs to continuously transmit data, such as cameras, speakers, and microphones. Instantaneous devices and time-consuming devices can be pre-planned, and each external device can be configured with a corresponding device category.
[0050] In addition, the USB host can also classify each type of device based on the amount or frequency of data transfer over a period of time. If the amount of data transfer is greater than a preset data threshold or the frequency of data transfer is greater than a preset frequency threshold, the current type of device is determined to be a time-consuming device; if the amount of data transfer is less than or equal to the preset data threshold or the frequency of data transfer is less than or equal to the preset frequency threshold, the current type of device is determined to be a momentary device.
[0051] If the current second service flow is a service flow from a time-consuming device, and the current shared bandwidth cannot support its transmission, then wait for the second type of device in communication to finish communicating before configuring the current second service flow in the shared bandwidth; if the current shared bandwidth can support its transmission, then configure the second service flow directly in the shared bandwidth. If the current second service flow is a service flow from a momentary device, and the current shared bandwidth cannot support its transmission, determine if there is currently a time-consuming device in communication.
[0052] If a time-consuming device is in communication, its transmission is paused, and the current second service flow is prioritized for allocation to the shared bandwidth. Once the current second service flow is completed, the service flow from the paused time-consuming device resumes transmission. If no time-consuming device is in communication, the current second service flow is allocated to the shared bandwidth only when idle bandwidth becomes available. If the shared bandwidth can handle the current second service flow, it can be directly allocated to it. This avoids prolonged occupation of the shared bandwidth by time-consuming devices and ensures the timeliness of data transmission for instantaneous devices.
[0053] S103. The data to be transmitted is sent to the slave device through the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device.
[0054] After the USB host sends the data to be transmitted to the USB slave via the USB interface, the USB slave determines the correspondence between the first service flow and the first type of device by the distribution location of the first service flow in the dedicated bandwidth or the device identifier in the first service flow, and then sends the first service flow to the corresponding external device. Similarly, the USB slave determines the correspondence between the second service flow and the second type of device by the device identifier of the second service flow in the shared bandwidth, and then sends the second service flow to the corresponding external device, thereby completing the data transmission between the USB host and the USB slave.
[0055] The technical solution of this invention, after acquiring the data to be transmitted, configures a first service flow whose receiving object is a first type of device in the data to be transmitted on a corresponding dedicated bandwidth; configures a second service flow whose receiving object is a second type of device on a shared bandwidth; finally, through the dedicated bandwidth and the shared bandwidth, the first service flow is sent to the corresponding first type of device, and the second service flow is sent to the corresponding second type of device. This not only achieves real-time data transmission between the host and multiple external devices, but also avoids the defects of controlling different external devices by defining various data packets through software protocols, reduces the communication difficulty between the host and slave devices, reduces the resource consumption during data transmission, and ensures orderly data transmission even when service flow exceeds bandwidth.
[0056] Example 2
[0057] Figure 2 This is a flowchart of a data transmission method provided in Embodiment 2 of the present invention. The relationship between this embodiment and the above embodiments is that multiple communication endpoints are configured through an abstract class, such as... Figure 2 As shown, the method includes:
[0058] S201. Configure a first input endpoint, a second input endpoint, a first output endpoint, and a second output endpoint through an abstract class; wherein, the first output endpoint is used by the host to send first configuration information to the slave; the second output endpoint is used by the host to send transmission data to the slave; the first input endpoint is used by the slave to send second configuration information to the host; and the second input endpoint is used by the slave to send transmission data to the host.
[0059] Abstract classes cannot be directly instantiated, but can be inherited by other classes and their abstract methods can be implemented. The output endpoint, also known as the bluk-on endpoint, is used by the USB host to send data to the USB slave. The input endpoint, also known as the bluk-in endpoint, is used by the USB slave to send data to the USB host. Specifically, the first output endpoint is used by the USB host to send configuration information (i.e., the first configuration information) to the USB slave. For example, when the data flow is from the USB host to the USB slave, the USB host pre-sends bandwidth parameters for dedicated and shared bandwidth to the USB slave. The second output endpoint is used by the USB host to send transmission data to the USB slave, i.e., to send the first and second service flows in the above technical solution.
[0060] The first input endpoint is used for the USB slave to send configuration information (i.e., the second configuration information) to the USB host. For example, when the data flow is from the USB slave to the USB host, the USB slave sends bandwidth parameters of dedicated bandwidth and shared bandwidth to the USB host in advance. The second input endpoint is used for the USB slave to send transmission data to the USB host, that is, to send the first service flow and the second service flow.
[0061] Optionally, in this embodiment of the invention, after configuring the first input endpoint, the second input endpoint, the first output endpoint, and the second output endpoint through an abstract class, the method further includes: configuring dedicated bandwidth and shared bandwidth according to user configuration information, and sending the configuration result as first configuration information to the slave device, or configuring dedicated bandwidth and shared bandwidth according to second configuration information sent by the slave device; wherein the first configuration information and the second configuration information include the identifier and required bandwidth of each first type of device, and the identifier of each second type of device.
[0062] Specifically, regardless of whether the data flow is from the USB host to the USB slave or from the USB slave to the USB host, the configuration of dedicated bandwidth and shared bandwidth can be completed by the business personnel. After obtaining the user configuration information, the USB host completes the configuration of dedicated bandwidth and shared bandwidth. The first configuration information specifically includes the identifier and required bandwidth of each first type of device, as well as the identifier of each second type of device, or the distribution location of the dedicated bandwidth of the first type of device, and then sends it to the USB slave to inform the USB slave of the specific bandwidth allocation result.
[0063] Meanwhile, since the USB slave device communicates with each external device, it can also send second configuration information based on the specific type of each connected external device. The second configuration information also specifically includes the identifier and required bandwidth of each first type of device, as well as the identifier of each second type of device, or the distribution location of the dedicated bandwidth of the first type of device. This information is then sent to the USB host to inform the USB host of the specific bandwidth allocation result. In this way, configuration information can be transmitted in different directions through the first input endpoint and the first output endpoint, ensuring bidirectional transmission of bandwidth parameters for dedicated bandwidth and shared bandwidth.
[0064] Optionally, in this embodiment of the invention, after configuring the first input endpoint, the second input endpoint, the first output endpoint, and the second output endpoint through an abstract class, the method further includes: if the digit occupancy rate of the first dedicated bandwidth is determined to be less than a preset occupancy threshold based on historical transmission records, performing bandwidth reduction processing on the first dedicated bandwidth; if the data delay frequency of the second dedicated bandwidth is determined to be greater than a preset frequency threshold based on historical transmission records, performing bandwidth expansion processing on the second dedicated bandwidth; and sending the bandwidth update result to the slave device through the second configuration information; wherein the bandwidth update result includes bandwidth reduction result and / or bandwidth expansion result.
[0065] Specifically, the dedicated bandwidth allocated by the USB host to each Type 1 device may have calculation errors, or the Type 1 device may change its service type due to service adjustments, which may also change its corresponding dedicated bandwidth. The required bandwidth may increase or decrease. Therefore, if the bit occupancy rate of the first dedicated bandwidth is less than the preset occupancy threshold based on historical transmission records, it indicates that the first dedicated bandwidth is too large and there are unused data bits. Based on this, the bandwidth of the first dedicated bandwidth is reduced.
[0066] If, based on historical transmission records, the frequency of data delays on the second dedicated bandwidth exceeds a preset threshold, it indicates that the second dedicated bandwidth is too small and frequently fails to meet data transmission requirements, resulting in data transmission delays. Therefore, the capacity of the second dedicated bandwidth is increased. This update of the dedicated bandwidth based on historical transmission records avoids both excessive bandwidth, which would waste transmission resources, and ensures that the dedicated bandwidth meets the real-time requirements of data transmission, preventing data transmission delays.
[0067] S202. The bandwidth configuration result is sent to the slave device through the first output endpoint.
[0068] S203. In response to acquiring the data to be transmitted, the first service flow in the data to be transmitted, whose receiving object is a first type of device, is configured in the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device.
[0069] S204. Configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device.
[0070] S205. Using the dedicated bandwidth and the shared bandwidth, the data to be transmitted is sent to the slave device based on the second output endpoint, so that the slave device can send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device.
[0071] In the technical solution of this invention, after the USB host configures the first input endpoint, the second input endpoint, the first output endpoint, and the second output endpoint through an abstract class, it completes the bandwidth information configuration through the first input endpoint or the first output endpoint. This not only ensures bidirectional transmission of bandwidth parameters for dedicated bandwidth and shared bandwidth, but also avoids the phenomenon of excessive dedicated bandwidth causing waste of transmission resources, and ensures that the dedicated bandwidth meets the real-time requirements of data transmission, preventing data transmission delays.
[0072] Example 3
[0073] Figure 3 This is a flowchart of a data transmission method provided in Embodiment 3 of the present invention. This embodiment can be configured in a USB slave device (i.e., the device end) to receive different types of service streams according to dedicated bandwidth and shared bandwidth, such as... Figure 3 As shown, the method includes:
[0074] S301. Obtain the first service flow through dedicated bandwidth and send the first service flow to the corresponding first type of device.
[0075] S302. Obtain the second service flow through shared bandwidth and send the second service flow to the corresponding second type of device.
[0076] As described in the above technical solution, the USB slave device determines the correspondence between the first service flow and the first type of device by the distribution location of the first service flow in the dedicated bandwidth or the device identifier in the first service flow, and then sends the first service flow to the corresponding external device; at the same time, it determines the correspondence between the second service flow and the second type of device by the device identifier of the second service flow in the shared bandwidth, and then sends the second service flow to the corresponding external device, thereby completing the data transmission between the USB host and the USB slave device.
[0077] The technical solution of this invention involves a USB slave device acquiring a first service stream through dedicated bandwidth and sending it to a corresponding first-type device. It then acquires a second service stream through shared bandwidth and sends it to a corresponding second-type device. This not only achieves real-time data transmission between the host and multiple external devices but also avoids the drawbacks of controlling different external devices by defining various data packets through software protocols. It reduces the communication difficulty between the host and slave devices, decreases resource consumption during data transmission, and ensures orderly data transmission even when service streams exceed bandwidth limits.
[0078] Example 4
[0079] Figure 4 This is a structural block diagram of a data transmission device provided in Embodiment 4 of the present invention, specifically including:
[0080] The dedicated bandwidth configuration module 401 is used to, in response to the acquisition of data to be transmitted, configure the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one by one with the first type of device;
[0081] The shared bandwidth configuration module 402 is used to configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device.
[0082] The data transmission execution module 403 is used to send the data to be transmitted to the slave device through the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device.
[0083] The technical solution of this invention, after acquiring the data to be transmitted, configures a first service flow whose receiving object is a first type of device in the data to be transmitted on a corresponding dedicated bandwidth; configures a second service flow whose receiving object is a second type of device on a shared bandwidth; finally, through the dedicated bandwidth and the shared bandwidth, the first service flow is sent to the corresponding first type of device, and the second service flow is sent to the corresponding second type of device. This not only achieves real-time data transmission between the host and multiple external devices, but also avoids the defects of controlling different external devices by defining various data packets through software protocols, reduces the communication difficulty between the host and slave devices, reduces the resource consumption during data transmission, and ensures orderly data transmission even when service flow exceeds bandwidth.
[0084] Optionally, the dedicated bandwidth configuration module 401 is specifically used to configure the first service flow and the device identifier of the first type of device in the corresponding dedicated bandwidth.
[0085] Optionally, the second type of device includes instantaneous devices and time-consuming devices, with the instantaneous devices having a higher priority than the time-consuming devices.
[0086] Optionally, the data transmission device is further configured to configure a first input endpoint, a second input endpoint, a first output endpoint, and a second output endpoint through an abstract class; wherein, the first output endpoint is used for the host to send first configuration information to the slave; the second output endpoint is used for the host to send transmission data to the slave; the first input endpoint is used for the slave to send second configuration information to the host; and the second input endpoint is used for the slave to send transmission data to the host.
[0087] Optionally, the data transmission device is further configured to configure dedicated bandwidth and shared bandwidth according to user configuration information, and send the configuration result as first configuration information to the slave device; wherein the first configuration information includes the identifier and required bandwidth of each first type of device, and the identifier of each second type of device; or configure dedicated bandwidth and shared bandwidth according to second configuration information sent by the slave device; wherein the second configuration information includes the identifier and required bandwidth of each first type of device, and the identifier of each second type of device.
[0088] Optionally, the data transmission device is further configured to: if the digit occupancy rate of the first dedicated bandwidth is determined to be less than a preset occupancy threshold based on historical transmission records; and if the data delay frequency of the second dedicated bandwidth is determined to be greater than a preset frequency threshold based on historical transmission records; and to send the bandwidth update result to the slave device through the second configuration information; wherein the bandwidth update result includes bandwidth reduction result and / or bandwidth expansion result.
[0089] The above-described apparatus can execute the data transmission method provided in Embodiment 1 or Embodiment 2 of the present invention, and has the corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be found in the data transmission method provided in any embodiment of the present invention.
[0090] Example 5
[0091] Figure 5A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, electronic devices, blade electronic devices, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0092] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0093] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0094] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as data transfer methods.
[0095] In some embodiments, the data transfer method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed on a heterogeneous hardware accelerator via ROM and / or a communication unit. When the computer program is loaded into RAM and executed by a processor, one or more steps of the data transfer method described above may be performed. Alternatively, in other embodiments, the processor may be configured to perform the data transfer method by any other suitable means (e.g., by means of firmware).
[0096] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0097] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or electronic device.
[0098] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0099] To provide user interaction, the systems and techniques described herein can be implemented on a heterogeneous hardware accelerator, which includes: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the heterogeneous hardware accelerator. Other types of devices can also be used to provide user interaction; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or haptic feedback); and input from the user can be received in any form (including sound input, voice input, or haptic input).
[0100] The systems and technologies described herein can be implemented in computing systems that include back-end components (e.g., as data electronic devices), or computing systems that include middleware components (e.g., application electronic devices), or computing systems that include front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and technologies described herein), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0101] A computing system can include clients and electronic devices. Clients and electronic devices are generally geographically separated and typically interact via communication networks. The client-electronic device relationship is created by computer programs running on the respective computers and establishing a client-electronic device relationship between them. Electronic devices can be cloud electronic devices, also known as cloud computing electronic devices or cloud servers, which are hosting products within the cloud computing service ecosystem. These address the shortcomings of traditional physical hosting and VPS services, such as high management difficulty and weak business scalability.
[0102] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0103] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A data transmission method, characterized in that, Applied to the host, including: In response to acquiring data to be transmitted, the first service flow in the data to be transmitted, whose receiving object is a first type of device, is configured in the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device; The second service flow in the data to be transmitted, whose receiving object is a second type of device, is configured in the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device; The data to be transmitted is sent to the slave device via the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and the second service flow to the corresponding second type device.
2. The method according to claim 1, characterized in that, The step of configuring the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth includes: Configure the first service flow and the device identifier of the first type of device in the corresponding dedicated bandwidth.
3. The method according to claim 1, characterized in that, The second type of device includes instantaneous devices and time-consuming devices, with the instantaneous devices having a higher priority than the time-consuming devices.
4. The method according to claim 1, characterized in that, Before acquiring the data to be transmitted, the process also includes: An abstract class is used to configure a first input endpoint, a second input endpoint, a first output endpoint, and a second output endpoint. The first output endpoint is used by the host to send first configuration information to the slave device; the second output endpoint is used by the host to send transmission data to the slave device; the first input endpoint is used by the slave device to send second configuration information to the host; and the second input endpoint is used by the slave device to send transmission data to the host.
5. The method according to claim 4, characterized in that, After configuring the first input endpoint, second input endpoint, first output endpoint, and second output endpoint through the abstract class, it also includes: Configure dedicated bandwidth and shared bandwidth according to user configuration information, and send the configuration result as first configuration information to the slave device, or configure dedicated bandwidth and shared bandwidth according to second configuration information sent by the slave device; wherein, the first configuration information and the second configuration information include the identifier and required bandwidth of each first type of device, and the identifier of each second type of device.
6. The method according to claim 4, characterized in that, After configuring the first input endpoint, second input endpoint, first output endpoint, and second output endpoint through the abstract class, it also includes: If the digit occupancy rate of the first dedicated bandwidth is determined to be less than a preset occupancy threshold based on historical transmission records, the bandwidth of the first dedicated bandwidth will be reduced. If the data delay frequency of the second dedicated bandwidth is determined to be greater than a preset frequency threshold based on historical transmission records, the bandwidth of the second dedicated bandwidth will be increased. The bandwidth update results are sent to the slave device using the second configuration information; wherein the bandwidth update results include bandwidth reduction results and / or bandwidth expansion results.
7. A data transmission device, characterized in that, Applied to the host, including: A dedicated bandwidth configuration module is used to, in response to the acquisition of data to be transmitted, configure the first service flow in the data to be transmitted, whose receiving object is a first type of device, to the corresponding dedicated bandwidth; wherein, the dedicated bandwidth is matched one-to-one with the first type of device; The shared bandwidth configuration module is used to configure the second service flow in the data to be transmitted, whose receiving object is a second type of device, to the shared bandwidth; wherein, the first type of device has a higher priority than the second type of device. The data transmission execution module is used to send the data to be transmitted to the slave device through the dedicated bandwidth and the shared bandwidth, so that the slave device can send the first service flow to the corresponding first type device and send the second service flow to the corresponding second type device.
8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data transmission method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that are used to cause a processor to execute the data transmission method according to any one of claims 1-6.
10. A computer program product comprising a computer program that, when executed by a processor, implements the data transmission method of any one of claims 1-6.
Citation Information
Patent Citations
Bandwidth allocation method and apparatus, computer device and storage medium
CN108064086A
Optical network destroy-resistant method and device based on fault classification
CN115913994A
Bandwidth allocation method and device, computer equipment, storage medium and program product
CN119835167A
Flow control method and system, storage medium and computer program product
CN120979948A
A method of resilient packet ring bandwidth allocation
CN1545270A