WO2024104095A1 - 一种数据传输方法、装置及系统 - Google Patents

一种数据传输方法、装置及系统 Download PDF

Info

Publication number
WO2024104095A1
WO2024104095A1 PCT/CN2023/127435 CN2023127435W WO2024104095A1 WO 2024104095 A1 WO2024104095 A1 WO 2024104095A1 CN 2023127435 W CN2023127435 W CN 2023127435W WO 2024104095 A1 WO2024104095 A1 WO 2024104095A1
Authority
WO
WIPO (PCT)
Prior art keywords
bluetooth
message
protocol stack
data
indication information
Prior art date
Application number
PCT/CN2023/127435
Other languages
English (en)
French (fr)
Inventor
杜潇泊
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2024104095A1 publication Critical patent/WO2024104095A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W48/00Access restriction; Network selection; Access point selection
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W52/00Power management, e.g. TPC [Transmission Power Control], power saving or power classes
    • H04W52/02Power saving arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W72/00Local resource management
    • H04W72/12Wireless traffic scheduling
    • H04W72/1263Mapping of traffic onto schedule, e.g. scheduled allocation or multiplexing of flows
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W88/00Devices specially adapted for wireless communication networks, e.g. terminals, base stations or access point devices
    • H04W88/02Terminal devices
    • H04W88/04Terminal devices adapted for relaying to or from another terminal or user

