A financial POS terminal code automatic generation method and system

By combining a visual parsing interface and a semantic parsing flowchart with knowledge of the financial POS field, POS terminal code is automatically generated, solving the problems of low development efficiency and difficulty in hardware adaptation, and realizing efficient and standardized POS terminal code generation and maintenance.

CN123137652APending Publication Date: 2026-11-20GUANGDONG TELEPOWER TELECOM TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610648135.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-12
Publication Date
2026-11-20

AI Technical Summary

Technical Problem

Financial POS terminal development is inefficient, has a long development cycle, poor code reusability, is difficult to adapt to hardware platforms, has high maintenance costs, lacks unified development standards, and existing AI code assistance tools cannot interpret payment transaction processes and call specific hardware SDKs.

Method used

By visually analyzing the interface prototype diagram and semantically analyzing the business process diagram, and combining the knowledge base in the financial POS field to generate enhanced prompt words, the code generation model automatically generates LVGL interface code, transaction state machine, hardware driver and SDK call code, and assembles them into a complete project package according to POS terminal engineering specifications.

Benefits of technology

Significantly lowers the development threshold, shortens the development cycle, improves code reusability and maintainability, unifies code standards, and reduces the high rework costs caused by requirement changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123137652A_ABST
    Figure CN123137652A_ABST
Patent Text Reader

Abstract

The application provides a financial POS terminal code automatic generation method and system, visual analysis is performed on an interface prototype uploaded by a user to obtain standardized page structure data, semantic analysis is performed on a business flowchart and a function text description, a page jump relationship, a transaction state machine, a key trigger event and a condition judgment rule are extracted, then information such as a target chip platform, an SDK version and an LVGL version configured by the user is combined, matched domain knowledge is retrieved from a financial POS domain knowledge base, and enhanced prompt words are generated accordingly, then the structured analysis result and the enhanced prompt words are jointly input into a code generation model to automatically generate financial POS terminal code, and finally code assembly, directory construction and compilation script generation are performed according to a POS terminal engineering specification, and a financial POS terminal code engineering package that can be directly compiled and run is output. The application realizes automatic generation from an interface prototype, a flowchart and a function text description to a compilable terminal engineering package.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of financial POS technology, and in particular to a method and system for automatically generating financial POS terminal codes. Background Technology

[0002] As a key device for payment transactions, financial POS terminals have long faced significant challenges in software development. Currently, most of these terminals run on Linux or RTOS platforms, and their graphical user interfaces are generally implemented using embedded graphics libraries such as LVGL. In actual development processes, on the one hand, due to the large number of transaction interfaces and the complexity of business processes, developers need to manually write a large amount of interface code based on LVGL (Light and Versatile Graphics Library), leading to prolonged development cycles and low efficiency. On the other hand, the lack of standardized chips, hardware SDKs, and driver interfaces from different manufacturers means that porting software between different hardware platforms requires significant manual costs for adaptation and is highly prone to introducing errors.

[0003] Furthermore, financial transaction processes demand extremely high rigor, involving complex state machine management, page transition logic, and robust exception handling mechanisms. The development of these core logics typically relies heavily on senior engineers with extensive industry experience. When requirements change, developers are forced to make extensive modifications to UI code, business logic code, and hardware adaptation code, leading to a sharp increase in rework costs and maintenance difficulty. Simultaneously, the lack of unified development standards means that code style and architectural quality heavily depend on the individual skill level of developers, resulting in poor code reusability and long-term maintenance difficulties.

[0004] Currently, while general-purpose AI-assisted code tools have emerged, their core deficiency lies in a lack of in-depth understanding of the financial POS field. These tools cannot interpret the specific constraints of payment transaction processes, cannot identify and correctly call the proprietary interfaces of specific manufacturers' hardware SDKs, and lack the ability to assemble isolated code snippets into a complete terminal project that can be directly compiled and run. Therefore, they cannot solve the substantial pain points in financial POS terminal development, such as low overall efficiency, high reliance on manual labor, and difficulty in platform adaptation. Summary of the Invention

