CN112306637B - Script expansion method, script expansion device, computer equipment and storage medium - Google Patents
Script expansion method, script expansion device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN112306637B CN112306637B CN202011227806.6A CN202011227806A CN112306637B CN 112306637 B CN112306637 B CN 112306637B CN 202011227806 A CN202011227806 A CN 202011227806A CN 112306637 B CN112306637 B CN 112306637B
- Authority
- CN
- China
- Prior art keywords
- script
- execution
- task
- engine
- executing
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000013515 script Methods 0.000 title claims abstract description 323
- 238000000034 method Methods 0.000 title claims abstract description 55
- 238000004590 computer program Methods 0.000 claims description 26
- 230000006870 function Effects 0.000 claims description 21
- 230000008569 process Effects 0.000 claims description 9
- 230000002618 waking effect Effects 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 3
- 230000007958 sleep Effects 0.000 description 15
- 238000004891 communication Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 7
- 230000005059 dormancy Effects 0.000 description 5
- 238000007796 conventional method Methods 0.000 description 4
- 238000005516 engineering process Methods 0.000 description 3
- 230000003993 interaction Effects 0.000 description 3
- 238000005265 energy consumption Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- 241000282326 Felis catus Species 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Abstract
The application relates to a script expansion method, a script expansion device, computer equipment and a storage medium. The method comprises the following steps: loading an extension script; the extension script is a pre-written script for realizing a customized function; the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter; transmitting the task executing command to the task executing engine through a virtual channel; executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel; and returning the execution result to a rule engine through the virtual channel so as to interact with the outside. By adopting the method, the hardware cost can be saved.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a script extension method, a script extension device, a computer device, and a storage medium.
Background
With the development of computer technology, in order to enable interaction between a communication device and an external device, a related technician typically needs to customize related functions for the communication device. Conventional methods for customizing related functions to a communication device are implemented by either adding codes corresponding to the customized related functions to an open computer system or adding a micro control unit.
The conventional method of adding codes corresponding to customized related functions in an open computer system has high requirements on memory and flash memory. By adding the micro control unit, which is a conventional method, an additional purchase of the micro control unit is required. Therefore, the conventional methods all require high hardware costs.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a script extension method, apparatus, computer device, and storage medium that can save hardware costs.
A script extension method, the method comprising:
loading an extension script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter;
transmitting the task executing command to the task executing engine through a virtual channel;
Executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the method further comprises:
executing the startup script through a rule engine;
after executing the startup script, detecting whether an expansion script to be executed exists or not through the rule engine;
And when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to a rule engine through the virtual channel so as to realize the execution of the extension script.
In one embodiment, the method further comprises:
If there are multiple extension scripts to be executed, then
And after the current extension script is executed and a preset time interval is reached, taking the next extension script as the current extension script, and returning to execute the step of loading the extension script and the subsequent step so as to execute the next extension script.
In one embodiment, the method further comprises:
And when detecting that the extension script to be executed does not exist, executing a dormant script through the rule engine to enter a dormant state.
In one embodiment, the method further comprises:
After entering a dormant state, continuously detecting whether an extension script to be executed exists or not through the rule engine; when detecting that the extension script to be executed exists, then
Executing the wake-up script, and returning to execute the step of loading the extension script after waking up.
In one embodiment, after the sending the task execution command to the task execution engine through the virtual channel, the method further includes:
If the field of the task execution command is a field which can be identified by the task execution engine, executing the task execution command through the task execution engine;
And when the field of the execution task command contains a field which cannot be identified by the execution task engine, informing a script interpreter to re-analyze the extension script through the virtual channel.
In one embodiment, the execution task command interpreted by one extension script is multiple;
The executing the execution task command by the execution task engine, and generating an execution result includes:
redirecting the output of the task executing command aiming at the previous target into the input of the next task executing command in the process of executing a plurality of task executing commands through the task executing engine until the task executing commands are executed, and generating an executing result;
The previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
A script extension device, the device comprising:
the loading module is used for loading the extension script; the extension script is a pre-written script for realizing a customized function;
The interpretation module is used for interpreting the extended script into an execution task command which can be identified by the execution task engine through a script interpreter;
The sending module is used for sending the task executing command to the task executing engine through a virtual channel;
The generation module is used for executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
and the return module is used for returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
A computer device comprising a memory storing a computer program and a processor which when executing the computer program performs the steps of:
loading an extension script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter;
transmitting the task executing command to the task executing engine through a virtual channel;
Executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
loading an extension script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter;
transmitting the task executing command to the task executing engine through a virtual channel;
Executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
and returning the execution result to a rule engine through the virtual channel so as to interact with the outside.
The script expansion method, the script expansion device, the computer equipment and the storage medium are characterized in that the script expansion method, the script expansion device, the computer equipment and the storage medium are used for loading an expansion script, the script interpreter is used for interpreting the script into an execution task command which can be identified by an execution task engine, and the execution task command is sent to the execution task engine through the virtual channel so as to complete execution. The execution of the execution task command can be completed through the execution task engine without additional hardware cost, and an execution result is generated. And finally, returning the generated execution result to a rule engine through the virtual channel so as to interact with the outside. The generated execution result can be transmitted to the outside for interaction without additionally adding a hardware unit for controlling the terminal to interact with the outside. In the whole process, no additional hardware cost is involved, so that the script expansion method can save the hardware cost.
Drawings
FIG. 1 is a flow diagram of a script extension method in one embodiment;
FIG. 2 is a flow diagram of a script extension step in one embodiment;
FIG. 3 is a flow diagram of a script extension step in one embodiment;
FIG. 4 is a block diagram of a script extension device in one embodiment;
FIG. 5 is a block diagram of a script extension device in one embodiment;
fig. 6 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
In one embodiment, as shown in fig. 1, a script extension method is provided, and this embodiment is applied to a terminal for illustration, where it is understood that the terminal may be a mobile terminal, a computer, or a dedicated device. Among them, mobile terminals such as mobile phones, tablet computers, hand-held POS (point of sale) machines. Computers such as desktop computers, notebook computers, and the like. A special device with a Modem function, such as a Modem (english name Modem), commonly called a "cat" or the like. The script expansion method specifically comprises the following steps:
step 102, loading an extension script; an extension script is a pre-written script for implementing a customized function.
Specifically, the user pre-writes the extension script according to the customized function to be realized. The terminal loads the extension script.
In one embodiment, the user pre-writes the extension script and uploads it to the preset server as needed to implement the customized functionality. The terminal can download the extension script at a preset server.
Step 104, the extended script is interpreted into an execution task command which can be identified by the execution task engine through a script interpreter.
The script interpreter is an interpreter for translating the extended script into an execution task command which can be identified by the execution task engine. The execution task engine is an engine for executing task commands. The execution task command is a command which has the same function as the extension script and which can be executed only by the execution task engine.
Specifically, the terminal interprets the loaded extension script through a script interpreter to interpret the extension script into an execution task command that can be identified by an execution task engine.
In one embodiment, the execute task command may be an "AT (attention)" command.
In one embodiment, the execution task engine may be an "AT" engine.
It will be appreciated that the execution task commands interpreted for an extended script may be one or more. The number of the plurality is at least two.
It can be understood that the extended script is directly interpreted into the execution task command which can be identified by the execution task engine, and if the process of executing the task command has a problem, the execution task command with the problem can be directly and quickly positioned according to the function flow, so that the execution task command with the problem can be quickly corrected, and the efficiency of generating the execution result is improved.
And step 106, sending the task executing command to the task executing engine through the virtual channel.
The virtual channel is a logic channel for realizing the input and output of the execution task engine.
It can be understood that the script interpreter on the terminal inputs the interpreted task command to the task engine through the virtual channel, and the task engine can output the execution result to the rule engine through the virtual channel. Thus, the input and output of the execution task engine is achieved by the virtual channel.
The execution result is a result generated after the execution task engine executes the execution task command. The rule engine is an engine for executing corresponding scripts according to a pre-set rule. The rule engine is used for supporting the execution of the execution task command, and also can be used for supporting a user-defined simple data processing flow due to the functions of condition judgment, character comparison and the like supported by the self-contained script language.
Step 108, executing the execution task command by the execution task engine, generating an execution result and returning to the virtual channel.
Specifically, an execution task engine on the terminal receives an execution task command sent by the script interpreter through the virtual channel. The execution task engine may execute the execution task command to generate an execution result. Further, the execution task engine on the terminal returns the generated execution result to the virtual channel.
It can be understood that when the execution task commands obtained by interpreting for one extension script are plural, the execution task engine may generate a final execution result after executing all the execution task commands.
And 110, returning the execution result to the rule engine through the virtual channel to interact with the outside.
Specifically, the rule engine on the terminal receives the execution result through the virtual channel. Further, the rule engine on the terminal sends the execution result to the outside to interact with the outside.
The script expansion method, the script expansion device, the computer equipment and the storage medium are characterized in that an expansion script is loaded, the script interpreter is used for interpreting the script into an execution task command which can be identified by an execution task engine, and the execution task command is sent to the execution task engine through a virtual channel so as to complete execution. The execution of the execution task command can be completed through the execution task engine without additional hardware cost, and an execution result is generated. And finally, returning the generated execution result to the rule engine through the virtual channel to interact with the outside. The generated execution result can be transmitted to the outside for interaction without additionally adding a hardware unit for controlling the terminal to interact with the outside. In the whole process, no additional hardware cost is involved, so that the script expansion method can save the hardware cost.
In one embodiment, the method further comprises: executing the startup script through a rule engine; after executing the startup script, detecting whether an expansion script to be executed exists or not through a rule engine; when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extension script.
The startup script is a script which can enable the terminal to start up after execution.
Specifically, a rule engine on the terminal executes the boot script. After executing the startup script, the rule engine on the terminal further detects whether an extension script to be executed exists. When a rule engine on the terminal detects that there is an extension script to be executed, the extension script may be executed. It can be understood that the steps 102 to 110 are specific steps for executing each extension script, so that the step of loading the extension script and the subsequent steps can be executed until the execution result is returned to the rule engine through the virtual channel, so as to implement the execution of the extension script.
In one embodiment, the boot script is executed only when the terminal is powered on to complete the configuration of the initial state of the external device on the terminal. For example, a rule engine on the terminal executes a startup script to complete the setting of the high and low levels of the GPIO, the initialization of the plug-in device when the terminal is powered on, and the like, and also can complete the setting of configuration items, such as setting a preset time interval corresponding to a timing task, and the like.
In one embodiment, when the existence of an extension script to be executed is detected, the extension script may be executed at a timing. It is understood that the number of the extension scripts to be executed may be one or more, and when there are a plurality of extension scripts to be executed, each extension script may be sequentially executed at regular time.
In this embodiment, the rule engine on the terminal detects whether the extension script to be executed exists, and the step of loading the extension script and the subsequent step are executed after the extension script to be executed exists, so that useless steps executed by the terminal when the extension script to be executed does not exist can be avoided, and the energy consumption of the terminal is saved.
In one embodiment, the method further comprises: if the number of the expansion scripts to be executed is multiple, after the current expansion script is executed and when a preset time interval is reached, the next expansion script is used as the current expansion script, and the step of loading the expansion script and the subsequent step are executed in a returning mode so as to execute the next expansion script.
Specifically, if there are multiple extension scripts to be executed, after executing the current extension script and when reaching a preset time interval, the rule engine on the terminal returns the next extension script as the current extension script to execute the step of loading the extension script and the subsequent step so as to execute the next extension script. That is, steps 102 to 110 may be executed for each extension script to implement the execution of the extension script, and when one extension script is executed, the next extension script is executed periodically, that is, steps 102 to 110 are executed for the next extension script continuously to implement the execution of the next extension script.
In this embodiment, after executing the current extension script and when the preset time interval is reached, the rule engine on the terminal returns to execute the step of loading the extension script and the subsequent step to execute the next extension script by taking the next extension script as the current extension script. Therefore, the rule engine on the terminal can orderly execute all the extension scripts to be executed, and the execution among the extension scripts to be executed is not affected.
In one embodiment, the method further comprises: and when detecting that the extension script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
The sleep script is a script for enabling the terminal to enter a sleep state after execution.
Specifically, when the rule engine on the terminal detects that there is no extension script to be executed, the sleep script is executed. And after the rule engine on the terminal executes the dormancy script, the terminal enters a dormancy state.
In this embodiment, when the rule engine on the terminal detects that there is no extension script to be executed, the terminal enters the sleep state by executing the sleep script, so that energy consumption of the terminal can be saved.
In one embodiment, the method further comprises: after entering a dormant state, continuously detecting whether an extension script to be executed exists or not through a rule engine; when the existence of the expansion script to be executed is detected, executing the wake-up script, and returning to the step of executing the loading expansion script after waking up.
The wake-up script is a state that can restore the terminal in the sleep state to enter the state before sleep after execution.
Specifically, after the terminal enters the sleep state, whether the extension script to be executed exists or not is continuously detected through the rule engine. And executing the wake-up script when the rule engine on the terminal detects that the extension script to be executed exists. And after the rule engine on the terminal wakes up the terminal, returning to the step of executing the loading extension script and the subsequent steps.
In this embodiment, when the rule engine on the terminal detects that the extension script to be executed exists, the wake-up script is executed, so that the terminal can quickly resume from the sleep state with energy saving to the state before sleep, so as to execute the step of loading the extension script and the subsequent steps.
In one embodiment, after sending the execute task command to the execute task engine through the virtual channel, the method further comprises: if the field of the execution task command is a field which can be identified by the execution task engine, executing the step of executing the execution task command by the execution task engine; when the field of the execution task command contains a field which cannot be identified by the execution task engine, the script interpreter is informed of re-parsing the extension script through the virtual channel.
Specifically, if the fields of the execution task command are all identifiable fields, the execution task engine on the terminal executes the execution task command, generates an execution result and returns the execution result to the virtual channel; and returning the execution result to the rule engine through the virtual channel so as to interact with the outside. If the unrecognizable field exists in the field of the execution task command, the execution task engine on the terminal informs the script interpreter to re-analyze the extension script through the virtual channel.
In one embodiment, after the script interpreter receives the notification, only the execution task command with unrecognizable fields can be reinterpreted, or the whole loaded extension script can be reinterpreted.
In this embodiment, if there is an unrecognizable field of the execution task command, the script interpreter is notified to re-parse the extension script through the virtual channel, so that it is ensured that the execution task engine can smoothly complete the execution of the execution task command.
In one embodiment, the execution task command interpreted for one extension script is a plurality of; executing the execution task command by the execution task engine, generating an execution result comprising: redirecting the output of the task executing command aiming at the previous target into the input of the next task executing command in the process of executing a plurality of task executing commands through the task executing engine until the plurality of task executing commands are executed, and generating an executing result; the previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
Wherein, the redirection (Redirect) is to relocate the execution result of the previous execution task command as the input of the subsequent execution task command.
It will be understood that, for example, the next task execution command is to add two factors, and by redirecting, the first output result and the second output result generated after the previous target task execution command is executed may be redirected to the first input factor and the second input factor of the next task execution command, so as to execute the next task execution command, that is, complete the addition of the two factors.
Specifically, in the process of executing a plurality of execution task commands through the execution task engine, the execution task engine on the terminal takes the output of the execution task command aiming at the previous target as the input of the next execution task command corresponding to the redirection until the execution of the plurality of execution task commands is completed, and an execution result is generated.
In this embodiment, by redirecting the output of the execution task command for the previous target to the input of the next execution task command, the execution task engine can be caused to complete the execution of the execution task command according to the prescribed direction, so as to generate the execution result.
In one embodiment, as illustrated in the flow chart of the script extension step of fig. 2, the terminal loads the extension script. And a script interpreter on the terminal interprets the extended script into an execution task command which can be identified by the execution task engine through a virtual channel and sends the execution task command to the execution task engine. If the unrecognizable field exists in the field of the execution task command, the execution task engine on the terminal informs the script interpreter to re-analyze the extension script through the virtual channel. If the fields of the execution task command are all identifiable fields, executing the execution task command by an execution task engine on the terminal. And the execution of the execution task engine on the terminal returns an execution result generated according to the execution task command to the rule engine through the virtual channel. The rule engine on the terminal sends the execution result to the outside to interact with the outside.
In one embodiment, as illustrated in the flowchart of the script extension step of fig. 3, the terminal is powered on (i.e., "module powered up") and the power-on script is executed by the rules engine. After executing the startup script, the rule engine on the terminal further detects whether an extension script to be executed exists. If the number of the extension scripts to be executed is multiple, the rule engine on the terminal returns the step of executing the loading extension script and the subsequent step to execute the next extension script by taking the next extension script as the current extension script after executing the current extension script and when the preset time interval is reached. And executing the dormancy script when the rule engine on the terminal detects that the extension script to be executed does not exist. And after the rule engine on the terminal executes the dormancy script, the terminal enters a dormancy state. And after the terminal enters the dormant state, continuously detecting whether the extension script to be executed exists or not through the rule engine. And executing the wake-up script when the rule engine on the terminal detects that the extension script to be executed exists. And after the rule engine on the terminal wakes up the terminal, returning to the step of executing the loading extension script. And when the rule engine on the terminal exceeds the time threshold and the existence of the extension script to be executed is not detected, interrupting the wake-up.
It should be understood that, although the steps in the flowcharts of fig. 1 to 3 are sequentially shown as indicated by arrows, the steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least a portion of the steps of fig. 1-3 may include steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the steps or stages are performed necessarily occur sequentially, but may be performed alternately or alternately with other steps or at least a portion of the steps or stages in other steps.
In one embodiment, as shown in fig. 4, there is provided a script extension device 400 comprising: a loading module 404, an interpretation module 406, a sending module 408, an execution module 410, and a return module 412, wherein:
A loading module 404, configured to load an extension script; an extension script is a pre-written script for implementing a customized function.
The interpretation module 406 is configured to interpret, by the script interpreter, the extended script into an execution task command that can be identified by the execution task engine.
The sending module 408 is configured to send the task execution command to the task execution engine through the virtual channel.
The execution module 410 is configured to execute the execution task command by using the execution task engine, generate an execution result, and return the execution result to the virtual channel.
And the return module 412 is configured to return the execution result to the rule engine through the virtual channel to interact with the outside.
In one embodiment, a boot module 401 is configured to execute a boot script through a rules engine; after executing the startup script, detecting whether an expansion script to be executed exists or not through a rule engine; when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extension script.
In one embodiment, the timing module 402 is configured to return, if there are multiple extension scripts to be executed, a next extension script as a current extension script after the current extension script is executed and when a preset time interval is reached, to execute the step of loading the extension script and the subsequent step, so as to execute the next extension script.
In one embodiment, the sleep module 414 is configured to execute the sleep script by the rule engine to enter the sleep state when it detects that there is no extension script to be executed.
As shown in fig. 5, in one embodiment, the apparatus further comprises: a power-on module 401, a timing module 402, a sleep module 414, and a wake-up module 416;
The wake-up module 416 is configured to, after entering the sleep state, continuously detect, through the rule engine, whether there is an extension script to be executed; when the existence of the expansion script to be executed is detected, executing the wake-up script, and returning to the step of executing the loading expansion script after waking up.
In one embodiment, the execution module 410 is further configured to execute the step of executing the task command by the task engine if the field of the task command is a field that can be identified by the task engine; when the field of the execution task command contains a field which cannot be identified by the execution task engine, the script interpreter is informed of re-parsing the extension script through the virtual channel.
In one embodiment, the execution module 410 is further configured to redirect, in executing the plurality of execution task commands by the execution task engine, an output of the execution task command for a previous target to an input of a next execution task command until the plurality of execution task commands are executed, and generate an execution result; the previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
For specific limitations of the script extension device, reference may be made to the above limitation of the script extension method, and the description thereof will not be repeated here. The various modules in the script extension device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure of which may be as shown in fig. 6. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a script extension method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in FIG. 6 is merely a block diagram of some of the structures associated with the present inventive arrangements and is not limiting of the computer device to which the present inventive arrangements may be applied, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
loading an extension script; the extension script is a pre-written script for realizing the customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter;
transmitting the task executing command to the task executing engine through the virtual channel;
Executing the execution task command through an execution task engine, generating an execution result and returning to the virtual channel;
and returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the processor when executing the computer program further performs the steps of: executing the startup script through a rule engine; after executing the startup script, detecting whether an expansion script to be executed exists or not through a rule engine; when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extension script.
In one embodiment, the processor when executing the computer program further performs the steps of: if the number of the expansion scripts to be executed is multiple, after the current expansion script is executed and when a preset time interval is reached, the next expansion script is used as the current expansion script, and the step of loading the expansion script and the subsequent step are executed in a returning mode so as to execute the next expansion script.
In one embodiment, the processor when executing the computer program further performs the steps of: and when detecting that the extension script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
In one embodiment, the processor when executing the computer program further performs the steps of: after entering a dormant state, continuously detecting whether an extension script to be executed exists or not through a rule engine; when the existence of the expansion script to be executed is detected, executing the wake-up script, and returning to the step of executing the loading expansion script after waking up. In one embodiment, the processor when executing the computer program further performs the steps of: if the field of the execution task command is a field which can be identified by the execution task engine, executing the step of executing the execution task command by the execution task engine; when the field of the execution task command contains a field which cannot be identified by the execution task engine, the script interpreter is informed of re-parsing the extension script through the virtual channel.
In one embodiment, the processor when executing the computer program further performs the steps of: redirecting the output of the task executing command aiming at the previous target into the input of the next task executing command in the process of executing a plurality of task executing commands through the task executing engine until the plurality of task executing commands are executed, and generating an executing result; the previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
loading an extension script; the extension script is a pre-written script for realizing the customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter;
transmitting the task executing command to the task executing engine through the virtual channel;
Executing the execution task command through an execution task engine, generating an execution result and returning to the virtual channel;
and returning the execution result to the rule engine through the virtual channel so as to interact with the outside.
In one embodiment, the computer program when executed by the processor further performs the steps of: executing the startup script through a rule engine; after executing the startup script, detecting whether an expansion script to be executed exists or not through a rule engine; when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to the rule engine through the virtual channel so as to realize the execution of the extension script.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the number of the expansion scripts to be executed is multiple, after the current expansion script is executed and when a preset time interval is reached, the next expansion script is used as the current expansion script, and the step of loading the expansion script and the subsequent step are executed in a returning mode so as to execute the next expansion script.
In one embodiment, the computer program when executed by the processor further performs the steps of: and when detecting that the extension script to be executed does not exist, executing the dormant script through the rule engine to enter a dormant state.
In one embodiment, the computer program when executed by the processor further performs the steps of: after entering a dormant state, continuously detecting whether an extension script to be executed exists or not through a rule engine; when the existence of the expansion script to be executed is detected, executing the wake-up script, and returning to the step of executing the loading expansion script after waking up.
In one embodiment, the computer program when executed by the processor further performs the steps of: if the field of the execution task command is a field which can be identified by the execution task engine, executing the step of executing the execution task command by the execution task engine; when the field of the execution task command contains a field which cannot be identified by the execution task engine, the script interpreter is informed of re-parsing the extension script through the virtual channel.
In one embodiment, the computer program when executed by the processor further performs the steps of: redirecting the output of the task executing command aiming at the previous target into the input of the next task executing command in the process of executing a plurality of task executing commands through the task executing engine until the plurality of task executing commands are executed, and generating an executing result; the previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, or the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory. By way of illustration, and not limitation, RAM can be in various forms such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), etc.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the application, which are described in detail and are not to be construed as limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of protection of the present application is to be determined by the appended claims.
Claims (10)
1. A script extension method, the method comprising:
loading an extension script; the extension script is a pre-written script for realizing a customized function;
the extended script is interpreted into an execution task command which can be identified by an execution task engine through a script interpreter; the execution task command refers to attention commands; the execution task engine refers to an AT engine;
transmitting the task executing command to the task executing engine through a virtual channel; the virtual channel is a logic channel for realizing the input and output of the task execution engine;
Executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
Returning the execution result to a rule engine through the virtual channel so as to interact with the outside; the rule engine is an engine for executing corresponding scripts according to preset rules; the rule engine has the functions of condition judgment and character comparison supported by the script language and is used for supporting the defined data processing flow.
2. The method according to claim 1, wherein the method further comprises:
executing the startup script through a rule engine;
after executing the startup script, detecting whether an expansion script to be executed exists or not through the rule engine;
And when the existence of the extension script to be executed is detected, executing the step of loading the extension script and the subsequent steps until the execution result is returned to a rule engine through the virtual channel so as to realize the execution of the extension script.
3. The method according to claim 2, wherein the method further comprises:
If there are multiple extension scripts to be executed, then
And after the current extension script is executed and a preset time interval is reached, taking the next extension script as the current extension script, and returning to execute the step of loading the extension script and the subsequent step so as to execute the next extension script.
4. The method according to claim 2, wherein the method further comprises:
And when detecting that the extension script to be executed does not exist, executing a dormant script through the rule engine to enter a dormant state.
5. The method according to claim 4, wherein the method further comprises:
After entering a dormant state, continuously detecting whether an extension script to be executed exists or not through the rule engine;
when detecting that the extension script to be executed exists, then
Executing the wake-up script, and returning to execute the step of loading the extension script after waking up.
6. The method of claim 1, wherein after the sending the task execution command to the task execution engine via a virtual channel, the method further comprises:
If the field of the task execution command is a field which can be identified by the task execution engine, executing the task execution command through the task execution engine;
And when the field of the execution task command contains a field which cannot be identified by the execution task engine, informing a script interpreter to re-analyze the extension script through the virtual channel.
7. The method according to any one of claims 1 to 6, wherein the execution task command interpreted for one extension script is a plurality of;
The executing the execution task command by the execution task engine, and generating an execution result includes:
redirecting the output of the task executing command aiming at the previous target into the input of the next task executing command in the process of executing a plurality of task executing commands through the task executing engine until the task executing commands are executed, and generating an executing result;
The previous target execution task command is an execution task command which is executed previously and needs to redirect output to input.
8. A script extension device, the device comprising:
the loading module is used for loading the extension script; the extension script is a pre-written script for realizing a customized function;
The interpretation module is used for interpreting the extended script into an execution task command which can be identified by the execution task engine through a script interpreter; the execution task command refers to attention commands; the execution task engine refers to an AT engine;
the sending module is used for sending the task executing command to the task executing engine through a virtual channel; the virtual channel is a logic channel for realizing the input and output of the task execution engine;
The generation module is used for executing the execution task command through the execution task engine, generating an execution result and returning to the virtual channel;
the return module is used for returning the execution result to the rule engine through the virtual channel so as to interact with the outside; the rule engine is an engine for executing corresponding scripts according to preset rules; the rule engine has the functions of condition judgment and character comparison supported by the script language and is used for supporting the defined data processing flow.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011227806.6A CN112306637B (en) | 2020-11-06 | Script expansion method, script expansion device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011227806.6A CN112306637B (en) | 2020-11-06 | Script expansion method, script expansion device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112306637A CN112306637A (en) | 2021-02-02 |
CN112306637B true CN112306637B (en) | 2024-06-21 |
Family
ID=
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110825488A (en) * | 2019-09-29 | 2020-02-21 | 山东中创软件工程股份有限公司 | Business processing method and device, electronic equipment and storage medium |
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110825488A (en) * | 2019-09-29 | 2020-02-21 | 山东中创软件工程股份有限公司 | Business processing method and device, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20200364085A1 (en) | Task scheduling based on performance control conditions for multiple processing units | |
EP2551741B1 (en) | Method for controlling temperature of terminal and terminal supporting the same | |
EP2919115B1 (en) | Task migration method and apparatus | |
CN108549568B (en) | Application entry processing method and device, storage medium and electronic equipment | |
CN108287918B (en) | Music playing method and device based on application page, storage medium and electronic equipment | |
CN101526901B (en) | Method and device for viewing files in computer | |
US11467650B2 (en) | Selecting a low power state in an electronic device | |
KR20150069504A (en) | Apparatus and method for switching application on a mobile terminal | |
WO2019214475A1 (en) | Application preloading method, device, storage medium, and mobile terminal | |
CN103809864A (en) | Method and device for switching interfaces dynamically | |
WO2019214477A1 (en) | Application program pre-loading method and device, storage medium and terminal | |
WO2019214476A1 (en) | Screen direction setting method and device, storage medium and terminal | |
WO2020015203A1 (en) | System recovery method and device | |
EP2979177A1 (en) | Method for controlling process of application and computer system | |
CN105847446B (en) | Method, device and system for acquiring network data | |
CN114237743B (en) | Interface loading method and device, electronic equipment and storage medium | |
US9411642B2 (en) | Using high priority thread to boost CPU clock rate | |
US11500647B2 (en) | Systems and methods for achieving faster boot times using BIOS attribute mitigation | |
CN112306637B (en) | Script expansion method, script expansion device, computer equipment and storage medium | |
CN108400929B (en) | Data processing method, device, computing equipment and medium | |
CN112261639B (en) | SIM card function configuration method, device, terminal equipment and storage medium | |
CN112527416A (en) | Task processing method and device, computer equipment and storage medium | |
CN107766218A (en) | system optimization method, device, storage medium and terminal device | |
US20120185713A1 (en) | Server, storage medium, and method for controlling sleep and wakeup function of the server | |
CN112306637A (en) | Script extension method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant |