Data processing method, smart glasses, storage medium, and program product

By introducing an opcode field into smart glasses to dynamically determine the payload format and length, the bandwidth waste and packet fragmentation problems caused by fixed-length designs are solved, achieving more efficient data transmission.

CN122268855APending Publication Date: 2026-06-23SHANGHAI LONGCHEER INTELLIGENCE TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610327255.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-17
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

The existing communication frame structure in smart glasses adopts a fixed field + fixed length design, which results in serious bandwidth waste during short data transmission and increased latency and complexity during long data transmission due to the need for packet splitting, resulting in low overall bandwidth utilization.

Method used

By including an opcode field in the frame header, the format and length information of the payload can be dynamically determined, supporting variable-length payloads, avoiding the allocation of too much space for short data, reducing invalid transmitted bytes, and supporting the transmission of more valid data within a single frame for long data.

Benefits of technology

It significantly improves bandwidth utilization, reduces redundant transmission and packet overhead, and enhances overall transmission efficiency and system scalability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122268855A_ABST
    Figure CN122268855A_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data processing method, smart glasses, a storage medium and a program product. The method comprises: obtaining a first target data frame, the first target data frame comprising at least one first sub-data frame, the first sub-data frame comprising a frame header and a payload, the frame header comprising an operation code field; determining format information and length information of the payload according to the value of the operation code field corresponding to the first sub-data frame; parsing the payload according to the format information and the length information to obtain parsed data; and performing a corresponding processing operation according to the parsed data. The present application uses a preset binding mechanism of the operation code and the payload length and format, so that the payload length can dynamically change according to the actual business data, significantly reducing the invalid transmission bytes, improving the effective payload ratio of a single frame of data, and for long data, being able to accommodate longer effective data in one frame, thereby reducing the additional frame header overhead and transmission times due to forced packeting, and improving the overall transmission efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a data processing method, smart glasses, storage medium, and program product. Background Technology

[0002] Smart glasses, as an emerging terminal device integrating wearable interaction and multi-device collaboration, are widely used in real-time communication, augmented reality (AR), health monitoring, and industrial assistance. Under the existing architecture of smart glasses, the system needs to support diverse business data transmission, with significant differences in data size: from high-frequency short data such as indicator light control commands and device status feedback (1 byte in size) to large-capacity long data such as microphone audio streams and file data (1 kilobyte in size).

[0003] Currently, the communication frame structure commonly used in smart glasses generally adopts a "fixed field + fixed length" design pattern. In this pattern, each frame of data has a predefined fixed length, with both the header field and the payload area remaining constant. However, in practical applications, such as when transmitting short data like 1-byte control commands, the fixed-length payload area contains a large amount of unused redundant space, leading to significant bandwidth waste and low bandwidth utilization. Summary of the Invention

[0004] This application provides a data processing method, smart glasses, storage medium, and program product to improve bandwidth utilization and transmission efficiency during data transmission.

[0005] In a first aspect, embodiments of this application provide a data processing method applied to a first processing device in smart glasses, the method comprising:

[0006] Acquire a first target data frame, the first target data frame including at least one first sub-data frame, the first sub-data frame including a frame header and a payload, the frame header including an opcode field;

[0007] For any first sub-data frame, determine the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame;

[0008] The payload is parsed according to the format information and the length information to obtain parsed data;

[0009] Perform corresponding processing operations based on the parsed data.

[0010] In one optional implementation, the first target data frame is an aggregate frame when it includes multiple first sub-data frames; the frame header of the aggregate frame includes an aggregate packet identifier field, a first sub-data frame count field, and a first sub-data frame offset field; wherein, the value of the first sub-data frame count field is used to indicate the number of first sub-data frames included in the aggregate frame, and the value of the first sub-data frame offset field is used to indicate the byte offset of the starting position of each first sub-data frame relative to the starting position of the aggregate frame payload;

[0011] The acquisition of the first target data frame includes:

[0012] When it is determined that the first target data frame contains an aggregation packet identifier field, the first target data frame is decapsulated according to the value of the first sub-data frame quantity field and the value of the first sub-data frame offset field in the first target data frame to obtain the at least one first sub-data frame.

[0013] In one optional implementation, the smart glasses include multiple first functional modules that perform corresponding processing operations based on the parsed data, including:

[0014] The first functional module corresponding to the first sub-data frame is determined based on the value of the opcode field.

[0015] The parsed data is sent to the corresponding first functional module so that the first functional module performs corresponding processing operations based on the parsed data.

[0016] In one optional implementation, the smart glasses further include a second processing device, wherein the frame header of the first sub-data frame further includes a destination field, and the format and length information of the payload are determined based on the value of the opcode field corresponding to the first sub-data frame, including:

[0017] Determine the value of the destination field corresponding to the first sub-data frame;

[0018] When the value of the destination field is the identifier of the first processing device, the format information and length information of the payload are determined according to the value of the opcode field corresponding to the first sub-data frame;

[0019] The method further includes:

[0020] When the destination field is an identifier of the second processing device, the first sub-data frame is sent to the second processing device so that the second processing device can perform subsequent processing on the first sub-data frame after obtaining it.

[0021] In an optional implementation, the first sub-data frame includes a command code field, and sending the first sub-data frame to the second processing device includes:

[0022] The value of the command code field determines whether the first sub-data frame is a command packet or a data packet.

[0023] Multiple target first sub-data frames to be sent are encapsulated to obtain a second target data frame, wherein the target first sub-data frame is a data packet;

[0024] The second target data frame is sent to the second processing device.

[0025] In one optional implementation, the header of the first sub-data frame further includes a source field and a destination field; when the second target data frame is an aggregate frame, the header of the second target data frame further includes a rate identifier field, the value of which is determined based on the values ​​of the source field and the destination field in each of the first sub-data frames;

[0026] Sending the second target data frame to the second processing device includes:

[0027] The second target data frame is sent to the second processing device according to the value of the rate identifier field.

[0028] Secondly, embodiments of this application provide a data processing method applied to a second processing device in smart glasses. The second processing device includes multiple second functional modules. The smart glasses include a first processing device and a second processing device. A first sub-data frame includes a frame header and a payload. The frame header contains an opcode field and a destination field. The method includes:

[0029] A first sub-data frame sent by a first processing device is acquired. This first sub-data frame is sent to the second processing device when the value of the destination field in the first sub-data frame is the value of the second processing device. When the value of the destination field in the first sub-data frame is the value of the first processing device, the first processing device determines the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame. Then, it parses the payload based on the format and length information to obtain parsed data. The first processing device then performs corresponding processing operations based on the parsed data. The first sub-data frame is included in a first target data frame, and the first target data frame includes at least one first sub-data frame.

[0030] Based on the value of the opcode field corresponding to the first sub-data frame, determine the format and length information of the payload;

[0031] The payload is parsed according to the format information and the length information to obtain parsed data;

[0032] The parsed data is sent to the target application layer or the target second functional module so that the target application layer or the second functional module performs corresponding processing operations on the parsed data, wherein the target application layer or the target second functional module is determined based on the value of the opcode field.

[0033] Thirdly, embodiments of this application provide smart glasses, including:

[0034] A first processing device, and / or a second processing device;

[0035] The first processing device is used to execute the method described in the first aspect;

[0036] The second processing device is used to execute the method described in the second aspect.

[0037] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement various possible implementations as described in any of the above aspects.

[0038] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements various possible implementations as described in any of the above aspects.

[0039] The data processing method, smart glasses, storage medium, and program product provided in this application include: acquiring a first target data frame, the first target data frame including at least one first sub-data frame, the first sub-data frame including a frame header and a payload, the frame header including an opcode field; for any first sub-data frame, determining the format information and length information of the payload according to the value of the opcode field corresponding to the first sub-data frame; parsing the payload according to the format information and the length information to obtain parsed data; and performing corresponding processing operations according to the parsed data. This application, through a preset binding mechanism between the opcode and the payload length and format, allows the payload length to dynamically change according to actual business data, thereby avoiding the allocation of excessively long fixed space for short data, significantly reducing invalid transmission bytes, and increasing the effective payload ratio of a single frame. For long data, this application supports variable-length payloads, which can accommodate longer effective data within a single frame, thereby reducing the additional frame header overhead and transmission frequency caused by forced packet splitting, and improving overall transmission efficiency. Attached Figure Description

[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0041] Figure 1An application scenario diagram provided for an embodiment of this application;

[0042] Figure 2 A flowchart illustrating a data processing method provided in an embodiment of this application;

[0043] Figure 3 A flowchart illustrating another data processing method provided in an embodiment of this application;

[0044] Figure 4 A flowchart illustrating another data processing method provided in an embodiment of this application;

[0045] Figure 5 A schematic diagram of a communication framework provided in an embodiment of this application;

[0046] Figure 6 This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application;

[0047] Figure 7 This is a schematic diagram of the structure of another data processing device provided in the embodiments of this application;

[0048] Figure 8 A schematic diagram of the structure of the electronic device provided in this application.

[0049] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.

[0051] Smart glasses, as an emerging terminal device integrating wearable interaction and multi-device collaboration, are widely used in fields such as real-time communication, augmented reality, health monitoring, and industrial assistance. Under the existing architecture of smart glasses, the system needs to support diverse business data transmission, with significant differences in data size: from high-frequency short data such as indicator light control commands and device status feedback (1 byte in size), to large-capacity long data such as microphone audio streams and file data (1 kilobyte in size).