[0005] In view of the above problems, the present invention is proposed to provide a method for automatically generating financial POS terminal codes and a corresponding system for automatically generating financial POS terminal codes, which overcomes or at least partially solves the above problems.

[0006] This invention discloses a method for automatically generating codes for financial POS terminals, the method comprising: Receive user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, as well as target chip platform, SDK version and LVGL version configuration information, and compilation environment configuration information; Visual analysis is performed on the interface prototype diagram to identify controls, positions, text and layout relationships, and output standardized page structure data. Semantic analysis is also performed on the business process diagram and functional text description to extract page jump relationships, transaction state machines, button trigger events and condition judgment rules. Based on the page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, are used to retrieve matching domain knowledge from the financial POS domain knowledge base, and enhanced prompt words are generated by combining the matching domain knowledge; the domain knowledge includes at least transaction process constraints, transaction state machine rules, LVGL code specifications and hardware SDK calling rules; The page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, along with the enhanced prompt words, are input into the code generation model to generate LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; The LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK calling code, event response and exception handling code are assembled into a complete project according to the POS terminal engineering specifications. The corresponding compilation script is generated according to the target chip platform and compilation environment configuration information. The complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run.

[0007] Optionally, the interface prototype is visually analyzed to identify controls, positions, text, and layout relationships, and standardized page structure data is output, including: The UI control detection model is used to detect and classify controls in the interface prototype, identifying buttons, text boxes, lists, icons, and container controls. The bounding box coordinates of each identified control are used to determine the position information of each control in the interface; Extracting text content from each control using optical character recognition; Analyze the hierarchy and layout relationships between controls using a layout structure model; Generate a JSON structure containing control type, coordinate position, text, hierarchy, and layout relationship as the standardized page structure data.

[0008] Optionally, semantic parsing is performed on the business process diagram and functional text description to extract page navigation relationships, transaction state machines, key trigger events, and condition judgment rules, including: The business process diagram and functional text description are logically decomposed using a large language semantic understanding model. Based on the breakdown results of the functional text description and the business process diagram, generate page navigation relationships, transaction state machines, key trigger events, and condition judgment rules.

[0009] Optionally, based on the page structure data, the extracted page navigation relationships, transaction state machines, key trigger events and condition judgment rules, and the target chip platform, SDK version and LVGL version configuration information, matching domain knowledge is retrieved from the financial POS domain knowledge base, including: The page structure data, the extracted page jump relationships, transaction state machine, key trigger events and condition judgment rules, and the target chip platform, SDK version and LVGL version configuration information are converted into text vector retrieval features; In the vector index of the knowledge base in the financial POS field, similarity matching is performed based on the retrieval features of the converted text vectors. The transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules with the highest similarity are obtained as the matching transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules.

[0010] Optionally, enhanced prompt words are generated by combining matching domain knowledge, including: The matched transaction process constraints and transaction state machine rules are integrated with the extracted page jump relationships, transaction state machines, key trigger events and condition judgment rules to form a process constraint description that includes transaction process boundary constraints and allowed state transition path restrictions. The matched LVGL code specifications are integrated with the page structure data and LVGL version configuration information to form an interface constraint description that includes the control initialization parameter range and style attribute configuration specifications. The matched hardware SDK calling rules are integrated with the target chip platform and SDK version configuration information to form a driver calling constraint description that includes a list of available APIs, parameter configuration order, and return value processing method. The enhanced prompt words are generated by combining the process constraint description, interface constraint description, and driver call constraint description.

[0011] Optionally, the code generation model is obtained by fine-tuning and training a general code model for the financial POS domain. The fine-tuning and training process includes: Obtain a sample set of financial POS code, including at least LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; Based on the general code model, the code generation model is obtained by fine-tuning the parameters of the general code model using the code sample set in the financial POS domain through the low-rank adaptation method.

