CN113254367A - iAP1 protocol-based command processing method, electronic device and storage medium - Google Patents

iAP1 protocol-based command processing method, electronic device and storage medium Download PDF

Info

Publication number
CN113254367A
CN113254367A CN202010086570.2A CN202010086570A CN113254367A CN 113254367 A CN113254367 A CN 113254367A CN 202010086570 A CN202010086570 A CN 202010086570A CN 113254367 A CN113254367 A CN 113254367A
Authority
CN
China
Prior art keywords
command
identification information
uniquely associated
transaction
reply
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.)
Granted
Application number
CN202010086570.2A
Other languages
Chinese (zh)
Other versions
CN113254367B (en
Inventor
陈骁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hefei Jiefa Technology Co ltd
Original Assignee
Hefei Jiefa Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Hefei Jiefa Technology Co ltd filed Critical Hefei Jiefa Technology Co ltd
Priority to CN202010086570.2A priority Critical patent/CN113254367B/en
Publication of CN113254367A publication Critical patent/CN113254367A/en
Application granted granted Critical
Publication of CN113254367B publication Critical patent/CN113254367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/10Program control for peripheral devices
    • G06F13/102Program control for peripheral devices where the programme performs an interfacing function, e.g. device driver

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application discloses a command processing method based on an iAP1 protocol, an electronic device and a storage medium, wherein the method comprises the following steps: creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command. Through the mode, the parallel command transmission of a plurality of threads can be realized.

Description

iAP1 protocol-based command processing method, electronic device and storage medium
Technical Field
The present application relates to the field of electronic device control processing technologies, and in particular, to a command processing method based on an iAP1 protocol, an electronic device, and a storage medium.
Background
The iAP1 protocol is a protocol used for command transmission between a device of a non-IOS system (hereinafter referred to as a first device) and a device of an IOS system (hereinafter referred to as a second device). Since each command sent by the first device in the iAP1 protocol requires the second device to reply to the command execution, when synchronous sending of a certain command is implemented, the command needs to be sent first, and then a reply corresponding to the command needs to be waited.
In the prior art, each sent command adopts the same condition variable, when multiple threads send commands simultaneously, after the first device receives the reply of the second device, because the commands sent by all the threads use the same condition variable, the receipt of any reply triggers all the threads waiting for the reply. In order to solve the problem, the prior art adopts a mode of transmitting only one command at a time and waiting for reply, and obviously, the mode has low efficiency.
Disclosure of Invention
In order to solve the above problems, the present application provides a command processing method, an electronic device, and a storage medium based on the iAP1 protocol, which can implement transmission of commands in parallel by multiple threads.
The technical scheme adopted by the application is as follows: a command transmission method based on an iAP1 protocol is provided, and the method comprises the following steps: creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command.
Another technical scheme adopted by the application is as follows: there is provided an electronic device based on the iAP1 protocol, the electronic device comprising an interconnected processor and memory for storing program data, the processor being arranged to execute the program data to implement the method as described above.
Another technical scheme adopted by the application is as follows: there is provided a computer readable storage medium having stored therein program data for implementing the method as described above when executed by a processor.
The command processing method based on the iAP1 protocol comprises the following steps: creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command. Through the mode, each issued command has one unique condition variable, and when the commands are sent by the multiple threads, the condition variables of the multiple commands are different, so that the multiple threads cannot respond when replies are received, and therefore the parallel command transmission of the multiple threads can be realized through the embodiment.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts. Wherein:
FIG. 1 is a diagram of the iAP1command class provided herein;
FIG. 2 is a schematic flow chart diagram illustrating a first embodiment of a command processing method provided in the present application;
FIG. 3 is a flowchart illustrating a second embodiment of a command processing method according to the present application;
FIG. 4 is a flowchart illustrating a third exemplary embodiment of a command processing method according to the present application;
FIG. 5 is a flowchart illustrating a fourth embodiment of a command processing method according to the present application;
FIG. 6 is a flowchart illustrating a fifth embodiment of a command processing method according to the present application;
FIG. 7 is a flowchart illustrating a sixth exemplary embodiment of a command processing method according to the present application;
FIG. 8 is a schematic structural diagram of an embodiment of an electronic device provided in the present application;
FIG. 9 is a schematic structural diagram of an embodiment of a computer-readable storage medium provided in the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The terms "first", "second", etc. in this application are used to distinguish between different objects and not to describe a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The iAP1 protocol includes two command/reply mapping methods:
1. transaction ID mode: when sending the command, the packet of each command carries a unique and dynamically generated 16-bit Transaction ID, and the corresponding reply command also carries the same Transaction ID to indicate that the reply corresponds to the command. The Transaction ID is generated by generating a random number as the Transaction ID of the first iAP1command sent by both parties, and then every time a new command is sent, the Transaction ID is the value of the previous command plus 1.
2. A fixed mode: when the Transaction ID is not supported, only the fixed command and reply mode can be adopted. For example, if a PlayControl command is sent, only an ipodcack can be replied; sending GetShuffle will only reply to Return Shuffle or iPodkack (bad parameter), i.e. directly use the fixed number of the command as ID.
The two modes differ in that: the mapping (one-to-one correspondence) of the command in the fixed mode and the replied ID is preset, and the reply corresponding to the command is directly found through the ID during calling; the command ID of the Transaction ID mode is set at the time of transmission, and when a command is received, the command ID is given to the reply ID.
The iAP1command class diagram designed by the present application for the above scenario is shown in fig. 1.
iAP1 accerrequest defines the relevant interface and its implementation for an access (non-IOS Device) to send commands and reply to commands from a Device (IOS Device). I.e., the class is used for access to send iAP1 commands and provides the function of isochronous sending (send and wait for a reply and return).
The iAP1 accessonse defines the relevant interface and its implementation for the access to listen for commands from Device. I.e. this class is used to receive commands from Device but not replies to commands sent by access, such replies being handled by iAP1 accerrequest.
The iAP1AccRequest and the iAP1AccResponse are both used in the fixed command/reply mode, and the iAP1 CommanddTID is used in the mode of supporting the Transaction ID. The iAP1 CommanddTID realizes the interfaces defined by the iAP1AccRequest and the iAP1AccResponse, and matches the sent and received packets according to the requirement of the Transaction ID.
The iAP1Command is responsible for deciding which way to send commands to use. Is a proxy for the iAP1AccRequest/iAP1AccResponse and iAP1CommandtID objects. This type can determine which type of command transmission method is used according to the transmitted and received commands, and can switch the transmission method internally, thereby simplifying the command processing procedure of the upper layer.
By using the design, the upper layer application only needs one iAP1Command object, and can use the corresponding Command sending mode according to the protocol specification without additionally increasing operation.
Referring to fig. 2, fig. 2 is a schematic flowchart of a first embodiment of a command processing method provided in the present application, where the method includes:
step 21: a condition variable uniquely associated with each of the plurality of first commands, respectively, is created based on the transmitted plurality of first commands.
The condition variable is a mechanism for synchronization by using a global variable shared among threads, and mainly comprises two actions: a thread waits for the condition of the condition variable to be established and hangs; the other thread makes a "condition hold" (gives a condition hold signal).
It is to be understood that the plurality of first commands may be sent sequentially in a time sequence, or may be sent simultaneously, which is not limited herein.
In an alternative embodiment, the first command may be sent first, and then the condition variable uniquely associated with the first command is created based on the sent first command; in another embodiment, the condition variable uniquely associated with the first command may be created based on the first command to be sent, and then the first command may be sent.
In this step, the non-IOS device sends the command to the IOS device.
Step 22: upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command.
Specifically, upon receiving a first reply replying to the first command, the condition variable uniquely associated with the first command is unregistered.
It can be understood that, in the above manner, when a plurality of commands are transmitted simultaneously, condition variables respectively associated with the plurality of commands in one-to-one correspondence can be created based on the transmitted plurality of commands; upon receiving a reply replying to a first command of the plurality of commands, completing a condition variable uniquely associated with the first command.
Different from the prior art, the command processing method based on the iAP1 protocol provided by the embodiment includes: creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command. Through the mode, each issued command has one unique condition variable, and when the commands are sent by the multiple threads, the condition variables of the multiple commands are different, so that the multiple threads cannot respond when replies are received, and therefore the parallel command transmission of the multiple threads can be realized through the embodiment.
Referring further to fig. 3, fig. 3 is a schematic flowchart of a second embodiment of a command processing method provided in the present application, where the method includes:
step 31: and acquiring a first Lingo value and a first Command value of the first Command.
The first command is a command to be sent or sent.
Lingo and Command are concepts in the iAP1 protocol. Lingo is a number of 1B and Command is a number of 1B or 2B, which together determine an iAP1Command type.
Step 32: and combining the first Lingo value and the first Command value to obtain first identification information uniquely associated with the first Command.
Alternatively, an ID (identification information) of 32b is composed using the Lingo and Command values of the Command. For example, when a packet corresponding to the PlayControl Command is transmitted through the interface, if Lingo of the PlayControl Command is 4 and Command is 0x0029, the ID corresponding to the Command is 0x 00040029.
Step 33: and associating and storing the callback function for processing the first reply with the first identification information.
Step 34: a condition variable uniquely associated with the first identification information is created based on the first identification information.
The condition variable is generally created by using a synchronization mechanism provided by an operating system, and a general process is that one thread (thread a) waits for the condition variable to be completed, another thread (thread B) is used for detecting whether the condition is completed, if the condition is completed, the thread B actively triggers the condition variable, and at this time, the thread a exits from waiting and continues subsequent operations.
After step 34, the condition variables wait for the condition to complete, and after the condition variables are completed, the corresponding condition variables and callback functions are deleted.
With reference to fig. 4, fig. 4 is a schematic flowchart of a third embodiment of a command processing method provided in the present application, where the method includes:
step 41: and when the Command to be processed is received, acquiring a second Lingo value and a second Command value of the Command to be processed.
Step 42: and combining the second Lingo value and the second Command value to obtain second identification information uniquely associated with the Command to be processed.
Step 43: and searching the associated callback function according to the second identification information, and processing the first callback by adopting the associated callback function.
Step 44: upon receiving a first reply replying to the first command, completing a condition variable uniquely associated with the first command.
Understandably, the embodiments of FIGS. 2-4 described above are applicable to the iAP1AccRequest command class.
In conjunction with fig. 3 and 4, the entire process may include:
1) when the first device sends an iAP1packet (packet is an actual data packet for passing the iAP1 command) through the send interface of the iAP1AccRequest, the send interface creates a unique ID (identification information) for each iAP1packet to be sent.
2) And pairing and storing the callback function used for processing the reply of the command and the ID obtained in the step 1).
3) The command is sent.
4) Creating a unique condition variable according to the ID obtained in the step 1), and waiting for the completion of the condition variable.
5) When receiving the iAP1packet from the second device, finding the ID of the Command corresponding to the iAP1packet according to the Lingo and the Command of the iAP1 packet.
6) Finding the callback function corresponding to the ID obtained in the step 5), and calling the callback function to process the returned command.
7) Finding the condition variable corresponding to the ID obtained in the step 5), finishing the condition, and deleting the callback function and the condition variable corresponding to the ID.
8) At this time, 5) the sender waiting for the condition completes the transmission flow.
Referring to fig. 5, fig. 5 is a schematic flowchart of a fourth embodiment of a command processing method provided in the present application, where the method includes:
step 51: and creating third identification information uniquely associated with the second command based on the second command to be listened to.
Optionally, in this step, a third Lingo value and a third Command value of the second Command to be monitored may be obtained; and combining the third Lingo value and the third Command value to obtain third identification information uniquely associated with the second Command.
Step 52: and associating and storing the callback function for processing the second command with the third identification information.
Step 53: and processing the second command by utilizing the callback function associated with the third identification information when the second command is received.
Optionally, in an embodiment, step 53 may specifically include:
step 531: and when the Command to be processed is received, acquiring a fourth Lingo value and a fourth Command value of the Command to be processed.
Step 532: and combining the fourth Lingo value and the fourth Command value to obtain fourth identification information uniquely associated with the Command to be processed.
Step 533: and processing the second command by using the callback function associated with the third identification information when the fourth identification signal and the third identification information are the same.
In conjunction with fig. 5, the entire process may include:
1) before beginning to listen for commands from the second device, the commands to be listened to are registered through the addListener interface, which needs to pass callback functions and Lingo and Command to listen for commands.
2) The addListener interface creates a unique ID according to the Lingo and the Command and stores the unique ID together with the callback function.
3) And when a Command from the second equipment is received, creating an ID according to the Lingo and the Command of the received packet, and matching the stored ID and the callback function to find the corresponding callback function.
4) Calling the callback function found in the step 3), and deleting the callback function and the corresponding ID after the execution of the callback function is completed.
Understandably, the embodiment of FIG. 5 described above is applicable to the iAP1AccResponse command class.
Referring to fig. 6, fig. 6 is a schematic flowchart of a fifth embodiment of a command processing method provided in the present application, where the method includes:
step 61: when the first command is a command sent for the first time, taking a preset Transaction ID as the Transaction ID of the first command and as first identification information uniquely associated with the first command; or when the first command is not the first-time sent command, the Transaction ID used last time is added with 1 to be used as the Transaction ID of the first command and used as the first identification information uniquely associated with the first command; or when the first command is used for replying to the received target command, taking the Transaction ID of the target command as the Transaction ID of the first command and as the first identification information uniquely associated with the first command.
The first command is a command to be sent or sent.
Step 62: and associating and storing the callback function for processing the first reply with the first identification information.
And step 63: a condition variable uniquely associated with the first identification information is created based on the first identification information.
After step 63, the condition variable waits for the condition to be completed, and after the condition variable is completed, the corresponding condition variable and callback function are deleted.
Specifically, when the reply to be processed is received, the Transaction ID of the reply to be processed is acquired as the second identification information of the reply to be processed; the condition variable uniquely associated with the first command is completed when the second identification signal and the first identification information are the same.
In conjunction with fig. 6, the entire process may include:
1) when a sender sends an iAP1packet through a send interface of an iAP1CommandTID, if the packet is the packet of a command sent by an Access, using the last Access Transaction ID +1 as the ID of the command; if it is a command to reply Device, the Transaction ID used by the corresponding Device packet is used as the ID of the command.
2) And pairing and storing the callback function used for processing the reply of the command and the ID obtained in the step 1).
3) The command is sent.
4) Creating a unique condition variable according to the ID obtained in the step 1), and waiting for the completion of the condition variable.
5) When the iAP1packet from Device is received, its Transaction ID is parsed from the packet.
6) Finding the callback function corresponding to the ID obtained in the step 5), and calling the callback function to process the returned command.
7) Finding the condition variable corresponding to the ID obtained in the step 5), and completing the condition.
8) At this time, 5) the sender waiting for the condition completes the transmission flow.
Referring to fig. 7, fig. 7 is a schematic flowchart of a sixth embodiment of a command processing method provided in the present application, where the method includes:
step 71: and associating and storing the Transaction ID of the third command to be monitored and a callback function for processing the third command.
Step 72: upon receiving the third command, the third command is processed using the callback function associated with the Transaction ID of the third command.
Optionally, in an embodiment, step 72 may specifically be: when a command to be processed is received, acquiring a Transaction ID of the command to be processed; and processing the command to be processed by utilizing a callback function associated with the Transaction ID of the third command when the Transaction ID of the command to be processed is the same as the Transaction ID of the third command.
In conjunction with fig. 7, the overall process may include:
1) before beginning to listen for commands from the second device, the commands to listen are registered via the addListener interface, which needs to pass the callback function and the Transaction ID of the command to listen.
2) The addListener interface saves the Transaction ID along with the callback function.
3) When a command from the second device is received, the Transaction ID of the received packet is saved.
4) And matching the saved Transaction ID and the callback function to find the corresponding callback function.
5) Calling the callback function found in the step 4), and deleting the corresponding Transaction ID and the callback function after the execution of the callback function is completed.
Understandably, the embodiments of FIGS. 6-7 described above are applicable to the iAP1 CommandTdID command class.
In the above flow, since the iAP1AccRequest and its derivative iAP1CommandTID generate the unique waiting condition according to the specific command sent when sending the iAP1packet, and match the waiting condition according to the reply command type after receiving the reply from the iPod, the above design can satisfy the purpose of multithreading simultaneously sending commands and waiting for replies without interfering with each other.
Meanwhile, the command sending/receiving process of the iAP1CommandTID is matched through the Transaction ID, and the requirement of the iAP1 protocol is met.
The iAP1Command is a proxy object that is iAP1AccRequest/iAP1AccResponse and iAP1 CommandtID. That is, the send interface function of the iAP1Command is actually realized by calling send of the iAP1AccRequest or the iAP1Command, and similar relationships exist among other interfaces with the same name.
in addition to serving as proxies for iAP1AccRequest/iAP1AccResponse and iAP1CommandTID, the iAP1Command must manage the objects iAP1AccRequest/iAP1AccResponse and iAP1CommandTID and switch between these three objects under prescribed conditions as required by the iAP1 protocol.
Since the handover condition involves the iAP1 protocol, it is not described in detail here, but it is possible that the process occurs before some specific command is sent, or after some specific command is received. The switching process is as follows:
1) the upper layer is prevented from continuously using the iAP1AccRequest/iAP1AccResponse or iAP1CommandTID object by calling the send or addListener and other interfaces;
2) if the current upper layer is waiting for the reply of some command, informing the upper layer to stop waiting;
3) performing a switching action, namely switching the iAP1AccRequest/iAP1AccResponse object to the iAP1 CommandTdID object, or switching the iAP1 CommandTdID object to the iAP1AccRequest/iAP1AccResponse object;
4) and opening interfaces such as send and the like, so that the upper layer can continuously call the interface of the iAP1 Command.
With the above embodiments, the present application has the following beneficial effects:
1. because a separate synchronization variable is used for each iAP1command, each synchronization variable can be triggered independently without affecting the other synchronization variables.
2. Because two methods for generating ID are used, in the fixed Command/reply mode, the iAP1Lingo and the Command are used for matching the Command and the reply, and in the Transaction ID mode, the Transaction ID in the iAP1packet is used for matching the Command and the reply. This flow conforms to the requirements of the iAP1 protocol.
3. Because the two modes use the same interface, the polymorphic characteristic of the programming language can be used at the moment, and the switching can be conveniently carried out before the two modes, so that the corresponding sending mode can be selected at a proper time according to the protocol requirement, and the interface for the upper layer is simplified.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an embodiment of an electronic device 80 provided in the present application, where the electronic device 80 includes a processor 81 and a memory 82 connected to each other, the memory 82 is used for storing program data, and the processor 81 is used for executing the program data to implement the following methods:
creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command.
The electronic device may be a device of a non-IOS system, specifically, a mobile phone, a tablet computer, and a wearable device, and the wearable device may be an earphone, smart glasses, or the like.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a computer-readable storage medium 90 provided in the present application, in which program data 91 is stored, and when the program data 91 is executed by a processor, the following method is implemented:
creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands; upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with each first command.
Optionally, in an embodiment, the processor is further configured to perform: creating first identification information uniquely associated with a first command based on the first command to be transmitted; a condition variable uniquely associated with the first identification information is created based on the first identification information.
Optionally, in an embodiment, the processor is further configured to perform: acquiring a first Lingo value and a first Command value of a first Command; and combining the first Lingo value and the first Command value to obtain first identification information uniquely associated with the first Command.
Optionally, in an embodiment, the processor is further configured to perform: when the reply to be processed is received, acquiring a second Lingo value and a second Command value of the reply to be processed; combining the second Lingo value and the second Command value to obtain second identification information uniquely associated with the reply to be processed; the condition variable uniquely associated with the first command is completed when the second identification signal and the first identification information are the same.
Optionally, in an embodiment, the processor is further configured to perform: associating and storing a callback function for processing the first reply with the first identification information; upon receiving a first reply replying to the first command, the first reply is processed utilizing a callback function associated with the first identification information.
Optionally, in an embodiment, the processor is further configured to perform: when the first command is a command sent for the first time, taking a preset Transaction ID as the Transaction ID of the first command and as first identification information uniquely associated with the first command; or when the first command is not the first-time sent command, the Transaction ID used last time is added with 1 to be used as the Transaction ID of the first command and used as the first identification information uniquely associated with the first command; or when the first command is used for replying to the received target command, taking the Transaction ID of the target command as the Transaction ID of the first command and as the first identification information uniquely associated with the first command.
Optionally, in an embodiment, the processor is further configured to perform: when receiving the reply to be processed, acquiring the Transaction ID of the reply to be processed as second identification information of the reply to be processed; the condition variable uniquely associated with the first command is completed when the second identification signal and the first identification information are the same.
Optionally, in an embodiment, the processor is further configured to perform: creating third identification information uniquely associated with the second command based on the second command to be monitored; associating and storing a callback function for processing the second command with the third identification information; and processing the second command by utilizing the callback function associated with the third identification information when the second command is received.
Optionally, in an embodiment, the processor is further configured to perform: acquiring a third Lingo value and a third Command value of a second Command to be monitored; and combining the third Lingo value and the third Command value to obtain third identification information uniquely associated with the second Command.
Optionally, in an embodiment, the processor is further configured to perform: when a Command to be processed is received, acquiring a fourth Lingo value and a fourth Command value of the Command to be processed; combining the fourth Lingo value and the fourth Command value to obtain fourth identification information uniquely associated with the Command to be processed; and processing the second command by using the callback function associated with the third identification information when the fourth identification signal and the third identification information are the same.
Optionally, in an embodiment, the processor is further configured to perform: associating and storing the Transaction ID of the third command to be monitored and a callback function for processing the third command; upon receiving the third command, the third command is processed using the callback function associated with the Transaction ID of the third command.
Optionally, in an embodiment, the processor is further configured to perform: when a command to be processed is received, acquiring a Transaction ID of the command to be processed; and processing the command to be processed by utilizing a callback function associated with the Transaction ID of the third command when the Transaction ID of the command to be processed is the same as the Transaction ID of the third command.
Optionally, in an embodiment, the processor is further configured to perform: creating condition variables respectively associated with the plurality of commands in a one-to-one correspondence manner based on the transmitted plurality of commands; upon receiving a reply replying to a first command of the plurality of commands, completing a condition variable uniquely associated with the first command.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the above-described device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The above description is only for the purpose of illustrating embodiments of the present application and is not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made according to the content of the present specification and the accompanying drawings, or which are directly or indirectly applied to other related technical fields, are also included in the scope of the present application.

