Application component generation method and device, electronic equipment and storage medium
By dynamically generating the display interface and device controls of application components, using the configuration information of the target peripherals, the problem of difficulty in controlling unlimited numbers or categories of intelligent peripherals in the prior art is solved, and high flexibility and adaptability of application component control is achieved.
Patent Information
- Application Number
- CN202411928653.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-04
AI Technical Summary
The existing AppWidget solution is difficult to effectively control unlimited numbers or categories of smart peripherals, and lacks flexibility and adaptability.
By obtaining the configuration information of the target peripheral, dynamically generate the display interface and device controls of the application components to achieve control and display of an infinite number of intelligent peripherals.
It improves the application flexibility and adaptability of application components, realizes the display and control of unlimited number or categories of intelligent peripherals, and provides a more convenient user experience.
Smart Images

Figure CN119759448A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to an application component generation method, device, electronic device and storage medium. Background Art
[0002] In modern society, with the improvement of people's living standards and the popularization of cars, in-vehicle infotainment systems and smart peripherals have become an indispensable part of people's daily lives.
[0003] One of the common solutions for controlling smart peripherals is to use AppWidget for quick control. AppWidget, also known as application widget or desktop plug-in, is a small, simplified application component displayed on the home screen in the Android system, allowing users to quickly view information or perform certain operations without opening the entire application. One AppWidget is created for one device, and multiple AppWidgets are created for multiple devices. The Appwdiget of this solution can realize the control of a limited number and limited categories of smart peripherals, but for smart peripherals with unlimited number and unlimited categories, the implementation of AppWidget is obviously stretched. Summary of the invention
[0004] This application provides an application component generation method, device, electronic device and storage medium, aiming to achieve control of an unlimited number of peripherals through the same application component and improve the application flexibility of the application component. The technical solution is as follows:
[0005] In a first aspect, a method for generating an application component is provided, the method comprising:
[0006] In response to a selection operation for a target peripheral received in a peripheral control application, obtaining configuration information of the target peripheral; the configuration information includes interface configuration information and control configuration information;
[0007] Generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0008] Generate device controls in the display interface based on the control configuration information.
[0009] In the above technical solution, a method for generating an application component is proposed, which obtains the selection operation for the target peripheral in the peripheral control application, obtains the configuration information of the selected target peripheral, and dynamically updates the display interface of the application component and the device controls therein according to the configuration information. Among them, the peripheral control application can support the addition of unlimited smart peripherals for control, and in the application component corresponding to the peripheral control application, that is, in the AppWidget, only one frequently used or concerned target peripheral can be displayed according to the user's selection operation, and by providing a concise information display and interactive method in the application component, a more convenient user experience is brought to the user. The effect of an application component being able to adapt to any selected smart peripheral is achieved, so that the display and control of an unlimited number or category of smart peripherals can be realized when the application components are limited.
[0010] In combination with the first aspect, in some possible implementations, the control configuration information includes control display information of the device control, and generating the device control in the display interface based on the control configuration information includes: generating the device control in the display interface based on the control display information and control layout information of the display interface.
[0011] In the above technical scheme, a scheme for generating device controls is specifically proposed. The control configuration information may include the control display information of the device control. The control display information is used to determine the display content, display effect, display position, etc. of the control. Different intelligent peripherals may be provided with different device controls. By obtaining the control display information of the device control and combining it with the control layout information of the display interface in the application component, the device control in the display interface may be generated. The control layout information of the display interface may be the initial interface layout information of the application component. By combining the control display information with the original control layout information, the generation rate of the device control can be increased. There is no need to redesign the entire interface layout for the application component, reduce redundant operations and interface redrawing, and improve development efficiency and maintainability.
[0012] In combination with the first aspect, in some possible implementations, the device controls in the display interface are generated based on the control display information and the initial layout information of the display interface, including: determining the display status and display content of each preset control in the control layout information of the display interface based on the control display information; the display status includes visible and invisible; and generating the device controls in the display interface based on the display status and display content.
[0013] In the above technical solution, a specific implementation method for determining device controls according to control display information is proposed. The display state and display content of the preset controls in the control layout information are determined according to the control display information, that is, which controls in the preset controls need to be displayed and what content needs to be displayed are determined according to the control display information, so that the device controls in the display interface are obtained according to the determined display state and the required display content. By only updating or hiding some preset controls, repeated layout construction can be avoided, the code and maintenance difficulty can be simplified, and the burden on the UI (User Interface Designer) thread can be reduced.
[0014] In combination with the first aspect, in some possible implementations, the control configuration information also includes control instructions for the device control; generating the device control in the display interface based on the display state and the display content includes: determining the correspondence between the display content and the control instruction; generating the device control in the display interface based on the display state, the display content and the correspondence.
[0015] In the above technical solution, another generation scheme of device controls is proposed. The control configuration information may also include control instructions. The control instructions of the control are mainly used to dynamically control and modify the behavior and state of the control according to specific conditions or user interactions. After determining the display state and display content of the preset control, the display content of the control can be bound to the control instructions, so as to trigger the corresponding control instructions according to the user's operation on different display contents to change the behavior of the peripherals, and display the actual state of the peripherals after the change through the display content. Make the application components dynamic and interactive at runtime.
[0016] In combination with the first aspect, in some possible implementations, the method also includes: in response to a control operation on a target device control in the application component, sending a target control command corresponding to the control operation to the target peripheral device; the target device control is any device control in the device controls; obtaining an execution result generated by the target peripheral device based on the target control command, and updating the display information of the target device control based on the execution result.
[0017] In the above technical solution, a solution for controlling peripherals according to device controls is specifically proposed. According to the device controls displayed in the application component, the target peripheral can be controlled, specifically in response to the control operation of the target device control, a control command pre-configured by the target device control is generated to the target peripheral, thereby achieving control of the target peripheral, and the command execution result of the target peripheral can also be obtained to update the display information of the device control. The application component has the ability of flexible configuration and dynamic update, so that it can respond to external changes and provide real-time information to users.
[0018] In combination with the first aspect, in some possible implementations, the response to a selection operation for a target peripheral received in a peripheral control application, obtaining the configuration information of the target peripheral, includes: in response to a trigger operation for setting options in the peripheral control application, displaying an application component setting page, displaying selectable peripherals in the application component setting page; in response to a selection operation for a target peripheral among the selectable peripherals, obtaining the configuration information of the target peripheral.
[0019] In the above technical solution, a specific implementation method for selecting a target peripheral is specifically proposed. A setting option is set in the peripheral control application. When the setting option is triggered, the application component setting page is displayed, and the selectable peripherals are displayed on the page. In response to the selection operation of the target peripheral in the selectable peripheral, a selected target peripheral is determined and the corresponding configuration information is obtained. The peripheral control application corresponding to the application component provides users with a wealth of peripheral options, and the required target peripherals can be switched in the peripheral control application according to the user's needs, thereby dynamically generating the application component according to the configuration information.
[0020] In combination with the first aspect, in some possible implementations, the device control includes at least one of a mode selection control, a switch control, and a display control.
[0021] In the above technical solution, specific types of device controls are provided. The mode selection control is used to select between multiple modes or options, the switch control is used to control the opening and closing of a function or mode, and the display control is used to display static text or dynamic text content, thereby conveying the status and information of the target peripheral. By conveying the user's selection or operation through switches and mode selection controls, it can help users easily control the behavior of the device; by providing feedback, guidance and instructions to users through display controls, it can help users understand and operate the device.
[0022] In a second aspect, an embodiment of the present specification provides an application component generation device, including:
[0023] A configuration acquisition unit, configured to acquire configuration information of a target peripheral device in response to a selection operation received in a peripheral control application; the configuration information includes interface configuration information and control configuration information;
[0024] An interface generating unit, configured to generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0025] A control generation unit is used to generate a device control in the display interface based on the control configuration information.
[0026] In a third aspect, an embodiment of the present specification provides an electronic device, the electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the steps of the above method are implemented when the computer program is executed by the processor.
[0027] In a fourth aspect, an embodiment of the present specification provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed, the steps of the above method are implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 This is an example schematic diagram of a method for generating an application component provided in an embodiment of this specification;
[0029] Figure 2 is another exemplary schematic diagram of a method for generating an application component provided in an embodiment of this specification;
[0030] Figure 3 It is a flowchart of a method for generating an application component provided in an embodiment of this specification;
[0031] Figure 4 It is a flowchart of a method for generating an application component provided in an embodiment of this specification;
[0032] Figure 5 It is a schematic diagram of an interface of an application component generation method provided in an embodiment of this specification;
[0033] Figure 6 It is another interface schematic diagram of an application component generation method provided by an embodiment of this specification;
[0034] Figure 7 It is another interface schematic diagram of an application component generation method provided in an embodiment of this specification;
[0035] Figure 8 It is another interface diagram of a method for generating an application component provided in an embodiment of this specification;
[0036] Fig. 9 It is another interface diagram of a method for generating an application component provided in an embodiment of this specification;
[0037] Fig.10 It is a structural schematic diagram of an application component generating device provided in an embodiment of this specification;
[0038] Fig.11 It is a structural schematic diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0039] The following will be combined with the accompanying drawings to clearly and thoroughly describe the technical solutions in this application. In the description of the embodiments of this specification, unless otherwise specified, " / " means or, for example, A / B can mean A or B: "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of this specification, "multiple" means two or more than two.
[0040] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.
[0041] Figure 1 This is an example schematic diagram of an application component generation method provided in an embodiment of this specification.
[0042] In the related art, AppWidget is a small, simplified application component used to be displayed on the home screen in the Android system, allowing users to quickly view information or perform certain operations without opening the entire application. For example, the AppWidget of the weather application can display the current weather without the user having to open the full weather application. Figure 1 As shown, an AppWidget needs to be created for each smart peripheral that needs to be controlled. Therefore, if multiple smart peripherals need to be controlled, multiple AppWidgets need to be created. However, the number of AppWidgets is pre-set in the App and cannot be updated dynamically, that is, the number of AppWidgets that can be created by each App is fixed. If the number of smart peripherals supported by the App exceeds the number of AppWidgets, the new smart peripheral AppWidget cannot be generated.
[0043] Based on the above situation, this specification embodiment proposes a method for generating an application component. Figure 2, is an example schematic diagram of an application component generation method provided in an embodiment of this specification. In response to a selection operation for a target peripheral received in a peripheral control application, the configuration information of the target peripheral is obtained, and the AppWidget (application component) parses the configuration information to generate the corresponding display content of the target peripheral, including a display interface and device controls. In this way, the user can select different smart peripherals. According to the user's selection, the same AppWidget can control different smart peripherals according to the configuration. By dynamically reading the configuration of the smart peripheral selected by the user, the UI of the smart peripheral is dynamically displayed to adapt to different smart peripheral requirements, thereby improving the scalability and flexibility of the application component.
[0044] The application component generation method provided in this specification is described in detail below in conjunction with specific embodiments.
[0045] Figure 3 FIG. 1 is a flow chart of a method for generating an application component provided in an embodiment of this specification. Figure 3 As shown, the method of the embodiment of this specification may include the following steps S101-S103.
[0046] S101, in response to a selection operation for a target peripheral received in a peripheral control application, acquiring configuration information of the target peripheral;
[0047] In one embodiment, the peripheral control application is used to control the smart peripherals, and the peripheral control application can be a Smart Peripheral Ecosystem App, which refers to a mobile application or software platform specially designed to manage and control various smart peripheral devices. These smart peripherals can be smart home devices, smart hardware, wearable devices, health monitoring tools, smart appliances, sensors, etc., which connect, interact and work together with smart phones or other main control devices.
[0048] In one embodiment, the peripheral control application can be installed in the vehicle system, and the user can control and link multiple smart peripherals in the vehicle through the peripheral control application on the vehicle. For example, the smart peripherals can be a car refrigerator, a car water cup, a child safety seat, etc.
[0049] An application widget is a widget of an app (usually a desktop widget), which is part of an application, but is usually a simpler, function-specific display interface. For example, in a smart home control app, users can set up various devices (such as lights, temperature control, etc.) in the app, and the AppWidget of the app may only display a simple interface, allowing users to switch lights or view device status directly from the desktop.
[0050] According to actual needs, users can select the target peripheral that needs to be quickly operated in the peripheral control application, so as to display and control the target peripheral on the application component. When a selection operation for the target peripheral is received in the peripheral control application, the configuration information of the target peripheral is obtained. The configuration information includes interface configuration information and control configuration information. The interface configuration information is used to determine the display effect of the entire interface. The control configuration information is used to determine the specific configuration of each control. The interface configuration information usually involves the display style, size, background, layout mode, etc. of the entire widget. For example, specify the color or image of the background of the application component, set the font, size, color, etc. of the text content in the interface. The control configuration information includes: control type (Widget Type), control position, control size, response event (Event Handlers), etc. For example, the control type indicates which category the current control belongs to, which may be a button (Button), a text box (TextView), a picture (ImageView), a switch (Switch), etc. For another example, the response event configures how the control responds to the user's operation. Usually, event handling includes click (onClick), long press (onLongClick), drag (onTouch), etc.
[0051] In one embodiment, in order to reduce the amount of stored data, the configuration information of all the smart peripherals supported by the peripheral control application can be stored in the cloud corresponding to the peripheral control application. When the target peripheral is determined, the configuration information of the target peripheral is downloaded from the cloud. It is understandable that the configuration information of all the smart peripherals can also be pre-downloaded locally for quick application.
[0052] S102, generating a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0053] In one embodiment, the display interface of the application component, that is, the overall visual style and appearance, is determined according to the interface configuration information. Exemplarily, different application component backgrounds can be set for different smart peripherals, that is, the application component background is set to the picture of the selected target peripheral. For example, if a smart water cup is selected, the picture of the water cup is displayed as the background in the application component to improve the intuitiveness of the display of the application component. It should be noted that the interface configuration information can be personalized for different target peripherals, or the interface configuration information of each selectable peripheral can be set to be consistent, and the specific selection is made according to the actual situation. In one embodiment, different peripherals share a consistent template, and only need to generate corresponding controls in the application component according to the control configuration information corresponding to different target peripherals. In another embodiment, the application component can have a template, and the interface configuration information only changes part of the content in the template, such as changing the background, font color, etc., but the size, shape, layout, etc. of the application component can be set according to the template.
[0054] S103: Generate a device control in the display interface based on the control configuration information.
[0055] In one embodiment, after determining the display interface, a device control is generated in the display interface according to the control configuration information. Device control (Widget): It is an element that the user can interact with, usually referring to a component used to receive user input or display data. For example, buttons (Button), text boxes (TextView), pictures (ImageView), etc. are all controls. They provide a certain function or display specific content. Different device controls can be set for the target peripheral according to the control configuration information of the target peripheral, so as to control or display the target peripheral in a targeted manner.
[0056] In the embodiments of the present specification, by responding to the selection operation for the target peripheral received in the peripheral control application, the configuration information of the target peripheral is obtained, the display interface of the application component corresponding to the peripheral control application is generated based on the interface configuration information in the configuration information, and the device control in the display interface is generated based on the control configuration information in the configuration information. In this way, the display interface of the application component and the device control therein are dynamically updated according to the configuration information of the peripheral selected by the user, so that an application component can adapt to any selected smart peripheral, thereby realizing the display and control of an unlimited number or category of smart peripherals when the application components are limited.
[0057] See also Figure 4 , is a flowchart of a method for generating an application component according to an embodiment of this specification. Figure 4 As shown, the method of the embodiment of this specification may include the following steps S201-S206.
[0058] S201, in response to a triggering operation for setting an option in a peripheral control application, displaying an application component setting page, and displaying selectable peripherals in the application component setting page;
[0059] In one embodiment, a setting option may be displayed in the peripheral control application. When the user clicks on the setting option, an application component setting page may be displayed, and selectable peripherals may be displayed on the application component setting page.
[0060] S202, in response to a selection operation on a target peripheral device among the selectable peripheral devices, acquiring configuration information of the target peripheral device;
[0061] In one embodiment, when a selection operation for a target peripheral device is received, configuration information of the target peripheral device is obtained and the configuration information is sent to the application component.
[0062] See also Figure 5, which is a schematic diagram of an interface of an application component generation method provided in an embodiment of the present specification. Taking a vehicle scenario as an example, a peripheral control application may be installed in the vehicle system. When the peripheral control application is opened, the main page of the peripheral control application may be displayed to display the connected smart peripherals, such as Figure 5 The three peripherals, refrigerator, child seat and water cup, can be managed separately in the peripheral control application. In order to improve the convenience of operation, some important peripherals are set to the application components on the desktop. Therefore, setting options can be provided in the application components. Figure 6 , which is another interface diagram of a method for generating an application component provided in an embodiment of this specification, Figure 6 The application component settings page is shown in the figure. When you click the settings option, the application component switches to the application component settings page. Figure 6 The selectable peripherals shown in the figure are all peripherals that the peripheral control application supports. You can determine the target peripheral by selecting the setting option.
[0063] See also Figure 7 , which is another interface diagram of an application component generation method provided in an embodiment of the present specification. In another embodiment of the present specification, the application component setting page can also be opened directly through the application component. For example, the prompt information of the smart device to be added can be displayed in the application component, and the application component setting page in the peripheral control application can be quickly opened by clicking the prompt information to select the target peripheral.
[0064] S203, generating a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0065] For details, please refer to the description of step S102 in the above-mentioned embodiment of the specification, which will not be elaborated here.
[0066] S204, generating a device control in the display interface based on the control display information and the control layout information of the display interface;
[0067] In one embodiment, after the display interface is determined, the device control in the application component can be generated according to the control display information and the control layout information of the display interface. The control configuration information can include the control display information of the device control, and the control display information is used to determine the display content, display effect, display position, etc. of the control. The position, background, font color, etc. of each control are pre-set in the application component. According to the control display information, the control to be displayed and the display content of the control can be determined on the original control layout, thereby improving the control generation efficiency.
[0068] It is understandable that the process of generating the display interface and the device controls therein can be performed simultaneously, and it is not necessary to wait until the display interface is rendered before determining the device controls therein.
[0069] Further, in one embodiment, the device control includes at least one of a mode selection control, a switch control, and a display control.
[0070] Among them, the mode selection control is used to select between multiple modes or options, the switch control is used to control the opening and closing of a function or mode, and the display control is used to display static text or dynamic text content, thereby conveying the status and information of the target peripheral. By conveying the user's selection or operation through switches and mode selection controls, it can help users easily control the behavior of the device, and by providing feedback, guidance and instructions to users through display controls, it can help users understand and operate the device. For example, the user clicks the switch control to enable or disable the heating function (such as "turn on heating" or "turn off heating"). For another example, the user selects different brewing modes, such as "coffee", "tea", "hot water", etc. through the mode selection control, and each mode controls the behavior of the machine (such as temperature, time, etc.).
[0071] Further, in one embodiment, generating the device control in the display interface based on the control display information and the initial layout information of the display interface includes:
[0072] S2041, determining the display state and display content of each preset control in the control layout information of the display interface based on the control display information; the display state includes visible and invisible;
[0073] In one embodiment, the display state of the preset control is changed by configuring the visibility (VISIBLE) or invisibility (INVISIBLE) of the original preset control in the application component in the control configuration information. For example, the original preset control is four text controls, and the current target peripheral only needs two text controls to display information, then two of the text controls are selected, and the display state of these two text controls is set to visible, and the other two are set to invisible. By configuring the display content required by the control in the control configuration information, the display content of the preset control to be displayed is confirmed. The display content can be text, icons, etc., and the data input path (data source) of the display content can also be configured. In some cases, it is necessary to dynamically load data and update the content of the widget through a service or data source. For example, to display a list of data from an external service (such as weather or stock prices), the display state of the control is determined by writing the bound data source in the configuration information.
[0074] If you redesign the entire AppWidget every time, you may need a lot of duplicate code and complex logic to handle changes in the interface. By updating or hiding only some controls, you can avoid repeated layout construction, simplifying the code and maintenance difficulty. By updating or hiding only some controls, the system can update the layout more efficiently, reducing unnecessary re-rendering and resource loading.
[0075] The template of the application component is actually a pre-written control layout information. For example, it can contain two texts, a switchButton, and a mode-type button, a total of 4. Which one needs to be displayed is controlled according to the control configuration information. See Figure 8 , Figure 8 Another interface diagram of a method for generating an application component is provided for the embodiment of this specification, such as Figure 8 As shown, preset controls can be pre-set in the application component, such as text area 1, text area 2, switch button control and mode switching control, which have fixed positions and sizes in the application component. The control to be displayed and the display content of the control are determined according to the control configuration information. Fig. 9 , which is a schematic diagram of the generated application components. Assume that text area 1, text area 2, switch button control and mode switch control are all visible. According to the control configuration information, the name of the target peripheral "smart water cup" is displayed in text area 1, the current temperature of the target peripheral "26℃" and the current state "heating" are displayed in text area 2, the current heating switch state of the target peripheral "on" is displayed in the switch button control, and the current water cup mode "coffee" is displayed in the mode switch control.
[0076] S2042: Generate device controls in the display interface based on the display state and display content.
[0077] In one embodiment, a device control is generated according to the display state and display content of the preset control determined above.
[0078] Furthermore, in one embodiment, the control configuration information also includes a control instruction of a device control, which generates a device control in the display interface based on the display state and the display content, including:
[0079] S2043, determining a correspondence between the display content and the control instruction;
[0080] In one embodiment, the display content in the control can be bound to the control instruction, so that different control instructions can be triggered when operating different contents displayed by the control. For example, the display content of the mode control can be "mode 1, mode 2, mode 3", and when the user clicks "mode 1", the control instruction corresponding to mode 1 is triggered.
[0081] S2044: Generate a device control in the display interface based on the display state, display content, and the corresponding relationship.
[0082] In one embodiment, a device control in a display interface is generated according to a correspondence between a display state, display content, and a control instruction.
[0083] For example, when writing configuration information, there is no need to distinguish between interface configuration information and control configuration information. It is sufficient to write a piece of configuration information for a peripheral, and the application can automatically parse the programming language and implement the configuration. The configuration information can be {"widget":[{"type":"switch","title":"Off|On","value":"0|1","field":"cupMode","command":"0|1"},{"type":"mode","title":"Milk|Warm water|Honey|Coffee|Tea|Boiling water","value":"35-45|46-55|56-65|66-75|76-89|90-100","field":"heatTemp","command":"40|50|60|70|80|90"},{"type":"text","unit":"℃","field":"curTemp"},{"type":"text","title":"Standby|Heating|Keep warm","field":"cupMode","value":"0|1"}]}. The type field is used to determine the type of control, for example, the "Switch" switch control, and the "title" field is used to determine the display content. In this example, the switch control can display "Off|On". For another example, the mode selection control can be the "cupmode" cup mode, and the display content of the cup mode can be "Milk|Warm Water|Honey|Coffee|Tea|Boiling Water". Furthermore, corresponding to the cup mode, each mode is provided with a control instruction, which is used to trigger the corresponding heating temperature control instruction when the user selects a different mode. The temperature setting corresponding to "Milk|Warm Water|Honey|Coffee|Tea|Boiling Water" is "35-45|46-55|56-65|66-75|76-89|90-100". In addition, the "heatTemp" heating temperature function is displayed, with a value of "40|50|60|70|80|90" in °C. The current temperature "curTemp" is also displayed. For example, the "text" text control can display "Standby|Heating|Keep Warm" and whether the water cup mode is selected, distinguished by 0 and 1.
[0084] S205, in response to a control operation on a target device control in the application component, sending a target control command corresponding to the control operation to the target peripheral device; the target device control is any device control in the device controls;
[0085] In one embodiment, after the application component is generated, when a control operation for a target device control in the application component is received, a target control command corresponding to the control operation is sent to the target peripheral device to control the target peripheral device. Specifically, when a user interacts with the control in the application component (such as clicking a button or a slider), the system receives a signal of such a control operation. After receiving the control operation, the application converts the operation into a corresponding control command (such as turning on a device, adjusting parameters, etc.), and sends these commands to the actual peripheral device through an appropriate communication protocol (such as a serial port, Bluetooth, Wi-Fi, etc.). After receiving the control command, the peripheral device performs a corresponding action (such as changing the state or parameters of the device) to achieve control of the peripheral device.
[0086] S206, obtaining an execution result generated by the target peripheral device based on the target control command, and updating display information of the target device control based on the execution result.
[0087] In one embodiment, after the user sends a control command to the target peripheral through the control, the peripheral will perform the corresponding operation (such as opening, closing, adjusting a parameter, etc.) according to the control command. The execution result refers to the feedback information after the peripheral executes the control command. This may be a state, data or other form of response. Once the system obtains the execution result of the peripheral, the application will update the display information of the corresponding control in the user interface according to these results. For example, if the state of the peripheral changes (such as the new value read by the temperature sensor), the display control in the interface (such as the temperature display box) will be updated in real time to display the latest temperature value.
[0088] In an embodiment of the present specification, in response to a trigger operation for setting options in a peripheral control application, an application component setting page is displayed, selectable peripherals are displayed in the application component setting page, in response to a selection operation for a target peripheral in the selectable peripherals, the configuration information of the target peripheral is obtained, a display interface of the application component corresponding to the peripheral control application is generated based on the interface configuration information, a device control in the display interface is generated based on the control display information and the control layout information of the display interface, in response to a control operation for a target device control in the application component, a target control command corresponding to the control operation is sent to the target peripheral; the target device control is any device control in the device control, the execution result generated by the target peripheral based on the target control command is obtained, and the display information of the target device control is updated based on the execution result. The generation rate of the device control can be improved by combining the control display information with the original control layout information, without the need to redesign the entire interface layout for the application component, reducing redundant operations and interface redrawing, and improving development efficiency and maintainability. In addition, the corresponding control instruction can be triggered according to the user's operation in the control to change the behavior of the peripheral, and the actual state of the peripheral after the change can be displayed through the display information. Make application components dynamic and interactive at runtime.
[0089] The following will be combined with the attached Fig.10 , the application component generation device provided in the embodiment of this specification is introduced in detail. It should be noted that the attached Fig.10 The application component generation device in the embodiment of the present invention is used to execute the application component generation device in the embodiment of the present invention. Figure 2-Figure 9 For the convenience of explanation, only the part related to the embodiment of this specification is shown. For the specific technical details not disclosed, please refer to this specification. Figure 2-Figure 9 The embodiment shown.
[0090] See also Fig.10 , which shows a schematic diagram of the structure of an application component generation device provided by an exemplary embodiment of this specification. The application component generation device can be implemented as all or part of the device through software, hardware or a combination of both. The device 1 includes:
[0091] The configuration acquisition unit 11 is used to acquire configuration information of the target peripheral device in response to a selection operation for the target peripheral device received in the peripheral device control application; the configuration information includes interface configuration information and control configuration information;
[0092] An interface generating unit 12, configured to generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0093] The control generation unit 13 is used to generate the device control in the display interface based on the control configuration information.
[0094] Optionally, the control configuration information includes control display information of the device control, and the control generation unit 13 is specifically used to: generate a first class loader corresponding to the plug-in in the application software; define the parent class loader of the first class loader as the parent class loader of the second class loader.
[0095] Optionally, the control generating unit 13 is specifically used to generate a device control in the display interface based on the control display information and the control layout information of the display interface.
[0096] Optionally, the control generation unit 13 is specifically used to: determine the display status and display content of each preset control in the control layout information of the display interface based on the control display information; the display status includes visible and invisible; and generate a device control in the display interface based on the display status and display content.
[0097] Optionally, the control configuration information also includes control instructions of the device control, and the control generation unit 13 is specifically used to: determine the correspondence between the display content and the control instruction; and generate the device control in the display interface based on the display state, display content and the correspondence.
[0098] Optionally, the control generation unit 13 is also used to: in response to a control operation on a target device control in the application component, send a target control command corresponding to the control operation to the target peripheral device; the target device control is any device control among the device controls; obtain an execution result generated by the target peripheral device based on the target control command, and update the display information of the target device control based on the execution result.
[0099] Optionally, the configuration acquisition unit 11 is specifically used to: in response to a trigger operation for setting options in a peripheral control application, display an application component setting page, and display selectable peripherals in the application component setting page; in response to a selection operation for a target peripheral among the selectable peripherals, acquire configuration information of the target peripheral.
[0100] Optionally, the device control includes at least one of a mode selection control, a switch control, and a display control.
[0101] It should be noted that the application component generation device provided in the above embodiment only uses the division of the above functional modules as an example when executing the application component generation method. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the application component generation device provided in the above embodiment and the application component generation method embodiment belong to the same concept, and the implementation process thereof is detailed in the method embodiment, which will not be repeated here.
[0102] The serial numbers of the embodiments of the present specification are for description only and do not represent the advantages and disadvantages of the embodiments. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0103] The embodiment of the present specification also provides a computer storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the above-mentioned Figure 2-Figure 9 The application component generation method of the embodiment shown in the figure can be found in the specific execution process. Figure 2-Figure 9 The specific description of the illustrated embodiment will not be repeated here.
[0104] Please refer to Fig.11 , which shows a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. The electronic device in this specification may include one or more of the following components: a processor 110, a memory 120, an input device 130, an output device 140, and a bus 150. The processor 110, the memory 120, the input device 130, and the output device 140 may be connected via the bus 150.
[0105] The processor 110 may include one or more processing cores. The processor 110 uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions and processes data of the terminal 100 by running or executing instructions, programs, code sets or instruction sets stored in the memory 120, and calling data stored in the memory 120. Optionally, the processor 110 can be implemented in at least one hardware form of digital signal processing (DSP), field programmable gate array (FPGA), and programmable logic array (PLA). The processor 110 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user pages, and applications; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 110, but may be implemented separately through a communication chip.
[0106] The memory 120 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 120 includes a non-transitory computer-readable medium (Non-Transitory Computer-Readable Storage Medium). The memory 120 may be used to store instructions, programs, codes, code sets, or instruction sets. The memory 120 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as a touch function, a sound playback function, an image playback function, etc.), instructions for implementing the above-mentioned various method embodiments, etc. The operating system may be an Android system, including a system deeply developed based on the Android system, an IOS system developed by Apple, including a system deeply developed based on the IOS system or other systems.
[0107] The memory 120 can be divided into an operating system space and a user space. The operating system runs in the operating system space, and native and third-party applications run in the user space. In order to ensure that different third-party applications can achieve good operating results, the operating system allocates corresponding system resources to different third-party applications. However, the requirements for system resources in different application scenarios in the same third-party application are also different. For example, in local application scenarios, third-party applications have higher requirements for disk reading speeds; in animation rendering scenarios, third-party applications have higher requirements for GPU performance. The operating system and third-party applications are independent of each other, and the operating system often cannot perceive the current application scenarios of third-party applications in a timely manner, resulting in the operating system being unable to perform targeted system resource adaptation according to the specific application scenarios of third-party applications.
[0108] In order for the operating system to distinguish the specific application scenarios of third-party applications, it is necessary to open up data communication between third-party applications and the operating system so that the operating system can obtain the current scenario information of third-party applications at any time, and then perform targeted system resource adaptation based on the current scenario.
[0109] The input device 130 is used to receive input commands or data, and includes but is not limited to a keyboard, a mouse, a camera, a microphone, or a touch device. The output device 140 is used to output commands or data, and includes but is not limited to a display device and a speaker. In one example, the input device 130 and the output device 140 can be combined, and the input device 130 and the output device 140 are touch screen displays.
[0110] The touch display screen can be designed as a full screen, a curved screen or a special-shaped screen. The touch display screen can also be designed as a combination of a full screen and a curved screen, or a combination of a special-shaped screen and a curved screen, which is not limited in the embodiments of this specification.
[0111] In addition, those skilled in the art can understand that the structure of the electronic device shown in the above drawings does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown, or combine certain components, or arrange the components differently. For example, the electronic device also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, a WiFi module, a power supply, and a Bluetooth module, which will not be described in detail here.
[0112] exist Fig.11 In the electronic device shown, the processor 110 may be used to call a computer application stored in the memory 120 and specifically perform the following operations:
[0113] In response to a selection operation for a target peripheral received in a peripheral control application, obtaining configuration information of the target peripheral; the configuration information includes interface configuration information and control configuration information;
[0114] Generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information;
[0115] Generate device controls in the display interface based on the control configuration information.
[0116] In one embodiment, the control configuration information includes control display information of the device control. When the processor 110 generates the device control in the display interface based on the control configuration information, the processor 110 specifically performs the following operations:
[0117] The device controls in the display interface are generated based on the control display information and the control layout information of the display interface.
[0118] In one embodiment, when the processor 110 generates the device control in the display interface based on the control display information and the initial layout information of the display interface, the processor 110 may specifically perform the following operations:
[0119] Determine the display state and display content of each preset control in the control layout information of the display interface based on the control display information; the display state includes visible and invisible;
[0120] A device control in the display interface is generated based on the display state and the display content.
[0121] In one embodiment, the control configuration information further includes a control instruction of the device control. When the processor 110 generates the device control in the display interface based on the display state and the display content, the following operations may be performed:
[0122] Determining a correspondence between the display content and the control instruction;
[0123] A device control in the display interface is generated based on the display state, the display content and the corresponding relationship.
[0124] In one embodiment, the processor 110 may further perform the following operations:
[0125] In response to a control operation on a target device control in the application component, sending a target control command corresponding to the control operation to the target peripheral device; the target device control is any device control in the device controls;
[0126] Acquire an execution result generated by the target peripheral device based on the target control command, and update display information of the target device control based on the execution result.
[0127] In one embodiment, when the processor 110 obtains the configuration information of the target peripheral device in response to the selection operation for the target peripheral device received in the peripheral device control application, the processor 110 specifically performs the following operations:
[0128] In response to a trigger operation for setting an option in a peripheral control application, displaying an application component setting page, and displaying selectable peripherals in the application component setting page;
[0129] In response to a selection operation on a target peripheral device among the selectable peripheral devices, configuration information of the target peripheral device is acquired.
[0130] In one embodiment, the device control includes at least one of a mode selection control, a switch control, and a display control.
[0131] In the embodiments of the present specification, by responding to the selection operation for the target peripheral received in the peripheral control application, the configuration information of the target peripheral is obtained, the display interface of the application component corresponding to the peripheral control application is generated based on the interface configuration information in the configuration information, and the device control in the display interface is generated based on the control configuration information in the configuration information. In this way, the display interface of the application component and the device control therein are dynamically updated according to the configuration information of the peripheral selected by the user, so that an application component can adapt to any selected smart peripheral, thereby realizing the display and control of an unlimited number or category of smart peripherals when the application components are limited.
[0132] Further, in response to a trigger operation for setting options in a peripheral control application, an application component setting page is displayed, selectable peripherals are displayed in the application component setting page, in response to a selection operation for a target peripheral in the selectable peripherals, configuration information of the target peripheral is obtained, a display interface of the application component corresponding to the peripheral control application is generated based on the interface configuration information, a device control in the display interface is generated based on the control display information and the control layout information of the display interface, in response to a control operation for a target device control in the application component, a target control command corresponding to the control operation is sent to the target peripheral; the target device control is any device control in the device control, an execution result generated by the target peripheral based on the target control command is obtained, and the display information of the target device control is updated based on the execution result. The generation rate of the device control can be improved by combining the control display information with the original control layout information, without the need to redesign the entire interface layout for the application component, reducing redundant operations and interface redrawing, and improving development efficiency and maintainability. In addition, the corresponding control instruction can be triggered according to the user's operation in the control to change the behavior of the peripheral, and the actual state of the peripheral after the change can be displayed through display information. Make application components dynamic and interactive at runtime.
[0133] In addition, an embodiment of the present specification provides a computer program product, which includes a computer program. When the computer program is executed by a processor of an electronic device, the processor can at least implement the above-mentioned Figures 2 to 9 The application component generation method provided in the illustrated embodiment.
[0134] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the above-mentioned program can be stored in a computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the above-mentioned storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.
[0135] The above disclosure is only the preferred embodiment of this specification, which certainly cannot be used to limit the scope of rights of this specification. Therefore, equivalent changes made according to the claims of this specification are still within the scope covered by this specification.
Claims
1. A component control method, characterized in that: The method comprises: In response to a selection operation for a target peripheral received in a peripheral control application, obtaining configuration information of the target peripheral; the configuration information includes interface configuration information and control configuration information; Generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information; Generate device controls in the display interface based on the control configuration information.
2. The method according to claim 1, characterized in that The control configuration information includes control display information of the device control; The generating the device control in the display interface based on the control configuration information includes: The device controls in the display interface are generated based on the control display information and the control layout information of the display interface.
3. The method according to claim 2, characterized in that The generating the device control in the display interface based on the control display information and the initial layout information of the display interface includes: Determine the display state and display content of each preset control in the control layout information of the display interface based on the control display information; the display state includes visible and invisible; A device control in the display interface is generated based on the display state and the display content.
4. The method according to claim 3, characterized in that The control configuration information also includes control instructions for the device control; The generating of the device controls in the display interface based on the display state and the display content includes: Determining a correspondence between the display content and the control instruction; A device control in the display interface is generated based on the display state, the display content and the corresponding relationship.
5. The method according to claim 1, characterized in that The method further comprises: In response to a control operation on a target device control in the application component, sending a target control command corresponding to the control operation to the target peripheral device; the target device control is any device control in the device controls; Acquire an execution result generated by the target peripheral device based on the target control command, and update display information of the target device control based on the execution result.
6. The method according to claim 1, characterized in that The step of acquiring configuration information of the target peripheral device in response to a selection operation for the target peripheral device received in the peripheral device control application includes: In response to a trigger operation for setting an option in a peripheral control application, displaying an application component setting page, and displaying selectable peripherals in the application component setting page; In response to a selection operation on a target peripheral device among the selectable peripheral devices, configuration information of the target peripheral device is acquired.
7. The method according to claim 1, characterized in that The device control includes at least one of a mode selection control, a switch control and a display control.
8. An application component generating device, characterized in that: The device comprises: A configuration acquisition unit, configured to acquire configuration information of a target peripheral device in response to a selection operation received in a peripheral control application; the configuration information includes interface configuration information and control configuration information; An interface generating unit, configured to generate a display interface of an application component corresponding to the peripheral control application based on the interface configuration information; A control generation unit is used to generate a device control in the display interface based on the control configuration information.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory; wherein the memory stores a computer program, and the computer program is suitable for being loaded by the processor and executing the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed, the method according to any one of claims 1 to 7 is implemented.