Data processing method and device, electronic equipment and storage medium

By identifying information based on identifiers and using a predefined format for encapsulation and retransmission mechanisms during data interaction, the inefficiency of multiple interactions in existing technologies is solved, achieving more efficient data processing and transaction completion.

CN116648871BActive Publication Date: 2026-11-24GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202080105079.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-01
Publication Date
2026-11-24
Estimated Expiration
2040-12-01

AI Technical Summary

Technical Problem

In existing technologies, transactions that require at least two data interactions to complete, such as security authentication and OTA upgrades, lack a common processing flow, resulting in low efficiency.

Method used

First information is determined based on a first identifier and a second identifier, and this information is transmitted during message interaction. The first identifier represents the requested service, and the second identifier represents the execution action related to the service. The system allows the next message to be sent before a response message is received, and improves efficiency by using a set message format encapsulation and retransmission mechanism.

Benefits of technology

It improves data interaction and processing efficiency, reduces waiting time for responses, and enhances the speed and efficiency of transaction processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116648871B_ABST
    Figure CN116648871B_ABST
Patent Text Reader

Abstract

This application discloses a data processing method, apparatus, electronic device, and storage medium. The data processing method includes: a first electronic device determining first information based on a first identifier and a second identifier; the first identifier representing a requested service; the second identifier representing an execution action related to the service; the first information representing data to be sent to a second electronic device to complete the execution action; and transmitting the first information to the second electronic device during message interaction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communications, and more particularly to a data processing method, apparatus, electronic device, and storage medium. Background Technology

[0002] In related technologies, for transactions that require at least two data interactions to complete, such as security authentication and over-the-air (OTA) upgrades, there is no universal processing procedure applicable to different transactions. Summary of the Invention

[0003] To address the related technical problems, embodiments of this application provide a data processing method, apparatus, electronic device, and storage medium.

[0004] This application provides a data processing method applied to a first electronic device, the method comprising:

[0005] First information is determined based on a first identifier and a second identifier; the first identifier represents the requested service; the second identifier represents the execution action related to the service; the first information represents the data to be sent to the second electronic device to complete the execution action.

[0006] During message interaction with the second electronic device, the first information is transmitted to the second electronic device.

[0007] The method in the above scheme further includes:

[0008] Receive a first message sent by the second electronic device; wherein,

[0009] The first message carries the first identifier and the second identifier.

[0010] In the above scheme, the first message also carries a third identifier; the third identifier represents the input parameters.

[0011] In the above scheme, the first message also carries a transaction identifier.

[0012] In the above scheme, when determining the first information based on the first identifier and the second identifier, the method includes:

[0013] First information is determined based on the first identifier, the second identifier, and the third identifier; the third identifier represents the input parameters.

[0014] In the above scheme, the first information transmitted carries the transaction identifier.

[0015] In the above scheme, the transmitted first information carries the first identifier and the second identifier.

[0016] In the above scheme, determining the first information based on the first identifier and the second identifier includes: determining the first information based on the first identifier and the second identifier when both the first identifier and the second identifier are valid.

[0017] In the above scheme, transmitting the first information to the second electronic device during message interaction includes:

[0018] At least one second message is generated based on the first information; each of the at least one second message carries all or part of the data in the first information.

[0019] Send the at least one second message to the second electronic device.

[0020] In the above scheme, the second message is encapsulated according to the set first message format; wherein,

[0021] The defined first message format includes: a first field and a second field;

[0022] The first field is used to identify the data carried in the corresponding second message; the second field is used to carry the data.

[0023] In the above scheme, the first message format further includes a third field; wherein the third field is used to identify the total number of messages in the second message.

[0024] The method in the above scheme further includes:

[0025] The device receives a third message sent by the second electronic device; wherein the third message is used to respond to the received second message.

[0026] In the above scheme, the third message is encapsulated according to a set second message format; the set second message format includes a fourth field; the fourth field is used to identify the second message that the second electronic device has received.

[0027] In the above scheme, the set second message format further includes: a fifth field; the fifth field is used to identify the number of second messages that the second electronic device can cache.

[0028] In the above scheme, sending the at least one second message to the second electronic device includes:

[0029] Based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message, at least one of the at least one second messages is sent to the second electronic device.

[0030] In the above scheme, when the number of second messages that the second electronic device can cache is greater than or equal to the total number of the at least one second message, sending at least one of the at least one second message to the second electronic device includes:

[0031] All the second messages to be sent in the at least one second message are sent consecutively to the second electronic device.

[0032] In the above scheme, when the number of second messages that the second electronic device can cache is less than the total number of the at least one second message, but greater than 1, sending at least one of the at least one second message to the second electronic device includes:

[0033] The first number of second messages to be sent from the at least one second message is continuously sent to the second electronic device; wherein the first number is less than or equal to the number of second messages that the second electronic device can cache, and is greater than 1.

[0034] In the above scheme, when sending the at least one second message to the second electronic device, the method includes:

[0035] Based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message, at least one of the at least one second messages is retransmitted to the second electronic device.

[0036] In the above scheme, when the fourth field in the third message is used to identify the second message most recently received by the second electronic device, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the at least one received third message and the field value of the first field in the at least one sent second message includes:

[0037] Based on the field values ​​of the fourth field in all received third messages and the field values ​​of the first field in all sent second messages, the second message that the second electronic device did not receive is determined.

[0038] In the above scheme, when the fourth field in the third message is used to identify all second messages that the second electronic device has received where the field value of the first field is less than or equal to the field value of the fourth field, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message includes:

[0039] Based on the field value of the fourth field in the most recently received third message and the field value of the first field in the most recently sent second message, the second message that the second electronic device did not receive is determined.

[0040] The method in the above scheme further includes:

[0041] A fourth message is sent to the second electronic device; the fourth message is used to identify that the second electronic device has received all the second messages.

[0042] This application also provides a data processing apparatus, including:

[0043] The determining unit is configured to determine first information based on a first identifier and a second identifier; the first identifier represents a requested service; the second identifier represents an execution action related to the service; and the first information represents the data to be sent to a second electronic device to complete the execution action.

[0044] The message interaction unit is configured to transmit the first information to the second electronic device during message interaction with the second electronic device.

[0045] This application also provides an electronic device, including: a processor and a memory for storing a computer program capable of running on the processor.

[0046] Wherein, when the processor is used to run the computer program, it implements any of the above-mentioned data processing methods.

[0047] This application also provides a storage medium storing a computer program thereon, which, when executed by a processor, implements any of the above-described data processing methods.

[0048] In this embodiment, a first identifier represents the requested service, and a second identifier represents the execution action related to the service. During message interaction between the first electronic device and the second electronic device, the first electronic device carries first information determined based on the first and second identifiers in the interaction message. This data processing method can be applied to different transactions that require at least two data interactions to complete. After sending a message, the first electronic device does not need to wait for a corresponding response message before sending the next message, which can improve data interaction efficiency and data processing efficiency. Attached Figure Description

[0049] Figure 1 An interactive diagram illustrating a data processing method provided in an embodiment of this application;

[0050] Figure 2 This is a schematic diagram illustrating the implementation flow of transmitting first information in a data processing method provided in an embodiment of this application;

[0051] Figure 3 An interaction diagram of a data processing method provided in another embodiment of this application;

[0052] Figure 4 An interactive diagram illustrating a data processing method provided in an application embodiment of this application;

[0053] Figure 5 This is a schematic diagram of the structure of the data processing apparatus provided in the embodiments of this application;

[0054] Figure 6 This is a schematic diagram of the hardware composition structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0055] In related technologies, different transactions that require at least two data interactions to complete, such as security authentication, key negotiation, and OTA upgrades, typically correspond to different processing procedures. There is no universal processing procedure applicable to different transactions that require at least two data interactions to complete. The OTA upgrade method is as follows:

[0056] An electronic device sends an upgrade request carrying version information to a server. Based on the version information in the received upgrade request, the server determines the corresponding upgrade package, encapsulates the upgrade package into multiple data packets, and sends each data packet corresponding to the upgrade package to the electronic device. During the process of the server sending the data packets corresponding to the upgrade package to the electronic device, the electronic device sends a corresponding response message or acknowledgment message upon receiving the first data packet from the server. This response message or acknowledgment message indicates that the corresponding data packet has been received. If the server receives the response message from the electronic device, it sends a second data packet to the electronic device; if the server does not receive a response message from the electronic device, it retransmits the first data packet. After sending all the data packets corresponding to the upgrade package to the electronic device, the server sends a corresponding notification message to the electronic device. Upon receiving this notification message, the electronic device sends a response message corresponding to the notification message to the server.

[0057] To address the aforementioned technical problems, this application provides a data processing method that determines first information based on a first identifier and a second identifier; and transmits the first information to a second electronic device through message interaction. This data processing method can be applied to different transactions that require at least two data interactions to complete. The first identifier represents the requested service; the second identifier represents the execution action related to the service; and the first information represents the data to be sent to the second electronic device to complete the execution action.