[0052] Currently, the common communication frame structure in smart glasses adopts a "fixed field + fixed length" design pattern. In this pattern, each frame has a predefined fixed length, with both the frame header field and the payload area remaining constant. However, in practical applications, such as transmitting short data like 1-byte control commands, the fixed-length payload area contains a large amount of unused redundant space. For example, a 1-byte LED (Light Emitting Diode) switch control command or a device status heartbeat packet, due to its fixed payload length (let's say 20 bytes), must be placed in a frame much larger than its required space. This results in a large amount of unused redundant space within the payload area, leading to a very low percentage of effective data in a single transmission. In the example above, effective data accounts for only 5%, with redundancy reaching 95%, resulting in significant bandwidth waste. Furthermore, in scenarios involving frequent transmission of such short commands, valuable wireless channel resources or internal bus bandwidth are occupied by a large number of invalid padding bytes, resulting in low overall bandwidth utilization.

[0053] Conversely, when transmitting long data, such as a 1KB audio stream or a configuration file, the limited capacity of a single frame forces the long data to be split into multiple smaller packets of fixed length for multiple transmissions. This process not only introduces additional protocol processing overhead, such as requiring an independent frame header for each packet, increasing transmission latency, but may also introduce additional complexity and error probability due to packet splitting and reassembly operations.

[0054] In view of this, this application provides a data processing method applied to a first processing device in smart glasses. The first processing device may be a chip running a specific operating system. The first processing device can acquire a first target data frame, wherein the first target data frame includes at least one first sub-data frame. For any first sub-data frame, the first processing device can determine the format information and length information of the payload according to the value of the opcode field in the first sub-data frame, and parse the payload in the sub-data frame according to the determined format information and length information to obtain parsed data. Finally, it performs corresponding processing operations according to the parsed data. This application, through a preset binding mechanism of opcode with payload length and format, enables the payload length to change dynamically according to actual business data, thereby avoiding the allocation of excessively long fixed space for short data, significantly reducing invalid transmission bytes, and increasing the effective payload ratio of single frame data. For long data, this application supports variable-length payload, which can accommodate longer effective data in one frame, thereby reducing the additional frame header overhead and transmission times caused by forced packet splitting, and improving the overall transmission efficiency.

[0055] Figure 1 An application scenario diagram provided for an embodiment of this application, such as... Figure 1As shown, the first processing device in the smart glasses acquires a first target data frame sent by another device outside the smart glasses. The first target data frame includes at least one first sub-data frame. The first sub-data frame includes a frame header and a payload. The frame header includes an opcode field. For each first sub-data frame, the value of the opcode field is extracted from the first sub-data frame. Based on the extracted opcode field value, the format information and length information of the payload are determined. Then, the payload is parsed based on the determined format information and length information to obtain parsed data. Based on the parsed data, corresponding processing operations are performed.

[0056] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0057] Figure 2 This is a flowchart illustrating a data processing method provided in an embodiment of this application. The executing entity in this embodiment can be any device with data processing capabilities. This application uses a first processing device in smart glasses as an example for specific description. The first processing device is the processing device in the smart glasses that executes the data processing method. This processing device can be a chip running a specific operating system. This application does not limit the specific operating system; for example, the specific operating system can be an RTOS (Real-Time Operating System) system or an Android system, such as... Figure 2 As shown in the embodiment of this application, a data processing method is provided, the method comprising:

[0058] Step 201: Obtain a first target data frame. The first target data frame includes at least one first sub-data frame. The first sub-data frame includes a frame header and a payload. The frame header contains an opcode field.

[0059] The first target data frame is a complete data packet unit received by the smart glasses from an external source and requiring processing. It contains data that needs to be parsed and executed by the smart glasses. This first target data frame is sent by other devices to the first processing unit within the smart glasses. These other devices refer to external electronic devices that connect to the smart glasses and interact with them wirelessly, such as via Bluetooth. Other devices include, but are not limited to, smartphones, smartwatches, etc.

[0060] The first target data frame includes one or more first sub-data frames. Each first sub-data frame consists of a header and a payload. The header, located before the payload, is a fixed-format section used to carry control and management information. The payload carries the actual business data, such as command content, audio streams, file data, etc.

[0061] The opcode is a specific field located in the frame header.

[0062] Specifically, other devices send the first target data frame to the smart glasses via a wireless link, and the first processing device in the smart glasses obtains the first target data frame.

[0063] In one optional implementation, when the first target data frame includes multiple first sub-data frames, it is an aggregate frame; the frame header of the aggregate frame includes an aggregate packet identifier field, a first sub-data frame count field, and a first sub-data frame offset field; wherein, the value of the first sub-data frame count field is used to indicate the number of first sub-data frames included in the aggregate frame, and the value of the first sub-data frame offset field is used to indicate the byte offset of the starting position of each first sub-data frame relative to the starting position of the aggregate frame payload;

[0064] Acquire the first target data frame, including:

[0065] When it is determined that the first target data frame contains an aggregation packet identifier field, the first target data frame is decapsulated according to the value of the first sub-data frame quantity field and the value of the first sub-data frame offset field in the first target data frame to obtain at least one first sub-data frame.

[0066] When the first target data frame includes multiple first sub-data frames, it is an aggregate frame. The aggregate frame contains an aggregate packet identifier field, a first sub-data frame number field, and a first sub-data frame offset field.

[0067] The Aggregate Packet Identifier field is a specific field in the header of the Aggregate Frame. The Aggregate Packet Identifier field is used to indicate that the data frame is an Aggregate Frame, which contains multiple first sub-data frames.

[0068] The value of the First Sub-DataFrame Count field indicates the total number of first sub-dataframes that are aggregated into this aggregate frame.

[0069] The first sub-data frame offset field contains multiple byte offsets, which correspond one-to-one with multiple first sub-data frames. Each byte offset is used to indicate the byte distance of the starting position of the corresponding first sub-data frame relative to the starting position of the entire aggregate frame payload.

[0070] Specifically, the first processing device parses the frame header of the first target data frame, checks whether there is an aggregation packet identifier field, and whether the value of the aggregation packet identifier field indicates that the first target data frame is an aggregation frame. If there is an aggregation packet identifier field, and the value of the aggregation packet identifier field indicates that the first target data frame is an aggregation frame, then the first processing device reads the value of the first sub-data frame quantity field and the value of the first sub-data frame offset field from the frame header of the first target data frame. Based on the read value of the first sub-data frame offset field and the starting position of the load, the first processing device calculates the position range of each first sub-data frame, and extracts each first sub-data frame from the first target data frame based on the calculated position range of each first sub-data frame.

[0071] By aggregating multiple first sub-data frames into a single aggregate frame for transmission, the error rate can be reduced and transmission efficiency improved.

[0072] Step 202: For any first sub-data frame, determine the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame.