[0012] Optionally, generate LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK calling code, event response and exception handling code, including: Based on the interface constraint description in the enhanced prompt, generate control creation, style setting, screen layout, and refresh callback registration code that conforms to the LVGL API specification; Based on the transaction process constraints in the enhanced prompts, generate transaction state machine initialization code, state transition table, and entry and exit processing functions corresponding to each state, and generate page jump control code; Based on the driver call constraint description in the enhanced prompt, select the API function corresponding to the current peripheral requirements from the hardware SDK of the target chip platform, and generate driver call code that includes pin configuration, clock initialization and communication parameter settings; Based on the extracted key trigger events and condition judgment rules, generate key scanning or interruption service registration code, transaction event distribution and processing code, and exception handling code for communication timeout, data verification failure and violation status jump scenarios.

[0013] Optionally, the LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK calling code, event response and exception handling code are assembled into a complete project according to the POS terminal engineering specifications, including: Perform syntax validation, specification matching, and format validation on the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK calling code, event response and exception handling code, and correct and remove invalid code segments that fail the validation. A standardized project directory structure is automatically created according to the POS terminal engineering specifications, including source code directory, header file directory, user interface source code directory, business logic source code directory, and driver source code directory. Place the verified LVGL interface code into the main program file corresponding to the user interface source code directory; place the transaction state machine and page jump logic code, event response and exception handling code into the main program file corresponding to the business logic source code directory; and place the hardware driver and SDK call code into the main program file corresponding to the driver source code directory. Automatically generate global macro definitions, common header files, system initialization call sequences, and main function entry points for the project according to POS terminal engineering specifications; A complete project consists of a standardized project directory structure, all main program files, project-wide macro definitions, common header files, system initialization call sequence, and main function entry point.

[0014] Optionally, according to the target chip platform and compilation environment configuration information, a corresponding compilation script is generated, and the complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run, including: Generate a corresponding compilation script based on the target chip platform and compilation environment configuration information; the compilation script configures compilation options, linking rules, and dependency libraries. Perform an integrity check on the assembled project, and encapsulate the project that passes the integrity check and the compilation script to output a financial POS terminal code project package that can be directly compiled and run.

[0015] This invention also discloses an automatic code generation system for financial POS terminals, the system comprising: The user interaction and configuration module is used to receive user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, as well as target chip platform, SDK version and LVGL version configuration information, and compilation environment configuration information. The multimodal parsing module is used to perform visual parsing on the interface prototype diagram, identify controls, positions, text and layout relationships, output standardized page structure data, and perform semantic parsing on the business process diagram and functional text descriptions to extract page jump relationships, transaction state machines, button trigger events and condition judgment rules. The Domain Knowledge RAG module is used to retrieve matching domain knowledge from the financial POS domain knowledge base based on the page structure data, extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as target chip platform, SDK version and LVGL version configuration information, and generate enhanced prompt words in combination with the matching domain knowledge; the domain knowledge includes at least transaction process constraints, transaction state machine rules, LVGL code specifications and hardware SDK calling rules; The AI ​​code generation module is used to input the page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, together with the enhanced prompt words, into the code generation model to generate LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; The engineering output module is used to assemble the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code into a complete project according to the POS terminal engineering specifications, and generate the corresponding compilation script according to the target chip platform and compilation environment configuration information. The complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run.

[0016] This invention has the following advantages: This invention performs visual analysis on user-uploaded interface prototype diagrams, identifying control types, positions, text, and layout relationships, and outputting standardized page structure data. Simultaneously, it performs semantic analysis on business process diagrams and functional text descriptions, extracting page transition relationships, transaction state machines, button trigger events, and condition judgment rules. Then, combining user-configured target chip platform, SDK version, and LVGL version information, it retrieves matching domain knowledge from the financial POS domain knowledge base, including transaction process constraints, state machine rules, LVGL code specifications, and hardware SDK calling rules, and generates enhanced prompts accordingly. The structured analysis results and enhanced prompts are then input into a code generation model fine-tuned from financial POS domain samples to automatically generate LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK calling code, and event response and exception handling code. Finally, following POS terminal engineering specifications, the code is assembled, directory structured, and compilation scripts are generated, outputting a financial POS terminal code engineering package that can be directly compiled and run. This invention eliminates the reliance on manually writing LVGL interface code, manually adapting multi-platform hardware SDKs, and senior engineers manually designing state machines, significantly reducing the development threshold and shortening the development cycle of financial POS terminals. At the same time, it unifies code standards and engineering structure, significantly improves code reusability and maintainability, and effectively addresses the problem of high rework costs caused by changes in requirements. Attached Figure Description