[0058] The technical solution of this application will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0059] Figure 1 An interactive diagram of a data processing method provided in an embodiment of this application is shown. (Refer to...) Figure 1 The data processing method in this embodiment includes:

[0060] S101: The first electronic device determines first information based on the first identifier and the second identifier; the first identifier represents the requested service; the second identifier represents the execution action related to the service; the first information represents the data to be sent to the second electronic device to complete the execution action.

[0061] Here, an action is the completion of a specific behavior. Compared to attributes and events, actions offer greater freedom and can accomplish more complex logic. In practical applications, service-related actions may include at least one of the following: sending a file, taking a photo, and flashing lights.

[0062] The first identifier can correspond to either a Service Instance ID (SIID) or an application layer service identifier. The service instance is used to implement the corresponding service, and the application layer service is used to provide the corresponding service, which includes at least one of OTA upgrades, security authentication, and key negotiation.

[0063] The second identifier can be an instance identifier (IID), used to identify the instance corresponding to the application layer service. This instance represents the execution action related to the service corresponding to the first identifier. In practical applications, an instance can include at least one of the following: an OTA upgrade instance, a security authentication instance, or a negotiated key instance.

[0064] It should be noted that one first identifier corresponds to at least one second identifier. Different second identifiers corresponding to the same first identifier represent different execution actions related to the service corresponding to that first identifier.

[0065] When the first identifier indicates that the requested service corresponds to an OTA upgrade, and the first electronic device is the device requesting the OTA upgrade service, the first information may include information such as the identifier and version number of the object to be upgraded; the object to be upgraded includes applications and firmware in the first electronic device. Firmware refers to a program written into an erasable programmable read-only memory (EPROM) or electrically erasable programmable read-only memory (EEPROM) of an electronic device. When the first electronic device is a server providing OTA upgrade services, the first information includes the corresponding upgrade package, which is determined based on the identifier and version number of the object to be upgraded.

[0066] When the service corresponding to the first identifier representation request is security authentication, the first information includes the relevant data that the first electronic device needs to send to the second electronic device for security authentication.

[0067] In one embodiment, determining the first information based on the first identifier and the second identifier includes:

[0068] First information is determined based on the first identifier, the second identifier, and the third identifier; the third identifier represents the input parameters.

[0069] Here, upon acquiring the first identifier, the second identifier, and the third identifier, the first electronic device determines the first information based on the first identifier, the second identifier, and the third identifier. The third identifier can be an InParameter, representing the input parameters corresponding to the requested service.

[0070] S102: During the message interaction between the first electronic device and the second electronic device, the first electronic device transmits the first information to the second electronic device.

[0071] Here, the first electronic device can encapsulate the first information into at least one message and transmit the at least one message to the second electronic device. This message carries some or all of the data in the first information. The first electronic device can continuously send all messages corresponding to the first information to the second electronic device.

[0072] When the first information is encapsulated into at least two messages, the first electronic device can also send all messages from the at least two messages to the second electronic device in batches. Each batch contains at least one message. When each batch contains at least two messages, the first electronic device sends all messages from each batch continuously to the second electronic device. When all messages included in the first information are sent in at least two batches, the first electronic device sends all messages from the at least two messages in the first batch continuously to the second electronic device. Upon receiving an acknowledgment message from the second electronic device regarding the first batch of messages, the first electronic device then sends the at least one message corresponding to the first information to the second electronic device. This acknowledgment message indicates that the second electronic device has received the at least one message corresponding to the first information and is used to respond to the received at least one message corresponding to the first information. In practical applications, this acknowledgment message corresponds to an Ack message.

[0073] It should be noted that during the process of the first electronic device interacting with the second electronic device and transmitting the first information to the second electronic device, when the first electronic device receives any confirmation message sent by the second electronic device indicating that it has not fully received all the data corresponding to the first information sent by the first electronic device, it determines the corresponding lost data from the first information based on the identifier of the received data indicated by the confirmation message sent by the second electronic device, and resends the determined lost data to the second electronic device.

[0074] In the solution provided in this embodiment, a first identifier represents the requested service, and a second identifier represents the execution action related to the service. During message interaction between the first electronic device and the second electronic device, the first electronic device carries first information determined based on the first and second identifiers through the interaction message. This data processing method can be applied to different transactions that require at least two data interactions to complete. After sending a message, the first electronic device does not need to wait for a corresponding response message before sending the next message, which can improve data interaction efficiency and data processing efficiency.

[0075] Figure 2This illustration shows a schematic diagram of the implementation flow of transmitting first information in a data processing method provided in an embodiment of this application. (Refer to...) Figure 2 The step of transmitting the first information to the second electronic device during message interaction includes:

[0076] S201: Generate at least one second message based on the first information; each of the at least one second message carries all or part of the data in the first information.

[0077] In one embodiment, each second message carries a transaction ID sent by the second electronic device, so that the second electronic device can determine the corresponding first and second identifiers based on the established correspondence between the transaction ID, the first identifier, and the second identifier.

[0078] In one embodiment, each second message may also carry a first identifier and a second identifier from the first message sent by the second electronic device.

[0079] In one embodiment, the second message is encapsulated according to a set first message format; wherein the set first message format includes: a first field and a second field; the first field is used to identify the data carried in the corresponding message; the second field is used to carry the data.

[0080] In practical applications, the first field corresponds to Seq, and the second field corresponds to Payload. The value of the first field in the second message is the sequence number of the data carried in the corresponding second field. The value of the first field in the second message is used by the second electronic device to concatenate the data carried in the second fields of all the second messages to obtain the first information, based on the value of the first field in each second message. Here, the values ​​of the first field in different second messages are consecutive and increasing.

[0081] In practical applications, Seq can be incremented from 0 by 1, and when Seq reaches (2^32-1), the Seq for the next valid message will be 0. Alternatively, Seq can be incremented from 1 by 1, and when Seq reaches 2^32, the Seq for the next valid message will be 1. A valid message is a message that carries data.

[0082] In one embodiment, the defined first message format further includes a third field; wherein the third field is used to identify the total message count of the second message. The third field corresponds to messageNum.

[0083] Here, the first electronic device encapsulates the first information into at least one second message according to a set first message format. Here, when the number of bits occupied by the first information exceeds the maximum number of bits that the second field of the set first message format can carry, the first information is encapsulated into at least two second messages. The data carried by all the second messages in the at least two second messages constitutes the complete data of the first information, and the number of bits occupied by the data in the second field of each second message is less than or equal to the maximum number of bits that the second field of the set first message format can carry. The second message can be labeled as ActionMessage.

[0084] Since the second field in the second message contains data, the second message is a valid message.

[0085] It should be noted that the set first message format may also include at least one of a fourth field and a fifth field. The fourth field is used to identify valid messages already received by the first electronic device; the fifth field is used to identify the number of valid messages that the first electronic device can currently cache; and the fifth field is used by the second electronic device to determine the total number of valid messages that can be continuously sent to the first electronic device. Specifically, when the set first message format also includes a fourth field, the value of the fourth field in each second message is determined based on the sequence number of the last valid message sent by the second electronic device that the first electronic device received.

[0086] It should be noted that when encapsulating the second message according to the set first message format, the fields included in the set first message format can be determined from the first field, the second field, the third field, and the fourth field according to the actual situation.

[0087] S202: Send the at least one second message to the second electronic device.

[0088] Here, when the total number of all second messages generated based on the first information is greater than or equal to 1, the first electronic device can continuously send at least two of the generated second messages to the second electronic device.

[0089] In practical applications, the first electronic device can continuously send second messages to the second electronic device. After sending all the second messages, based on the third message sent by the second electronic device, it is determined whether the second electronic device has received all the second messages sent by the first electronic device. If the second electronic device has not received all the second messages sent by the first electronic device, based on the field values ​​of the first field in the received third message and the sent second messages, the unreceived second messages are determined, and the determined second messages are retransmitted to the second electronic device. The third message is used for the second electronic device to respond to the received second messages. When the number of unreceived second messages by the second electronic device is greater than one, the first electronic device can continuously send all the determined second messages to the second electronic device.

[0090] It should be noted that, during the continuous transmission of second messages to the second electronic device, if the first electronic device receives a third message from the second electronic device, it can, based on the third message, determine the second message that the second electronic device has not received from the already transmitted second messages, retransmit the determined second message, and continuously transmit the untransmitted second message corresponding to the first information to the second electronic device. Alternatively, the first electronic device can, after sending a second message to the second electronic device, wait to receive a third message from the second electronic device, and then send another second message upon receiving the third message; if it has sent a second message to the second electronic device but has not received a third message, it can retransmit the most recently sent second message to the second electronic device.