Definitions

  • the present application relates to the field of communication technology, and in particular to a data transmission method, device and system.
  • a forwarding device is required to forward the data.
  • the forwarding device when processing Bluetooth data, the forwarding device usually has the problem of excessive performance overhead due to multiple traversal of user state and kernel state, or the upper-layer application of the forwarding device needs to make major changes, resulting in poor adaptability.
  • the embodiment of the present application discloses a data transmission method, device and system.
  • the forwarding device can process forwarding data and non-forwarding data based on the user-mode Bluetooth protocol stack and the kernel-mode Bluetooth protocol stack, respectively, which can reduce power consumption and has high adaptability.
  • an embodiment of the present application discloses a data transmission method, which is applied to a forwarding device, wherein a first device communicates with the forwarding device via a first network, and the forwarding device communicates with a second device via Bluetooth, the method comprising:
  • the forwarding device receives a first message sent by the first device, where the first message includes first data and first indication information; the first indication information is used to indicate that the receiving device is the second device;
  • the forwarding device parses the first message through a first protocol stack corresponding to the first network to obtain first data and first indication information;
  • the forwarding device processes the first data and the first indication information through the first Bluetooth protocol stack in the kernel state to obtain a second message
  • the forwarding device sends the second message to the second device based on the window allocation rule; the window allocation rule is used to manage the sending order of the message from the second Bluetooth protocol stack in the user state and the message from the first Bluetooth protocol stack.
  • the forwarding device can process the forwarding data and non-forwarding data respectively based on the second Bluetooth protocol stack in the user state and the first Bluetooth protocol stack in the kernel state.
  • the forwarding data is processed by the first Bluetooth protocol stack in the kernel state, and there is no need to cross the user state and the kernel state multiple times, which can reduce performance overhead and power consumption.
  • the second Bluetooth protocol stack in the user state is used to process non-forwarding data, and the upper-layer application does not need to be modified, and the Bluetooth data can be processed through the second Bluetooth protocol stack in the user state. This solution has high adaptability.
  • forwarded data refers to forwarded data in a heterogeneous network, such as the first data mentioned above; non-forwarded data refers to data directly communicated between a forwarding device and other devices, and is not forwarded by a third party.
  • a third device establishes a Bluetooth communication connection with a forwarding device, the sending end is the third device, and the receiving end is the forwarding device.
  • the data sent by the third device to the forwarding device through the Bluetooth communication connection is non-forwarded data.
  • first and second in the above-mentioned first Bluetooth protocol stack and second Bluetooth protocol stack are only used to distinguish the two protocol stacks and should not limit the embodiments of the present application.
  • the second Bluetooth protocol stack in user state is referred to as the “Bluetooth protocol stack”
  • the first Bluetooth protocol stack in kernel state is referred to as the “Bluetooth protocol substack”.
  • the window allocation rules include giving priority to sending messages from the first Bluetooth protocol stack, giving priority to sending messages from the second Bluetooth protocol stack, and sending messages from the first Bluetooth protocol stack and messages from the second Bluetooth protocol stack in proportion.
  • the window allocation rule of the forwarding device can be flexibly changed. For example, when the window allocation module receives messages from the first Bluetooth protocol stack and messages from the second Bluetooth protocol stack at the same time, the forwarding device can select messages to send based on the proportional window allocation rule; when the window allocation module only receives messages from the first Bluetooth protocol stack or messages from the second Bluetooth protocol stack, the forwarding device can directly send the received messages without waiting for the messages from the other protocol stack.
  • the forwarding device can determine the current second Bluetooth protocol stack to be sent through the window allocation rule.
  • the Bluetooth protocol stack is also the first Bluetooth protocol stack, which can avoid data congestion and improve data transmission.
  • the forwarding device sends a second message to the second device based on the window allocation rule, including:
  • the forwarding device obtains the window busy/idle status of the Bluetooth controller
  • the forwarding device sends the second message through the idle window.
  • the forwarding device can obtain the busy and idle status of the window of the Bluetooth controller through the window allocation module; when there is an idle window of the Bluetooth controller, the window allocation module sends the second message to the idle window of the Bluetooth controller, and the Bluetooth controller sends the second message to the second device through the idle window.
  • the method further includes:
  • the forwarding device receives a third message sent by the second device, where the third message includes second data and second indication information; the second indication information is used to indicate that the receiving device is the first device;
  • the forwarding device parses the third message through the first Bluetooth protocol stack to obtain the second data;
  • the forwarding device processes the second data and the second indication information through the first protocol stack to obtain a fourth message
  • the forwarding device sends the fourth message to the first device based on the second indication information.
  • a forwarding device when implementing the embodiments of the present application, when a forwarding device receives a Bluetooth message that needs to be forwarded to other devices, it can process it through the first Bluetooth protocol stack located in the kernel state, without having to cross the user state and kernel state multiple times, which can reduce performance overhead and power consumption.
  • the method further includes:
  • the forwarding device generates a Bluetooth message through the second Bluetooth protocol stack in response to the user operation
  • the forwarding device sends a Bluetooth message to the third device based on the window allocation rule, and the third device communicates with the forwarding device via Bluetooth.
  • the forwarding device When implementing the embodiments of the present application, the forwarding device directly performs Bluetooth communication with other devices. When it does not act as a forwarding device, the forwarding device can respond to the upper-layer application through the second Bluetooth protocol stack in user state, thereby generating a Bluetooth message.
  • the upper-layer application does not need to be modified and can perform Bluetooth data processing through the second Bluetooth protocol stack in user state. This solution has high adaptability.
  • the method further includes:
  • the forwarding device receives a fifth message sent by the second device, where the fifth message includes third data and third indication information; the third indication information is used to indicate that the receiving device is a forwarding device;
  • the forwarding device parses the third message based on the first Bluetooth protocol stack to obtain fourth data and third indication information
  • the forwarding device parses the fourth data through the second Bluetooth protocol stack to obtain the third data.
  • the forwarding device when the forwarding device receives a Bluetooth message sent to the forwarding device, the forwarding device can send the message to the second Bluetooth protocol stack for analysis when the first Bluetooth protocol stack determines that the message is not forwarding data.
  • an embodiment of the present application discloses a data transmission device, wherein the device communicates with a first device via a first network, and the device communicates with a second device via Bluetooth, and the device includes:
  • a network receiving unit configured to receive a first message sent by a first device, wherein the first message includes first data and first indication information; the first indication information is used to indicate that the receiving device is a second device;
  • a first protocol stack corresponding to the first network is used to parse the first message to obtain first data and first indication information
  • a first Bluetooth protocol stack in kernel state used for processing the first data and the first indication information to obtain a second message
  • the window allocation unit is used to send a second message to the second device based on the window allocation rule; the window allocation rule is used to manage the sending order of the message from the second Bluetooth protocol stack in the user state and the message from the first Bluetooth protocol stack.
  • the network receiving unit is used to receive messages from the first network.
  • the network receiving unit may include a network card driver or a WIFI driver, etc.
  • the window allocation unit may include a window allocation module and a Bluetooth sending unit located in the first Bluetooth protocol stack, wherein the window allocation module is used to determine whether to send content from the first Bluetooth protocol stack or from the second Bluetooth protocol stack based on the window allocation rules
  • the Bluetooth sending unit is used to send Bluetooth messages in the Bluetooth network, and may include a UART driver, a UART interface, and a Bluetooth controller, etc.
  • the window allocation module may be a module in the first Bluetooth protocol stack, as shown in FIG6 below. It should be noted that in the embodiment of the present application, the delineation of each functional module may be split into more functional modules or may be combined into the same functional module, which is not limited in the embodiment of the present application.
  • the first Bluetooth protocol stack includes part or all of the content of the second Bluetooth protocol stack.
  • the window allocation rule includes giving priority to sending messages from the first Bluetooth protocol stack, giving priority to sending messages from the second Bluetooth protocol stack, sending messages from the first Bluetooth protocol stack and messages from the second Bluetooth protocol stack in proportion, and arts.
  • the window allocation unit is used to obtain the busy and idle status of the window of the Bluetooth controller
  • the second message is sent through the idle window.
  • the device further includes a Bluetooth receiving unit and a network sending unit:
  • a Bluetooth receiving unit configured to receive a third message sent by a second device, wherein the third message includes second data and second indication information; the second indication information is used to indicate that the receiving device is the first device;
  • the first Bluetooth protocol stack is used to parse the third message to obtain the second data when it is determined that the third message indicates forwarding;
  • the first protocol stack is used to process the second data and the second indication information to obtain a fourth message
  • a network sending unit is used to send a fourth message to the first device based on the second indication information.
  • the network sending unit is used to send messages of the first network.
  • the network sending unit may include a network card driver or a WIFI driver, etc.
  • the Bluetooth receiving unit is used to receive Bluetooth messages in the Bluetooth network, and may include a UART driver, a UART interface, and a Bluetooth controller, etc.
  • the second Bluetooth protocol stack is used to generate a Bluetooth message in response to a user operation
  • the window allocation unit is used to send a Bluetooth message to a third device based on the window allocation rule, and the third device communicates with the forwarding device via Bluetooth.
  • the device further includes a Bluetooth receiving unit;
  • a Bluetooth receiving unit configured to receive a fifth message sent by the second device, wherein the fifth message includes third data and third indication information; the third indication information is used to indicate that the receiving device is a forwarding device;
  • the first Bluetooth protocol stack is used to parse the third message to obtain fourth data and third indication information
  • the second Bluetooth protocol stack is used to parse the fourth data to obtain the third data.
  • the first Bluetooth protocol stack and the second Bluetooth protocol stack communicate through a virtual serial port UART. Then, when the first Bluetooth protocol stack determines that the receiving device of the third message is a forwarding device based on the third indication information, the first Bluetooth protocol stack can send the fourth data to the second Bluetooth protocol stack through the virtual serial port UART; then, the second Bluetooth protocol stack can parse the fourth data to obtain the third data.
  • an embodiment of the present application discloses a data transmission device, including a processor and a communication interface, wherein the processor is used to call a computer program stored in a memory to implement the method described in the first aspect or any possible implementation manner of the first aspect.
  • an embodiment of the present application also provides a chip system, comprising at least one processor and a communication interface, wherein the communication interface is used to send and/or receive data, and the at least one processor is used to call a computer program stored in at least one memory so that the device where the chip system is located implements the method described in the first aspect or any possible implementation manner of the first aspect.
  • an embodiment of the present application discloses a computer-readable storage medium, in which a computer program is stored.
  • the computer program runs on one or more processors, the method described in the first aspect or any possible implementation of the first aspect is executed.
  • an embodiment of the present application discloses a computer program product, which, when running on one or more processors, executes the method described in the first aspect or any possible implementation of the first aspect.
  • FIG1 is a schematic diagram of a Bluetooth deployment provided in an embodiment of the present application.
  • FIG2 is a schematic diagram of a heterogeneous network provided in an embodiment of the present application.
  • FIG3 is a schematic diagram of another Bluetooth deployment provided in an embodiment of the present application.
  • FIG4 is a schematic diagram of another Bluetooth deployment provided in an embodiment of the present application.
  • FIG5 is a schematic diagram of a possible data transmission system provided in an embodiment of the present application.
  • FIG6 is a schematic diagram of a Bluetooth deployment of a current device provided in an embodiment of the present application.
  • FIG7 is a schematic diagram of a sending window provided in an embodiment of the present application.
  • FIG8A is a schematic diagram of a flow chart of a data transmission method provided in an embodiment of the present application.
  • FIG8B is a flow chart of a data transmission method provided in an embodiment of the present application.
  • FIG9 is a schematic diagram of the structure of a data transmission device provided in an embodiment of the present application.
  • FIG10 is a schematic diagram of a hardware structure of an electronic device provided in an embodiment of the present application.
  • FIG. 11 is a software structure block diagram of an electronic device 100 provided in an embodiment of the present application.
  • At least one refers to one or more, and “plurality” refers to two or more.
  • At least one of the following” or similar expressions refers to any combination of these items, including any combination of single items or plural items.
  • at least one of a, b, or c can be represented by: a, b, c, (a and b), (a and c), (b and c), or (a and b and c), where a, b, c can be single or multiple.
  • “And/or” describes the association relationship of associated objects, indicating that three relationships can exist.
  • a and/or B can be represented by: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural.
  • the character "/" generally indicates that the associated objects before and after are in an "or” relationship.
  • first and second used in the embodiments of the present application are used to distinguish multiple objects, and are not used to limit the order, timing, priority or importance of multiple objects.
  • first information and the second information are only used to distinguish different information, and do not indicate the difference in content, priority, sending order or importance of the two types of information.
  • Bluetooth is a common communication protocol. Bluetooth devices usually need to deploy two parts, the Bluetooth host and the Bluetooth controller. Among them, the Bluetooth host usually runs in the system-on-chip (SOC) of the Bluetooth device and is mainly responsible for the processing of protocol logic; the Bluetooth controller is usually an independent chip hanging outside the SOC, and the Bluetooth controller is more responsible for the Bluetooth physical layer processing. A few SOCs will also integrate the Bluetooth controller. It should be noted that the above-mentioned Bluetooth devices refer to devices that support Bluetooth communication.
  • SOC system-on-chip
  • Figure 1 is a schematic diagram of a Bluetooth deployment provided in an embodiment of the present application.
  • the Bluetooth Host may include a Bluetooth application, a Bluetooth protocol stack, and a Universal Asynchronous Receiver/Transmitter (UART) interface; the Bluetooth Controller includes a UART interface.
  • the UART interface of the Bluetooth Host and the UART interface of the Bluetooth Controller may be connected via a cable or a (Printed Circuit Board, PCB) line to transmit data, such as for transmitting a Host Controller Interface (HCI) command; the Bluetooth Controller is connected to a Bluetooth antenna to receive or send Bluetooth data via the Bluetooth antenna.
  • HCI Host Controller Interface
  • heterogeneity means that two or more wireless data transmission systems use different access technologies, or use the same wireless access technology but belong to different wireless operators.
  • a product can have multiple communication devices, including Bluetooth devices, WIFI devices, Ethernet (ETH) devices, etc. These communication devices can form a network.
  • the Bluetooth devices of multiple products can form a Bluetooth network; for another example, the WIFI/ETH devices of multiple products can form an ETH network. Devices in the same network can communicate freely with each other.
  • FIG 2 is a schematic diagram of a heterogeneous network provided in an embodiment of the present application.
  • the heterogeneous network includes a router, a device A, a device B, a device D, and a device H.
  • Device A and device B both include a Bluetooth device and a WIFI device;
  • device D and device H both include a Bluetooth device.
  • the solid straight line represents the WiFi connection
  • the dotted line represents the Bluetooth connection.
  • device A and device B respectively connect to the WiFi of the router through their respective WiFi devices, which can form WiFi network 1
  • device B and device H connect to Bluetooth through their respective Bluetooth devices, which form Bluetooth network 1
  • device A and device D connect to Bluetooth through their respective Bluetooth devices, which form Bluetooth network 2.
  • Method 1 Please refer to Figure 3, which is a schematic diagram of another Bluetooth deployment provided by an embodiment of the present application.
  • the user state includes a Bluetooth protocol stack and a forwarding application, and the Bluetooth protocol stack and the forwarding application can perform data transmission through inter-process communication (IPC);
  • the kernel state includes an IP stack, a UART driver, a network card driver, and a WiFi driver, wherein the Bluetooth protocol stack includes a Bluetooth chip driver, such as vendorlib.
  • the Bluetooth protocol stack is in user mode, and the forwarding APP in user mode forwards the network from the IP to the Bluetooth network. Or forward data from the Bluetooth network to the ETH network.
  • the Bluetooth chip driver is generally provided by the chip manufacturer, which is used to complete the initialization configuration, management and data transmission and reception of the chip, and is usually not open source.
  • Method 2 Please refer to Figure 4, which is a schematic diagram of another Bluetooth deployment provided by an embodiment of the present application.
  • the user state includes the application
  • the kernel state includes the forwarding module, the Bluetooth protocol stack, the IP stack, the UART driver, the network card driver and the WiFi driver, wherein the Bluetooth protocol stack includes the Bluetooth chip driver.
  • the Bluetooth protocol stack is located in the kernel state, and the kernel state includes a forwarding module, which is used to forward data from the IP network to the Bluetooth network or forward data from the Bluetooth network to the ETH network.
  • This method directly moves the Bluetooth protocol stack to the kernel state. Although it solves the problem of multiple traversal of the user state and kernel state, it will have a significant impact on the upper-layer applications and requires the upper-layer application design to be changed. In addition, this method requires the chip manufacturer to provide a Bluetooth chip driver, but due to the kernel's open source protocol, the driver needs to be open source, and the chip driver usually contains the core value assets of the Bluetooth chip manufacturer, and the manufacturer is generally unwilling to open source.
  • FIG. 5 is a schematic diagram of a possible data transmission system provided in an embodiment of the present application.
  • the data transmission system 10 includes a first device 101, a forwarding device 102, and a second device 103. Among them:
  • the first device 101 and the forwarding device 102 establish a Bluetooth connection, and the forwarding device 102 establishes a non-Bluetooth communication connection with the second device 103.
  • the first device 101 and the forwarding device 102 communicate via a Bluetooth network
  • the forwarding device 102 and the second device 103 communicate via a WiFi network.
  • the first device 101 when the first device 101 sends data to the second device 103 , since the first device 101 and the second device 103 are not in the same network, the first device 101 may first forward the data to the second device 103 through the forwarding device 102 .
  • the first device 101 can be the transmitter and the second device 103 can be the receiver; or the second device 103 can be the transmitter and the first device 101 can be the receiver. It can be determined according to the specific scenario and is not limited here.
  • the first device 101, the forwarding device 102, and the second device 103 may all be electronic devices.
  • the electronic devices may include, but are not limited to, mobile phones, wearable devices (such as watches, etc.), tablets, displays, televisions, desktop computers, laptop computers, handheld computers, notebook computers, super mobile personal computers, netbooks, augmented reality devices, virtual reality devices, artificial intelligence devices, vehicle-mounted devices, smart home devices, and other electronic devices.
  • first device 101 and the second device 103 This is only an example and should not limit the first device 101 and the second device 103.
  • the first device 101, the forwarding device 102 and the second device 103 may be the same or different devices, which is not limited here.
  • the above data transmission system may also include other network elements or devices (such as routers), which are not limited here.
  • FIG. 6 is a schematic diagram of a Bluetooth deployment of a current device provided in an embodiment of the present application.
  • the current device can be any one of the first device 101, the forwarding device 102 and the second device 103 in the above data transmission system.
  • the Bluetooth deployment of the current device includes Bluetooth Host and Bluetooth Controller, where Bluetooth Host includes user state and kernel state.
  • the user state may include Bluetooth protocol stack and Bluetooth application, and the Bluetooth protocol stack and Bluetooth application may communicate through IPC, where the Bluetooth protocol stack includes Bluetooth driver, such as vendorlib;
  • the kernel state includes virtual UART, forwarding module, Bluetooth protocol substack, UART driver, UART interface, other protocol stacks (such as IP stack) and network card driver, WiFi driver, etc.
  • the Bluetooth protocol substack includes window allocation module.
  • the Bluetooth protocol stack in user mode is responsible for initializing the Bluetooth Controller and other actions; the kernel mode can only be used to send standard HCI commands.
  • the Bluetooth protocol substack in kernel state is responsible for forwarding data in heterogeneous networks.
  • the virtual UART is used for data transmission between the Bluetooth protocol stack and the Bluetooth protocol substack. Specifically, it can include sending data from the Bluetooth protocol stack to the Bluetooth protocol substack, or sending data from the Bluetooth protocol substack to the Bluetooth protocol stack. For example, when the user-mode Bluetooth protocol stack sends data to the Bluetooth Controller, the virtual UART can intercept the Bluetooth data and send it to the Bluetooth protocol substack for transmission. For another example, when the current device is a device for receiving data, the Bluetooth protocol stack transparently transmits the data to the Bluetooth protocol stack through the virtual UART. The data can be sent to the Bluetooth protocol stack by other protocol stacks or by the Bluetooth controller.
  • the forwarding module is used for data transmission between the Bluetooth protocol stack and other protocol stacks.
  • the forwarding module can forward data from other network types to the Bluetooth protocol stack.
  • the forwarding module can forward data from the Bluetooth protocol stack to other corresponding protocol stacks.
  • the Bluetooth protocol substack contains part/all of the contents of the Bluetooth protocol stack and the window allocation module.
  • the window allocation module is used to manage the data sent by the Bluetooth protocol stack and the Bluetooth protocol substack to the Bluetooth Controller.
  • the window allocation module can send data from the Bluetooth protocol stack or the forwarding module to the UART interface when the Bluetooth Controller has an idle sending window (buffer) based on the configuration rules.
  • the configuration rules include but are not limited to: forwarding priority, Bluetooth protocol stack priority, proportional allocation, etc.
  • This configuration rule is used for the window allocation module of the current device to decide whether to send the message to be sent by the Bluetooth protocol stack or the message to be sent by the Bluetooth protocol substack when receiving the message to be sent by the Bluetooth protocol stack and the Bluetooth protocol substack.
  • forwarding priority means that when the window allocation module of the current device receives the message to be sent by the Bluetooth protocol stack and the Bluetooth protocol substack, it gives priority to sending the message of the Bluetooth protocol substack;
  • Bluetooth protocol stack priority means that the message of the Bluetooth protocol stack is sent first;
  • proportional allocation means that the contents of the Bluetooth protocol stack and the Bluetooth protocol substack are sent in a certain ratio and order. For example, the ratio of Bluetooth protocol stack: Bluetooth protocol substack is 2:1, then the window allocation module first sends 2 messages from the Bluetooth protocol stack to the UART interface, and then sends 1 message from the forwarding module to the UART interface, and so on.
  • Bluetooth Controller Several sending windows can be established inside the Bluetooth Controller, and the messages to be sent can be first transferred to the idle sending window, and then sent from the sending window to other devices.
  • the Bluetooth Controller After the Bluetooth Controller completes the sending of messages in one/multiple sending windows, it will report a command to the Bluetooth Host (specifically, it can be the window allocation module in the Bluetooth Host), which is used to indicate that the message sending is completed.
  • the command can be an HCI command indicating that the message sending is completed.
  • the Bluetooth protocol substack can learn the busy and idle status of the current sending window of the Bluetooth Controller through the above command (such as the above HCI command).
  • Figure 7 is a schematic diagram of a sending window provided in an embodiment of the present application.
  • the window allocation module can receive data sent by the Bluetooth Controller via UART, parse and obtain the command reported therein.
  • the command may include a first HCI command and a second HCI command.
  • the first HCI command is used to indicate that the message (or packet) is sent.
  • the first HCI command includes indication information, and the indication information is used to indicate the busy or idle status of the sending window.
  • the window allocation module can determine the busy or idle status of the sending window based on the first HCI command; then, based on the busy or idle status of the sending window and the configuration rules, determine whether to send the Bluetooth protocol stack or the Bluetooth protocol substack message next; when determining to send the Bluetooth protocol stack message, the first HCI command is transparently transmitted to the virtual UART; when determining to send the Bluetooth protocol substack message, the HCI command is deducted and the Bluetooth protocol substack message is sent to the Bluetooth Controller.
  • the second HCI command may include data sent by other devices to the current device and the data type of the data, and the data type may include forwarded data or received data, wherein the forwarded data is data that needs to be forwarded to a device of a non-Bluetooth network, and the received data is data sent to the current device.
  • the window allocation module may determine the data type of the data based on the second HCI command, and then send the forwarded data to the Bluetooth protocol stack through the first channel, and send the received data to the Bluetooth protocol stack through the second channel.
  • the first channel and the second channel are different channels.
  • Figure 8A is a flowchart of a data transmission method provided in an embodiment of the present application.
  • the first device can generate a first message through the Bluetooth protocol substack in response to a user operation on the first application, and the first message includes indication information and data.
  • the indication information can be generated by a heterogeneous transmission protocol in the Bluetooth protocol substack, and the indication information is used to indicate that the receiving device is a second device, and the indication information can be an identifier of the second device (such as the address of the second device).
  • the window allocation module in the Bluetooth protocol substack sends the first message to the UART interface of the first device through the UART driver of the first device.
  • the UART interface sends the first message to the Bluetooth controller Controller of the first device through a cable or a PBC line; the Bluetooth Controller sends the first message to the Bluetooth Controller of the forwarding device.
  • the Controller of the forwarding device can send the first message to the UART interface of the forwarding device through a cable or a PBC line;
  • the UART interface sends the first message to the Bluetooth protocol substack of the forwarding device through the UART driver of the forwarding device;
  • the Bluetooth protocol substack parses the first message to obtain data and indication information, and then sends the data and indication information to the forwarding module;
  • the forwarding module determines the next protocol stack (such as the IP protocol stack) based on the indication information, and then forwards the data and indication information to the next protocol stack;
  • the next protocol stack performs protocol processing on the data and indication information to obtain a second message, and the second message includes the data after protocol processing and the indication information after protocol processing; then, the second message is sent to the second device through the network card driver or the WiFi driver.
  • the second device sends the second message to other protocol stacks (such as IP protocol stack) through the network card driver or WiFi driver, and the other protocol stack obtains the data in the second message; then, the heterogeneous transmission protocol can report the data to the second application, and the second application performs display and other operations.
  • protocol stacks such as IP protocol stack
  • first and second are only used for distinction and do not constitute a limitation on the embodiments of the present application.
  • the embodiments of the present application refer to the message sent by the sending device as the first message, and the message received by the receiving device as the second message; the "first” and “second” in the first message and the second message are only used for distinction, and the first message and the second message are the results of different protocol stacks performing different protocol processing on the same data based on their respective protocol rules.
  • the second device can generate indication information indicating that the receiving device is the second device through a heterogeneous transmission protocol in response to user operations on the second application; then, generate a first message through other protocol stacks (such as an IP protocol stack), and the first message includes the indication information and data; the second device sends the first message to the forwarding device through a network card driver or a WiFi driver.
  • a network card driver or a WiFi driver.
  • the forwarding device receives the first message sent by the second device through the network card driver or the WiFi driver; then, other protocol stacks (such as the IP protocol stack) parse the first message to obtain data and indication information; then, other protocol stacks send the data and the indication information to the forwarding module; the forwarding module determines that the first message is a message forwarded to the first device based on the indication information, so the forwarding module sends the data and the indication information to the Bluetooth protocol substack, and the Bluetooth protocol substack performs protocol processing on the data and the indication information to obtain a second message, which includes the data after protocol processing and the indication information after protocol processing; then, the window allocation module sends the second message to the UART interface of the forwarding device through the UART driver of the forwarding device; then, the UART interface sends the second message to the Bluetooth controller Controller of the forwarding device through a cable or a PBC line; the Bluetooth Controller of the forwarding device sends the first message to the Bluetooth Controller of the first device.
  • other protocol stacks such as
  • the Bluetooth controller of the first device sends the second message to the UART interface of the first device through a cable or a PBC line; the UART interface sends the first message to the Bluetooth protocol substack of the forwarding device through the UART driver of the forwarding device; the Bluetooth protocol substack parses the second message to obtain the data and indication information in the second message; the Bluetooth protocol substack can report the parsed data to the first application, and the first application performs display and other operations.
  • Figure 8B is a flow chart of a data transmission method provided by an embodiment of the present application. As shown in Figure 8B, the method includes some or all of the following steps:
  • a first device establishes a first network connection with a forwarding device.
  • the first network is other network types other than the Bluetooth network, such as Ethernet, WiFi network, etc., which are not limited here.
  • S802 The second device establishes a Bluetooth connection with the forwarding device.
  • the second device and the forwarding device are devices with Bluetooth function.
  • the Bluetooth deployment of the second device and the forwarding device may be as shown in FIG. 6 .
  • the first device sends a first message to the forwarding device through the first network connection, where the first message includes first data and first indication information; the first indication information is used to indicate that the receiving device is the second device.
  • the first device in response to a user operation of sending first data to a second device, queries a device that can forward data for the first device and the second device when it is determined that the second device is not a device on the same network as the first device; when determining the forwarding device, a first message can be sent to the forwarding device through the first network connection, the first message including first data and first indication information; the first indication information is used to indicate that the receiving device is the second device.
  • the forwarding device parses the first message through the first protocol stack corresponding to the first network to obtain first data and first indication information.
  • the forwarding device when the forwarding device receives the first message sent from the second device, it can parse the first message through the first protocol stack corresponding to the first network to obtain the first data and the first indication information.
  • the first network is an IP protocol stack.
  • the forwarding device processes the first data and the first indication information through the first Bluetooth protocol stack in kernel state to obtain a second message.
  • the forwarding device parses the first message through the first protocol stack corresponding to the first network and obtains the first indication information
  • the forwarding device determines, based on the first indication information, that the protocol stack for processing the first data and the first indication information is the first Bluetooth protocol stack in the kernel state; then, the forwarding device processes the first data and the first indication information through the first Bluetooth protocol stack to obtain a second message.
  • the first Bluetooth protocol stack may be a Bluetooth protocol substack in the kernel state in the forwarding device in FIG. 8A , or may be a Bluetooth protocol substack in the kernel state shown in FIG. 6 .
  • the forwarding device sends a second message to the second device based on the window allocation rule; the window allocation rule is used to manage the first message from the user state.
  • the forwarding device can determine through the window allocation module whether to send a message from the second Bluetooth protocol stack in user mode or a message from the first Bluetooth protocol stack; after determining to send a message from the first Bluetooth protocol stack, the second message is sent to the Bluetooth controller, and the second message is sent to the second device through the Bluetooth controller and the Bluetooth antenna.
  • the first Bluetooth protocol stack may be the user-mode Bluetooth protocol stack shown in FIG. 6 ; and the window allocation module may be the window allocation module in FIG. 6 .
  • Figure 9 is a schematic diagram of the structure of a data transmission device provided in an embodiment of the present application, and the device can be the forwarding device mentioned above.
  • the device can also be a device in the forwarding device, such as a chip or an integrated circuit, and the device can include a network receiving unit 901, a first protocol stack 902 corresponding to the first network, a first Bluetooth protocol stack 903 in the kernel state, and a window allocation unit 904.
  • the data transmission device is used to implement the aforementioned data transmission method, such as the data transmission method of any embodiment shown in Figure 8A or Figure 8B.
  • the data transmission device communicates with the first device via a first network, and the device communicates with the second device via Bluetooth, and the device includes:
  • a network receiving unit 901 is configured to receive a first message sent by the first device, where the first message includes first data and first indication information; the first indication information is used to indicate that the receiving device is the second device;
  • the first protocol stack 902 corresponding to the first network is used to parse the first message to obtain the first data and the first indication information;
  • the first Bluetooth protocol stack 903 in kernel state is used to process the first data and the first indication information to obtain a second message;
  • the window allocation unit 904 is used to send the second message to the second device based on the window allocation rule; the window allocation rule is used to manage the sending order of the message from the second Bluetooth protocol stack 905 in user mode and the message from the first Bluetooth protocol stack 903.
  • the forwarding device can process the forwarding data and non-forwarding data based on the second Bluetooth protocol stack 905 in the user state and the first Bluetooth protocol stack 903 in the kernel state respectively.
  • the forwarding data it is processed by the first Bluetooth protocol stack 903 in the kernel state, and there is no need to cross the user state and the kernel state multiple times, which can reduce performance overhead and power consumption;
  • the second Bluetooth protocol stack 905 in the user state is used to process non-forwarding data, and the upper-layer application does not need to be modified, and the Bluetooth data can be processed through the second Bluetooth protocol stack 905 in the user state.
  • This solution has high adaptability.
  • the window allocation rules include giving priority to sending messages from the first Bluetooth protocol stack 903, giving priority to sending messages from the second Bluetooth protocol stack 905, and sending messages from the first Bluetooth protocol stack 903 and messages from the second Bluetooth protocol stack 905 in proportion.
  • the forwarding device can determine whether to send the second Bluetooth protocol stack 905 or the first Bluetooth protocol stack 903 through window allocation rules, thereby avoiding data congestion and improving the speed of data transmission.
  • the window allocation unit 904 is used to obtain the busy and idle status of the window of the Bluetooth controller
  • the second message is sent through the idle window.
  • the device further includes a Bluetooth receiving unit 906 and a network sending unit 907:
  • the Bluetooth receiving unit 906 is used to receive a third message sent by the second device, where the third message includes second data and second indication information; the second indication information is used to indicate that the receiving device is the first device;
  • the first Bluetooth protocol stack 903 is used to parse the third message to obtain the second data when it is determined that the third message indicates forwarding;
  • the first protocol stack 902 corresponding to the first network is used to process the second data and the second indication information to obtain a fourth message;
  • the network sending unit 907 is configured to send the fourth message to the first device based on the second indication information.
  • a forwarding device when implementing the embodiments of the present application, when a forwarding device receives a Bluetooth message that needs to be forwarded to other devices, it can process it through the first Bluetooth protocol stack 903 located in the kernel state, without having to cross the user state and kernel state multiple times, which can reduce performance overhead and power consumption.
  • the second Bluetooth protocol stack 905 is used to generate a Bluetooth message in response to a user operation
  • the window allocation unit 904 is configured to send the Bluetooth message to a third device based on the window allocation rule, and the third device communicates with the forwarding device via Bluetooth.
  • the device further includes a Bluetooth receiving unit 906;
  • the Bluetooth receiving unit 906 is used to receive a fifth message sent by the second device, where the fifth message includes third data and third indication information; the third indication information is used to indicate that the receiving device is the forwarding device;
  • the first Bluetooth protocol stack 903 is used to parse the third message to obtain the fourth data and the third indication information
  • the second Bluetooth protocol stack 905 is used to parse the fourth data to obtain the third data.
  • the forwarding device when the forwarding device receives a Bluetooth message sent to the forwarding device, the forwarding device can send the message to the second Bluetooth protocol stack 905 for analysis when the first Bluetooth protocol stack 903 determines that the message is not forwarding data.
  • the first Bluetooth protocol stack 903 and the second Bluetooth protocol stack 905 communicate through a virtual UART, then the first Bluetooth protocol stack 903 can send the fourth data to the second Bluetooth protocol stack 905 based on the third indication information; and then, the second Bluetooth protocol stack 905 can parse the fourth data to obtain the third data.
  • the data transmission between the first Bluetooth protocol stack 903, the second Bluetooth protocol stack 905 and the virtual UART can refer to the relevant description above.
  • each unit may also correspond to the corresponding description of the embodiment shown in Figure 6, Figure 8A or Figure 8B.
  • the data transmission device may be the forwarding device in the embodiment shown in Figure 6, Figure 8A or Figure 8B.
  • the electronic device 100 is taken as an example to specifically describe the devices mentioned above.
  • the first device, the forwarding device, and the second device mentioned above may all be the electronic device 100.
  • FIG. 10 exemplarily shows a schematic diagram of a hardware structure of an electronic device 100 .
  • the electronic device 100 may have more or fewer components than those shown in the figure, may combine two or more components, or may have different component configurations.
  • the various components shown in Figure 10 may be implemented in hardware, software, or a combination of hardware and software including one or more signal processing and/or application specific integrated circuits.
  • the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194 and a subscriber identification module (SIM) card interface 195, etc.
  • SIM subscriber identification module
  • the sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
  • the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the electronic device 100.
  • the electronic device 100 may include more or fewer components than shown in the figure, or combine some components, or split some components, or arrange the components differently.
  • the components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and/or a neural-network processing unit (NPU), etc.
  • AP application processor
  • GPU graphics processor
  • ISP image signal processor
  • controller a memory
  • video codec a digital signal processor
  • DSP digital signal processor
  • NPU neural-network processing unit
  • Different processing units may be independent devices or integrated in one or more processors.
  • the controller may be the nerve center and command center of the electronic device 100.
  • the controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
  • the processor 110 may also be provided with a memory for storing instructions and data.
  • the memory in the processor 110 is a cache memory.
  • the memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver/transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input/output (GPIO) interface, a subscriber identity module (SIM) interface, and/or a universal serial bus (USB) interface, etc.
  • I2C inter-integrated circuit
  • I2S inter-integrated circuit sound
  • PCM pulse code modulation
  • UART universal asynchronous receiver/transmitter
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may include multiple groups of I2C buses.
  • the processor 110 may be coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces.
  • the processor 110 may be coupled to the touch sensor 180K through the I2C interface, so that the processor 110 communicates with the touch sensor 180K through the I2C bus interface, thereby realizing the touch function of the electronic device 100.
  • the I2S interface can be used for audio communication.
  • the processor 110 can include multiple I2S buses.
  • the processor 110 can The processor 110 can communicate with the audio module 170 by coupling with the audio module 170 via the I2S bus.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 via the I2S interface to implement the function of answering calls via a Bluetooth headset.
  • the PCM interface can also be used for audio communication, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 can be coupled via a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 via the PCM interface to realize the function of answering calls via a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus can be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • the UART interface is generally used to connect the processor 110 and the wireless communication module 160.
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the UART interface can be used to be responsible for the communication between the Bluetooth host and the Bluetooth controller.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to achieve the function of playing music through Bluetooth headphones.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193.
  • the MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc.
  • the processor 110 and the camera 193 communicate via the CSI interface to implement the shooting function of the electronic device 100.
  • the processor 110 and the display screen 194 communicate via the DSI interface to implement the display function of the electronic device 100.
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or a data signal.
  • the GPIO interface can be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc.
  • the GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
  • the SIM interface can be used to communicate with the SIM card interface 195 to implement the function of transmitting data to the SIM card or reading data in the SIM card.
  • the USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
  • the USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transmit data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones.
  • the interface can also be used to connect other electronic devices, such as AR devices, etc.
  • the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100.
  • the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
  • the charging management module 140 is used to receive charging input from a charger, where the charger can be a wireless charger or a wired charger.
  • the power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110.
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
  • the wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor and the baseband processor.
  • Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of antennas.
  • antenna 1 can be reused as a diversity antenna for a wireless local area network.
  • the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 can provide solutions for wireless communications including 2G/3G/4G/5G, etc., applied to the electronic device 100.
  • the mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1.
  • at least some functional modules of the mobile communication module 150 may be set in the processor 110.
  • At least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal.
  • the demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the application processor transmits the low-frequency baseband signal to the baseband processor through the audio device. (not limited to speaker 170A, receiver 170B, etc.) outputs sound signals, or displays images or videos through display screen 194.
  • the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) network), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) and the like applied to the electronic device 100.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global navigation satellite system
  • FM frequency modulation
  • NFC near field communication
  • IR infrared
  • the wireless communication module 160 can be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering processing, and sends the processed signal to the processor 110.
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of the signal, amplify the signal, and convert it into electromagnetic waves for radiation through the antenna 2.
  • the forwarding device communicates with the first device and the second device through the wireless communication module 160.
  • the wireless communication module 160 in the forwarding device can provide solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks) and Bluetooth (BT) wireless communications; and the wireless communication module in the first device has WiFi function but not Bluetooth function, and the wireless communication module in the second device has Bluetooth function but not WiFi function, then the forwarding device can establish a WiFi connection with the first device, and the forwarding device can establish a Bluetooth connection with the second device, and further, the forwarding device can realize data transmission between the first device and the second device.
  • WLAN wireless local area networks
  • BT Bluetooth
  • the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and/or IR technology.
  • the GNSS may include the global positioning system (GPS), the global navigation satellite system (GLONASS), the Beidou navigation satellite system (BDS), the quasi-zenith satellite system (QZSS) and/or the satellite based augmentation system (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou navigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation system
  • the electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor.
  • the GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • the processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
  • the electronic device 100 may include 1 or N display screens 194 , where N is a positive integer greater than 1.
  • the ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye.
  • the ISP can also perform algorithm optimization on the noise, brightness, etc. of the image.
  • the ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP can be set in the camera 193.
  • the camera 193 is used to capture still images or videos.
  • the object is projected onto a photosensitive element through a lens to generate an optical image.
  • the photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CCD charge coupled device
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • the DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format.
  • the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
  • the digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.
  • Video codecs are used to compress or decompress digital videos.
  • the electronic device 100 may support one or more video codecs. In this way, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
  • MPEG Moving Picture Experts Group
  • MPEG2 MPEG2, MPEG3, MPEG4, etc.
  • NPU is a neural network (NN) computing processor.
  • NN neural network
  • applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
  • the external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.
  • the external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function. For example, files such as music and videos can be stored in the external memory card.
  • the internal memory 121 may be used to store computer executable program codes, wherein the executable program codes include instructions.
  • the processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 .
  • the internal memory 121 may include a program storage area and a data storage area.
  • the program storage area may store an operating system, an application required for at least one function (such as a face recognition function, a fingerprint recognition function, a mobile payment function, etc.), etc.
  • the data storage area may store data created during the use of the electronic device 100 (such as face information template data, fingerprint information template, etc.), etc.
  • the internal memory 121 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • a non-volatile memory such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
  • the electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.
  • the audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals.
  • the audio module 170 can also be used to encode and decode audio signals.
  • the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
  • the speaker 170A also called a "speaker" is used to convert an audio electrical signal into a sound signal.
  • the electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.
  • the receiver 170B also called a "earpiece" is used to convert audio electrical signals into sound signals.
  • the voice can be received by placing the receiver 170B close to the human ear.
  • Microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C.
  • the electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function.
  • the electronic device 100 may also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, implement directional recording functions, etc.
  • the earphone interface 170D is used to connect a wired earphone.
  • the earphone interface 170D may be the USB interface 130, or may be a 3.5 mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal.
  • the pressure sensor 180A can be set on the display screen 194.
  • a capacitive pressure sensor can be a parallel plate including at least two conductive materials.
  • the electronic device 100 determines the intensity of the pressure based on the change in capacitance.
  • the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A.
  • the electronic device 100 can also calculate the position of the touch based on the detection signal of the pressure sensor 180A.
  • touch operations acting on the same touch position but with different touch operation strengths may correspond to different operation instructions. For example, when a touch operation with a touch operation strength less than a first pressure threshold acts on a short message application icon, an instruction to view a short message is executed. When a touch operation with a touch operation strength greater than or equal to the first pressure threshold acts on a short message application icon, an instruction to create a new short message is executed.
  • the gyro sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting.
  • the gyro sensor 180B detects the shaking angle of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenes.
  • the air pressure sensor 180C is used to measure air pressure.
  • the electronic device 100 measures the air pressure value through the air pressure sensor 180C. Calculate altitude to assist positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case.
  • the electronic device 100 when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip cover according to the magnetic sensor 180D. Then, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, the flip cover can be automatically unlocked.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
  • the distance sensor 180F is used to measure the distance.
  • the electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • the proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector, such as a photodiode.
  • the light emitting diode may be an infrared light emitting diode.
  • the electronic device 100 emits infrared light outward through the light emitting diode.
  • the electronic device 100 uses a photodiode to detect infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100.
  • the electronic device 100 can use the proximity light sensor 180G to detect that the user holds the electronic device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • the proximity light sensor 180G can also be used in leather case mode and pocket mode to automatically unlock and lock the screen.
  • the ambient light sensor 180L is used to sense the ambient light brightness.
  • the electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in a pocket to prevent accidental touches.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint call answering, etc.
  • the temperature sensor 180J is used to detect temperature.
  • the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of a processor located near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 due to low temperature. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • the touch sensor 180K is also called a "touch panel”.
  • the touch sensor 180K can be set on the display screen 194, and the touch sensor 180K and the display screen 194 form a touch screen, also called a "touch screen”.
  • the touch sensor 180K is used to detect touch operations acting on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output related to the touch operation can be provided through the display screen 194.
  • the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.
  • the key 190 includes a power key, a volume key, etc.
  • the key 190 may be a mechanical key or a touch key.
  • the electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
  • Motor 191 can generate vibration prompts.
  • Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • touch operations acting on different areas of the display screen 194 can also correspond to different vibration feedback effects.
  • Different application scenarios for example: time reminders, receiving messages, alarm clocks, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 may be an indicator light, which may be used to indicate the charging status, power changes, messages, missed calls, notifications, etc.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195.
  • the electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 can also be compatible with external memory cards.
  • the electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications.
  • the electronic device 100 can execute the data transmission method through the processor 110.
  • FIG. 11 is a software structure block diagram of the electronic device 100 provided in an embodiment of the present application.
  • the layered architecture divides the software into several layers, each with clear roles and division of labor.
  • the layers communicate with each other through software interfaces.
  • the Android system is divided into four layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.
  • the application layer can include a series of application packages.
  • the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, and voice assistant.
  • a user can communicate with other devices via Bluetooth, for example, a user uses a first device to send first data to a second device, wherein the first device and the second device are located in different networks; accordingly, when the first device receives a user operation on a Bluetooth application, the first device sends a Bluetooth message to a forwarding device, and the Bluetooth message includes first data and first indication information; the first indication information is used to indicate that the receiving device is the second device, and the forwarding device can process the first message through the first Bluetooth protocol stack in the kernel state to obtain the first data and the first indication information; since the forwarding device communicates with the second device through the first network, the forwarding device can process the first data and the first indication information through the first protocol stack corresponding to the first network to obtain the second message; and send the second message to the second device.
  • the application framework layer provides application programming interface (API) and programming framework for the applications in the application layer.
  • API application programming interface
  • the application framework layer includes some predefined functions.
  • the application framework layer may include a display manager, a sensor manager, a cross-device connection manager, an event manager, a task manager, a window manager, a content provider, a view system, a resource manager, a notification manager, etc.
  • the display manager is used for system display management and is responsible for managing all display-related affairs, including creation, destruction, direction switching, size and state changes, etc.
  • the display manager is only one default display module on a single device, that is, the main display module.
  • the sensor manager is responsible for the status management of the sensor, and manages the application to monitor sensor events and report the events to the application in real time.
  • the cross-device connection manager is used to establish a communication connection with the terminal device 200 and send a voice signal to the terminal device 200 based on the communication connection.
  • the event manager is used for the system's event management service. It is responsible for receiving events uploaded from the bottom layer and distributing them to each window, completing tasks such as event reception and distribution.
  • the task manager is used to manage task (Activity) components, including startup management, life cycle management, task direction management, etc.
  • the window manager is used to manage window programs.
  • the window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
  • the window manager is also responsible for window display management, including window display mode, display size, display coordinate position, display level, etc.
  • Content providers are used to store and retrieve data and make it accessible to applications.
  • the data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
  • the view system includes visual controls, such as controls for displaying text, controls for displaying images, etc.
  • the view system can be used to build applications.
  • a display interface can be composed of one or more views.
  • a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
  • the resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
  • the notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc.
  • the notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.
  • Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for the scheduling and management of the Android system.
  • the core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
  • the application layer and the application framework layer run in a virtual machine.
  • the virtual machine executes the Java files of the application layer and the application framework layer as binary files.
  • the virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
  • the system library (also called the data management layer) can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL) and event data.
  • functional modules such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL) and event data.
  • the surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
  • the media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc.
  • the media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
  • the 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.
  • a 2D graphics engine is a drawing engine for 2D drawings.
  • the kernel layer is the layer between hardware and software.
  • the kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.
  • An embodiment of the present application also provides an electronic device, which includes one or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program codes, and the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method described in the above embodiment.
  • the embodiments of the present application also provide a computer program product including instructions.
  • the computer program product When the computer program product is executed on an electronic device, the electronic device executes the method described in the above embodiments.
  • An embodiment of the present application also provides a computer-readable storage medium, including instructions, which, when executed on an electronic device, enable the electronic device to execute the method described in the above embodiment.
  • the computer program product includes one or more computer instructions.
  • the computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device.
  • the computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated.
  • the available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk), etc.
  • the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media.
  • the programs can include the processes of the above-mentioned method embodiments.
  • the aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

