Data transmission method and mobile terminal
By introducing communication middleware into the mobile terminal and automatically switching communication methods based on network information, the data transmission problem of mobile terminals when the environment changes is solved, and seamless near-field and far-field communication is achieved.
Patent Information
- Application Number
- CN202310848422.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-11
- Publication Date
- 2025-01-14
AI Technical Summary
In the prior art, when the mobile terminal changes from a near field to a far field, the preset near field communication method cannot be adapted, resulting in data transmission failure.
By introducing communication middleware into the mobile terminal, the target communication method adapted to the current communication environment is determined based on the networking information of the second mobile terminal, and data transmission is realized. Communication middleware provides a unified interface for multiple applications, decouples applications from the underlying communication methods, and automatically switches near-field and far-field communication protocols.
Ensure seamless data transmission between mobile terminals, avoid data transmission interruption caused by environmental changes, and improve communication flexibility and reliability.
Smart Images

Figure CN119316854A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communication technology, and in particular, to a data transmission method and a mobile terminal. Background Art
[0002] The number of mobile terminals held by users is increasing, and the scenarios of business collaboration and communication between mobile terminals are becoming more and more diverse. Business collaborative mobile terminals can also be understood as devices that log in to the same system account or device account. Generally, business collaborative mobile terminals communicate in the near field. Among them, near field is the abbreviation of near-field wireless network communication environment, which refers to the communication environment in which the distance between mobile terminals is about ten centimeters to ten meters. Wireless network communication methods in the near field include wireless local area networks (WLAN), Bluetooth (blue tooth, BT), ZigBee Technology, etc. For example, WLAN can be a (wireless fidelity, Wi-Fi) network. For example, business collaborative mobile terminal A can perform message notification, file transfer, screen control and other operations with business collaborative mobile terminal B through Bluetooth.
[0003] In existing technologies, data transmission between business collaboration devices is mostly carried out at the application level, with different applications opening data channels and transmitting data layer by layer based on preset near-field communication methods. In actual usage scenarios, the distance between business collaboration devices may change at any time, and the environment in which the business collaboration mobile terminal is located may change from near field to far field. Far field, accordingly, refers to a communication environment where the distance between mobile terminals exceeds ten meters. Wireless network communication methods in the far field include cellular networks, etc. In other words, the communication method between business collaboration devices may change.
[0004] When the environment between business collaboration devices changes and the near-field communication method preset in the application of the mobile terminal is not applicable to the current far-field environment, the problem of being unable to transmit data will occur. Summary of the invention
[0005] The embodiment of the present application provides a data transmission method and a mobile terminal, which are applied to a first mobile terminal and a second mobile terminal including a communication middleware, wherein a first application of the first mobile terminal initiates a session request, and the first application sends the session request to the communication middleware of the first mobile terminal, wherein the communication middleware of the first mobile terminal provides a unified interface for multiple applications of the first mobile terminal. The communication middleware of the first mobile terminal can obtain the networking information of the second mobile terminal based on the identifier of the second mobile terminal carried in the session request of the first application, and determine the target communication mode for data transmission with the second mobile terminal based on the networking information of the second mobile terminal, and perform data transmission of the first application through the target communication mode. In this solution, the application is decoupled from the bottom layer, and the application transmission data does not rely on its preset communication mode for opening the data channel and data transmission. The communication middleware of the first mobile terminal can determine the target communication mode suitable for the current communication environment through the networking information of the second mobile terminal to which the first application wants to send data, so that the data of the first application is successfully transmitted to the second mobile terminal, avoiding the problem of data transmission failure.
[0006] In order to achieve the above-mentioned purpose, the embodiments of the present application adopt the following technical solutions.
[0007] In a first aspect, a data transmission method is provided, which is applied to a mobile terminal, wherein the mobile terminal includes a first mobile terminal and a second mobile terminal, wherein the first mobile terminal and the second mobile terminal are devices belonging to the same device account / system account; the first mobile terminal and the second mobile terminal both include communication middleware, and the communication middleware is used to provide a unified interface for multiple applications of the mobile terminal to process data. The method includes:
[0008] The communication middleware of the first mobile terminal responds to the session request initiated by the first application of the first mobile terminal and obtains the identification of the second mobile terminal carried in the session request. The first mobile terminal obtains the networking mode of the second mobile terminal based on the identification of the second mobile terminal; the networking mode includes the far-field networking mode and the far-field networking mode.
[0009] If the networking mode of the second mobile terminal is a far-field networking mode, the first mobile terminal transmits data of the first application with the second mobile terminal through the first communication mode;
[0010] If the networking mode of the second mobile terminal is a near field networking mode, the first mobile terminal transmits data of the first application with the second mobile terminal through the second communication mode;
[0011] The first communication mode is a communication mode corresponding to a far-field communication environment, the second communication mode is a communication mode corresponding to a near-field communication environment, and the communication distance of the first communication mode is greater than that of the second communication mode.
[0012] Among them, the near-field networking mode refers to the networking mode of the near-field wireless network communication environment, and the near-field wireless network communication environment refers to the communication environment where the distance between devices is about ten centimeters to ten meters. In the near-field communication environment, multiple mobile terminals usually use a peer-to-peer (P2P) architecture data transmission method for data transmission, such as data transmission based on wireless local area networks (WLAN) (such as wireless fidelity, Wi-Fi network), data transmission based on Bluetooth technology, data transmission based on ZigBee Technology, etc.
[0013] Far-field networking refers to the networking of a far-field wireless network communication environment, which refers to a communication environment where the distance between devices is more than ten meters. In a far-field communication environment, multiple mobile terminals usually use a server-client (Client-Server, C / S) architecture for data transmission, such as WLAN-based data transmission, cellular network technology-based data transmission, etc.
[0014] In the present application, in a first mobile terminal and a second mobile terminal including a communication middleware, a first application of the first mobile terminal initiates a session request and sends the session request to the communication middleware of the first mobile terminal, wherein the communication middleware of the first mobile terminal provides a unified interface for multiple applications of the first mobile terminal. The communication middleware of the first mobile terminal can obtain the networking mode of the second mobile terminal based on the identifier of the second mobile terminal carried in the session request of the first application, and perform data transmission of the first application in the first communication mode or the second communication mode according to different networking modes. In this solution, the application is decoupled from the bottom layer, and the application does not rely on its preset communication mode to open the data channel and transmit data. The communication middleware of the first mobile terminal can determine the communication mode suitable for the current communication environment through the networking mode of the second mobile terminal to which the first application wants to send data, so that the data of the first application is successfully transmitted to the second mobile terminal, avoiding the problem of being unable to transmit data.
[0015] In a possible implementation manner of the first aspect, the first communication mode includes multiple communication modes, different communication modes correspond to different priorities, and the first mobile terminal transmits data of the first application with the second mobile terminal through the first communication mode, including:
[0016] The first mobile terminal transmits data of the first application with the second mobile terminal through the communication mode with the highest priority among the first communication modes;
[0017] The first communication method includes wireless local area network WLAN and cellular network technology.
[0018] In a possible implementation manner of the first aspect, the second communication mode includes multiple communication modes, different communication modes correspond to different priorities, and the first mobile terminal transmits data of the first application with the second mobile terminal through the second communication mode, including:
[0019] The first mobile terminal transmits data of the first application with the second mobile terminal through the communication mode with the highest priority among the second communication modes;
[0020] The second communication method includes wireless local area network WLAN, Bluetooth and ZigBee technology.
[0021] The priority of the communication mode can represent the communication performance of the communication mode, such as the communication quality and communication rate. The priority of the communication mode is preset, and the priority of the corresponding communication mode is different in different communication environments.
[0022] In this embodiment, the first mobile terminal may use the communication mode with the highest priority among the first communication mode or the second communication mode as the communication mode for data transmission with the second mobile terminal, thereby ensuring the transmission performance of data transmission between the first mobile terminal and the second mobile terminal.
[0023] In another possible implementation manner of the first aspect, the first mobile terminal transmits data of the first application with the second mobile terminal through the first communication mode, including:
[0024] The first mobile terminal determines a negotiation channel corresponding to the first communication mode; the negotiation channel is used to negotiate the exchange of session keys between the first mobile terminal and the second mobile terminal; the negotiation channel includes a negotiation channel of the WLAN protocol and a negotiation channel based on the message queue telemetry transmission MQTT protocol;
[0025] as well as,
[0026] The first mobile terminal determines a data channel corresponding to the first communication mode; the data channel is used for data transmission of applications between the first mobile terminal and the second mobile terminal; the data channel includes a negotiation channel based on the WLAN protocol and a data channel based on the web real-time communication WebRTC protocol.
[0027] Among them, WebRTC is an application layer protocol used to realize data transmission between mobile terminals in the far field. The WebRTC protocol is suitable for video streaming transmission.
[0028] In another possible implementation manner of the first aspect, the first mobile terminal transmits data of the first application with the second mobile terminal through the second communication mode, including:
[0029] The first mobile terminal determines a negotiation channel corresponding to the second communication mode; the negotiation channel is used to negotiate the exchange of session keys between the first mobile terminal and the second mobile terminal; the negotiation channel includes a negotiation channel based on the WLAN protocol and a negotiation channel based on the Bluetooth protocol;
[0030] as well as,
[0031] The first mobile terminal determines a data channel corresponding to the second communication mode; the data channel is used for data transmission of applications between the first mobile terminal and the second mobile terminal; the data channel includes a negotiation channel based on the WLAN protocol and a data channel based on the Bluetooth protocol.
[0032] The negotiation channel based on the WLAN protocol may be a negotiation channel based on the Wi-Fi protocol. The data transmission protocol between mobile terminals in a near field such as Wi-Fi and Bluetooth is a lightweight communication protocol, which is suitable for interactive use as a negotiation package.
[0033] In the present application, negotiation channels of different protocols are adopted based on different communication environments, which can better meet the negotiation needs of the first mobile terminal and the second mobile terminal. The first mobile terminal and the second mobile terminal need to determine the negotiation channel for negotiating the session key and the data channel for data transmission for data transmission. Among them, the negotiation channel and the data channel correspond to the target communication method. If the target communication method is a communication method under a near-field communication environment, then the negotiation channel and the data channel adopt the channel of the network protocol corresponding to the near-field communication method; if the target communication method is a communication method under a far-field communication environment, then the negotiation channel and the data channel adopt the channel of the network protocol corresponding to the far-field communication method. The first mobile terminal determines the negotiation channel and the data channel that comply with the current communication environment, so that the first mobile terminal and the second mobile terminal can perform data transmission, avoiding the problem that the data of the application module cannot be transmitted due to changes in the communication environment.
[0034] In another possible implementation manner of the first aspect, the method further includes:
[0035] The first mobile terminal performs an initialization operation of a transmission protocol stack; the transmission protocol stack includes a correspondence between different communication modes and retransmission mechanisms during data transmission.
[0036] In this application, different retransmission strategies corresponding to the transmission characteristics of different communication methods are deployed in the transmission protocol stack. When the target communication method adopts unreliable protocols such as the User Datagram Protocol UDP for transmission, the corresponding retransmission strategy deployed by the transmission protocol stack can further ensure the transmission reliability during the data transmission process.
[0037] In another possible implementation manner of the first aspect, the second communication mode uses a user datagram protocol UDP protocol to transmit data, and the retransmission mechanism corresponding to the second communication mode includes:
[0038] If the first mobile terminal receives a response packet returned by the second mobile terminal in response to a preset response interval, and the response packet includes a retransmission linked list, the first mobile terminal retransmits the data sequence corresponding to the data sequence identifier to be retransmitted carried in the retransmission linked list to the second mobile terminal; if the first mobile terminal does not receive the response packet returned by the second mobile terminal when the preset timeout interval arrives, the first mobile terminal obtains the data sequence to be retransmitted, and retransmits the data sequence to be retransmitted to the second mobile terminal.
[0039] In the present application, when the target communication method adopts an unreliable protocol such as the User Datagram Protocol UDP for transmission, the first mobile terminal can determine whether to perform a retransmission operation based on a response packet returned by the second mobile terminal based on a preset response interval; or, the first mobile terminal can determine whether to perform a retransmission operation based on its own preset timeout interval, and after determining that a retransmission operation needs to be performed, perform a retransmission operation on the data sequence to be retransmitted based on the data sequence identifier to be retransmitted, thereby further ensuring the transmission reliability during the data transmission process.
[0040] In another possible implementation manner of the first aspect, the method further includes:
[0041] If the first mobile terminal receives a response packet returned by the second mobile terminal in response to a preset response interval, and the response packet does not include a retransmission linked list, the first mobile terminal retransmits sequence information corresponding to the current sequence to the second mobile terminal.
[0042] In the present application, if the first mobile terminal determines that there is no data sequence that needs to be retransmitted based on the response packet returned by the second mobile terminal, the sequence information of the data sequence can be retransmitted, which can further avoid the loss of the complete sequence during data transmission.
[0043] According to a second aspect, a mobile terminal is provided, which includes a communication middleware, a communication module, and an application module; the mobile terminal transmits data with other devices through the communication middleware; the other devices and the mobile terminal are devices belonging to the same device account / system account; the communication module supports a first communication mode in a far-field communication environment and a second communication mode in a near-field communication environment; the communication distance of the first communication mode is greater than the communication distance of the second communication mode.
[0044] The communication middleware of the mobile terminal responds to the session request initiated by the application module and obtains the identifier of the other device carried in the session request;
[0045] The communication middleware obtains the networking mode of other devices based on the identification of other devices; the networking mode includes far-field networking mode and far-field networking mode;
[0046] If the networking mode of the other devices is a far-field networking mode, the mobile terminal transmits application data of the application module to the other devices through the first communication mode;
[0047] If the networking mode of the other devices is a near field networking mode, the mobile terminal transmits application data of the application module to the other devices through the second communication mode;
[0048] The first communication mode is a communication mode corresponding to a far-field communication environment, the second communication mode is a communication mode corresponding to a near-field communication environment, and a communication distance of the first communication mode is greater than a communication distance of the second communication mode.
[0049] In the present application, the communication middleware of the mobile terminal can obtain the networking information of other devices based on the identification of other devices carried in the session request of the first application, and determine the target communication method for data transmission with other devices based on the networking information of other devices, and perform data transmission of the application module through the target communication method. In this solution, the application is decoupled from the bottom layer, and the application does not rely on its preset communication method to open the data channel and transmit data. The communication middleware of the mobile terminal can determine the target communication method suitable for the current communication environment through the networking information of other devices to which the application module wants to send data, so that the data of the application module can be successfully transmitted to other devices, avoiding the problem of being unable to transmit data.
[0050] In a possible implementation of the second aspect, the communication middleware includes a transmission module and a networking module; the transmission module responds to a session request initiated by the application module, and obtains the identifier of other devices carried in the session request; the transmission module sends the identifier of other devices to the networking module; the networking module obtains the networking mode of other devices, and returns the networking mode of other devices to the transmission module; the transmission module transmits application data of the application module with other devices through the first communication mode or the second communication mode.
[0051] In the present application, the networking module can obtain the networking information of other devices from the application server, so that the transmission module can determine the corresponding communication method based on the networking method of other devices. The transmission module performs the same processing of the communication method for different application modules, decouples the application module from the underlying link of the mobile terminal, and realizes data transmission in different communication environments.
[0052] In another possible implementation of the second aspect, the transmission module includes a transmission protocol stack; the transmission protocol stack deploys the correspondence between different communication modes and retransmission mechanisms during data transmission; the transmission module is used to determine the retransmission mechanism corresponding to the target communication mode from the transmission protocol stack, and based on the corresponding retransmission mechanism, transmit application data of the application module with other devices.
[0053] The transport protocol stack may encapsulate the data carried in the session request.
[0054] In this application, different retransmission strategies corresponding to the transmission characteristics of different communication modes are deployed in the transmission protocol stack. When unreliable protocols such as UDP are used for transmission, the corresponding retransmission strategies deployed by the transmission protocol stack can further ensure the transmission reliability during the data transmission process.
[0055] In another possible implementation of the second aspect, the transmission module includes a unified operation set; the unified operation set provides multiple interfaces for different communication modes; the multiple interfaces include establishing a connection interface, closing a connection interface, sending data interface, and receiving data interface; the transmission module transmits application data with other devices based on the interface corresponding to the first communication mode or the second communication mode.
[0056] In this application, the unified operation set provides different interfaces for different communication methods, shields the interface differences of different underlying links, provides a unified sending and receiving interface for the application module, and realizes the decoupling between the upper-layer business and the underlying far-field and near-field links.
[0057] In another possible implementation manner of the second aspect, the transmission module includes a sending unit;
[0058] The sending unit is used to send the data carried in the session request to the quality server for data quality QOS management analysis.
[0059] In the present application, the sending unit can report the data carried in the session request initiated by the received application module to the quality server, thereby realizing data monitoring of the business transmission process of different application modules and realizing data quality QOS management and analysis functions.
[0060] According to a third aspect, a mobile terminal is provided, which includes a memory, a communication module and one or more processors; the memory and the communication module are coupled to the processor; the memory stores computer program code, and the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the mobile terminal executes a method as described in any one of the above-mentioned first aspects.
[0061] In a fourth aspect, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is executed on a mobile terminal, the mobile terminal can execute any one of the methods described in the first aspect.
[0062] In a fifth aspect, a computer program product comprising instructions is provided, which, when executed on a mobile terminal, enables the mobile terminal to execute any one of the methods described in the first aspect.
[0063] In a sixth aspect, an embodiment of the present application provides a chip, the chip including a processor, the processor being used to call a computer program in a memory to execute the method of the first aspect.
[0064] It can be understood that the beneficial effects that can be achieved by the mobile terminal described in the second and third aspects, the computer-readable storage medium described in the fourth aspect, the computer program product described in the fifth aspect, and the chip described in the sixth aspect provided above can refer to the beneficial effects in the first aspect and any possible design method thereof, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] Figure 1 A schematic diagram of a scenario in which multiple mobile terminals are in near-field service collaboration provided in an embodiment of the present application;
[0066] Figure 2 A schematic diagram of a display interface of a message notification of a mobile terminal provided in an embodiment of the present application;
[0067] Figure 3 A schematic diagram of a dial display interface of a smart watch provided in an embodiment of the present application;
[0068] Figure 4 A schematic diagram of a scenario in which multiple mobile terminals are in far-field service collaboration provided in an embodiment of the present application;
[0069] Figure 5 A schematic diagram of the structure of a mobile terminal provided in an embodiment of the present application;
[0070] Figure 6 A schematic diagram of a system architecture of a mobile terminal provided in an embodiment of the present application;
[0071] Figure 7 A schematic diagram of the architecture of another mobile terminal provided in an embodiment of the present application;
[0072] Figure 8 A schematic diagram of the structure of a transmission module and an access networking layer in a mobile terminal provided in an embodiment of the present application;
[0073] Fig. 9A schematic diagram of interaction between a first mobile terminal and a second mobile terminal provided in an embodiment of the present application;
[0074] Fig.10 A schematic diagram of an interaction scenario between a mobile phone, a smart watch, and a tablet computer provided in an embodiment of the present application;
[0075] Fig.11 A flowchart of a data transmission method provided in an embodiment of the present application;
[0076] Fig.12 A schematic diagram of a process for determining a negotiation channel and a data channel in a data transmission method provided in an embodiment of the present application;
[0077] Fig.13 A schematic diagram of a process of performing negotiation through a negotiation channel and performing data transmission through a data channel in a data transmission method provided in an embodiment of the present application;
[0078] Fig.14 A schematic diagram of a flow chart of a packet loss detection and retransmission mechanism provided in an embodiment of the present application;
[0079] Fig.15 A schematic diagram of the structure of another mobile terminal provided in an embodiment of the present application;
[0080] Fig.16 A schematic diagram of the structure of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0081] In the description of the embodiments of the present application, the terms used in the following embodiments are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification and the appended claims of the present application, the singular expressions "a", "said", "above", "the" and "this" are intended to also include such expressions as "one or more", unless there is a clear contrary indication in the context. It should also be understood that in the following embodiments of the present application, "at least one", "one or more" refer to one or more (including two). The term "and / or" is used to describe the association relationship of associated objects, indicating that three relationships can exist; for example, A and / or B can represent: 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 a kind of "or" relationship.
[0082] References to "one embodiment" or "some embodiments" etc. described in this specification mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Thus, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways. The term "connection" includes direct connection and indirect connection, unless otherwise specified. "First" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated.
[0083] In the embodiments of the present application, words such as "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0084] As the scenarios in which users use mobile terminals are diversified, the number of mobile terminals held by users is also increasing, and the scenarios of business collaboration and communication between mobile terminals are also becoming more and more diverse. Generally, some business collaborations between multiple mobile terminals are carried out in the near field. Near field is the abbreviation of near-field wireless network communication environment, which refers to a communication environment in which the distance between devices is about ten centimeters to ten meters. In the near field, multiple mobile terminals usually use a point-to-point (peer to peer, P2P) architecture data transmission method for data transmission, such as data transmission based on WLAN (such as Wi-Fi network), data transmission based on Bluetooth technology, and data transmission based on ZigBee Technology. In order to increase the communication bandwidth, the transmission control protocol / internet protocol (TCP / IP) transport layer of the mobile terminal usually adopts the user datagram protocol (UDP) protocol.
[0085] Multiple mobile terminals often log in to the same device account or system account when performing business collaboration operations. The near-field business collaboration scenarios of multiple mobile terminals can include screen projection, multi-screen collaborative operations, split-screen / copy screen display, device control, file transfer, data synchronization, message notification, and many other scenarios.
[0086] For example, reference Figure 1 A schematic diagram of a near-field wireless network communication environment is given. Among multiple mobile terminals, the first mobile terminal can be a mobile phone, and the second mobile terminal can be a TV, a tablet computer, etc. The first mobile terminal and the second mobile terminal belong to the same device account or system account. When the application of the first mobile terminal has message notification permissions enabled, the first mobile terminal can send message notifications of the application to the second mobile terminal, thereby realizing message synchronization between the first mobile terminal and the second mobile terminal in business collaboration. For example, when the first mobile terminal is a mobile phone, the message notification permission setting interface of each application in the mobile phone can refer to Figure 2 In the message notification setting interface of the mobile phone, you can set the message notification permissions of application 1-application 7. If the message notification of an application is turned on, the mobile phone can synchronize the message notification of the application to the corresponding second mobile terminal (for example, a smart watch, a smart bracelet, a tablet computer, etc.) at the same time.
[0087] refer to Figure 3 , Figure 3 A schematic diagram of a schedule notification message displayed on a smart watch is given. The schedule notification message can be sent to the smart watch by a mobile phone via a near field communication method such as Wi-Fi / Bluetooth / ZigBee. For example, the schedule notification can be as follows: Figure 3 The meeting notification information shown in (a) can also be as follows Figure 3 Flight notification information of the travel application shown in (b).
[0088] In other business collaboration scenarios, for example, when a mobile phone and a TV / tablet are in the same room, the mobile phone can project the screen or a video of a video application played on the mobile phone to the TV / tablet through any short-distance communication method such as Wi-Fi / Bluetooth / ZigBee to achieve near-field screen projection. The mobile phone can replicate the screen and project it to the TV / tablet through Wi-Fi / Bluetooth / ZigBee, where screen replication refers to the projection ratio formed by the size of the display screen of the TV / tablet and the size of the display screen of the mobile phone, and all the display content in the display screen of the mobile phone is displayed on the TV / tablet according to the projection ratio. Alternatively, the mobile phone extends the screen and projects it to the TV / tablet through Wi-Fi / Bluetooth / ZigBee, where screen expansion refers to displaying part of the display content in the display screen of the mobile phone on the TV / tablet according to a certain projection ratio, where part of the display content can be customized or determined according to a preset expansion ratio. This realizes multi-screen collaborative operation, split screen / copy screen display, etc. between mobile phones and TV / tablets in the near field. The mobile phone can also control the screen or function of the TV / tablet through Wi-Fi / Bluetooth / ZigBee to achieve device control, etc. The mobile phone can also transfer files stored locally on the mobile phone to the TV / tablet computer via Wi-Fi / Bluetooth / ZigBee. Or, the tablet computer can transfer files stored locally to the mobile phone / TV via Wi-Fi / Bluetooth / ZigBee to achieve file transfer, etc.
[0089] For example, among multiple mobile terminals, the first mobile terminal may be a mobile phone, and the second mobile terminal may be a wearable device (e.g., a watch, a bracelet, etc.). The distance between the mobile phone and the watch / bracelet is within the data transmission distance corresponding to the near field, and the mobile phone may obtain the user's health data (e.g., heart rate, blood pressure, number of steps, etc.) collected by the watch or bracelet through Wi-Fi / Bluetooth / ZigBee, and realize data synchronization of health data between the first mobile terminal and the second mobile terminal, etc. Alternatively, the mobile phone sends the notification message of the received application to the watch / bracelet through Wi-Fi / Bluetooth / ZigBee, and realizes data synchronization of the notification message between the first mobile terminal and the second mobile terminal, etc.
[0090] Exemplarily, business collaboration between multiple mobile terminals can also be carried out in the far field. Corresponding to the near field, the far field refers to the far-field wireless network communication environment, which refers to the communication environment where the distance between devices is more than ten meters. In the far field, multiple mobile terminals usually use a server-client (Client-Server, C / S) architecture data transmission method for data transmission, such as WLAN-based data transmission, cellular network technology-based data transmission, etc. In the far-field wireless network communication environment, the TCP / IP transport layer of the mobile terminal usually adopts the TCP protocol.
[0091] The business collaboration scenarios between multiple mobile terminals in the far field include data synchronization, etc. For example, refer to Figure 4 A schematic diagram of a far-field wireless network communication environment is given, in which a plurality of mobile terminals, a first mobile terminal may be a mobile phone, and a second mobile terminal may be a wearable device (e.g., a watch, a bracelet, etc.), for example, the distance between the mobile phone and the watch / bracelet exceeds the near-field communication distance, and the mobile phone and the watch / bracelet cannot communicate through the near-field communication method, and the mobile phone and the watch / bracelet can communicate through the far-field communication method without limiting the communication distance. For example, for example, the mobile phone is indoors and the user is exercising outdoors with a bracelet, and the communication distance between the mobile phone and the bracelet has exceeded the farthest communication distance in the near field. In this scenario, the mobile phone can communicate with the bracelet through a cellular network with no restrictions on the communication distance to obtain the user's health data (e.g., heart rate, blood pressure, number of steps, etc.) collected by the bracelet, and realize the data synchronization of the health data of the mobile phone and the bracelet in the far field. Alternatively, the mobile phone sends the notification message of the received application to the watch / bracelet through the cellular network, realizing the data synchronization of the notification message of the notification message mobile phone and the notification message of the application of the bracelet in the far field, etc.
[0092] The data transmission methods of multiple mobile terminals in the near field and far field are completely different. If the data transmission methods of multiple mobile terminals change from far field to near field, for example, the communication environment between mobile terminals is switched from near field to far field, for applications in the mobile terminal that only preset the data transmission method corresponding to the near field for data transmission, it is impossible to communicate in the far field through the data transmission method corresponding to the far field, so that this type of application may cause data transmission interruption. For example, the distance between the mobile phone and the bracelet is within the near field communication distance, such as the mobile phone and the bracelet are in the same room or in the same outdoor. The health application in the bracelet can synchronize the collected user's health data to the mobile phone through the preset near field data transmission method, such as Wi-Fi / Bluetooth / ZigBee. If the distance between the mobile phone and the bracelet exceeds the near field communication distance and cannot communicate through the near field data transmission method, the health application in the bracelet cannot synchronize the collected user's health data to the mobile phone through Wi-Fi / Bluetooth / ZigBee according to the preset data transmission method, resulting in the health data of the health application of the bracelet cannot be transmitted to the mobile phone normally.
[0093] Among them, in the above-mentioned far-field communication distance scenario, the essence of the problem that the bracelet cannot synchronize health data to the mobile phone via Wi-Fi / Bluetooth / ZigBee is that the data transmission for business collaboration between existing mobile terminals is often implemented by each business / application at the application layer. The data transmission method of each business / application is a preset data transmission method. The application layers of different businesses / applications need to adapt to different underlying transmission protocols, and the application layer and the physical layer are highly coupled.
[0094] For example, the preset data transmission method of the health application of the bracelet is Wi-Fi / Bluetooth / ZigBee. Only after the bracelet and the mobile phone are connected through Wi-Fi / Bluetooth / ZigBee, the health application of the bracelet can send data at its application layer through the data transmission method of Wi-Fi / Bluetooth / ZigBee; if the bracelet and the watch are not connected through Wi-Fi / Bluetooth / ZigBee, the health application of the bracelet cannot transmit data through any of these methods.
[0095] That is to say, there are services / applications in the mobile terminal that are preset for data transmission under a certain communication environment. If the communication environment in which the mobile terminal is located changes, for example, the communication environment changes from near field to far field, the services / applications that are preset for data transmission under the near field will be unable to transmit data through the near field data transmission method because the mobile terminal is in the far field, resulting in data transmission interruption.
[0096] An embodiment of the present application provides a data transmission method and a mobile terminal, which are applied to a first mobile terminal and a second mobile terminal, wherein the first mobile terminal and the second mobile terminal are mobile terminals under the same device account / system account. Both the first mobile terminal and the second mobile terminal include communication middleware, wherein the communication middleware may include one or more processors and other functional modules for executing the data transmission method provided by the present application. In this embodiment, a first application of the first mobile terminal initiates a session request, and the first application sends the session request to the communication middleware of the first mobile terminal, wherein the communication middleware of the first mobile terminal provides a unified interface for multiple applications of the first mobile terminal. The communication middleware of the first mobile terminal can obtain the networking information of the second mobile terminal based on the identifier of the second mobile terminal carried in the session request of the first application, and the communication middleware of the first mobile terminal determines the target communication mode for data transmission with the second mobile terminal based on the networking information of the second mobile terminal, and performs data transmission of the first application through the target communication mode. In this solution, the application is decoupled from the underlying transmission protocol, and the application does not rely on its preset communication method to open the data channel and transmit data. The communication middleware of the first mobile terminal can determine the target communication method suitable for the current communication environment through the networking information of the second mobile terminal to which the first application wants to send data, thereby successfully transmitting the data of the first application to the second mobile terminal and avoiding the problem of being unable to transmit data.
[0097] The data transmission method provided in the embodiment of the present application can be applied to a mobile terminal with corresponding communication capabilities in near-field and far-field environments. Among them, the near-field corresponding communication capabilities include short-range communication capabilities such as Bluetooth, Wi-Fi, ZigBee, near field communication (NFC); and the far-field corresponding communication capabilities include long-range communication capabilities such as cellular networks. Exemplarily, the mobile terminal can be a portable computer (such as a mobile phone), a tablet computer, a laptop computer, a personal computer (PC), a wearable electronic device (such as a smart watch, a smart bracelet), an augmented reality (AR) and a virtual reality (VR) device, etc. The following embodiments do not impose any special restrictions on the specific form of the mobile terminal.
[0098] Please refer to Figure 5, which shows a structural block diagram of a mobile terminal (such as mobile terminal 100) provided in an embodiment of the present application. Among them, the mobile terminal 100 may include a processor 310, an external memory interface 320, an internal memory 321, a universal serial bus (USB) interface 330, a charging management module 340, a power management module 341, a battery 342, an antenna 1, an antenna 2, a mobile communication module 350, a wireless communication module 360, an audio module 370, a speaker 370A, a receiver 370B, a microphone 370C, an earphone interface 370D, a sensor module 380, a camera 393, a display screen 394, etc.
[0099] The structure illustrated in the embodiment of the present invention does not constitute a limitation on the mobile terminal 100. It 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.
[0100] The processor 310 may include one or more processing units. For example, the processor 310 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). Different processing units may be independent devices or integrated into one or more processors.
[0101] The controller can be a decision maker that directs the various components of the mobile terminal 100 to work in coordination according to the instructions. It is the nerve center and command center of the mobile terminal 100. The controller generates an operation control signal according to the instruction operation code and timing signal to complete the control of fetching and executing instructions.
[0102] In this embodiment, the processor 310 of the mobile terminal (first mobile terminal) can select a data transmission method suitable for the networking situation of the second mobile terminal to perform business / application data transmission, thereby achieving an effect of successful data transmission between the first mobile terminal and the second mobile terminal regardless of the communication environment in which the first mobile terminal and the second mobile terminal are located.
[0103] The processor 310 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 310 is a high-speed cache memory, which can store instructions or data that the processor 310 has just used or cyclically used. If the processor 310 needs to use the instruction or data again, it can be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 310, and thus improves the efficiency of the system.
[0104] In some embodiments, the processor 310 may include an interface. 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 SIM interface, and / or a USB interface, etc.
[0105] The interface connection relationship between the modules shown in the embodiment of the present invention is only for illustrative purposes and does not constitute a structural limitation on the mobile terminal 100. The mobile terminal 100 may adopt different interface connection modes in the embodiment of the present invention, or a combination of multiple interface connection modes.
[0106] The charging management module 340 is used to receive charging input from the charger to charge the battery 342. While the charging management module 340 is charging the battery 342, it can also power the mobile terminal 100 through the power management module 341. The power management module 341 is used to connect the battery 342, the charging management module 340 and the processor 310. The power management module 341 receives input from the battery 342 and / or the charging management module 340, and powers the processor 310, the internal memory 321, the external memory interface 320, the display screen 394, the camera 393, and the communication module 360. The power management module 341 can also be used to monitor parameters such as battery capacity, battery cycle number, battery health status (leakage, impedance), etc. In some embodiments, the power management module 341 can also be set in the processor 310. In some embodiments, the power management module 341 and the charging management module 340 can also be set in the same device.
[0107] The wireless communication function of the mobile terminal 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 350, the wireless communication module 360, the modem processor and the baseband processor.
[0108] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the mobile terminal 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0109] The mobile communication module 350 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the mobile terminal 100. The mobile communication module 350 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 350 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 350 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the processor 310. In some embodiments, at least some of the functional modules of the mobile communication module 350 can be set in the same device as at least some of the modules of the processor 310.
[0110] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent 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. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 370A, a receiver 370B, etc.), or displays an image or video through a display screen 394. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 310 and be set in the same device as the mobile communication module 350 or other functional modules.
[0111] The wireless communication module 360 can provide wireless communication solutions including WLAN (such as Wi-Fi network), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the mobile terminal 100. The wireless communication module 360 can be one or more devices integrating at least one communication processing module. The wireless communication module 360 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and filters it, and sends the processed signal to the processor 310. The wireless communication module 360 can also receive the signal to be sent from the processor 310, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.
[0112] In some embodiments, the antenna 1 of the mobile terminal 100 is coupled to the mobile communication module 350, and the antenna 2 is coupled to the wireless communication module 360, so that the mobile terminal 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, etc. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).
[0113] In this embodiment,
[0114] The mobile terminal 100 implements the display function through a GPU, a display screen 394, and an application processor. The GPU is a microprocessor for image processing, connecting the display screen 394 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 310 may include one or more GPUs that execute program instructions to generate or change display information.
[0115] The display screen 394 is used to display images, videos, etc. For example, the display screen 394 can display an incoming call reminder interface and a voice call interface. In the embodiment of the present application, if the mobile terminal 100 receives an in-application call request initiated by the opposite end in the first application, the display screen 394 of the mobile terminal 100 can display a voice call interface including the service information of the first application.
[0116] The mobile terminal 100 can realize the shooting function through the ISP, the camera 393, the video codec, the GPU, the display screen and the application processor.
[0117] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of the mobile terminal 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.
[0118] The external memory interface 320 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the mobile terminal 100. The external memory card communicates with the processor 310 through the external memory interface 320 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0119] The internal memory 321 can be used to store computer executable program codes, which include instructions. The processor 310 executes various functional applications and data processing of the mobile terminal 100 by running the instructions stored in the internal memory 321. The memory 321 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the mobile terminal 100 (such as audio data, a phone book, etc.), etc. In addition, the memory 321 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, other volatile solid-state storage devices, a universal flash storage (UFS), etc.
[0120] The mobile terminal 100 can implement audio functions such as music playing and recording through the audio module 370, the speaker 370A, the receiver 370B, the microphone 370C, the earphone interface 370D, and the application processor.
[0121] The software system of the mobile terminal 100 may adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. Taking the system as an example, the software structure of the mobile terminal 100 is exemplified.
[0122] Figure 61 is a software structure diagram of the mobile terminal 100 of an embodiment of the present invention. The layered architecture divides the software into several layers, each with a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, The system is divided into four layers, from top to bottom: application layer, application framework layer, Android runtime and system library, and kernel layer.
[0123] The application layer can include a series of application packages.
[0124] like Figure 6 As shown, the application package may include applications such as camera, gallery, calendar, phone, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0125] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0126] like Figure 6 As shown, the application framework layer may include communication middleware, window manager, content provider, view system, telephony manager, resource manager and notification manager.
[0127] In this embodiment, reference Figure 7 The communication middleware of the mobile terminal includes a transmission module, a connection discovery module, a networking module, etc. The communication middleware is used to execute the data transmission method provided in this embodiment.
[0128] Among them, the connection discovery module is used to query other devices (referred to as other devices) that belong to the same device account / system account as the mobile terminal from the device server. Among them, the device server also includes the online status / offline status of each mobile terminal in the near field or far field. The connection discovery module is also used to establish a binding relationship between the mobile terminal and other devices based on the identity authentication mechanism. The binding relationship can be understood as a binding relationship between trusted devices under the same device account / system account based on the identity authentication system.
[0129] Optionally, the mobile terminal and other devices can perform data transmission through the application server; the mobile terminal and other devices can also perform data transmission directly through the data transmission method of the P2P architecture. The application server implements operations such as the establishment and closing of the data transmission channel / negotiation channel between the mobile terminal and other devices, as well as data transmission and reception. Among them, the application server also includes information such as the networking status of each mobile terminal.
[0130] The networking module is used to obtain the networking status of other devices from the application server through the communication module.
[0131] The transmission module is used to receive data transmitted by each application / service in the application layer of the mobile terminal. For example, the data transmitted by the application / service includes the identifier of the peer device, the service name, the service type, etc. The transmission module is also used to obtain the networking status of the peer device corresponding to the identifier from the networking module based on the received identifier of the peer device, and determine the appropriate data transmission mode for the data transmission of the current service / application based on the networking status of the peer device. This includes determining the appropriate negotiation channel and data transmission channel, etc.
[0132] Optionally, refer to Figure 8 ,The transmission module of the communication middleware may include a transmission protocol stack, a sending unit, and a unified operation set.
[0133] Among them, the transmission protocol stack encapsulates the received business / application data to be sent once; different retransmission strategies corresponding to different data transmission methods are deployed in the transmission protocol stack, and the transmission protocol stack can execute the corresponding retransmission strategy based on the determined data transmission method; the transmission protocol stack can transmit the encapsulated data to the sending unit.
[0134] The sending unit can perform quality of service (QOS) management based on the encapsulated data of the business / application; and, the sending unit writes the encapsulated data of different businesses / applications into different sending queues according to the priorities of different businesses / applications, and transmits the encapsulated data of the business / application to a unified operation set based on the priorities of the sending queues.
[0135] In order to support different far-field and near-field data transmission channels (for example, Wi-Fi transmission channels, WebRTC transmission channels, Bluetooth transmission channels, etc.) to access the sending unit together, the sending unit needs to formulate a unified operation set interface for multiple data transmission channels. The unified operation set includes a connection creation interface, a data sending interface, a data receiving interface, and a connection closing interface. It can support multiple data transmission channels to be registered to the unified operation set interface. When the service triggers the initialization of the local transmission capability, it initializes the corresponding operation set according to the data transmission type supported by the local end, including initialization of the device socket, establishment of connection, closing connection, sending data, receiving data and other operations. When the transmission module performs related operations, a unified operation can be called for different transmission types, and then the corresponding interface is called by the specific implementation of the operation set.
[0136] That is, the unified operation set provides multiple link interfaces for different services / applications. The unified operation set initializes registration information according to each service / application and calls the sending interface corresponding to the service / application to perform data transmission of the encapsulated data of the service / application.
[0137] The multiple interfaces in the unified operation set may include link interfaces corresponding to multiple data transmission modes in the far field and the near field. Exemplarily, the multiple interfaces include a Wi-Fi interface, a Bluetooth interface, a web real-time communication (WebRTC) interface, and the like.
[0138] Exemplarily, in this embodiment, the communication middleware can receive data from multiple services / applications, and determine the data transmission method, interface, etc. that are suitable for each service / application, and provide a unified interface for the application layer application / service to process the data sent by the application layer application / service. Compared with the prior art, in the process of data transmission of each application / service, each application / service needs to send data down layer by layer to adapt to the underlying transmission protocol and data transmission method corresponding to each application / service. The unified operation of the communication middleware in this embodiment sets multiple interfaces to shield the interface differences of different underlying links, and provide a unified sending and receiving interface for the application layer, realizing the decoupling between the application layer service / application and the different underlying links.
[0139] 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.
[0140] 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.
[0141] 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. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.
[0142] In an embodiment of the present application, a data file describing the interface layout may be stored in a database. When constructing an interface (e.g., a desktop including application icons), the view system may obtain the stored data file through a content provider and display the interface according to the obtained data file. In some embodiments, when constructing an interface, the data file stored in the content provider may also be modified.
[0143] The phone manager is used to provide communication functions of the mobile terminal 100. For example, the management of call status (including connected, hung up, etc.).
[0144] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0145] 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, the mobile terminal vibrates, the indicator light flashes, etc.
[0146] Android runtime includes core library and virtual machine. Android runtime is responsible for scheduling and management of Android system. Core library consists of two parts: one is the function that Java language needs to call, and the other is Android core library.
[0147] 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.
[0148] The system library may include multiple functional modules, such as surface manager, media libraries, 3D graphics processing library (such as openGL ES), 2D graphics engine (such as SGL), etc.
[0149] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications. The media library supports playback and recording of multiple common audio and video formats, as well as static image files. The media library can support multiple 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, synthesis, and layer processing. The 2D graphics engine is a drawing engine for 2D drawing.
[0150] 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.
[0151] The embodiments of the present application provide a data transmission method and a mobile terminal, which are applied to a first mobile terminal and a second mobile terminal. Fig. 9 A diagram of an interaction architecture between a first mobile terminal and a second mobile terminal is provided.
[0152] The first mobile terminal may be a transmitting device; the second mobile terminal may be a receiving device. The first mobile terminal includes application layer applications / services, communication middleware, and communication modules, etc.; the second mobile terminal includes application layer applications / services, data routing distribution modules, communication middleware, and communication modules, etc. The first mobile terminal and the second mobile terminal are devices belonging to the same device account or system account, that is, the first mobile terminal and the second mobile terminal are trusted devices that have undergone identity authentication.
[0153] Fig. 9 The device server in is used to manage at least one mobile terminal corresponding to multiple device accounts or system accounts. For example, the first mobile terminal can obtain the device status of other mobile terminals belonging to the same device account or system account by accessing the device server. Among them, the device status includes an online state or an offline state line. The online state refers to the mobile terminal being in a state where data can be transmitted with a mobile terminal of a device belonging to the same device account or system account through any communication connection method in the near field or the far field. Exemplarily, the distance between the second mobile terminal and the first mobile terminal is within the near field communication distance range. After the second mobile terminal is powered on, it can transmit data with the first mobile terminal through a near field communication connection method such as Wi-Fi, Bluetooth, etc. At this time, the second mobile terminal is in an online state; for example, the distance between the second mobile terminal and the first mobile terminal exceeds the near field communication distance. After the second mobile terminal is powered on, it can transmit data with the first mobile terminal through a cellular network. At this time, the second mobile terminal is also in an online state. For example, the second mobile terminal and the first mobile terminal are within the near field communication distance, the second mobile terminal is not powered on, the second mobile terminal cannot be discovered by the first mobile terminal, and is in an offline state. Alternatively, all communication modules of the near-field communication mode of the second mobile terminal are abnormal, and the second mobile terminal cannot be found by the first mobile terminal and is in an offline state. Alternatively, the distance between the second mobile terminal and the first mobile terminal exceeds the near-field communication distance, the second mobile terminal is not powered on, and the second mobile terminal cannot be found by the first mobile terminal and is in an offline state. Alternatively, all communication modules of the far-field communication mode of the second mobile terminal are abnormal, and the second mobile terminal cannot be found by the first mobile terminal and is in an offline state.
[0154] Whether the mobile terminal is online or offline, the mobile terminal reports its current device status to the device server, and the device server can update the device status of the mobile terminal accordingly, making it easier for other mobile terminals to query the device status of trusted devices.
[0155] In this embodiment, the discovery connection module of the communication middleware of the first mobile terminal can obtain a trusted device whose device status is online from the device server. Alternatively, after a new mobile terminal belonging to the same device account / system account as the first mobile terminal is discovered by the first mobile terminal, the first mobile terminal can authenticate the new mobile terminal as a trusted device based on the identity authentication mechanism, thereby reporting the new mobile terminal that passes the identity authentication mechanism to the device server through the discovery connection module.
[0156] The mobile terminal can report its corresponding networking information to the application server. For example, the mobile terminal can transmit data with other trusted devices through one of multiple communication methods such as Wi-Fi, Bluetooth, message queuing telemetry transport (MQTT). The application server can store the networking information reported by the mobile terminal in the device information library in the cloud. The networking information is used to characterize the current communication method of the mobile terminal or the communication method that the mobile terminal can adopt.
[0157] The service / application of the first mobile terminal initiates a session request, and the session request carries information such as the identifier of the receiving device of the data, the transmission data type, and the priority of the communication mode. Among them, exemplarily, the identifier of the receiving device corresponds to the second mobile terminal. The transmission data type refers to the data type transmitted by the service / application. For example, the data type includes information flow data, video flow data, etc. The priority of the communication mode refers to the priority of different communication modes preset when the mobile terminal can support multiple communication modes. For example, the mobile terminal supports Wi-Fi communication and Bluetooth communication, and the preset priority of Wi-Fi communication is higher than that of Bluetooth communication. The service / application can transmit the identifier of the receiving device, the transmission data type, the priority of the communication mode, and other information to the communication middleware of the first mobile terminal. The transmission module of the communication middleware receives this information, and based on the identifier of the receiving device, through the networking module and the communication module, queries the device information library of the application server to obtain the networking information of the mobile terminal corresponding to the identifier of the receiving device. Optionally, the communication middleware of the first mobile terminal can also query the networking information of the local terminal (the first mobile terminal itself) at the same time. The communication middleware of the first mobile terminal determines the communication mode with the second mobile terminal based on the networking information of the opposite end (the second mobile terminal) and the local end (the first mobile terminal). Among them, the communication middleware of the first mobile terminal determines the communication mode with the second mobile terminal, including determining the negotiation channel and the data channel with the second mobile terminal. Among them, the negotiation channel is an encrypted channel, and the first mobile terminal and the second mobile terminal exchange and negotiate information such as version number, service name, session key, channel type, channel identifier, heartbeat strategy, target device identifier, service priority, etc. based on the negotiation channel; the data channel is a non-encrypted channel, which is used for the transmission of service data and control signaling. During the data transmission process, the sending end device (such as the first mobile terminal) uses the session key negotiated in the negotiation channel to encrypt the sent data, and the receiving end device (such as the second mobile terminal) uses the session key to decrypt the received data.
[0158] Fig.10 A schematic diagram of a scenario in which a first mobile terminal interacts with a second mobile terminal is provided. Fig.10 In the example, the first mobile terminal is a mobile phone, and the second mobile terminal is a tablet computer and a smart watch. The mobile phone, tablet computer and smart watch use the same system account / device account and are trusted devices. The mobile phone and tablet computer are in a near-field wireless network communication environment, and the mobile phone and smart watch are in a far-field wireless network communication environment. Fig.10 , introduces the data transmission method provided by this embodiment, taking the example of a mobile phone sending a message notification to a tablet computer and a smart watch as an example, referring to Fig.11 ,include:
[0159] S201. A first application of a first mobile terminal generates service data to be sent.
[0160] The first application may be any system application or third-party application in the mobile phone. For example, the first application is a communication application, and the service data may be message notifications; the first application is a file transfer application, and the service data may be file data to be transferred; the first application is a video application, and the service data may be video stream data; the second application is a health management application, and the service data may be the user's health data, such as sleep duration, heart rate, number of steps, and other data.
[0161] S202: The communication middleware of the first mobile terminal receives a session request initiated by the first application.
[0162] Exemplarily, the session request carries information such as service data, an identifier of the second mobile terminal, a transmission data type, and a communication mode priority.
[0163] For example, in one embodiment, the preset communication mode of the first application may be a far-field communication mode, for example, the preset communication mode of the first application includes Wi-Fi and a cellular network. The communication mode priority of the first application includes that the priority of cellular network communication is higher than that of Wi-Fi communication.
[0164] Optionally, in another embodiment, the preset communication mode of the first application may be a near field communication mode, for example, the preset communication mode of the second application includes Wi-Fi, Bluetooth, NFC, and Zigbee. The communication mode priority of the second application includes Wi-Fi communication having a higher priority than Bluetooth communication, Bluetooth communication having a higher priority than Zigbee communication, Zigbee communication having a higher priority than NFC communication, and so on.
[0165] Alternatively, the preset communication mode of the first application includes both the near-field communication mode and the far-field communication mode, for example, the preset communication mode of the first application includes Wi-Fi, Bluetooth, and cellular network. The priority of the communication mode of the first application includes that the priority of cellular network communication is higher than that of Wi-Fi communication, and the priority of Wi-Fi communication is higher than that of Bluetooth communication.
[0166] S203: The communication middleware of the first mobile terminal queries the application server for networking information of the second mobile terminal corresponding to the identifier of the second mobile terminal in the session request.
[0167] Among them, the networking information is used to characterize the communication methods currently available for the tablet computer or smart watch. In this embodiment, exemplarily, when the second mobile terminal is a tablet computer, the mobile phone queries the networking information of the tablet computer corresponding to the identifier from the application server, and the tablet computer and the mobile phone are in a near-field network communication environment. The tablet computer networking information includes the communication methods in the near field, such as Wi-Fi, Bluetooth, etc. Exemplarily, when the second mobile terminal is a smart watch, the mobile phone queries the networking information of the smart watch corresponding to the identifier from the application server, and the smart watch and the mobile phone are in a far-field network communication environment. The tablet computer networking information includes the communication methods in the far field, such as the networking information of the smart watch and includes Wi-Fi and cellular network.
[0168] S204: The communication middleware of the first mobile terminal determines a target communication mode according to the priority of the preset communication mode of the application and the networking information of the second mobile terminal.
[0169] Exemplarily, when the second mobile terminal is a tablet computer, the first mobile terminal determines the communication method with the highest priority in the current communication environment (near field) based on the networking information of the tablet computer and the priority of the preset communication method of the first application. For example, for a tablet computer in a near-field network communication environment, the Wi-Fi communication method has the highest priority, and the mobile phone can determine Wi-Fi as the target communication method for data transmission with the tablet computer.
[0170] Exemplarily, when the second mobile terminal is a smart watch, the first mobile terminal determines the communication method with the highest priority in the current communication environment (far field) based on the networking information of the smart watch and the priority of the preset communication method of the first application. For example, for a smart watch in a far-field network communication environment, the cellular network communication method has the highest priority, so the mobile phone can determine the cellular network as the target communication method for data transmission with the smart watch.
[0171] S205. The communication middleware of the first mobile terminal sends the service data of the first application to the second mobile terminal through a target communication method.
[0172] In the above embodiment, whether the second mobile terminal and the first mobile terminal are in a near-field network communication environment or a far-field network communication environment, for example, the mobile phone and the smart watch are in a far-field network communication environment, for example, the mobile phone is placed indoors, and the user wears a smart watch to exercise outdoors. Or, the mobile phone and the smart watch are in a near-field network communication environment, for example, the mobile phone is placed indoors, and the user wears a smart watch to move indoors. Or, the network communication environment of the mobile phone and the smart watch changes, for example, the mobile phone is placed indoors, and the user wears a smart watch from outdoor to indoor (from near field to far field); or, the mobile phone is placed indoors, and the user wears a smart watch from indoor to outdoor (from far field to near field) and other scenes. The mobile phone (first mobile terminal) can obtain the current networking information of the smart watch (second mobile terminal) when the application initiates a session request, that is, the first mobile terminal can determine the corresponding communication mode according to the network communication environment where the second mobile terminal is located.
[0173] In the above embodiment, regardless of whether the preset communication mode of the application that initiates the session request in the first mobile terminal is the near-field communication mode or the far-field communication mode. For example, the application is a health management application, a file transfer application, etc., and the preset communication mode of such applications is the near-field communication mode; for example, Wi-Fi, Bluetooth, etc. Alternatively, the application may be a communication application, a video application, etc., and the preset communication mode of such applications is a far-field communication mode, such as Wi-Fi, a cellular network, etc. When the application initiates a session request, the mobile phone (first mobile terminal) can determine the corresponding communication mode based on the priority of the preset communication mode of the application and the current networking information of the second mobile terminal (that is, the first mobile terminal can be based on the network communication environment with the second mobile terminal).
[0174] The communication middleware of the first mobile terminal provides a unified interface for multiple applications. The communication middleware of the first mobile terminal can determine the target communication mode with the second mobile terminal based on the preset communication mode of the application and the networking information of the second mobile terminal, thereby transmitting the business data of the application based on the target communication mode, decoupling the application from the underlying layer, and the application does not rely on its preset communication mode to open the data channel and transmit data. The communication middleware of the first mobile terminal can determine the target communication mode suitable for the current communication environment through the networking information of the second mobile terminal to which the application wants to send data, thereby successfully transmitting the application data to the second mobile terminal and avoiding the problem of being unable to transmit data.
[0175] Among them, in the above steps S204 and S205, the specific process of the first mobile terminal determining the target communication mode with the second mobile terminal and performing data transmission based on the determined target communication mode further includes the first mobile terminal determining the negotiation channel with the second mobile terminal and the first mobile terminal determining the data channel with the second mobile terminal. Fig.12 The first mobile terminal interacts with the second mobile terminal via the established negotiation channel to perform negotiation packets; the first mobile terminal interacts with the second mobile terminal via the established data channel to perform data packets (data, information) and control packets (control instructions).
[0176] In different network environments where the mobile terminal is located (for example, the mobile terminal is in the near field or the far field), the mobile terminal can adopt different communication methods, that is, the selectable negotiation channels and data channels are different. Exemplarily, the negotiation channel includes channels such as Wi-Fi, Bluetooth, and MQTT; the data channel includes channels such as Wi-Fi, Bluetooth, and WebRTC. Among them, Wi-Fi and Bluetooth can be used to realize data transmission between mobile terminals in the near field; MQTT and WebRTC are application layer protocols for realizing data transmission between mobile terminals in the far field. The data transmission protocol between mobile terminals in the near field such as Wi-Fi and Bluetooth is a lightweight communication protocol, which is suitable for use as a negotiation package interaction. The WebRTC protocol is suitable for video streaming transmission. The MQTT and WebRTC protocols use Wi-Fi or cellular network protocols at the physical layer.
[0177] refer to Fig.13 , Fig.13 Provided is a dimension of interaction between a transmission module and an access networking layer of a first mobile terminal and a transmission module and an access networking layer of a second mobile terminal, and introduces a specific process in which a first mobile terminal determines a target communication mode with a second mobile terminal and performs data transmission based on the determined target communication mode, including:
[0178] S301: The first mobile terminal determines a negotiation channel based on a service type of an application and networking information of a second mobile terminal.
[0179] In this embodiment, the service types of the application include file transmission, message notification, screen sharing, video projection and playback, etc. Considering the transmission performance requirements such as transmission bandwidth required by different services, the first mobile terminal can determine the negotiation channel based on the service type and the networking information of the second mobile terminal. Exemplarily, the networking information of the second mobile terminal includes that the second mobile terminal can support communication modes such as Wi-Fi, Bluetooth, and cellular network.
[0180] If the second mobile terminal and the first mobile terminal are in a near-field network communication environment, the communication mode is determined in the order of priority of Wi-Fi, WLAN, and Bluetooth, and the negotiation channel between the first mobile terminal and the second mobile terminal can use the Wi-Fi link in the order of priority from high to low while taking into account the networking information of the second mobile terminal. Exemplarily, if the second mobile terminal and the first mobile terminal are in a far-field network communication environment, the first mobile terminal can use the MQTT negotiation channel as the negotiation channel.
[0181] S302: The transmission module of the first mobile terminal sends a request to open a negotiation channel to the access networking layer of the first mobile terminal.
[0182] S303: The access networking layer of the first mobile terminal sends a request to establish a negotiation channel to the access networking layer of the second mobile terminal.
[0183] In this embodiment, after the transmission module of the first mobile terminal determines the negotiation channel, the transmission module of the first mobile terminal can send a request to open the negotiation channel to the access networking layer of the first mobile terminal. The access networking layer of the first mobile terminal sends a request to establish a negotiation channel to the access networking layer of the second mobile terminal.
[0184] Exemplarily, if the negotiation channel uses a Wi-Fi link, the access networking layer of the first mobile terminal sends a request to the access networking layer of the second mobile terminal to establish a negotiation channel based on the Wi-Fi protocol; if the negotiation channel uses an MQTT link, the access networking layer of the first mobile terminal sends a request to the access networking layer of the second mobile terminal to establish a negotiation channel based on the MQTT protocol.
[0185] S304: The access networking layer of the second mobile terminal returns a response to the request for establishing a negotiation channel to the access networking layer of the first mobile terminal.
[0186] S305. The access networking layer of the first mobile terminal returns a response to the request to open the negotiation channel to the transmission module of the first mobile terminal.
[0187] S306: After receiving a response to the request to open the negotiation channel, the transmission module of the first mobile terminal initializes the transmission protocol stack.
[0188] In this embodiment, the transmission module of the first mobile terminal initializes the transmission protocol stack, including initializing different retransmission mechanisms corresponding to different service requirements and different data channels in the transmission protocol stack.
[0189] S307: The transmission module of the first mobile terminal sends a negotiation request to the second mobile terminal through the negotiation channel.
[0190] In this embodiment, the transmission module of the first mobile terminal uses the established negotiation channel to initiate a session-level negotiation request to the second mobile terminal. The negotiation request is used to negotiate information such as version number, service name, session key, channel type, channel identifier, heartbeat strategy, target device identifier, service priority, etc.
[0191] Optionally, after receiving the negotiation request sent by the first mobile terminal, the second mobile terminal may initialize the transmission protocol stack.
[0192] S308: The transmission module of the second mobile terminal returns a negotiation request response to the first mobile terminal through the negotiation channel.
[0193] In this embodiment, the transmission module of the second mobile terminal uses the established negotiation channel to reply to the negotiation request, and sends the information negotiated between the second mobile terminal and the first mobile terminal back to the first mobile terminal.
[0194] S309: After receiving the negotiation request response, the first mobile terminal determines a data channel based on the service type of the application and the networking status of the second mobile terminal.
[0195] Considering the transmission performance requirements such as transmission bandwidth required by different services, the first mobile terminal can determine the data channel based on the service type and the networking information of the second mobile terminal. Exemplarily, the networking information of the second mobile terminal includes that the second mobile terminal can support communication modes such as Wi-Fi, Bluetooth, and cellular networks.
[0196] If the second mobile terminal and the first mobile terminal are in a near-field network communication environment, the communication mode is determined in the order of priority of Wi-Fi, WLAN, and Bluetooth, and the first mobile terminal and the second mobile terminal use a data channel based on the Wi-Fi protocol in the order of priority from high to low while taking into account the networking information of the second mobile terminal. For example, if the second mobile terminal and the first mobile terminal are in a far-field network communication environment, the first mobile terminal can use a data channel based on the WebRTC protocol.
[0197] S310. The transmission module of the first mobile terminal sends a request to open a data channel to the access networking layer of the first mobile terminal.
[0198] S311. The access networking layer of the first mobile terminal sends a request to establish a data channel to the access networking layer of the second mobile terminal.
[0199] S312: The second mobile terminal establishes a data channel with the first mobile terminal, and the second mobile terminal returns a data channel establishment success response to the first mobile terminal.
[0200] Optionally, the access networking layer of the second mobile terminal may also synchronize a data channel establishment success response to the transmission module of the second mobile terminal.
[0201] S313: When the service sends data, the first mobile terminal sends a transmission protocol stack negotiation request to the second mobile terminal through the established data channel.
[0202] The transmission protocol stack negotiation request is used to request the second mobile terminal to perform data transmission based on the negotiated key.
[0203] S314: The second mobile terminal returns a response to the transmission protocol stack negotiation request to the first mobile terminal through the data channel.
[0204] S315. The first mobile terminal transmits service data to the second mobile terminal via the data channel.
[0205] S316. During the process of business data transmission between the first mobile terminal and the second mobile terminal, the first mobile terminal may detect and retransmit packet loss in data transmission through a retransmission mechanism initialized by a transmission protocol stack in a transmission module.
[0206] Correspondingly, the transmission protocol stack in the transmission module of the second mobile terminal can also detect and retransmit packet loss in data transmission based on the retransmission mechanism.
[0207] S317: After the service data transmission is completed, the first mobile terminal sends a data channel closing request to the second mobile terminal through the data channel.
[0208] In the embodiment of the present application, in the process of determining the communication mode with the second mobile terminal, the first mobile terminal may adopt different protocols for data transmission at the transport layer of the TCP / IP protocol based on the network quality and communication bandwidth of different links.
[0209] For example, when the data channel uses a Wi-Fi link, the UDP protocol can be used for data transmission; when the data channel uses a Bluetooth link, the Bluetooth-specific logical link control and adaptation protocol (L2CAP) protocol can be used for data transmission; when the data channel uses an MQTT link, the TCP protocol can be used for data transmission; when the data channel uses WebRTC, the TCP or UDP protocol can be used for data transmission, and so on.
[0210] Among them, the TCP protocol is a reliable protocol, and its own retransmission mechanism can realize packet loss detection and retransmission during data transmission. The UDP protocol is an unreliable protocol, and it does not have its own retransmission mechanism. In the data transmission method of this embodiment, the first mobile terminal uses the UDP protocol for data transmission in the process of determining the target communication method. In order to further reduce the packet loss rate of data transmission using the UDP protocol and ensure the effectiveness of data transmission; in the embodiment of the present application, the first mobile terminal can adopt different congestion control and retransmission mechanisms according to different business needs and different data channels to ensure the transmission reliability during data transmission.
[0211] In this embodiment, when the first mobile terminal uses the UDP protocol to transmit data with the second mobile terminal, the transmission module of the first mobile terminal can add an ACK mechanism based on the transmission based on the UDP protocol. The second mobile terminal determines the response time interval according to the amount of message data, and periodically sends the packet receiving status to the first mobile terminal through the ACK packet. The first mobile terminal retransmits the failed packet according to the content of the ACK packet. If the first mobile terminal has not received the ACK packet from the second mobile terminal after the preset timeout period, it will actively initiate retransmission.
[0212] For example, Fig.14 A schematic diagram of a retransmission mechanism in a first mobile terminal during data transmission between a first mobile terminal and a second mobile terminal is given, referring to Fig.14 The first mobile terminal sends a data sequence 3 to the second mobile terminal and starts a timer to count a preset response time. For example, the preset timeout time may be a response time interval of N ACKs. Fig.14 In the example, the first packet sent by the first mobile terminal to the second mobile terminal is data sequence 3. The second mobile terminal receives data sequence 3, determines that the first packet (data sequence 1 and data sequence 2) is lost, and writes the packets that need to be retransmitted (data sequence 1 and data sequence 2) into the retransmission linked list.
[0213] After the first mobile terminal sends data sequence 3 to the second mobile terminal, the first mobile terminal sends data sequence 5 to the second mobile terminal; the second mobile terminal receives data sequence 5, determines that there is a lost packet (data sequence 4), and writes the packet that needs to be retransmitted (data sequence 4) into the retransmission linked list.
[0214] After the first mobile terminal sends data sequence 5 to the second mobile terminal, the first mobile terminal sends data sequence 6 to the second mobile terminal.
[0215] At this time, the packets received by the second mobile terminal include data sequence 3, data sequence 5 and data sequence 6.
[0216] When data sequence 6 is received, based on the preset response time, the ACK timer of the second mobile terminal reaches the response time, and the second mobile terminal returns an ACK packet to the first mobile terminal. The ACK packet includes a retransmission linked list, and the retransmission linked list includes the lost packets determined by the second mobile terminal, that is, data sequence 1, data sequence 2, and data sequence 4. The ACK packet is used to instruct the first mobile terminal to retransmit the data sequence.
[0217] Although the timer of the first mobile terminal has not reached the preset timeout period, when the first mobile terminal receives the ACK packet returned by the second mobile terminal, the first mobile terminal resends data sequence 1, data sequence 2, and data sequence 4 to the second mobile terminal according to the information in the retransmission linked list carried in the ACK packet. At the same time, the first mobile terminal refreshes the timer and performs a new round of timing of the preset timeout period.
[0218] During the process of retransmitting data sequence 1, data sequence 2 and data sequence 4, the ACK timer of the second mobile terminal reaches the response time again based on the preset response time, and the second mobile terminal returns an ACK packet to the first mobile terminal. During the process of receiving data sequence 1, data sequence 2 and data sequence 4, the second mobile terminal did not detect the lost packet, so the retransmission linked list is empty, and there is no new data sequence update at present. The ACK packet returned by the second mobile terminal to the first mobile terminal does not include the retransmission linked list. At this time, the ACK packet is used to instruct the first mobile terminal to retransmit the message. The message here refers to the sequence message corresponding to the data sequence k.
[0219] The first mobile terminal receives the ACK packet, which does not carry the retransmission linked list, and the first mobile terminal continues to send data sequence 7 to the second mobile terminal.
[0220] Optionally, if the second mobile terminal does not return an ACK packet to the first mobile terminal when the ACK timer arrives, for example, the second mobile terminal does not return an ACK packet to the first mobile terminal after receiving data sequence 6. The preset timeout event of the first mobile terminal is 1 ACK response time. When the timer of the first mobile terminal reaches 1 ACK response time and the ACK packet of the second mobile terminal is not received, the first mobile terminal initiates an active retransmission operation, actively detects packet loss, and resends the lost data sequence 1, data sequence 2, and data sequence to the second mobile terminal.
[0221] Optionally, if the first mobile terminal and the second mobile terminal are in a far-field network communication environment, the first mobile terminal communicates with the second mobile terminal based on the TCP protocol. Due to the transmission reliability of the TCP protocol, the first mobile terminal can encapsulate the data packet header without adding retransmission logic.
[0222] In this embodiment, the main body used to execute different business requirements and adopt different congestion control and retransmission mechanisms for different data channels can be the transmission module of the first mobile terminal. The transmission module can initialize different retransmission mechanisms corresponding to different business requirements and different data channels into the transmission protocol stack, so that data transmission can be performed based on the corresponding retransmission mechanism after the transmission module of the first mobile terminal determines the data channel.
[0223] In this embodiment, even if the unreliable UDP protocol is used for data transmission between the first mobile terminal and the second mobile terminal, the first mobile terminal and the second mobile terminal can still perform packet loss detection and retransmission operations during data transmission based on the retransmission mechanism set in this embodiment, which can avoid the situation where the whole packet or transmission message is lost during data transmission between the first mobile terminal and the second mobile terminal. Data transmission reliability can be guaranteed whether the first mobile terminal and the second mobile terminal communicate based on the TCP protocol or the UDP protocol.
[0224] Fig.15 A possible structural diagram of the mobile terminal involved in the above embodiments is shown. Fig.15 The mobile terminal 1000 shown includes a processor 1001 , a communication module 1002 , and a storage module 1003 .
[0225] Among them, the processor 1001 can be a central processing unit (CPU), a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The processor may include an application processor and a baseband processor. It can implement or execute various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor may also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a DSP and a microprocessor, and the like. The storage module 1003 may be a memory.
[0226] For example, the processor 1001 may be Figure 5 The processor 310 shown; it may also be Figure 7 The communication module 1002 may be as follows: Figure 5 The wireless communication module 360 shown in FIG. 100; the storage module 1003 may be as follows Figure 5The internal memory 321 shown. The mobile terminal provided in the embodiment of the present application can be Figure 5 The mobile terminal 100 is shown.
[0227] The present application also provides a chip system (eg, a system on a chip (SoC)), such as Fig.16 As shown, the chip system includes at least one processor 701 and at least one interface circuit 702. The processor 701 and the interface circuit 702 can be interconnected via lines. For example, the interface circuit 702 can be used to receive signals from other devices (such as a memory of a mobile terminal). For another example, the interface circuit 702 can be used to send signals to other devices (such as a processor 701 or a camera of a mobile terminal). Exemplarily, the interface circuit 702 can read instructions stored in the memory and send the instructions to the processor 701. When the instruction is executed by the processor 701, the mobile terminal can execute the various steps in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in the embodiments of the present application.
[0228] An embodiment of the present application also provides a computer-readable storage medium, which includes computer instructions. When the computer instructions are executed on the above-mentioned mobile terminal, the mobile terminal executes each function or step executed by the mobile terminal 100 in the above-mentioned method embodiment.
[0229] The embodiment of the present application further provides a computer program product, which, when executed on a computer, enables the computer to execute the functions or steps executed by the mobile terminal 100 in the above method embodiment. For example, the computer may be the above mobile terminal 100.
[0230] Through the description of the above implementation methods, technical personnel in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0231] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0232] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0233] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0234] If the 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 readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0235] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present application shall be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A data transmission method, characterized in that: Applied to a mobile terminal, the mobile terminal includes a first mobile terminal and a second mobile terminal, the first mobile terminal and the second mobile terminal are devices belonging to the same device account / system account; The first mobile terminal and the second mobile terminal both include communication middleware, and the communication middleware is used to provide a unified interface for multiple applications of the mobile terminal to process data; the method includes: The communication middleware of the first mobile terminal obtains the identifier of the second mobile terminal carried in the session request in response to the session request initiated by the first application of the first mobile terminal; The first mobile terminal acquires a networking mode of the second mobile terminal based on the identifier of the second mobile terminal; the networking mode includes a far-field networking mode and a far-field networking mode; If the networking mode of the second mobile terminal is a far-field networking mode, the first mobile terminal transmits data of the first application with the second mobile terminal through a first communication mode; If the networking mode of the second mobile terminal is a near field networking mode, the first mobile terminal transmits data of the first application with the second mobile terminal through a second communication mode; The first communication mode is a communication mode corresponding to a far-field communication environment, the second communication mode is a communication mode corresponding to a near-field communication environment, and a communication distance of the first communication mode is greater than a communication distance of the second communication mode.
2. The method according to claim 1, characterized in that: The first communication mode includes a plurality of communication modes, different communication modes correspond to different priorities, and the first mobile terminal transmits data of the first application with the second mobile terminal through the first communication mode, including: The first mobile terminal transmits data of the first application with the second mobile terminal through the communication mode with the highest priority among the first communication modes; Wherein, the first communication mode includes wireless local area network WLAN and cellular network technology.
3. The method according to claim 1, characterized in that The second communication mode includes a plurality of communication modes, different communication modes correspond to different priorities, and the first mobile terminal transmits data of the first application with the second mobile terminal through the second communication mode, including: The first mobile terminal transmits data of the first application with the second mobile terminal through the communication mode with the highest priority among the second communication modes; The second communication method includes wireless local area network WLAN, Bluetooth and ZigBee technology.
4. The method according to any one of claims 1 to 3, characterized in that The first mobile terminal performs data transmission of the first application with the second mobile terminal through a first communication mode, including: The first mobile terminal determines a negotiation channel corresponding to the first communication mode; the negotiation channel is used to negotiate the exchange of a session key between the first mobile terminal and the second mobile terminal; the negotiation channel includes a negotiation channel of a WLAN protocol and a negotiation channel based on a message queue telemetry transmission MQTT protocol; as well as, The first mobile terminal determines a data channel corresponding to the first communication mode; the data channel is used for data transmission of applications between the first mobile terminal and the second mobile terminal; the data channel includes a negotiation channel based on the WLAN protocol and a data channel based on the web real-time communication WebRTC protocol.
5. The method according to any one of claims 1 to 3, characterized in that: The first mobile terminal performs data transmission of the first application with the second mobile terminal through the second communication mode, including: The first mobile terminal determines a negotiation channel corresponding to the second communication mode; the negotiation channel is used to negotiate the exchange of session keys between the first mobile terminal and the second mobile terminal; the negotiation channel includes a negotiation channel based on a WLAN protocol and a negotiation channel based on a Bluetooth protocol; as well as, The first mobile terminal determines a data channel corresponding to the second communication mode; the data channel is used for data transmission of applications between the first mobile terminal and the second mobile terminal; the data channel includes a negotiation channel based on the WLAN protocol and a data channel based on the Bluetooth protocol.
6. The method according to any one of claims 1 to 5, characterized in that The method further comprises: The first mobile terminal performs an initialization operation of a transmission protocol stack; the transmission protocol stack includes a correspondence between different communication modes and retransmission mechanisms during data transmission.
7. The method according to claim 6, characterized in that The second communication mode uses a User Datagram Protocol (UDP) protocol for data transmission, and the retransmission mechanism corresponding to the second communication mode includes: If the first mobile terminal receives a response packet returned by the second mobile terminal in response to a preset response interval, and the response packet includes a retransmission linked list, the first mobile terminal retransmits the data sequence corresponding to the data sequence identifier to be retransmitted carried in the retransmission linked list to the second mobile terminal; If the first mobile terminal does not receive the response packet returned by the second mobile terminal when the preset timeout interval arrives, the first mobile terminal obtains the data sequence to be retransmitted, and retransmits the data sequence to be retransmitted to the second mobile terminal.
8. The method according to claim 7, characterized in that The method further comprises: If the first mobile terminal receives a response packet returned by the second mobile terminal in response to a preset response interval, and the response packet does not include the retransmission linked list, the first mobile terminal retransmits sequence information corresponding to the current data sequence to the second mobile terminal.
9. A mobile terminal, characterized in that: The mobile terminal includes a communication middleware, a communication module, and an application module; the mobile terminal transmits data with other devices through the communication middleware; the other devices and the mobile terminal are devices belonging to the same device account / system account; the communication module supports a first communication mode in a far-field communication environment and a second communication mode in a near-field communication environment; the communication distance of the first communication mode is greater than the communication distance of the second communication mode; The communication middleware of the mobile terminal responds to the session request initiated by the application module and obtains the identifier of the other device carried in the session request; The communication middleware obtains the networking mode of the other device based on the identifier of the other device; the networking mode includes a far-field networking mode and a far-field networking mode; If the networking mode of the other device is a far-field networking mode, the mobile terminal transmits application data of the application module with the other device through the first communication mode; If the networking mode of the other device is a near field networking mode, the mobile terminal transmits application data of the application module with the other device through a second communication mode; The first communication mode is a communication mode corresponding to a far-field communication environment, the second communication mode is a communication mode corresponding to a near-field communication environment, and a communication distance of the first communication mode is greater than a communication distance of the second communication mode.
10. The mobile terminal according to claim 9, characterized in that: The communication middleware includes a transmission module and a networking module; The transmission module obtains the identifier of the other device carried in the session request in response to the session request initiated by the application module; The transmission module sends the identifier of the other device to the networking module; The networking module obtains the networking modes of the other devices and returns the networking modes of the other devices to the transmission module; The transmission module transmits the application data of the application module with the other device through the first communication mode or the second communication mode.
11. The mobile terminal according to claim 10, characterized in that: The transmission module includes a transmission protocol stack; The transmission protocol stack deploys the correspondence between different communication modes and retransmission mechanisms during data transmission; The transmission module is used to determine a retransmission mechanism corresponding to the first communication mode or the second communication mode from the transmission protocol stack, and based on the corresponding retransmission mechanism, perform application data transmission of the application module with the other device.
12. The mobile terminal according to claim 10, characterized in that: The transmission module includes a unified operation set; The unified operation set provides multiple interfaces for different communication modes; the multiple interfaces include establishing a connection interface, closing a connection interface, sending data interface, and receiving data interface; The transmission module transmits the application data of the application module to the other device based on an interface corresponding to the first communication mode or the second communication mode.
13. The mobile terminal according to claim 10, characterized in that: The transmission module includes a sending unit; The sending unit is used to send the data carried in the session request to the quality server for data quality QOS management analysis.
14. A mobile terminal, characterized in that: The mobile terminal includes a memory, a communication module and one or more processors; the memory and the communication module are coupled to the processor; the memory stores computer program code, the computer program code includes computer instructions, and when the computer instructions are executed by the processor, the mobile terminal executes the method as described in any one of claims 1-8.
15. A computer-readable storage medium, characterized in that: The method comprises computer instructions, and when the computer instructions are executed on a mobile terminal, the mobile terminal is caused to execute the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for wireless communication between communication terminals
CN104301857A
Cross-device data sharing method and related device
CN114356870A
Connection establishment method, and terminal apparatus
WO2021098533A1
Cited By
Large file transmission system based on low-broadband scene of mobile terminal
CN121262205A