[0091] It should be noted that when the first electronic device sets the number of second messages that the second electronic device can cache during the initialization process, the first electronic device can continuously send at least two second messages to the second electronic device when sending the at least one second message to the second electronic device; the first electronic device can also send at least one of the at least one second message to the second electronic device based on the number of second messages that the second electronic device can cache.

[0092] Here, when the first electronic device sends at least one of the at least one second message to the second electronic device based on the number of second messages that the second electronic device can cache, if the number of second messages that the second electronic device can cache is equal to 1, the first electronic device sends one second message to the second electronic device each time, and the second electronic device needs to respond to each second message sent by the first electronic device; if the number of second messages that the second electronic device can cache is greater than 1, and the total number of all second messages corresponding to the first information is greater than 1, the first electronic device can send at least two second messages to the second electronic device consecutively, and the second electronic device can respond to each second message received; alternatively, if at least two second messages are received, the first electronic device can respond to the at least two consecutively received second messages. Wherein, the total number of second messages that the first electronic device consecutively sends to the second electronic device is less than or equal to the number of second messages that the second electronic device can cache.

[0093] In practical applications, when the number of second messages that the second electronic device can cache is greater than or equal to the total number of second messages corresponding to the first information, the first electronic device can continuously send all second messages to the second electronic device, thereby transmitting all second messages corresponding to the first information to the second electronic device. Here, the total number of second messages corresponding to the first information refers to the total number of second messages generated based on the first information.

[0094] If the number of second messages that the second electronic device can cache is less than the total number of all second messages corresponding to the first information, but greater than 1, the first electronic device can continuously send at least two second messages corresponding to the first information to the second electronic device.

[0095] In the solution provided in this embodiment, the first information is encapsulated into at least one second message according to the set first message format. When there are at least two second messages corresponding to the first information, the first electronic device can continuously send at least two second messages carrying the data of the first information to the second electronic device. That is, after sending a second message, it is not necessary to wait for the response message corresponding to the second message before sending the next second message, thereby improving the interaction efficiency and message transmission efficiency.

[0096] In one embodiment, the third message received by the first electronic device is encapsulated according to a predefined second message format; the predefined second message format includes a fourth field; the fourth field is used to identify the second message that the second electronic device has received. In practical applications, the fourth field corresponds to Ack.

[0097] In one embodiment, the defined second message format further includes a fifth field; the fifth field is used to identify the number of second messages that the second electronic device can cache. In practical applications, the fifth field corresponds to Win.

[0098] In one embodiment, when a first electronic device receives a third message sent by a second electronic device, and the third message includes a fifth field, sending the at least one second message to the second electronic device includes:

[0099] Based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message, at least one of the at least one second messages is sent to the second electronic device.

[0100] Here, when the first electronic device sends at least one second message to the second electronic device, it receives a third message sent by the second electronic device; based on the field value of the fourth field in the received third message and the field value of the first field in the sent second message, it determines the second message that the second electronic device has not received; and determines the second message that the second electronic device has not received and the second message that the first electronic device has not sent as the second message to be sent.

[0101] Upon determining that a second message is to be sent, the first electronic device, based on the number of second messages that the second electronic device can cache, as indicated by the fifth field in the received third message, sends at least one second message to the second electronic device. The second message to be sent includes at least one of the following:

[0102] The first message corresponds to the unsent second message;

[0103] The second message was not received by the second electronic device.

[0104] In practical applications, the first electronic device can send at least one unsent second message to the second electronic device based on the field value of the fifth field in the received third message, or resend at least one second message to the second electronic device.

[0105] In one embodiment, when the number of second messages that the second electronic device can cache is greater than or equal to the total number of the at least one second message, sending at least one of the at least one second message to the second electronic device includes:

[0106] All the second messages to be sent in the at least one second message are sent consecutively to the second electronic device.

[0107] Here, since the fifth field in the third message indicates that the number of second messages that the second electronic device can currently cache is greater than or equal to the total number of all second messages generated based on the first information, the first electronic device will continuously send all the second messages to be sent in the second messages generated based on the first information to the second electronic device to improve message transmission efficiency.

[0108] In one embodiment, when the number of second messages that the second electronic device can cache is less than the total number of the at least one second message, but greater than 1, sending at least one of the at least one second message to the second electronic device includes:

[0109] The first number of second messages to be sent from the at least one second message is continuously sent to the second electronic device; wherein the first number is less than or equal to the number of second messages that the second electronic device can cache, and is greater than 1.

[0110] Here, when the number of messages that the second electronic device can currently cache is less than the total number of messages of all second messages generated based on the first information, at least one second message of the first number of second messages to be sent will be continuously sent to the second electronic device.

[0111] In one embodiment, when sending the at least one second message to the second electronic device, the method includes:

[0112] Based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message, at least one of the at least one second messages is retransmitted to the second electronic device.

[0113] Here, the first electronic device determines all second messages that the second electronic device has not received based on the field value of the fourth field in at least one received third message and the field value of the first field in at least one sent second message.

[0114] If it is determined that all second messages not received by the second electronic device are not received, and the third message includes a fourth field, the first electronic device may continuously send all the second messages not received by the second electronic device to the second electronic device.

[0115] If it is determined that all second messages not received by the second electronic device, and the third message includes a fourth field and a fifth field, the first electronic device may retransmit all the second messages not received by the second electronic device to the second electronic device based on the number of second messages that the second electronic device can cache, as indicated by the fifth field of the third message. The method for retransmitting all the second messages not received by the second electronic device based on the number of second messages that the second electronic device can cache, please refer to the relevant description above regarding sending at least one of at least one second message to the second electronic device based on the number of second messages that the second electronic device can cache, as indicated by the fifth field of the third message.

[0116] For example, when the fifth field Win = 1 and the fourth field Ack = 2 in the third message most recently received by the first electronic device, the first electronic device determines that the second electronic device has received a second message in which the field value of the first field is represented as 2; when the field value of the first field in the second message most recently sent by the first electronic device is represented as 3, the first electronic device retransmits a valid message in which the field value of the first field is 3 to the second electronic device.

[0117] For example, when the fifth field Win = 5 and the fourth field Ack = 3 in the third message most recently received by the first electronic device, the first electronic device determines that the second electronic device has received a second message in which the field values ​​of the first field are represented as 1, 2, and 3 respectively; when the field value of the first field in the second message most recently sent by the first electronic device is represented as 5, the first electronic device retransmits a second message in which the field values ​​of the first field are represented as 4 and 5 to the second electronic device.

[0118] In practical applications, the method for determining all second messages that the second electronic device has not received is as follows:

[0119] When the second electronic device responds to each second message sent by the first electronic device, the third message is used to identify the most recently received second message. The first electronic device determines which second messages the second electronic device has not received based on the values ​​of the fourth field in all received third messages and the values ​​of the first field in all sent second messages. Specifically, the values ​​of the first field in the second messages not received by the second electronic device are different from the values ​​of the fourth field in all third messages.

[0120] When the second electronic device responds to at least two consecutive second messages sent by the first electronic device, the third message is used to identify all second messages received by the second electronic device where the value of the first field is less than or equal to the value of the fourth field in the third message. If the first electronic device determines that the value of the fourth field in the most recently received third message differs from the value of the first field in the most recently sent second message, the first electronic device determines the second messages it has not received based on the value of the fourth field in the most recently received third message and the value of the first field in the most recently sent second message. Specifically, the value of the first field in the second messages not received by the second electronic device is greater than the value of the fourth field in the most recently received third message.

[0121] In one embodiment, where the fourth field in the third message is used to identify the most recently received second message by the second electronic device, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the at least one received third message and the field value of the first field in the at least one sent second message includes:

[0122] Based on the field values ​​of the fourth field in all received third messages and the field values ​​of the first field in all sent second messages, the second message that the second electronic device did not receive is determined.

[0123] In practical applications, when the second electronic device responds to each second message sent by the first electronic device, and the first electronic device continuously sends at least two second messages to the second electronic device, the third message is used to identify the most recently received second message by the second electronic device. The value of the fourth field in the third message is the same as the value of the first field in the most recently received second message by the second electronic device. The first electronic device determines whether the second electronic device has received all the second messages sent by the first electronic device based on the values ​​of the fourth field in all received third messages and the values ​​of the first field in all sent second messages. Specifically, when the values ​​of the fourth field in all received third messages are the same as the values ​​of the first field in all sent second messages, it indicates that the second electronic device has received all the second messages sent by the first electronic device. When the values ​​of the fourth field in all received third messages are different from the values ​​of the first field in all sent second messages, it indicates that the second electronic device has not received all the second messages sent by the first electronic device, and the first electronic device determines the second messages that it has not received based on the values ​​of the fourth field in all received third messages and the values ​​of the first field in all sent second messages. The field value of the first field in the second message that the second electronic device did not receive is different from the field value of the fourth field in all third messages.