[0017] Figure 1 This is a flowchart of a method for automatically generating codes for a financial POS terminal provided in an embodiment of the present invention; Figure 2 This is a structural block diagram of a financial POS terminal code automatic generation system provided in an embodiment of the present invention; Figure 3 This is a structural block diagram of the multimodal parsing module provided in an embodiment of the present invention; Figure 4 This is a structural block diagram of the domain knowledge RAG module provided in an embodiment of the present invention; Figure 5 This is a flowchart of AI code generation and engineering output provided in an embodiment of the present invention. Detailed Implementation

[0018] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0019] Reference Figure 1 The flowchart illustrates a method for automatically generating codes for a financial POS terminal provided in an embodiment of the present invention, which may specifically include the following steps: 1) Input Acquisition ① Obtain user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, and configuration information such as chip platform, SDK version, LVGL version, and compilation environment; ② Perform format validation, deduplication, and preprocessing on the input data to form a unified input dataset.

[0020] 2) Multimodal analysis ①Visual Analysis: Using UI control detection models and character recognition models, the prototype image is analyzed for control recognition, text extraction, coordinate positioning, and layout, and standardized page structure data is output. ② Process Analysis: Through the big language semantic understanding model, the flowchart and natural language description are logically decomposed to extract page jump relationships, transaction state machines, key trigger events and condition judgment rules; ③SDK parsing: Using a C language syntax tree parsing tool, lexical and syntactic analysis is performed on the SDK header file to extract hardware API functions, parameters, structures, enumerations, and calling constraints.

[0021] 3) Domain knowledge retrieval and enhancement ① Based on the vectorization model and vector index, the parsing results are converted into retrieval vectors, which are then matched with L2 transaction processes, L3 state machine rules, LVGL development specifications, and hardware SDK adaptation rules from the financial POS domain knowledge base; ② The retrieved domain knowledge is fused with multimodal parsing data, deduplicated, and sorted to generate enhanced prompts with constraints.

[0022] 4) AI code generation ① The code generation model is based on a basic code model, with LoRA fine-tuned weights for the financial POS domain added. Based on structured parsed information and domain-enhanced hints, the model automatically generates LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK call code, event response and exception handling code; ② Perform syntax verification, standardization matching, and format optimization on the generated code to ensure compliance with embedded development and financial security requirements.

[0023] 5) Engineered assembly and output ① In accordance with POS terminal engineering standards, automatically generate project directory structure, common header files, global macro definitions, system initialization code, and main entry function; ② Based on the target chip platform and compiler, automatically generate Makefile / CMake build scripts, and configure build options, linking rules and dependency libraries; ③ Perform project integrity verification and output a complete terminal project package that can be directly compiled, burned, and run.

[0024] 6) Output and Feedback ① Provide users with code preview, project download, and structure display functions; ② Receive user modification instructions and parameter adjustments, support re-triggering the parsing, generation and assembly process, and complete iterative optimization.

[0025] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.

[0026] Reference Figure 2 The diagram illustrates a structural block diagram of a financial POS terminal code automatic generation system provided in an embodiment of the present invention, which may specifically include: The user interaction and configuration module is used to receive user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, as well as target chip platform, SDK version and LVGL version configuration information, and compilation environment configuration information. The multimodal parsing module is used to perform visual parsing on the interface prototype diagram, identify controls, positions, text and layout relationships, output standardized page structure data, and perform semantic parsing on the business process diagram and functional text descriptions to extract page jump relationships, transaction state machines, button trigger events and condition judgment rules. The Domain Knowledge RAG module is used to retrieve matching domain knowledge from the financial POS domain knowledge base based on the page structure data, extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as target chip platform, SDK version and LVGL version configuration information, and generate enhanced prompt words in combination with the matching domain knowledge; the domain knowledge includes at least transaction process constraints, transaction state machine rules, LVGL code specifications and hardware SDK calling rules; The AI ​​code generation module is used to input the page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, together with the enhanced prompt words, into the code generation model to generate LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; The engineering output module is used to assemble the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code into a complete project according to the POS terminal engineering specifications, and generate the corresponding compilation script according to the target chip platform and compilation environment configuration information. The complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run.