[0073] The format information refers to the organization and interpretation rules of the payload data. Different opcodes may correspond to different payload format data. For example, the payload of an instruction to control an LED switch may be a status byte indicating "on" or "off". The payload of an audio data segment may be a continuous stream of bytes organized according to a specific encoding format.

[0074] The length information refers to the number of bytes occupied by the payload.

[0075] Specifically, for any first sub-data frame, the first processing device extracts the value of the opcode field corresponding to the first sub-data frame, and determines the format information and degree information of the load based on the value of the opcode field and the preset first mapping table. The first mapping table is used to indicate the correspondence between the values ​​of multiple opcode fields and multiple format information, and the first mapping table is also used to indicate the correspondence between the values ​​of multiple opcode fields and multiple length information.

[0076] In one optional implementation, the smart glasses further include a second processing unit, wherein the frame header of the first sub-data frame further includes a destination field, and the format and length information of the payload are determined based on the value of the opcode field corresponding to the first sub-data frame, including:

[0077] Determine the value of the destination field corresponding to the first sub-data frame;

[0078] When the value of the destination field is the identifier of the first processing device, the format and length information of the payload are determined according to the value of the opcode field corresponding to the first sub-data frame;

[0079] The method also includes:

[0080] When the destination field is the identifier of the second processing device, the first sub-data frame is sent to the second processing device so that the second processing device can perform subsequent processing on the first sub-data frame after obtaining it.

[0081] The second processing device is an independent processor or processing unit inside the smart glasses, other than the first processing device. The second processing device can also be a chip running a specific operating system. In this embodiment, the operating system running in the first processing device can be an RTOS system, and the operating system running in the second processing device can be an Android system.

[0082] The value of the destination field is used to identify the intended receiver or processing unit of the first sub-data frame. For example, its value can be an identifier (ID) pointing to a "first processing device" or a "second processing device".

[0083] The first subframe may also contain a source field, the value of which is used to identify the sender of the first subframe.

[0084] Specifically, the first processing device reads the value of the destination field in the frame header of the first sub-data frame. If the value of the destination field is the identifier of the first processing device, that is, the destination of the first sub-data frame is to be sent to the first processing device, then the first processing device performs subsequent parsing and processing on the first sub-data frame. For example, based on the value of the opcode field corresponding to the first sub-data frame, the format information and length information of the payload are determined, and then the payload is parsed based on the format information and length information to obtain parsed data, and corresponding processing operations are performed based on the parsed data.

[0085] If the value of the destination field is the identifier of the second processing device, that is, the target of the first sub-data frame is to be sent to the second processing device, after receiving the first sub-data frame, the second processing device performs subsequent processing on the first sub-data frame. For example, the subsequent processing may be to determine the format information and length information of the payload according to the value of the opcode field corresponding to the first sub-data frame, then parse the payload according to the format information and length information to obtain parsed data, and perform corresponding processing operations according to the parsed data.

[0086] In this way, the newly added second processing unit can independently undertake specific functions, such as dedicated image processing, AI computing, and communication protocol stacks, making the system architecture more modular. If more processing units are needed in the future, only the identification rules of the destination field need to be extended, without modifying the existing processing logic, thus improving the scalability of the system.

[0087] In one optional implementation, the first sub-data frame includes a command code field, and sending the first sub-data frame to the second processing device includes:

[0088] The value of the command code field determines whether the first sub-data frame is a command packet or a data packet.

[0089] Multiple target first sub-data frames to be sent are encapsulated to obtain a second target data frame, where the target first sub-data frame is a data packet;

[0090] The second target data frame is sent to the second processing device.

[0091] The command code field indicates whether the first sub-data frame is a command packet or a data packet. For example, a value of 01 indicates that the first sub-data frame is a command packet, and a value of 10 indicates that the first sub-data frame is a data packet.

[0092] If the first sub-data frame is a command packet, it indicates that the first sub-data frame is used to transmit control commands, status queries, etc. If the first sub-data frame is a data packet, it indicates that the first sub-data frame is used to transmit audio streams, files, etc.

[0093] Specifically, before sending a first sub-data frame, the first processing device first extracts the value of the command code field in the frame header of the first sub-data frame, and determines whether the first sub-data frame is a command packet or a data packet based on the value of the command code field.

[0094] The first sub-data frame identified as a data packet is the target first sub-data frame. Multiple target first sub-data frames to be sent are encapsulated. This application does not limit the number of encapsulated target first sub-data frames. In one optional implementation, a preset number of target first sub-data frames can be encapsulated, or target first sub-data frames within a preset time period can be encapsulated to obtain a second target data frame. The second target data frame is also an aggregate frame, with the same structure as the aggregate frame in the above embodiments. The second target data frame also includes an aggregate packet identifier field, a first sub-data frame quantity field, and a first sub-data frame offset field. Then, the first processing device sends the second target data frame to the second processing device. After receiving the second target data frame, the second processing device decapsulates it to obtain multiple target first sub-data frames. Subsequent operations are then performed based on the opcode values ​​in each target first sub-data frame. The specific operation process is described in the above embodiments and will not be repeated here.

[0095] In this way, by explicitly distinguishing between command packets and data packets through the command code field, the communication protocol can implement the most appropriate transmission strategy for different types of data packets, allowing the system to process them differently and optimize overall communication quality. Aggregating and encapsulating multiple data packets further improves the accuracy of data transmission and addresses the high error rate in data packet transmission in existing technologies.

[0096] In one optional implementation, the header of the first sub-data frame further includes a source field and a destination field; when the second target data frame is an aggregate frame, the header of the second target data frame further includes a rate identifier field, the value of which is determined based on the values ​​of the source field and the destination field in each of the first sub-data frames;

[0097] Sending the second target data frame to the second processing device includes:

[0098] The second target data frame is sent to the second processing device according to the value of the rate identifier field.

[0099] The source field identifies the sender of the first sub-data frame. For example, the value of the source field can identify whether the data comes from an RTOS system, an Android system, or an external device such as a smartphone.

[0100] The value of the destination field is used to identify the intended recipient or processing unit of the first sub-data frame. For example, the value of the destination field can indicate whether the data needs to be sent to the Android system, the RTOS system, or to an external application via Bluetooth.

[0101] The value of the rate identifier field is used to indicate the communication rate or rate class that the aggregate frame should use during transmission.

[0102] Specifically, when the second target data frame is an aggregated frame, a rate identifier field needs to be set when constructing the frame header of the second target data frame. The specific process for determining the value of the rate identifier field is as follows:

[0103] Since the maximum transmission rate supported by the sender (determined by the value of the source field) and receiver (determined by the value of the destination field) of the second target data frame is different, the sender should be determined first based on the value of the source field, and the maximum transmission rate supported by the sender should be determined. Then, the receiver should be determined based on the value of the destination field, and the maximum transmission rate supported by the receiver should be determined.

[0104] If the values ​​of the source field and the target field corresponding to all target first sub-data frames contained in the second target data frame are the same, then the maximum transmission rate supported by the sending end and the receiving end is compared. If the maximum transmission rate supported by the sending end is lower, the final transmission rate is determined based on the maximum transmission rate supported by the sending end, and the value of the rate identifier field is determined based on the final transmission rate. The final transmission rate is less than the maximum transmission rate supported by the sending end. If the maximum transmission rate supported by the receiving end is lower, the final transmission rate is determined based on the maximum transmission rate supported by the receiving end, and the value of the rate identifier field is determined based on the final transmission rate. The final transmission rate is less than the maximum transmission rate supported by the receiving end.

[0105] If the values ​​of the source field and the target field corresponding to each target first sub-data frame contained in the second target data frame are not all the same, then the maximum value of the transmission rate supported by each sender and each receiver is determined, the sender or receiver with the smallest maximum supported transmission rate is determined, and the value of the rate identifier field is determined accordingly.

[0106] After setting the value of the rate identifier field, when sending the second target data frame to the second processing device, the target transmission rate is determined according to the value of the rate identifier field in the second target data frame through the second mapping table, and the second target data frame is sent to the second processing device at the target transmission rate. The second mapping table indicates the correspondence between the values ​​of multiple rate identifier fields and multiple transmission rates.

[0107] By introducing source and rate identifier fields and dynamically determining the rate identifier based on the source and destination information of multiple first sub-data frames in the aggregated frame, intelligent and adaptive data transmission control is achieved, significantly improving communication efficiency, system responsiveness, and overall energy efficiency.

[0108] Step 203: Parse the payload according to the format and length information to obtain the parsed data.

[0109] Specifically, the first processing unit parses the payload according to the format information and length information to obtain parsed data. The parsed data is the original data that the sender actually wants to transmit, which can be a command to be executed, or a file packet, data packet, etc.

[0110] Step 204: Perform the corresponding processing operations based on the parsed data.

[0111] Specifically, the first processing unit selects and triggers one or more predefined functional modules to complete the task, ultimately achieving the system's specific business objectives or technical effects.

[0112] If the parsed data is a file packet or data packet, it can be directly stored using the preset method. If the parsed data is a command to be executed, the command to be executed is sent to the corresponding functional module, which then executes the command.

[0113] In one optional implementation, the smart glasses include multiple first functional modules that perform corresponding processing operations based on the parsed data, including:

[0114] The first functional module corresponding to the first sub-data frame is determined based on the value of the opcode field;

[0115] The parsed data is sent to the corresponding first functional module so that the first functional module can perform the corresponding processing operation based on the parsed data.

[0116] The value of the opcode field is related to the specific business type. When the first sub-data frame is a command packet, the first functional module that processes the first sub-data frame can be determined based on the value of the opcode field through the third mapping table. The third mapping table is used to indicate the correspondence between the values ​​of multiple opcode fields and multiple first functional modules.

[0117] The first processing unit sends the parsed data to the first functional module determined by the value of the opcode field, and the first functional module performs the corresponding processing operation based on the parsed data.

[0118] The data processing method provided in this application can acquire a first target data frame, which includes at least one first sub-data frame. The first sub-data frame includes a frame header and a payload, and the frame header contains an opcode field. For any first sub-data frame, the format information and length information of the payload are determined according to the value of the opcode field corresponding to the first sub-data frame. The payload is parsed according to the format information and length information to obtain parsed data. Corresponding processing operations are performed according to the parsed data. This application uses a preset binding mechanism between the opcode and the payload length and format, so that the payload length can be dynamically changed according to the actual business data, thereby avoiding the allocation of too long fixed space for short data, significantly reducing invalid transmission bytes, and increasing the effective payload ratio of single frame data. For long data, this application supports variable-length payload, which can accommodate longer effective data in one frame, thereby reducing the additional frame header overhead and transmission times caused by forced packet splitting, and improving the overall transmission efficiency.

[0119] Figure 3This is a flowchart illustrating another data processing method provided in this application embodiment. The executing entity in this embodiment can be any device with data processing capabilities. This application uses a client device as the executing entity for specific description. The method is applied to a second processing device in smart glasses. The second processing device includes multiple second functional modules. The smart glasses include a first processing device and a second processing device. The first sub-data frame includes a frame header and a payload. The frame header contains an opcode field and a destination field, such as... Figure 3 As shown in the embodiment of this application, a data processing method is provided, the method comprising:

[0120] Step 301: Obtain the first sub-data frame sent by the first processing device. The first sub-data frame is sent by the first processing device to the second processing device when the value of the destination field in the first sub-data frame is the value of the second processing device. When the value of the destination field in the first sub-data frame is the value of the first processing device, the first processing device determines the format information and length information of the payload according to the value of the opcode field corresponding to the first sub-data frame, and then parses the payload according to the format information and length information to obtain parsed data. The first processing device then performs corresponding processing operations according to the parsed data. The first sub-data frame is included in the first target data frame, and the first target data frame includes at least one first sub-data frame.

[0121] Step 302: Determine the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame.

[0122] Step 303: Parse the payload according to the format information and length information to obtain the parsed data.

[0123] Step 304: Send the parsed data to the target application layer or the target second functional module so that the target application layer or the second functional module can perform corresponding processing operations on the parsed data. The target application layer or the target second functional module is determined based on the value of the opcode field.

[0124] The other data processing method provided in this embodiment has a similar implementation principle and technical effect to the above embodiment, and will not be described in detail here.

[0125] The following is the structural design of the first sub-data frame, also known as the primary frame. The primary frame is the basic transmission unit, adopting a "fixed frame header + variable length payload" mode. Through field coordination, it achieves accurate data routing, dynamic adaptation, and reliability assurance. The specific structure and functional definitions are as follows:

[0126]

[0127] The following is the structural design of the aggregate frame. An aggregate frame is obtained by encapsulating multiple primary frames. The aggregate frame uses flag bits and control fields to achieve multi-frame collaborative transmission and dynamic rate adaptation. The specific structure and functional definitions are as follows:

[0128]

[0129] Figure 4 The following is a flowchart illustrating another data processing method provided in this application embodiment: The sender encapsulates the original data once to obtain a first frame, namely the first sub-data frame, and then encapsulates the first frame a second time to obtain an aggregate frame. The sender sends the aggregate frame to the receiver, and the receiver decapsulates the aggregate frame a second time to obtain a first frame, and then decapsulates the first frame once to obtain the original data.

[0130] Figure 5 This is a schematic diagram of a communication framework provided in an embodiment of this application. The following detailed implementation methods illustrate this. Figure 5 To explain.

[0131] I. Data Transmission Process (Interaction between External Devices and Smart Glasses)

[0132] 1. Data Reception Process (External Device → Smart Glasses)

[0133] Bluetooth service (RTOS side): Receives Bluetooth data sent by "other device app (application)" and transmits one frame of data to the connection service module.

[0134] Connection service module (RTOS side):

[0135] a. Parse the "source" and "destination" identifiers of the data frame, perform an initial check to confirm whether the destination is an RTOS. If the destination is not an RTOS, forward it to the preprocessing module (RTOS side).

[0136] b. For data destined for RTOS, determine the service type based on the "operation code". For example, if it is an LED command, route it to the indicator light module.

[0137] Preprocessing module (RTOS side): Performs secondary encapsulation on the first frame data and transmits the data to the preprocessing module (Android side) via SPI.

[0138] Preprocessing module (Android side): Parses the secondary encapsulated data into primary frame data and passes it to the connection service module (Android side).

[0139] Connection service module (Android side): Obtains frame data once, forwards the data to the application layer according to the "destination" and "operation code", and the application layer business logic completes the final processing (such as device status instruction parsing).

[0140] 2. Data transmission process (smart glasses → external devices)

[0141] Upper-layer service module (Android side): Fills the raw data with fields such as "command code", "operation code", "source", "destination", "length", and "checksum" and passes it to the connection service module (Android side).

[0142] Connection service module (Android side): Passes data to the preprocessing module (Android side) according to the "destination".

[0143] Preprocessing module (Android side): Performs secondary encapsulation on the data, and then passes the processed data to the preprocessing module (RTOS side).

[0144] Preprocessing module (RTOS side): Performs data verification, unpacks the verified data frame into a single frame, and transmits it to the connection service module (RTOS side).

[0145] Connection service module (RTOS side):

[0146] Confirm that the destination is "app" and forward the data to the Bluetooth module.

[0147] Bluetooth service (RTOS side):

[0148] II. Internal Communication Flow Between the Dual Systems (RTOS and Android Interaction)

[0149] 1. RTOS to Android data transfer

[0150] RTOS-side functional modules: For example, after the logging module generates system logs, it encapsulates data frames (identifying "source" as RTOS and "destination" as Android) and transmits the data to the connection service module (RTOS side).

[0151] Connection service module (RTOS side): Passes the data to the preprocessing module (RTOS side) according to the "destination".

[0152] Preprocessing module (RTOS side): Takes a single frame of data, performs multi-frame aggregation, adds rate indicators, etc., and passes it to the preprocessing module (Android side).

[0153] Preprocessing module (Android side): Parses the data into single-frame data, then passes it to the connection service module (Android side), and finally routes it to the upper-layer service module for business processing.

[0154] 2. Android to RTOS data transfer