[0124] When the second electronic device responds to each second message sent by the first electronic device, and the first electronic device sends one second message to the second electronic device each time, the third message is used to identify the most recently received second message by the second electronic device. If the value of the fourth field in the most recently received third message is the same as the value of the first field in the most recently sent second message, it indicates that the second electronic device has received all the second messages sent by the first electronic device. If the value of the fourth field in the most recently received third message is different from the value of the first field in the most recently sent second message, it indicates that the second electronic device has not received all the second messages sent by the first electronic device, and the first electronic device determines the most recently sent second message as a second message that the second electronic device has not received.

[0125] In one embodiment, where the fourth field in the third message is used to identify all second messages received by the second electronic device where the field value of the first field is less than or equal to the field value of the fourth field, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the at least one second message that has been sent, includes:

[0126] Based on the field value of the fourth field in the most recently received third message and the field value of the first field in the most recently sent second message, the second message that the second electronic device did not receive is determined.

[0127] In practical applications, when a second electronic device responds to at least two consecutive second messages sent by a first electronic device, a third message is used to identify all second messages received by the second electronic device where the value of the first field is less than or equal to the value of the fourth field in the third message. If the first electronic device determines that the value of the fourth field in the most recently received third message differs from the value of the first field in the most recently sent second message, the first electronic device determines the value of the first field in the second messages already received by the second electronic device based on the value of the fourth field in the most recently received third message; based on the value of the first field in the most recently sent second message and the value of the first field in the second messages already received by the second electronic device, it determines the value of the first field in the second messages not received by the second electronic device, and then retransmits the second message corresponding to the determined value of the first field to the second electronic device. Wherein, the value of the first field in the second messages not received by the second electronic device is greater than the value of the fourth field in the most recently received third message. The first electronic device can consecutively send at least two unreceived second messages to the second electronic device.

[0128] It should be noted that the technical solutions described in the various embodiments of this application can be combined arbitrarily without conflict.

[0129] In the solution provided in this embodiment, the first electronic device sends at least one of the at least one second message to the second electronic device based on the number of second messages that the second electronic device can cache, as indicated by the fifth field in the third message. This avoids the situation where the first electronic device needs to resend the corresponding second message because the second electronic device cannot cache the second message sent by the first electronic device, thereby saving power consumption of the first electronic device. When the number of second messages that the second electronic device can cache is greater than 1, the first electronic device can continuously send at least two unsent second messages to the second electronic device, or continuously send at least two second messages that the second electronic device has not received, thereby improving the transmission efficiency of the second messages.

[0130] Figure 3 An interactive diagram of a data processing method provided in an embodiment of this application is shown. (Refer to...) Figure 3 The data processing method in this embodiment includes:

[0131] S301: The second electronic device sends a first message to the first electronic device; the first message carries a first identifier and a second identifier.

[0132] The first identifier represents the requested service; the second identifier represents the execution action related to the service.

[0133] In one embodiment, the first message also carries a third identifier; the third identifier represents the input parameters.

[0134] In one embodiment, the first message also carries a transaction identifier. The transaction identifier, the first identifier, and the second identifier have a corresponding relationship; that is, the second electronic device can determine the corresponding first identifier and second identifier based on the transaction identifier. Here, a transaction refers to the entire process of handling a single event. For example, "the entire execution process of a service-related action," "the entire reading process of reading a certain state of a device," or "the entire sending process of sending a file to a device." The first message is a message sent when the second electronic device interacts with the first electronic device.

[0135] In practical applications, the first message can be a startup message, for example, the first message can be ActionStart or ActionCall.

[0136] It should be noted that, after both the first and second electronic devices have completed initialization, the second electronic device sends a first message to the first electronic device. Among these,

[0137] During the initialization process, the first and second electronic devices can initialize the following parameters:

[0138] LocalSeq, LocalAck, LocalWin; RemoteSeq, RemoteAck, RemoteWin.

[0139] When the first electronic device initializes the above parameters, LocalSeq is used to identify valid messages sent by the first electronic device; LocalAck is used to identify valid messages received by the first electronic device; LocalWin represents the number of valid messages that the first electronic device can currently cache, and is used to identify the total number of valid messages that the second electronic device can continuously send to the first electronic device; RemoteSeq is used to identify valid messages sent by the second electronic device; RemoteAck is used to identify valid messages received by the second electronic device; RemoteWin represents the number of valid messages that the second electronic device can currently cache, and is used to identify the total number of valid messages that the first electronic device can continuously send to the second electronic device. For example, when RemoteWin = 14, it means that the first electronic device can currently continuously send 14 valid messages to the second electronic device. Valid messages represent messages carrying data.

[0140] When the second electronic device initializes the above parameters, LocalSeq is used to identify valid messages sent by the second electronic device; LocalAck is used to identify valid messages received by the second electronic device; LocalWin represents the number of valid messages that the second electronic device can currently cache, and is used to identify the total number of valid messages that the first electronic device can continuously send to the second electronic device; RemoteSeq is used to identify valid messages sent by the first electronic device; RemoteAck is used to identify valid messages received by the first electronic device; RemoteWin represents the number of valid messages that the first electronic device can currently cache, and is used to identify the total number of valid messages that the second electronic device can continuously send to the first electronic device.

[0141] It should be noted that during the initialization process, LocalSeq, LocalAck, RemoteSeq, and RemoteAck are all set to 0; the field values ​​of LocalWin and RemoteWin can be greater than or equal to 2.

[0142] S302: Upon receiving the first message, the first electronic device determines first information. This first information represents the data that needs to be sent to the second electronic device to complete the execution action.

[0143] In practical applications, when the first message carries a first identifier and a second identifier, the first electronic device determines the first information based on the first identifier and the second identifier.

[0144] In practical applications, when the first message carries a first identifier, a second identifier, and a third identifier, the first electronic device determines the first information based on the first identifier, the second identifier, and the third identifier.

[0145] In one embodiment, when the first electronic device receives the first message, determining the first information may include: determining the first information when both the first identifier and the second identifier are valid.

[0146] In practical applications, the first electronic device determines the first information based on the first and second identifiers when it confirms that both the first identifier and the second identifier are valid; or it determines the first information based on the first identifier, the second identifier, and the third identifier.

[0147] Here, when the first electronic device receives the first identifier and the second identifier sent by the second electronic device, it verifies the first identifier and the second identifier sent by the second electronic device based on the set first identifier and the set second identifier, and obtains the verification result.

[0148] Specifically, when the first electronic device finds a first identifier that is the same as or matches the first identifier sent by the second electronic device from the set first identifiers, the first identifier sent by the second electronic device is valid; when the first electronic device finds a first identifier that is different from or does not match the first identifier sent by the second electronic device, the first identifier sent by the second electronic device is invalid. When the first electronic device finds a second identifier that is the same as or matches the second identifier sent by the second electronic device from the set second identifiers, the second identifier sent by the second electronic device is valid; when the first electronic device finds a second identifier that is different from or does not match the second identifier sent by the second electronic device, the second identifier sent by the second electronic device is invalid. When the first electronic device has no right to access the second identifier, or the value corresponding to the second identifier is invalid, the second identifier sent by the second electronic device is invalid.

[0149] If the verification result indicates that both the first identifier and the second identifier sent by the second electronic device are valid, the first information is determined based on the first identifier and the second identifier.

[0150] If the verification result indicates that both the first and second identifiers sent by the second electronic device are valid, and the first, second, and third identifiers are obtained, the first information is determined based on the first, second, and third identifiers.

[0151] If the verification result indicates that either the first identifier or the second identifier sent by the second electronic device is invalid, the data processing flow ends.

[0152] If the verification result indicates that either the first identifier or the second identifier sent by the second electronic device is invalid, the data processing flow ends.

[0153] In practical applications, the first electronic device can also respond to the first message sent by the second electronic device after confirming that both the first and second identifiers sent by the second electronic device are valid. For example, after receiving the ActionStart sent by the second electronic device and confirming that both the first and second identifiers carried in ActionStart are valid, the first electronic device sends an ActionMessage. This ActionMessage is used to respond to ActionStart, indicating that ActionStart has been received. The ActionMessage used to respond to ActionStart may or may not carry data. When the ActionMessage received by the second electronic device does not carry data, the second electronic device does not need to respond to the ActionMessage; when the ActionMessage received by the second electronic device carries data, the second electronic device needs to respond to the ActionMessage.

[0154] S303: The first electronic device generates at least one second message based on the first information; each of the at least one second message carries all or part of the data in the first information.

[0155] In one embodiment, each second message carries a transaction identifier from the first message sent by the second electronic device, so that the second electronic device can determine the corresponding first identifier and second identifier.

[0156] In one embodiment, each second message may also carry a first identifier and a second identifier from the first message sent by the second electronic device.