Claims (14)

1. A command processing method based on an iAP1 protocol, the method comprising:
creating a condition variable uniquely associated with each of the plurality of first commands, respectively, based on the transmitted plurality of first commands;
upon receiving a first reply replying to each first command of the plurality of commands, completing a condition variable uniquely associated with said each first command.
2. The method of claim 1,
the creating, based on the transmitted plurality of first commands, a condition variable respectively uniquely associated with each of the plurality of first commands, includes:
creating first identification information uniquely associated with a first command based on the transmitted first command;
creating a condition variable uniquely associated with the first identification information based on the first identification information.
3. The method of claim 2,
the creating of first identification information uniquely associated with the first command based on the transmitted first command includes:
acquiring a first Lingo value and a first Command value of the first Command;
and combining the first Lingo value and the first Command value to obtain first identification information uniquely associated with the first Command.
4. The method of claim 3,
said completing, upon receiving a first reply replying to each first command of said plurality of commands, a condition variable uniquely associated with said each first command, comprising:
when a reply to be processed is received, acquiring a second Lingo value and a second Command value of the reply to be processed;
combining the second Lingo value and the second Command value to obtain second identification information uniquely associated with the reply to be processed;
completing a condition variable uniquely associated with the first command when the second identification signal and the first identification information are the same.
5. The method of claim 2,
the method further comprises the following steps:
associating and storing a callback function for processing the first reply with the first identification information;
processing the first reply with a callback function associated with the first identification information upon receiving the first reply to the first command.
6. The method of claim 2,
the creating of first identification information uniquely associated with the first command based on the transmitted first command includes:
when the first command is a command sent for the first time, taking a preset Transaction ID as the Transaction ID of the first command and as first identification information uniquely associated with the first command; or
When the first command is not a command sent for the first time, adding 1 to the Transaction ID used for the last time to be used as the Transaction ID of the first command and being used as first identification information uniquely associated with the first command; or
And when the first command is used for replying to the received target command, taking the Transaction ID of the target command as the Transaction ID of the first command and as first identification information uniquely associated with the first command.
7. The method of claim 6,
said completing, upon receiving a first reply replying to each first command of said plurality of commands, a condition variable uniquely associated with said each first command, comprising:
when a reply to be processed is received, acquiring the Transaction ID of the reply to be processed as second identification information of the reply to be processed;
completing a condition variable uniquely associated with the first command when the second identification signal and the first identification information are the same.
8. The method of claim 1,
the method further comprises the following steps:
creating third identification information uniquely associated with a second command to be monitored based on the second command;
associating and storing a callback function for processing the second command with the third identification information;
processing the second command using a callback function associated with the third identification information upon receiving the second command.
9. The method of claim 8,
the creating of third identification information uniquely associated with the second command based on the second command to be listened to includes:
acquiring a third Lingo value and a third Command value of a second Command to be monitored;
and combining the third Lingo value and the third Command value to obtain third identification information uniquely associated with the second Command.
10. The method of claim 9,
processing the second command by using the callback function associated with the third identification information when the second command is received, including:
when a Command to be processed is received, acquiring a fourth Lingo value and a fourth Command value of the Command to be processed;
combining the fourth Lingo value and the fourth Command value to obtain fourth identification information uniquely associated with the Command to be processed;
and when the fourth identification signal is the same as the third identification information, processing the command to be processed by using a callback function associated with the third identification information.
11. The method of claim 1,
the method further comprises the following steps:
associating and storing a Transaction ID of a third command to be monitored and a callback function for processing the third command;
processing the third command with a callback function associated with a Transaction ID of the third command upon receipt of the third command.
12. The method of claim 11,
when the third command is received, processing the third command by using a callback function associated with a Transaction ID of the third command, including:
when a command to be processed is received, acquiring a Transaction ID of the command to be processed;
and when the Transaction ID of the command to be processed is the same as the Transaction ID of the third command, processing the command to be processed by utilizing a callback function associated with the Transaction ID of the third command.
13. An electronic device based on the iAP1 protocol, characterized in that the electronic device comprises an interconnected processor and memory for storing program data, the processor being adapted to execute the program data for implementing the method according to any of claims 1-12.
14. A computer-readable storage medium, in which program data are stored which, when being executed by a processor, are adapted to carry out the method according to any one of claims 1-12.
CN202010086570.2A 2020-02-11 2020-02-11 Command processing method based on iAP1 protocol, electronic equipment and storage medium Active CN113254367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010086570.2A CN113254367B (en) 2020-02-11 2020-02-11 Command processing method based on iAP1 protocol, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010086570.2A CN113254367B (en) 2020-02-11 2020-02-11 Command processing method based on iAP1 protocol, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113254367A true CN113254367A (en) 2021-08-13
CN113254367B CN113254367B (en) 2024-08-23

Family

ID=77219636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010086570.2A Active CN113254367B (en) 2020-02-11 2020-02-11 Command processing method based on iAP1 protocol, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113254367B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189446A1 (en) * 2002-12-24 2008-08-07 Rajesh Pulpatta Method and apparatus for monitoring responses of configuration commands
CN102004630A (en) * 2009-08-31 2011-04-06 国际商业机器公司 Multi-core/thread work-group computation scheduler
CN102428665A (en) * 2009-03-16 2012-04-25 苹果公司 Accessory and mobile computing device communication using application communication protocol
CN104881258A (en) * 2015-06-10 2015-09-02 北京金山安全软件有限公司 Buffer concurrent access method and device
CN105721438A (en) * 2016-01-19 2016-06-29 烽火通信科技股份有限公司 LTE gateway processing AT instruction method based on Linux
US20170315806A1 (en) * 2016-04-28 2017-11-02 Oracle International Corporation Method for managing software threads dependent on condition variables
CN109753354A (en) * 2018-11-26 2019-05-14 平安科技(深圳)有限公司 Processing method, device and the computer equipment of Streaming Media task based on multithreading

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080189446A1 (en) * 2002-12-24 2008-08-07 Rajesh Pulpatta Method and apparatus for monitoring responses of configuration commands
CN102428665A (en) * 2009-03-16 2012-04-25 苹果公司 Accessory and mobile computing device communication using application communication protocol
CN102004630A (en) * 2009-08-31 2011-04-06 国际商业机器公司 Multi-core/thread work-group computation scheduler
CN104881258A (en) * 2015-06-10 2015-09-02 北京金山安全软件有限公司 Buffer concurrent access method and device
CN105721438A (en) * 2016-01-19 2016-06-29 烽火通信科技股份有限公司 LTE gateway processing AT instruction method based on Linux
US20170315806A1 (en) * 2016-04-28 2017-11-02 Oracle International Corporation Method for managing software threads dependent on condition variables
CN109753354A (en) * 2018-11-26 2019-05-14 平安科技(深圳)有限公司 Processing method, device and the computer equipment of Streaming Media task based on multithreading