[0027] In an optional embodiment of the present invention, the multimodal parsing module is used for: The UI control detection model is used to detect and classify controls in the interface prototype, identifying buttons, text boxes, lists, icons, and container controls. The bounding box coordinates of each identified control are used to determine the position information of each control in the interface; Extracting text content from each control using optical character recognition; Analyze the hierarchy and layout relationships between controls using a layout structure model; Generate a JSON structure containing control type, coordinate position, text, hierarchy, and layout relationship as the standardized page structure data.

[0028] In an optional embodiment of the present invention, the multimodal parsing module is used for: The business process diagram and functional text description are logically decomposed using a large language semantic understanding model. Based on the breakdown results of the functional text description and the business process diagram, generate page navigation relationships, transaction state machines, key trigger events, and condition judgment rules.

[0029] In an optional embodiment of the present invention, the domain knowledge RAG module is used for: The page structure data, the extracted page jump relationships, transaction state machine, key trigger events and condition judgment rules, and the target chip platform, SDK version and LVGL version configuration information are converted into text vector retrieval features; In the vector index of the knowledge base in the financial POS field, similarity matching is performed based on the retrieval features of the converted text vectors. The transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules with the highest similarity are obtained as the matching transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules.

[0030] In an optional embodiment of the present invention, the domain knowledge RAG module is used for: The matched transaction process constraints and transaction state machine rules are integrated with the extracted page jump relationships, transaction state machines, key trigger events and condition judgment rules to form a process constraint description that includes transaction process boundary constraints and allowed state transition path restrictions. The matched LVGL code specifications are integrated with the page structure data and LVGL version configuration information to form an interface constraint description that includes the control initialization parameter range and style attribute configuration specifications. The matched hardware SDK calling rules are integrated with the target chip platform and SDK version configuration information to form a driver calling constraint description that includes a list of available APIs, parameter configuration order, and return value processing method. The enhanced prompt words are generated by combining the process constraint description, interface constraint description, and driver call constraint description.

[0031] In an optional embodiment of the present invention, the system further includes a model fine-tuning training module, which is used for: Obtain a sample set of financial POS code, including at least LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; Based on the general code model, the code generation model is obtained by fine-tuning the parameters of the general code model using the code sample set in the financial POS domain through the low-rank adaptation method.

[0032] In an optional embodiment of the present invention, the AI ​​code generation module is used for: Based on the interface constraint description in the enhanced prompt, generate control creation, style setting, screen layout, and refresh callback registration code that conforms to the LVGL API specification; Based on the transaction process constraints in the enhanced prompts, generate transaction state machine initialization code, state transition table, and entry and exit processing functions corresponding to each state, and generate page jump control code; Based on the driver call constraint description in the enhanced prompt, select the API function corresponding to the current peripheral requirements from the hardware SDK of the target chip platform, and generate driver call code that includes pin configuration, clock initialization and communication parameter settings; Based on the extracted key trigger events and condition judgment rules, generate key scanning or interruption service registration code, transaction event distribution and processing code, and exception handling code for communication timeout, data verification failure and violation status jump scenarios.

[0033] In an optional embodiment of the present invention, the engineering output module is used for: Perform syntax validation, specification matching, and format validation on the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK calling code, event response and exception handling code, and correct and remove invalid code segments that fail the validation. A standardized project directory structure is automatically created according to the POS terminal engineering specifications, including source code directory, header file directory, user interface source code directory, business logic source code directory, and driver source code directory. Place the verified LVGL interface code into the main program file corresponding to the user interface source code directory; place the transaction state machine and page jump logic code, event response and exception handling code into the main program file corresponding to the business logic source code directory; and place the hardware driver and SDK call code into the main program file corresponding to the driver source code directory. Automatically generate global macro definitions, common header files, system initialization call sequences, and main function entry points for the project according to POS terminal engineering specifications; A complete project consists of a standardized project directory structure, all main program files, project-wide macro definitions, common header files, system initialization call sequence, and main function entry point.