[0157] In one embodiment, the second message is encapsulated according to a set first message format; wherein the set first message format includes: a first field and a second field; the first field is used to identify the data carried in the corresponding message; the second field is used to carry the data.

[0158] Here, the implementation method of the first electronic device generating at least one second message based on the first information is described in the relevant description in S201 above, and will not be repeated here.

[0159] S304: The first electronic device sends at least one second message to the second electronic device.

[0160] Here, the method for the first electronic device to send at least one second message to the second electronic device is described in S202, and will not be repeated here.

[0161] S305: The second electronic device sends a third message to the first electronic device; wherein the third message is used to respond to the received second message.

[0162] Here, the third message sent by the second electronic device is used to respond to at least one of the received second messages.

[0163] In one embodiment, the third message is encapsulated according to a predefined second message format; the predefined second message format includes a fourth field; the fourth field is used to identify the second message that the second electronic device has received. In practical applications, the fourth field corresponds to Ack.

[0164] In practical applications, the second electronic device can respond to each received second message; that is, it sends a third message to the first electronic device every time it receives a second message. In this case, the third message identifies the most recently received second message; the value of the fourth field in the third message is the same as the value of the first field in the most recently received second message.

[0165] The second electronic device can also respond to at least two consecutively received second messages. In this case, the third message is used to identify all second messages received by the second electronic device in which the value of the first field is less than or equal to the value of the fourth field in the third message. For example, if the value of the fourth field in the third message sent by the second electronic device is 5, the third message is used to identify all second messages received by the second electronic device in which the value of the first field is represented as 1, 2, 3, 4, or 5.

[0166] In one embodiment, the set second message format further includes a fifth field; the fifth field is used to identify the number of second messages that the second electronic device can cache.

[0167] In practical applications, the fifth field corresponds to Win. The fifth field is used by the first electronic device to determine the number of second messages that can be continuously sent to the second electronic device. The number of valid messages that the second electronic device can cache can be determined based on the corresponding cache space and the maximum number of bits occupied by a single valid message. The number of currently cacheable valid messages, represented by the fifth field, is dynamically updated as the processing progress of valid messages progresses. For example, the second electronic device updates the number of currently cacheable valid messages in real time after processing at least one cached valid message. When the second electronic device responds to a received second message, the value of the fifth field in the third message sent to the first electronic device represents the updated number of cacheable valid messages.

[0168] In one embodiment, if the fifth field in the third message identifies that the number of second messages that the second electronic device can cache is equal to 1, the fourth field in the third message can be used to identify the second message most recently received by the second electronic device;

[0169] When the fifth field in the third message indicates that the number of second messages that the second electronic device can cache is greater than 1, the fourth field in the third message can be used to identify all second messages that the second electronic device has received where the field value of the first field is less than or equal to the field value of the third field; the fourth field in the third message can also be used to identify the second message that the second electronic device has received most recently.

[0170] Here, when the value of the fifth field in the third message is equal to 1, it indicates that the number of second messages that the second electronic device can cache is 1, and the value of the fourth field in the third message is the same as the value of the first field in the second message most recently received by the second electronic device. When the value of the fifth field in the third message is greater than 1, it indicates that the number of second messages that the second electronic device can cache is greater than 1, and the value of the fourth field in the third message cannot overwrite the value of the first field in a second message that has not been received. For example, if the first electronic device sends 5 second messages to the second electronic device consecutively, and the values ​​of the first fields of the 5 second messages represent 1, 2, 3, 4, and 5 respectively, and the second electronic device receives second messages from the first electronic device with the values ​​of the first fields representing 1, 2, 3, and 5 respectively, since the second electronic device has not received a second message with the value of 4 in the first field, when the second electronic device responds to the second messages sent by the first electronic device, the second electronic device can send one third message or four third messages to the first electronic device. Specifically, when the second electronic device sends a third message to the first electronic device, the value of the fourth field in the corresponding third message is 3, which is used to indicate that the second electronic device has received all second messages sent by the first electronic device in which the value of the first field is less than or equal to 3; when the second electronic device sends four third messages to the first electronic device, the values ​​of the fourth field in the four third messages are 1, 2, 3 and 5 respectively.

[0171] In practical applications, when Win=1 and Ack=2 in the third message sent by the second electronic device to the first electronic device, it indicates that the second electronic device has received a second message in which the field value of the first field is represented as 2.

[0172] When Win=3 and Ack=3 in the third message sent by the second electronic device to the first electronic device, it can represent that the second electronic device has received a second message in which the field value of the first field is represented as 1 to 3, or it can represent that the second electronic device has received a second message in which the field value of the first field is represented as 3.

[0173] It should be noted that when the number of second messages that the second electronic device can cache is equal to one, the second electronic device responds to each received second message. When the number of second messages that the second electronic device can cache is greater than one, the second electronic device can respond to each received second message or respond to at least two received second messages. When the second electronic device responds to at least two received second messages, it does not need to respond to each valid message, which can improve message transmission efficiency.

[0174] S306: The first electronic device receives a third message sent by the second electronic device.

[0175] Here, the first electronic device determines whether the second electronic device has received all the second messages sent by the first electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message. For the specific implementation method, please refer to the above description of retransmitting the relevant description in at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message. It will not be repeated here.

[0176] When the second electronic device receives all the second messages sent by the first electronic device, the first electronic device determines whether the maximum field value corresponding to the first field in all the second messages sent is the same as the maximum field value in all the second messages corresponding to the first information. If the maximum field value corresponding to the first field in all the second messages sent is the same as the maximum field value in all the second messages corresponding to the first information, it indicates that the first electronic device has sent all the second messages corresponding to the first information to the second electronic device, and there are currently no unsent second messages. If the maximum field value corresponding to the first field in all the second messages sent is different from the maximum field value in all the second messages corresponding to the first information, it indicates that there are currently unsent second messages.

[0177] If the second electronic device has received all the second messages sent by the first electronic device, and there are still unsent second messages, execute S207; or, if the second electronic device has not received all the second messages sent by the first electronic device, execute S307.

[0178] When the second electronic device has received all the second messages sent by the first electronic device, and the first electronic device has sent all the second messages corresponding to the first information, S308 is executed.

[0179] S307: The first electronic device sends at least one of the at least one second message to the second electronic device based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message.

[0180] Here, the first electronic device sends at least one second message to be sent corresponding to the first information to the second electronic device based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message.

[0181] When the second electronic device has received all the second messages sent by the first electronic device, and there are still unsent second messages, the second messages to be sent are all the second messages that the first electronic device has not sent.

[0182] When the second electronic device has not received all the second messages sent by the first electronic device, and there are still unsent second messages, the second messages to be sent include the second messages that the second electronic device has not received and the second messages that the first electronic device has not sent.

[0183] When the second electronic device has not received all the second messages sent by the first electronic device, and there are currently no unsent second messages, the second messages to be sent are all second messages that the second electronic device has not received.

[0184] It should be noted that when the number of second messages that the second electronic device can cache, as indicated by the fifth field in the third message, is equal to 1, the first electronic device sends 1 second message to the second electronic device each time. When the number of second messages that the second electronic device can cache, as indicated by the fifth field in the third message, is greater than 1, the first electronic device can send at least two second messages to the second electronic device consecutively.

[0185] In one embodiment, when the number of second messages that the second electronic device can cache is greater than or equal to the total number of the at least one second message, sending at least one of the at least one second message to the second electronic device includes:

[0186] All the second messages to be sent in the at least one second message are sent consecutively to the second electronic device.

[0187] Here, when the number of messages that the second electronic device can currently cache is greater than or equal to the total number of all second messages generated based on the first information, and when the second electronic device has received all the second messages sent by the first electronic device, and there are still unsent second messages, the first electronic device continuously sends all the unsent second messages to the second electronic device. For example, when the value of the fifth field in the third message is 16, the total number of second messages corresponding to the first information is 10, and the first electronic device sends 2 second messages to the second electronic device in S304, the first electronic device continuously sends the remaining 8 unsent second messages corresponding to the first information to the second electronic device.

[0188] When the second electronic device has not received all the second messages sent by the first electronic device, and there are still unsent second messages, the first electronic device continuously sends all the unsent second messages and all the second messages that the second electronic device has not received to the second electronic device.

[0189] When the second electronic device has not received all the second messages sent by the first electronic device, and there are currently no unsent second messages, the first electronic device will continuously send all the second messages that the second electronic device has not received to the second electronic device.

[0190] In one embodiment, when the number of second messages that the second electronic device can cache is less than the total number of the at least one second message, but greater than 1, sending at least one of the at least one second message to the second electronic device includes:

[0191] The first number of second messages to be sent from the at least one second message is continuously sent to the second electronic device; wherein the first number is less than or equal to the number of second messages that the second electronic device can cache, and is greater than 1.

[0192] Here, when the number of messages that the second electronic device can currently cache is less than the total number of all second messages generated based on the first information, the first electronic device will send the second messages to be sent in at least two batches. Specifically, the first electronic device will send all second messages within the same batch consecutively. The first number of second messages in each batch is less than or equal to the number of second messages that the second electronic device can cache, and greater than 1.

[0193] For example, when the value of the fifth field in the third message is 6, and the total number of messages in the second message corresponding to the first message is 10, when the first electronic device sends 2 second messages to the second electronic device in S304, the first electronic device can continuously send 6 of the 8 unsent second messages to the second electronic device, and the remaining 2 unsent second messages can be sent when the next third message is received.

[0194] In one embodiment, when sending the at least one second message to the second electronic device, the method includes:

[0195] Based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message, at least one of the at least one second messages is retransmitted to the second electronic device.

[0196] Here, the method for retransmitting at least one of the second messages to the second electronic device is described in the relevant description in the above embodiments, and will not be repeated here.

[0197] S308: The first electronic device sends a fourth message to the second electronic device; the fourth message is used to identify that the second electronic device has received all the second messages.

[0198] When the value of the fourth field in the most recently received third message is the same as the maximum value of the first field in all the second messages corresponding to the first message, the first electronic device sends a fourth message to the second electronic device. The fourth message can be marked as TransactionEnd.

[0199] In one embodiment, when the second message received by the second electronic device includes a third field, and the value of the first field in the last second message received by the second electronic device is the same as the value of the third field, it indicates that the second electronic device has received all the second messages sent by the first electronic device. The second electronic device can then send an end request message to the first electronic device; for example, the end request message can be marked as TransactionEndReq. ​​The value of the fourth field in the end request message represents the maximum field value corresponding to the first field in the received second messages. When the first electronic device receives the end request message from the second electronic device, it determines whether the value of the fourth field in the end request message is the same as the value of the first field in the last message. If they are the same, the first electronic device sends a fourth message to the second electronic device.

[0200] Here, the second electronic device, having received all the second messages corresponding to the first information, parses all the second messages corresponding to the first information to obtain the parsing results. The parsing results include the field value of the first field corresponding to each second message and the data carried by the corresponding second field. When the second electronic device can successfully parse the data carried by all the second messages, it reports a message to the application layer to indicate that the execution is normal. Based on the field value of the first field corresponding to each second message in the parsing results, the second electronic device sorts the data carried by the corresponding second field to obtain sorted data, and reports the sorted data to the application layer. The sorted data constitutes the corresponding first information, which is used by the service corresponding to the first identifier to perform service-related actions on the corresponding application or firmware, such as performing OTA upgrades.

[0201] When the second electronic device encounters an error in parsing any of the second information corresponding to the first information, it reports the processing result used to identify the data processing failure to the application layer and terminates the data processing flow.

[0202] It should be noted that the technical solutions described in the various embodiments of this application can be combined arbitrarily without conflict.

[0203] In the solution provided in this embodiment, the first information is encapsulated into at least one second message according to the set first message format. When there are at least two second messages corresponding to the first information, the first electronic device can continuously send at least two second messages carrying the data of the first information to the second electronic device. That is, after sending a second message, it is not necessary to wait for the response message corresponding to the second message before sending the next second message, thereby improving the interaction efficiency and message transmission efficiency.

[0204] The third message sent by the second electronic device to the first electronic device is encapsulated according to a predefined second message format, which includes at least a fourth field. The second electronic device can respond to each received second message or to at least two consecutively received second messages. Responding to at least two consecutively received second messages saves the overhead of the third message. When the number of unreceived second messages by the second electronic device is greater than one, the first electronic device can retransmit at least two second messages to the second electronic device, improving data retransmission efficiency.

[0205] As an application example of this application, Figure 4 An interactive diagram of a data processing method provided in an application embodiment of this application is shown. As shown in Figure 4, in the application scenario of OTA upgrade of a terminal, the data processing method includes:

[0206] S401: The terminal sends the first message to the server.

[0207] The first message carries at least a first identifier, a second identifier, and a third identifier. The first identifier represents the requested service; the second identifier represents the action related to the service; and the third identifier represents the input parameters.

[0208] Here, the first identifier can correspond to the OTA service instance identifier, indicating that the requested service is an OTA upgrade service. The second identifier indicates the execution action related to the OTA service, such as an OTA upgrade. The third identifier may include information such as the identifier and version number of the object to be upgraded; the object to be upgraded may include applications in the terminal, firmware in the terminal, etc. In practical applications, the terminal sends an ActionStart to the server. ActionStart carries the first and second identifiers, and may also carry a transaction identifier, as well as information to identify the number of valid messages that the terminal can currently cache.

[0209] The terminal encapsulates the first information into at least one ActionMessage; the data carried by all ActionMessages in the at least one ActionMessage constitutes the complete data of the first information. The fourth field in the ActionMessage is used to carry the data of the first information.

[0210] In practical applications, since the total number of bits occupied by the identifier and version number of the object to be upgraded is small, the first information can be encapsulated into an ActionMessage.

[0211] S402: When the server confirms that both the first identifier and the second identifier are valid, it determines the first information based on the first message.

[0212] The first information represents the data that needs to be sent to the terminal to complete the execution action.

[0213] Here, the second piece of information includes the corresponding upgrade package.

[0214] In practical applications, after confirming that both the first identifier and the second identifier are valid, the server responds to the ActionStart sent by the terminal and sends an ActionMessage to the terminal.

[0215] The ActionMessage can carry a transaction identifier, as well as a first identifier and a second identifier.

[0216] S403: The server interacts with the terminal by transmitting at least one second message corresponding to the first information to the terminal.

[0217] Here, because the upgrade package occupies a large number of bits, the server generates at least two ActionMessages based on the second information. Each ActionMessage is encapsulated according to a set first message format; wherein the set first message format includes: a first field and a second field; the first field corresponds to Seq, used to identify the data carried in the corresponding second message; the second field corresponds to Payload, used to carry the data. The data carried in the second field of all ActionMessages in at least two ActionMessages constitutes the complete data of the second information.

[0218] The first message format may also include a third field; the third field corresponds to messageNum, which is used to identify the total number of messages in the second message.

[0219] When the total number of messages in at least two ActionMessages is less than or equal to the number of valid messages that the terminal can currently cache, all ActionMessages from the at least two ActionMessages will be sent to the terminal consecutively. For example, when the number of valid messages that the terminal can currently cache is 16, if the total number of messages in at least two ActionMessages is less than or equal to 16, all ActionMessages from the at least two ActionMessages will be sent to the terminal consecutively.

[0220] When the total number of messages from at least two ActionMessages exceeds the number of valid messages that the ActionStart terminal can currently cache, the first number of ActionMessages from the at least two ActionMessages will be sent to the terminal consecutively. The first number is less than or equal to the number of valid messages that the terminal can currently cache.

[0221] It should be noted that the ActionMessage used to respond to the ActionStart sent by the terminal may or may not carry the data from the first message. When the ActionMessage carries the data from the first message, it is encapsulated according to the format set for the first message.

[0222] S404: The terminal sends a third message to the server after receiving at least one second message.

[0223] Upon receiving at least one ActionMessage corresponding to the second message sent by the server, the terminal sends a third message to the server. The third message is used to respond to the received ActionMessage. The third message is encapsulated according to a predefined second message format, which includes a fourth field and a fifth field. The fourth field corresponds to Ack and is used to identify the second message that the terminal has received. The fifth field corresponds to Win and is used to identify the number of valid messages that the terminal can cache.

[0224] In one embodiment, when the fifth field in the third message identifies that the number of second messages that the terminal can cache is equal to 1, the fourth field in the third message is used to identify the second message most recently received by the terminal;

[0225] If the fifth field in the third message identifies that the number of second messages that the terminal can cache is greater than 1, the fourth field in the third message is used to identify all second messages that the second electronic device has received where the field value of the first field is less than or equal to the field value of the third field.

[0226] Here, when the number of valid messages that the terminal can cache is equal to 1, the terminal sends a third message to the server for each received ActionMessage in response to each ActionMessage sent by the server. The value of the fourth field in the third message is the same as the value of the first field in the most recently received ActionMessage.

[0227] When the number of valid messages that the terminal can cache is greater than one, and the terminal receives at least two ActionMessages corresponding to the second message sent by the server, it can determine whether the field values ​​of the first field of the received ActionMessages are consecutive based on the field value of the first field of each of the at least two ActionMessages sent by the server. If the determination result indicates that the sequence numbers represented by the field values ​​of the first field of the received ActionMessages are not consecutive, the terminal sends a third message to the server. Alternatively, the terminal can send a third message to the server if the determination result indicates that the sequence numbers represented by the field values ​​of the first field of the received ActionMessages are consecutive, and the maximum field value corresponding to the first field of the ActionMessage is equal to the number of valid messages that the terminal can currently cache.

[0228] The values ​​of the first field of the ActionMessage received by the terminal are represented as 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13. The fourth field Ack = 10 in the third message sent by the terminal indicates that the terminal has received ActionMessages whose values ​​of the first field are represented as 1 to 10.

[0229] S405: The server retransmits at least one second message to the terminal based on the received third message.

[0230] Here, the server retransmits at least one of the at least one second message to the terminal based on the fourth and fifth fields of the most recently received third message, and based on the first field of the most recently sent second message; wherein,

[0231] The value of the fourth field in the most recently received third message is different from the value of the first field in the most recently sent second message.

[0232] In practical applications, if the value of the fifth field in the most recently received third message is equal to 1, the most recently sent second message will be retransmitted to the terminal.

[0233] In practical applications, if the value of the fifth field in the most recently received third message is greater than 1, the terminal is retransmitted at least one of the at least one second message based on the fourth field in the most recently received third message and the first field in the most recently sent second message.

[0234] For example, if the first field of the last ActionMessage sent by the server is represented as 14, and the fifth field of the third message most recently received by the server is represented as 10, since the server has already sent ActionMessages with the first field value represented as 1-14 to the terminal, and the terminal has already received ActionMessages with the first field value represented as 1 to 10, the server will continuously send ActionMessages with Seq=11, 12, 13, 14 to the terminal based on the field value of the fourth field in the third message.

[0235] It should be noted that if there are still unsent ActionMessages corresponding to the second information after the server sends 14 ActionMessages in S305, it can continuously send ActionMessages with Seq=11, 12, 13, and 14, as well as at least one unsent ActionMessage corresponding to the second information, to the terminal based on the number of valid messages that the terminal can currently cache, represented by the fourth field in the third message.

[0236] S406: The server sends a fourth message to the terminal; the fourth message is used to identify that the terminal has received all the second messages corresponding to the first information.

[0237] When the value of the fourth field in the most recently received third message is the same as the maximum value of the first field in all the second messages corresponding to the first message, the server sends a TransactionEnd to the terminal.

[0238] In one embodiment, upon receiving all ActionMessages used to carry the upgrade package data, the terminal sends an end request message, such as TransactionEndReq, to ​​the server. Upon receiving the TransactionEndReq from the terminal, the server sends an end confirmation message to the terminal.

[0239] S407: The server marks the execution action represented by the second identifier as completed.

[0240] S408: Upon receiving the fourth message from the server, the terminal reports the corresponding execution result to the application layer.

[0241] Here, after receiving all ActionMessages corresponding to the first information, the terminal parses all ActionMessages to obtain the parsing results. The parsing results include the value of the first field for each ActionMessage and the data carried by the corresponding second field. When the terminal successfully parses the data carried by all ActionMessages, it reports a message to the application layer to indicate normal execution. Based on the value of the first field for each ActionMessage in the parsing results, the terminal sorts the data carried by the corresponding second field to obtain sorted data, and reports the sorted data to the application layer. The sorted data forms the corresponding first information (i.e., the upgrade package), which is used by the OTA upgrade service corresponding to the first identifier to perform OTA upgrades on the corresponding application or firmware.

[0242] If the terminal encounters an error parsing any ActionMessage corresponding to the first information, it terminates the OTA upgrade, reports the processing result used to identify the upgrade failure to the application layer, and ends the data processing flow.

[0243] It should be noted that the technical solutions described in the various embodiments of this application can be combined arbitrarily without conflict.

[0244] In the solution provided in this embodiment, the server can continuously send at least two ActionMessages to the terminal, and the terminal does not need to respond to each ActionMessage, thereby improving the transmission efficiency of OTA upgrade packages and increasing the speed of OTA upgrades.

[0245] To implement the method of the embodiments of this application, the embodiments of this application also provide a data processing apparatus disposed on an electronic device.

[0246] like Figure 5 As shown, the data processing device includes:

[0247] The determining unit 51 is configured to determine first information based on a first identifier and a second identifier; the first identifier represents a requested service; the second identifier represents an execution action related to the service; and the first information represents the data to be sent to a second electronic device to complete the execution action.

[0248] The message interaction unit 52 is configured to transmit the first information to the second electronic device during message interaction with the second electronic device.

[0249] In one embodiment, the determining unit 51 is configured to: determine first information based on a first identifier, a second identifier, and a third identifier; the third identifier represents the input parameters.

[0250] In one embodiment, the message interaction unit 52 is configured to: upon receiving a first message sent by the second electronic device, perform message interaction with the second electronic device and transmit the first information to the second electronic device; the first message carries a transaction identifier.

[0251] In one embodiment, the data processing apparatus further includes:

[0252] The receiving unit is configured to receive a first message sent by the second electronic device; wherein,

[0253] The first message carries the first identifier and the second identifier.

[0254] In one embodiment, the first message also carries a third identifier; the third identifier represents the input parameter.

[0255] In one embodiment, the first message also carries a transaction identifier.

[0256] In one embodiment, the determining unit 51 is configured as follows:

[0257] First information is determined based on the first identifier, the second identifier, and the third identifier; the third identifier represents the input parameters.

[0258] In one embodiment, the transmitted first information carries the transaction identifier.

[0259] In one embodiment, the transmitted first information carries the first identifier and the second identifier.

[0260] In one embodiment, determining the first information based on the first identifier and the second identifier includes:

[0261] If both the first identifier and the second identifier are valid, the first information is determined based on the first identifier and the second identifier.

[0262] In one embodiment, the message interaction unit 52 is configured as follows:

[0263] At least one second message is generated based on the first information; each of the at least one second message carries all or part of the data in the first information.

[0264] Send the at least one second message to the second electronic device.

[0265] In one embodiment, the second message is encapsulated according to a set first message format; wherein the set first message format includes: a first field and a second field;

[0266] The first field is used to identify the data carried in the corresponding second message; the second field is used to carry the data.

[0267] In one embodiment, the set first message format further includes a third field; wherein the third field is used to identify the total number of messages in the second message.

[0268] In one embodiment, the receiving unit is further configured to:

[0269] The device receives a third message sent by the second electronic device; wherein the third message is used to respond to the received second message.

[0270] In one embodiment, the third message is encapsulated according to a set second message format; the set second message format includes a fourth field; the fourth field is used to identify the second message that the second electronic device has received.

[0271] In one embodiment, the set second message format further includes a fifth field; the fifth field is used to identify the number of second messages that the second electronic device can cache.

[0272] In one embodiment, the message interaction unit 52 is configured as follows:

[0273] Based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message, at least one of the at least one second messages is sent to the second electronic device.

[0274] In one embodiment, when the number of second messages that the second electronic device can cache is greater than or equal to the total number of messages in the at least one second message, the message interaction unit 52 is configured to continuously send all the second messages to be sent in the at least one second message to the second electronic device.

[0275] In one embodiment, when the number of second messages that the second electronic device can cache is less than the total number of the at least one second message, but greater than 1, sending at least one of the at least one second message to the second electronic device includes:

[0276] The first number of second messages to be sent from the at least one second message is continuously sent to the second electronic device; wherein the first number is less than or equal to the number of second messages that the second electronic device can cache, and is greater than 1.

[0277] In one embodiment, the message interaction unit 52 is configured to retransmit at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the at least one third message received and the field value of the first field in the at least one second message that has been sent.

[0278] In one embodiment, when the fourth field in the third message is used to identify the second message most recently received by the second electronic device, the message interaction unit 52 is configured to: determine the second message that the second electronic device has not received based on the field value of the fourth field in all received third messages and the field value of the first field in all sent second messages.

[0279] In one embodiment, where the fourth field in the third message is used to identify all second messages that the second electronic device has received where the field value of the first field is less than or equal to the field value of the fourth field, the message interaction unit 52 is configured to: determine the second message that the second electronic device has not received based on the field value of the fourth field in the most recently received third message and the field value of the first field in the most recently sent second message.

[0280] In one embodiment, the data processing apparatus further includes:

[0281] The sending unit is configured to send a fourth message to the second electronic device; the fourth message is used to identify that the second electronic device has received all the second messages.

[0282] In practical applications, the various units included in the data processing device can be implemented by the processor within the data processing device, or by the processor and a communication interface working together. Of course, the processor needs to run programs stored in memory to implement the functions of the aforementioned program modules.

[0283] It should be noted that the data processing apparatus provided in the above embodiments is only illustrated by the division of the above program modules. In practical applications, the above processing can be assigned to different program modules as needed, that is, the internal structure of the data processing apparatus can be divided into different program modules to complete all or part of the processing described above. In addition, the data processing apparatus and data processing method embodiments provided in the above embodiments belong to the same concept, and their specific implementation process can be found in the method embodiments, which will not be repeated here.