本申请实施例提供一种数据传输方法、装置及系统,应用于转发设备,第一设备与转发设备通过第一网络进行通信,转发设备与第二设备通过蓝牙进行通信,该方法包括:转发设备接收第一设备发送的第一报文;第一指示信息用于指示接收设备为第二设备;通过第一网络对应的第一协议栈解析第一报文得到第一数据和第一指示信息;通过内核态的第一蓝牙协议栈对第一数据和第一指示信息进行处理得到第二报文;基于窗口分配规则向第二设备发送第二报文;窗口分配规则用于管理来自用户态的第二蓝牙协议栈的报文和来自第一蓝牙协议栈的报文的发送顺序。该方法中,转发设备可以基于内核态的蓝牙协议栈对转发数据进行处理,可以降低功耗,适配性高。

Description

一种数据传输方法、装置及系统
本申请要求在2022年11月18日提交中国国家知识产权局、申请号为202211444227.6的中国专利申请的优先权,发明名称为“一种数据传输方法、装置及系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及通信技术领域,具体涉及一种数据传输方法、装置及系统。
背景技术
目前,要实现蓝牙网络中的设备与处于非蓝牙网络(如以太网)的设备的数据传输,需要转发设备对数据进行转发。目前,在蓝牙网络中的设备与非蓝牙网络中的设备的数据传输中,转发设备在处理蓝牙数据时,通常会出现多次穿越用户态和内核态造成性能开销过大的问题,或者,转发设备的上层应用需要作出较大改动造成适配性差的问题。
发明内容
本申请实施例公开了一种数据传输方法、装置及系统。实施本申请实施例,转发设备可以基于用户态的蓝牙协议栈和内核态的蓝牙协议栈分别对转发数据和非转发数据进行处理,可以降低功耗,适配性高。
第一方面,本申请实施例公开了一种数据传输方法,应用于转发设备,第一设备与转发设备通过第一网络进行通信,转发设备与第二设备通过蓝牙进行通信,该方法包括:
转发设备接收第一设备发送的第一报文,第一报文包括第一数据和第一指示信息;第一指示信息用于指示接收设备为第二设备;
转发设备通过第一网络对应的第一协议栈解析第一报文,得到第一数据和第一指示信息;
转发设备通过内核态的第一蓝牙协议栈对第一数据和第一指示信息进行处理,得到第二报文;
转发设备基于窗口分配规则向第二设备发送第二报文;窗口分配规则用于管理来自用户态的第二蓝牙协议栈的报文和来自第一蓝牙协议栈的报文的发送顺序。
实施本申请实施例,转发设备可以基于用户态的第二蓝牙协议栈和内核态的第一蓝牙协议栈分别对转发数据和非转发数据进行处理,在处理转发数据通过位于内核态的第一蓝牙协议栈进行处理,不需多次穿越用户态和内核态,可以减少性能开销,降低功耗;用户态的第二蓝牙协议栈用于处理非转发数据,上层应用不需改动,即可通过用户态的第二蓝牙协议栈进行蓝牙数据处理,该方案适配性高。
其中,转发数据是指异构网络中的转发数据,如上文中的第一数据;非转发数据是指转发设备与其他设备之间直接通信的数据,不经过第三方参与转发的数据。例如,第三设备与转发设备建立蓝牙通信连接,发送端为第三设备,接收端为转发设备,由第三设备通过蓝牙通信连接发送至转发设备的数据即为非转发数据。
需要说明的是,上述第一蓝牙协议栈和第二蓝牙协议栈中的“第一”“第二”仅用于区分两个协议栈,并不应造成对本申请实施例的限定。在下文示例性示出的部分实施例中,为方便描述,将用户态的第二蓝牙协议栈称为“蓝牙协议栈”,将内核态的第一蓝牙协议栈称为“蓝牙协议子栈”。
结合第一方面,在一种可能的实现方式中,窗口分配规则包括来自第一蓝牙协议栈的报文优先发送、来自第二蓝牙协议栈的报文优先发送、按比例发送来自第一蓝牙协议栈的报文和来自第二蓝牙协议栈的报文。
在一种可能的实现方式中,转发设备的窗口分配规则是可以灵活更改的,例如,在窗口分配模块同时接收到来自第一蓝牙协议栈的报文和来自第二蓝牙协议栈的报文时,转发设备可以基于按比例发送的窗口分配规则选择报文进行发送;在窗口分配模块仅接收到来自第一蓝牙协议栈的报文或来自第二蓝牙协议栈的报文时,转发设备可以直接发送接收到的报文,不需要等待另一个协议栈的报文。
实施本申请实施例,由于转发设备中部署了用户态的第二蓝牙协议栈和内核态的第一蓝牙协议栈的双栈结构,在蓝牙数据接收和蓝牙数据发送的过程中,转发设备可以通过窗口分配规则确定当前发送第二蓝 牙协议栈还是第一蓝牙协议栈,可以避免发生数据拥堵的问题,提高数据传输的数据。
结合第一方面,在一种可能的实现方式中,转发设备基于窗口分配规则向第二设备发送第二报文,包括:
转发设备获取蓝牙控制器的窗口忙闲情况;
转发设备在蓝牙控制器存在空闲窗口时,通过空闲窗口发送第二报文。
在一种可能的实现方式中,转发设备可以通过窗口分配模块获取蓝牙控制器的窗口忙闲情况;在蓝牙控制器存在空闲窗口时,由窗口分配模块将第二报文发送至蓝牙控制器的空闲窗口,由蓝牙控制器通过空闲窗口将第二报文发送至第二设备。
结合第一方面,在一种可能的实现方式中,方法还包括:
转发设备接收第二设备发送的第三报文,第三报文包括第二数据和第二指示信息;第二指示信息用于指示接收设备为第一设备;
转发设备在确定第三报文指示转发时,通过第一蓝牙协议栈解析第三报文,得到第二数据;
转发设备通过第一协议栈,对第二数据和第二指示信息进行处理,得到第四报文;
转发设备基于第二指示信息,将第四报文发送至第一设备。
实施本申请实施例,转发设备在接收到需要转发至其他设备的蓝牙报文时,可以通过位于内核态的第一蓝牙协议栈进行处理,不需多次穿越用户态和内核态,可以减少性能开销,降低功耗。
结合第一方面,在一种可能的实现方式中,方法还包括:
转发设备响应于用户操作,通过第二蓝牙协议栈生成蓝牙报文;
转发设备基于窗口分配规则向第三设备发送蓝牙报文,第三设备与转发设备通过蓝牙进行通信。
实施本申请实施例,转发设备与其他设备直接进行蓝牙通信,不充当转发角色时,转发设备可以通过用户态的第二蓝牙协议栈响应上层应用,从而生成蓝牙报文,上层应用不需改动,即可通过用户态的第二蓝牙协议栈进行蓝牙数据处理,该方案适配性高。
结合第一方面,在一种可能的实现方式中,方法还包括:
转发设备接收第二设备发送的第五报文,第五报文包括第三数据和第三指示信息;第三指示信息用于指示接收设备为转发设备;
转发设备基于第一蓝牙协议栈解析第三报文,得到第四数据和第三指示信息;
转发设备基于第二指示信息,通过第二蓝牙协议栈对第四数据进行解析,得到第三数据。
实施本申请实施例,转发设备在接收到发送至转发设备的蓝牙报文时,转发设备可以通过第一蓝牙协议栈在解析确定该报文不是转发数据时,将该报文发送至第二蓝牙协议栈进行解析。
第二方面,本申请实施例公开了一种数据传输装置,装置与第一设备通过第一网络进行通信,装置与第二设备通过蓝牙进行通信,装置包括:
网络接收单元,用于接收第一设备发送的第一报文,第一报文包括第一数据和第一指示信息;第一指示信息用于指示接收设备为第二设备;
第一网络对应的第一协议栈,用于解析第一报文,得到第一数据和第一指示信息;
内核态的第一蓝牙协议栈,用于对第一数据和第一指示信息进行处理,得到第二报文;
窗口分配单元,用于基于窗口分配规则向第二设备发送第二报文;窗口分配规则用于管理来自用户态的第二蓝牙协议栈的报文和来自第一蓝牙协议栈的报文的发送顺序。
在一种可能的实现方式中,网络接收单元用于接收第一网络的报文,例如第一网络为以太网时,网络接收单元可以包括网卡驱动或WIFI驱动等;窗口分配单元可以包括位于第一蓝牙协议栈的窗口分配模块和蓝牙发送单元,其中,窗口分配模块用于基于窗口分配规则确定发送来自第一蓝牙协议栈或来自第二蓝牙协议栈的内容;蓝牙发送单元用于发送蓝牙网络中的蓝牙报文,可以包括UART驱动、UART接口以及蓝牙控制器等。
在一种可能的实现方式中,窗口分配模块可以为第一蓝牙协议栈中的模块。如下文中图6所示。需要说明的是,本申请实施例中,各功能模块的划定可以拆分为更多功能模块,也可以合并为同一个功能模块,本申请实施例对此不作限定。
在一种可能的实现方式中,第一蓝牙协议栈包括第二蓝牙协议栈的部分或全部内容。
结合第二方面,在一种可能的实现方式中,窗口分配规则包括来自第一蓝牙协议栈的报文优先发送、来自第二蓝牙协议栈的报文优先发送、按比例发送来自第一蓝牙协议栈的报文和来自第二蓝牙协议栈的报 文。
结合第二方面,在一种可能的实现方式中,窗口分配单元,用于获取蓝牙控制器的窗口忙闲情况;
在蓝牙控制器存在空闲窗口时,通过空闲窗口发送第二报文。
结合第二方面,在一种可能的实现方式中,装置还包括蓝牙接收单元和网络发送单元:
蓝牙接收单元,用于接收第二设备发送的第三报文,第三报文包括第二数据和第二指示信息;第二指示信息用于指示接收设备为第一设备;
第一蓝牙协议栈,用于在确定第三报文指示转发时解析第三报文,得到第二数据;
第一协议栈,用于对第二数据和第二指示信息进行处理,得到第四报文;
网络发送单元,用于基于第二指示信息,将第四报文发送至第一设备。
在一种可能的实现方式中,网络发送单元用于发送第一网络的报文,例如第一网络为以太网时,网络发送单元可以包括网卡驱动或WIFI驱动等;蓝牙接收单元用于接收蓝牙网络中的蓝牙报文,可以包括UART驱动、UART接口以及蓝牙控制器等。
结合第二方面,在一种可能的实现方式中,第二蓝牙协议栈,用于响应于用户操作,生成蓝牙报文;
窗口分配单元,用于基于窗口分配规则向第三设备发送蓝牙报文,第三设备与转发设备通过蓝牙进行通信。
结合第二方面,在一种可能的实现方式中,装置还包括蓝牙接收单元;
蓝牙接收单元,用于接收第二设备发送的第五报文,第五报文包括第三数据和第三指示信息;第三指示信息用于指示接收设备为转发设备;
第一蓝牙协议栈,用于解析第三报文,得到第四数据和第三指示信息;
第二蓝牙协议栈,用于对第四数据进行解析,得到第三数据。
在一种可能的实施方式中,第一蓝牙协议栈和第二蓝牙协议栈通过虚拟串口UART进行通信,那么,第一蓝牙协议栈可以基于第三指示信息确定第三报文的接收设备为转发设备时,通过虚拟串口UART将第四数据发送至所述第二蓝牙协议栈;进而,第二蓝牙协议栈可以对所述第四数据进行解析,得到所述第三数据。
第三方面,本申请实施例公开了一种数据传输装置,包括处理器和通信接口,所述处理器用于调用存储器中存储的计算机程序,以实现第一方面或者第一方面的任意一种可能的实施方式所描述的方法。
第四方面,本申请实施例还提供一种芯片系统,所述芯片系统包括至少一个处理器和通信接口,所述通信接口用于发送和/或接收数据,所述至少一个处理器用于调用至少一个存储器中存储的计算机程序,以使得所述芯片系统所在的装置实现第一方面或者第一方面的任意一种可能的实施方式所描述的方法。
第五方面,本申请实施例公开了一种计算机可读存储介质,所述计算机可读存储介质中存储有计算机程序,当所述计算机程序在一个或多个处理器上运行时,执行第一方面或第一方面的任意一种可能的实施方式所描述的方法。
第六方面,本申请实施例公开了一种计算机程序产品,当所述计算机程序产品在一个或多个处理器上运行时,执行第一方面或第一方面的任意一种可能的实施方式所描述的方法。
附图说明
以下对本申请实施例用到的附图进行介绍。
图1是本申请实施例提供的一种蓝牙部署的示意图;
图2是本申请实施例提供的一种异构网络的示意图;
图3是本申请实施例提供的另一种蓝牙部署的示意图;
图4是本申请实施例提供的又一种蓝牙部署的示意图;
图5是本申请实施例提供的一种可能的数据传输系统的示意图;
图6是本申请实施例提供的一种当前设备的蓝牙部署的示意图;
图7是本申请实施例提供的一种发送窗口示意图;
图8A是本申请实施例提供的一种数据传输方法的流程示意图;
图8B是本申请实施例提供的一种数据传输方法的流程图;
图9是本申请实施例提供的一种数据传输装置的结构示意图;
图10是本申请实施例提供的一种电子设备的一种硬件结构示意图;
图11是本申请实施例提供的一种电子设备100的软件结构框图。
具体实施方式
下面结合本申请实施例中的附图对本申请实施例进行描述。需要说明的是,本申请中,“示例性的”或者“例如”等词用于表示作例子、例证或说明。本申请中被描述为“示例性的”或者“例如”的任何实施例或设计方案不应被解释为比其他实施例或设计方案更优选或更具优势。确切而言,使用“示例性的”或者“例如”等词旨在以具体方式呈现相关概念。
本申请中实施例提到的“至少一个”是指一个或者多个,“多个”是指两个或两个以上。“以下至少一项(个)”或其类似表达,是指的这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a、b、或c中的至少一项(个),可以表示:a、b、c、(a和b)、(a和c)、(b和c)、或(a和b和c),其中a、b、c可以是单个,也可以是多个。“和/或”,描述关联对象的关联关系,表示可以存在三种关系,例如,A和/或B,可以表示:单独存在A、同时存在A和B、单独存在B这三种情况,其中A、B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。
以及,除非有相反的说明,本申请实施例使用“第一”、“第二”等序数词是用于对多个对象进行区分,不用于限定多个对象的顺序、时序、优先级或者重要程度。例如,第一信息和第二信息,只是为了区分不同的信息,而并不是表示这两种信息的内容、优先级、发送顺序或者重要程度等的不同。
在介绍本申请实施例之前,先对本申请实施例中出现的技术术语进行介绍。
1、蓝牙
蓝牙是常见的通讯协议,蓝牙设备通常需要部署两部分,蓝牙主机(Host)和蓝牙控制器(Controller)。其中,蓝牙Host通常运行在蓝牙设备的系统级芯片(System on Chip,SOC)中,主要负责协议逻辑的处理;蓝牙Controller通常是一个独立的芯片挂在SOC外,蓝牙Cont更多的负责蓝牙物理层处理,少数SOC也会集成蓝牙Controller。需要说明的是,上述蓝牙设备是指支持蓝牙通信的设备。
请参见图1,图1是本申请实施例提供的一种蓝牙部署的示意图。
如图1所示,蓝牙Host可以包括蓝牙应用、蓝牙协议栈和通用异步收发传输器(Universal Asynchronous Receiver/Transmitter,UART)接口;蓝牙Controller包括UART接口。其中,蓝牙Host的UART接口与蓝牙Controller的UART接口可以通过线缆或(Printed Circuit Board,PCB)线路连接以传输数据,例如用于传输主机控制器接口层(HostController Interface,HCI)命令;蓝牙Controller与蓝牙天线连接,通过蓝牙天线接收或发送蓝牙数据。
2、异构网络
其中,异构是指两个或以上的无线数据传输系统采用了不同的接入技术,或者是采用相同的无线接入技术但属于不同的无线运营商。
一个产品可以具有多种通讯装置,多种通讯装置可以包括蓝牙装置、WIFI装置、以太网(EtherNet,ETH)装置等。这些通讯装置可以组成一个网络,例如,多个产品的蓝牙装置可以组成蓝牙网络;又例如,多个产品的WIFI/ETH装置可以组成ETH网络。在同一个网络内的装置可以自由相互通讯。
但是,通常在不同网络间的通讯装置无法直接通讯,需要通过异构网络方案才能实现跨网络类型的通讯,例如,将ETH网络的数据转发给蓝牙网络或将蓝牙网络的数据转发给ETH网络。
请参见图2,图2是本申请实施例提供的一种异构网络的示意图。其中,该异构网络包括路由、设备A、设备B、设备D和设备H。其中,设备A和设备B均包括蓝牙装置和WIFI装置;设备D和设备H均包括蓝牙装置。
图2中以实直线代表WiFi连接,以虚线代表蓝牙连接。如图2所示,设备A和设备B分别通过其各自的WiFi装置连接路由的WiFi,可以构成WiFi网络1;设备B和设备H通过其各自的蓝牙装置进行蓝牙连接,构成蓝牙网络1;设备A和设备D通过其各自的蓝牙装置进行蓝牙连接,构成蓝牙网络2。
下面先介绍现有技术中异构网络中数据传输的两种方法。
方法一:请参见图3,图3是本申请实施例提供的另一种蓝牙部署的示意图。如图3所示,用户态包括蓝牙协议栈和转发应用,蓝牙协议栈和转发应用之间可以通过进程间通信(Inter-Process Communication,IPC)进行数据传输;内核态包括IP栈、UART驱动、网卡驱动和WiFi驱动,其中,蓝牙协议栈包括蓝牙芯片驱动程序,如vendorlib。
如图3所示,蓝牙协议栈位于用户态,在用户态实现转发APP将来自IP的网络转发到蓝牙网络上, 或将来自蓝牙网络的数据转发到ETH网络上。其中,蓝牙芯片驱动程序一般由芯片厂家提供,用于完成对芯片进行初始化配置、管理和数据收发等操作,通常不开源。
如图3所示,由于ETH网络上比较常用的IP协议栈一般实现在内核态中,因此在IP协议的数据与蓝牙网络的数据进行相互转发时,需要多次穿越用户态和内核态之间,导致性能开销过大。
方法二:请参见图4,图4是本申请实施例提供的又一种蓝牙部署的示意图。如图4所示,用户态包括应用,内核态包括转发模块、蓝牙协议栈、IP栈、UART驱动、网卡驱动和WiFi驱动,其中,蓝牙协议栈包括蓝牙芯片驱动。
如图4所示,蓝牙协议栈位于内核态,内核态包括转发模块,转发模块用于将来自IP的网络转发到蓝牙网络或将来自蓝牙网络的数据转发到ETH网络。
该方法中直接将蓝牙协议栈移动至内核态,虽然解决了多次穿越用户态和内核态的问题,但是会对上层应用造成较大影响,需要配套更改上层应用设计。另外,该方法需要芯片厂商提供蓝牙芯片驱动程序,但受限于内核的开源协议,该驱动需要开源,而芯片驱动中通常包含蓝牙芯片厂商的核心价值资产,厂家一般不愿意开源。
下面对本申请实施例的系统架构和业务场景进行描述。需要说明的是,本申请描述的系统架构及业务场景是为了更加清楚的说明本申请的技术方案,并不构成对于本申请提供的技术方案的限定,本领域普通技术人员可知,随着系统架构的演变和新业务场景的出现,本申请提供的技术方案对于类似的技术问题,同样适用。
请参见图5,图5是本申请实施例提供的一种可能的数据传输系统的示意图,该数据传输系统10包括第一设备101、转发设备102和第二设备103。其中:
如图5所示,第一设备101和转发设备102建立蓝牙连接,转发设备102与第二设备103建立非蓝牙通信连接。例如,第一设备101和转发设备102通过蓝牙网络进行通信,转发设备102与第二设备103通过WiFi网络进行通信。
在一些实施例中,在第一设备101向第二设备103发送数据时,由于第一设备101和第二设备103不在同一个网络中,因此,第一设备101可以先通过转发设备102将该数据转发至第二设备103。
可以理解的,可以是第一设备101为发送端,第二设备103为接收端;也可以是第二设备103为发送端,第一设备101为接收端,可以根据具体场景确定,此处不作限定。
其中,第一设备101、转发设备102和第二设备103均可以为电子设备。电子设备可以包括但不限于手机、穿戴设备(如手表等)、平板、显示器、电视机、桌面型计算机、膝上型计算机、手持计算机、笔记本电脑、超级移动个人计算机、上网本,增强现实设备、虚拟现实设备、人工智能设备、车载设备、智能家居设备等电子设备。
此处仅为示例,不应造成对第一设备101和第二设备103的限定,在不同的应用场景中,第一设备101、转发设备102和第二设备103可以为相同或不同的设备,此处不做限定。
需要说明的是,上述数据传输系统上还可以包括其它网元或设备(例如路由),此处不作限定。
接下来,对上述数据传输系统中的设备进行介绍。
请参见图6,图6是本申请实施例提供的一种当前设备的蓝牙部署的示意图。当前设备可以为上述数据传输系统中的第一设备101、转发设备102和第二设备103中的任一个。
如图6所示,当前设备的蓝牙部署包括蓝牙Host和蓝牙Controller,其中,蓝牙Host包括用户态和内核态,用户态中可以包括蓝牙协议栈和蓝牙应用,蓝牙协议栈和蓝牙应用可以通过IPC进行通信,其中,蓝牙协议栈包括蓝牙驱动程序,如vendorlib;内核态包括虚拟UART、转发模块、蓝牙协议子栈、UART驱动、UART接口、其他协议栈(如IP栈)以及网卡驱动、WiFi驱动等,其中,蓝牙协议子栈包括窗口分配模块。其中:
位于用户态的蓝牙协议栈负责蓝牙Controller的初始化等动作;内核态可以仅用于发送标准的HCI命令。
位于内核态的蓝牙协议子栈,用于负责转发异构网络中的数据。
虚拟UART用于蓝牙协议栈和蓝牙协议子栈之间的数据传输,具体可以包括将蓝牙协议栈的数据发送至蓝牙协议子栈,或者,将蓝牙协议子栈的数据发送至蓝牙协议栈。例如,用户态的蓝牙协议栈向蓝牙Controller发送数据时,虚拟UART可以拦截蓝牙数据,交给蓝牙协议子栈安排发送,具体可以由蓝牙协 议子栈中的窗口分配模块安排发送。又例如,当该当前设备为接收数据的设备时,蓝牙协议子栈通过虚拟UART将该数据透传发送到蓝牙协议栈,该数据可以是由其他协议栈发送至蓝牙协议子栈的,也可以是蓝牙controller发送至蓝牙协议子栈的。
转发模块用于蓝牙协议子栈与其他协议栈之间的数据传输。例如,转发模块可以将来自其他网络类型的数据转发到蓝牙协议子栈。又例如,转发模块可以将蓝牙协议子栈的数据转发到其他相应的协议栈。
蓝牙协议子栈包含蓝牙协议栈的部分/全部内容,以及窗口分配模块。
窗口分配模块用于管理蓝牙协议栈和蓝牙协议子栈向蓝牙Controller发送的数据。例如,窗口分配模块可以基于配置规则,在蓝牙Controller有空闲发送窗口(buffer)时向UART接口发送来自蓝牙协议栈或转发模块的数据。
其中,配置规则包括但不限于:转发优先、蓝牙协议栈优先、按比例分配等。该配置规则用于当前设备的窗口分配模块在接收到蓝牙协议栈和蓝牙协议子栈要发送的报文时,决定发送蓝牙协议栈要发送的报文还是蓝牙协议子栈要发送的报文。其中,转发优先是指,当前设备的窗口分配模块在接收到蓝牙协议栈和蓝牙协议子栈要发送的报文时,优先发送蓝牙协议子栈的报文;蓝牙协议栈优先是指,优先发送所述蓝牙协议栈的报文;按比例分配是指,按照一定的比例和顺序发送蓝牙协议栈和蓝牙协议子栈的内容。例如,比例为蓝牙协议栈:蓝牙协议子栈为2:1,则窗口分配模块先向UART接口发送2个来自蓝牙协议栈的报文,再向向UART接口发送1个来自转发模块的报文,依次类推。
蓝牙Controller内部可以建立若干个发送窗口,待发送报文可以先传输到空闲的发送窗口中,再从发送窗口发送至其他设备。在蓝牙Controller完成一个/多个发送窗口内的报文发送后,会向蓝牙Host(具体可以是蓝牙Host中的窗口分配模块)上报命令,该命令用于表示报文发送完成,该命令可以为指示报文发送完成的HCI命令,进而,蓝牙协议子栈通过上述命令(如上述HCI命令)可以获知蓝牙Controller当前发送窗口的忙闲情况。
请参见图7,图7是本申请实施例提供的一种发送窗口示意图。
如图7所示,窗口分配模块可以接收蓝牙Controller通过UART发送过来的数据,解析并获取其中上报的命令。例如,命令可以包括第一HCI命令和第二HCI命令。
其中,第一HCI命令用于指示报文(或称为包)发送完成,例如,第一HCI命令包括指示信息,该指示信息用于指示发送窗口的忙闲情况。具体的,窗口分配模块可以基于第一HCI命令,确定发送窗口的忙闲情况;进而,基于发送窗口的忙闲情况以及配置规则,确定接下来发送蓝牙协议栈还是蓝牙协议子栈的报文;在确定发送蓝牙协议栈的报文时,将该第一HCI命令透传给虚拟UART;在确定发送蓝牙协议子栈的报文时,则扣下这个HCI命令,向蓝牙Controller发送蓝牙协议子栈的报文。
第二HCI命令可以包括其他设备发送至当前设备的数据以及该数据的数据类型,该数据类型可以包括转发数据或接收数据,其中,转发数据为需要转发至非蓝牙网络的设备的数据,接收数据为发送至当前设备的数据。那么,窗口分配模块可以基于第二HCI命令,确定数据的数据类型,进而,将转发数据通过第一通道发送至蓝牙协议子栈,将接收数据通过第二通道发送至蓝牙协议栈。其中,第一通道和第二通道为不同的通道。
请参见图8A,图8A是本申请实施例提供的一种数据传输方法的流程示意图。
首先,结合图8A,介绍由第一设备通过转发设备向第二设备发送报文的数据传输过程。
在第一设备侧:第一设备可以响应于针对第一应用的用户操作,通过蓝牙协议子栈生成第一报文,该第一报文包括指示信息和数据。其中,指示信息可以是由蓝牙协议子栈中的异构传输协议生成的,该指示信息用于指示接收设备为第二设备,该指示信息可以为第二设备的标识(如第二设备的地址)。进而,由蓝牙协议子栈中的窗口分配模块将第一报文通过第一设备的UART驱动发送至第一设备的UART接口。进而,该UART接口将该第一报文通过线缆或PBC线路发送至第一设备的蓝牙控制器Controller;该蓝牙Controller将该第一报文发送至转发设备的蓝牙Controller。
在转发设备侧:转发设备的Controller在接收到第一报文后,可以将该第一报文通过线缆或PBC线路发送至转发设备的UART接口;该UART接口通过转发设备的UART驱动将第一报文发送至转发设备的蓝牙协议子栈;由蓝牙协议子栈解析第一报文,得到数据和指示信息,进而,将数据和指示信息发送至转发模块;转发模块基于指示信息确定下一个协议栈(如IP协议栈),进而,将数据和指示信息转发至下一个协议栈;由下一个协议栈对数据和指示信息进行协议处理以得到第二报文,第二报文包括协议处理后的数据和协议处理后的指示信息;进而,通过网卡驱动或WiFi驱动将第二报文发送至第二设备。
在第二设备侧:第二设备通过网卡驱动或WiFi驱动将第二报文发送至其他协议栈(如IP协议栈),由其他协议栈获取第二报文中的数据;进而,异构传输协议可以将该数据上报至第二应用,由第二应用进行显示等操作。
需要说明的是,以上“第一”和“第二”仅用于区分,并不造成对本申请实施例的限定。为方便理解,本申请实施例将发送设备发送的报文称为第一报文,接收设备接收的报文称为第二报文;第一报文和第二报文中的“第一”和“第二”仅用于区别,第一报文和第二报文由不同的协议栈基于其各自的协议规则对同一数据进行不同的协议处理的结果。
接下来,结合图8A,介绍由第二设备通过转发设备向第一设备发送报文的数据传输过程。
在第二设备侧:第二设备可以响应于针对第二应用的用户操作,通过异构传输协议生成指示接收设备为第二设备的指示信息;进而,通过其他协议栈(如IP协议栈)生成第一报文,该第一报文包括该指示信息和数据;第二设备通过网卡驱动或WiFi驱动将第一报文发送至转发设备。
在转发设备侧:转发设备通过网卡驱动或WiFi驱动接收第二设备发送的第一报文;进而,由其他协议栈(如IP协议栈)解析第一报文,得到数据和指示信息;进而,由其他协议栈将该数据和该指示信息发送至转发模块;转发模块基于指示信息确定该第一报文为转发至第一设备的报文,因此,转发模块将该数据和该指示信息发送至蓝牙协议子栈,由蓝牙协议子栈对该数据和该指示信息进行协议处理,得到第二报文,第二报文包括协议处理后的数据和协议处理后的指示信息;进而,由窗口分配模块将第二报文通过转发设备的UART驱动发送至转发按设备的UART接口;进而,由该UART接口将该第二报文通过线缆或PBC线路发送至转发设备的蓝牙控制器Controller;由转发设备的蓝牙Controller将该第一报文发送至第一设备的蓝牙Controller。
在第一设备侧:第一设备的蓝牙控制器在接收第二报文后,将该第二报文通过线缆或PBC线路发送至第一设备的UART接口;由该UART接口通过转发设备的UART驱动将第一报文发送至转发设备的蓝牙协议子栈;由该蓝牙协议子栈解析第二报文,得到第二报文中的数据和指示信息;该蓝牙协议子栈可以将解析到的数据上报至第一应用,由第一应用进行显示等操作。
请参见图8B,图8B是本申请实施例提供的一种数据传输方法的流程图。如图8B所示,该方法包括以下部分或全部步骤:
S801:第一设备与转发设备建立第一网络连接。
其中,第一网络为非蓝牙网络的其它网络类型,例如以太网、WiFi网络等,此处不作限定。
S802:第二设备与转发设备建立蓝牙连接。
其中,第二设备和转发设备为具备蓝牙功能的设备。
在一些实施例中,第二设备和转发设备的蓝牙部署均可以如图6所示。
S803:第一设备通过第一网络连接,向转发设备发送第一报文,第一报文包括第一数据和第一指示信息;第一指示信息用于指示接收设备为第二设备。
在一些实施例中,第一设备响应于向第二设备发送第一数据的用户操作,在确定第二设备与第一设备不是同一个网络的设备时,查询可为第一设备和第二设备转发数据的设备;在确定转发设备时,可以通过第一网络连接,向转发设备发送第一报文,第一报文包括第一数据和第一指示信息;第一指示信息用于指示接收设备为第二设备。
S804:转发设备通过第一网络对应的第一协议栈解析第一报文,得到第一数据和第一指示信息。
在一些实施例中,转发设备在接收到来自第二设备发送的第一报文时,可以通过第一网络对应的第一协议栈解析第一报文,得到第一数据和第一指示信息。
例如,第一网络为IP协议栈。
S805:转发设备通过内核态的第一蓝牙协议栈对第一数据和第一指示信息进行处理,得到第二报文。
在一些实施例中,转发设备在通过第一网络对应的第一协议栈解析第一报文,得到第一指示信息后,转发设备基于第一指示信息,确定处理该第一数据和第一指示信息的协议栈为内核态的第一蓝牙协议栈;进而,转发设备通过第一蓝牙协议栈对第一数据和第一指示信息进行处理,得到第二报文。
其中,第一蓝牙协议栈可以为图8A中转发设备中的内核态的蓝牙协议子栈,也可以为图6中所示的内核态的蓝牙协议子栈。
S806:转发设备基于窗口分配规则向第二设备发送第二报文;窗口分配规则用于管理来自用户态的第 二蓝牙协议栈的报文和来自第一蓝牙协议栈的报文的发送顺序。
在一些实施例中,转发设备在通过第一蓝牙协议栈得到第二报文后,可以通过窗口分配模块确定发送来自用户态的第二蓝牙协议栈的报文还是来自第一蓝牙协议栈的报文;在确定发送来自第一蓝牙协议栈的报文,将第二报文发送至蓝牙控制器,通过蓝牙控制器和蓝牙天线将第二报文发送至第二设备。
其中,第一蓝牙协议栈可以为图6中所示的用户态的蓝牙协议栈;窗口分配模块可以为图6中的窗口分配模块。
请参见图9,图9是本申请实施例提供的一种数据传输装置的结构示意图,该装置可以为上文中的转发设备。当然,该装置也可以为转发设备中的一个器件,例如芯片或者集成电路等,该装置可以包括网络接收单元901、第一网络对应的第一协议栈902、内核态的第一蓝牙协议栈903和窗口分配单元904。该数据传输装置用于实现前述的数据传输方法,例如图8A或者图8B所示的任意一个实施例的数据传输方法。
在一种可能的实施方式中,该数据传输装置与第一设备通过第一网络进行通信,所述装置与第二设备通过蓝牙进行通信,所述装置包括:
网络接收单元901,用于接收所述第一设备发送的第一报文,所述第一报文包括第一数据和第一指示信息;所述第一指示信息用于指示接收设备为所述第二设备;
所述第一网络对应的第一协议栈902,用于解析所述第一报文,得到所述第一数据和所述第一指示信息;
内核态的第一蓝牙协议栈903,用于对所述第一数据和所述第一指示信息进行处理,得到第二报文;
窗口分配单元904,用于基于窗口分配规则向所述第二设备发送所述第二报文;所述窗口分配规则用于管理来自用户态的第二蓝牙协议栈905的报文和来自所述第一蓝牙协议栈903的报文的发送顺序。
实施本申请实施例,转发设备可以基于用户态的第二蓝牙协议栈905和内核态的第一蓝牙协议栈903分别对转发数据和非转发数据进行处理,在处理转发数据通过位于内核态的第一蓝牙协议栈903进行处理,不需多次穿越用户态和内核态,可以减少性能开销,降低功耗;用户态的第二蓝牙协议栈905用于处理非转发数据,上层应用不需改动,即可通过用户态的第二蓝牙协议栈905进行蓝牙数据处理,该方案适配性高。
在一种可能的实施方式中,所述窗口分配规则包括来自所述第一蓝牙协议栈903的报文优先发送、来自所述第二蓝牙协议栈905的报文优先发送、按比例发送来自所述第一蓝牙协议栈903的报文和来自所述第二蓝牙协议栈905的报文。
实施本申请实施例,由于转发设备中部署了用户态的第二蓝牙协议栈905和内核态的第一蓝牙协议栈903的双栈结构,在蓝牙数据接收和蓝牙数据发送的过程中,转发设备可以通过窗口分配规则确定当前发送第二蓝牙协议栈905还是第一蓝牙协议栈903,可以避免发生数据拥堵的问题,提高数据传输的速度。
在一种可能的实施方式中,所述窗口分配单元904,用于获取蓝牙控制器的窗口忙闲情况;
在所述蓝牙控制器存在空闲窗口时,通过所述空闲窗口发送所述第二报文。
在一种可能的实施方式中,所述装置还包括蓝牙接收单元906和网络发送单元907:
所述蓝牙接收单元906,用于接收所述第二设备发送的第三报文,所述第三报文包括第二数据和第二指示信息;所述第二指示信息用于指示接收设备为所述第一设备;
所述第一蓝牙协议栈903,用于在确定所述第三报文指示转发时解析所述第三报文,得到所述第二数据;
所述第一网络对应的第一协议栈902,用于对所述第二数据和所述第二指示信息进行处理,得到第四报文;
所述网络发送单元907,用于基于所述第二指示信息,将所述第四报文发送至所述第一设备。
实施本申请实施例,转发设备在接收到需要转发至其他设备的蓝牙报文时,可以通过位于内核态的第一蓝牙协议栈903进行处理,不需多次穿越用户态和内核态,可以减少性能开销,降低功耗。
在一种可能的实施方式中,所述第二蓝牙协议栈905,用于响应于用户操作,生成蓝牙报文;
所述窗口分配单元904,用于基于所述窗口分配规则向第三设备发送所述蓝牙报文,所述第三设备与所述转发设备通过蓝牙进行通信。
在一种可能的实施方式中,所述装置还包括蓝牙接收单元906;
所述蓝牙接收单元906,用于接收所述第二设备发送的第五报文,所述第五报文包括第三数据和第三指示信息;所述第三指示信息用于指示接收设备为所述转发设备;
所述第一蓝牙协议栈903,用于解析所述第三报文,得到所述第四数据和所述第三指示信息;
所述第二蓝牙协议栈905,用于对所述第四数据进行解析,得到所述第三数据。
实施本申请实施例,转发设备在接收到发送至转发设备的蓝牙报文时,转发设备可以通过第一蓝牙协议栈903在解析确定该报文不是转发数据时,将该报文发送至第二蓝牙协议栈905进行解析。
在一种可能的实施方式中,第一蓝牙协议栈903和第二蓝牙协议栈905通过虚拟UART进行通信,那么,第一蓝牙协议栈903可以基于第三指示信息,将第四数据发送至所述第二蓝牙协议栈905;进而,第二蓝牙协议栈905可以对所述第四数据进行解析,得到所述第三数据。其中,第一蓝牙协议栈903、第二蓝牙协议栈905和虚拟UART之间的数据传输可以参见上文中的相关描述。
需要说明的是,各个单元的实现还可以对应参照图6、图8A或者图8B所示的实施例的相应描述。该数据传输装置可以为图6、图8A或者图8B所示实施例中的转发设备。
下面以电子设备100为例对上文中的设备进行具体说明,上文中的第一设备、转发设备和第二设备均可以为该电子设备100。
图10示例性示出了电子设备100的一种硬件结构示意图。
应该理解的是,电子设备100可以具有比图中所示的更多的或者更少的部件,可以组合两个或多个的部件,或者可以具有不同的部件配置。图10中所示出的各种部件可以在包括一个或多个信号处理和/或专用集成电路在内的硬件、软件、或硬件和软件的组合中实现。
电子设备100可以包括:处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。
可以理解的是,本申请实施例示意的结构并不构成对电子设备100的具体限定。在本申请另一些实施例中,电子设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processing unit,GPU),图像信号处理器(image signal processor,ISP),控制器,存储器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。
其中,控制器可以是电子设备100的神经中枢和指挥中心。控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。
处理器110中还可以设置存储器,用于存储指令和数据。在一些实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了系统的效率。
在一些实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuit sound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronous receiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purpose input/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一些实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现电子设备100的触摸功能。
I2S接口可以用于音频通信。在一些实施例中,处理器110可以包含多组I2S总线。处理器110可以 通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一些实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一些实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一些实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。
在一些实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。
本申请实施例中,UART接口可以用于负责蓝牙主机和蓝牙控制器之间的通信。
在一些实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等外围器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(display serial interface,DSI)等。在一些实施例中,处理器110和摄像头193通过CSI接口通信,实现电子设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现电子设备100的显示功能。
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。
在一些实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。
SIM接口可以被用于与SIM卡接口195通信,实现传送数据到SIM卡或读取SIM卡中数据的功能。
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为电子设备100充电,也可以用于电子设备100与外围设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他电子设备,例如AR设备等。
可以理解的是,本申请实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对电子设备100的结构限定。在本申请另一些实施例中,电子设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,外部存储器,显示屏194,摄像头193,和无线通信模块160等供电。
电子设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。
天线1和天线2用于发射和接收电磁波信号。电子设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。
在另外一些实施例中,天线可以和调谐开关结合使用。
移动通信模块150可以提供应用在电子设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(low noise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一些实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。
在一些实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备 (不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。
在一些实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。
无线通信模块160可以提供应用在电子设备100上的包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星系统(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。
在本申请实施例中,转发设备通过无线通信模块160与第一设备和第二设备进行通信。
例如,转发设备中的无线通信模块160可以提供包括无线局域网(wireless local area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT)无线通信的解决方案;而第一设备中的无线通信模块具备WiFi功能但不具备蓝牙功能,第二设备中的无线通信模块具备蓝牙功能但不具备WiFi功能,那么转发设备可以与第一设备建立WiFi连接,转发设备与第二设备建立蓝牙连接,进而,转发设备可以实现第一设备和第二设备进行的数据传输。
在一些实施例中,电子设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得电子设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯系统(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(code division multiple access,CDMA),宽带码分多址(wideband code division multiple access,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。
其中,所述GNSS可以包括全球卫星定位系统(global positioning system,GPS),全球导航卫星系统(global navigation satellite system,GLONASS),北斗卫星导航系统(beidou navigation satellite system,BDS),准天顶卫星系统(quasi-zenith satellite system,QZSS)和/或星基增强系统(satellite based augmentation systems,SBAS)。
电子设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。
显示屏194用于显示图像,视频等。
显示屏194包括显示面板。显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。
在一些实施例中,电子设备100可以包括1个或N个显示屏194,其中,N为大于1的正整数。
电子设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度等进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一些实施例中,ISP可以设置在摄像头193中。
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。
感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一些实施例中,电子设备100可以包括1个或N个摄像头193,N为大于1的正整数。
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当电子设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。
视频编解码器用于对数字视频压缩或解压缩。电子设备100可以支持一种或多种视频编解码器。这样,电子设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现电子设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展电子设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。处理器110通过运行存储在内部存储器121的指令,从而执行电子设备100的各种功能应用以及数据处理。
内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储操作系统,至少一个功能所需的应用(比如人脸识别功能,指纹识别功能、移动支付功能等)等。存储数据区可存储电子设备100使用过程中所创建的数据(比如人脸信息模板数据,指纹信息模板等)等。
此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。
电子设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一些实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。电子设备100可以通过扬声器170A收听音乐,或收听免提通话。
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当电子设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。电子设备100可以设置至少一个麦克风170C。在另一些实施例中,电子设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。
在另一些实施例中,电子设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动电子设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一些实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。电子设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,电子设备100根据压力传感器180A检测所述触摸操作强度。电子设备100也可以根据压力传感器180A的检测信号计算触摸的位置。
在一些实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。
陀螺仪传感器180B可以用于确定电子设备100的运动姿态。在一些实施例中,可以通过陀螺仪传感器180B确定电子设备100围绕三个轴(即,x,y和z轴)的角速度。陀螺仪传感器180B可以用于拍摄防抖。
示例性的,当按下快门,陀螺仪传感器180B检测电子设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消电子设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。
气压传感器180C用于测量气压。在一些实施例中,电子设备100通过气压传感器180C测得的气压值 计算海拔高度,辅助定位和导航。
磁传感器180D包括霍尔传感器。电子设备100可以利用磁传感器180D检测翻盖皮套的开合。在一些实施例中,当电子设备100是翻盖机时,电子设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。
加速度传感器180E可检测电子设备100在各个方向上(一般为三轴)加速度的大小。当电子设备100静止时可检测出重力的大小及方向。还可以用于识别电子设备姿态,应用于横竖屏切换,计步器等应用。
距离传感器180F,用于测量距离。电子设备100可以通过红外或激光测量距离。在一些实施例中,拍摄场景,电子设备100可以利用距离传感器180F测距以实现快速对焦。
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。电子设备100通过发光二极管向外发射红外光。电子设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定电子设备100附近有物体。当检测到不充分的反射光时,电子设备100可以确定电子设备100附近没有物体。电子设备100可以利用接近光传感器180G检测用户手持电子设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。
环境光传感器180L用于感知环境光亮度。电子设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测电子设备100是否在口袋里,以防误触。
指纹传感器180H用于采集指纹。电子设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。
温度传感器180J用于检测温度。在一些实施例中,电子设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,电子设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,电子设备100对电池142加热,以避免低温导致电子设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,电子设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。
触摸传感器180K,也称“触控面板”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输出。在另一些实施例中,触摸传感器180K也可以设置于电子设备100的表面,与显示屏194所处的位置不同。
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。电子设备100可以接收按键输入,产生与电子设备100的用户设置以及功能控制有关的键信号输入。
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。
SIM卡接口195用于连接SIM卡。SIM卡可以通过插入SIM卡接口195,或从SIM卡接口195拔出,实现和电子设备100的接触和分离。电子设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时插入多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。电子设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。
本申请实施例中,电子设备100可以通过处理器110执行所述数据传输方法。
图11是本申请实施例提供的电子设备100的软件结构框图。
分层架构将软件分成若干个层,每一层都有清晰的角色和分工。层与层之间通过软件接口通信。在一些实施例中,将Android系统分为四层,从上至下分别为应用程序层,应用程序框架层,安卓运行时(Android runtime)和系统库,以及内核层。
应用程序层可以包括一系列应用程序包。
如图11所示,应用程序包可以包括相机,图库,日历,通话,地图,导航,WLAN,蓝牙,音乐,视频,短信息和语音助手等应用程序。
在一些实施例中,用户可以通过蓝牙与其他设备进行通信连接,例如用户使用第一设备向第二设备发送第一数据,其中,第一设备和第二设备位于不同的网络中;相应的,第一设备在接收到用户针对蓝牙应用的用户操作时,第一设备向转发设备发送蓝牙报文,蓝牙报文包括第一数据和第一指示信息;第一指示信息用于指示接收设备为第二设备,则转发设备可以通过内核态的第一蓝牙协议栈对第一报文进行处理,得到第一数据和第一指示信息;由于转发设备与第二设备通过第一网络通信,则转发设备可以通过第一网络对应的第一协议栈对第一数据和第一指示信息进行处理,得到第二报文;将第二报文发送至第二设备。
应用程序框架层为应用程序层的应用程序提供应用编程接口(application programming interface,API)和编程框架。应用程序框架层包括一些预先定义的函数。
如图11所示,应用程序框架层可以包括显示(display)管理器,传感器(sensor)管理器,跨设备连接管理器,事件管理器,任务(activity)管理器,窗口管理器,内容提供器,视图系统,资源管理器,通知管理器等。
显示管理器用于系统的显示管理,负责所有显示相关事务的管理,包括创建、销毁、方向切换、大小和状态变化等。一般来说,单设备上只会有一个默认显示模块,即主显示模块。
传感器管理器负责传感器的状态管理,并管理应用向其监听传感器事件,将事件实时上报给应用。
跨设备连接管理器用于和终端设备200建立通信连接,基于该通信连接向终端设备200发送语音信号。
事件管理器用于系统的事件管理服务,负责接收底层上传的事件并分发给各窗口,完成事件的接收和分发等工作。
任务管理器用于任务(Activity)组件的管理,包括启动管理、生命周期管理、任务方向管理等。
窗口管理器用于管理窗口程序。窗口管理器可以获取显示屏大小,判断是否有状态栏,锁定屏幕,截取屏幕等。窗口管理器还用于负责窗口显示管理,包括窗口显示方式、显示大小、显示坐标位置、显示层级等相关的管理。
内容提供器用来存放和获取数据,并使这些数据可以被应用程序访问。所述数据可以包括视频,图像,音频,拨打和接听的电话,浏览历史和书签,电话簿等。
视图系统包括可视控件,例如显示文字的控件,显示图片的控件等。视图系统可用于构建应用程序。显示界面可以由一个或多个视图组成的。例如,包括短信通知图标的显示界面,可以包括显示文字的视图以及显示图片的视图。
资源管理器为应用程序提供各种资源,比如本地化字符串,图标,图片,布局文件,视频文件等等。
通知管理器使应用程序可以在状态栏中显示通知信息,可以用于传达告知类型的消息,可以短暂停留后自动消失,无需用户交互。比如通知管理器被用于告知下载完成,消息提醒等。通知管理器还可以是以图表或者滚动条文本形式出现在系统顶部状态栏的通知,例如后台运行的应用程序的通知,还可以是以对话窗口形式出现在屏幕上的通知。例如在状态栏提示文本信息,发出提示音,电子设备振动,指示灯闪烁等。
Android Runtime包括核心库和虚拟机。Android runtime负责安卓系统的调度和管理。
核心库包含两部分:一部分是java语言需要调用的功能函数,另一部分是安卓的核心库。
应用程序层和应用程序框架层运行在虚拟机中。虚拟机将应用程序层和应用程序框架层的java文件执行为二进制文件。虚拟机用于执行对象生命周期的管理,堆栈管理,线程管理,安全和异常的管理,以及垃圾回收等功能。
系统库(也可称为数据管理层)可以包括多个功能模块。例如:表面管理器(surface manager),媒体库(Media Libraries),三维图形处理库(例如:OpenGL ES),2D图形引擎(例如:SGL)和事件数据等。
表面管理器用于对显示子系统进行管理,并且为多个应用程序提供了2D和3D图层的融合。
媒体库支持多种常用的音频,视频格式回放和录制,以及静态图像文件等。媒体库可以支持多种音视频编码格式,例如:MPEG4,H.264,MP3,AAC,AMR,JPG,PNG等。
三维图形处理库用于实现三维图形绘图,图像渲染,合成,和图层处理等。
2D图形引擎是2D绘图的绘图引擎。
内核层是硬件和软件之间的层。内核层至少包含显示驱动,摄像头驱动,音频驱动,传感器驱动。
本申请实施例还提供了一种电子设备,电子设备包括一个或多个处理器和一个或多个存储器;其中,一个或多个存储器与一个或多个处理器耦合,一个或多个存储器用于存储计算机程序代码,计算机程序代码包括计算机指令,当一个或多个处理器执行计算机指令时,使得电子设备执行上述实施例描述的方法。
本申请实施例还提供了一种包含指令的计算机程序产品,当计算机程序产品在电子设备上运行时,使得电子设备执行上述实施例描述的方法。
本申请实施例还提供了一种计算机可读存储介质,包括指令,当指令在电子设备上运行时,使得电子设备执行上述实施例描述的方法。
可以理解的是,本申请的各实施方式可以任意进行组合,以实现不同的技术效果。
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机程序指令时,全部或部分地产生按照本申请所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线)或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质,(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质(例如固态硬盘Solid State Disk)等。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,该流程可以由计算机程序来指令相关的硬件完成,该程序可存储于计算机可读取存储介质中,该程序在执行时,可包括如上述各方法实施例的流程。而前述的存储介质包括:ROM或随机存储记忆体RAM、磁碟或者光盘等各种可存储程序代码的介质。
总之,以上所述仅为本申请技术方案的实施例而已,并非用于限定本申请的保护范围。凡根据本申请的揭露,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。

Claims (15)

  1. 一种数据传输方法,其特征在于,所述方法应用于转发设备,第一设备与所述转发设备通过第一网络进行通信,所述转发设备与第二设备通过蓝牙进行通信,所述方法包括:
    所述转发设备接收所述第一设备发送的第一报文,所述第一报文包括第一数据和第一指示信息;所述第一指示信息用于指示接收设备为所述第二设备;
    所述转发设备通过所述第一网络对应的第一协议栈解析所述第一报文,得到所述第一数据和所述第一指示信息;
    所述转发设备通过内核态的第一蓝牙协议栈对所述第一数据和所述第一指示信息进行处理,得到第二报文;
    所述转发设备基于所述窗口分配规则向所述第二设备发送所述第二报文;所述窗口分配规则用于管理来自用户态的第二蓝牙协议栈的报文和来自所述第一蓝牙协议栈的报文的发送顺序。
  2. 根据权利要求1所述的方法,其特征在于,所述窗口分配规则包括来自所述第一蓝牙协议栈的报文优先发送、来自所述第二蓝牙协议栈的报文优先发送、按比例发送来自所述第一蓝牙协议栈的报文和来自所述第二蓝牙协议栈的报文。
  3. 根据权利要求1或2所述的方法,其特征在于,所述转发设备基于所述窗口分配规则向所述第二设备发送所述第二报文,包括:
    所述转发设备获取蓝牙控制器的窗口忙闲情况;
    所述转发设备在所述蓝牙控制器存在空闲窗口时,通过所述空闲窗口发送所述第二报文。
  4. 根据权利要求1-3任一项所述的方法,其特征在于,所述方法还包括:
    所述转发设备接收所述第二设备发送的第三报文,所述第三报文包括第二数据和第二指示信息;所述第二指示信息用于指示接收设备为所述第一设备;
    所述转发设备在确定所述第三报文指示转发时,通过所述第一蓝牙协议栈解析所述第三报文,得到所述第二数据;
    所述转发设备通过所述第一协议栈,对所述第二数据和所述第二指示信息进行处理,得到第四报文;
    所述转发设备基于所述第二指示信息,将所述第四报文发送至所述第一设备。
  5. 根据权利要求1-4任一项所述的方法,其特征在于,所述方法还包括:
    所述转发设备响应于用户操作,通过所述第二蓝牙协议栈生成蓝牙报文;
    所述转发设备基于所述窗口分配规则向第三设备发送所述蓝牙报文,所述第三设备与所述转发设备通过蓝牙进行通信。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述方法还包括:
    所述转发设备接收所述第二设备发送的第五报文,所述第五报文包括第三数据和第三指示信息;所述第三指示信息用于指示接收设备为所述转发设备;
    所述转发设备基于所述第一蓝牙协议栈解析所述第三报文,得到所述第四数据和所述第三指示信息;
    所述转发设备基于所述第二指示信息,通过所述第二蓝牙协议栈对所述第四数据进行解析,得到所述第三数据。
  7. 一种数据传输装置,其特征在于,所述装置与第一设备通过第一网络进行通信,所述装置与第二设备通过蓝牙进行通信,所述装置包括:
    网络接收单元,用于接收所述第一设备发送的第一报文,所述第一报文包括第一数据和第一指示信息;所述第一指示信息用于指示接收设备为所述第二设备;
    所述第一网络对应的第一协议栈,用于解析所述第一报文,得到所述第一数据和所述第一指示信息;
    内核态的第一蓝牙协议栈,用于对所述第一数据和所述第一指示信息进行处理,得到第二报文;
    窗口分配单元,用于基于窗口分配规则向所述第二设备发送所述第二报文;所述窗口分配规则用于管理来自用户态的第二蓝牙协议栈的报文和来自所述第一蓝牙协议栈的报文的发送顺序。
  8. 根据权利要求7所述的装置,其特征在于,所述窗口分配规则包括来自所述第一蓝牙协议栈的报文优先发送、来自所述第二蓝牙协议栈的报文优先发送、按比例发送来自所述第一蓝牙协议栈的报文和来自所述第二蓝牙协议栈的报文。
  9. 根据权利要求7或8所述的装置,其特征在于,所述窗口分配单元,用于获取蓝牙控制器的窗口忙闲情况;
    在所述蓝牙控制器存在空闲窗口时,通过所述空闲窗口发送所述第二报文。
  10. 根据权利要求7-9任一项所述的装置,其特征在于,所述装置还包括蓝牙接收单元和网络发送单元:
    所述蓝牙接收单元,用于接收所述第二设备发送的第三报文,所述第三报文包括第二数据和第二指示信息;所述第二指示信息用于指示接收设备为所述第一设备;
    所述第一蓝牙协议栈,用于在确定所述第三报文指示转发时解析所述第三报文,得到所述第二数据;
    所述第一协议栈,用于对所述第二数据和所述第二指示信息进行处理,得到第四报文;
    所述网络发送单元,用于基于所述第二指示信息,将所述第四报文发送至所述第一设备。
  11. 根据权利要求7-10任一项所述的装置,其特征在于,所述第二蓝牙协议栈,用于响应于用户操作,生成蓝牙报文;
    所述窗口分配单元,用于基于所述窗口分配规则向第三设备发送所述蓝牙报文,所述第三设备与所述转发设备通过蓝牙进行通信。
  12. 根据权利要求7-11任一项所述的装置,其特征在于,所述装置还包括蓝牙接收单元;
    所述蓝牙接收单元,用于接收所述第二设备发送的第五报文,所述第五报文包括第三数据和第三指示信息;所述第三指示信息用于指示接收设备为所述转发设备;
    所述第一蓝牙协议栈,用于解析所述第三报文,得到所述第四数据和所述第三指示信息;
    所述第二蓝牙协议栈,用于对所述第四数据进行解析,得到所述第三数据。
  13. 一种电子设备,其特征在于,所述电子设备包括一个或多个处理器和一个或多个存储器;其中,所述一个或多个存储器与所述一个或多个处理器耦合,所述一个或多个存储器用于存储计算机程序代码,所述计算机程序代码包括计算机指令,当所述一个或多个处理器执行所述计算机指令时,使得所述电子设备执行如权利要求1-6中任一项所述的方法。
  14. 一种包含指令的计算机程序产品,其特征在于,当所述计算机程序产品在电子设备上运行时,使得所述电子设备执行如权利要求1-6中任一项所述的方法。
  15. 一种计算机可读存储介质,包括指令,其特征在于,当所述指令在电子设备上运行时,使得所述电子设备执行如权利要求1-6中任一项所述的方法。
PCT/CN2023/127435 2022-11-18 2023-10-28 一种数据传输方法、装置及系统 WO2024104095A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211444227.6 2022-11-18
CN202211444227.6A CN118057880A (zh) 2022-11-18 2022-11-18 一种数据传输方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2024104095A1 true WO2024104095A1 (zh) 2024-05-23

Family

ID=91068560

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/127435 WO2024104095A1 (zh) 2022-11-18 2023-10-28 一种数据传输方法、装置及系统

Country Status (2)

Country Link
CN (1) CN118057880A (zh)
WO (1) WO2024104095A1 (zh)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102573128A (zh) * 2010-12-22 2012-07-11 北京格林思通科技有限公司 短距离无线移动终端方法和系统
US20200084697A1 (en) * 2018-09-11 2020-03-12 Qualcomm Incorporated Broadcast isochronous relay over esco
CN111262784A (zh) * 2020-01-13 2020-06-09 杭州朗和科技有限公司 报文转发方法、报文转发装置、存储介质及电子设备
CN112422453A (zh) * 2020-12-09 2021-02-26 新华三信息技术有限公司 一种报文处理的方法、装置、介质及设备
CN112788535A (zh) * 2021-03-02 2021-05-11 深圳淇诺科技有限公司 蓝牙路由器、组网系统及通信方法
CN115226048A (zh) * 2021-04-14 2022-10-21 Oppo广东移动通信有限公司 数据传输方法、装置、设备及存储介质
WO2022228015A1 (zh) * 2021-04-26 2022-11-03 华为技术有限公司 一种数据传输方法及设备

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102573128A (zh) * 2010-12-22 2012-07-11 北京格林思通科技有限公司 短距离无线移动终端方法和系统
US20200084697A1 (en) * 2018-09-11 2020-03-12 Qualcomm Incorporated Broadcast isochronous relay over esco
CN111262784A (zh) * 2020-01-13 2020-06-09 杭州朗和科技有限公司 报文转发方法、报文转发装置、存储介质及电子设备
CN112422453A (zh) * 2020-12-09 2021-02-26 新华三信息技术有限公司 一种报文处理的方法、装置、介质及设备
CN112788535A (zh) * 2021-03-02 2021-05-11 深圳淇诺科技有限公司 蓝牙路由器、组网系统及通信方法
CN115226048A (zh) * 2021-04-14 2022-10-21 Oppo广东移动通信有限公司 数据传输方法、装置、设备及存储介质
WO2022228015A1 (zh) * 2021-04-26 2022-11-03 华为技术有限公司 一种数据传输方法及设备

Also Published As

Publication number Publication date
CN118057880A (zh) 2024-05-21

Similar Documents

Publication Publication Date Title
WO2021000807A1 (zh) 一种应用程序中等待场景的处理方法和装置
CN112399390B (zh) 一种蓝牙回连的方法及相关装置
US20230419570A1 (en) Image Processing Method and Electronic Device
WO2020244623A1 (zh) 一种空鼠模式实现方法及相关设备
WO2021190344A1 (zh) 多屏幕显示电子设备和电子设备的多屏幕显示方法
WO2020093988A1 (zh) 一种图像处理方法及电子设备
CN113923230B (zh) 数据同步方法、电子设备和计算机可读存储介质
US20230216990A1 (en) Device Interaction Method and Electronic Device
EP4086780A1 (en) File sharing method and system, and related device
WO2022001258A1 (zh) 多屏显示方法、装置、终端设备及存储介质
WO2022042637A1 (zh) 一种蓝牙数据传输方法及相关装置
WO2022262492A1 (zh) 数据下载方法、装置和终端设备
WO2022143310A1 (zh) 一种双路投屏的方法及电子设备
CN114979261B (zh) 业务交互方法、终端、服务器及系统
WO2024104095A1 (zh) 一种数据传输方法、装置及系统
CN114116073A (zh) 电子设备及其驱动加载方法、介质
WO2024093703A1 (zh) 一种实例的管理方法、装置、电子设备及存储介质
CN114125805B (zh) 蓝牙回连方法及终端设备
CN114423024B (zh) Wlan驱动框架、wlan驱动框架的组件化方法及相关设备
WO2024078315A1 (zh) 一种应用控制方法、电子设备和系统
US12032938B2 (en) Plug-in installation method, apparatus, and storage medium
WO2024051634A1 (zh) 一种投屏显示的方法、系统以及电子设备
CN111859418B (zh) 原子能力调用方法及终端设备
WO2024093614A1 (zh) 设备输入方法、系统、电子设备及存储介质
WO2024093871A1 (zh) 一种按键事件监听方法、系统和电子设备