Also Published As

Publication number Publication date
CN113254367B (en) 2024-08-23

Similar Documents

Publication Publication Date Title
CN107277029B (en) Remote procedure call method and device and computer equipment
US20190199834A1 (en) Method, apparatus and terminal device for communication protocol compatibility
US9065788B2 (en) Method, device and system for voice communication
CN104184756A (en) Data synchronization method, device and system
US20180262284A1 (en) Method, apparatus and terminal device for sending broadcast
CN109302437B (en) Method and device for redirecting website
CN111858083B (en) Remote service calling method and device, electronic equipment and storage medium
CN110740145A (en) Message consumption method, device, storage medium and electronic equipment
CN108966159A (en) Short message cancelling method, system, computer equipment and storage medium
CN107479985B (en) Remote procedure call method and device and computer equipment
CN111405059A (en) Data transmission method of cloud equipment, electronic equipment and Internet of things system
CN111338710A (en) Application program control method and device, electronic equipment and storage medium
CN106161647A (en) The method of a kind of cloud terminal unit batch discovery and cloud terminal management system
US20210250408A1 (en) Server node selection method and terminal device
CN108536541B (en) Process engine object processing method and device
CN114697888B (en) 5G message processing method, device and storage medium
CN113254367A (en) iAP1 protocol-based command processing method, electronic device and storage medium
CN116881040A (en) Service operation processing method and device, electronic device and storage medium
CN102693434B (en) Communication apparatus and method for interface layer of radio frequency identification device
CN104821979A (en) Telephone number identification processing method and device thereof
CN113676894B (en) Service processing method and equipment
CN117354956A (en) 5G-based session establishment method and device, electronic equipment and storage medium
CN113783826A (en) Micro-service exception handling method and device
CN111130968A (en) Method and terminal for solving Modbus bus communication packet sticking
CN113556370A (en) Service calling method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant