AT command processing method, device, terminal equipment and storage medium
By setting up a virtual channel in the terminal device and processing AT commands according to the sorting rules, the problem of low AT command processing performance in the existing technology is solved, parallel transmission between processes is realized, and the usage efficiency of the communication module is improved.
Patent Information
- Application Number
- CN202310114043.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-10
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2043-02-10
AI Technical Summary
In the existing technology, AT command processing performance is poor and transmission efficiency is low, resulting in waiting between processes and inability to effectively utilize the resources of the communication module.
By setting multiple processes to be communicated in the terminal device, each process corresponds to a virtual channel, AT commands are added to the sending linked list according to the preset sorting rules, and sent to the communication module in turn, allowing processes to send AT commands in parallel. Reduce waiting time.
It improves the performance and efficiency of sending AT commands, reduces the waiting time between processes, and improves the overall performance of the terminal device.
Smart Images

Figure CN116112911B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to an AT command processing method, apparatus, terminal equipment and storage medium. Background Art
[0002] With the rapid development of network communications, various types of communication modules emerge in an endless stream, such as WIFI (Wireless Fidelity) modules, 4 / 5G modules, GPRS (General Packet Radio Services) modules, etc. At present, the process in the terminal device can send AT commands to the communication module through the AT (Attention) channel to control the communication module.
[0003] In the prior art, AT commands often follow a one-receive-one-send mode, that is, after one process sends an AT command to a communication module and receives a reply, another process can send an AT command to the communication module. Therefore, there is a problem of poor AT command processing performance of each process and low sending efficiency. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide an AT command processing method, apparatus, terminal device and storage medium to solve the problems of poor AT command processing performance and low sending efficiency of each process in the prior art.
[0005] In order to achieve the above purpose, the technical solution adopted in the embodiment of the present application is as follows:
[0006] In a first aspect, the present application provides an AT command processing method, which is applied to a terminal device, wherein the terminal device includes a communication module, and a plurality of processes to be communicated are arranged in the terminal device, and each of the processes to be communicated corresponds to a virtual channel, and the method includes:
[0007] Receiving AT commands sent by each of the processes to be communicated through the corresponding virtual channels;
[0008] Adding the plurality of AT commands to a sending linked list according to a preset sorting rule, and sending the AT commands in the sending linked list to the communication module in sequence;
[0009] The communication module processes the received AT command.
[0010] In an optional implementation, the sorting rule includes a priority order and a receiving time order, and the terminal device stores the priority of each of the processes to be communicated; the adding of the plurality of AT instructions to a sending linked list according to the preset sorting rule, and sequentially sending the AT instructions in the sending linked list to the communication module includes:
[0011] Determine the priority of each of the AT commands according to the priority of each of the processes to be communicated, and add each of the AT commands to the sending linked list according to the priority of each of the AT commands;
[0012] If the AT command has the same priority as other AT commands in the sending chain list, the AT command is added to the sending chain list according to the order of the receiving time of the AT commands.
[0013] In an optional implementation manner, each of the AT instructions is provided with a channel identifier of a corresponding virtual channel, and the method further includes:
[0014] The communication module obtains the operation information corresponding to the AT command, and determines whether the AT command has been completed;
[0015] If the AT command is completed, the communication module adds a channel identifier and an end identifier corresponding to the AT command to the operation information, and sends the operation information to the terminal device;
[0016] If the AT command has not been completed, the communication module adds a channel identifier corresponding to the AT command to the operation information, and sends the operation information to the terminal device.
[0017] In an optional embodiment, the method further comprises:
[0018] Receive the operation information sent by the communication module, and add the operation information to the receiving linked list according to the sorting rule;
[0019] Determine the virtual channel corresponding to the operation information according to the channel identifier corresponding to each operation information in the receiving linked list in turn, and send the operation information to the corresponding process to be communicated through the virtual channel, so that the process to be communicated determines whether there is an end identifier in the operation information, and stops obtaining the operation information if there is an end identifier in the operation information.
[0020] In an optional embodiment, the method further comprises:
[0021] In case of receiving the registration parameters sent by the process, generating a corresponding virtual channel for the process, and determining the priority of the process according to a preset priority determination condition and the registration parameters;
[0022] The process identifier of the process is added to a preset process management table to determine the process as a process to be communicated.
[0023] In an optional embodiment, the method further comprises:
[0024] When the loading completion information sent by the communication module is received, a channel available signal is sent to all the processes to be communicated according to the process management table, so that each of the processes to be communicated sends an AT instruction through the corresponding virtual channel.
[0025] In a second aspect, the present application provides an AT command processing device, which is applied to a terminal device, wherein the terminal device includes a communication module, and a plurality of processes to be communicated are arranged in the terminal device, and each of the processes to be communicated corresponds to a virtual channel, and the device includes:
[0026] A receiving module, used for receiving AT commands sent by each of the processes to be communicated through the corresponding virtual channel;
[0027] A sending module, used for adding the plurality of AT commands to a sending linked list according to a preset sorting rule, and sending the AT commands in the sending linked list to the communication module in sequence;
[0028] The running module is used to process the received AT command.
[0029] In an optional implementation, the sorting rule includes a priority order and a receiving time order, and the priority of each of the processes to be communicated is stored in the terminal device;
[0030] The sending module is further used to determine the priority of each of the AT instructions according to the priority of each of the processes to be communicated, and add each of the AT instructions to the sending linked list according to the priority of each of the AT instructions; if the AT instruction has the same priority as other AT instructions in the sending linked list, then add the AT instruction to the sending linked list according to the order of receiving time of the AT instructions.
[0031] In a third aspect, the present application provides a terminal device, including a processor and a memory, wherein the memory stores a computer program that can be executed by the processor, and the processor can execute the computer program to implement any of the methods described in the aforementioned implementation methods.
[0032] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements a method as described in any of the foregoing embodiments.
[0033] The AT command processing method, device, terminal device and storage medium provided by the embodiment of the present application, the terminal device is provided with a communication module, and at the same time, a plurality of processes to be communicated are also provided in the terminal device, each process to be communicated corresponds to a virtual channel, then the terminal device can receive the AT command sent by each process to be communicated through the corresponding virtual channel, and then add the plurality of AT commands to the sending linked list according to the preset sorting rule, and send the AT commands in the sending linked list to the communication module in sequence, and the communication module can run the received AT command. Through this method, the process to be communicated can send AT commands in parallel, and the terminal device can directly send the received plurality of commands to the corresponding communication module in sequence, without waiting for the operation information of the communication module, so that the waiting time between processes can be reduced, and the sending performance and sending efficiency of the AT command of each process can be improved.
[0034] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0036] Figure 1 A block diagram of a terminal device provided in an embodiment of the present application is shown;
[0037] Figure 2 A schematic diagram of a flow chart of an AT command processing method provided in an embodiment of the present application is shown;
[0038] Figure 3 Another schematic diagram of a flow chart of an AT command processing method provided in an embodiment of the present application is shown;
[0039] Figure 4 A functional module diagram of an AT command processing device provided in an embodiment of the present application is shown.
[0040] Icon: 10 - terminal device; 100 - memory; 110 - processor; 120 - communication module; 300 - receiving module; 310 - sending module; 320 - operation module. DETAILED DESCRIPTION
[0041] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. The components of the embodiments of the present application described and shown in the drawings here can be arranged and designed in various different configurations.
[0042] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for which protection is sought, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.
[0043] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants 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, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0044] With the rapid development of network communications, various types of communication modules emerge in an endless stream, such as WIFI (Wireless Fidelity) modules, 4 / 5G modules, GPRS (General Packet Radio Services) modules, etc.
[0045] At present, the network communication module is generally controlled by converting the hardware interface to the serial port, and the AT command is the key to realize this control method. This command language adopts the standard serial port method, which greatly simplifies the module control. It can be realized by simple serial port programming and has comprehensive functions. Through a set of commands, the module's call, SMS, phone book, data service, fax and other controls can be realized.
[0046] In the prior art, a process can send AT commands to a communication module through an AT channel, and the communication module can often return corresponding operation information based on the received AT commands. Currently, the use of AT channels is generally restricted by locking. When a process uses an AT channel, it can apply for a mutex to protect resources. At this time, other processes cannot use the AT channel and can only wait for the process using the AT channel to release the mutex after receiving the operation information before other processes can use the channel.
[0047] In this case, AT instructions follow a one-receive-one-send mode, that is, after one process sends an AT instruction to the communication module and receives the running information, another process can send an AT instruction to the communication module. Therefore, there is a reception wait between the processes, and the AT instruction processing performance of each process is poor, and the sending efficiency is low; at the same time, two programs based on different programming logics cannot use the same set of locking protection logic.
[0048] Based on this, the embodiment of the present application provides an AT command processing method to solve the above problems. Specifically, Figure 1 1 is a block diagram of a terminal device 10, which includes a memory 100, a processor 110, and a communication module 120. The memory 100, the processor 110, and the communication module 120 are electrically connected to each other directly or indirectly to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0049] The memory 100 is used to store programs or data. The memory 100 may be, but is not limited to, a random access memory (RAM), a read only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), etc.
[0050] The processor 110 is used to read / write data or programs stored in the memory and execute corresponding functions.
[0051] The communication module 120 is used to establish a communication connection between the server and other communication terminals through the network, and to send and receive data through the network.
[0052] It should be understood that Figure 1The structure shown is only a schematic diagram of the terminal device. The terminal device may also include Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown. Figure 1 Each component shown in the figure can be implemented by hardware, software or a combination thereof.
[0053] Optionally, the terminal device 10 is also provided with a communication module and a channel management module, wherein the channel management module can send AT instructions of each process to the communication module through the AT channel, and receive operation information sent by the communication module.
[0054] Optionally, the terminal device 10 is also provided with a plurality of processes to be communicated, and each process to be communicated corresponds to a virtual channel, and each process to be communicated can be connected to the channel management module through the corresponding virtual channel. It can be understood that each process to be communicated can send the generated AT instructions to the channel management module on the terminal device through the corresponding virtual channel.
[0055] Optionally, the channel management module is used to manage the virtual channels corresponding to each process to be communicated, receive AT commands sent by each process to be communicated, send AT commands to the communication module through the AT channel, receive operation information sent by the communication module, and send operation information to each process to be communicated. Figure 1 The terminal device 10 in the embodiment is the execution subject, and the AT command processing method provided in the embodiment of the present application is introduced as an example in combination with the flowchart. Specifically, Figure 2 A flowchart of the AT command processing method provided in the embodiment of the present application is shown in FIG. Figure 2 , the method comprising:
[0056] Step S20, receiving AT commands sent by each process to be communicated through the corresponding virtual channel.
[0057] Optionally, the process to be communicated refers to a process that has a need to interact with the communication module. The virtual channel can be generated for the process by the channel management module on the terminal device when the process has an interaction need, or can be generated in advance for each process.
[0058] In this embodiment, after generating an AT command, each process to be communicated may send the AT command to the channel management module on the terminal device through the virtual channel.
[0059] Step S21, adding multiple AT commands to a sending linked list according to a preset sorting rule, and sending the AT commands in the sending linked list to the communication module in sequence.
[0060] Optionally, in order to facilitate the channel management module to send each AT command to the communication module, a sending linked list may be set in advance for temporarily storing and sending AT commands.
[0061] Optionally, the preset sorting rule may be pre-set in the channel management module to add the AT command to the sending linked list.
[0062] In this embodiment, the channel management module in the terminal device can add the received AT instructions to the sending list according to the preset sorting rules. At the same time, the channel management module can send the AT instructions in the sending list to the communication module in sequence. It can be understood that in this case, each process to be communicated can send AT instructions to the controller concurrently, and the channel management module can also continuously send AT instructions to the communication module through the AT channel.
[0063] Step S22: the communication module processes the received AT command.
[0064] In this embodiment, after receiving the AT command, the communication module can process the AT command.
[0065] The AT command processing method provided by the embodiment of the present application is that the terminal device is provided with a communication module, and at the same time, a plurality of processes to be communicated are also provided in the terminal device, and each process to be communicated corresponds to a virtual channel, so that the terminal device can receive the AT command sent by each process to be communicated through the corresponding virtual channel, and then add the plurality of AT commands to the sending linked list according to the preset sorting rule, and send the AT commands in the sending linked list to the communication module in sequence, and the communication module can run the received AT commands. Through this method, the processes to be communicated can send AT commands in parallel, and the terminal device can directly send the received plurality of commands to the corresponding communication module in sequence, without waiting for the operation information of the communication module, so that the waiting time between processes can be reduced, and the sending performance and sending efficiency of the AT commands of each process can be improved.
[0066] Optionally, when adding AT commands to the sending list, the terminal device can give priority to the priority of each AT command. If the priorities of the AT commands are the same, the receiving time of the AT commands is referred to. On this basis, the sorting rules include priority order and receiving time order. The priority of each process to be communicated can be stored in advance in the terminal device.
[0067] Specifically, in Figure 2 On the basis of Figure 3 For another flow chart of the AT command processing method provided in the embodiment of the present application, please refer to Figure 3 , the above step S21 can also be implemented by the following steps:
[0068] Step S21-1, determining the priority of each AT command according to the priority of each process to be communicated, and adding each AT command to the sending linked list according to the priority of each AT command;
[0069] Step S21-2: If the AT command has the same priority as other AT commands in the sending chain list, the AT command is added to the sending chain list according to the order of receiving time of the AT command.
[0070] In this embodiment, it can be understood that the priority of each AT command is consistent with the priority of the communication process that generates the AT command. Therefore, the channel management module on the terminal device can determine the priority of each received AT command based on the priority of each communication process stored in advance.
[0071] Optionally, the channel management module may first add the AT instruction to the sending linked list based on the priority order. If an AT instruction with the same priority as the AT instruction already exists in the sending linked list, the AT instruction may be added according to the order of receiving time.
[0072] In a possible implementation manner, an AT command with a higher priority may be arranged before an AT command with a lower priority, and an AT command received earlier may be arranged before an AT command received later.
[0073] Optionally, there are multiple processes in the terminal device, but not every process is a process to be communicated. The channel management module in the terminal device can determine the priority of the process when determining the process as a process to be communicated, and generate a corresponding virtual channel for it.
[0074] Optionally, the channel management module in the terminal device can determine the priority of each process to be communicated in advance according to the parameters of the process to be communicated and store them. In a possible implementation, each process can send registration parameters to the channel management module when there is an interaction demand. Then, when the channel management module receives the registration parameters sent by the process, it can generate a corresponding virtual channel for the process, and determine the priority of the process according to the preset priority determination conditions and registration parameters, and then add the process identifier of the process to the preset process management table to determine the process as the process to be communicated.
[0075] Optionally, the registration parameter refers to the parameter of the process to be communicated, such as the task type, process identifier, task urgency, etc. of the process to be communicated; the priority determination condition may be stored in the terminal device in advance, to indicate how to determine the priority of the process to be communicated based on the registration parameters of the process to be communicated. For example, the priority determination condition may be to determine the priority of the process to be communicated based on the task type of the process, or to determine the priority of the process to be communicated based on the task urgency of the process.
[0076] Optionally, the process management table is used to manage information of the process to be communicated, and may be generated in advance and stored in the terminal device, in which information such as the process identifier, priority, and corresponding virtual channel of the process to be communicated may be recorded.
[0077] In one possible implementation, a process will be registered as a process to be communicated before the communication module is loaded. However, since the communication module has not been loaded at this time, the process to be communicated cannot send AT commands. In this case, the channel management module can send a channel available signal to all processes to be communicated according to the process management table after receiving the loading completion information sent by the communication module, so that each process to be communicated can send AT commands through the corresponding virtual channel.
[0078] It can be understood that the loading completion information is sent by the communication module to the channel management module after the loading is completed, and the channel management module can send a channel available signal to all the processes to be communicated recorded in the process management table in the form of broadcasting.
[0079] In another possible implementation, the process will be registered as a process to be communicated after the communication module is loaded, and the channel management module can directly send loading completion information to the process to be communicated so that the process to be communicated can send an AT command.
[0080] Optionally, the communication module may also be uninstalled. When the communication module is uninstalled, the uninstall information can be sent to the channel management module in advance. Then, when the channel management module receives the uninstall information sent by the communication module, it can send a channel unavailable signal to all processes to be communicated according to the process management table, so that each process to be communicated stops sending AT commands.
[0081] Optionally, considering that the AT channel can only pass one AT command or operation information at the same time, if multiple processes send AT commands to the communication module, there may be a command conflict problem, resulting in the return of misplaced operation information. Therefore, in order to prevent the operation information returned by the communication module from being confused, each AT command can be set with a channel identifier of the corresponding virtual channel. The communication module can add the channel identifier of the corresponding virtual channel to the obtained operation information, so that the channel management module returns the operation information to the corresponding communication process according to the channel identifier.
[0082] In this embodiment, the communication module can obtain operation information during the process of running according to the AT command. It can be understood that for some AT commands, the communication module can only obtain the corresponding operation information when the AT command is completed. For some AT commands, the communication module can obtain the operation information during the AT command execution. On this basis, the communication module may return the operation information multiple times until the AT command is completed.
[0083] However, currently, after receiving the running information of the communication module, the process will stop receiving immediately. Therefore, there will be a problem that the running information of some processes is not completely received. Therefore, in order to ensure that the process to be communicated will not stop receiving before receiving the complete running information, the communication module can also add an end mark to the running information when the AT command is completed, so that the process to be communicated can keep receiving when it determines that the end mark is not added in the running information.
[0084] On this basis, the above method also includes:
[0085] The communication module obtains the running information corresponding to the AT command and determines whether the AT command has been completed; if the AT command has been completed, the communication module adds the channel identifier and the end identifier corresponding to the AT command to the running information, and sends the running information to the terminal device; if the AT command has not been completed, the communication module adds the channel identifier corresponding to the AT command to the running information, and sends the running information to the terminal device.
[0086] Optionally, the operation information is information obtained by the communication module executing an AT command. In one possible implementation, the operation information may be operation parameters, data to be obtained pointed to by the AT command, etc.; in another possible implementation, the operation information may be an execution success mark or an execution failure mark, etc.
[0087] In this embodiment, the communication module can operate according to the received AT command to obtain the operation information. After obtaining the operation information, the communication module can determine whether the AT command has been completed.
[0088] In this embodiment, when the AT command has been executed, the communication module can add the channel identifier of the corresponding virtual channel in the running information, add the end identifier at the same time, and send it to the channel management module; when the AT command has not been executed, only the channel identifier of the corresponding virtual channel is added to the running information, and then it is sent to the channel management module.
[0089] It can be understood that on this basis, the terminal device can receive the operation information sent by the communication module, and add the operation information to the receiving linked list according to the sorting rules; determine the virtual channel corresponding to the operation information according to the channel identifier corresponding to each operation information in the receiving linked list, and send the operation information to the corresponding process to be communicated through the virtual channel, so that the process to be communicated can determine whether there is an end identifier in the operation information, and stop obtaining the operation information if there is an end identifier in the operation information.
[0090] Optionally, when the channel management module receives the operation information sent by the communication module, the channel management module may add the operation information to the receiving linked list according to a preset sorting rule.
[0091] It can be understood that the channel management module can first add the operation information to the receiving linked list based on the priority order. If the receiving linked list already has operation information with the same priority as the operation information, the operation information can be added according to the receiving time order.
[0092] Optionally, the channel management module may sequentially send the operation information in the received linked list to the corresponding process to be communicated through the corresponding virtual channel.
[0093] In this embodiment, since the channel identifier of the corresponding virtual channel is added to the operation information, the channel management module can determine the virtual channel corresponding to the operation information according to the channel identifier, and directly send the operation information to the corresponding process to be communicated through the virtual channel.
[0094] It can be understood that, through this method, the channel management module in the terminal device can accurately send the operation information to the corresponding process to be communicated, thereby avoiding the problem of misplaced return of the operation information.
[0095] Optionally, after receiving the corresponding operation information, the process to be communicated can determine whether there is an end mark in the operation information, so as to determine whether it can stop obtaining the operation information at this time. It can be understood that if the operation information includes an end mark, it can be determined that the operation information is completely obtained, so the reception is stopped; if the operation information does not include an end mark, it can be determined that the operation information is not completely obtained, and some operation information has not been obtained, so the reception will not be stopped, so that the process to be communicated can be guaranteed to receive the complete operation information.
[0096] In order to execute the corresponding steps in the above embodiments and various possible methods, an implementation method of an AT command processing device is given below. Figure 4 , Figure 4This is a functional module diagram of an AT command processing device provided in an embodiment of the present application. It should be noted that the basic principle and technical effects of the AT command processing device provided in this embodiment are the same as those of the above embodiments. For the sake of brief description, for parts not mentioned in this embodiment, reference can be made to the corresponding contents in the above embodiments. The AT command processing device includes: a receiving module 300, a sending module 310 and an operating module 320.
[0097] The receiving module 300 is used to receive AT instructions sent by each communication process through the corresponding virtual channel.
[0098] It can be understood that the receiving module 300 can also be used to execute the above step S20.
[0099] The sending module 310 is used to add multiple AT instructions to the sending linked list according to a preset sorting rule, and send the AT instructions in the sending linked list to the communication module in sequence.
[0100] It can be understood that the sending module 310 can be used to execute the above step S21.
[0101] The operation module 320 is used to process the received AT command.
[0102] It can be understood that the operation module 320 can also be used to execute the above step S22.
[0103] Optionally, the sending module 310 is further used to determine the priority of each AT instruction according to the priority of each process to be communicated, and add each AT instruction to the sending linked list according to the priority of each AT instruction; if the AT instruction has the same priority as other AT instructions in the sending linked list, the AT instruction is added to the sending linked list according to the receiving time sequence of the AT instruction.
[0104] It can be understood that the sending module 310 can be used to execute the above steps S21 - 1 to S21 - 2.
[0105] Optionally, the operation module 320 is also used for the communication module to obtain the operation information corresponding to the AT instruction and determine whether the AT instruction has been completed; if the AT instruction has been completed, the communication module adds the channel identifier and the end identifier corresponding to the AT instruction to the operation information, and sends the operation information to the terminal device; if the AT instruction has not been completed, the communication module adds the channel identifier corresponding to the AT instruction to the operation information, and sends the operation information to the terminal device.
[0106] Optionally, the sending module 310 is also used to receive operation information sent by the communication module, and add the operation information to the receiving linked list according to the sorting rules; determine the virtual channel corresponding to the operation information according to the channel identifier corresponding to each operation information in the receiving linked list, and send the operation information to the corresponding process to be communicated through the virtual channel, so that the process to be communicated determines whether there is an end identifier in the operation information, and stops obtaining the operation information if there is an end identifier in the operation information.
[0107] Optionally, the receiving module 300 is also used to generate a corresponding virtual channel for the process when receiving registration parameters sent by the process, and determine the priority of the process according to preset priority conditions and registration parameters; add the process identifier of the process to a preset process management table to determine the process as a process to be communicated.
[0108] Optionally, the receiving module 300 is further configured to send a channel available signal to all processes to be communicated according to the process management table when receiving the loading completion information sent by the communication module, so that each process to be communicated sends an AT command through the corresponding virtual channel.
[0109] The AT instruction processing device provided in the embodiment of the present application receives the AT instructions sent by each process to be communicated through the corresponding virtual channel through the receiving module; adds multiple AT instructions to the sending list according to the preset sorting rules through the sending module, and sends the AT instructions in the sending list to the communication module in sequence; and runs according to the received AT instructions through the running module. Through this device, the process to be communicated can send AT instructions in parallel, and the terminal device can directly send the received multiple instructions to the corresponding communication module in sequence without waiting for the operation information of the communication module, so the waiting time between processes can be reduced, and the sending performance and sending efficiency of the AT instructions of each process can be improved.
[0110] Optionally, the above modules can be stored in the form of software or firmware. Figure 1 The memory shown in FIG. 1 is stored in the operating system (OS) of the terminal device and can be used by Figure 1 Meanwhile, the data and program codes required for executing the above modules can be stored in the memory.
[0111] Optionally, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the AT command processing method provided in the embodiment of the present application can be implemented.
[0112] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.
[0113] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
[0114] If the functions are implemented in the form of software function modules 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 application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0115] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for processing an AT command, characterized in that: Applied to a terminal device, the terminal device includes a communication module, a plurality of processes to be communicated are arranged in the terminal device, and each of the processes to be communicated corresponds to a virtual channel, the method includes: Receiving AT commands sent by each of the processes to be communicated through the corresponding virtual channels; Adding the plurality of AT commands to a sending linked list according to a preset sorting rule, and sending the AT commands in the sending linked list to the communication module in sequence; The communication module processes the received AT command; each of the AT commands is provided with a channel identifier of a corresponding virtual channel; The communication module obtains the operation information corresponding to the AT command, and determines whether the AT command has been completed; If the AT command is completed, the communication module adds a channel identifier and an end identifier corresponding to the AT command to the operation information, and sends the operation information to the terminal device; If the AT command has not been completed, the communication module adds the channel identifier corresponding to the AT command in the operation information and sends the operation information to the terminal device, so that the communication process corresponding to the AT command maintains the receiving state when it determines that no end identifier is added in the operation information.
2. The method according to claim 1, characterized in that The sorting rules include a priority order and a receiving time order, and the terminal device stores the priority of each of the processes to be communicated; the adding of the plurality of AT instructions to a sending linked list according to the preset sorting rules, and sequentially sending the AT instructions in the sending linked list to the communication module, includes: Determine the priority of each of the AT commands according to the priority of each of the processes to be communicated, and add each of the AT commands to the sending linked list according to the priority of each of the AT commands; If the AT command has the same priority as other AT commands in the sending chain list, the AT command is added to the sending chain list according to the order of the receiving time of the AT commands.
3. The method according to claim 1, characterized in that: The method further comprises: Receive the operation information sent by the communication module, and add the operation information to the receiving linked list according to the sorting rule; Determine the virtual channel corresponding to the operation information according to the channel identifier corresponding to each operation information in the receiving linked list in turn, and send the operation information to the corresponding process to be communicated through the virtual channel, so that the process to be communicated determines whether there is an end identifier in the operation information, and stops obtaining the operation information if there is an end identifier in the operation information.
4. The method according to claim 1, characterized in that: The method further comprises: In case of receiving the registration parameters sent by the process, generating a corresponding virtual channel for the process, and determining the priority of the process according to a preset priority determination condition and the registration parameters; The process identifier of the process is added to a preset process management table to determine the process as a process to be communicated.
5. The method according to claim 4, characterized in that The method further comprises: When the loading completion information sent by the communication module is received, a channel available signal is sent to all the processes to be communicated according to the process management table, so that each of the processes to be communicated sends an AT instruction through the corresponding virtual channel.
6. An AT command processing device, characterized in that: Applied to a terminal device, the terminal device includes a communication module, a plurality of processes to be communicated are arranged in the terminal device, and each of the processes to be communicated corresponds to a virtual channel, the device includes: A receiving module, used for receiving AT commands sent by each of the processes to be communicated through the corresponding virtual channel; A sending module, used for adding the plurality of AT commands to a sending linked list according to a preset sorting rule, and sending the AT commands in the sending linked list to the communication module in sequence; An operation module, used for processing the received AT command; each of the AT commands is provided with a channel identifier of a corresponding virtual channel; The operation module is further used to obtain the operation information corresponding to the AT instruction and determine whether the AT instruction has been completed; if the AT instruction has been completed, the communication module adds the channel identifier and the end identifier corresponding to the AT instruction in the operation information, and sends the operation information to the terminal device; if the AT instruction has not been completed, the communication module adds the channel identifier corresponding to the AT instruction in the operation information, and sends the operation information to the terminal device, so that the communication process corresponding to the AT instruction maintains a receiving state when it is determined that the end identifier is not added in the operation information.
7. The device according to claim 6, characterized in that The sorting rules include priority order and receiving time order, and the priority of each of the processes to be communicated is stored in the terminal device; The sending module is further used to determine the priority of each of the AT commands according to the priority of each of the processes to be communicated, and to add each of the AT commands to the sending linked list according to the priority of each of the AT commands; If the AT command has the same priority as other AT commands in the sending chain list, the AT command is added to the sending chain list according to the order of the receiving time of the AT commands.
8. A terminal device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program executable by the processor, and the processor can execute the computer program to implement the method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