[0284] Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiments of this application, the embodiments of this application also provide an electronic device, which is the first electronic device or the second electronic device in any of the above embodiments. Figure 6 This is a schematic diagram of the hardware structure of the electronic device according to an embodiment of this application, as shown below. Figure 6 As shown, the electronic device includes:

[0285] Communication interface 1 enables information exchange with other devices, such as network devices;

[0286] Processor 2 is connected to communication interface 1 to enable information interaction with other devices and to execute the data processing methods provided by one or more of the above-mentioned technical solutions when running computer programs. The computer program is stored in memory 3.

[0287] Of course, in practical applications, the various components in an electronic device are coupled together through bus system 4. It can be understood that bus system 4 is used to achieve communication and connection between these components. In addition to the data bus, bus system 4 also includes a power bus, a control bus, and a status signal bus. However, for clarity, in... Figure 6 The general will label all buses as Bus System 4.

[0288] The memory 3 in this embodiment is used to store various types of data to support the operation of the electronic device. Examples of such data include any computer program used to operate on the electronic device.

[0289] It is understood that memory 3 can be volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), ferromagnetic random access memory (FRAM), flash memory, magnetic surface memory, optical disc, or compact disc read-only memory (CD-ROM); magnetic surface memory can be disk storage or magnetic tape storage. Volatile memory can be random access memory (RAM), which is used as an external cache. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), Enhanced Synchronous Dynamic Random Access Memory (ESDRAM), Sync Link Dynamic Random Access Memory (SLDRAM), and Direct Rambus Random Access Memory (DRRAM).The memory 3 described in the embodiments of this application is intended to include, but is not limited to, these and any other suitable types of memory.

[0290] The methods disclosed in the embodiments of this application can be applied to processor 2, or implemented by processor 2. Processor 2 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the integrated logic circuit of the hardware in processor 2 or by instructions in the form of software. The processor 2 may be a general-purpose processor, DSP, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Processor 2 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor may be a microprocessor or any conventional processor, etc. The steps of the methods disclosed in the embodiments of this application can be directly manifested as being executed by a hardware decoding processor, or being executed by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium, which is located in memory 3. Processor 2 reads the program in memory 3 and completes the steps of the aforementioned method in combination with its hardware.

[0291] When processor 2 executes the program, it implements the corresponding processes in the various methods of the embodiments of this application. For the sake of brevity, these will not be described in detail here.

[0292] In an exemplary embodiment, this application also provides a storage medium, namely a computer storage medium, specifically a computer-readable storage medium, such as a memory 3 that stores a computer program, which can be executed by a processor 2 to complete the steps described in the aforementioned method. The computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disc, or CD-ROM.

[0293] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0294] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0295] In addition, each functional unit in the various embodiments of this application can be integrated into one processing module, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0296] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0297] It should be noted that terms such as "first" and "second" are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. Furthermore, the technical solutions described in the embodiments of this application can be combined arbitrarily without conflict.

[0298] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0299] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

Claims

1. A data processing method applied to a first electronic device, the method comprising: The first information is determined based on the first identifier and the second identifier; The first identifier represents the requested service; The second identifier represents the execution action related to the service; The first information represents the data that needs to be sent to the second electronic device to complete the execution action; During message interaction with the second electronic device, the first information is transmitted to the second electronic device; The step of transmitting the first information to the second electronic device during message interaction includes: At least one second message is generated based on the first information; each of the at least one second message carries all or part of the data in the first information. Send the at least one second message to the second electronic device; Each second message carries a transaction identifier sent by the second electronic device. The transaction identifier is used by the second electronic device to determine the corresponding first identifier and second identifier based on the established correspondence between the transaction identifier, the first identifier, and the second identifier. The second message is encapsulated according to a set first message format. The set first message format includes a first field and a second field. The first field is used to identify the data carried in the corresponding second message. The second field is used to carry the data. The method further includes: The device receives a third message sent by the second electronic device; wherein the third message is used to respond to the received second message. Send a fourth message to the second electronic device; the fourth message is used to identify that the second electronic device has received all the second messages; The action represented by the second identifier is marked as completed.

2. The data processing method according to claim 1, wherein, The method further includes: Receive a first message sent by the second electronic device; wherein, The first message carries the first identifier and the second identifier.

3. The data processing method according to claim 2, wherein, The first message also carries a third identifier; the third identifier represents the input parameters.

4. The data processing method according to claim 2, wherein, The first message also carries a transaction identifier.

5. The data processing method according to claim 3, wherein, When the first information is determined based on the first identifier and the second identifier, the method includes: First information is determined based on the first identifier, the second identifier, and the third identifier; the third identifier represents the input parameters.

6. The data processing method according to claim 4, wherein, The first information transmitted carries the transaction identifier.

7. The data processing method according to claim 1, wherein, The first information transmitted carries the first identifier and the second identifier.

8. The data processing method according to claim 1, wherein, The determination of the first information based on the first identifier and the second identifier includes: If both the first identifier and the second identifier are valid, the first information is determined based on the first identifier and the second identifier.

9. The data processing method according to claim 1, wherein, The first message format further includes a third field; wherein the third field is used to identify the total number of messages in the second message.

10. The data processing method according to claim 1, wherein, The third message is encapsulated according to the set second message format; The set second message format includes a fourth field; the fourth field is used to identify the second message that the second electronic device has received.

11. The data processing method according to claim 10, wherein, The set second message format also includes a fifth field; the fifth field is used to identify the number of second messages that the second electronic device can cache.

12. The data processing method according to claim 11, wherein, Sending the at least one second message to the second electronic device includes: Based on the number of second messages that the second electronic device can cache, as represented by the fifth field in the third message, at least one of the at least one second messages is sent to the second electronic device.

13. The data processing method according to claim 12, wherein, When the number of second messages that the second electronic device can cache is greater than or equal to the total number of the at least one second message, sending at least one of the at least one second message to the second electronic device includes: All the second messages to be sent in the at least one second message are sent consecutively to the second electronic device.

14. The data processing method according to claim 12, wherein, When the number of second messages that the second electronic device can cache is less than the total number of the at least one second message, but greater than 1, sending at least one of the at least one second message to the second electronic device includes: The first number of second messages to be sent from the at least one second message is continuously sent to the second electronic device; wherein the first number is less than or equal to the number of second messages that the second electronic device can cache, and is greater than 1.

15. The data processing method according to claim 10, wherein, When sending the at least one second message to the second electronic device, the method includes: Based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message, at least one of the at least one second messages is retransmitted to the second electronic device.

16. The data processing method according to claim 15, wherein, When the fourth field in the third message is used to identify the most recently received second message by the second electronic device, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message includes: Based on the field values ​​of the fourth field in all received third messages and the field values ​​of the first field in all sent second messages, the second message that the second electronic device did not receive is determined.

17. The data processing method according to claim 15, wherein, In the case where the fourth field in the third message is used to identify all second messages received by the second electronic device where the field value of the first field is less than or equal to the field value of the fourth field, the method for retransmitting at least one of the at least one second message to the second electronic device based on the field value of the fourth field in the received at least one third message and the field value of the first field in the sent at least one second message includes: Based on the field value of the fourth field in the most recently received third message and the field value of the first field in the most recently sent second message, the second message that the second electronic device did not receive is determined.

18. A data processing apparatus, comprising: The determining unit is configured to determine first information based on a first identifier and a second identifier; The first identifier represents the requested service; The second identifier represents the service-related execution action; the first information represents the data that needs to be sent to the second electronic device to complete the execution action; The message interaction unit is configured to transmit the first information to the second electronic device during message interaction with the second electronic device; The message interaction unit is configured to generate at least one second message based on the first information; Each of the at least one second message carries all or part of the data in the first information; the at least one second message is sent to the second electronic device; wherein, each second message carries a transaction identifier sent by the second electronic device, the transaction identifier being used by the second electronic device to determine the corresponding first identifier and second identifier based on a predefined correspondence between the transaction identifier, the first identifier, and the second identifier; the second message is encapsulated according to a predefined first message format; the predefined first message format includes: a first field and a second field; the first field is used to identify the data carried in the corresponding second message; the second field is used to carry the data; The receiving unit is configured to receive a third message sent by the second electronic device; wherein the third message is used to respond to the received second message; The sending unit is configured to send a fourth message to the second electronic device; the fourth message is used to identify that the second electronic device has received all the second messages. The data processing device is configured to mark the execution action represented by the second identifier as completed.

19. An electronic device comprising: The processor and the memory used to store computer programs that can run on the processor. When the processor is used to run the computer program, it performs the steps of the data processing method according to any one of claims 1 to 17.

20. A storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data processing method according to any one of claims 1 to 17.

Citation Information

Patent Citations

  • Data processing method and device, electronic equipment and storage medium

    CN111970102A