[0034] In an optional embodiment of the present invention, the engineering output module is used for: Generate a corresponding compilation script based on the target chip platform and compilation environment configuration information; the compilation script configures compilation options, linking rules, and dependency libraries. Perform an integrity check on the assembled project, and encapsulate the project that passes the integrity check and the compilation script to output a financial POS terminal code project package that can be directly compiled and run.

[0035] The functions of each component of the financial POS terminal code automatic generation system are briefly described below: 1) User Interaction and Configuration Module It accepts prototype diagrams, flowcharts, and text descriptions uploaded by users; and provides configuration items for chip platform, operating system, LVGL version, and manufacturer SDK.

[0036] 2) Multimodal analysis module Figure 3 This is a block diagram of the multimodal parsing module, see reference. Figure 3 The multimodal parsing module includes the following units: ① Visual Analysis Unit: The UI control detection model is used to identify controls, locate regions, and extract text from the prototype image. Combined with the layout structure model, the hierarchy and layout relationship are analyzed, and the page JSON structure containing control type, coordinates, and attributes is output. ②Flow parsing unit: Logically parses natural language or flowcharts using a big language semantic understanding model, and converts them into page jump, state machine and key event rules; ③SDK Parsing Unit: Based on the C language syntax tree parsing model, the header file is parsed in a structured manner to extract API functions, parameters, structures and calling rules.

[0037] 3) Domain Knowledge RAG Module Figure 4 This is a structural diagram of the Domain Knowledge RAG module, see reference. Figure 4 The Domain Knowledge RAG module includes the following units: ① Knowledge Base Unit: Organizes and stores POS financial business knowledge (PBOC / EMV L2 transaction process, L3 state machine), LVGL standard code templates and specifications, and hardware SDK / driver adaptation rules from various manufacturers; ② Vector retrieval unit: The knowledge base content is encoded using a text vectorization model to establish a retrieval index and vector database; ③ Knowledge retrieval unit, knowledge matching unit, and knowledge enhancement unit: Receive structured data from the multimodal parsing module, match the optimal knowledge through similarity retrieval, and fuse them to generate enhanced prompt words, providing domain constraints and references for AI code generation.

[0038] 4) AI Code Generation Module Reference Figure 5 AI code generation and engineering output process.

[0039] ① Model Adaptation Unit: Using a general code model as the base model, the model is fine-tuned using LoRA through POS terminal domain data (LVGL code, transaction logic, SDK call cases) to generate terminal domain-specific model weights to adapt to payment terminal development scenarios; ② Input Fusion Unit: Receives the page structure JSON and business process rules output by the multimodal parsing module, as well as the enhanced prompts (financial business constraints, LVGL specifications, SDK adaptation rules) output by the domain knowledge RAG module, performs format standardization and content fusion, and forms the model input prompt; ③ Code Generation Unit: Based on the merged prompt, and through the fine-tuned code model, it automatically generates four types of core code: LVGL UI control initialization and layout code, page navigation logic and L3 state machine code, hardware SDK / driver calling code (including parameter configuration), and button / transaction event response and exception handling logic code; ④ Basic verification unit: Performs syntax verification and specification matching verification on the generated code, removes invalid code, and corrects content that does not conform to the LVGL specification and SDK calling rules to ensure that the code can be compiled normally.

[0040] 5) Engineering output module Reference Figure 5 AI code generation and engineering output process.

[0041] ① Directory building unit: Automatically creates standardized directory structures for source code, header files, drivers, UI, business logic, etc., according to embedded terminal project specifications; ② Code Assembly Unit: The LVGL interface code, state machine logic, SDK call code, and event handling code are categorized and integrated by module, and common header files, global macro definitions, system initialization code, and entry main function are automatically generated; ③ Compilation script generation unit: Based on the target hardware platform and compiler type, automatically generate an adapted Makefile or CMake compilation script, and configure compilation options, linking rules and dependency libraries; ④ Project Output Unit: Performs integrity verification on the entire project and outputs a terminal project file package that can be directly compiled, burned, and run.

