A transmission method and related apparatus
By establishing a connection between a smart wearable device and a second device with a communication protocol, and utilizing the protocol stack of the second device to obtain network resources, the network access problem caused by hardware limitations is solved, and memory and power consumption are saved.
Patent Information
- Application Number
- CN202210872519.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-20
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2042-07-20
AI Technical Summary
Some smart wearable devices, due to hardware limitations such as lack of a mobile communication module or small memory capacity, cannot achieve independent internet access, thus preventing them from accessing network resources.
By establishing a communication connection between the first electronic device and the second electronic device, and using the protocol stack of the second electronic device to obtain data from the third electronic device, the first electronic device does not need to have the same protocol stack built in, thus saving memory resources and reducing the power consumption of protocol encapsulation and parsing.
This technology enables smart wearable devices to access network resources through a second electronic device, saving memory and power consumption and expanding the device's network access capabilities.
Smart Images

Figure CN117478760B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terminal, and in particular to a transmission method and related device. BACKGROUND
[0002] With the development of science and technology, smart wearable devices are becoming more and more popular. However, due to the hardware limitations of some smart wearable devices, for example, without a mobile communication module, or with small memory capacity, etc. This part of the smart wearable devices cannot realize independent online function. Therefore, how this part of the smart wearable devices accesses network resources becomes a problem to be solved. SUMMARY
[0003] The present application provides a transmission method and related device, which realizes that the first electronic device can obtain a first data structure based on first data of a first application, the first data includes an address parameter, and the first data structure includes an address field carrying the address parameter. The first electronic device sends the first data structure to a second electronic device. The second electronic device can parse the first data structure to obtain the first data. The second electronic device can obtain second data from a third electronic device corresponding to the address parameter based on the first data. The second electronic device can obtain a second data structure based on the second data and send the second data structure to the first electronic device, and the second data structure includes the second data. The first electronic device can obtain second data provided to the first application based on the second data structure. In this way, the first electronic device and the second electronic device establish a communication connection, and the first electronic device can obtain data of the third electronic device through the second electronic device. Since the second electronic device needs to obtain data from the third electronic device through the protocol stack built-in the second electronic device, the first electronic device obtains data through the second electronic device, and the first electronic device can no longer build-in the protocol stack same as the protocol stack of the second electronic device, saving memory resources. And, since the first electronic device does not need to perform protocol encapsulation and parsing, device power consumption is saved.
[0004] In a first aspect, the present application provides a transmission method, comprising:
[0005] The first electronic device obtains first data of a first application, and the first data includes a first address parameter. The first electronic device obtains a first data structure based on the first data, and the first data structure includes a first address field carrying the first address parameter. The first electronic device sends the first data structure to a second electronic device.
[0006] After receiving the first data structure, the second electronic device obtains the first data based on the first data structure; based on the first data, the second electronic device obtains the second data from the third electronic device corresponding to the first address parameter; based on the second data, the second electronic device obtains the second data structure, which includes the second data; the second electronic device sends the second data structure to the first electronic device.
[0007] The first electronic device parses the second data structure to obtain the second data, which is then provided to the first application.
[0008] In this way, the first electronic device does not establish a communication connection with the third electronic device, and the first electronic device can send / receive data to the third electronic device through the second electronic device. The first electronic device can use the transmission method provided in this application to encapsulate the data to be sent to the third electronic device based on the communication protocol of the second electronic device, and parse the data from the third electronic device.
[0009] In one possible implementation, the first data further includes a filename parameter; the method further includes: a first electronic device determining the value of the filename field of the first data structure based on the filename parameter, the filename field being used to indicate the file to which the second data belongs. In this way, the second electronic device can determine the filename of the file to which the second data belongs through the filename parameter, facilitating the second electronic device's acquisition of the second data.
[0010] In one possible implementation, the first data structure further includes an application identifier field, the value of which is an identifier of the first application; the second data structure also includes an application identifier field. Thus, when multiple applications obtain data from other electronic devices through the second electronic device, the specific application to which the data should be sent can be determined based on the application identifier field.
[0011] In one possible implementation, the second electronic device obtains second data from the third electronic device corresponding to the first address parameter based on the first data. Specifically, the second electronic device encapsulates the first data into a request message of a first communication protocol and sends the request message to the third electronic device to obtain the second data. In this way, the first electronic device can obtain the second data from the third electronic device by encapsulating the first data with the second electronic device.
[0012] In one possible implementation, the first communication protocol is an application layer protocol, such as Hypertext Transfer Protocol or Simple Text Transfer Protocol. In this way, the first electronic device may not store the application layer protocol or process the first data through it.
[0013] In one possible implementation, the first address parameter is a Uniform Resource Locator (URL) parameter, and the first communication protocol is Hypertext Transfer Protocol (HTTP); or, the first address parameter is an Internet Protocol (IP) parameter, and the first communication protocol is Simple Text Transfer Protocol (SMT).
[0014] In one possible implementation, the first data structure further includes a protocol identifier field. The value of the protocol identifier field indicates that the first communication protocol is Hypertext Transfer Protocol (HTTP) or Simple Text Transfer Protocol (STP). Thus, the second electronic device can determine whether the value of the first address field is a URL or an IP address based on the value of the protocol identifier field. The second electronic device can also determine the communication protocol used and the interface used to invoke the protocol stack based on the value of the protocol identifier field.
[0015] In one possible implementation, the first electronic device does not support the first communication protocol. Thus, because the first electronic device does not support the first communication protocol, it cannot communicate with the third electronic device using the first communication protocol. However, since the first electronic device can communicate with the second electronic device using supported communication protocols, and the second electronic device supports the first communication protocol, the first electronic device can communicate with the third electronic device using the second electronic device's first communication protocol. It is understood that even if the first electronic device only sets up one communication protocol for communicating with the second electronic device, it can still use multiple communication protocols of the second electronic device to send / receive data to the third electronic device.
[0016] In one possible implementation, the method further includes: the second electronic device storing the first data structure and the second data, and when the second electronic device receives another data structure identical to the first data structure from the first electronic device, it directly sends the second data to the first electronic device; or,
[0017] The second electronic device stores the first data and the second data, and when the second electronic device receives the same data as the first electronic device again, it directly sends the second data to the first electronic device.
[0018] In this way, the second electronic device can store the second data. When the first electronic device requests the stored second data, it can send the stored second data directly to the first electronic device without having to obtain the second data from the third electronic device, thus shortening the response time and saving the power consumption generated by requesting data.
[0019] In one possible implementation, the method further includes: before the first electronic device sends the first data structure to the second electronic device, the first electronic device establishes a communication connection with the second electronic device;
[0020] The first electronic device sends the first data structure to the second electronic device, specifically including:
[0021] The first electronic device sends the first data structure to the second electronic device via a communication connection.
[0022] In one possible implementation, the second electronic device sends the second data structure to the first electronic device, specifically including: the second electronic device sending it to the first electronic device via a communication connection.
[0023] In this way, data can be transmitted between the first electronic device and the second electronic device through this communication connection.
[0024] In one possible implementation, the method further includes: a first electronic device acquiring third data from a first application, the third data including a second address parameter and a file body parameter; the first electronic device obtaining a third data structure based on the third data, the third data structure including a second address field and a file body field, the second address field carrying the second address parameter and the file body field carrying the file body parameter; and the first electronic device sending the third data structure to a second electronic device.
[0025] After receiving the third data structure, the second electronic device obtains the third data based on the third data structure; based on the third data, the second electronic device sends the value of the file body parameter to the third electronic device corresponding to the second address parameter.
[0026] In this way, the first electronic device can send the value of the file body parameter to the third electronic device through the second electronic device, and the first electronic device and the third electronic device do not need to establish a communication connection.
[0027] In one possible implementation, after sending the value of the file body parameter to the third electronic device, the method further includes: the second electronic device receiving fourth data sent by the third electronic device, the fourth data being used to indicate the reception status of the value of the file body parameter by the third electronic device; the second electronic device obtaining a fourth data structure based on the fourth data, the fourth data structure including the fourth data; and the second electronic device sending the fourth data structure to the first electronic device.
[0028] The first electronic device parses the fourth data structure to obtain the fourth data, which is then provided to the first application.
[0029] In this way, the first application can obtain the reception status of the file body parameters received by the third electronic device through the fourth data.
[0030] In one possible implementation, the first data includes a first method parameter, and the third data includes a second method parameter; the method further includes: a first electronic device determining the value of a first method field of a first data structure based on the first method parameter, the first method field being used to instruct a second electronic device to obtain the second data from a third electronic device;
[0031] The first electronic device determines the value of the second method field of the third data structure based on the second method parameters. The second method field is used to instruct the second electronic device to send the value of the file body parameters to the third electronic device.
[0032] In this way, the second electronic device can determine whether to obtain data from the third electronic device based on the first method parameters, and determine whether to send data to the third electronic device based on the second method parameters.
[0033] In one possible implementation, the first electronic device includes a transmission module; the first electronic device obtains a first data structure based on the first data, specifically including: the first electronic device processes the first data through the transmission module to obtain the first data structure.
[0034] In one possible implementation, the second electronic device includes a second application for controlling the first electronic device; the second electronic device obtains a second data structure based on the second data, specifically including: the second electronic device processes the second data through the second application to obtain the second data structure.
[0035] In one possible implementation, the first electronic device is a smartwatch, and the second application is a sports and health application.
[0036] In this way, a second electronic device with a second application installed can help the first electronic device obtain data from a third electronic device, or help the first electronic device transmit data to a third electronic device.
[0037] In one possible implementation, the first data format and the second data format conform to the Type-Length-Value (TLV) encoding scheme. This allows the first and second electronic devices to easily add, delete, modify, and search fields within the first and second data formats, since the TLV encoding scheme can describe multiple data types.
[0038] In one possible implementation, the first electronic device further includes a third application; before the first electronic device obtains the first data structure based on the first data of the first application, the method further includes: the transmission module of the first electronic device receives the first data of the first application and the fifth data of the third application, wherein the third application has a higher priority than the first application; the first electronic device obtains the fifth data structure based on the fifth data and sends the fifth data structure to the second electronic device. Thus, the first electronic device can, based on application priority, prioritize processing the fifth data of the third application (which has a higher priority) to obtain the fifth data structure and send the fifth data structure to the second electronic device, and then process the first data of the first application (which has a lower priority than the third application) to obtain the first data structure and send it to the second electronic device.
[0039] In one possible implementation, the first electronic device further includes a third application. The transmission module of the first electronic device provides multiple interfaces, including a first interface and a second interface, where the second interface has a higher priority than the first interface. Before the first electronic device obtains a first data structure based on the first data from the first application, the method further includes: the transmission module of the first electronic device simultaneously receiving operations from both the first application and the third application calling the second interface; the first electronic device obtains a fifth data packet based on the fifth data from the third application and sends the fifth data packet to the second electronic device via a first communication connection. In this way, the first electronic device can assign different priorities to different interfaces, determining the data processing order of different applications based on the interfaces called by different applications.
[0040] In one possible implementation, the method is characterized in that, before the first electronic device obtains the first data structure based on the first data of the first application, the method further includes: the transmission module of the first electronic device simultaneously receives operations from the first application and the third application calling the first interface; the transmission module of the first electronic device stores m recently received data, the m data including the fifth data of the third application, and the m data not including the first data; the first electronic device obtains the fifth data packet based on the fifth data of the third application, and sends the fifth data packet to the second electronic device through the first communication connection.
[0041] In one possible implementation, the first electronic device processes the first data through a first preset interface to obtain a first data structure, and the second electronic device processes the first data through a second preset interface to obtain a request message. The first preset interface and the second preset interface are the same.
[0042] In some examples, the first preset interface and the second preset interface are identical, specifically including: the first preset interface and the second preset interface have the same identifier, and the first preset interface and the second preset interface receive the same parameters. In this way, the second electronic device can obtain the parameters required by the second preset interface from the first data structure.
[0043] Secondly, this application provides another transmission method, comprising: a first electronic device acquiring first data of a first application, the first data including a first address parameter; the first electronic device obtaining a first data structure based on the first data, the first data structure including a first address field carrying the first address parameter; the first electronic device sending the first data structure to a second electronic device, the first data carried in the first data structure being used by the second electronic device to obtain second data from a third electronic device corresponding to the first address parameter; the first electronic device receiving a second data structure including the second data from the second electronic device; the first electronic device parsing the second data structure to obtain the second data, the second data being used to provide to the first application. In this way, the first electronic device can obtain the first data structure to transmit the first data to the second electronic device, and obtain the second data through the first data structure.
[0044] In one possible implementation, the first data further includes a filename parameter; the method further includes: a first electronic device determining the value of the filename field of the first data structure based on the filename parameter, the filename field being used to indicate the file to which the second data belongs.
[0045] In one possible implementation, the first data structure also includes an application identifier field, the value of which is an identifier of the first application.
[0046] In one possible implementation, the first data structure further includes a protocol identifier field. The value of the protocol identifier field indicates that the first communication protocol is Hypertext Transfer Protocol (HTTP) or Simple Text Transfer Protocol (STP). Thus, the second electronic device can determine whether the value of the first address field is a URL or an IP address based on the value of the protocol identifier field. The second electronic device can also determine the communication protocol used and the interface used to invoke the protocol stack based on the value of the protocol identifier field.
[0047] In one possible implementation, the method further includes: before the first electronic device sends the first data structure to the second electronic device, the first electronic device establishes a communication connection with the second electronic device;
[0048] The first electronic device sends the first data structure to the second electronic device, specifically including: the first electronic device sending the first data structure to the second electronic device through a communication connection.
[0049] In one possible implementation, the first electronic device obtains third data from the first application, the third data including a second address parameter and a file body parameter; the first electronic device obtains a third data structure based on the third data, the third data structure including a third address field and a file body field, the third address field carrying the third address parameter, and the file body field carrying the file body parameter; the first electronic device sends the third data structure to the second electronic device, the third data carried in the third data structure being used by the second electronic device to send the value of the file body parameter to the third electronic device corresponding to the second address parameter.
[0050] In one possible implementation, after the first electronic device sends the third data structure to the second electronic device, the method further includes: the first electronic device receiving a fourth data structure from the second electronic device, the fourth data structure including fourth data, the fourth data being used to indicate the reception status of the file body parameter values received by the third electronic device; the first electronic device parsing the fourth data structure to obtain the fourth data, the fourth data being used to provide to the first application.
[0051] In one possible implementation, the first data includes a first method parameter, and the third data includes a second method parameter; the method further includes: a first electronic device determining the value of a first method field of a first data structure based on the first method parameter, the first method field being used to instruct a second electronic device to obtain second data from a third electronic device; and the first electronic device determining the value of a second method field of a third data structure based on the second method parameter, the second method field being used to instruct the second electronic device to send the value of a file body parameter to the third electronic device.
[0052] Thirdly, this application provides another transmission method, comprising: a second electronic device receiving a first data structure from a first electronic device, the first data structure including a first address field carrying a first address parameter of first data of a first application; the second electronic device acquiring first data based on the first data structure; the second electronic device acquiring second data from a third electronic device corresponding to the first address parameter based on the first data; the second electronic device obtaining a second data structure based on the second data, the second data structure including second data, the second data being provided to the first application; and the second electronic device sending the second data structure to the first electronic device. In this way, the second electronic device can acquire the first data based on the first data structure of the first electronic device, then acquire the second data from the third electronic device through the first data, and return the second data to the first electronic device, thus helping the first electronic device send the first data to the third electronic device and simultaneously helping the first electronic device acquire data from the third electronic device.
[0053] In one possible implementation, the second electronic device obtains the second data from the third electronic device corresponding to the first address parameter based on the first data. Specifically, the second electronic device encapsulates the first data into a request message of the first communication protocol and sends the request message to the third electronic device to obtain the second data. The first electronic device does not support the first communication protocol.
[0054] In one possible implementation, the first communication protocol is an application layer protocol, which includes Hypertext Transfer Protocol and Simple Text Transfer Protocol.
[0055] In one possible implementation, the first address parameter is a Uniform Resource Locator (URL) parameter, and the first communication protocol is Hypertext Transfer Protocol (HTTP); or, the first address parameter is an Internet Protocol (IP) parameter, and the first communication protocol is Simple Text Transfer Protocol (SMT).
[0056] In one possible implementation, the first data structure further includes a protocol identifier field. The value of the protocol identifier field indicates that the first communication protocol is Hypertext Transfer Protocol (HTTP) or Simple Text Transfer Protocol (STP). Thus, the second electronic device can determine whether the value of the first address field is a URL or an IP address based on the value of the protocol identifier field. The second electronic device can also determine the communication protocol used and the interface used to invoke the protocol stack based on the value of the protocol identifier field.
[0057] In one possible implementation, the method further includes: the second electronic device storing the first data structure and the second data, and when the second electronic device receives a data structure identical to the first data structure from the first electronic device again, directly sending the second data to the first electronic device; or, the second electronic device storing the first data and the second data, and when the second electronic device receives data identical to the first data from the first electronic device again, directly sending the second data to the first electronic device.
[0058] Fourthly, this application provides an electronic device including one or more processors and one or more memories. The one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, including computer instructions, which, when executed by the one or more processors, cause the electronic device to perform the transmission method in any of the possible implementations of the second or third aspect described above.
[0059] Fifthly, this application provides a chip system applied to an electronic device. The chip system includes one or more processors, which are used to invoke computer instructions to cause the electronic device to perform the transmission method in any possible implementation of the second or third aspect described above.
[0060] In a sixth aspect, embodiments of this application provide a computer storage medium including computer instructions that, when executed on an electronic device, cause the electronic device to perform the transmission method in any of the possible implementations of the second or third aspect described above.
[0061] In a seventh aspect, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to execute the transmission method in any of the possible implementations of the second or third aspect described above. Attached Figure Description
[0062] Figure 1 A schematic diagram of a communication system provided in an embodiment of this application;
[0063] Figure 2 A flowchart is provided for an embodiment of this application;
[0064] Figure 3 A schematic diagram of a system architecture provided for an embodiment of this application;
[0065] Figure 4 A schematic flowchart illustrating a transmission method provided in an embodiment of this application;
[0066] Figure 5A This is a schematic diagram of an application scenario provided by an embodiment of this application;
[0067] Figure 5B This is a schematic diagram of a first data structure provided in an embodiment of this application;
[0068] Figure 5C This is a schematic diagram of a second data structure provided in an embodiment of this application;
[0069] Figure 6A This is a schematic diagram illustrating another application scenario provided by an embodiment of this application;
[0070] Figure 6B This is a schematic diagram of another first data structure provided in an embodiment of this application;
[0071] Figure 6C This is a schematic diagram of another second data structure provided in an embodiment of this application;
[0072] Figure 7 This is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application;
[0073] Figure 8 This is a schematic diagram of the hardware structure of an electronic device 200 provided in an embodiment of this application. Detailed Implementation
[0074] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; the word "and / or" in the text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone.
[0075] Hereinafter, the terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature, and in the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.
[0076] The following describes a communication system provided by an embodiment of this application.
[0077] like Figure 1 As shown, the communication system 10 may include, but is not limited to, electronic device 100, electronic device 200, and cloud server 300. Electronic device 100 and electronic device 200 establish a first communication connection (also referred to as a first connection). Electronic device 100 can establish the first connection with electronic device 200 via wireless communication methods, such as Bluetooth, Near Field Communication (NFC), etc. In some examples, when the first communication connection is a Bluetooth connection, electronic device 100 can provide one or more Bluetooth communication solutions, including Basic Rate / Enhanced Data Rate (BR / EDR) or Bluetooth Low Energy (BLE). Alternatively, electronic device 100 can establish the first connection with electronic device 200 via wired communication methods, such as Universal Serial Bus (USB), Ethernet, etc. Electronic device 100 and electronic device 200 can transmit data through the first connection. Electronic device 100 and cloud server 300 establish a second communication connection (also referred to as a second connection). In some examples, the second connection is a network communication connection. The second connection can be a wired connection or a wireless connection (e.g., a Wi-Fi communication connection or a cellular communication connection). In some examples, the electronic device 100 does not support the communication protocol used by the second connection.
[0078] The descriptions of the first and second connections herein are merely illustrative, and this application does not impose any limitations on the types of communication connections or data transmission protocols between devices. The communication system 10 can implement the transmission methods provided in the embodiments of this application.
[0079] In this embodiment of the application, the electronic device 100 can be any electronic device with independent Internet access capability. For example, the electronic device 100 can be a mobile phone, tablet computer, desktop computer, laptop computer, handheld computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, as well as cellular phone, personal digital assistant (PDA), augmented reality (AR) device, virtual reality (VR) device, artificial intelligence (AI) device, wearable device, in-vehicle device, smart home device and / or smart city device, etc.
[0080] Electronic device 200 can be augmented reality device, virtual reality device, artificial intelligence device, in-vehicle device, wearable device, smart home device, etc.
[0081] To better describe the relevant embodiments of this application, it is first necessary to introduce a computer network model. Here, the embodiments of this application will use the five-layer model of Transmission Control Protocol (TCP) / Internet Protocol (IP) as an example to introduce the computer model.
[0082] The TCP / IP five-layer model comprises the application layer, transport layer, network layer, data link layer, and physical layer. The application layer defines the format of the data to be transmitted, such as message types, message type syntax, and field semantics. In other words, application layer protocols standardize the format of data transmitted between different applications, enabling them to interact with each other using a standardized format.
[0083] The transport layer is used to ensure data delivery and flow control. For example, in a scenario where electronic device A and electronic device B transmit data via the TCP protocol, the port number field in the TCP packet sent by application a on electronic device A to application b on electronic device B allows the receiving end, i.e., electronic device B, to identify the application receiving the data as application b.
[0084] In one possible implementation, electronic device 200 can encapsulate the application's request information using its built-in protocol stack to obtain a transport layer message A. Electronic device 200 then sends transport layer message A to its virtual server. Upon receiving transport layer message A, the virtual server can forward it to electronic device 100 via a first connection. Electronic device 100 can then send transport layer message A to cloud server 300 via a second connection. Cloud server 300 can parse transport layer message A to obtain the request information and retrieve stored response information based on it. Cloud server 300 can encapsulate the response information into a transport layer message B and send it to electronic device 100 via the second connection. Upon receiving transport layer message B, electronic device 100 can forward it to the virtual server of electronic device 200 via the first connection. The virtual server of electronic device 200 can then send transport layer message B to the protocol stack of electronic device 200. The protocol stack of electronic device 200 can parse transport layer message B to obtain the response information and return it to the application. In this way, electronic device 200 can transmit data with cloud server 300 through the network function of electronic device 100. Specifically, the process by which electronic device 200 obtains response information can be found in [reference needed]. Figure 2 The flowchart shown is as follows. Figure 2 As shown:
[0085] S201. Electronic device 200 generates application layer message A through the application layer protocol stack interface. Application layer message A includes request information.
[0086] Specifically, application A of electronic device 200 can send a request to cloud server 300 when it receives input from a user to access a webpage. The request information may include the URL of the webpage. Alternatively, application A of electronic device 200 can send a request to cloud server 300 when it receives input from a user to download a file. The request information may include the storage path of the file.
[0087] Application A of electronic device 100 can call the protocol stack of electronic device 100 through the application layer protocol stack interface to encapsulate the request information into an application layer message A of the application layer protocol.
[0088] S202. Electronic device 200 encapsulates application layer message A into transport layer message A through a socket and then sends it to the virtual server.
[0089] The protocol stack can encapsulate application layer message A into transport layer message A through the socket interface. If the protocol stack determines, based on the destination IP address, that transport layer message A is not a local loopback message or a LAN message, it will then send transport layer message A to the virtual server.
[0090] Specifically, the protocol stack can initiate a transport layer connection (e.g., a TCP connection) to the virtual server on a specified port number (e.g., port 80). Both the protocol stack and the virtual server have a socket associated with this connection. The protocol stack can send transport layer message A to the virtual server via its socket. The virtual server can receive transport layer message A via its socket (not shown in the diagram).
[0091] S203. The virtual server of electronic device 200 sends transport layer message A to the Bluetooth communication module of electronic device 200.
[0092] After receiving transport layer message A, the virtual server of electronic device 200 can send transport layer message A to the Bluetooth communication module of electronic device 200.
[0093] Here, since the electronic device 200 has a built-in protocol stack, after the electronic device 200 encapsulates the request information into a transport layer message, it must transmit the transport layer message through a socket. It cannot directly send the transport layer message to the electronic device 100 through the Bluetooth communication module. Therefore, the electronic device 200 needs to be equipped with a virtual server to send the transport layer message to the Bluetooth communication module of the electronic device 200.
[0094] S204. The Bluetooth communication module of electronic device 200 sends transport layer message A to the Bluetooth communication module of electronic device 100.
[0095] The Bluetooth communication module of electronic device 200 can be used to establish a communication connection with the Bluetooth communication module of electronic device 100 and transmit data to electronic device 100 through this communication connection. It should be noted that, not limited to Bluetooth connection, electronic device 100 and electronic device 200 can also transmit data via USB connection or other means.
[0096] S205. The Bluetooth communication module of electronic device 100 sends transport layer message A to the electronic device 200 control application of electronic device 100.
[0097] After receiving data (i.e., transport layer message A) from electronic device 200, the Bluetooth communication module of electronic device 100 can transmit the data from electronic device 200 to the electronic device 200 control application of electronic device 100.
[0098] For example, when electronic device 200 is a smartwatch, the control application for electronic device 200 is a smartwatch control application (e.g., a fitness and health application). When electronic device 200 is a Bluetooth headset, the control application for electronic device 200 is a Bluetooth headset control application, and so on.
[0099] S206. Electronic device 200 of electronic device 100 controls the application to send transport layer message A to cloud server 300.
[0100] After receiving the transport layer message A, the electronic device 200 of the electronic device 100 can send the transport layer message A to the cloud server 300 based on the destination IP address information of the transport layer message A and using the network function of the electronic device 100.
[0101] S207. The cloud server 300 parses transport layer message A to obtain request information, obtains response information based on the request information, and encapsulates the response information into transport layer message B.
[0102] After receiving transport layer message A from electronic device 100, cloud server 300 can use its built-in protocol stack to parse transport layer message A and obtain request information. Cloud server 300 can retrieve response information indicated by the request information from its storage. It then encapsulates the response information into application layer message B, and further encapsulates application layer message B into transport layer message B.
[0103] S208. Cloud server 300 sends transport layer message B to electronic device 200 control application of electronic device 100.
[0104] It is understandable that electronic device 100 and cloud server 300 can transmit data via TCP / IP protocol or user datagram protocol (UDP).
[0105] S209. The electronic device 200 control application of the electronic device 100 sends the transport layer message B to the Bluetooth communication module of the electronic device 100.
[0106] S210. The Bluetooth communication module of electronic device 100 sends the transport layer message B to the Bluetooth communication module of electronic device 200.
[0107] After receiving the transport layer message B, the control application of electronic device 200 of electronic device 100 can send the transport layer message B to electronic device 200 through the Bluetooth communication module of electronic device 100.
[0108] S211. The Bluetooth communication module of electronic device 200 sends transport layer message B to the virtual server of electronic device 200.
[0109] After receiving the transport layer message B, the Bluetooth communication module of electronic device 200 can send the transport layer message B to the virtual server of electronic device 200.
[0110] S212. Electronic device 200 resolves transport layer message B into application layer message B through a socket, and sends application layer message B to application A.
[0111] The virtual server can send transport layer message B to the protocol stack of electronic device 200 through the virtual server's socket (not shown in the figure). The protocol stack of electronic device 200 can receive transport layer message B through the protocol stack's socket.
[0112] The protocol stack of electronic device 200 can parse transport layer message B through socket interface to obtain application layer message B, and then upload application layer message B to application A.
[0113] S213. Electronic device 200 parses application layer message B through the application layer protocol interface to obtain response information.
[0114] The protocol stack of electronic device 100 can parse application layer message B, obtain response information, and then return the response information to application A through the application layer protocol stack interface.
[0115] In this way, electronic device 200 can obtain data from cloud server 300 through the network communication function of electronic device 100. However, since electronic device 200 needs to have a built-in protocol stack and then encapsulate and transmit messages through transport layer protocols (e.g., TCP protocol), it occupies the memory of electronic device 200, and the protocol stack consumes a lot of power for data encapsulation and parsing.
[0116] Therefore, this application provides a transmission method. Electronic device 200 can obtain a first data structure based on first data from a first application. The first data includes address parameters, and the first data structure includes an address field carrying the address parameters. Electronic device 200 can send the first data structure to electronic device 100. Electronic device 100 can parse the first data structure to obtain first data. Electronic device 100 can obtain second data from the cloud server 300 corresponding to the address parameters based on the first data. Electronic device 100 can obtain a second data structure based on the second data and send the second data structure to electronic device 200. The second data structure includes the second data. Electronic device 200 can obtain the second data provided to the first application based on the second data structure.
[0117] In this way, electronic device 200 and electronic device 100 establish a communication connection, and electronic device 200 can obtain data from cloud server 300 through electronic device 100. Furthermore, since electronic device 100 needs to obtain data from cloud server 300 through its built-in protocol stack, electronic device 200 can obtain data through electronic device 100 without needing to build its own protocol stack, saving memory resources. Moreover, since electronic device 200 does not need to perform protocol encapsulation and parsing, it saves device power consumption. In some examples, if electronic device 200 does not have internet access capabilities (e.g., it does not have Wi-Fi or cellular communication capabilities), that is, if electronic device 200 does not support Wi-Fi or cellular communication protocols, electronic device 200 can still obtain internet resources through electronic device 100, which supports Wi-Fi and cellular communication protocols, based on the transmission method provided in this application embodiment.
[0118] The following is a schematic diagram of a system architecture provided by an embodiment of this application.
[0119] like Figure 3 As shown, the electronic device 200 may include, but is not limited to, the first application 301, the transmission module 302, and the communication module 303.
[0120] In this context, the first application 301 of the electronic device 200 can be an application already installed on the electronic device 200 (e.g., a browser application, a music application, etc.). After receiving the user's first input, the first application 301 can send first data to the transmission module 302 through a designated interface. The first application 301 can also receive second data returned by the transmission module 302 through the designated interface. The first data may include address parameters indicating the storage address of the second data. The second data is data from the target electronic device (e.g., a cloud server 300) indicated by the address parameters in the first data.
[0121] The first input can be an input used to trigger a first application 301 of the electronic device 200 to obtain second data based on first data. For example, if the first application 301 is a browser application, the first input can be a click input on the icon of the first application 301. After receiving the click input, the first application 301 can send the first data (i.e., the second data) used to obtain the page data of the first application 301 to the electronic device 100 through the transmission module 302. Alternatively, the first input can be a set of user operations. For example, the first input can be the input of typing a URL in the input box of the first application 301, and the input of a control that jumps to the page indicated by the URL, and the first data includes the URL. Alternatively, the first input can be the input of typing a keyword in the input box of the first application 301, and the input of a control that jumps to the page indicated by the URL and the keyword, and the first data includes the URL and the keyword. Alternatively, the first input can also be a voice command input, such as the voice command input of "search for 'computer'", and the first data can include the keyword "computer" and the URL of the search webpage.
[0122] The first input can also be the input from the first application 301 uploading data to the target electronic device (e.g., cloud server 300). Here, the first data can include data uploaded by the first application 301 to the cloud server 300. For example, the first data can include user data collected by the first application 301, such as user heart rate data. Optionally, after receiving data from the first application 301, the target electronic device can also return second data to the first application 301, the second data indicating the reception status of the data received by the target electronic device from the first application 301.
[0123] It should be noted that the first input for the first application 301 described above is merely an example and should not constitute a specific limitation on the first input.
[0124] The transmission module 302 of the electronic device 200 can receive first data from the first application 301, obtain a first data structure based on the first data, and then send the first data structure to the electronic device 100 through the communication module 303. The transmission module 302 of the electronic device 200 can also receive a second data structure including second data sent by the electronic device 100 through the communication module 303, parse the second data structure to obtain the second data, and return the second data to the first application 301.
[0125] In one possible implementation, the transmission module 302 of the electronic device 200 can provide an interface to the first application. The transmission module 302 can receive first data from the first application 301 through this interface, and upon receiving the first data, obtain a first data structure based on the first data. The first data may include one or more parameters, including address parameters. The transmission module 302 can obtain one or more fields of the first data structure based on the one or more parameters of the first data. These one or more fields include an address field, which carries address parameters. The transmission module 302 of the electronic device 200 can also receive a second data structure containing second data sent by the electronic device 100 through the communication module 303, parse the second data structure, and obtain the second data. The obtained second data is then returned to the first application 301 through the interface.
[0126] In some embodiments, the transmission module 302 may be provided with one or more interfaces. These one or more interfaces include a first interface and a second interface, which are different from each other. Since different applications in the electronic device 200 may transmit different first data, calling different interfaces, the first data structure obtained by the transmission module 302 based on the first data will also be different.
[0127] For example, if the first application 301 is a browser application, the first application 301 can transmit the first data to the transmission module 302 through the first interface provided by the transmission module 302. The transmission module 302 can obtain a first data structure based on the first data. The first data may include, but is not limited to, address parameters. Address parameters can be used to indicate the address of the target electronic device (e.g., cloud server 300). Here, the address parameter can be a Uniform Resource Locator (URL) parameter. When the address parameter of the first data is a URL parameter, the first data may also include method parameters. Method parameters can take different values (e.g., GET, POST, etc.). When the value of the method parameter is GET, it can be used to obtain the second data indicated by the URL parameter. Here, the second data includes web page data. In some examples, the URL parameter can not only indicate the address of the target electronic device but also indicate the storage path of the second data. In some examples, the address parameter of the first data may include keywords. Keywords can be used to indicate keywords of the second data. The electronic device 200 can obtain the second data including the keywords based on the keywords. Here, the second data includes web page data related to the keywords. Optionally, the keyword is not part of the address parameter. The first data includes both the address parameter and the keyword parameter, with the keyword parameter's value being the keyword. When the method parameter's value is POST, it can be used to upload data to the target electronic device indicated by the URL. Here, the first data includes the file body parameter, whose value is the data uploaded by electronic device 200 to the target electronic device.
[0128] It should be noted that, in addition to address parameters, method parameters, etc., the first data may also include, but is not limited to, browser identification parameters (used to indicate the browser version), receiving language parameters (used to indicate the text language of the second data), etc., and this application does not limit them.
[0129] For example, if the first application 301 is a music application, the first application 301 can transmit the first data to the transmission module 302 through the second interface provided by the transmission module 302. The transmission module 302 can obtain a first data structure based on the first data. The first data may include, but is not limited to, address parameters, which can be used to indicate a target electronic device (e.g., a cloud server 300). Here, the address parameters are IP parameters. The first data may also include method parameters, etc.
[0130] The method parameter can take different values (e.g., get, put, etc.). When the method parameter is set to get, it can be used to retrieve data from a specified file stored in the target electronic device indicated by the address parameter. Here, the data of the specified file is the second data. When the method parameter is set to get, the first data also includes a filename parameter, whose value is an identifier for the specified file. The filename parameter can be used to indicate the specified file. Optionally, the filename parameter can also include the storage path of the specified file.
[0131] When the method parameter value is `put`, the first data also includes a file body parameter, which includes data of a specified file to be uploaded to the target electronic device, and this specified file is stored on electronic device 200. Electronic device 200 can upload the data of the specified file to the target electronic device (e.g., cloud server 300) indicated by the IP parameter. Optionally, the first data may also include a filename parameter, which can be used to instruct the target electronic device to use the value of the filename parameter as the name of the file when storing the data of the specified file in a file format. Further optionally, the filename parameter may also include a file storage path, and the target electronic device can store the value of the file body parameter according to the file storage path. Optionally, after receiving the file body parameter, the target electronic device can reply with second data. This second data can be an acknowledgment message, which can be used to indicate whether the target electronic device has received the file body parameter, or to indicate the status of the target electronic device's receipt of the file body parameter.
[0132] Optionally, the first data may also include an address indication parameter, which is used to indicate whether the address parameter is an IP parameter or a URL parameter.
[0133] The following is a structural example of a first data structure provided in an embodiment of this application.
[0134] Table 1
[0135]
[0136] As shown in Table 1 above, the first data structure may include, but is not limited to, address fields, method fields, etc.
[0137] For example, the value of the address field can be obtained from the address parameter in the first data, and the address field can be used to indicate the address of the target electronic device (e.g., cloud server 300). When the address parameter is a URL parameter, the address field can be a URL field carrying the URL parameter. When the address parameter is an IP parameter, the address field can be an IP field carrying the IP parameter.
[0138] Optionally, the first data structure may further include an address indicator field, which can be used to indicate whether the address field is a URL field or an IP field. The value of the address indicator field can be obtained from the address parameter or the address field. For example, if the address parameter is a URL parameter or the address field carries a URL parameter, the value of the address indicator field is used to indicate that the address field is a URL field; if the address parameter is an IP parameter or the address field carries an IP parameter, the value of the address indicator field is used to indicate that the address field is an IP field. Optionally, the first data includes an address indicator parameter, and the value of the address indicator field can be obtained from the address indicator parameter. Alternatively, the value of the address indicator field can be obtained from the value of the address parameter.
[0139] The method field can be used to instruct electronic device 200 to upload data to or retrieve data from the target electronic device. The method field can be obtained from the method parameters in the first data. For example, the method field can carry method parameters.
[0140] When the method field instructs the electronic device 200 to obtain data from the target electronic device corresponding to the address field, and the address field is an IP field, the first data structure also includes a filename field. The filename field can carry a filename parameter, which can be used to indicate the filename of the file to which the data obtained by the electronic device 200 belongs.
[0141] When the method field indicates that electronic device 200 will upload data to the target electronic device indicated by the address field, the first data structure also includes a file body field. The file body field includes the data of the file uploaded by electronic device 200. The value of the file body field is the same as the value of the file body parameter in the first data. Optionally, the first data may also include a filename parameter, and the first data structure may also include a filename field. The value of the filename field may be the same as the value of the filename parameter in the first data.
[0142] Optionally, the first data structure may also include an application identifier field, which can be used to identify the first application 301 to which the first data belongs. The value of the application identifier field can be the identifier of the first application 301 to which the first data belongs. The electronic device 200 can determine the application to which the first data structure belongs based on the application identifier field. In this way, when the electronic device 100 sends the second data structure to the electronic device 200, it can add the application identifier field obtained from the first data structure to the second data structure, and the electronic device 200 can determine the application receiving the second data based on the application identifier field. In some examples, the electronic device 200 has identifiers for all applications of the electronic device 200, or the electronic device 200 can assign a temporary identifier to the application to which the first data belongs when generating the first data structure; this application does not limit this.
[0143] Optionally, the first data structure may further include a protocol identifier field, which can be used to indicate the communication protocol used when the electronic device 100 communicates with the target electronic device. For example, the protocol identifier field can be 1 bit long. When the value of the protocol identifier field is 0, it can be used to instruct the electronic device 100 to obtain data from (or upload data to) the cloud server 300 via the Hypertext Transfer Protocol (HTTP) and TCP / IP protocols. When the value of the protocol identifier field is 1, it can be used to instruct the electronic device 100 to obtain data from (or upload data to) the cloud server 300 via the Trivial File Transfer Protocol (TFTP) and UDP protocols. The electronic device 200 can determine the value of the protocol identifier field based on the application to which the first data belongs. For example, when the application described in the first data is a browser application, the value of the protocol identifier field is 0; when the application described in the first data is a music application, the value of the protocol identifier field is 1. Alternatively, the electronic device 200 can determine the value of the protocol identifier field based on the value of the address field (or address parameter). For example, if the address field is an IP address, the value of the protocol identifier field is 1. In some examples, electronic device 200 can determine the value of the protocol identifier field based on the address indication field. In other examples, the first data includes a protocol identifier parameter, and electronic device 200 can directly obtain the protocol identifier field based on the value of the protocol identifier parameter (e.g., http, tftp, etc.). In still other examples, electronic device 200 can determine the value of the protocol identifier field based on the interface called by the first application 301; for example, if the first application calls the first interface, the value of the protocol identifier field is 0. Thus, after receiving the first data structure, electronic device 100 can determine the communication protocol used for communication with the cloud server 300 based on the protocol identifier field. Electronic device 100 can also determine that the address field value is a URL or IP address based on the value of the protocol identifier field.
[0144] It should be noted that the length, values, and communication protocols corresponding to different values of the protocol identifier field are only examples and should not constitute specific limitations on the protocol identifier field.
[0145] In some embodiments, electronic devices 100 and 200 can construct a first data structure and a second data structure using a type-length-value (TLV) encoding method. Here, type represents the type of a field, length represents the length of the field's value, and value represents the field's value. For example, electronic device 200 can use the number 1 to represent an address field, number 2 to represent a method field, and number 3 to represent a file body field; where, when electronic device 200 uploads data, the value of the file body field in the first data structure is the uploaded data. When electronic device 200 downloads data, the value of the file body field in the second data structure is the downloaded second data. Number 4 represents a filename field, and so on. Electronic device 200 can obtain the address field in the first data structure based on the address parameter in the first data, the method field in the first data structure based on the method parameter in the first data, the file body field in the first data structure based on the file body parameter in the first data, and the filename field in the first data structure based on the filename parameter in the first data. Electronic device 100 can obtain the text body field in the second data structure based on the second data.
[0146] For example, the address parameter of the first data structure has the value "https: / / www.huawei.com", and the method parameter has the value "get". The first data structure includes an address field and a method field. The address field can be "122https: / / www.huawei.com", where "1" indicates that the field is an address field, "22" indicates the length of the field's value, and "https: / / www.huawei.com" is the value of the address field, which is the same as the address parameter value. The method field of the first data structure can be "23get", where "2" indicates that the field is a method field, "3" indicates the length of the field's value, and "get" is the value of the method field, which is the same as the method parameter value.
[0147] It is understood that the specific fields, the order of the fields, and the values of the fields included in the first data structure in the embodiments of this application are merely examples, and this application does not limit them.
[0148] It should be noted that when the transmission module 302 receives interface call requests from multiple applications of the electronic device 200, the transmission module 302 can provide interface services to the applications sequentially based on their priority. The transmission module 302 first provides the service of obtaining the first data structure to the application with the highest priority, and finally provides the service of obtaining the first data structure to the application with the lowest priority.
[0149] In some examples, electronic device 200 may store application priority information, which includes the priority relationship of applications on electronic device 200. After electronic device 200 downloads a new application, it can update the priority information.
[0150] In other examples, electronic device 100 can determine the priority of an application based on its usage frequency. The usage frequency can be the duration a user uses the application over a period of time (e.g., one day). The longer a user uses the application over a period of time, the higher the usage frequency and the higher the application's priority. Alternatively, the usage frequency can also be the number of times a user opens the application over a period of time (e.g., one day).
[0151] In other examples, electronic device 100 may also determine the priority of an application by the duration it occupies the CPU. For example, the longer an application occupies the CPU in a recent period (e.g., 200ms), the higher its priority.
[0152] In other examples, electronic device 100 may also determine the priority of an application based on its power consumption over a period of time. For example, the more power an application consumes in a recent period (e.g., a day), the higher its priority.
[0153] In other examples, electronic device 100 can also determine the priority of an application based on its most recent usage time. For example, the more recently an application received user input or read data, the higher its priority.
[0154] In some examples, to avoid multiple applications having the same priority, the electronic device 100 can combine the above methods to determine the priority of applications. For example, when the electronic device 100 determines that multiple applications have the same priority based on the frequency of application use, it can determine the priority of multiple applications based on the power consumption of the applications, and so on.
[0155] Optionally, when multiple applications have the same priority, the electronic device 100 can determine the priority of the applications according to their business type. For example, the electronic device 100 can determine that the navigation application has a higher priority than the music citation.
[0156] In other examples, electronic device 200 can assign different priorities to different interfaces. Accordingly, electronic device 200 can determine the application priority based on the interface called by the application. It should be noted that transmission module 302 provides multiple different interfaces. Application developers of electronic device 200 can write applications based on the interfaces provided by electronic device 200. Therefore, multiple applications may call the same interface. When transmission module 302 of electronic device 200 receives call requests from multiple applications for the same interface, since the interface is the same, the applications also have the same priority. Electronic device 200 can determine the priority of each call request based on the first data and allocate interface resources to the multiple applications sequentially. Transmission module 302 first provides interface resources to the call request with the highest priority and lastly to the call request with the lowest priority. Electronic device 200 can store m pieces of first data recently sent to electronic device 100, with the most recent first data having higher priority. Electronic device 200 prioritizes processing call requests whose first data is stored in electronic device 200, and then processes call requests whose first data is not stored in electronic device 200. If the first data of one or more call requests is not stored in the electronic device 200, the electronic device 200 can randomly set the priority of these one or more call requests. In this way, the electronic device 200 can determine the processing order of the call requests according to the called interface and the first data, and process the call requests with higher priority first.
[0157] The communication module 303 of the electronic device 200 can be used to transmit data with the electronic device 100. The communication module 303 of the electronic device 200 can be used to establish a communication connection with the electronic device 100 (e.g., Bluetooth connection), and the communication module 303 can be used to send a first data structure including first data to the electronic device 100, and to receive a second data structure including second data sent by the electronic device 100.
[0158] Understandably, the communication module 303 of electronic device 200 can encapsulate the first data structure into a first specified message A using a specified communication protocol supported by both electronic device 200 and electronic device 100. The first specified message A is then sent to the communication module 311 of electronic device 100. Furthermore, upon receiving the first specified message B, the communication module 303 of electronic device 200 can parse the first specified message B using the specified communication protocol supported by both electronic device 200 and electronic device 100 to obtain the second data structure. For example, the specified communication protocol supported by both electronic device 200 and electronic device 100 could be Bluetooth, USB, etc.
[0159] Electronic device 100 may include, but is not limited to, communication module 311, electronic device 200 control application 312, and network protocol stack 313.
[0160] The communication module 311 can be used to establish a communication connection (e.g., Bluetooth connection) with the electronic device 200. The communication module 311 can receive a first specified message A including a first data structure sent by the electronic device 100, and send a first specified message B including a second data structure to the electronic device 200. It should be noted that the communication module 311 specifically refers to the communication module for data transmission with the electronic device 200. The electronic device 100 may also include other communication modules, which may include communication modules for data transmission with the cloud server 300 (not shown in the figure). For example, the electronic device 100 and the electronic device 200 can transmit data via a Bluetooth module, and the electronic device 100 and the cloud server 300 can transmit data via a wireless local area network (WLAN) module. Here, the Bluetooth module is the communication module 311.
[0161] Understandably, when the communication module 311 of the electronic device 100 receives the first designated message A, it can parse the first designated message A according to the designated communication protocol to obtain the first data structure, and send the first data structure to the control application 312 of the electronic device 200. The communication module 311 of the electronic device 100 can also encapsulate the second data structure sent by the control application 312 of the electronic device 200 according to the designated communication protocol to obtain the first designated message B, and send the first designated message B to the transmission communication module 303 of the electronic device 200.
[0162] The electronic device 200 control application 312 is an application within the electronic device 100 used to control the electronic device 200. The electronic device 200 control application 312 can display data from the electronic device 200. For example, if the electronic device 200 is a smartwatch, the electronic device 200 control application 312 can display user heart rate data, blood oxygen concentration data, etc., acquired by the electronic device 200. Here, the electronic device 200 control application 312 can be used to parse the first data structure sent by the electronic device 100 to obtain the first data. The electronic device 200 control application can also be used to obtain the second data structure based on the second data sent by the cloud server 300. It should be noted that both the transmission module 302 of the electronic device 200 and the electronic device 200 control application 312 of the electronic device 100 store the formats of the first and second data structures. Therefore, the electronic device 200 can generate the first data structure and parse the second data structure. The electronic device 100 can generate the second data structure and parse the first data structure. In some embodiments, the formats of the first and second data structures in electronic device 200 can be set by the manufacturer, or they can be obtained from electronic device 100 (electronic device 200 control application 312). The formats of the first and second data structures in electronic device 100 can be provided by the installed electronic device 200 control application 312. If electronic device 100 and electronic device 200 are products of the same manufacturer, the formats of the first and second data structures in electronic device 100 can be set by the manufacturer.
[0163] The second data structure may include, but is not limited to, a file body field. The value of the file body field is the same as the second data. In some descriptions, it may be directly stated that the second data structure includes the second data. Optionally, the second data structure may also include an application identifier field, which can be used to indicate the application receiving the second data. The value of the application identifier field is an identifier of the application receiving the second data.
[0164] The electronic device 200 control application 312 can invoke the network protocol stack 313 to obtain second data stored in the target electronic device (e.g., cloud server 300) indicated by the address field. Alternatively, the electronic device 200 control application 312 can invoke the network protocol stack 313 to upload data of a specified file to the target electronic device (e.g., cloud server 300) indicated by the address field, wherein the first data structure includes the data of the specified file.
[0165] When the electronic device 200 controls the application 312 to call the network protocol stack 313, it can first obtain the first data required by the network protocol stack 313 from the first data structure. The network protocol stack 313 can then obtain a second specified message A based on the first data. The second specified message A can be used to instruct the target electronic device to send second data to the electronic device 100, or it can be used to send data of a specified file to the target electronic device.
[0166] Network protocol stack 313 (also referred to as protocol stack 313) can encapsulate the first data into a second specified message A (also referred to as a request message) of the first communication protocol, and then send the second specified message A to the target electronic device (e.g., cloud server 300), which does not support the first communication protocol. For example, the first communication protocol may include, but is not limited to, HTTP and TCP / IP protocols, TFTP and UDP protocols, etc. In some examples, network protocol stack 313 may include an application layer, transport layer, network layer, data link layer, and physical layer.
[0167] In this way, electronic device 200 can be configured with only one protocol stack, through which it transmits data with electronic device 100. Electronic device 100 can be configured with multiple protocol stacks, allowing electronic device 200 to acquire / upload data to the target electronic device using these stacks. In some examples, electronic device 200 may not have a network address configured, yet it can still transmit data with electronic device 100; however, electronic device 100 must use its network address when transmitting data over the network. In some examples, electronic device 200 may not support a specified communication protocol, while electronic device 100 may support one; in this case, electronic device 200 must use its specified communication protocol when transmitting data.
[0168] The network protocol stack 313 can also parse the second specified message B from the target electronic device to obtain the second data. Specifically, the network protocol stack 313 can receive the second specified message B sent by the server, parse the second specified message B based on the first communication protocol, and obtain the data of the second specified message B (e.g., the second data). After parsing and obtaining the second data, the network protocol stack 313 can return the second data to the electronic device 200 to control the application 312.
[0169] In some examples, the first data only includes an address field, and electronic device 200 can directly send the first data to communication module 311 of electronic device 100 via communication module 303. Communication module 311 of electronic device 100 then sends the first data to control application 312 of electronic device 200. Control application 312 of electronic device 200 can directly obtain second data from cloud server 300 indicated by the address field of the first data.
[0170] The network protocol stack 313 can provide one or more interfaces to the electronic device 200 control application 312, which can be used to transmit the first data to the network protocol stack 313.
[0171] In some embodiments, the network protocol stack 313 provides one or more interfaces, including a third interface and a fourth interface, which are different. The one or more interfaces provided by the network protocol stack 313 correspond to one or more interfaces provided by the transmission module 302. Specifically, the third interface corresponds to the first interface, and the fourth interface corresponds to the second interface. In some examples, the correspondence between an interface provided by the network protocol stack 313 and an interface provided by the transmission module 302 can be understood as the two interfaces having the same interface identifier (also called interface name) and parameters. For example, the identifiers of both the first and third interfaces are "httpfunction", and the parameters of both interfaces are "stringmethod, string postdata", where string indicates that the interface parameter type is string, method parameter is a method parameter, and postdata parameter is an address parameter. As another example, the identifiers of both the second and fourth interfaces are "tftpfunction". Furthermore, the parameters of both the fourth and second interfaces are "string address, string method, string filepath", where string indicates that the interface parameter type is string, method parameter is a method parameter, address parameter is an address parameter, and filepath parameter is a filename parameter. In this case, the parameter types, parameter values, and the order of multiple parameters are all the same in the two corresponding interfaces.
[0172] The cloud server 300 stores the second data. The cloud server 300 also includes a network protocol stack, which can be used to encapsulate the second data. The cloud server 300 can obtain the second data based on a second specified message A (also known as a request message). The cloud server 300 can encapsulate the second data into a second specified message B (also known as a response message) of the first communication protocol, and then send the second specified message B to the electronic device 100.
[0173] In the embodiments of this application, such as Figure 3 As shown in the digital identifier, the first application 301 of electronic device 200 can obtain a first data structure based on the first data through the designated interface provided by transmission module 302. Communication module 303 can encapsulate the first data structure into a first designated message A and send the first designated message A to communication module 311 of electronic device 100. Communication module 311 of electronic device 100 can parse the first designated message A to obtain the first data structure and send the first data structure to control application 312 of electronic device 200. Control application 312 of electronic device 200 can parse the first data structure to obtain the first data, and then, based on the first data, obtain a second designated message A of the first communication protocol through network protocol stack 313, and send the second designated message A to cloud server 300. Cloud server 300 can obtain the second data based on the second designated message A. Cloud server 300 can also encapsulate the second data into a second designated message B and then send the second designated message B to electronic device 100. Electronic device 100 can parse the second specified message B through network protocol stack 313 and send the parsed second data to electronic device 200 control application 312. Electronic device 200 control application 312 then obtains a second data structure based on the second data, and encapsulates the second data structure into a first specified message B through communication module 311, sending the first specified message B to communication module 303 of electronic device 200. Communication module 303 of electronic device 200 can parse the first specified message B to obtain the second data structure and send the second data structure to transmission module 302. Transmission module 302 can parse the second data structure and send the parsed second data to first application 301. After receiving the second data, first application 301 can execute the operation corresponding to the second data. For example, when the second data is web page data, first application 301 can display the page containing the web page data. As another example, when the second data is audio file data, first application 301 can play the audio file.
[0174] The following is a flowchart illustrating a transmission method provided in an embodiment of this application.
[0175] like Figure 4 As shown, the transmission method includes:
[0176] S401. The first application of the electronic device 200 obtains a first data structure based on the first data through a specified interface, and sends the first data structure to the communication module of the electronic device 200.
[0177] The description of the first application, and the detailed description of how the first application obtains the first data structure based on the first data through the specified interface, can be found in [reference needed]. Figure 3 The illustrated embodiment will not be described in detail here. The specified interface is...Figure 3 The interface provided by the transmission module 302 shown.
[0178] S402. The communication module of electronic device 200 can send the first data structure to the communication module of electronic device 100.
[0179] The communication module of electronic device 200 can be used to establish a communication connection with electronic device 100 and to transmit data with electronic device 100. A description of the communication module of electronic device 200 can be found here. Figure 3 The description of the communication module 303 in the illustrated embodiment will not be repeated here.
[0180] S403. The communication module of electronic device 100 can send the first data structure to the control application of electronic device 200.
[0181] A description of the communication module of electronic device 100 can be found in [reference needed]. Figure 3 The description of the communication module 311 in the illustrated embodiment will not be repeated here.
[0182] S404. The electronic device 200 control application can parse the first data structure based on the format of the first data structure to obtain the first data.
[0183] The control application for electronic device 200 stores field composition information for a first data structure and a second data structure (i.e., the formats of the first and second data structures). The control application for electronic device 200 can parse the first data structure based on the stored field composition information to obtain the first data. The control application for electronic device 200 can also encapsulate the second data based on the stored field composition information to obtain the second data structure. In this way, any electronic device (e.g., electronic device 100) that has the control application for electronic device 200 installed and can establish a communication connection with the target electronic device (e.g., cloud server 300) can transmit data to electronic device 200.
[0184] S405. The electronic device 200 control application obtains the communication protocol data packet based on the first data through the protocol stack, and sends the communication protocol data packet to the cloud server 300.
[0185] Electronic device 100 can determine the communication protocol used by electronic device 100 to communicate with cloud server 300 based on the first data, and then obtain the communication protocol data packet indicating the communication protocol based on the first data. For example, if the first data structure includes a URL field, electronic device 100 can obtain the communication protocol data packet based on the first data, HTTP protocol, and TCP / IP protocol. Specifically, electronic device 100 can determine whether the address field is a URL field or an IP field based on the value of the address field. Optionally, if the first data structure includes an address indication field, electronic device 100 can determine whether the address field is a URL field or an IP field based on the address indication field.
[0186] Alternatively, if the first data structure also includes Figure 3 The protocol identifier field shown indicates that the electronic device 100 can directly use the communication protocol indicated by the protocol identifier field.
[0187] It is understandable that electronic device 100 can obtain communication protocol data packets based on the first data, which are then processed sequentially through the application layer, transport layer, network layer, data link layer, and physical layer. Here, the communication protocol data packet can be understood as... Figure 3 The second protocol message A (or request data message) shown, and the detailed description of how the electronic device 100 obtains the communication protocol data packet, can be found in [reference needed]. Figure 3 The embodiments shown are not described in detail here.
[0188] S406. Cloud Server 300 obtains the second data based on communication protocol data packets and encapsulates the second data through the protocol stack of Cloud Server 300.
[0189] S407. Electronic device 100 receives encapsulated second data sent by cloud server 300, and parses the encapsulated second data through the protocol stack to obtain the second data.
[0190] After receiving the encapsulated second data sent by the cloud server 300, the electronic device 100 can sequentially pass through the physical layer, data link layer, network layer, transport layer and application layer to obtain the second data.
[0191] S408. Electronic device 200 control application encapsulates the second data into a second data structure.
[0192] The electronic device 200 control application stores parameter composition information for a first data structure and a second data structure. Based on the stored parameter composition information, the electronic device 200 control application can process the second data structure to obtain the second data structure.
[0193] S409. The control application of electronic device 200 sends the second data structure to the communication module of electronic device 100.
[0194] S410. The communication module of electronic device 100 can send the second data structure to the communication module of electronic device 200.
[0195] S411. Electronic device 200 parses the second data structure through a specified interface, obtains the second data, and sends the second data to the first application.
[0196] Optionally, the second data structure may also include an application identifier field, which can be used to indicate the application in the electronic device 200 that receives the second data. The electronic device 200 can parse the second data structure through a specified interface to obtain the second data and the application identifier field, and send the second data to the first application indicated by the application identifier field.
[0197] In this way, electronic devices 200 and 100 only need to transmit the first and second data, without needing to transmit the header information of communication protocols not supported by electronic device 200, thus improving transmission efficiency. Furthermore, electronic device 200 no longer needs to configure the entire protocol stack, reducing storage space usage and lowering the power consumption of protocol encapsulation.
[0198] The following section describes the transmission method provided in the embodiments of this application, using application scenarios as examples.
[0199] In some application scenarios, taking an electronic device 200 as a watch or bracelet as an example, the transmission method provided in the embodiments of this application is introduced.
[0200] like Figure 5A As shown, the process by which electronic device 200 obtains the second data stored in cloud server 300 through electronic device 100 can be divided into five stages:
[0201] Phase 1: The first application of electronic device 200 is a browser application. Electronic device 200 displays page 501, which is the page for the first application. Page 501 includes an input box 502 and a confirmation control 503. The input box 502 can be used to input a URL, and the first data includes this URL. Here, the input box 502 displays the URL "www.huawei.com" entered by the user. The confirmation control 503 can be used to trigger electronic device 200 to display the web page corresponding to the input content in input box 502.
[0202] The first application receives the first input. Here, the first input can be an input to the confirmation control 503 (e.g., a click).
[0203] Phase 2: After receiving the first input, the first application of electronic device 200 can obtain the first data structure based on the first data of the first application through the Hypertext Transfer Protocol (HTTP) interface. Here, the Hypertext Transfer Protocol interface can be understood as...Figure 3 The first interface shown may include a URL parameter "https: / / www.huawei.com" and a method parameter "get". The first data structure includes an address field and a method field obtained based on the first data. This first data structure can be used to request web page data indicated by the address field from the cloud server 300. The address field can be used to instruct the cloud server 300, and the method field can be used to instruct the retrieval of second data from the cloud server 300. For a detailed description of how the electronic device 200 obtains the first data structure based on the first data, please refer to [link to relevant documentation]. Figure 3 The illustrated embodiment will not be described in detail here. Electronic device 200 can encapsulate the first data structure into a Bluetooth data packet A in Bluetooth protocol format via the Bluetooth protocol stack, and send the Bluetooth data packet A to electronic device 100. Here, Bluetooth communication is merely an example and should not be construed as limiting the communication connection between electronic device 100 and electronic device 200. For example, communication between electronic device 100 and electronic device 200 can also be achieved through... Figure 1 The USB port is used for communication, etc.
[0204] Phase 3: Electronic device 200 sends Bluetooth data packet A to electronic device 100. Electronic device 100 can parse Bluetooth data packet A through the Bluetooth protocol stack to obtain a first data structure, which includes an address field and a method field. Electronic device 100 can obtain first data from the first data structure. Electronic device 100 then obtains a first application layer message through the HTTP protocol and the first data. It then encapsulates the first application layer message based on the TCP / IP protocol to obtain a specified protocol message A, and sends the specified protocol message A to cloud server 300. After receiving the specified protocol message A, cloud server 300 can obtain second data based on the specified protocol message A. Cloud server 300 can encapsulate the second data through the HTTP and TCP / IP protocols to obtain a specified protocol message B. Here, the second data includes the data of the hypertext markup language (HTML) file "huawei.html", that is, the webpage content of "https: / / www.huawei.com". Cloud server 300 can then send the specified protocol message B to electronic device 100. Electronic device 100 can parse the specified protocol message B to obtain the second data, then package the second data into a second data structure, and encapsulate the second data structure through the Bluetooth protocol stack to obtain a Bluetooth data message B in Bluetooth protocol format. Finally, it sends the Bluetooth data message B to electronic device 200 through the Bluetooth communication connection. Here, the HTTP and TCP / IP protocols are only examples and should not constitute a limitation on the communication protocol between electronic device 100 and cloud server 300.
[0205] Phase 4: Electronic device 200 receives Bluetooth data packet B, can parse Bluetooth data packet B to obtain the second data structure, then parses the second data structure through the Hypertext Transfer Protocol interface to obtain the second data, and sends the second data to the first application.
[0206] Phase 5: After receiving the second data, the first application can construct page 511 based on the second data. The electronic device 200 can display page 511, which is the web page indicated by the URL in the input box 502.
[0207] In this way, electronic device 200 can obtain the network data required by browser application through electronic device 100, and electronic device 200 can obtain network resources even if it does not have Internet access function.
[0208] For example, if the first data structure and the second data structure are constructed using TLV encoding, the process for the first application of the electronic device 200 to acquire the second data can be seen as follows: Figure 5B and Figure 5C As shown:
[0209] like Figure 5B As shown, the first data of the first application of the electronic device 200 includes URL parameters and method parameters. The first application of the electronic device 200 calls the first interface to pass the URL parameters and method parameters to the transmission module of the electronic device 200.
[0210] The transmission module of electronic device 200 processes the first data and obtains... Figure 5B The first data structure shown includes an address field and a method field. The address field carries the address parameters of the first data; "1" in the address field represents the address parameter, "22" indicates the address parameter's value is 22 bytes long, and "https: / / www.huawei.com" represents the address parameter's value. The method field shows "2" representing the method parameter, "3" indicating the method parameter's value is 3 bytes long, and "get" representing the method parameter's value.
[0211] It should be noted that the first data structure may also include, but is not limited to, an address indicator field corresponding to the address indicator parameter. The address indicator field can be used to indicate whether the address field in the first data structure carries a URL parameter or an IP parameter. In some examples, the address parameter also includes keywords.
[0212] In some examples, when electronic device 200 uploads data, the value of the method field of the first data structure is "put" or "post", and the first data structure also includes a file body field, which includes the file content.
[0213] The Bluetooth module of electronic device 200 can encapsulate a first data structure into a first data packet, which includes a Bluetooth protocol header and can be referred to here as a Bluetooth data packet, and then transmit the first data packet to the Bluetooth module of electronic device 200.
[0214] The Bluetooth module of electronic device 100 can parse the first data packet, obtain the first data structure, and send the first data structure to the second application of electronic device 100.
[0215] The second application of electronic device 100 can parse the first data structure to obtain the first data.
[0216] The second application of electronic device 100 can call the interface of the protocol stack to transmit the first data to the protocol stack. The protocol stack of electronic device 100 can then obtain an HTTP request based on the first data and send the HTTP request to cloud server 300. Upon receiving the HTTP request, cloud server 300 can send an HTTP response to electronic device 100. The HTTP response includes the page content of the webpage (also known as the page content). This HTTP request can be understood as... Figure 5A The HTTP response to the specified protocol message A shown can be understood as... Figure 5A The specified protocol message B is shown.
[0217] In some examples, the names of the first interface and the interface called by the second application of electronic device 100 are the same, as are the names, order, and values of the parameters. For example, here, both the first interface and the interface called by the second application of electronic device 100 can be httpfunction(string method, string postdata), where method is the method parameter in the first data, and postdata is the address parameter in the first data.
[0218] like Figure 5C As shown, after receiving the HTTP response, the protocol stack of electronic device 100 can parse the HTTP response to obtain the webpage content, i.e., the second data. The protocol stack of electronic device 100 then sends the webpage content to the second application of electronic device 100.
[0219] The second application of electronic device 100 processes the webpage content to obtain a second data structure, and then sends the second data structure to the Bluetooth module of electronic device 100. The second data structure includes a file body field. This file body field carries the second data; a "3" in the file body field indicates that the data is returned by cloud server 300, and "1000" in the file body field indicates that the length of the second data value is 1000 bytes. The webpage content in the file body field represents the second data.
[0220] The Bluetooth module of electronic device 100 encapsulates the second data structure using Bluetooth to obtain a second data packet, which can be referred to as a Bluetooth data packet.
[0221] The Bluetooth module of electronic device 100 sends the second data packet to the Bluetooth module of electronic device 200.
[0222] The Bluetooth module of electronic device 200 parses the second data packet, obtains the second data structure, and returns the second data structure to the transmission module of electronic device 200.
[0223] The transmission module of electronic device 200 parses the second data structure, obtains the second data, and returns the second data to the first application of electronic device 200.
[0224] After receiving the second data, the first application of the electronic device 200 can process the second data and display it as shown. Figure 5A Page 511 is shown.
[0225] In other application scenarios, taking the electronic device 200 as an example of an earphone, the transmission method provided by the embodiments of this application is introduced.
[0226] like Figure 6A As shown, the process by which electronic device 200 obtains second data from cloud server 300 through electronic device 100 can be divided into five stages:
[0227] Phase 1: The first application of electronic device 200 is a music application, which receives the first input. Here, the first input can be a voice command, such as: "Play the song 'Dreamit Possible'". Electronic device 200 can recognize the voice command and obtain the keyword "Dreamit Possible".
[0228] Phase 2: After receiving the first input, the first application of electronic device 200 can obtain the first data structure based on the first data of the first application through the Simple Text Transfer Protocol (TFTP) interface. Here, the Simple Text Transfer Protocol interface can be understood as... Figure 3 The second interface shown includes a first data structure comprising a method parameter "get", an IP parameter "192.168.59.133", and a filename parameter "dreamitpossible.mp3". The first data structure includes a method field, an address field, and a filename field obtained based on the first data. For a detailed description of how the electronic device 200 obtains the first data structure based on the first data, please refer to [link to relevant documentation]. Figure 3The illustrated embodiment will not be described in detail here. The first data structure can be used to retrieve the content of a file named "dreamitpossible.mp3" stored on the cloud server 300, as indicated by the IP parameters.
[0229] Electronic device 200 can send the first data structure to electronic device 100 via Bluetooth communication technology. Here, Bluetooth communication is merely an example and should not be construed as limiting the communication connection between electronic device 100 and electronic device 200. For example, electronic device 100 and electronic device 200 can also communicate via... Figure 1 The USB port is used for communication, etc.
[0230] Phase 3: Electronic device 200 sends the first data structure to electronic device 100. Electronic device 100 can obtain first data from the first data structure. Based on the first data, TFTP protocol, and UDP protocol, electronic device 100 can obtain a specified protocol message C and send the specified protocol message C to cloud server 300. After receiving the specified protocol message C, cloud server 300 can obtain a specified protocol message D based on the specified protocol message C. The specified protocol message D includes second data. Here, the second data includes the data of the Moving Picture Experts Group AudioLayer III (MP3) file "dreamitpossible.mp3", that is, the file content of the "dreamitpossible.mp3" file. Cloud server 300 can send the specified protocol message D to electronic device 100. Electronic device 100 can parse the specified protocol message D to obtain the second data, then package the second data to obtain the second data structure, and finally send the second data structure to electronic device 200 through Bluetooth communication connection.
[0231] Phase 4: After receiving the second data structure, the electronic device 200 can parse the second data structure through the Simple Text Transfer Protocol interface to obtain the second data and send the second data to the first application.
[0232] Stage 5: Electronic device 200 can play the MP3 file.
[0233] In this way, electronic device 200 can obtain the audio files required by music applications through electronic device 100, and electronic device 200 can access network resources even if it does not have internet access capabilities.
[0234] For example, if the first data structure and the second data structure are constructed using TLV encoding, the process for the first application of the electronic device 200 to acquire the second data can be seen as follows: Figure 6B and Figure 6C As shown:
[0235] like Figure 6B As shown, the first data of the first application of electronic device 200 includes IP parameters, method parameters, and filename parameters. The first application of electronic device 200 calls the second interface to pass the IP parameters, method parameters, and filename parameters to the transmission module of electronic device 200.
[0236] The transmission module of electronic device 200 processes the first data to obtain... Figure 6B The first data structure shown includes an address field, a filename field, and a method field. The address field carries the address parameters of the first data; "1" in the address field represents an address parameter, "14" indicates the address parameter's value is 14 bytes long, and "192.168.59.133" represents the address parameter's value. The method field contains "2" representing a method parameter, "3" indicating the method parameter's value is 3 bytes long, and "get" represents the method parameter's value. The filename field contains "4" representing a filename parameter, "21" indicating the method parameter's value is 21 bytes long, and "dreamitpossible.mp3" represents the filename parameter's value.
[0237] It should be noted that the first data structure may also include, but is not limited to, the protocol identifier field corresponding to the protocol identifier parameter. The protocol identifier field can be used to indicate whether the address field in the first data structure carries a URL parameter or an IP parameter.
[0238] In some examples, when electronic device 200 uploads data, the value of the method field of the first data structure is "put" or "post", and the first data structure also includes a file body field, which includes the file content.
[0239] The Bluetooth module of electronic device 200 can encapsulate a first data structure into a first data packet, which includes a Bluetooth protocol header and can be referred to here as a Bluetooth data packet, and then transmit the first data packet to the Bluetooth module of electronic device 200.
[0240] The Bluetooth module of electronic device 100 can parse the first data packet, obtain the first data structure, and send the first data structure to the second application of electronic device 100.
[0241] The second application of electronic device 100 can parse the first data structure to obtain the first data.
[0242] The second application of electronic device 100 can call the interface of the protocol stack to transmit the first data to the protocol stack. The protocol stack of electronic device 100 can obtain a TFTP request based on the first data and send the TFTP request to cloud server 300. After receiving the TFTP request, cloud server 300 can send a TFTP response to electronic device 100. The TFTP response includes the file content (also known as the file content) of dreammitpossible.mp3. This TFTP request can be understood as... Figure 6A The specified protocol message C shown, the TFTP response can be understood as Figure 6A The specified protocol message D is shown.
[0243] In some examples, the names of the second interface and the interface called by the second application of electronic device 100 are the same, as are the names and order of the parameters. For example, here, both the second interface and the interface called by the second application of electronic device 100 can be tftpfunction(string address, string method, string filepath), where method is the method parameter in the first data, address is the address parameter in the first data, and filepath is the filename parameter in the first data. In some examples, the filename parameter includes the filename and the file's storage path.
[0244] like Figure 6C As shown, after receiving the TFTP response, the protocol stack of electronic device 100 can parse the TFTP response to obtain the file content, i.e., the second data. The protocol stack of electronic device 100 then sends the file content to the second application of electronic device 100.
[0245] The second application of electronic device 100 processes the file content to obtain a second data structure and sends the second data structure to the Bluetooth module of electronic device 100. The second data structure includes a file body field. This file body field carries the second data; a "3" in the file body field indicates that the field is data returned by cloud server 300, and "1000" in the file body field indicates that the length of the second data value is 1000 bytes. The file content in the file body field represents the second data.
[0246] The Bluetooth module of electronic device 100 encapsulates the second data structure using Bluetooth to obtain a second data packet, which can be referred to as a Bluetooth data packet.
[0247] The Bluetooth module of electronic device 100 sends the second data packet to the Bluetooth module of electronic device 200.
[0248] The Bluetooth module of electronic device 200 parses the second data packet, obtains the second data structure, and returns the second data structure to the transmission module of electronic device 200.
[0249] The transmission module of electronic device 200 parses the second data structure, obtains the second data, and returns the second data to the first application of electronic device 200.
[0250] After receiving the second data, the first application of the electronic device 200 can process and play the second data.
[0251] In some embodiments, electronic device 100 may store a portion of the second data. When electronic device 100 receives again the first data structure (or first data) from electronic device 200 requesting that portion of the second data, it can directly send the second data to electronic device 200. This allows electronic device 200 to obtain the second data in a shorter time. Furthermore, since electronic device 200 does not need to store the second data after use, it further conserves the storage resources of electronic device 200.
[0252] For example, electronic device 100 may store m recently received first data structures (or first data), and the second data corresponding to each first data structure (or first data). Upon receiving a first data structure (or first data), electronic device 100 may compare each field in that first data structure (or first data) with each field of one of the stored m first data structures (or first data). If they match, electronic device 100 may send the second data corresponding to that first data structure (or first data) to electronic device 200. If they do not match, electronic device 100 may retrieve the second data corresponding to the first data structure (or first data) from cloud server 300 and store that first data structure (or first data) and its second data. Electronic device 100 may also delete the first data structure (or first data) with the earliest received time and its corresponding second data from the stored m first data structures (or first data).
[0253] In some embodiments, when receiving the second data, the electronic device 100 can detect the size of the second data. If the size of the second data is greater than the first capacity (e.g., 3MB), the electronic device 100 can store the second data and send only a specified capacity (e.g., 500KB) of the second data to the electronic device 200 each time until all the second data has been sent to the electronic device 200. It is understood that after receiving the specified capacity of data, the electronic device 200 can perform operations based on the received data. For example, if the second data is a 3MB audio file, the electronic device 100 can first send the specified capacity of the beginning portion of the audio file. After receiving it, the electronic device 200 can play the audio signal obtained based on that portion of data, then acquire the specified capacity of data immediately following the beginning portion, and play the audio signal of the subsequent portion of data. Here, the electronic device 200 can delete the beginning portion of data when receiving the subsequent portion of data. In this way, the electronic device 200 does not have to receive the complete second data at once. The electronic device 200 can receive only a portion of the data to be processed, and after processing that portion of the data, release the memory occupied by that portion of the data, and then receive the subsequent data for subsequent data processing, thus saving the memory space of the electronic device 200. When the memory space of the electronic device 200 is insufficient to hold the complete second data, the second data can also be received and processed in segments.
[0254] The following describes the electronic device 100 provided in the embodiments of this application.
[0255] Figure 7 A schematic diagram of the structure of electronic device 100 is shown. Electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, antenna 1, antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0256] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0257] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.
[0258] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0259] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0260] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0261] It is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.
[0262] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device via the power management module 141.
[0263] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.
[0264] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0265] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.
[0266] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0267] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates 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 processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.
[0268] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0269] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via 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 technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).
[0270] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0271] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0272] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.
[0273] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0274] Camera 193 is used to capture still images or videos. An object passes through the lens to generate an optical image that is projected onto a photosensitive element. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP (Internet Service Provider) for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP (Digital Signal Processor) for processing. The DSP converts the digital image signal into image signals in standard formats such as RGB and YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0275] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.
[0276] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0277] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.
[0278] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0279] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0280] Audio module 170 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal. Speaker 170A, also called a "loudspeaker," is used to convert audio electrical signals into sound signals. Receiver 170B, also called a "handpiece," is used to convert audio electrical signals into sound signals. Microphone 170C, also called a "microphone" or "microphone unit," is used to convert sound signals into electrical signals.
[0281] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.
[0282] When pressure sensor 180A is used to sense pressure signals, it can convert the pressure signals into electrical signals. In some embodiments, pressure sensor 180A can be disposed on display screen 194. Gyroscope sensor 180B can be used to determine the motion posture of electronic device 100. Barometric pressure sensor 180C is used to measure barometric pressure. Magnetic sensor 180D includes a Hall sensor and can be used to detect the opening and closing of the flip cover. Accelerometer 180E can detect the magnitude of acceleration of electronic device 100 in various directions (generally three axes). Distance sensor 180F is used to measure distance. Proximity sensor 180G can also be used for automatic unlocking and locking in flip cover mode and pocket mode. Ambient light sensor 180L is used to sense ambient light brightness. Fingerprint sensor 180H is used to collect fingerprints. Temperature sensor 180J is used to detect temperature. Touch sensor 180K, also called "touch panel". Touch sensor 180K can be disposed on display screen 194, and touch sensor 180K and display screen 194 constitute a touch screen, also called "touch screen". A touch sensor 180K is used to detect touch operations applied to or near it. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided via the display screen 194. In some embodiments, the touch sensor 180K may also be located on the surface of the electronic device 100, in a different position than the display screen 194. A bone conduction sensor 180M can acquire vibration signals. Buttons 190 include a power button, volume buttons, etc. A motor 191 can generate vibration cues. An indicator 192 may be an indicator light, used to indicate charging status, battery level changes, or messages, missed calls, notifications, etc. A SIM card interface 195 is used to connect a SIM card.
[0283] The following describes the electronic device 200 provided in the embodiments of this application.
[0284] Please refer to Figure 8 , Figure 8 An exemplary schematic diagram of the hardware structure of an electronic device 200 provided in an embodiment of this application is shown.
[0285] like Figure 8As shown, the electronic device 200 may include a processor 801, a memory 802, a power switch 803, a communication module 804, etc. These modules can be connected via a bus or other means; this embodiment uses a bus connection as an example.
[0286] The processor 801 can be used to read and execute computer-readable instructions. In a specific implementation, the processor 801 mainly includes a controller, an arithmetic logic unit (ALU), and registers. The controller is primarily responsible for instruction decoding and issuing control signals for the operations corresponding to the instructions. The ALU is primarily responsible for storing register operands and intermediate operation results temporarily stored during instruction execution. In a specific implementation, the hardware architecture of the processor 801 can be an application-specific integrated circuit (ASIC) architecture, a MIPS architecture, an ARM architecture, or an NP architecture, etc.
[0287] In this embodiment, processor 801 can be used to obtain a first data structure based on first data. Processor 801 can also be used to obtain second data based on a second data structure. Processor 801 can also be used to generate signals, such as Bluetooth signals, to be transmitted externally by communication module 804. Processor 801 can also be used to parse signals received by communication module 804.
[0288] The memory 802 is coupled to the processor 801 and is used to store various software programs and / or multiple sets of instructions. In a specific implementation, the memory 802 may include high-speed random access memory, and may also include non-volatile memory, such as one or more disk storage devices, flash memory devices, or other non-volatile solid-state storage devices. Here, the memory 802 may also store a transmission module, which can be used to acquire data from the cloud server 300.
[0289] The power switch 803 can be used to control the power supply to the electronic device 200.
[0290] The communication module 804 may include a Bluetooth module 804A or others. Electronic device 200 can receive or transmit wireless signals through one or more of the Bluetooth communication modules 804A to establish a wireless communication connection with electronic device 100. Electronic device 200 can receive data transmitted by electronic device 100 (e.g., a second data packet including a second data structure) through the aforementioned wireless communication connection, and can also send data to electronic device 100 (e.g., a first data packet including a first data structure) through the aforementioned wireless communication connection. The Bluetooth communication module 804A can provide a Bluetooth communication solution including one or more of Bluetooth technologies, such as Basic Rate / Enhanced Data Rate (BR / EDR) or Bluetooth Low Energy (BLE). Electronic device 200 can establish a wireless communication connection with electronic device 100 through other wireless communication technologies and perform data interaction with electronic device 100 based on this wireless communication connection.
[0291] Optionally, the electronic device 200 may also include a display screen. Figure 8 (Not shown in the image), the display screen can be used to display images, videos, controls, text information, etc. The display screen may include a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a Mini LED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 200 may include one or N display screens 205, where N is a positive integer greater than 1.
[0292] Optionally, the electronic device 200 may include a touch sensor, which may also be referred to as a "touch device". The touch sensor may be disposed on the display screen, and the touch sensor and the display screen constitute a touch screen, which may also be referred to as a "touchscreen". The touch sensor can be used to detect touch operations applied to or near it.
[0293] Optionally, the electronic device 200 may also include an audio module. The electronic device 100 can implement audio functions through an audio module, speaker, receiver, microphone, and processor 801, such as music playback and recording.
[0294] An audio module is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. A loudspeaker, also called a "horn," is used to convert audio electrical signals into sound signals. A receiver, also called a "handset," is used to convert audio electrical signals into sound signals. A microphone, also called a "microphone" or "voice transducer," is used to convert sound signals into electrical signals.
[0295] Optionally, the electronic device 200 may include one or more physical buttons. These physical buttons can receive input from a user (e.g., pressing the physical button). In response to the input, the electronic device 200 can perform an operation corresponding to a control displayed on the screen corresponding to the physical button.
[0296] Optionally, the electronic device 200 may also include a USB interface, through which the electronic device 200 can establish a wired communication connection with the electronic device 100 and transmit data information to each other through the wired communication connection.
[0297] Understandable Figure 8 The electronic device 200 shown is merely one implementation of an embodiment of this application and does not constitute a specific limitation on the electronic device 200. For example, the electronic device 200 can be a smartwatch, which may also include a watch strap and a watch face. The watch face may include the aforementioned display screen for displaying images, videos, controls, text information, etc. The watch strap can be used to secure the electronic device 200 to the limbs for easy wearing. As another example, the electronic device 200 can be a Bluetooth headset, which may also include the aforementioned Bluetooth module 804A, a speaker, and a microphone. The Bluetooth module 804A can be used to transmit audio file data, the speaker can be used to play sound signals, and the microphone can be used to collect sound signals. In practical applications, the electronic device 200 may include more or fewer components than shown in the figure; this is not a limitation.
[0298] In one possible implementation, electronic devices 100 and 200 establish a third communication connection, and electronic devices 100 and 300 establish a fourth communication connection. The third communication connection uses a third communication protocol, and the fourth communication connection uses a fourth communication protocol, which are different from each other. Electronic device 200 can encapsulate its data into a data packet of the fourth communication protocol using the protocol stack of electronic device 100 and send the data to electronic device 300. Electronic device 100 can encapsulate the data sent from electronic device 300 to electronic device 200 into a data packet of the third communication protocol and send the data from electronic device 300 to electronic device 200. The third and fourth communication protocols can be any two different communication protocols; for example, if the third communication protocol is Bluetooth, the fourth communication protocol could be Wi-Fi. Thus, even if electronic device 200 does not support the fourth communication protocol or electronic device 300 does not support the third communication protocol, data can still be transmitted between electronic devices 200 and 300 through electronic device 100. In this context, electronic device 300 can be a server (e.g., a cloud server 300, or a single server, etc.), or it can be other electronic devices, such as a television, a computer, etc. For a detailed description of the data transmission between electronic device 100 and electronic device 300 via electronic device 100, please refer to the above embodiments, which will not be repeated here.
[0299] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of this application.
Claims
1. A transmission method, characterized in that, include: A first electronic device acquires first data from a first application, the first data including a first address parameter; The first electronic device obtains a first data structure based on the first data, the first data structure including a first address field, the first address field carrying the first address parameter; The first electronic device sends the first data structure to the second electronic device; After receiving the first data structure, the second electronic device obtains the first data based on the first data structure; The second electronic device obtains the second data from the third electronic device corresponding to the first address parameter based on the first data; The second electronic device obtains a second data structure based on the second data, the second data structure including the second data; The second electronic device sends the second data structure to the first electronic device; The first electronic device parses the second data structure to obtain the second data, which is then provided to the first application.
2. The method according to claim 1, characterized in that, The first data also includes a filename parameter; the method further includes: The first electronic device determines the value of the filename field of the first data structure based on the filename parameter, the filename field being used to indicate the file to which the second data belongs.
3. The method according to claim 1 or 2, characterized in that, The first data structure further includes an application identifier field, the value of which is the identifier of the first application; the second data structure also includes the application identifier field.
4. The method according to any one of claims 1-3, characterized in that, The second electronic device obtains second data from the third electronic device corresponding to the first address parameter based on the first data, specifically including: The second electronic device encapsulates the first data into a request message of the first communication protocol and sends the request message to the third electronic device to obtain the second data.
5. The method according to claim 4, characterized in that, The first communication protocol is an application layer protocol, which is either Hypertext Transfer Protocol or Simple Text Transfer Protocol.
6. The method according to claim 5, characterized in that, The first address parameter is a Uniform Resource Locator (URL) parameter, and the first communication protocol is Hypertext Transfer Protocol; or, the first address parameter is an Internet Protocol (IP) parameter, and the first communication protocol is Simple Text Transfer Protocol (SMT).
7. The method according to claim 6, characterized in that, The first data structure further includes a protocol identifier field, the value of which is used to indicate that the first communication protocol is a Hypertext Transfer Protocol or a Simple Text Transfer Protocol.
8. The method according to any one of claims 4-7, characterized in that, The first electronic device does not support the first communication protocol.
9. The method according to any one of claims 1-8, characterized in that, The method further includes: The second electronic device stores the first data structure and the second data, and when the second electronic device receives another data structure identical to the first data structure from the first electronic device, it directly sends the second data to the first electronic device; or, The second electronic device stores the first data and the second data, and when the second electronic device receives data identical to the first data from the first electronic device again, it directly sends the second data to the first electronic device.
10. The method according to any one of claims 1-9, characterized in that, The method further includes: Before the first electronic device sends the first data structure to the second electronic device, the first electronic device establishes a communication connection with the second electronic device; The first electronic device sends the first data structure to the second electronic device, specifically including: The first electronic device sends the first data structure to the second electronic device through the communication connection.
11. The method according to claim 10, characterized in that, The second electronic device sends the second data structure to the first electronic device, specifically including: The second electronic device sends data to the first electronic device via the communication connection.
12. The method according to any one of claims 1-11, characterized in that, The method further includes: The first electronic device acquires third data from the first application, the third data including a second address parameter and a file body parameter; The first electronic device obtains a third data structure based on the third data. The third data structure includes a second address field and a file body field. The second address field carries the second address parameter, and the file body field carries the file body parameter. The first electronic device sends the third data structure to the second electronic device; After receiving the third data structure, the second electronic device obtains the third data based on the third data structure; Based on the third data, the second electronic device sends the value of the file body parameter to the third electronic device corresponding to the second address parameter.
13. The method according to claim 12, characterized in that, After sending the value of the file body parameter to the third electronic device, the method further includes: The second electronic device receives fourth data sent by the third electronic device, the fourth data being used to indicate the reception status of the file body parameter value by the third electronic device; The second electronic device obtains a fourth data structure based on the fourth data, the fourth data structure including the fourth data; The second electronic device sends the fourth data structure to the first electronic device; The first electronic device parses the fourth data structure to obtain the fourth data, which is then provided to the first application.
14. The method according to claim 12 or 13, characterized in that, The first data includes first method parameters, and the third data includes second method parameters; the method further includes: The first electronic device determines the value of the first method field of the first data structure based on the first method parameters. The first method field is used to instruct the second electronic device to obtain the second data from the third electronic device. The first electronic device determines the value of the second method field of the third data structure based on the second method parameters. The second method field is used to instruct the second electronic device to send the value of the file body parameters to the third electronic device.
15. The method according to any one of claims 1-14, characterized in that, The first electronic device includes a transmission module; the first electronic device obtains a first data structure based on the first data, specifically including: The first electronic device processes the first data through the transmission module to obtain the first data structure.
16. The method according to any one of claims 1-15, characterized in that, The second electronic device includes a second application for controlling the first electronic device; The second electronic device, based on the second data, obtains a second data structure, specifically including: The second electronic device processes the second data through the second application to obtain the second data structure.
17. The method according to claim 16, characterized in that, The first electronic device is a smartwatch, and the second application is a sports and health application.
18. The method according to any one of claims 1-17, characterized in that, The first data format and the second data format conform to the Type-Length-Value (TLV) encoding method.
19. A transmission method, characterized in that, include: A first electronic device acquires first data from a first application, the first data including a first address parameter; The first electronic device obtains a first data structure based on the first data, the first data structure including a first address field, the first address field carrying the first address parameter; The first electronic device sends the first data structure to the second electronic device, and the first data carried in the first data structure is used by the second electronic device to obtain the second data from the third electronic device corresponding to the first address parameter; The first electronic device receives a second data structure from the second electronic device that includes the second data; The first electronic device parses the second data structure to obtain the second data, which is then provided to the first application.
20. The method according to claim 19, characterized in that, The first data also includes a filename parameter; the method further includes: The first electronic device determines the value of the filename field of the first data structure based on the filename parameter, the filename field being used to indicate the file to which the second data belongs.
21. The method according to claim 19 or 20, characterized in that, The first data structure also includes an application identifier field, the value of which is the identifier of the first application.
22. The method according to any one of claims 19-21, characterized in that, The first data structure further includes a protocol identifier field, the value of which is used to indicate that the first communication protocol is a Hypertext Transfer Protocol or a Simple Text Transfer Protocol.
23. The method according to any one of claims 19-22, characterized in that, The method further includes: Before the first electronic device sends the first data structure to the second electronic device, the first electronic device establishes a communication connection with the second electronic device; The first electronic device sends the first data structure to the second electronic device, specifically including: The first electronic device sends the first data structure to the second electronic device through the communication connection.
24. The method according to any one of claims 19-23, characterized in that, The method further includes: The first electronic device acquires third data from the first application, the third data including second address parameters and file body parameters; The first electronic device obtains a third data structure based on the third data. The third data structure includes a third address field and a file body field. The third address field carries a third address parameter, and the file body field carries the file body parameter. The first electronic device sends the third data structure to the second electronic device, and the third data carried in the third data structure is used by the second electronic device to send the value of the file body parameter to the third electronic device corresponding to the second address parameter.
25. The method according to claim 24, characterized in that, After the first electronic device sends the third data structure to the second electronic device, the method further includes: The first electronic device receives a fourth data structure from the second electronic device, the fourth data structure including fourth data, the fourth data being used to indicate the reception status of the file body parameter value received by the third electronic device; The first electronic device parses the fourth data structure to obtain the fourth data, which is then provided to the first application.
26. The method according to claim 24 or 25, characterized in that, The first data includes first method parameters, and the third data includes second method parameters; the method further includes: The first electronic device determines the value of the first method field of the first data structure based on the first method parameters. The first method field is used to instruct the second electronic device to obtain the second data from the third electronic device. The first electronic device determines the value of the second method field of the third data structure based on the second method parameters. The second method field is used to instruct the second electronic device to send the value of the file body parameters to the third electronic device.
27. A transmission method, characterized in that, include: The second electronic device receives a first data structure from the first electronic device. The first data structure includes a first address field, which carries a first address parameter of the first data of the first application. The second electronic device acquires the first data based on the first data structure; The second electronic device obtains the second data from the third electronic device corresponding to the first address parameter based on the first data; The second electronic device obtains a second data structure based on the second data, the second data structure including the second data, the second data being provided to the first application; The second electronic device sends the second data structure to the first electronic device.
28. The method according to claim 27, characterized in that, The second electronic device obtains second data from the third electronic device corresponding to the first address parameter based on the first data, specifically including: The second electronic device encapsulates the first data into a request message of the first communication protocol and sends the request message to the third electronic device to obtain the second data. The first electronic device does not support the first communication protocol.
29. The method according to claim 28, characterized in that, The first communication protocol is an application layer protocol, which includes Hypertext Transfer Protocol and Simple Text Transfer Protocol.
30. The method according to claim 29, characterized in that, The first address parameter is a Uniform Resource Locator (URL) parameter, and the first communication protocol is Hypertext Transfer Protocol; or, the first address parameter is an Internet Protocol (IP) parameter, and the first communication protocol is Simple Text Transfer Protocol (SMT).
31. The method according to claim 30, characterized in that, The first data structure further includes a protocol identifier field, the value of which is used to indicate that the first communication protocol is a Hypertext Transfer Protocol or a Simple Text Transfer Protocol.
32. The method according to any one of claims 27-31, characterized in that, The method further includes: The second electronic device stores the first data structure and the second data, and when the second electronic device receives another data structure identical to the first data structure from the first electronic device, it directly sends the second data to the first electronic device; or, The second electronic device stores the first data and the second data, and when the second electronic device receives data identical to the first data from the first electronic device again, it directly sends the second data to the first electronic device.
33. An electronic device, characterized in that, include: One or more processors and one or more memories; wherein the one or more memories are coupled to the one or more processors, and the one or more memories are used to store computer program code, the computer program code including computer instructions, which, when the one or more processors execute the computer instructions, cause the electronic device to perform the method as described in any one of claims 19-26 or 27-32.
34. A computer-readable storage medium comprising instructions, characterized in that, When the instructions are executed on an electronic device, the electronic device causes the electronic device to perform the method as described in any one of claims 19-26 or 27-32.
Citation Information
Patent Citations
Data transmission method and device
CN108111523A
Connection establishment method and electronic equipment
CN114697929A