Disclosure of Invention
The embodiment of the application aims to provide a method and a device for generating development data of an automobile instrument, which can preview a display interface of the automobile instrument in real time, so that the coding time and the debugging period are shortened.
An embodiment of the present application provides a method for generating vehicle instrument development data, including:
acquiring an engineering explanation file for developing the vehicle instrument;
generating a rendering directory tree according to the engineering interpretation file;
generating an instrument preview interface for the vehicle according to the rendering directory tree;
and when receiving a confirmation instruction for the vehicle instrument preview interface, generating vehicle instrument development data required by coding according to the engineering explanation file.
In the implementation process, a rendering directory tree is generated according to the engineering interpretation file, then a vehicle instrument preview interface is generated according to the rendering directory tree, finally vehicle instrument development data required by coding is generated according to the rendering directory tree when a confirmation instruction for the vehicle instrument preview interface is received, and further the technical effects of previewing a display interface of a vehicle instrument in real time and shortening coding time and debugging period are achieved.
Further, the vehicle instrument development data includes header file data, source file data, drawing interface data of the source file data, and an optical disc image file required for programming.
In the implementation process, the effect of the preview interface of the vehicle instrument can be ensured to be seamlessly linked to the realization of the code by automatically generating the development data of the vehicle instrument, and the error of manual coding is reduced.
Further, the engineering interpretation file includes meter usage field Jing Dingyi data, background definition data, picture class drawing operation definition data, text class drawing operation definition data, minimum word stock data, and file format definition data of the vehicle meter development data.
In the implementation process, the engineering explanation file is adopted to define the related data required by the development of the vehicle instrument, so that the machine analysis is easy.
Further, generating a vehicle instrument preview interface according to the rendering directory tree, including:
receiving a selection instruction for selecting a node of the rendering directory tree, the selection instruction comprising a target preview node:
and generating a vehicle instrument preview interface corresponding to the target preview node according to the rendering directory tree and the selection instruction.
In the implementation process, the vehicle instrument preview interface corresponding to the target preview node can be generated according to the selection instruction including the target preview node input by the user, so that the effect of what you see is what you get is achieved.
Further, generating vehicle instrument development data required by coding according to the engineering explanation file, including:
generating the drawing interface data in a sequential traversal mode according to the meter usage field Jing Dingyi data, the background definition data, the picture class drawing operation definition data, the text class drawing operation definition data and the minimum word stock data;
generating the header file data, the source file data and the optical disc image file according to the engineering explanation file;
and generating vehicle instrument development data according to the drawing interface data, the header file data, the source file data and the optical disk image file.
In the implementation process, drawing interface data, header file data, source file data and an optical disc image file are automatically generated, and the obtained vehicle instrument development data corresponds to a vehicle instrument preview interface previewed before, so that the vehicle instrument development data is obtained, and the coding time and the debugging period are shortened.
Further, the drawing interface data includes picture information type definition data, font alignment definition data, text type definition data, drawing element definition data, and drawing element drawing interface definition data.
In the implementation process, the effect of the preview interface of the vehicle instrument can be guaranteed to be seamlessly linked to the coding implementation by generating the drawing interface data, and the error of manual coding is effectively avoided.
A second aspect of the embodiments of the present application provides an instrument development data generating device for a vehicle, including:
the acquisition module is used for acquiring an engineering explanation file for vehicle instrument development;
the catalog tree generation module is used for generating a rendering catalog tree according to the engineering interpretation file;
the preview module is used for generating a vehicle instrument preview interface according to the rendering directory tree;
and the development data generation module is used for generating vehicle instrument development data required by coding according to the engineering interpretation file when receiving a confirmation instruction aiming at the vehicle instrument preview interface.
In the implementation process, the catalog tree generating module generates a rendering catalog tree according to the engineering interpretation file, the preview module generates a vehicle instrument preview interface according to the rendering catalog tree, and finally the development data generating module generates vehicle instrument development data required by coding according to the rendering catalog tree when receiving a confirmation instruction for the vehicle instrument preview interface, so that the technical effects of previewing the display interface of the vehicle instrument in real time and shortening the coding time and the debugging period are achieved.
Further, the preview module includes:
a node obtaining sub-module, configured to receive a selection instruction for selecting a node of the rendering directory tree, where the selection instruction includes a target preview node:
and the preview generation sub-module is used for generating an automobile instrument preview interface corresponding to the target preview node according to the rendering directory tree and the selection instruction.
In the implementation process, the vehicle instrument preview interface corresponding to the target preview node can be generated according to the selection instruction including the target preview node input by the user, so that the effect of what you see is what you get is achieved.
A third aspect of the embodiments of the present application provides a computer device, including a memory and a processor, where the memory is configured to store a computer program, and the processor is configured to execute the computer program to cause the computer device to execute the vehicle instrument development data generating method according to any one of the first aspect of the embodiments of the present application.
A fourth aspect of the embodiments of the present application provides a computer-readable storage medium storing computer program instructions that, when read and executed by a processor, perform the method for generating vehicle meter development data according to any one of the first aspects of the embodiments of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Example 1
Referring to fig. 1, fig. 1 is a schematic flow chart diagram of a method for generating development data of an automobile instrument according to an embodiment of the present application. As shown in fig. 1, the vehicle instrument development data generation method includes:
s101, acquiring an engineering explanation file for developing the vehicle instrument.
In the embodiment of the present application, the vehicle meter is mainly a TFT (Thin Film Transisto) meter, which is not limited to the embodiment of the present application.
In the embodiment of the application, the engineering explanation file is a JSON file, and JSON (JavaScript Object Notation, JS object numbered musical notation) is a lightweight data exchange format. It stores and presents data in a text format that is completely independent of the programming language, based on a subset of ECMAScript (js specification formulated by the european computer institute). Is easy to read and write by people, is easy to analyze and generate by machines, and effectively improves the network transmission efficiency.
In the embodiment of the application, the engineering explanation file includes a Scene node, an Attribute node, a Picture node, a TextArea node, a FontText node, a Config node, and the like, which are defined by JSON. The method comprises the steps of defining various scenes required by a TFT instrument by using a Scene node, defining a background image path, transparent color and background image size Attribute by using an Attribute node, defining a drawing area and a UI image path of image rendering by using a Picture node, defining drawing operations of various indicators, navigation icons, rotating speed pointers and the like, defining attributes of font names, font sizes, drawing areas, font colors, alignment modes and the like of text rendering by using a text node, defining a minimum word library by using a text section, and defining a FLASH file format of a derived image by using a Config section.
S102, generating a rendering directory tree according to the engineering interpretation file.
Referring to fig. 2 together, fig. 2 is a schematic diagram illustrating a rendering directory tree according to an embodiment of the present application. As shown in fig. 2, region 310 is a schematic representation of a rendered directory tree, and region 320 is a vehicle instrument preview region. The rendering directory tree is divided into a plurality of main nodes and multi-layer sub-nodes at the lower level of each main node, each sub-node is corresponding to a selection frame, and a user can select different sub-nodes by selecting the selection frame. The area 310 can also present node information for each child node for easy viewing by the user.
In this embodiment of the present application, the main node for rendering the directory tree includes a Scene node, an Attribute node, a Picture node, a TextArea node, a FontText node, a Config node, and the like, which is not limited to this embodiment of the present application. The main nodes of the rendering directory tree are in one-to-one correspondence with the nodes included in the engineering interpretation file, and the corresponding definition data content is also in one-to-one correspondence, in other words, the rendering directory tree can be in a tree-shaped display mode of the engineering interpretation file.
S103, generating a vehicle instrument preview interface according to the rendering directory tree.
In the embodiment of the application, the rendering directory tree is generated by explaining the JSON file, and then the rendering directory tree is used for rendering the background, the picture and the text based on the GDI+ interface of the WIN system to generate the automobile instrument preview interface, so that the UI effect obtained immediately after the user sees is realized.
And S104, when a confirmation instruction for the vehicle instrument preview interface is received, generating vehicle instrument development data required by coding according to the engineering explanation file.
In this embodiment of the present application, the rendering directory tree may be a tree display manner of an engineering interpretation file, and vehicle instrument development data required for encoding may also be generated according to the rendering directory tree, where the vehicle instrument development data generated according to the rendering directory tree is the same as the vehicle instrument development data generated according to the engineering interpretation file.
In this embodiment of the present application, the vehicle instrument development data includes header files, drawing interfaces of source files, FLASH programming files, and the like required for encoding, which are not limited to this embodiment of the present application. Firstly, a minimum word stock picture is generated by character definition in a rendering directory tree, then, a header file and a drawing interface of a source file required by coding are generated for the background, the picture and the character stock picture by the rendering directory tree, and finally, a FLASH programming file is generated according to the rendering directory tree.
Therefore, by implementing the method for generating the development data of the vehicle instrument described in fig. 1, the display interface of the vehicle instrument can be previewed in real time, so that the coding time and the debugging period are shortened.
Example 2
Referring to fig. 3, fig. 3 is a schematic flow chart diagram of a method for generating development data of an automobile instrument according to an embodiment of the present application. As shown in fig. 3, the vehicle instrument development data generation method includes:
s201, acquiring an engineering explanation file for developing the vehicle instrument.
In this embodiment of the present application, the engineering explanation file includes meter usage field Jing Dingyi data, background definition data, drawing operation definition data of a picture class, drawing operation definition data of a text class, minimum word stock data, file format definition data of vehicle meter development data, and the like, which is not limited to the embodiment of the present application.
In the embodiment of the application, in the engineering explanation file, the field Jing Dingyi data is defined by using a Scene node to define an instrument, the background definition data is defined by using an Attribute node, the Picture class drawing operation definition data is defined by using a Picture node, the text class drawing operation definition data is defined by using a text node, the minimum word stock data is defined by using a FontText node, and the file format definition data of the vehicle instrument development data is defined by using a Config node.
In the embodiment of the application, the meter usage scene definition data includes various scenes required by the TFT meter, such as a daytime mode, a night-time mode, a sports mode, an economy mode, a startup animation, and the like. The background definition data includes a background map path, a background transparent color attribute, a background map size attribute, and the like. The picture class drawing operation definition data comprises drawing areas, UI (user interface) picture paths and the like for picture class drawing operation definitions such as various indicators, navigation icons, rotating speed pointers and the like. The text class drawing operation definition data comprises attributes such as font names, font sizes, drawing areas, font colors, alignment modes and the like of text class rendering, and is used for defining text class drawing operations such as vehicle speed, mileage, water temperature, fault codes and the like.
S202, generating a rendering directory tree according to the engineering interpretation file.
In the embodiment of the application, a rendering directory tree is generated according to a Scene node, an Attribute node, a Picture node, a TextArea node and a FontText node in the engineering explanation file.
S203, receiving a selection instruction for selecting a node of the rendering directory tree.
In the embodiment of the application, a user can input a selection instruction for selecting a node of the rendering directory tree to select a rendering node needing to be previewed. The selection instruction includes a target preview node, which is a rendering node that needs to be previewed.
S204, generating a vehicle instrument preview interface corresponding to the target preview node according to the rendering directory tree and the selection instruction.
According to the embodiment of the application, corresponding node diagrams can be drawn to Canvas in real time through GDI and drawing interfaces of the WIN system according to rendering nodes selected by a user, and the node diagrams are displayed to a TPicture display UI component, so that the effect of what you see is what you get is achieved.
Referring to fig. 4 together, fig. 4 is a schematic illustration showing a preview interface of a vehicle instrument according to an embodiment of the present application. As shown in fig. 4, the node 311 is a child node selected by the user through the selection frame, and the area 310 is a vehicle instrument preview interface corresponding to the node 311.
In the embodiment of the present application, the steps S203 to S204 are performed, and the vehicle instrument preview interface can be generated from the rendering directory tree.
As an alternative embodiment, after generating the vehicle instrument preview interface corresponding to the target preview node, the method may further include the steps of:
s205, judging whether a confirmation instruction aiming at a preview interface of the vehicle instrument is received, and if so, executing steps S206 to S208; if not, the process is ended.
As an alternative embodiment, when it is determined that the confirmation instruction for the vehicle instrument preview interface is not received, the method may further include the steps of:
acquiring information to be modified aiming at a preview interface of the vehicle instrument;
positioning node information corresponding to the information to be modified in the rendering directory tree according to the information to be modified;
and outputting node information.
In the above embodiment, after outputting the node information, the engineer may modify the engineering interpretation file according to the node information and re-execute steps S201 to S205 until receiving a confirmation instruction for the vehicle instrument preview interface.
After step S205, the method further includes the steps of:
s206, drawing interface data is generated in a first-order traversal mode according to the meter usage field Jing Dingyi data, the background definition data, the picture class drawing operation definition data, the text class drawing operation definition data and the minimum word stock data.
In the embodiment of the application, text class drawing operation definition data can be defined through the text area node, and minimum word stock data is defined through the fontsext node, all characters are drawn one by one and cut to generate the minimum word stock data, and the minimum word stock data comprises minimum characters required by drawing.
In this embodiment of the present application, the first-order traversal is also called first-root traversal, and the first-order traversal passes through all nodes on a path along a certain path according to the left-right order of the root. In a binary tree, root first and then left and right.
In this embodiment of the present application, the drawing interface data includes picture information type definition data, font alignment definition data, text type definition data, drawing element drawing interface definition data, and the like, which is not limited to this embodiment of the present application.
In this embodiment of the present application, the drawing interface data may be described in C language, which is not limited to this embodiment of the present application. By generating drawing interface data, the effect of the vehicle instrument preview interface can be guaranteed to be seamlessly linked to the MCU coding realization, and the error of manual coding is effectively avoided.
S207, generating header file data, source file data and an optical disc image file according to the engineering explanation file.
In this embodiment of the present application, a header file required for encoding an MCU may be generated according to an engineering interpretation file, where the header file data is a header file required for encoding an MCU, and the header file data may be described in a C language, which is not limited to this embodiment of the present application.
In the embodiment of the application, when drawing interface data are generated, corresponding background, picture and text picture characters can be generated into a BIN file for programming into the FLASH memory according to engineering interpretation files by a file flow technology, and the BIN file for programming into the FLASH memory is an optical disc image file.
In this embodiment of the present application, the optical disc image file may be a FLASH writing file or a BIN format file, which is not limited to this embodiment of the present application. The BIN file is a binary file, and the BIN has various meanings including a virtual drive format, a data format for scientific research and calculation, and the like.
In this embodiment of the present application, source file data refers to a set of source codes (i.e., a set of program development codes having specific meaning and capable of implementing specific functions) required for encoding, and is a result after the codes written in assembly language or high-level language are saved as file data.
After step S207, the following steps are further included:
s208, generating vehicle instrument development data according to the drawing interface data, the header file data, the source file data and the optical disk image file.
In the embodiment of the present application, the vehicle instrument development data includes header file data, source file data, drawing interface data of the source file data, and an optical disc image file, which are required for programming, and the embodiment of the present application is not limited thereto.
In the embodiment of the present application, when the above steps S206 to S208 are performed, the vehicle instrument development data required for encoding can be generated from the engineering explanation file upon receiving the confirmation instruction for the vehicle instrument preview interface.
Therefore, by implementing the vehicle instrument development data generation method described in the embodiment, the display interface of the vehicle instrument can be previewed in real time, so that the coding time and the debugging period are shortened.
Example 3
Referring to fig. 5, fig. 5 is a schematic block diagram of a vehicle instrument development data generating device according to an embodiment of the present application. As shown in fig. 5, the vehicle instrument development data generation device includes:
the obtaining module 410 is configured to obtain an engineering explanation file for vehicle instrument development.
The directory tree generation module 420 is configured to generate a rendered directory tree according to the engineering interpretation file.
And the preview module 430 is used for generating a vehicle instrument preview interface according to the rendering directory tree.
The development data generation module 440 is configured to generate vehicle instrument development data required for encoding according to the engineering interpretation file when receiving a confirmation instruction for the vehicle instrument preview interface.
In the embodiment of the present application, the vehicle instrument development data includes header file data, source file data, drawing interface data of the source file data, and an optical disc image file, which are required for programming, and the embodiment of the present application is not limited thereto.
In this embodiment of the present application, the engineering explanation file includes meter usage field Jing Dingyi data, background definition data, drawing operation definition data of a picture class, drawing operation definition data of a text class, minimum word stock data, file format definition data of vehicle meter development data, and the like, which is not limited to the embodiment of the present application.
Referring to fig. 6 together, fig. 6 is a schematic block diagram of another vehicle instrument development data generating device according to an embodiment of the present application. The vehicle meter development data generating device shown in fig. 6 is optimized by the vehicle meter development data generating device shown in fig. 5. As shown in fig. 6, the preview module 430 includes:
the node obtaining sub-module 431 is configured to receive a selection instruction for selecting a node of the rendering directory tree, where the selection instruction includes a target preview node:
and the preview generation sub-module 432 is configured to generate an automobile instrument preview interface corresponding to the target preview node according to the rendering directory tree and the selection instruction.
In the embodiment of the present application, the development data generating module 440 includes:
the first generation sub-module 441 is configured to generate drawing interface data in a first-order traversal manner according to the meter usage field Jing Dingyi data, the background definition data, the picture class drawing operation definition data, the text class drawing operation definition data, and the minimum word stock data.
The second generation sub-module 442 is configured to generate header file data, source file data, and an optical disc image file according to the engineering interpretation file.
The third generation sub-module 443 is configured to generate vehicle meter development data according to the drawing interface data, the header file data, the source file data, and the optical disc image file.
In this embodiment of the present application, the drawing interface data includes picture information type definition data, font alignment definition data, text type definition data, drawing element drawing interface definition data, and the like, which is not limited to this embodiment of the present application.
Therefore, the vehicle instrument development data generating device described in the embodiment can preview the display interface of the vehicle instrument in real time, so that the coding time and the debugging period are shortened.
In addition, the invention also provides computer equipment. The computer device includes a memory operable to store a computer program and a processor operable to cause the computer device to perform the functions of the above-described method or the above-described respective modules in the vehicle instrument development data generation apparatus by running the computer program.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, phonebooks, etc.) created according to the use of the mobile terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The present embodiment also provides a computer storage medium storing a computer program used in the above computer device.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners as well. The apparatus embodiments described above are merely illustrative, for example, flow diagrams and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present application may be integrated together to form a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution, in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing is merely exemplary embodiments of the present application and is not intended to limit the scope of the present application, and various modifications and variations may be suggested to one skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application should be included in the protection scope of the present application. It should be noted that: like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures.
The foregoing is merely specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily think about changes or substitutions within the technical scope of the present application, and the changes and substitutions are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.