Equipment control method and device, electronic equipment and storage medium
By loading configuration files and path code mechanisms in the central control device, the problems of poor control logic flexibility and memory usage of central control device software are solved, and more efficient smart home device control is achieved.
Patent Information
- Application Number
- CN202411843169.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-25
AI Technical Summary
The software control logic of central control devices is poor in flexibility, easy to occupy running memory, affecting device performance.
By loading the configuration file of the target application, the configuration file contains the configuration table of the smart home device, the configuration table includes the interface parameters of the device control interface, obtain the path code to read the configuration table, and render the control interface according to the device status changes or control instructions.
It improves the flexibility of software logic implementation, reduces the repetition rate of code, improves the control efficiency of smart home devices, and avoids the use of running memory.
Smart Images

Figure CN119882522A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of equipment control technology, and in particular to a equipment control method, an equipment control device, an electronic device and a computer-readable storage medium. Background Art
[0002] Smart home refers to the use of computer technology, network communication technology and integrated wiring technology to integrate related smart home devices through lines, networks and devices to achieve intelligent management and control of smart home devices. Among them, in the smart home system, users can deploy a central control device to manage and control the devices deployed in the smart home environment through the central control device, such as centralized control, scene mode, voice control, remote control, security monitoring, energy management, health management and entertainment system. However, for the central control device, developers usually solidify the software control logic and write fixed code in the underlying code to implement the corresponding control logic, which leads to a high code repetition rate, the implementation of software logic is not flexible enough, and the repeated control logic is also easy to occupy the running memory of the central control device, affecting the running performance of the device. Summary of the invention
[0003] The embodiments of the present invention provide a device control method, apparatus, electronic device and computer-readable storage medium to solve or partially solve the problem that software control logic has poor flexibility and easily occupies the running memory of the central control device.
[0004] An embodiment of the present invention discloses a device control method, which is applied to a central control device, wherein a target application is deployed in the central control device, and the target application is used to manage and control different smart home devices. The method includes:
[0005] In response to powering on the central control device, loading a configuration file corresponding to the target application, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device;
[0006] Obtain the file path corresponding to each of the configuration tables, and convert the file path into a path code;
[0007] In response to a device state change of a first smart home device or a device control instruction input by a user for the first smart home device, acquiring a first path code corresponding to the first smart home device;
[0008] A first configuration table corresponding to the first smart home device is read according to the first path code, and a first control interface corresponding to the first smart home device is rendered according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
[0009] Some possible implementations also include:
[0010] If it is detected that the second smart home device has not reported status parameters to the central control device for a preset period of time, and the graphical user interface of the central control device remains at the second control interface corresponding to the second smart home device, the second configuration table corresponding to the second smart home device is determined, and the second configuration table is released from the running memory of the central control device.
[0011] Some possible implementations also include:
[0012] The second path code corresponding to the second smart home device is retained.
[0013] In some feasible implementations, the first configuration table includes at least interface interaction information and interface interaction control logic, and the rendering of the corresponding first control interface according to the first configuration table includes:
[0014] The interface interaction information and the interface interaction control logic are used to perform interface rendering, and a first control interface for the first smart home device is displayed in the graphical user interface of the central control device.
[0015] In some feasible implementations, the interface interaction information includes at least interface elements and position information corresponding to the interface elements, the interface interaction control logic includes at least triggering conditions, execution actions, and interface display logic of the interface elements, and the interface rendering is performed using the interface interaction information and the interface interaction control logic to display a first control interface for the first smart home device in the graphical user interface of the central control device, including:
[0016] Performing interface rendering using the interface elements and the position information corresponding to the interface elements to obtain a corresponding interactive interface, and adding corresponding control logic to the interface elements in the interactive interface according to the trigger condition, the execution action, and the interface display logic to obtain a first control interface for the first smart home device;
[0017] The first control interface is displayed in the graphical user interface of the central control device.
[0018] In some feasible implementations, in response to a device state change of the first smart home device, obtaining a first path code corresponding to the first smart home device includes:
[0019] Receiving a target device status sent by a first smart home device;
[0020] If the target device state is different from the current device state of the first control interface currently displayed in the graphical user interface of the central control device, the first path code corresponding to the first smart home device is obtained.
[0021] In some feasible implementations, rendering a first control interface corresponding to the first smart home device according to the first configuration table and the device state change includes:
[0022] Extracting target device parameters corresponding to the target device state;
[0023] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0024] In some feasible implementations, rendering a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction includes:
[0025] Determining a target device parameter corresponding to the device control instruction;
[0026] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0027] The embodiment of the present invention further discloses a device control apparatus, which is applied to a central control device, wherein a target application is deployed in the central control device, and the target application is used to manage and control different smart home devices. The apparatus includes:
[0028] a configuration file loading module, configured to load a configuration file corresponding to the target application in response to power-on of the central control device, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device;
[0029] A path acquisition module, used to acquire the file path corresponding to each of the configuration tables, and convert the file path into a path code;
[0030] a code acquisition module, configured to acquire a first path code corresponding to the first smart home device in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device;
[0031] An interface processing module is used to read a first configuration table corresponding to the first smart home device according to the first path code, and render a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
[0032] Some possible implementations also include:
[0033] A configuration table release module is used to determine the second configuration table corresponding to the second smart home device and release the second configuration table from the running memory of the central control device if it is detected that the second smart home device has not reported the status parameters to the central control device for a preset period of time and the graphical user interface of the central control device remains at the second control interface corresponding to the second smart home device.
[0034] Some possible implementations also include:
[0035] A code processing module is used to retain the second path code corresponding to the second smart home device.
[0036] In some feasible implementations, the first configuration table includes at least interface interaction information and interface interaction control logic, and the interface processing module is specifically used to:
[0037] The interface interaction information and the interface interaction control logic are used to perform interface rendering, and a first control interface for the first smart home device is displayed in the graphical user interface of the central control device.
[0038] In some feasible implementations, the interface interaction information includes at least an interface element and position information corresponding to the interface element, the interface interaction control logic includes at least a trigger condition, an execution action, and an interface display logic of the interface element, and the interface processing module is specifically used to:
[0039] Performing interface rendering using the interface elements and the position information corresponding to the interface elements to obtain a corresponding interactive interface, and adding corresponding control logic to the interface elements in the interactive interface according to the trigger condition, the execution action, and the interface display logic to obtain a first control interface for the first smart home device;
[0040] The first control interface is displayed in the graphical user interface of the central control device.
[0041] In some feasible implementations, the code acquisition module is specifically used to:
[0042] Receiving a target device status sent by a first smart home device;
[0043] If the target device state is different from the current device state of the first control interface currently displayed in the graphical user interface of the central control device, the first path code corresponding to the first smart home device is obtained.
[0044] In some feasible implementations, the interface processing module is specifically used to:
[0045] Extracting target device parameters corresponding to the target device state;
[0046] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0047] In some feasible implementations, the interface processing module is specifically used to:
[0048] Determining a target device parameter corresponding to the device control instruction;
[0049] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0050] The embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;
[0051] The memory is used to store computer programs;
[0052] The processor is used to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0053] The embodiment of the present invention further discloses a computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, enables the processors to execute the method described in the embodiment of the present invention.
[0054] The embodiments of the present invention include the following advantages:
[0055] In an embodiment of the present invention, when a user controls a smart home device through a target application program running in a central control device, the central control device may load a configuration file corresponding to the target application program in response to powering on the central control device, wherein the configuration file at least includes a configuration table corresponding to each smart home device, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device, then obtain a file path corresponding to each configuration table, and convert the file path into a path code, then obtain a first path code corresponding to the first smart home device in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device, finally read a first configuration table corresponding to the first smart home device according to the first path code, and render a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device, thereby configuring a corresponding configuration table for each smart home device, and implementing a device control function based on the configuration table when a device state change occurs or the user controls the smart home device, thereby effectively improving the flexibility of software logic implementation and reducing code repetition, and at the same time, the corresponding configuration table can be quickly found through the path code, effectively improving the control efficiency of the smart home device. BRIEF DESCRIPTION OF THE DRAWINGS
[0056] Figure 1 is a flowchart of a method for controlling a device provided in an embodiment of the present invention;
[0057] Figure 2 is a schematic diagram of a fan control interface provided in an embodiment of the present invention;
[0058] Figure 3 is a schematic diagram of an air conditioning control interface provided in an embodiment of the present invention;
[0059] Figure 4 is a structural block diagram of a control device of a device provided in an embodiment of the present invention;
[0060] Figure 5 It is a block diagram of an electronic device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0061] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] As an example, for central control devices, developers usually solidify the software control logic and write fixed code in the underlying code to implement the corresponding control logic, which leads to high code repetition rate, inflexible implementation of software logic, and repeated control logic easily occupies the running memory of the central control device, affecting the running performance of the device.
[0063] In this regard, in the present invention, different smart home devices can be processed according to the commonalities and individualities of the device functions corresponding to the smart home devices, the individualities of the smart home devices are configured with corresponding configuration tables for each smart home device, and the control interface is adapted and compatible based on the configuration tables. Specifically, when a user controls the smart home device through a target application running in a central control device, the central control device can, in response to power-on of the central control device, load a configuration file corresponding to the target application, the configuration file at least including a configuration table corresponding to each smart home device, the configuration table at least including interface parameters of the device control interface corresponding to the smart home device, and then obtain the file path corresponding to each configuration table, convert the file path into a path code, and then respond to a setting of the first smart home device. The first smart home device is controlled by a first control interface, and a first configuration table is rendered according to the first configuration table and the device state change or the device control instruction to control the first smart home device, thereby configuring a corresponding configuration table for each smart home device, and realizing the device control function based on the configuration table when a device state change occurs or the user controls the smart home device, effectively improving the flexibility of software logic implementation and reducing the code repetition rate, and at the same time, the corresponding configuration table can be quickly found through the path code, effectively improving the control efficiency of the smart home device.
[0064] Reference Figure 1 , shows a flowchart of a method for controlling a device provided in an embodiment of the present invention, which is applied to a central control device, in which a target application is deployed, and the target application is used to manage and control different smart home devices, and specifically may include the following steps:
[0065] Step 101, in response to the power-on of the central control device, loading a configuration file corresponding to the target application, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device;
[0066] In an embodiment of the present invention, a corresponding application can be run in the central control device, and the user can manage and control different smart home devices through the application. Specifically, in the process of controlling the smart home devices, the central control device can display a control interface for the smart home devices in a graphical user interface, and the control interface includes corresponding interface elements, etc. The user can input user operations for the interface elements to control the smart home devices.
[0067] It should be noted that different smart home devices may have certain differences in device types, but they also have corresponding commonalities. For example, Figure 2 , showing a schematic diagram of a fan control interface provided in an embodiment of the present invention, and Figure 3 , shows a schematic diagram of the air-conditioning control interface provided in an embodiment of the present invention. Both are control interfaces provided by an application. It can be seen that for fans and air conditioners, the control interfaces of the two have similarities to a certain extent, as well as certain differences. Based on the same content, corresponding common information (such as interface layout, control logic, etc.) can be configured. For different contents, a corresponding configuration table can be configured for each smart home device. When the corresponding control interface needs to be rendered, the interface rendering can be achieved by reading the configuration table of the personalized configuration. Therefore, for developers, by exploring the commonalities and individualities of different smart home devices in the control interface, and then for the common content, by developing the corresponding unified implementation logic, for the individual content, by using the form of a configuration table for adaptation and compatibility, the repetition rate of the underlying code can be effectively reduced, and the difficulty of development can be reduced.
[0068] For example, the configuration table folder hierarchy can be divided into: major category -> device category -> MID -> subdivision code -> UI / master control, etc., wherein the major category refers to the device type corresponding to the smart device; the device category refers to the product corresponding to the smart home device; MID refers to the code of different products under the same device category (such as the MID of a fan based on WiFi communication is 221, the MID of a fan based on Bluetooth communication is 222, etc.) Further, the subdivision code can be a device code with different functions under the same MID (such as a Bluetooth network configuration fan with MID222, subdivision code 1 represents a fan with only left and right shaking function, and subdivision code 2 represents a fan with left and right shaking function, up and down shaking function, etc.); UI refers to information related to the user interface display, and the master control represents the processing parameters of the back-end control logic, etc., and the present invention is not limited to this.
[0069] In one example, assuming that the control interface of a fan is similar to the control interface of an air conditioner, the relevant parameters such as the specific location and content display of the control interface can be presented by configuring the corresponding UI configuration table. In the UI configuration table, corresponding parameters can be configured to characterize the corresponding UI display. For example, the UI configuration table for a fan or an air conditioner can include at least the following contents:
[0070] 1. Device type and subtype:
[0071] The device type is Fan.
[0072] The subtype code is 2, which may represent a specific fan model or functional subdivision.
[0073] 2. Pictures:
[0074] The fan image name is specified and is used to display the fan image in the UI.
[0075] 3. Action collection:
[0076] An action set is defined, which contains an action called "Set left and right shaking angles".
[0077] The Chinese name of this action is "Shake your head".
[0078] The coordinates of the action's display position in the UI are (x, y).
[0079] The action's display icon is a picture named "Left and right shaking angle picture name".
[0080] The action has an associated page for further setup or display of detailed information.
[0081] 4. Action attribute range:
[0082] Several possible pan angle settings are defined:
[0083] swingStop: Stop shaking the head. The displayed name is "Stop shaking the head".
[0084] swingHorizontal60: The swing angle is 60 degrees, and the display name is "60".
[0085] swingHorizontal90: The swing angle is 90 degrees, and the display name is "90".
[0086] 5. Functional attributes:
[0087] Defines the properties of the left and right shaking function:
[0088] The attribute name is "left and right shake attribute name", and the current value is "swingStop", indicating that the current state is to stop shaking the head.
[0089] In one example, you can use Pic (picture) to set whether to reference a fan picture or an air conditioner picture, and use actions (action collection) to distinguish the type of buttons and the corresponding display position of the buttons in the UI interface; through "actionName (action display Chinese name)": "shake head", you can set it to mode, shake head, advanced, timing, etc.; through "actionPage (whether there is an action page)": "yes" or "no", this parameter can be used to distinguish whether the switch will enter the secondary page, and directly change the UI display status. For modes, shake heads, etc., you need to expand the secondary page to select more parameters; through "actionInstructions (action attribute range)": this parameter can adjust different display ranges, for example: stop shaking head, 60°, 90°, etc.
[0090] In addition, after confirming the relevant configuration rules and ranges through the UI configuration table, you can also configure the control logic and related parameters such as the actions and ranges that the UI needs to display through the main control configuration table. For example, the UI configuration table for fans or air conditioners can be configured with code content that at least includes the following control logic:
[0091] The control fields of the fan device (such as "left and right shaking angle", "mode", "switch", etc.) and their value ranges and display names are defined.
[0092] Defines the mutual exclusion logic and association rules between fields:
[0093] When the value of the "Mode" field is 0, the sleep function is disabled and the left and right panning angles can be set to 60 degrees or 90 degrees.
[0094] When the value of the "mode" field is 1, certain features are disabled (placeholder).
[0095] Complex association rules control the values of the "Wind Speed", "Left and Right Shake Switch", and "Left and Right Shake Angle" fields through the "Switch" and "Mode" fields.
[0096] In one example, the corresponding parameters can be configured in the main control configuration table. Through "ValueExplain (value meaning)": ["swingStop", "swingHorizontal60", "swingHorizontal90"], it can be adjusted according to the functions of different devices. If there are only switches and 60°, only two are configured, and the UI will display two. If there are three, all three need to be written in the code to ensure the integrity of the interface display; through "mutex (simple field association rules)": this can configure simple rule association relationships. If the mode is 0, you can set the sleep off and the display of the shaking angle can only be selected from 1 and 2; through "unite_rules (complex field association rules)", this is to configure more complex rules, and the rule logic needs to be described by functions. For example: when the mode value is 0, turn off the machine, adjust the wind speed to gear 1, turn off the left and right shaking, and the left and right shaking angle to 90°. This can be associated through "func (rule function)". If devices with different MIDs have the same processing, the function can be reused through configuration.
[0097] Through the above process, a corresponding configuration table can be configured for each smart home device, so as to perform adaptation and compatibility of the control interface display based on the configuration table.
[0098] In actual application, the central control device can load the configuration file corresponding to the target application in response to power-on. The configuration file includes at least a configuration table corresponding to each smart home device, and the configuration table includes at least interface parameters of the device control interface corresponding to the smart home device.
[0099] Step 102, obtaining the file path corresponding to each of the configuration tables, and converting the file path into a path code;
[0100] In a specific implementation, the central control device can parse and load the configuration tables corresponding to all smart home devices during the process of loading the configuration table. Specifically, it obtains the file path corresponding to each configuration table, converts the file path into a path code, and loads each configuration table.
[0101] It should be noted that, at the beginning of the application startup, by converting the file path into a path code, it is convenient to quickly find the specific configuration table through the path code when the configuration table needs to be loaded again after the configuration table is released.
[0102] In one example, the paths of all configuration table files can be obtained by traversing the configuration file directory, and then the file path can be converted into a unique path code, and the mapping relationship between the path code and the file path can be stored in a corresponding data structure (such as a dictionary or a local database) for subsequent query and use. Optionally, a hash function can be used to convert the file path into a string of fixed length, so that by converting the file path into a path code, it is convenient to quickly find the specific configuration table through the path code when the configuration table needs to be loaded again after the configuration table is released.
[0103] Step 103, in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device, obtaining a first path code corresponding to the first smart home device;
[0104] During the operation of the application, the central control device can receive the device status parameters sent by the smart home device in real time or regularly, and respond to the device control instructions for the smart home device input by the user. Among them, whether it is receiving the device status parameters or detecting the corresponding device control instructions, it may cause the control interface to change, such as the device status displayed in the control interface changes, the device parameters change, the environmental parameters change, etc. In this regard, after receiving the device status parameters sent by the first smart home device, the central control device can compare the received device status parameters with the device status parameters displayed in the current control interface. If there is a difference between the two, it can be determined that the device status of the first smart home device has changed, and the control interface needs to be updated; similarly, when the user enters the device control instruction for the first smart home device in the control interface, the control interface also needs to be updated according to the device control instruction. Therefore, the central control device can obtain the first path code corresponding to the first smart home device, so as to obtain the corresponding configuration table based on the first path code, and then realize the update of the control interface.
[0105] For example, the central control device can receive the target device status sent by the first smart home device. If the target device status is different from the current device status of the first control interface currently displayed in the graphical user interface of the central control device, the first path code corresponding to the first smart home device is obtained; it can also detect whether the user has entered a corresponding control operation in the control interface, such as selecting an interface element of the control interface, setting a corresponding numerical value, etc. The present invention is not limited to this.
[0106] Step 104: read a first configuration table corresponding to the first smart home device according to the first path code, and render a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
[0107] In an embodiment of the present invention, the central control device can read the first configuration table corresponding to the first smart home device according to the first path code, and render the first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device, thereby configuring a corresponding configuration table for each smart home device, and implementing the device control function based on the configuration table when a device state change occurs or the user controls the smart home device, effectively improving the flexibility of software logic implementation and reducing the code repetition rate. At the same time, the corresponding configuration table can be quickly found through the path code, effectively improving the control efficiency of the smart home device.
[0108] In some feasible implementations, such as the above embodiment, the first configuration table includes at least interface interaction information and interface interaction control logic, and the central control device can use the interface interaction information and the interface interaction control logic to perform interface rendering, and display the first control interface for the first smart home device in the graphical user interface of the central control device.
[0109] In a specific implementation, the interface interaction information includes at least interface elements and position information corresponding to the interface elements, and the interface interaction control logic includes at least trigger conditions, execution actions and interface display logic of the interface elements. The central control device can use the interface elements and the position information corresponding to the interface elements to render the interface, obtain the corresponding interaction interface, and add corresponding control logic to the interface elements in the interaction interface according to the trigger conditions, execution actions and interface display logic, obtain the first control interface for the first smart home device, and then display the first control interface in the graphical user interface of the central control device.
[0110] Among them, for the process of device change, the central control device can extract the target device parameters corresponding to the target device state, then update the first configuration table according to the target device parameters, and render the first control interface corresponding to the first smart home device based on the updated first configuration table. For the process of device control, the central control device can determine the target device parameters corresponding to the device control instruction, then update the first configuration table according to the target device parameters, and render the first control interface corresponding to the first smart home device based on the updated first configuration table.
[0111] In addition, during the running of the application, since the user will not control the smart home devices all the time, for the smart home devices that the user does not control, if the corresponding configuration table is always loaded, it will occupy the running memory of the central control device. In this regard, if the central control device detects that the second smart home device has not reported status parameters to the central control device for a preset period of time, and the graphical user interface of the central control device is stuck at the second control interface corresponding to the second smart home device, then the second configuration table corresponding to the second smart home device is determined, and the second configuration table is released from the running memory of the central control device, and the second path code corresponding to the second smart home device is retained. In this way, the size of the running memory occupied by the device control is reduced through the detection mechanism of periodically optimizing the release of infrequently used memory. At the same time, based on the path code, when the corresponding configuration table needs to be reloaded, the terminal device can quickly read the corresponding configuration through the path code to ensure the normal implementation of the device control function.
[0112] It should be noted that the embodiments of the present invention include but are not limited to the above examples. It is understandable that those skilled in the art can also make settings according to actual needs under the guidance of the ideas of the embodiments of the present invention, and the present invention is not limited to this.
[0113] In an embodiment of the present invention, when a user controls a smart home device through a target application program running in a central control device, the central control device may load a configuration file corresponding to the target application program in response to powering on the central control device, wherein the configuration file at least includes a configuration table corresponding to each smart home device, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device, then obtain a file path corresponding to each configuration table, and convert the file path into a path code, then obtain a first path code corresponding to the first smart home device in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device, finally read a first configuration table corresponding to the first smart home device according to the first path code, and render a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device, thereby configuring a corresponding configuration table for each smart home device, and implementing a device control function based on the configuration table when a device state change occurs or the user controls the smart home device, thereby effectively improving the flexibility of software logic implementation and reducing code repetition, and at the same time, the corresponding configuration table can be quickly found through the path code, effectively improving the control efficiency of the smart home device.
[0114] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, the following examples are used for exemplary description:
[0115] As an example, when the program is running, the device configuration table of the corresponding category is loaded. If the configuration table of the relevant device has not been used for a long time and has not stayed on the device control page, it can be released first and loaded later when it is needed. For example: when loading at power-on, first parse the entire configuration table, and convert the path where the relevant MID is located into the corresponding path code, so that when it is released later, you only need to retain the corresponding path code to quickly find the specific configuration file information. Generally, the device status will be reported for update only when there is a change in the device, or the corresponding configuration logic will be used when the user controls it on the UI. Therefore, if a device has not reported its status for a long time and the UI has not stayed on the corresponding interface, the detailed configuration parameter block parsed from the device can be released, and only the corresponding path code can be retained. This can save the size of the running memory occupied.
[0116] Through the above process, a corresponding configuration table is configured for each smart home device, and when the device state changes or the user controls the smart home device, the device control function is implemented based on the configuration table, which effectively improves the flexibility of software logic implementation and reduces the code repetition rate. At the same time, the corresponding configuration table can be quickly found through the path code, which effectively improves the control efficiency of the smart home device.
[0117] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0118] Reference Figure 4 , shows a structural block diagram of a control device of a device provided in an embodiment of the present invention, which is applied to a central control device, in which a target application is deployed, and the target application is used to manage and control different smart home devices, and specifically may include the following modules:
[0119] A configuration file loading module 401 is used to load a configuration file corresponding to the target application in response to the power-on of the central control device, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device;
[0120] A path acquisition module 402 is used to acquire the file path corresponding to each of the configuration tables and convert the file path into a path code;
[0121] The code acquisition module 403 is used to acquire a first path code corresponding to the first smart home device in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device;
[0122] The interface processing module 404 is used to read the first configuration table corresponding to the first smart home device according to the first path code, and render the first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
[0123] Some possible implementations also include:
[0124] A configuration table release module is used to determine the second configuration table corresponding to the second smart home device and release the second configuration table from the running memory of the central control device if it is detected that the second smart home device has not reported the status parameters to the central control device for a preset period of time and the graphical user interface of the central control device remains at the second control interface corresponding to the second smart home device.
[0125] Some possible implementations also include:
[0126] A code processing module is used to retain the second path code corresponding to the second smart home device.
[0127] In some feasible implementations, the first configuration table includes at least interface interaction information and interface interaction control logic, and the interface processing module 404 is specifically used to:
[0128] The interface interaction information and the interface interaction control logic are used to perform interface rendering, and a first control interface for the first smart home device is displayed in the graphical user interface of the central control device.
[0129] In some feasible implementations, the interface interaction information includes at least interface elements and position information corresponding to the interface elements, the interface interaction control logic includes at least triggering conditions, execution actions and interface display logic of the interface elements, and the interface processing module 404 is specifically used to:
[0130] Performing interface rendering using the interface elements and the position information corresponding to the interface elements to obtain a corresponding interactive interface, and adding corresponding control logic to the interface elements in the interactive interface according to the trigger condition, the execution action, and the interface display logic to obtain a first control interface for the first smart home device;
[0131] The first control interface is displayed in the graphical user interface of the central control device.
[0132] In some feasible implementations, the code acquisition module is specifically used to:
[0133] Receiving a target device status sent by a first smart home device;
[0134] If the target device state is different from the current device state of the first control interface currently displayed in the graphical user interface of the central control device, the first path code corresponding to the first smart home device is obtained.
[0135] In some feasible implementations, the interface processing module 404 is specifically used to:
[0136] Extracting target device parameters corresponding to the target device state;
[0137] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0138] In some feasible implementations, the interface processing module 404 is specifically used to:
[0139] Determining a target device parameter corresponding to the device control instruction;
[0140] The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
[0141] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0142] In addition, an embodiment of the present invention further provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the control method embodiment of the above-mentioned device are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.
[0143] The embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the control method embodiment of the above-mentioned device is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0144] Figure 5 A schematic diagram of the hardware structure of an electronic device for implementing various embodiments of the present invention.
[0145] The electronic device 500 includes but is not limited to: a radio frequency unit 501, a network module 502, an audio output unit 503, an input unit 504, a sensor 505, a display unit 506, a user input unit 507, an interface unit 508, a memory 509, a processor 510, and a power supply 511. Those skilled in the art will appreciate that the electronic device structure involved in the embodiments of the present invention does not constitute a limitation on the electronic device, and the electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange components differently. In the embodiments of the present invention, the electronic device includes but is not limited to a mobile phone, a tablet computer, a laptop computer, a PDA, a vehicle-mounted terminal, a wearable device, and a pedometer.
[0146] It should be understood that in the embodiment of the present invention, the radio frequency unit 501 can be used for receiving and sending signals during information transmission or communication. Specifically, after receiving downlink data from the base station, it is sent to the processor 510 for processing; in addition, uplink data is sent to the base station. Generally, the radio frequency unit 501 includes but is not limited to an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, etc. In addition, the radio frequency unit 501 can also communicate with the network and other devices through a wireless communication system.
[0147] The electronic device provides users with wireless broadband Internet access through the network module 502, such as helping users to send and receive emails, browse web pages, and access streaming media.
[0148] The audio output unit 503 can convert the audio data received by the RF unit 501 or the network module 502 or stored in the memory 509 into an audio signal and output it as sound. Moreover, the audio output unit 503 can also provide audio output related to a specific function performed by the electronic device 500 (for example, a call signal reception sound, a message reception sound, etc.). The audio output unit 503 includes a speaker, a buzzer, a receiver, etc.
[0149] The input unit 504 is used to receive audio or video signals. The input unit 504 may include a graphics processor (GPU) 5041 and a microphone 5042. The graphics processor 5041 processes the image data of a static picture or video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The processed image frame can be displayed on the display unit 506. The image frame processed by the graphics processor 5041 can be stored in the memory 509 (or other storage medium) or sent via the radio frequency unit 501 or the network module 502. The microphone 5042 can receive sound and can process such sound into audio data. The processed audio data can be converted into a format output that can be sent to a mobile communication base station via the radio frequency unit 501 in the case of a telephone call mode.
[0150] The electronic device 500 also includes at least one sensor 505, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 5061 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 5061 and / or the backlight when the electronic device 500 is moved to the ear. As a type of motion sensor, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), and can detect the magnitude and direction of gravity when stationary, which can be used to identify the posture of the electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc.; the sensor 505 can also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be repeated here.
[0151] The display unit 506 is used to display information input by the user or information provided to the user. The display unit 506 may include a display panel 5061, which may be configured in the form of a liquid crystal display (LCD), an organic light-emitting diode (OLED), or the like.
[0152] The user input unit 507 can be used to receive input digital or character information, and to generate key signal input related to user settings and function control of the electronic device. Specifically, the user input unit 507 includes a touch panel 5071 and other input devices 5072. The touch panel 5071, also known as a touch screen, can collect the user's touch operation on or near it (such as the user's operation on the touch panel 5071 or near the touch panel 5071 using any suitable object or accessory such as a finger, stylus, etc.). The touch panel 5071 may include two parts: a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into the contact point coordinates, and then sends it to the processor 510, receives the command sent by the processor 510 and executes it. In addition, the touch panel 5071 can be implemented using multiple types such as resistive, capacitive, infrared and surface acoustic waves. In addition to the touch panel 5071, the user input unit 507 may also include other input devices 5072. Specifically, other input devices 5072 may include but are not limited to a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail here.
[0153] Further, the touch panel 5071 may be covered on the display panel 5061. When the touch panel 5071 detects a touch operation on or near it, it is transmitted to the processor 510 to determine the type of the touch event, and then the processor 510 provides a corresponding visual output on the display panel 5061 according to the type of the touch event. It can be understood that in one embodiment, the touch panel 5071 and the display panel 5061 are used as two independent components to implement the input and output functions of the electronic device, but in some embodiments, the touch panel 5071 and the display panel 5061 can be integrated to implement the input and output functions of the electronic device, which is not limited here.
[0154] The interface unit 508 is an interface for connecting an external device to the electronic device 500. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device with an identification module, an audio input / output (I / O) port, a video I / O port, a headphone port, etc. The interface unit 508 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic device 500 or may be used to transmit data between the electronic device 500 and an external device.
[0155] The memory 509 can be used to store software programs and various data. The memory 509 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the mobile phone (such as audio data, a phone book, etc.), etc. In addition, the memory 509 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices.
[0156] The processor 510 is the control center of the electronic device. It uses various interfaces and lines to connect various parts of the entire electronic device. By running or executing software programs and / or modules stored in the memory 509 and calling data stored in the memory 509, it performs various functions of the electronic device and processes data, thereby monitoring the electronic device as a whole. The processor 510 may include one or more processing units; preferably, the processor 510 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 510.
[0157] The electronic device 500 may also include a power source 511 (such as a battery) for supplying power to various components. Preferably, the power source 511 may be logically connected to the processor 510 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system.
[0158] In addition, the electronic device 500 includes some functional modules not shown, which will not be described in detail here.
[0159] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0160] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0161] The embodiments of the present invention are described above in conjunction with the accompanying drawings, but the present invention is not limited to the above-mentioned specific implementation modes, which are merely illustrative rather than restrictive. Under the guidance of the present invention, ordinary technicians in this field can also make many forms without departing from the scope of protection of the present invention and the claims, all of which are within the protection of the present invention.
[0162] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0163] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0164] In the embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0165] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0166] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0167] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, ROM, RAM, magnetic disks, or optical disks.
[0168] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for controlling a device, characterized in that: Applied to a central control device, in which a target application is deployed, the target application is used to manage and control different smart home devices, the method includes: In response to powering on the central control device, loading a configuration file corresponding to the target application, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device; Obtain the file path corresponding to each of the configuration tables, and convert the file path into a path code; In response to a device state change of a first smart home device or a device control instruction input by a user for the first smart home device, acquiring a first path code corresponding to the first smart home device; A first configuration table corresponding to the first smart home device is read according to the first path code, and a first control interface corresponding to the first smart home device is rendered according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
2. The method according to claim 1, characterized in that Also includes: If it is detected that the second smart home device has not reported status parameters to the central control device for a preset period of time, and the graphical user interface of the central control device remains at the second control interface corresponding to the second smart home device, the second configuration table corresponding to the second smart home device is determined, and the second configuration table is released from the running memory of the central control device.
3. The method according to claim 2, characterized in that Also includes: The second path code corresponding to the second smart home device is retained.
4. The method according to claim 1, 2 or 3, characterized in that: The first configuration table at least includes interface interaction information and interface interaction control logic, and the rendering of the corresponding first control interface according to the first configuration table includes: The interface interaction information and the interface interaction control logic are used to perform interface rendering, and a first control interface for the first smart home device is displayed in the graphical user interface of the central control device.
5. The method according to claim 4, characterized in that The interface interaction information at least includes interface elements and position information corresponding to the interface elements, the interface interaction control logic at least includes triggering conditions, execution actions and interface display logic of the interface elements, and the interface rendering is performed by using the interface interaction information and the interface interaction control logic to display a first control interface for the first smart home device in the graphical user interface of the central control device, including: Performing interface rendering using the interface elements and the position information corresponding to the interface elements to obtain a corresponding interactive interface, and adding corresponding control logic to the interface elements in the interactive interface according to the trigger condition, the execution action, and the interface display logic to obtain a first control interface for the first smart home device; The first control interface is displayed in the graphical user interface of the central control device.
6. The method according to claim 1, characterized in that The step of obtaining a first path code corresponding to the first smart home device in response to a device state change of the first smart home device includes: Receiving a target device status sent by a first smart home device; If the target device state is different from the current device state of the first control interface currently displayed in the graphical user interface of the central control device, the first path code corresponding to the first smart home device is obtained.
7. The method according to claim 6, characterized in that The rendering of the first control interface corresponding to the first smart home device according to the first configuration table and the device state change includes: Extracting target device parameters corresponding to the target device state; The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
8. The method according to claim 1, characterized in that The rendering of the first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction includes: Determining a target device parameter corresponding to the device control instruction; The first configuration table is updated according to the target device parameters, and a first control interface corresponding to the first smart home device is rendered based on the updated first configuration table.
9. A control device for an equipment, characterized in that: Applied to a central control device, in which a target application is deployed, and the target application is used to manage and control different smart home devices. The device includes: a configuration file loading module, configured to load a configuration file corresponding to the target application in response to power-on of the central control device, wherein the configuration file at least includes a configuration table corresponding to each of the smart home devices, and the configuration table at least includes interface parameters of a device control interface corresponding to the smart home device; A path acquisition module, used to acquire the file path corresponding to each of the configuration tables, and convert the file path into a path code; a code acquisition module, configured to acquire a first path code corresponding to the first smart home device in response to a device state change of the first smart home device or a device control instruction input by a user for the first smart home device; An interface processing module is used to read a first configuration table corresponding to the first smart home device according to the first path code, and render a first control interface corresponding to the first smart home device according to the first configuration table and the device state change or the device control instruction to control the first smart home device.
10. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; The memory is used to store computer programs; The processor is used to implement the method according to any one of claims 1 to 8 when executing the program stored in the memory.
11. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 8.
Citation Information
Cited By
Data loading method and device, intelligent terminal and storage medium
CN120950141A