A data display method and device, electronic equipment and storage medium
By performing validity checks and frame splicing on the messages to be processed, combined with character type decoding and exception handling, the problems of resource waste and parsing errors in the custom character display of color screens are solved, and stable and flexible character display is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHANGHAI ECAR TECHNOLOGY CO LTD
- Filing Date
- 2026-03-31
- Publication Date
- 2026-07-07
Smart Images

Figure CN122346346A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a data display method, apparatus, electronic device, and storage medium. Background Technology
[0002] Currently, custom character display technology for color screens typically employs a method of assigning different message identifiers (IDs) to characters of varying lengths to achieve multi-length character display. This approach requires setting multiple message IDs based on character length, leading to excessive consumption of message ID resources, wasted communication resources, and increased complexity and maintenance costs of the communication system.
[0003] Regarding character parsing, existing technologies are insufficient for processing Chinese character bytes distributed across frames. When the two encoded bytes of a Chinese character are located in two adjacent frames, parsing errors and garbled characters are prone to occur. In addition, existing solutions lack a robust exception handling mechanism. When exceptions such as frame loss, message timeout, or invalid data occur, they cannot be effectively handled, resulting in unstable character display and affecting display quality and user experience.
[0004] Meanwhile, existing solutions have poor compatibility with character display lengths, failing to flexibly adapt to diverse scenarios such as prompts and status texts of varying lengths, and thus failing to meet the versatility and flexibility requirements of custom character display on color screens. Therefore, how to accurately display characters has become an urgent problem to be solved. Summary of the Invention
[0005] This invention provides a data display method, apparatus, electronic device, and storage medium to solve the problem that character parsing in the prior art is prone to errors.
[0006] According to one aspect of the present invention, a data display method is provided, wherein the method includes: Obtain the message to be processed and perform message validity verification on the message to be processed; wherein, the message to be processed includes a character data area, a frame number control area and a verification area; When the message validity check passes, the message to be processed is spliced into a character data sequence according to the frame number control area and the preset packet assembly rules. The character type is determined based on the character data sequence, and the target character is obtained by parsing the character data sequence according to the decoding rules corresponding to the character type. The target characters are combined to obtain the text to be displayed, and the text to be displayed is displayed in a designated area of the display device.
[0007] According to another aspect of the present invention, a data display device is provided, wherein the device comprises: The message verification module is used to acquire the message to be processed and to verify the validity of the message; wherein the message to be processed includes a character data area, a frame number control area and a verification area; The character concatenation module is used to concatenate the data frames of the message to be processed according to the frame number control area and the preset packet assembly rules to obtain a character data sequence when the message validity verification is passed. The character parsing module is used to determine the character type based on the character data sequence, and parse the character data sequence according to the decoding rules corresponding to the character type to obtain the target character; A character display module is used to combine the target characters to obtain the text to be displayed, and to display the text to be displayed in a specified area of the display device.
[0008] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data display method according to any embodiment of the present invention.
[0009] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the data display method described in any embodiment of the present invention.
[0010] According to another aspect of the present invention, embodiments of the present invention also provide a computer program product, the computer program product including a computer program, which, when executed by a processor, implements the data display method of any embodiment of the present invention.
[0011] The technical solution of this invention involves acquiring a message to be processed, validating the message's validity, and then, if the validity verification passes, performing data framing and splicing on the message to be processed according to the frame number control area and preset packet assembly rules to obtain a character data sequence. The character type is determined based on the character data sequence, and the character data sequence is parsed according to the decoding rules corresponding to the character type to obtain the target character. The target characters are then combined to obtain the text to be displayed, and the text is displayed in a designated area on the display device. This achieves full-scenario custom character transmission using the same message format, eliminating the need for multiple IDs, reducing the complexity of the communication system, and improving resource utilization. Simultaneously, it supports mixed display of characters of different types, avoiding parsing errors and flexibly adapting to the text display needs of different scenarios.
[0012] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0013] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0014] Figure 1 This is a flowchart of a data display method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart of a data display method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of a data display device according to Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the structure of an electronic device that implements the data display method of this invention. Detailed Implementation
[0015] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0016] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0017] Example 1 Figure 1 This is a flowchart of a data display method according to Embodiment 1 of the present invention. This embodiment is applicable to the parsing and display of characters. The method can be executed by a data display device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes: S110. Obtain the message to be processed and perform message validity verification on the message to be processed.
[0018] The message to be processed can be understood as the message that needs to be parsed and displayed, and is the original data carrier for character display. In one embodiment, the message to be processed includes a character data area, a frame number control area, and a check area. In actual operation, the message to be processed can be a pre-set message format. The message to be processed is fixed to an 8-byte structure. The first 6 bytes are the character data area, used to store Chinese characters or American Standard Code for Information Interchange (ASCII). One frame of message can hold 3 Chinese characters (each Chinese character occupies 2 bytes) or 6 ASCII characters (each character occupies 1 byte). The 7th byte is the frame number control area. The high byte indicates the total number of frames (i.e., the total number of messages to be processed required to form a complete display of text in this round), and the low byte indicates the current frame number (i.e., the sequence number of the current message in the total number of frames, with the first frame having a sequence number of 1). The 8th byte is a check bit used to verify the integrity of the message data and prevent invalid data from entering the processing flow. Message validity verification refers to verifying the integrity and validity of received messages to be processed, so as to filter out invalid or erroneous messages and prevent abnormal data from entering subsequent processes.
[0019] In this embodiment, messages to be processed transmitted from outside can be received via a Controller Area Network (CAN) bus, RS485 bus, etc., and message validity verification can be performed by checking data integrity and frame number information validity. In actual operation, the check bit in the check area can be verified. If the check bit is incorrect, data integrity is deemed unsuccessful, and the message is discarded; if the check bit is correct, data integrity is deemed successful. If data integrity is successful, the total number of frames and the current number of frames in the frame number control area are checked to see if they meet preset conditions, such as whether the total number of frames is greater than or equal to 1, whether the current number of frames is greater than or equal to 1, and whether the first frame's current frame number is 1. If these conditions are met, the frame number information validity is deemed successful, and the message validity verification is deemed successful; if not, the message is deemed invalid and discarded.
[0020] S120. When the message validity check passes, the message to be processed is spliced into a character data sequence by data framing according to the frame number control area and the preset packet assembly rules.
[0021] The preset packet assembly rules can be understood as predefined rules for concatenating multiple frames of messages. These rules may include packet assembly triggering conditions and frame order reception rules, and are used to integrate the character data of multiple frames of messages into a complete character data sequence. The character data sequence refers to the continuous byte sequence after concatenating the character data of multiple frames of messages. It may contain all the character codes of the text to be displayed and serves as the input data for decoding.
[0022] In this embodiment, when the message validity check passes, the total number of frames and the current number of frames in the frame count control area of the message to be processed can be extracted. It is then determined whether the total number of frames and the current number of frames meet the preset packet assembly rules. If they do, a new round of character packet assembly is triggered, and a new cache is opened. If they do not meet the rules, the previous round of caching continues. In actual operation, the packet assembly triggering conditions in the preset packet assembly rules can be used to determine whether the message to be processed meets the preset packet assembly rules. Generally, the packet assembly triggering conditions may include: the total number of frames of the message to be processed being a non-zero value and inconsistent with the total number of frames of the message to be processed received in the previous round; the current number of frames of the message to be processed being a non-zero value and smaller than the current number of frames of the message to be processed received in the previous round; and the current number of frames of the message to be processed being a first value, where the first value can be 1, meaning the total number of frames is inconsistent with the previous round, the current number of frames is 1, or the current number of frames is smaller than the previous round. In actual operation, when a new round of character packet assembly is triggered and a new cache is opened, historical cache data can be cleared, and the character data area of the current message can be used as the initial cache data. If the total number of frames is 1 (single-frame text), the initial cache data can be directly used as the character data sequence. If the total number of frames is greater than 1 (multiple-frame text), new messages of the same round with the total number of frames can be received in ascending order of the current frame number, and the character data area of the new message can be appended to the initial cache data sequentially to form cache data. This continues until the current frame number of the received message equals the total frame number, at which point the cache data is a complete character data sequence. When no packet assembly is triggered and the previous round of caching continues, historical cache data can be extracted, and the character data area of the current message can be appended to the historical cache data to form new cache data. If the current frame number equals the total frame number, the new cache data is a character data sequence. If the current frame number is less than the total frame number, new messages of the same round are received in frame order and appended to the cache data until the current frame number equals the total frame number, and the final cache data is used as the character data sequence.
[0023] S130. Determine the character type based on the character data sequence, and parse the character data sequence according to the decoding rules corresponding to the character type to obtain the target character.
[0024] Character type can be understood as a classification based on byte encoding characteristics. Character types include single-byte characters (ASCII characters) and double-byte characters (such as Chinese characters). Decoding rules refer to the encoding and parsing rules for different character types. Taking single-byte characters as ASCII characters as an example and double-byte characters as Chinese characters as an example, single bytes are parsed according to ASCII, while double bytes are parsed according to Chinese character encoding rules such as GB2312. The target byte refers to the smallest displayable unit obtained after decoding the character data sequence, i.e., the decoded ASCII character or Chinese character, etc.
[0025] In this embodiment, the character data sequence can be checked byte by byte in byte order. Different character types may correspond to different high-order byte identifiers. For example, when the high-order byte is 0, the character type is determined to be a single-byte character; when the high-order byte is 0, the character type is determined to be a double-byte character. A single-byte character can be directly treated as an independent character, while a double-byte character can be combined with its immediately following byte to form a complete character. If a double-byte character spans multiple frames (e.g., the 6th byte of the previous frame, the 1st byte of the next frame), it can also be directly combined until the character end identifier (e.g., 0x00) is detected, at which point the combination stops. The character data sequence is then parsed according to the decoding rules corresponding to the character type to obtain the target character. For example, single-byte characters can be parsed according to ASCII rules, and double-byte characters can be parsed according to Chinese character encoding rules such as GB2312, ultimately resulting in multiple displayable target characters.
[0026] S140. Combine the target characters to obtain the text to be displayed, and display the text to be displayed in the specified area of the display device.
[0027] The text to be displayed refers to the complete text formed by combining multiple target characters in sequence. The display device refers to a pre-set electronic device used to display the text, such as a color screen monitor. The display device can display the corresponding text to be displayed in a preset designated area (such as a battery level area or a notification area).
[0028] In this embodiment, all target characters can be combined in parsing order to form complete text to be displayed. If any frames are lost during the frame assembly process, preset characters such as "□" are filled into the character positions corresponding to the lost frames to avoid display gaps. The text to be displayed is then output to a preset designated area of the display device.
[0029] In this embodiment of the invention, a message to be processed is acquired, and its validity is verified. If the validity verification passes, the message to be processed is framed and concatenated according to the frame number control area and preset packet assembly rules to obtain a character data sequence. The character type is determined according to the character data sequence, and the character data sequence is parsed according to the decoding rules corresponding to the character type to obtain the target character. The target characters are combined to obtain the text to be displayed, and the text to be displayed is displayed in a designated area of the display device. This enables the transmission of custom characters in all scenarios using the same message format, without the need to occupy multiple IDs, reducing the complexity of the communication system, improving resource utilization, and supporting the mixed display of characters of different character types to avoid parsing errors and flexibly adapting to the text display needs of different scenarios.
[0030] In one embodiment, after obtaining the message to be processed and performing message validity verification on the message to be processed, the method further includes: When it is determined that the data integrity of the message to be processed fails or the message validity check of the message to be processed fails, the message to be processed is determined to be an invalid message and is discarded.
[0031] In this embodiment, if it is determined that the data integrity of the message to be processed fails or the message validity check of the message to be processed fails, the message to be processed can be considered as not conforming to the standard. The message to be processed can be considered as invalid and discarded to avoid subsequent parsing errors that lead to garbled text.
[0032] In one embodiment, before combining the target characters to obtain the text to be displayed and displaying the text to be displayed in a designated area of the display device, the method further includes: If a frame is lost during the current data frame assembly process, a preset character will be filled in the character position corresponding to the lost frame.
[0033] The preset character can be a pre-set character used to fill the character position corresponding to the lost frame. For example, the preset character can include, but is not limited to, □.
[0034] In this embodiment, if a frame is lost during the current data frame assembly process, preset characters can be added to the character positions corresponding to the lost frames to ensure stable character display; at the same time, it facilitates the location of the problematic frame in case of anomalies. In one embodiment, when a message to be processed is offline for more than a preset time (e.g., 10 seconds), a custom area can be cleared to ensure stable character display.
[0035] Example 2 Figure 2This is a flowchart of a data display method according to Embodiment 2 of the present invention. This embodiment is a further optimization and extension based on the above embodiments, and can be combined with various optional technical solutions in the above embodiments. Figure 2 As shown, the method includes: S201, Receive messages to be processed via the bus.
[0036] In this context, the high-order bits of the frame number control area of the message constitute the total number of frames of the text to be displayed, while the low-order bits represent the sequence number of the current frame within the total number of frames.
[0037] In this embodiment, a message to be processed can be received via a bus such as a CAN bus, and the high-order identifier and low-order identifier can be separated from the frame number control area of the message as the total frame number and the current frame number.
[0038] S202. Verify the checksum of the message to be processed. If the checksum is incorrect, the data integrity of the message to be processed is deemed to be unsuccessful. If the checksum is correct, the data integrity is deemed to be successful.
[0039] In this embodiment, the check bits of the check area can be extracted, and the correctness of the check bits in the check area of the message to be processed can be verified by methods such as summation. If the check bit verification fails, the data integrity of the message to be processed can be considered to have failed; if the check bit verification succeeds, the data integrity can be considered to have passed.
[0040] S203. When data integrity is passed, determine whether the total number of frames and the current number of frames in the frame number control area meet the preset frame number judgment conditions.
[0041] The preset frame count judgment condition can be understood as a pre-set condition for determining the validity of the frame count information of the message to be processed. For example, the preset frame count judgment condition may include, but is not limited to, total frame count ≥ 1, current frame count ≥ 1, and the current frame count of the first frame must be 1.
[0042] In this embodiment, when the data integrity is determined to be passed, it can be determined whether the total number of frames and the current number of frames meet the preset frame count judgment conditions.
[0043] S204. If the total number of frames and the current number of frames meet the preset frame count judgment conditions, the validity of the frame count information of the message to be processed is determined to be passed. If the total number of frames and the current number of frames do not meet the preset frame count judgment conditions, the validity of the message to be processed is determined to be failed.
[0044] In this embodiment, when the total number of frames and the current number of frames meet the preset frame count judgment conditions, the frame count information of the message to be processed can be considered valid; when the total number of frames and the current number of frames do not meet the preset frame count judgment conditions, the frame count information of the message to be processed can be considered invalid.
[0045] S205. If the data integrity of the message to be processed is passed and the frame number information is valid, the message validity check of the message to be processed is determined to be passed.
[0046] In this embodiment, when both the data integrity and frame number information validity of the message to be processed are satisfied, the message validity check of the message to be processed is considered to be passed.
[0047] S206. When the message validity check passes, extract the total number of frames and the current number of frames in the frame count control area, and determine whether the total number of frames and the current number of frames meet the packet triggering conditions in the preset packet assembly rules.
[0048] In one embodiment, the packet assembly triggering condition includes at least one of the following: the total number of frames of the pending messages is non-zero and is inconsistent with the total number of frames of the pending messages received in the previous round; the current number of frames of the pending messages is non-zero and is smaller than the current number of frames of the pending messages received in the previous round; the current number of frames of the pending messages is a first value. Generally, the first value can be 1.
[0049] In this embodiment, when the message validity check passes, the total number of frames and the current number of frames can be extracted to determine whether the total number of frames and the current number of frames meet the packet assembly triggering conditions.
[0050] S207. If the packet assembly triggering condition is met, trigger the clearing of historical cache data and use the character data area of the message to be processed as the initial cache data.
[0051] Historical cache data can be understood as cached data that stores character data that was not fully concatenated in the previous round. Initialized cache data refers to the reconstructed buffer data.
[0052] In this embodiment, if it is determined that the total number of frames and the current number of frames meet the packet assembly triggering condition, the historical cache data can be cleared and the character data area of the message to be processed can be stored in the cache area as the initial cache data.
[0053] S208. If the total number of frames of the message to be processed is the target value, the initial buffer data will be used as a character data sequence.
[0054] The target value can be a pre-set value, such as 1.
[0055] In this embodiment, when it is determined that the total number of frames of the message to be processed is the target value, the message to be processed can be determined to be a single frame of data, and the initialization cache data can be used as a character data sequence.
[0056] S209. If the total number of frames of the message to be processed is greater than the target value, new messages to be processed belonging to the same round of total frames are received in ascending order of the current frame number. The character data area content of the new message to be processed is appended to the initial buffer data in sequence to form the first buffer data. This process continues until the current frame number of the new message to be processed is the same as the total number of frames. The final first buffer data is then used as the character data sequence.
[0057] The total number of frames in the same round can be understood as the total number of frames belonging to the same text to be displayed.
[0058] In this embodiment, when it is determined that the total number of frames of the messages to be processed is greater than the target value, it can be determined that the messages to be processed are multi-frame data. New messages to be processed belonging to the same total number of frames in the same round are received in ascending order of the current frame number. For example, if the total number of frames is 3 and the current frame number of the messages to be processed is 1, the messages to be processed with the current frame number of 2 can continue to be received sequentially. The character data area content of the new messages to be processed is appended to the initial buffer data in sequence to form the first buffer data. This continues until the current frame number is the same as the total number of frames, indicating that the messages to be processed in the same total number of frames in the same round have been received. The final first buffer data is then used as the character data sequence. S210. If the packet assembly triggering condition is not met, extract the historical cache data and append the character data area of the message to be processed to the historical cache data to form the second cache data.
[0059] In this embodiment, if the packet triggering condition is not met, the historical cache data can be directly appended to the character data area of the message to be processed to obtain new cache data as the second cache data.
[0060] S211. If the current frame number of the message to be processed is the same as the total frame number, the second buffer data is used as a character data sequence.
[0061] In an embodiment, if the current frame number of the message to be processed is the same as the total number of frames, that is, the current message to be processed is the last message of the previous round, then the second buffered data can be used as a character data sequence.
[0062] S212. If the current frame number is less than the total frame number, new messages to be processed belonging to the same round of total frames are received in ascending order of the current frame number. The character data area content of the new message to be processed is appended to the second buffer data in sequence until the current frame number of the new message to be processed is the same as the total frame number. The final second buffer data is used as the character data sequence.
[0063] In an embodiment, if it is determined that the current frame number is less than the total frame number, it can be considered that the current data to be processed is not the last frame. In this case, new messages to be processed belonging to the same round of total frames can be received in ascending order of the current frame number. The character data area content of the new message to be processed is appended to the second buffer data in sequence until all messages to be processed in the same round are received. The final second buffer data is then used as the character data sequence.
[0064] S213. Determine the character type byte by byte according to the byte order of the character data sequence.
[0065] If the high-order bit of a byte is the first value, the byte is determined to be a single-byte character; if the high-order bit of a byte is the second value, the byte is determined to be a double-byte character.
[0066] In this embodiment, the bytes in the character data sequence can be parsed byte by byte to determine the character type. If the high bit of a byte is a first value, such as 0, the byte is determined to be a single-byte character. If the high bit of a byte is a second value, such as 1, the byte is determined to be a double-byte character.
[0067] S214. When the character type is determined to be a single-byte character, each byte is treated as an independent character. When the character type is determined to be a double-byte character, the byte is combined with the immediately following byte to form a complete character, until the character end identifier is detected.
[0068] The character end marker refers to the byte that marks the end of the text (usually 0x00). When this marker is detected, character parsing stops.
[0069] In this embodiment, if the character type is a single-byte character, a single byte can be directly treated as an independent character. If the character type is a double-byte character, the byte can be combined with the next adjacent byte to form a complete character until the character end marker is identified, at which point character combination stops.
[0070] S215. Parse the independent characters and complete characters according to the decoding rules corresponding to the character types to obtain the target characters.
[0071] In this embodiment, decoding rules corresponding to each character type can be determined, and independent characters and complete characters can be parsed according to the decoding rules corresponding to each character type to obtain the target character. For example, independent characters can be decoded according to ASCII rules, and complete characters can be decoded according to GB2312 Chinese character encoding rules to obtain the target character.
[0072] S216. Combine the target characters to obtain the text to be displayed, and display the text to be displayed in the specified area of the display device.
[0073] In this embodiment of the invention, a message to be processed is received via a bus. The checksum bit in the checksum area of the message to be processed is verified to determine if data integrity is satisfied. Then, the total number of frames and the current number of frames in the frame count control area are checked to see if they meet preset frame count judgment conditions. If the data integrity of the message to be processed is satisfied and the frame count information is valid, the message validity check of the message to be processed is deemed successful. This multiple verification ensures the reliability of the message. When the message validity check is successful, the total number of frames and the current number of frames in the frame count control area are extracted. It is then determined whether the total number of frames and the current number of frames meet the packet assembly triggering conditions in the preset packet assembly rules. If the packet assembly triggering conditions are met, the packet assembly is triggered. Clear historical cache data, and use the character data area of the message to be processed as the initial cache data. If the total number of frames of the message to be processed is the target value, use the initial cache data as the character data sequence. If the total number of frames of the message to be processed is greater than the target value, receive new messages to be processed belonging to the same round of total frames in ascending order of the current frame number, and append the content of the character data area of the new message to the initial cache data to form the first cache data. Continue until the current frame number of the received new message to be processed is the same as the total number of frames, and use the final first cache data as the character data sequence. If the packet assembly trigger condition is not met... The process involves retrieving historical cached data and appending the character data area of the message to be processed to the historical cached data to form a second cached data. If the current frame number of the message to be processed is the same as the total frame number, the second cached data is used as the character data sequence. If the current frame number is less than the total frame number, new messages to be processed belonging to the same round of total frames are received in ascending order of the current frame number. The character data area of the new message to be processed is appended to the second cached data sequentially until the current frame number of the new message to be processed is the same as the total frame number. The final second cached data is then used as the character data sequence, ensuring that the text to be displayed belonging to the same round can be decoded simultaneously. Analysis: When the character type is determined to be a single-byte character, each byte is treated as an independent character. When the character type is determined to be a double-byte character, the byte is combined with the immediately following byte to form a complete character. This process continues until the end-of-character identifier is detected. The independent characters and complete characters are parsed according to the decoding rules corresponding to the character type to obtain the target character. The target characters are then combined to obtain the text to be displayed, which is then displayed in a designated area on the display device. This achieves compatibility with ASCII characters and Chinese characters, supports mixed display, and incorporates combination parsing logic for cross-frame Chinese characters to avoid parsing errors and garbled characters.
[0074] Example 3 In one embodiment, this embodiment uses ASCII characters as single-byte characters, Chinese characters as double-byte characters, a unique message ID (0x290) as the message ID to be processed, and a color screen as the display device as an example to further illustrate a data display method.
[0075] This solution achieves full-scene display control of the custom character area on the color screen through a unique message ID (0x290), eliminating the need to occupy multiple message IDs; it defines a standardized 8-byte message structure, integrating character data, frame number information, and verification information; it implements mixed parsing of Chinese characters and ASCII characters based on the GB2312 encoding rules, and designs combination parsing logic for cross-frame Chinese characters; at the same time, it constructs a complete exception handling mechanism to ensure stable and accurate character display.
[0076] The message structure definition uses a unique message ID (0x290) to transmit all data required for displaying custom characters. The message is fixed at 8 bytes, and the functions of each byte are defined as follows: Bytes 1-6: Character data area, used to store Chinese characters or ASCII character codes. One frame of message can hold 3 Chinese characters (each Chinese character occupies 2 bytes) or 6 ASCII characters (each character occupies 1 byte); Byte 7: Frame number control area, the high byte indicates the total number of frames (i.e., the total number of 0x290 messages required to form a complete display of text in this round), and the low byte indicates the current frame number (i.e., the sequence number of the current message in the total number of frames, the first frame sequence number is 1); Byte 8: Checksum, used to verify the integrity of the message data and prevent invalid data from entering the processing flow.
[0077] The data display processing flow is as follows: message reception → verification → frame validity judgment → packet assembly triggering → character parsing → exception handling → combined display. The specific process is explained below: Step 1. Message Reception: The color screen receives the 0x290 message transmitted by the bus and enters the data processing flow.
[0078] Step 2. Verification: Verify the checksum of the 8th byte of the message. If the verification fails, discard the message frame directly.
[0079] Step 3. Frame validity judgment: Determine whether the total number of frames and the current number of frames in the 7th byte are valid. The valid conditions are that the total number of frames is ≥1, the current number of frames is ≥1, and the current number of the first frame is 1. If the total number of frames is 0 and the current number of frames is 0, it is determined to be an invalid frame and discarded.
[0080] Step 4. Packet Assembly Trigger: A new round of character packet assembly is triggered when one of the following three situations occurs (the previous round of cache is cleared and a new cache is started): ① The total number of frames changes to be non-zero; ② The current frame number decreases to be non-zero (to deal with the scenario of missing the first frame); ③ The current frame number is 1.
[0081] Step 5. Character parsing: Process in sequence according to the 1st to 6th bytes in the message. Parse based on the GB2312 encoding rule: When the high byte of a byte is 0, it is parsed as an ASCII character alone; when the high byte of a byte is 1, it is combined with the subsequent adjacent byte for parsing as a Chinese character; if the two encoding bytes of a Chinese character cross frames (the 6th byte of the previous frame and the 1st byte of the next frame), then automatically combine the corresponding bytes of the two frames and parse.
[0082] Step 6. Exception handling: ① Frame loss: When a certain frame is not received, use "□□□" to replace the character position of that frame; ② End identifier: When the byte "0x00" appears for the first time, it is regarded as the end of the characters in this round, and stop processing the subsequent content; ③ Timeout handling: When the 0x290 message is offline for more than 10 seconds, clear and display the custom area.
[0083] Step 7. Combined display: When the current frame number is equal to the total number of frames (both non-zero) or the end identifier "0x00" appears, complete the combination of characters in this round and display them centered; before the conditions are met, do not splice and display, and if there are no new characters, retain the content displayed in the previous round.
[0084] In one embodiment, taking the display of "Color screen custom display test" (9 Chinese characters, requiring 3 message frames, total number of frames 3) as an example, the specific implementation process is as follows: The 1st message frame includes 8 bytes, corresponding to the three Chinese characters "Color screen self" (current frame number 1, total number of frames 3): BC (10111100, high byte of "color"), 2A (00101010, low byte of "color"), C6 (11000110, high byte of "screen"), C1 (11000001, low byte of "screen"), D7 (11010111, high byte of "self"), D4 (11010100, low byte of "self"), 0x31 (high bit 0x3 = total number of frames 3, low bit 0x1 = current frame number 1), check bit (such as 0x1A, etc.). That is to say, when it is determined that the high byte of the first byte corresponds to a Chinese character, the current byte can be combined with the next byte as a Chinese character.
[0085] The 2nd message frame includes 8 bytes, corresponding to the three Chinese characters "Definition display" (current frame number 2, total number of frames 3): B6 (10110110, high byte of "define"), A8 (10101000, low byte of "define"), D2 (11010010, high byte of "meaning"), E5 (11100101, low byte of "meaning"), CF (11001111, high byte of "display"), D6 (11010100, low byte of "display"), 0x32 (high bit 0x3 = total number of frames 3, low bit 0x2 = current frame number 2), check bit.
[0086] The 3rd frame message contains 8 bytes, corresponding to the three Chinese characters "Show Test" (current frame number 3, total frame number 3): CA (11001010, high byte of "Show"), BE (10111110, low byte of "Show"), B2 (10110010, high byte of "Test"), E2 (11100010, low byte of "Test"), CA (11001010, high byte of "Test"), FD (11010100, low byte of "Test"), 0x33 (high bit 0x3 = total frame number 3, low bit 0x3 = current frame number 3), and checksum bit.
[0087] Processing process: The color screen receives the 1st frame. After passing the check, packet assembly is triggered because the current frame number is 1, and "Color, Screen, Self" is cached and parsed; it receives the 2nd frame, and "Define, Display" is parsed after passing the check; it receives the 3rd frame, and "Show, Test, Test" is parsed. After passing the check, it is confirmed that the current frame number = total frame number; Character combination is triggered, and "Color Screen Custom Display Test" is centered and displayed; if the 2nd frame is lost, then "Color Screen Self □□□ Show Test" is finally displayed.
[0088] In this embodiment, full-scenario custom character transmission is achieved through a unique message ID (0x290), without occupying multiple IDs, reducing the complexity of the communication system, saving communication resources, and improving resource utilization rate; Based on the GB2312 coding rule, it is compatible with ASCII characters and Chinese characters, supports mixed display, and at the same time designs a combined parsing logic for cross-frame Chinese characters to avoid parsing errors and garbled codes, achieving accurate and reliable parsing; At the same time, it covers various abnormal scenarios such as invalid frames, frame loss, end identifiers, timeouts, etc., ensuring stable character display and improving user experience; And in case of abnormal situations, it is convenient to locate the problematic frame; Moreover, one frame message can carry 3 Chinese characters / 6 ASCII characters, and at most 7 frames can cover the display requirements of 20 Chinese characters / 40 ASCII characters, flexibly adapting to the text display requirements of different scenarios; And the character processing sequence, packet assembly, and display trigger conditions are clear and definite, the software implementation logic is simple, and the later maintenance cost is low.
[0089] Embodiment 4 Figure 3 It is a structural schematic diagram of a data display device provided according to Embodiment 3 of the present invention. As Figure 3 shown, the device includes: a message verification module 31, a character splicing module 32, a character parsing module 33, and a character display module 34.
[0090] Among them, the message verification module 31 is used to obtain the message to be processed and perform message validity verification on the message to be processed; among them, the message to be processed includes a character data area, a frame number control area, and a verification area.
[0091] The character concatenation module 32 is used to concatenate the data frames of the message to be processed according to the frame number control area and the preset packet assembly rules to obtain a character data sequence when the message validity check passes.
[0092] The character parsing module 33 is used to determine the character type based on the character data sequence and parse the character data sequence according to the decoding rules corresponding to the character type to obtain the target character.
[0093] The character display module 34 is used to combine target characters to obtain the text to be displayed, and to display the text to be displayed in a specified area of the display device.
[0094] The technical solution of this invention involves obtaining a message to be processed through a message verification module, validating the message, and then, if the message validity verification passes, concatenating the message according to the frame number control area and preset packet assembly rules to obtain a character data sequence. A character parsing module determines the character type based on the character data sequence and parses the character data sequence according to the decoding rules corresponding to the character type to obtain the target character. Finally, a character display module combines the target characters to obtain the text to be displayed and displays the text in a designated area on the display device. This achieves full-scenario custom character transmission using the same message format, eliminating the need for multiple IDs, reducing the complexity of the communication system, and improving resource utilization. Furthermore, it supports mixed display of characters of different types, avoiding parsing errors and flexibly adapting to the text display needs of different scenarios.
[0095] In one embodiment, the message verification module 31 includes: The message receiving unit is used to receive messages to be processed via the bus; the high-order bits of the frame number control area of the message to be processed form the total number of frames of the text to be displayed, and the low-order bits are the sequence number of the current frame in the total number of frames. The integrity judgment unit is used to verify the check bit of the check area of the message to be processed. If the check bit verification is incorrect, the data integrity of the message to be processed is determined to be unsuccessful. If the check bit verification is correct, the data integrity is determined to be successful. The frame count determination unit is used to determine whether the total number of frames and the current number of frames in the frame count control area meet the preset frame count determination conditions when the data integrity is passed. The frame count verification unit is used to determine that the frame count information of the message to be processed is valid if the total frame count and the current frame count meet the preset frame count judgment conditions, and to determine that the message validity verification of the message to be processed is unsuccessful if the total frame count and the current frame count do not meet the preset frame count judgment conditions. The message verification unit is used to determine that the message validity verification of the message to be processed has passed if the data integrity of the message to be processed is passed and the frame number information is valid.
[0096] In one embodiment, the data display device further includes: The message discarding module is used to determine that a message to be processed is invalid when the data integrity of the message to be processed fails or the message validity check of the message to be processed fails, and to discard the invalid message.
[0097] In one embodiment, the character concatenation module 32 includes: The condition judgment unit is used to extract the total number of frames and the current number of frames in the frame number control area, and determine whether the total number of frames and the current number of frames meet the packet triggering conditions in the preset packet grouping rules; The initial cache unit is used to clear historical cache data and use the character data area of the message to be processed as the initial cache data if the packet assembly triggering condition is met. The first splicing unit is used to initialize the buffer data as a character data sequence if the total number of frames of the message to be processed is the target value; The second splicing unit is used to receive new messages to be processed belonging to the same total number of frames in the same round in ascending order of the current frame number when the total number of frames of the message to be processed is greater than the target value. The character data area content of the new message to be processed is appended to the initial buffer data in sequence to form the first buffer data until the current frame number of the new message to be processed is the same as the total number of frames. The final first buffer data is used as the character data sequence. The data caching unit is used to extract historical cached data and append the character data area of the message to be processed to the historical cached data to form a second cached data if the packet assembly triggering condition is not met. The third splicing unit is used to treat the second buffered data as a character data sequence if the current frame number of the message to be processed is the same as the total frame number. The fourth splicing unit is used to receive new messages to be processed belonging to the same total number of frames in ascending order of the current frame number when the current frame number is less than the total number of frames. The character data area of the new message to be processed is appended to the second buffer data in sequence until the current frame number of the new message to be processed is the same as the total number of frames. The final second buffer data is then used as the character data sequence.
[0098] In one embodiment, the packet triggering condition includes at least one of the following: The total number of frames of pending messages is a non-zero value and is inconsistent with the total number of frames of pending messages received in the previous round; The current frame number of the message to be processed is a non-zero value and is smaller than the current frame number of the message to be processed received in the previous round; The current frame number of the message to be processed is the first value.
[0099] In one embodiment, the character parsing module 33 includes: The type confirmation unit is used to determine the character type byte by byte according to the byte order of the character data sequence; wherein, if the high bit of the byte is the first value, the byte is determined to be a single-byte character, and if the high bit of the byte is the second value, the byte is determined to be a double-byte character. The character determination unit is used to treat each byte as an independent character when the character type is determined to be a single-byte character, and to combine the byte with the next adjacent byte as a complete character when the character type is determined to be a double-byte character, until the end-of-character identifier is detected. The character parsing unit is used to parse independent characters and complete characters according to the decoding rules corresponding to the character type to obtain the target character.
[0100] In one embodiment, the data display device further includes: The character filling module is used to fill the character positions of the lost frames with preset characters when there are frame losses during the current data frame splicing process.
[0101] The data display device provided in the embodiments of the present invention can execute the data display method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0102] Example 5 Figure 4 This is a schematic diagram of the structure of an electronic device implementing the data display method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0103] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0104] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0105] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as data display methods.
[0106] In some embodiments, the data display method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the data display method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the data display method by any other suitable means (e.g., by means of firmware).
[0107] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0108] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0109] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0110] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0111] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0112] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0113] In one embodiment, the present invention further includes a computer program product, which includes a computer program that, when executed by a processor, implements the data display method of any embodiment of the present invention.
[0114] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0115] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and no limitation is imposed herein.
[0116] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A data display method, characterized in that, include: Obtain the message to be processed and perform message validity verification on the message to be processed; wherein, the message to be processed includes a character data area, a frame number control area and a verification area; When the message validity check passes, the message to be processed is spliced into a character data sequence according to the frame number control area and the preset packet assembly rules. The character type is determined based on the character data sequence, and the target character is obtained by parsing the character data sequence according to the decoding rules corresponding to the character type. The target characters are combined to obtain the text to be displayed, and the text to be displayed is displayed in a designated area of the display device.
2. The method according to claim 1, characterized in that, The step of obtaining the message to be processed and performing message validity verification on the message to be processed includes: The message to be processed is received via the bus; the high-order identifier of the frame number control area of the message to be processed constitutes the total number of frames of the text to be displayed, and the low-order identifier is the sequence number of the current frame in the total number of frames. Verify the checksum bit of the checksum area of the message to be processed. If the checksum bit is incorrectly verified, the data integrity of the message to be processed is determined to be unsuccessful. If the checksum bit is correctly verified, the data integrity is determined to be successful. When the data integrity is passed, determine whether the total number of frames and the current number of frames in the frame number control area meet the preset frame number judgment conditions; If the total number of frames and the current number of frames meet the preset frame count judgment condition, the validity of the frame count information of the message to be processed is determined to be passed; if the total number of frames and the current number of frames do not meet the preset frame count judgment condition, the validity of the message to be processed is determined to be failed. If the data integrity of the message to be processed is passed and the frame number information is valid, the message validity check of the message to be processed is determined to be passed.
3. The method according to claim 1, characterized in that, After obtaining the message to be processed and performing message validity verification on the message to be processed, the method further includes: When it is determined that the data integrity of the message to be processed fails or the message validity check of the message to be processed fails, the message to be processed is determined to be an invalid message and the invalid message is discarded.
4. The method according to claim 1, characterized in that, The step of framing and concatenating the message to be processed according to the frame number control area and the preset packet assembly rules to obtain a character data sequence includes: Extract the total number of frames and the current number of frames in the frame number control area, and determine whether the total number of frames and the current number of frames meet the packet triggering conditions in the preset packet grouping rules; If the packet assembly triggering condition is met, the historical cache data will be cleared, and the character data area of the message to be processed will be used as the initial cache data. If the total number of frames of the message to be processed is the target value, the initialization cache data will be used as a character data sequence. If the total number of frames of the pending messages is greater than the target value, new pending messages belonging to the same round of total frames are received in ascending order of the current frame number. The character data area content of the new pending messages is appended to the initial buffer data in sequence to form the first buffer data. This process continues until the current frame number of the received new pending messages is the same as the total number of frames. The final first buffer data is then used as the character data sequence. If the packet assembly triggering condition is not met, extract the historical cache data and append the character data area of the message to be processed to the historical cache data to form the second cache data; If the current frame number of the message to be processed is the same as the total frame number, the second cached data is used as a character data sequence; If the current frame number is less than the total frame number, new messages to be processed belonging to the same round of total frames are received in ascending order of the current frame number. The character data area content of the new message to be processed is appended to the second buffer data in sequence until the current frame number of the new message to be processed is the same as the total frame number. The final second buffer data is then used as the character data sequence.
5. The method according to claim 1, characterized in that, The packet triggering condition includes at least one of the following: The total number of frames of pending messages is a non-zero value and is inconsistent with the total number of frames of pending messages received in the previous round; The current frame number of the message to be processed is a non-zero value and is smaller than the current frame number of the message to be processed received in the previous round. The current frame number of the message to be processed is the first value.
6. The method according to claim 1, characterized in that, The step of determining the character type based on the character data sequence and parsing the character data sequence according to the decoding rules corresponding to the character type to obtain the target character includes: The character type is determined byte by byte according to the byte order of the character data sequence; if the high byte of a byte is a first value, the byte is determined to be a single-byte character, and if the high byte of a byte is a second value, the byte is determined to be a double-byte character. When the character type is determined to be a single-byte character, each byte is treated as an independent character. When the character type is determined to be a double-byte character, the byte is combined with the immediately following byte to form a complete character, until the character end identifier is detected. The target character is obtained by parsing the independent character and the complete character according to the decoding rules corresponding to the character type.
7. The method according to claim 1, characterized in that, Before combining the target characters to obtain the text to be displayed and displaying the text to be displayed in a designated area of the display device, the method further includes: If a frame is lost during the current data frame assembly process, a preset character will be filled in the character position corresponding to the lost frame.
8. A data display device, characterized in that, include: The message verification module is used to acquire the message to be processed and to verify the validity of the message; wherein the message to be processed includes a character data area, a frame number control area and a verification area; The character concatenation module is used to concatenate the data frames of the message to be processed according to the frame number control area and the preset packet assembly rules to obtain a character data sequence when the message validity verification is passed. The character parsing module is used to determine the character type based on the character data sequence, and parse the character data sequence according to the decoding rules corresponding to the character type to obtain the target character; A character display module is used to combine the target characters to obtain the text to be displayed, and to display the text to be displayed in a specified area of the display device.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data display method according to any one of claims 1-7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the data display method according to any one of claims 1-7.