[0155] Upper-layer service module (Android side): Generates control commands (such as indicator light commands) and passes them to the connection service module (Android side).

[0156] Connection service module (Android side): Transmits one frame of data to the preprocessing module (Android side).

[0157] Preprocessing module (Android side): Re-encapsulates the first frame data and passes it to the preprocessing module (RTOS side).

[0158] Preprocessing module (RTOS side): Decapsulates the data into a single frame and transmits the data to the connection service module (RTOS side).

[0159] Connection service module (RTOS side): Routes data to the target functional module (such as the indicator light module to perform on / off operation) according to the "operation code".

[0160] III. Processing of Key Fields in Communication Protocols (Taking a Single Frame as an Example)

[0161] In each processing module, a single frame is encapsulated by the service initiator, and the main uses of the key fields are as follows:

[0162] Command code: Determines whether the current data frame is a data packet or a command packet.

[0163] Operation code: Determined by the connection service module, which module the current data is sent to.

[0164] Source / Destination: The connection service module determines the direction of data flow, such as whether to send it to Android, process it locally, or send it to the device.

[0165] Length: Assigned by the business module based on the actual number of bytes in the load (e.g., 1KB data stream corresponds to a length of 0x00000400).

[0166] Checksum: Generated by each business module using the CRC16 algorithm, covering the frame header and payload to ensure data integrity.

[0167] Corresponding to the above data processing method, this application also provides a data processing apparatus. Figure 6This is a schematic diagram of the structure of a data processing device provided in an embodiment of this application, which is a first processing device applied in smart glasses, such as... Figure 6 As shown, this embodiment provides a data processing apparatus, which includes:

[0168] Acquisition module 601 is used to acquire a first target data frame, the first target data frame including at least one first sub-data frame, the first sub-data frame including a frame header and a payload, the frame header including an opcode field;

[0169] The determination module 602 is used to determine the format information and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame for any first sub-data frame;

[0170] Module 603 is used to parse the payload based on format and length information to obtain parsed data;

[0171] Execution module 604 is used to perform corresponding processing operations based on the parsed data.

[0172] In one optional implementation, when the first target data frame includes multiple first sub-data frames, it is an aggregate frame; the frame header of the aggregate frame includes an aggregate packet identifier field, a first sub-data frame count field, and a first sub-data frame offset field; wherein, the value of the first sub-data frame count field is used to indicate the number of first sub-data frames included in the aggregate frame, and the value of the first sub-data frame offset field is used to indicate the byte offset of the starting position of each first sub-data frame relative to the starting position of the aggregate frame payload;

[0173] Module 601 is used specifically for:

[0174] When it is determined that the first target data frame contains an aggregation packet identifier field, the first target data frame is decapsulated according to the value of the first sub-data frame quantity field and the value of the first sub-data frame offset field in the first target data frame to obtain at least one first sub-data frame.

[0175] In one alternative implementation, execution module 604 is specifically used for:

[0176] The first functional module corresponding to the first sub-data frame is determined based on the value of the opcode field;

[0177] The parsed data is sent to the corresponding first functional module so that the first functional module can perform the corresponding processing operation based on the parsed data.

[0178] In an optional implementation, the smart glasses further include a second processing device, and the frame header of the first sub-data frame further includes a destination field. The determination module 602 is specifically used for:

[0179] Determine the value of the destination field corresponding to the first sub-data frame;

[0180] When the value of the destination field is the identifier of the first processing device, the format and length information of the payload are determined according to the value of the opcode field corresponding to the first sub-data frame;

[0181] Module 602 is also used for:

[0182] When the destination field is the identifier of the second processing device, the first sub-data frame is sent to the second processing device so that the second processing device can perform subsequent processing on the first sub-data frame after obtaining it.

[0183] In an optional implementation, the first sub-data frame includes a command code field, and the determining module 602, when sending the first sub-data frame to the second processing device, specifically performs the following:

[0184] The value of the command code field determines whether the first sub-data frame is a command packet or a data packet.

[0185] Multiple target first sub-data frames to be sent are encapsulated to obtain a second target data frame, where the target first sub-data frame is a data packet;

[0186] The second target data frame is sent to the second processing device.

[0187] In one optional implementation, the header of the first sub-data frame further includes a source field and a destination field; when the second target data frame is an aggregate frame, the header of the second target data frame further includes a rate identifier field, the value of which is determined based on the values ​​of the source field and the destination field in each of the first sub-data frames;

[0188] When determining whether to send the second target data frame to the second processing device, the module 602 is specifically used for:

[0189] The second target data frame is sent to the second processing device according to the value of the rate identifier field.

[0190] The data processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0191] Corresponding to the above data processing method, this application embodiment also provides another data processing apparatus. Figure 7 This is a schematic diagram of another data processing device provided in an embodiment of this application. The second processing device, applied in smart glasses, includes multiple second functional modules. The smart glasses include a first processing device and a second processing device. The first sub-data frame includes a frame header and a payload. The frame header contains an opcode field and a destination field, such as... Figure 7As shown, this embodiment provides a data processing apparatus, which includes:

[0192] The acquisition module 701 is used to acquire a first sub-data frame sent by the first processing device. The first sub-data frame is sent by the first processing device to the second processing device when the value of the destination field in the first sub-data frame is the value of the second processing device. When the value of the destination field in the first sub-data frame is the value of the first processing device, the first processing device determines the format information and length information of the payload according to the value of the opcode field corresponding to the first sub-data frame, and then parses the payload according to the format information and length information to obtain parsed data. The first sub-data frame is included in a first target data frame, and the first target data frame includes at least one first sub-data frame.