[0042] As the system implementation is basically similar to the method implementation, it is described in a relatively simple way. For relevant details, please refer to the description of the method implementation.

[0043] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0044] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the system embodiments are basically similar to the method embodiments, so the description is relatively simple; relevant parts can be referred to the descriptions of the method embodiments.

[0045] The above description is merely a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention are included within the scope of protection of the present invention.

Claims

1. A method for automatically generating codes for financial POS terminals, characterized in that, The method includes: Receive user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, as well as target chip platform, SDK version and LVGL version configuration information, and compilation environment configuration information; Visual analysis is performed on the interface prototype diagram to identify controls, positions, text and layout relationships, and output standardized page structure data. Semantic analysis is also performed on the business process diagram and functional text description to extract page jump relationships, transaction state machines, button trigger events and condition judgment rules. Based on the page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, are used to retrieve matching domain knowledge from the financial POS domain knowledge base, and enhanced prompt words are generated by combining the matching domain knowledge; the domain knowledge includes at least transaction process constraints, transaction state machine rules, LVGL code specifications and hardware SDK calling rules; The page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, along with the enhanced prompt words, are input into the code generation model to generate LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; The LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK calling code, event response and exception handling code are assembled into a complete project according to the POS terminal engineering specifications. The corresponding compilation script is generated according to the target chip platform and compilation environment configuration information. The complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run.

2. The method according to claim 1, characterized in that, The interface prototype is visually analyzed to identify controls, positions, text, and layout relationships, and standardized page structure data is output, including: The UI control detection model is used to detect and classify controls in the interface prototype, identifying buttons, text boxes, lists, icons, and container controls. The bounding box coordinates of each identified control are used to determine the position information of each control in the interface; Extracting text content from each control using optical character recognition; Analyze the hierarchy and layout relationships between controls using a layout structure model; Generate a JSON structure containing control type, coordinate position, text, hierarchy, and layout relationship as the standardized page structure data.

3. The method according to claim 1, characterized in that, Semantic parsing is performed on the business process diagram and functional text descriptions to extract page navigation relationships, transaction state machines, key trigger events, and condition judgment rules, including: The business process diagram and functional text description are logically decomposed using a large language semantic understanding model. Based on the breakdown results of the functional text description and the business process diagram, generate page navigation relationships, transaction state machines, key trigger events, and condition judgment rules.

4. The method according to claim 1, characterized in that, Based on the page structure data, the extracted page navigation relationships, transaction state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, are used to retrieve matching domain knowledge from the financial POS domain knowledge base, including: The page structure data, the extracted page jump relationships, transaction state machine, key trigger events and condition judgment rules, and the target chip platform, SDK version and LVGL version configuration information are converted into text vector retrieval features; In the vector index of the knowledge base in the financial POS field, similarity matching is performed based on the retrieval features of the converted text vectors. The transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules with the highest similarity are obtained as the matching transaction process constraints, transaction state machine rules, LVGL code specifications, and hardware SDK calling rules.

5. The method according to claim 4, characterized in that, Enhanced prompts are generated by combining matching domain knowledge, including: The matched transaction process constraints and transaction state machine rules are integrated with the extracted page jump relationships, transaction state machines, key trigger events and condition judgment rules to form a process constraint description that includes transaction process boundary constraints and allowed state transition path restrictions. The matched LVGL code specifications are integrated with the page structure data and LVGL version configuration information to form an interface constraint description that includes the control initialization parameter range and style attribute configuration specifications. The matched hardware SDK calling rules are integrated with the target chip platform and SDK version configuration information to form a driver calling constraint description that includes a list of available APIs, parameter configuration order, and return value processing method. The enhanced prompt words are generated by combining the process constraint description, interface constraint description, and driver call constraint description.

6. The method according to claim 1, characterized in that, The code generation model is obtained by fine-tuning a general code model for the financial POS domain. The fine-tuning training process includes: Obtain a sample set of financial POS code, including at least LVGL interface code, transaction state machine and page navigation logic code, hardware driver and SDK calling code, event response and exception handling code; Based on the general code model, the code generation model is obtained by fine-tuning the parameters of the general code model using the code sample set in the financial POS domain through the low-rank adaptation method.

