Device Interconnection Method and Related Products
The AOA communication method using a virtual USB device stabilizes data transfer between electronic devices, addressing interference issues and data loss, enhancing reliability and pairing efficiency.
Patent Information
- Application Number
- CN202211177779.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-24
- Publication Date
- 2025-07-15
- Estimated Expiration
- 2042-09-24
AI Technical Summary
In the prior art, the wireless connection between a mobile phone and a computer is susceptible to interference with surrounding signals and unstable transmission. Although the wired connection is stable, it may lead to loss of mobile phone traffic in specific scenarios, and the existing routing algorithms have poor performance and cannot completely solve the problem.
AOA communication connection is realized through USB devices, the target virtual USB device is configured to support AOA protocol, establish an AOA communication connection between the first device and the second device, receive service data and process it through a proxy server, avoid USB sharing network, and support TCP/IP protocol.
Improves the reliability of data transmission, prevents the loss of traffic from target devices, quickly pairing and improves pairing efficiency, and reduces the time for wireless connection.
Smart Images

Figure CN115589428B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of electronic devices, and particularly relates to a device interconnection method and related products. Background Art
[0002] At present, with the development of electronic device technology, a mobile phone can establish a wireless connection with a computer and transmit data through this wireless connection to achieve the interconnection between the mobile phone and the computer, and implement upper-layer services such as screen mirroring and reverse control. However, transmitting data through a wireless connection is easily interfered by surrounding signals, and the transmission situation is unstable. In contrast, a wired connection is not affected by the external environment and transmits data more stably.
[0003] With the upgrade of the Universal Serial Bus (USB) protocol, the transmission speed of USB is getting faster and faster. A wired connection between a computer and a mobile phone can be achieved through a USB device, and the interconnection between the computer and the mobile phone can be realized by sharing the network through the USB device. However, USB network sharing requires the use of traffic. Because the mobile phone cannot connect to the hotspot in a specific scenario, after the PC and the mobile phone are connected through USB network sharing, all networks pass through the mobile phone, resulting in the loss of mobile phone traffic. Summary of the Invention
[0004] Embodiments of this application provide a device interconnection method and related products, which can achieve an AOA communication connection between a first device and a second device through a USB device, and realize the sending and receiving of service data through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and does not adopt USB network sharing, which is beneficial to preventing the loss of traffic of the target second device; and when implementing upper-layer services through an AOA connection, the time for wireless connection is saved, which is beneficial to quick pairing and improving the pairing efficiency.
[0005] In a first aspect, embodiments of this application provide a device interconnection method, which is applied to a first device, and the method includes:
[0006] Determine a target second device connected to the first device;
[0007] Configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol;
[0008] Start the target virtual USB device, and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device;
[0009] Receive the service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection.
[0010] In a second aspect, an embodiment of the present application provides a device interconnection apparatus, which is applied to a first device. The apparatus includes: a determination unit, a configuration unit, a startup unit, and a reception unit, where
[0011] The determination unit is configured to determine a target second device connected to the first device;
[0012] The configuration unit is configured to configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol;
[0013] The startup unit is configured to start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device;
[0014] The reception unit is configured to receive the service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection.
[0015] In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the above one or more programs are stored in the above memory and are configured to be executed by the above processor. The above programs include instructions for performing the steps in any method of the first aspect of the embodiments of the present application.
[0016] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, and the computer program causes a computer to execute some or all of the steps described in any method of the first aspect of the embodiments of the present application.
[0017] In a fifth aspect, an embodiment of the present application provides a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps described in any method of the first aspect of the embodiments of the present application. The computer program product may be a software installation package.
[0018] It can be seen that in the embodiments of the present application, a target second device connected to the first device is determined; a target virtual USB device corresponding to the target second device is configured, where the target virtual USB device is used to support the AOA protocol; the target virtual USB device is started, and a target AOA communication connection between the target second device and the first device is established through the target virtual USB device; according to the target AOA communication connection, service data sent by the target second device is received, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection. In this way, an AOA communication connection between the first device and the second device can be implemented through a USB device, and the sending and receiving of service data can be implemented through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and the USB shared network is not adopted, which is beneficial to preventing the loss of the traffic of the target second device; and when implementing the upper-layer service through the AOA connection, the time for wireless connection is saved, which is beneficial to quick pairing and beneficial to improving the pairing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the description of the prior art. Obviously, the following drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1A is a schematic structural diagram of a device interconnection system provided by an embodiment of the present application;
[0021] Figure 1B is a schematic structural diagram of a device interconnection system provided by an embodiment of the present application;
[0022] Figure 2 is a schematic flowchart of a device interconnection method provided by an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a scenario of interconnection between a first device and a second device provided by an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of device interaction provided by an embodiment of the present application;
[0025] Figure 5 is a schematic flowchart of a device interconnection method provided by an embodiment of the present application;
[0026] Figure 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;
[0027] Figure 7A It is a block diagram of the functional units of a device interconnection apparatus provided by an embodiment of the present application;
[0028] Figure 7B It is a block diagram of the functional units of a device interconnection apparatus provided by an embodiment of the present application;
[0029] Figure 7C It is a block diagram of the functional units of a device interconnection apparatus provided by an embodiment of the present application. Specific embodiments
[0030] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.
[0031] The terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally further includes steps or units not listed, or optionally further includes other steps or units inherent to these processes, methods, products or devices.
[0032] Referring to "embodiments" herein means that a specific feature, structure or characteristic described in connection with the embodiments can be included in at least one embodiment of the present application. The phrase appears in various places in the specification and does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment mutually exclusive with other embodiments. Those skilled in the art will explicitly and implicitly understand that the embodiments described herein can be combined with other embodiments.
[0033] 1) The electronic device may be a portable electronic device that also includes other functions such as a personal digital assistant and / or a music player function, such as a mobile phone, a tablet computer, a wearable electronic device with a wireless communication function (such as a smart watch, smart glasses), a vehicle-mounted device, etc. Exemplary embodiments of portable electronic devices include but are not limited to portable electronic devices equipped with an IOS system, an Android system, a Microsoft system, or other operating systems. The above-mentioned portable electronic device may also be other portable electronic devices, such as a laptop computer (Laptop), etc. It should also be understood that in some other embodiments, the above-mentioned electronic device may not be a portable electronic device, but a desktop computer. In some examples, the above-mentioned electronic device may include the first device and the second device in the present application.
[0034] 2) Bluetooth Low Energy (BLE) technology is a personal area network technology designed and sold by the Bluetooth Technology Alliance. Bluetooth Low Energy is not backward compatible with the original Bluetooth protocol (hereinafter referred to as Classic Bluetooth). Bluetooth Low Energy uses the same 2.4GHz radio frequency as Classic Bluetooth, so dual-mode devices can share the same antenna. The modulation system used by Bluetooth Low Energy is simpler. Compared with Classic Bluetooth, Bluetooth Low Energy aims to significantly reduce power consumption and cost while maintaining the same communication range.
[0035] 3) BLE broadcasting refers to putting broadcast data into the BLE device broadcast. When two Bluetooth devices want to establish a connection, the first step is for the slave (server) to broadcast outward, and the host (client) initiates a request after searching. The slave broadcast contains relevant information about the device, such as device name, manufacturer, and private protocol, etc. After the BLE device is connected, BLE service discovery and connection can be performed, etc. Among them, the maximum length of BLE broadcast data is 31 bytes. If it is less than 31 bytes, it is filled with 0 by default.
[0036] 4) Android Open Accessory Protocol (AOA) allows external Universal Serial Bus (USB) hardware (Android USB accessories) to interact with Android devices. When an Android device is in accessory mode, the connected accessory acts as the USB host (powering the bus and enumerating devices), while the Android device acts as the USB accessory.
[0037] 5) Hot Swap is hot plugging and unplugging, which means inserting or removing modules or boards into or out of the system without turning off the system power without affecting the normal operation of the system.
[0038] At present, with the development of electronic device technology, a mobile phone can establish a wireless connection with a computer and transmit data through this wireless connection to achieve the interconnection between the mobile phone and the computer, and implement upper-layer services such as screen mirroring and reverse control. However, transmitting data through a wireless connection is easily affected by surrounding signals, and the transmission situation is unstable. In contrast, a wired connection is not affected by the external environment and transmits data more stably.
[0039] With the upgrade of the Universal Serial Bus (USB) protocol, the transmission speed of USB is getting faster and faster. A wired connection between a computer and a mobile phone can be achieved through a USB device, and the interconnection between the computer and the mobile phone can be realized by sharing the network through the USB device. However, USB network sharing requires the use of traffic. Because in specific scenarios, the mobile phone cannot connect to the hotspot, after the PC and the mobile phone are connected through USB network sharing, all the networks pass through the mobile phone, resulting in the loss of mobile phone traffic.
[0040] Currently, the above problems are solved through a routing selection algorithm. However, the current routing algorithm has poor performance, cannot completely solve the problems mentioned in a, and will cause an increase in cost.
[0041] In view of the above problems, this application proposes a device interconnection method and related products, which will be described in detail below.
[0042] As Figure 1A shown, it is a schematic structural diagram of a device interconnection system applicable to this application. The system may include: electronic device 100a, electronic device 100b, and electronic device 100c.
[0043] Among them, the above-mentioned electronic device 100a, electronic device 100b, and electronic device 100c can all be used as the electronic devices in the embodiments of this application. For example, electronic device 100a can be a notebook computer, a tablet computer, etc., electronic device 100b can be a terminal device such as a mobile phone, and electronic device 100c can be a wearable electronic device such as a smart watch.
[0044] Among them, electronic device 100a can establish an AOA communication connection with electronic device 100b and / or electronic device 100c through a USB device, and implement cross-screen interconnection or screen sharing and other service processing between electronic device 100a and electronic device 100b (or electronic device 100c).
[0045] Among them, as Figure 1BAs shown in the figure, it is a schematic structural diagram of a device interconnection system, including: electronic device 100a, electronic device 100b, and a USB device; among them, electronic device 100b can be wired to electronic device 100a through the USB device, and an AOA communication connection between electronic device 100a and electronic device 100b can be established through this USB device.
[0046] In a possible example, a host application can be loaded in the above-mentioned electronic device 100a, and an accessory application can be loaded in electronic device 100b, and the host application can correspond to the accessory application.
[0047] Among them, electronic device 100b accesses electronic device 100a through the USB device. Electronic device 100a can start the host application, and electronic device 100b can start the accessory application so that electronic device 100b is in the accessory mode; electronic device 100a can determine the server information corresponding to the accessory application according to the host application; according to the server information, the host application, and the accessory application, an AOA communication connection with electronic device 100b is established. Among them, the above-mentioned electronic device 100a and / or electronic device 100b both support the AOA protocol, and this AOA protocol is used to provide support for the upper-layer services of electronic device 100b. For example, electronic device 100b can be projected onto electronic device 100a through the AOA protocol, and electronic device 100b can be remotely controlled by electronic device 100a, etc., which are not limited here.
[0048] In a possible example, electronic device 100a can determine electronic device 100b connected to the electronic device 100a; configure a target virtual USB device corresponding to the electronic device 100b, where the target virtual USB device is used to support the AOA protocol; start the target virtual USB device, and establish a target AOA communication connection between the electronic device 100b and the electronic device 100a through the target virtual USB device; according to the target AOA communication connection, receive the service data sent by the electronic device 100b, where the service data is used to implement the upper-layer services between the second device and the electronic device 100a through the target AOA communication connection. In this way, an AOA communication connection between electronic device 100a and electronic device 100b can be realized through the USB device, which is beneficial to improving the reliability of data transmission; and without using USB shared network, it is beneficial to prevent the loss of the traffic of the target second device; and when implementing upper-layer services through AOA connection, the time for wireless connection is saved, which is beneficial to quick pairing and beneficial to improving the pairing efficiency.
[0049] It should be noted that in this application, "multiple" can refer to two or more, and will not be elaborated hereinafter.
[0050] Please refer to Figure 2 , Figure 2 which is a schematic flowchart of a device interconnection method provided by an embodiment of the present application, applied to a first device. As shown in the figure, the device interconnection method includes the following operations.
[0051] S201. Determine a target second device connected to the first device.
[0052] Among them, the above-mentioned first device may be an electronic device 100a as shown in Figure 1A or Figure 1B ; the above-mentioned target second device may be an electronic device 100b as shown in Figure 1A or Figure 1B .
[0053] Among them, when the first device is connected to multiple second devices (including the target second device), since some second devices may not support the AOA protocol, or some second devices do not have the conditions for AOA connection with the first device, or some second devices are not the AOA connection authorized devices of the first device, etc., therefore, not every second device can establish an AOA connection with the first device. Multiple second devices can be screened to determine the target second device that can establish an AOA communication connection with the first device.
[0054] S202. Configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol.
[0055] Among them, the target second device can be connected to the first device through a physical USB device. Since the actual physical USB device connected to the first device may not support the AOA protocol, after the first device and the target second device are connected through the physical USB device, the first device can reconfigure to obtain a virtual target virtual USB device, and the target virtual USB device can support the AOA protocol.
[0056] Among them, when configuring the target virtual USB device, the first device can define the vendor identification code (VID) information and product identification code (PID) information corresponding to the target virtual USB device, and the PID information and VID information can be used to start the target virtual USB device.
[0057] S203. Start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device.
[0058] S204. Receive the service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection.
[0059] The upper-layer service may include at least one of the following: screen mirroring service, reverse control service, file data transmission service, etc., which is not limited herein.
[0060] Exemplarily, if the upper-layer service is a screen mirroring service, after the first device establishes an AOA communication connection with the target second device, the first device can receive the service data to be screen mirrored sent by the target second device through the AOA communication connection. For example, it may include at least one of the following: control information, attribute information, resource information, etc., which is not limited herein; among them, the attribute information may include font, color, size, dimension, etc., the control information may include text type, picture type, etc., and the resource information may be videos, pictures, etc. required for screen mirroring, which is not limited herein.
[0061] It can be seen that the device interconnection method provided by the embodiments of the present application determines the target second device connected to the first device; configures a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol; starts the target virtual USB device, and establishes a target AOA communication connection between the target second device and the first device through the target virtual USB device; receives the service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection. In this way, the AOA communication connection between the first device and the second device can be realized through the USB device, and the sending and receiving of service data can be realized through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and without using a USB shared network, it is beneficial to prevent the loss of the target second device's traffic; and when implementing the upper-layer service through the AOA connection, the time for wireless connection is saved, which is beneficial to quick pairing and beneficial to improving the pairing efficiency.
[0062] In a possible example, if the upper-layer service needs to be implemented through the TCP / IP protocol, the method further includes the following steps: determine the proxy server corresponding to the upper-layer service; start the proxy server; after receiving the service data sent by the target second device, the method further includes: process the service data through the proxy server to implement the upper-layer service.
[0063] Among them, generally, the current device interconnection function is based on wireless network connection, that is, the upper-layer services such as the current screen mirroring service and reverse control service are implemented through the TCP / IP protocol. Since the AOA protocol does not support the TCP / IP protocol, in order to ensure the normal implementation of the above upper-layer services and reduce the R & D cost, the AOA protocol can be made to support the TCP / IP protocol through a proxy server. The proxy server can be set by the user himself or by the system default, and different ports can be set for different upper-layer services to process the service data.
[0064] Among them, as Figure 3 shown, it is a schematic diagram of the interconnection scenario between a first device and a second device. The first device can be connected to the proxy server, and the second device can be connected to the proxy server. After the first device and the second device establish an AOA communication connection, the second device can process the service data through the proxy server and send it to the first device through the AOA communication connection. After the first device receives the above service data, similarly, the service data can be processed through the proxy server so that the first device can implement the upper-layer service through the service data.
[0065] It can be seen that in this example, the AOA protocol can be made to support the TCP / IP protocol through a proxy server to implement the upper-layer service between the first device and the second device, which is beneficial to reducing the R & D cost and facilitating the subsequent work of the upper-layer service.
[0066] In a possible example, for determining the target second device connected to the first device, the above method includes the following steps: in response to the insertion operations of multiple second devices, determining the PID information and VID information of the USB device corresponding to each second device, where each second device corresponds to one USB device, and each USB device corresponds to one PID information and one VID information; determining at least one target USB device according to the PID information and VID information corresponding to each USB device; determining the second device connected to each target USB device to obtain at least one second device; and screening out the target second device from the at least one second device, where the target second device is used for AOA communication with the first device.
[0067] Among them, each device may correspond to vendor identification code (VID) information and product identification code (PID) information; the VID information and PID information corresponding to devices of different device types are different. The above device types may include at least one of the following: keyboard device, mouse device, keyboard device, mobile phone device, etc., which is not limited here; for example, the PID information and VID information corresponding to a keyboard and a mobile phone are different.
[0068] Of course, each USB device may also correspond to PID information and VID information. To prevent the first device from establishing a communication connection with a second device that does not support the AOA protocol (for example, it can be a keyboard device or a mouse device, etc.), or to prevent the first device from establishing an AOA communication connection with an unauthorized other second device, the above-mentioned target second device can pre-agree with the first device on the USB device corresponding to the target second device, that is, it can be achieved to agree on the PID information and VID information corresponding to the USB device corresponding to the target second device. That is, the VID information and PID information of the USB device can be used to identify the target second device.
[0069] Among them, the first device can preset a preset USB device list, and the preset USB device list can store the second devices that have been agreed with the first device and can be used to implement upper-layer services.
[0070] In a specific implementation, when the first device recognizes the access of multiple second devices, that is, after the insertion operation, it can obtain or determine the PID information and VID information of the USB device corresponding to each second device. Furthermore, it can query the preset USB device list according to the PID information and VID information corresponding to each USB device, and screen out at least one target USB device that can query the corresponding PID information and VID information.
[0071] Furthermore, determine the second devices connected to each target USB device to obtain at least one second device; if there is only one such second device, determine this second device as the target second device; if there are multiple such second devices, obtain the access time corresponding to each second device accessing the target second device, and select the second device with the earliest access time as the target second device. Therefore, the obtained target second device can establish an AOA communication connection with the first device and implement AOA communication.
[0072] It can be seen that in this example, in order to prevent the second device from mistakenly establishing an AOA communication connection with the first device or to prevent the situation where the AOA communication connection is unavailable, etc., the target USB device can be identified through the VID information and PID information, obtain at least one second device that can establish a communication connection, and screen out the desired target second device from them, and establish an AOA connection between the first device and the target second device.
[0073] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function; before receiving the service data sent by the target second device according to the target AOA communication connection, the above method further includes the following steps: scanning the BLE broadcast corresponding to the target second device, where the BLE broadcast is used to indicate the status information of the target USB device corresponding to the target second device, and the status information includes any one of the following: the target USB device unplugged state and the target USB device plugged-in state; obtaining the USB device list corresponding to the first device. If the target virtual USB device is included in the USB device list, then according to the target AOA communication connection, receive the service data sent by the target second device; if the target virtual USB device is not included in the USB device list, then determine the first VID information and the second PID information of the third device corresponding to the target USB device, and obtain the second VID information and the second PID information of the target second device; if the first VID information matches the second VID information and the first PID information matches the second PID information, then reconfigure the virtual USB device corresponding to the third device, and establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement the upper-layer service between the third device and the first device according to the AOA communication connection; if the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, then terminate the process.
[0074] Among them, the above second device supports the hot-plug function. After the target second device is connected to the first device through the corresponding target USB device, the target second device can broadcast the plugged-in state of the target USB device. When the target USB device corresponding to the target second device is unplugged, the target second device can broadcast the unplugged state of the target USB device; the status information of the above target USB device can be carried by the BLE broadcast.
[0075] Among them, the information carried by the above BLE broadcast may include at least one of the following: protocol version number, connection method, target USB status information, etc., which are not limited here. The USB status information may include any one of the following: the target USB device unplugged state and the target USB device plugged-in state, and is used to indicate the insertion or unplugging of the target USB device connected to the target second device.
[0076] Among them, after the first device establishes a communication connection with the target second device, the PID information and VID information corresponding to the target virtual USB device can be stored in the USB device list. The USB device list can include the virtual USB devices corresponding to all the devices that have established an AOA connection with the first device.
[0077] Among them, the above-mentioned third device can be the same as or different from the second device. For example, the third device and the second device can be mobile phones of the same manufacturer or mobile phones of different manufacturers.
[0078] In a specific implementation, since the first device may have established an AOA connection with more than one target second device, whenever the first device receives a BLE broadcast, it can trigger the first device to obtain a preset USB device list, which can be used to store the USB devices that have established an AOA connection with the first device; furthermore, it can be queried whether the VID information and PID information corresponding to the above-mentioned target virtual USB device exist in the USB device list. If the VID information and PID information do not exist, it indicates that the target virtual USB device is not included in the USB device list. Otherwise, it indicates that the target virtual USB device is included in the USB device list.
[0079] Furthermore, when the target virtual USB device is included in the USB device list, it indicates that the second device that has a hot plug event at this time has already established the target AOA communication connection corresponding to the target virtual USB device with the first device. Then, the service data sent by the target second device can be received according to the target AOA communication connection.
[0080] Still further, when the target virtual USB device is not included in the USB device list, it indicates that the third device corresponding to the hot plug event may not have established an AOA communication connection with the first device, or the AOA communication connection has been disconnected, etc.; furthermore, it can be further confirmed whether the third device that generates the hot plug event is the same as the target second device, that is, to determine whether the newly connected device is a device allowed by the first device to establish an AOA communication connection, or whether it supports the AOA protocol, etc.
[0081] Furthermore, since the VID information and PID information of devices corresponding to different manufacturers are different, it is possible to further confirm whether a device is allowed by the first device to establish an AOA communication connection by matching the first VID information and the second VID information respectively corresponding to the third device and the target second device, as well as the first PID information and the second PID information respectively corresponding thereto; if the first VID information matches the second VID information and the first PID information matches the second PID information, it can be confirmed that the third device can establish an AOA communication connection with the first device. The third device may be a newly connected device or the target second device that has been unplugged and then reconnected. Then, for the third device, the corresponding virtual USB device can be reconfigured, and further, an AOA communication connection with the first device can be established through the virtual USB device.
[0082] Finally, if the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, it indicates that the third device is not allowed by the first device to establish an AOA communication connection. At this time, since the target virtual USB device does not exist in the USB device list, the above-mentioned target AOA communication connection cannot be established, and all processes can be terminated, that is, the establishment of the AOA communication connection between the third device and the first device fails.
[0083] It can be seen that in this example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function, hot plug can be achieved through BLE broadcast, which is beneficial to ensuring the AOA communication connection between the first device and the second device, or ensuring that the first device can receive or send service data to and from the second device to maintain the implementation of the upper-layer service between the first device and the second device, which is beneficial to improving the user experience. In addition, the AOA communication connection can be re-established or the establishment of the AOA communication connection can be blocked through the VID information and PID information to ensure the data security of the first device.
[0084] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function, and the first device does not support BLE communication; before receiving the service data sent by the target second device according to the target AOA communication connection, the above method further includes the following steps: starting a preset timer, where the preset timer corresponds to a preset period; obtaining the USB device list corresponding to the first device every preset period; if the target virtual USB device is included in the USB device list, receiving the service data sent by the target second device according to the target AOA communication connection; if the target virtual USB device is not included in the USB device list, determining the first VID information and the second PID information corresponding to the third device corresponding to the target USB device, and obtaining the second VID information and the second PID information corresponding to the target second device; if the first VID information matches the second VID information and the first PID information matches the second PID information, reconfiguring the virtual USB device corresponding to the third device, establishing an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implementing the upper-layer service between the third device and the first device according to the AOA communication connection; if the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminating the process.
[0085] Among them, the above preset timer can be set by the system default or by the user himself, which is not limited here. The preset timer can correspond to a preset period, and the preset period can be understood as the expiration time or the validity period. The timer can count and work within the preset period, and can obtain the USB device list corresponding to all USB devices connected to the first device via AOA communication every preset period.
[0086] Among them, since in applications such as timers, it is necessary to frequently take the minimum value for judgment, therefore, in order to save space, in this application, the timing function of the preset timer can be implemented by the time wheel algorithm.
[0087] For example, the first device can set multiple preset timers, call the preset function at a certain frequency, and sequentially detect the expired preset timers. Once the preset timer expires, then execute the callback function set by the preset timer, and the callback function is used to obtain the USB device list corresponding to all USB devices connected to the first device via AOA communication.
[0088] In a specific implementation, the first device can set an initial expiration time, and use the timeout value of the preset timer with the smallest timeout among all the preset timers as the preset period for this timing process. In this way, once the preset function is called, the preset timer with the smallest timeout will surely expire. Thus, when the preset function is called, other preset timers can be processed. Furthermore, find the one with the smallest remaining time from the remaining preset timers, and set the time period corresponding to the one with the smallest remaining time as the preset period for the next timing process. Repeating this way, the above preset period can be adjusted at any time, which is beneficial to more precisely implement the timing function.
[0089] It should be noted that the subsequent steps are the same as the relevant descriptions in the previous embodiment (if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function), and will not be elaborated here.
[0090] It can be seen that in this example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function and does not support the BLE protocol, hot-plugging can be achieved by setting preset timers, which is beneficial to ensuring the AOA communication connection between the first device and the second device, or ensuring that the first device can receive or send service data to and from the second device to maintain the implementation of the upper-layer service between the first device and the second device, and is beneficial to improving the user experience. Moreover, the AOA communication connection can be re-established or the establishment of the AOA communication connection can be blocked through the VID information and PID information to ensure the data security of the first device.
[0091] In a possible example, if the target USB device corresponding to the target second device is in the target USB insertion state and the target AOA communication connection is disconnected; the above method further includes the following steps: sending a session reset request to the target second device, where the session reset request is used for the target second device to update the state machine; receiving the session reset response information sent by the target second device, where the session reset response information is used for the first device to re-establish the target AOA communication connection between the first device and the target second device to maintain the normal implementation of the upper-layer service between the first device and the target second device.
[0092] In a possible example, before sending the session reset request to the target second device, the above method further includes the following steps: encapsulating the session information carried in the session reset request according to a preset protocol, where the preset protocol is encapsulated in the upper service layer of the first device, and the session information includes at least one of the following: message type, connection type, and reset status information.
[0093] Among them, the above preset protocol can be set by the user himself or be the system default, which is not limited herein; the preset protocol can be encapsulated in the upper-layer service layer.
[0094] Among them, after the first device and the target second device establish an AOA communication connection, there may be a situation where the target USB device corresponding to the target second device is not unplugged in the upper-layer service layer and the AOA communication connection needs to be disconnected; in the above situation, the target second device often cannot perceive the AOA communication connection disconnection event, resulting in a situation where the first device cannot establish a normal connection when it needs to establish an AOA communication connection again. Therefore, a preset protocol can be encapsulated in the upper-layer service layer, and the session information in the session reset request sent by the first device to the target second device can be encapsulated through this preset protocol.
[0095] Among them, as Figure 4 shown, it is a schematic diagram of device interaction. If the first device detects that the AOA communication connection is disconnected and the target USB device corresponding to the target second device is in the target USB inserted state, the first device can encapsulate the session information to be sent to the target second device through the preset protocol and send a session reset request to the target second device, and the session reset request can carry the above session information; furthermore, the target second device can receive the session reset request, reset the state machine, and finally send a session reset response message to the first device to inform the first device that the state machine modification is completed. The reset response message is used for the first device to successfully re-establish the target AOA communication connection between the first device and the target second device when it needs to establish a target AOA communication connection next time, so as to maintain the normal implementation of the upper-layer service between the first device and the target second device.
[0096] It can be seen that in this example, the session information can be encapsulated through the preset protocol, and a session reset request can be sent to the target second device that cannot perceive the disconnection of the target AOA communication connection to inform the target second device that the current target AOA communication connection is disconnected. The above target second device can reset the state machine to wait for the first device to establish a target AOA communication connection next time. In this way, it is beneficial to ensure the normal use of the next AOA communication connection.
[0097] Please refer to Figure 5 , Figure 5 which is a schematic flowchart of a device interconnection method provided by an embodiment of the present application. As shown in the figure, applied to the first device, the device interconnection method includes the following operations.
[0098] S501. In response to the insertion operations of multiple second devices, determine the PID information and VID information of the USB device corresponding to each second device, where each second device corresponds to one USB device, and each USB device corresponds to one PID information and one VID information.
[0099] S502. Determine at least one target USB device according to the PID information and VID information corresponding to each of the said USB devices.
[0100] S503. Determine the second devices connected to each of the said target USB devices to obtain at least one second device.
[0101] S504. Screen out the target second device from the said at least one second device, wherein the target second device is used for AOA communication with the first device.
[0102] S505. Configure the target virtual USB device corresponding to the target second device, wherein the target virtual USB device is used to support the AOA protocol.
[0103] S506. Start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device.
[0104] S507. Receive the service data sent by the target second device according to the target AOA communication connection, wherein the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection.
[0105] Among them, the above steps S501 - S507 can refer to Figure 2 Steps S201 - S204 and their related descriptions in the device interconnection method described, which will not be elaborated here.
[0106] It can be seen that for the device interconnection method described in the embodiments of the present application, in response to the insertion operations of multiple second devices, the PID information and VID information of the USB device corresponding to each second device are determined, where each second device corresponds to one USB device, and each USB device corresponds to one PID information and one VID information; at least one target USB device is determined according to the PID information and VID information corresponding to each USB device; the second devices connected to each target USB device are determined to obtain at least one second device; a target second device is screened out from the at least one second device, where the target second device is used for AOA communication with the first device; a target virtual USB device corresponding to the target second device is configured, where the target virtual USB device is used to support the AOA protocol; the target virtual USB device is started, and a target AOA communication connection between the target second device and the first device is established through the target virtual USB device; according to the target AOA communication connection, service data sent by the target second device is received, where the service data is used to implement the upper-layer service between the second device and the first device through the target AOA communication connection. In this way, in order to prevent the second device from mistakenly establishing an AOA communication connection with the first device or to prevent the situation where the AOA communication connection is unavailable, etc., the target USB device can be identified through the VID information and PID information, at least one second device capable of establishing a communication connection is obtained, and the desired target second device is screened out from them, and an AOA connection between the first device and the target second device is established through the target second device. The first device can implement the sending and receiving of service data through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and the USB shared network is not adopted, which is beneficial to preventing the loss of the traffic of the target second device; and when the upper-layer service is implemented through the AOA connection, the time of wireless connection is saved, which is beneficial to quick pairing and is beneficial to improving the pairing efficiency.
[0107] Please refer to Figure 6 , Figure 6 which is a schematic structural diagram of an electronic device provided by an embodiment of the present application. As shown in the figure, the electronic device includes a processor, a memory, a communication interface, and one or more programs, which are applied to the first device. Among them, the above one or more programs are stored in the above memory, and the above one or more programs are configured with instructions for the above processor to execute the following steps:
[0108] Determine the target second device connected to the first device;
[0109] Configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol;
[0110] Start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device;
[0111] Receive service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection.
[0112] It can be seen that the electronic device described in the embodiments of the present application determines a target second device connected to the first device; configures a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol; starts the target virtual USB device and establishes a target AOA communication connection between the target second device and the first device through the target virtual USB device; receives service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection. In this way, an AOA communication connection between the first device and the second device can be realized through the USB device, and the sending and receiving of service data can be realized through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and does not adopt USB shared network, which is beneficial to preventing the loss of traffic of the target second device; and when implementing the upper-layer service through the AOA connection, the time for wireless connection is saved, which is beneficial to quick pairing and beneficial to improving the pairing efficiency.
[0113] In a possible example, if the upper-layer service needs to be implemented through the TCP / IP protocol, the above program further includes instructions for performing the following steps:
[0114] Determine the proxy server corresponding to the upper-layer service;
[0115] Start the proxy server.
[0116] In a possible example, after receiving the service data sent by the target second device, the above program further includes instructions for performing the following steps:
[0117] Process the service data through the proxy server to implement the upper-layer service.
[0118] In a possible example, in terms of determining the target second device connected to the first device, the above program includes instructions for performing the following steps:
[0119] In response to the insertion operations of multiple second devices, determine the PID information and VID information of the USB devices corresponding to each of the second devices, where each of the second devices corresponds to one of the USB devices, and each of the USB devices corresponds to one PID information and one VID information;
[0120] Determine at least one target USB device according to the PID information and VID information corresponding to each of the USB devices;
[0121] Determine the second devices connected to each of the target USB devices to obtain at least one second device;
[0122] Screen out the target second device from the at least one second device, where the target second device is used for AOA communication with the first device.
[0123] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function; before receiving the service data sent by the target second device according to the target AOA communication connection, the above program further includes instructions for performing the following steps:
[0124] Scan the BLE broadcast corresponding to the target second device, where the BLE broadcast is used to indicate the status information of the target USB device corresponding to the target second device, and the status information includes any one of the following: the target USB device unplugged state and the target USB device plugged-in state;
[0125] Obtain the USB device list corresponding to the first device;
[0126] If the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection;
[0127] If the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information of the third device corresponding to the target USB device, and obtain the second VID information and the second PID information corresponding to the target second device;
[0128] If the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement the upper-layer service between the third device and the first device according to the AOA communication connection;
[0129] If the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, the process is terminated.
[0130] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function, and the first device does not support BLE communication; before receiving the service data sent by the target second device according to the target AOA communication connection, the above program further includes instructions for performing the following steps:
[0131] Start a preset timer, where the preset timer corresponds to a preset period;
[0132] Obtain the USB device list corresponding to the first device every preset period;
[0133] If the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection;
[0134] If the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information corresponding to the third device corresponding to the target USB device, and obtain the second VID information and the second PID information corresponding to the target second device;
[0135] If the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement the upper-layer service between the third device and the first device according to the AOA communication connection;
[0136] If the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, the process is terminated.
[0137] In a possible example, if the target USB device corresponding to the target second device is in the target USB insertion state and the target AOA communication connection is disconnected; the above program further includes instructions for performing the following steps:
[0138] Send a session reset request to the target second device, where the session reset request is used for the target second device to update the state machine;
[0139] Receive the session reset response information sent by the target second device, where the session reset response information is used for the first device to re - establish the target AOA communication connection between the first device and the target second device to maintain the normal implementation of the upper - layer service between the first device and the target second device.
[0140] In a possible example, before sending the session reset request to the target second device, the above - mentioned program further includes instructions for performing the following steps:
[0141] Encapsulate the session information carried in the session reset request according to a preset protocol, where the preset protocol is encapsulated in the upper - layer service layer of the first device, and the session information includes at least one of the following: message type, connection type, and reset status information.
[0142] The above mainly introduces the solution of the embodiment of the present application from the perspective of the execution process on the method side. It can be understood that in order for an electronic device to implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments provided in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0143] The embodiment of the present application can divide the functional units of the electronic device according to the above - mentioned method examples. For example, each functional unit can be divided corresponding to each function, or two or more functions can be integrated into one processing unit. The above - integrated unit can be implemented in the form of hardware or in the form of a software functional unit. It should be noted that the division of units in the embodiment of the present application is illustrative, only a logical function division, and there can be other division methods in actual implementation.
[0144] In the case of dividing each functional module corresponding to each function, Figure 7A The schematic diagram of the device interconnection device is shown, as Figure 7A shown, the device is applied to the first device, and the device interconnection device 700 may include: a determination unit 701, a configuration unit 702, a start unit 703, and a reception unit 704, where,
[0145] The determination unit 701 is used to determine the target second device connected to the first device;
[0146] The configuration unit 702 is configured to configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol;
[0147] The starting unit 703 is configured to start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device;
[0148] The receiving unit 704 is configured to receive service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection.
[0149] It can be seen that the device interconnection device described in the embodiments of this application determines a target second device connected to the first device; configures a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol; starts the target virtual USB device and establishes a target AOA communication connection between the target second device and the first device through the target virtual USB device; and receives service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection. In this way, an AOA communication connection between the first device and the second device can be implemented through the USB device, and the sending and receiving of service data can be implemented through this AOA communication connection, which is beneficial to improving the reliability of data transmission; and the USB shared network is not adopted, which is beneficial to preventing the loss of the traffic of the target second device; and when implementing the upper-layer service through the AOA connection, the time for wireless connection is omitted, which is beneficial to quick pairing and beneficial to improving the pairing efficiency.
[0150] In a possible example, if the upper-layer service needs to be implemented through the TCP / IP protocol, as Figure 7B shown, Figure 7B shows a schematic diagram of the device interconnection device. On the basis of Figure 7A , the device interconnection device 700 may further include: a processing unit 705, where the determining unit 701 is further configured to determine a proxy server corresponding to the upper-layer service; the starting unit is further configured to start the proxy server; after receiving the service data sent by the target second device, the processing unit 705 is configured to process the service data through the proxy server to implement the upper-layer service.
[0151] In a possible example, in terms of determining the target second device connected to the first device, the determining unit 701 is specifically configured to:
[0152] In response to the insertion operations of multiple second devices, determine the PID information and VID information of the USB device corresponding to each second device, where each second device corresponds to one USB device, and each USB device corresponds to one PID information and one VID information;
[0153] Determine at least one target USB device according to the PID information and VID information corresponding to each USB device;
[0154] Determine the second device connected to each target USB device to obtain at least one second device;
[0155] Screen out the target second device from the at least one second device, where the target second device is used for AOA communication with the first device.
[0156] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function; in terms of receiving the service data sent by the target second device according to the target AOA communication connection, the processing unit 705 is specifically configured to:
[0157] Scan the BLE broadcast corresponding to the target second device, where the BLE broadcast is used to indicate the status information of the target USB device corresponding to the target second device, and the status information includes any one of the following: the target USB device unplugged state and the target USB device plugged-in state;
[0158] Obtain the USB device list corresponding to the first device;
[0159] If the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection;
[0160] If the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information of the third device corresponding to the target USB device, and obtain the second VID information and the second PID information corresponding to the target second device;
[0161] If the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, establish an AOA communication connection between the second device and the third device based on the virtual USB device corresponding to the third device, and implement upper-layer services between the third device and the first device based on the AOA communication connection;
[0162] If the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminate the process.
[0163] In a possible example, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function, and the first device does not support BLE communication; in terms of receiving service data sent by the target second device according to the target AOA communication connection, the above processing unit 705 is specifically configured to:
[0164] Start a preset timer, where the preset timer corresponds to a preset period;
[0165] Obtain the USB device list corresponding to the first device every preset period;
[0166] If the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection;
[0167] If the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information corresponding to the third device corresponding to the target USB device, and obtain the second VID information and the second PID information corresponding to the target second device;
[0168] If the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, establish an AOA communication connection between the second device and the third device based on the virtual USB device corresponding to the third device, and implement upper-layer services between the third device and the first device based on the AOA communication connection;
[0169] If the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminate the process.
[0170] In a possible example, if the target USB device corresponding to the target second device is in the target USB inserted state and the target AOA communication connection is disconnected; as Figure 7C shown, Figure 7C A schematic diagram of the device interconnection apparatus is shown. Based on Figure 7A and Figure 7B the device interconnection apparatus 700 may further include: a sending unit 706. Among them, the sending unit 706 is configured to send a session reset request to the target second device, where the session reset request is used for the target second device to update the state machine;
[0171] The receiving unit 704 is further configured to receive session reset response information sent by the target second device, where the session reset response information is used for the first device to re - establish the target AOA communication connection between the first device and the target second device to maintain the normal implementation of the upper - layer service between the first device and the target second device.
[0172] In a possible example, before sending the session reset request to the target second device, the above - mentioned processing unit 705 is specifically configured to:
[0173] Encapsulate the session information carried in the session reset request according to a preset protocol, where the preset protocol is encapsulated in the upper - layer service layer of the first device, and the session information includes at least one of the following: message type, connection type, and reset status information.
[0174] It should be noted that all relevant contents of each step involved in the above - mentioned method embodiments can be cited in the function descriptions of the corresponding functional modules, and will not be elaborated here.
[0175] The electronic device provided in this embodiment is used to execute the above - mentioned device interconnection method, so it can achieve the same effect as the above - mentioned implementation method.
[0176] In the case of adopting an integrated unit, the electronic device may include a processing module, a storage module, and a communication module. Among them, the processing module can be used to control and manage the actions of the electronic device. For example, it can be used to support the electronic device to execute the steps performed by the above - mentioned determination unit 701, configuration unit 702, start unit 703, receiving unit 704, processing unit 705, and sending unit 706. The storage module can be used to support the electronic device to execute storing program codes and data, etc. The communication module can be used to support the communication between the electronic device and the second device.
[0177] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic blocks, modules, and circuits described in connection with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, and so on. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, etc.
[0178] An embodiment of this application also provides a computer storage medium. Among them, this computer storage medium stores a computer program for electronic data exchange, and this computer program enables a computer to execute part or all of the steps of any of the methods described in the foregoing method embodiments. The foregoing computer includes an electronic device.
[0179] An embodiment of this application also provides a computer program product. The foregoing computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the foregoing computer program is operable to enable a computer to execute part or all of the steps of any of the methods described in the foregoing method embodiments. This computer program product can be a software installation package, and the foregoing computer includes an electronic device.
[0180] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0181] In the foregoing embodiments, the descriptions of the various embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0182] In several embodiments provided by this application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the above-mentioned unit division is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling, direct coupling, or communication connection can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical or other form.
[0183] The units described above as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0184] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0185] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the above methods in the various embodiments of this application. The aforementioned memory includes: USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs and other media that can store program codes.
[0186] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing relevant hardware through a program. This program can be stored in a computer-readable memory. The memory can include: flash drives, read-only memories, random access memories, magnetic disks, or optical discs, etc.
[0187] The above has introduced the embodiments of this application in detail. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application; at the same time, for those of ordinary skill in the art, according to the idea of this application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to this application.
Claims
1. A device interconnection method, applied to a first device, characterized in that, Including: Determine a target second device connected to the first device; Configure a target virtual USB device corresponding to the target second device, wherein the target virtual USB device is used to support the AOA protocol; Start the target virtual USB device, and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device; According to the target AOA communication connection, receive service data sent by the target second device, wherein the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection; Wherein, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function; before receiving the service data sent by the target second device according to the target AOA communication connection, the method further includes: scanning the BLE broadcast corresponding to the target second device, wherein the BLE broadcast is used to indicate the status information of the target USB device corresponding to the target second device, and the status information includes any one of the following: the target USB device unplugged state and the target USB device plugged-in state; obtaining the USB device list corresponding to the first device; if the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection; if the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information of the third device corresponding to the target USB device, and obtain the second VID information and the second PID information of the target second device; if the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, and establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement the upper-layer service between the third device and the first device according to the AOA communication connection; if the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminate the process.
2. The method according to claim 1, wherein If the upper-layer service needs to be implemented through the TCP / IP protocol, the method further includes: Determine the proxy server corresponding to the upper-layer service; Start the proxy server; After receiving the service data sent by the target second device, the method further includes: Process the service data through the proxy server to implement the upper-layer service.
3. The method according to claim 2, wherein The determining the target second device connected to the first device includes: In response to the insertion operations of multiple second devices, determine the PID information and VID information of the USB device corresponding to each second device, wherein each second device corresponds to one USB device, and each USB device corresponds to one PID information and VID information; Determine at least one target USB device according to the PID information and VID information corresponding to each of the USB devices; Determine a second device connected to each of the target USB devices to obtain at least one second device; Screen out a target second device from the at least one second device, where the target second device is used for AOA communication with the first device.
4. The method according to claim 3, wherein If the operating system corresponding to the first device carrying the AOA protocol does not support the hot plug function, and the first device does not support BLE communication; Before receiving the service data sent by the target second device according to the target AOA communication connection, the method further includes: Start a preset timer, where the preset timer corresponds to a preset period; Obtain the USB device list corresponding to the first device every preset period; If the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection; If the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information corresponding to the third device corresponding to the target USB device, and obtain the second VID information and the second PID information corresponding to the target second device; If the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, and establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement the upper-layer service between the third device and the first device according to the AOA communication connection; If the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminate the process.
5. The method according to claim 1, wherein If the target USB device corresponding to the target second device is in the target USB insertion state and the target AOA communication connection is disconnected; the method further includes: Send a session reset request to the target second device, where the session reset request is used for the target second device to update the state machine; Receive the session reset response information sent by the target second device, where the session reset response information is used for the first device to re-establish the target AOA communication connection between the first device and the target second device to maintain the normal implementation of the upper-layer service between the first device and the target second device.
6. The method according to claim 5, wherein Before sending the session reset request to the target second device, the method further includes: Encapsulate the session information carried in the session reset request according to a preset protocol, where the preset protocol is encapsulated in the upper service layer of the first device, and the session information includes at least one of the following: message type, connection type, and reset status information.
7. A device interconnection apparatus, applied to a first device, characterized in that, The device includes: a determination unit, a configuration unit, a start unit, a reception unit, and a processing unit, where The determining unit is configured to determine a target second device connected to the first device; The configuring unit is configured to configure a target virtual USB device corresponding to the target second device, where the target virtual USB device is used to support the AOA protocol; The starting unit is configured to start the target virtual USB device and establish a target AOA communication connection between the target second device and the first device through the target virtual USB device; The receiving unit is configured to receive service data sent by the target second device according to the target AOA communication connection, where the service data is used to implement an upper-layer service between the second device and the first device through the target AOA communication connection; Wherein, if the operating system corresponding to the first device carrying the AOA protocol does not support the hot-plug function; before receiving the service data sent by the target second device according to the target AOA communication connection, the processing unit is configured to: scan the BLE broadcast corresponding to the target second device, where the BLE broadcast is used to indicate the status information of the target USB device corresponding to the target second device, and the status information includes any one of the following: the target USB device unplugged state and the target USB device plugged-in state; obtain the USB device list corresponding to the first device; if the target virtual USB device is included in the USB device list, receive the service data sent by the target second device according to the target AOA communication connection; if the target virtual USB device is not included in the USB device list, determine the first VID information and the second PID information of the third device corresponding to the target USB device, and obtain the second VID information and the second PID information of the target second device; if the first VID information matches the second VID information and the first PID information matches the second PID information, reconfigure the virtual USB device corresponding to the third device, establish an AOA communication connection between the second device and the third device according to the virtual USB device corresponding to the third device, and implement an upper-layer service between the third device and the first device according to the AOA communication connection; if the first VID information does not match the second VID information, and / or the first PID information does not match the second PID information, terminate the process.
8. An electronic device, characterized in that, It includes a processor, a memory, a communication interface, and one or more programs. The one or more programs are stored in the memory and are configured to be executed by the processor. The programs include instructions for performing the steps in the method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, A computer program for electronic data exchange is stored, where the computer program causes a computer to execute the method according to any one of claims 1-6.
Citation Information
Patent Citations
USB connection method and device, electronic equipment and storage medium
CN113297123A
Method and electronic device for USB transmission
CN114201432A