[0193] The determination module 702 is used to determine the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame.

[0194] Module 703 is used to parse the payload based on format and length information to obtain parsed data;

[0195] The sending module 704 is used to send the parsed data to the target application layer or the target second functional module so that the target application layer or the second functional module can perform corresponding processing operations on the parsed data, wherein the target application layer or the target second functional module is determined according to the value of the opcode field.

[0196] Another data processing device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0197] Figure 8 A schematic diagram of the structure of the electronic device provided in this application. Figure 8 As shown, the electronic device 80 provided in this embodiment includes at least one processor 801 and a memory 802. Optionally, the device 80 further includes a communication component 803. The processor 801, memory 802, and communication component 803 are connected via a bus 804.

[0198] In a specific implementation, at least one processor 801 executes computer execution instructions stored in memory 802, causing at least one processor 801 to perform the above-described method.

[0199] The specific implementation process of processor 801 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0200] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0201] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0202] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0203] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0204] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0205] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0206] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0207] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0208] The units described 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 can be selected to achieve the purpose of this embodiment according to actual needs.

[0209] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0210] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0211] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0212] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

Claims

1. A data processing method, characterized in that, A first processing device applied in smart glasses, the method comprising: Acquire a first target data frame, the first target data frame including at least one first sub-data frame, the first sub-data frame including a frame header and a payload, the frame header including an opcode field; For any first sub-data frame, determine the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame; The payload is parsed according to the format information and the length information to obtain parsed data; Perform corresponding processing operations based on the parsed data.

2. The method according to claim 1, characterized in that, When the first target data frame includes multiple first sub-data frames, it is an aggregate frame; the frame header of the aggregate frame includes an aggregate packet identifier field, a first sub-data frame count field, and a first sub-data frame offset field; wherein, the value of the first sub-data frame count field is used to indicate the number of first sub-data frames included in the aggregate frame, and the value of the first sub-data frame offset field is used to indicate the byte offset of the starting position of each first sub-data frame relative to the starting position of the aggregate frame payload; The acquisition of the first target data frame includes: When it is determined that the first target data frame contains an aggregation packet identifier field, the first target data frame is decapsulated according to the value of the first sub-data frame quantity field and the value of the first sub-data frame offset field in the first target data frame to obtain the at least one first sub-data frame.

3. The method according to claim 1, characterized in that, The smart glasses include multiple first functional modules that perform corresponding processing operations based on the parsed data, including: The first functional module corresponding to the first sub-data frame is determined based on the value of the opcode field. The parsed data is sent to the corresponding first functional module so that the first functional module performs corresponding processing operations based on the parsed data.

4. The method according to claim 1, characterized in that, The smart glasses also include a second processing device. The frame header of the first sub-data frame further includes a destination field. Based on the value of the opcode field corresponding to the first sub-data frame, the format and length information of the payload are determined, including: Determine the value of the destination field corresponding to the first sub-data frame; When the value of the destination field is the identifier of the first processing device, the format information and length information of the payload are determined according to the value of the opcode field corresponding to the first sub-data frame; The method further includes: When the destination field is an identifier of the second processing device, the first sub-data frame is sent to the second processing device so that the second processing device can perform subsequent processing on the first sub-data frame after obtaining it.

5. The method according to claim 4, characterized in that, The first sub-data frame includes a command code field. Sending the first sub-data frame to the second processing device includes: The value of the command code field determines whether the first sub-data frame is a command packet or a data packet. Multiple target first sub-data frames to be sent are encapsulated to obtain a second target data frame, wherein the target first sub-data frame is a data packet; The second target data frame is sent to the second processing device.

6. The method according to claim 5, characterized in that, The header of the first sub-data frame also includes a source field and a destination field; when the second target data frame is an aggregate frame, the header of the second target data frame also includes a rate identifier field, the value of which is determined based on the values ​​of the source field and the destination field in each of the first sub-data frames; Sending the second target data frame to the second processing device includes: The second target data frame is sent to the second processing device according to the value of the rate identifier field.

7. A data processing method, characterized in that, A second processing device for use in smart glasses, the second processing device including multiple second functional modules, the smart glasses including a first processing device and a second processing device, a first sub-data frame including a frame header and a payload, the frame header including an opcode field and a destination field, the method including: A first sub-data frame sent by a first processing device is acquired. This first sub-data frame is sent to the second processing device when the value of the destination field in the first sub-data frame is the value of the second processing device. When the value of the destination field in the first sub-data frame is the value of the first processing device, the first processing device determines the format and length information of the payload based on the value of the opcode field corresponding to the first sub-data frame. Then, it parses the payload based on the format and length information to obtain parsed data. The first processing device then performs corresponding processing operations based on the parsed data. The first sub-data frame is included in a first target data frame, and the first target data frame includes at least one first sub-data frame. Based on the value of the opcode field corresponding to the first sub-data frame, determine the format and length information of the payload; The payload is parsed according to the format information and the length information to obtain parsed data; The parsed data is sent to the target application layer or the target second functional module so that the target application layer or the second functional module performs corresponding processing operations on the parsed data, wherein the target application layer or the target second functional module is determined based on the value of the opcode field.

8. A type of smart glasses, characterized in that, include: A first processing device, and / or a second processing device; The first processing device is used to perform the method according to any one of claims 1-6; The second processing device is used to perform the method of claim 7.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1-7.

10. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.