7. The method according to claim 5, characterized in that, Generate LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK calling code, event response and exception handling code, including: Based on the interface constraint description in the enhanced prompt, generate control creation, style setting, screen layout, and refresh callback registration code that conforms to the LVGL API specification; Based on the transaction process constraints in the enhanced prompts, generate transaction state machine initialization code, state transition table, and entry and exit processing functions corresponding to each state, and generate page jump control code; Based on the driver call constraint description in the enhanced prompt, select the API function corresponding to the current peripheral requirements from the hardware SDK of the target chip platform, and generate driver call code that includes pin configuration, clock initialization and communication parameter settings; Based on the extracted key trigger events and condition judgment rules, generate key scanning or interruption service registration code, transaction event distribution and processing code, and exception handling code for communication timeout, data verification failure and violation status jump scenarios.

8. The method according to claim 7, characterized in that, Assemble the LVGL interface code, transaction state machine and page transition logic code, hardware driver and SDK calling code, event response and exception handling code into a complete project according to POS terminal engineering specifications, including: Perform syntax validation, specification matching, and format validation on the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK calling code, event response and exception handling code, and correct and remove invalid code segments that fail the validation. A standardized project directory structure is automatically created according to the POS terminal engineering specifications, including source code directory, header file directory, user interface source code directory, business logic source code directory, and driver source code directory. Place the verified LVGL interface code into the main program file corresponding to the user interface source code directory; place the transaction state machine and page jump logic code, event response and exception handling code into the main program file corresponding to the business logic source code directory; and place the hardware driver and SDK call code into the main program file corresponding to the driver source code directory. Automatically generate global macro definitions, common header files, system initialization call sequences, and main function entry points for the project according to POS terminal engineering specifications; A complete project consists of a standardized project directory structure, all main program files, project-wide macro definitions, common header files, system initialization call sequence, and main function entry point.

9. The method according to claim 8, characterized in that, Generate corresponding compilation scripts based on the target chip platform and compilation environment configuration information, and package the complete project and compilation scripts into a financial POS terminal code project package that can be directly compiled and run, including: Generate a corresponding compilation script based on the target chip platform and compilation environment configuration information; the compilation script configures compilation options, linking rules, and dependency libraries. Perform an integrity check on the assembled project, and encapsulate the project that passes the integrity check and the compilation script to output a financial POS terminal code project package that can be directly compiled and run.

10. A financial POS terminal code automatic generation system, characterized in that, The system includes: The user interaction and configuration module is used to receive user-uploaded interface prototype diagrams, business process diagrams, functional text descriptions, as well as target chip platform, SDK version and LVGL version configuration information, and compilation environment configuration information. The multimodal parsing module is used to perform visual parsing on the interface prototype diagram, identify controls, positions, text and layout relationships, output standardized page structure data, and perform semantic parsing on the business process diagram and functional text descriptions to extract page jump relationships, transaction state machines, button trigger events and condition judgment rules. The Domain Knowledge RAG module is used to retrieve matching domain knowledge from the financial POS domain knowledge base based on the page structure data, extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as target chip platform, SDK version and LVGL version configuration information, and generate enhanced prompt words in combination with the matching domain knowledge; the domain knowledge includes at least transaction process constraints, transaction state machine rules, LVGL code specifications and hardware SDK calling rules; The AI ​​code generation module is used to input the page structure data, the extracted page jump relationships, state machines, key trigger events and condition judgment rules, as well as the target chip platform, SDK version and LVGL version configuration information, together with the enhanced prompt words, into the code generation model to generate LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code; The engineering output module is used to assemble the LVGL interface code, transaction state machine and page jump logic code, hardware driver and SDK call code, event response and exception handling code into a complete project according to the POS terminal engineering specifications, and generate the corresponding compilation script according to the target chip platform and compilation environment configuration information. The complete project and compilation script are packaged and output as a financial POS terminal code project package that can be directly compiled and run.