Summary of the invention
Embodiments provide a kind of simulative serial port method of testing and device, for the test of client,
The exploitation debugging efforts enabling client is supported at any time, promotes whole development progress.
A kind of simulative serial port method of testing, including:
Receive the Modem commands language AT instruction that client sends;
Read and resolve each test data file prestored, obtain the test instruction in test data file;
Confirm that whether described test instruction is the result coding information URC instruction of active reporting, the most then
Described URC instruction is sent to described client, if it is not, then confirm whether described AT instruction is included in
In test instruction in described test data file, if comprising, then by the test corresponding with described AT instruction
The response contents of instruction is sent to described client, otherwise sends the expression information that the match is successful to described
Client.
Alternatively, each test data file that described reading parsing prestore, obtain in test data file
Test instruction;Confirm that whether described test instruction is the result coding information URC instruction of active reporting,
The most described URC instruction is sent to described client, if it is not, then confirm that described AT instruction is
In the no test instruction being included in described test data file, if comprising, then will be right with described AT instruction
The response contents of the test instruction answered is sent to described client, otherwise sends the letter representing that the match is successful
Breath includes to described client:
It is successively read each test data file prestored, and the test that parsing obtains in test data file refers to
Order, using described test instruction one by one as present node;Confirm that whether present node is the knot of active reporting
Fruit coding information URC instruction, the most then be sent to described client by described URC instruction, if it is not,
Then described AT instruction is mated with present node;If it fails to match, then send and represent that the match is successful
Information give described client, if the match is successful, then will be with the described successful present node of AT instructions match
Response contents be sent to described client;Or,
Read and resolve each test data file prestored, obtain the test instruction in test data file,
Then described test instruction is stored;Confirm that whether the test instruction of currently stored point is the result of active reporting
Coding information URC instructs, the most described URC instruction is sent to described client, if it is not,
Then confirming whether described AT instruction is included in the test instruction of described currently stored point, if comprising, then will
The response contents of the test instruction corresponding with described AT instruction is sent to described client, otherwise sends expression
The information that the match is successful gives described client.
Preferably, performing: described URC instruction is sent to described client, will refer to described AT
The response contents of the order present node that the match is successful is sent to described client, will instruct corresponding with described AT
Test instruction response contents be sent to any one in described client before also include:
Require arrange and start intervalometer according to the delay of the present node of configuration, will after intervalometer overflows
Described URC instruction is sent to described client, or, will instruct with described AT after intervalometer overflows
The response contents of the present node that the match is successful is sent to described client, or, after intervalometer overflows
The response contents of the test instruction corresponding with described AT instruction is sent to described client.
Preferably, before after intervalometer starts, intervalometer overflows, please if receiving the interruption from client
Ask, also include:
Stop intervalometer timing, and use interruption success message to replace described and described AT instructions match success
The response contents of present node or replace described corresponding with described AT instruction testing the response instructed
Content is sent to described client.
Preferably, described test data file is expandable mark language XML file;Described method is also wrapped
Include:
Accept the text editor amendment to XML file;Or, receive with AT instruction encapsulation format not
With XML file more fresh information, and according to described XML file update information updating its specify preset
XML file.
Preferably, described method, also include:
Creating two or more eavesdropping target, searching with polling mode after client terminal start-up can
The client connected, and set up the corresponding relation between eavesdropping target and attachable client;
Described described URC instruction is sent to described client includes: described URC instruction is used wide
Broadcast mode is sent to each client, client screen corresponding URC instruction;
The described expression information that the match is successful, described with the described successful present node of AT instructions match
Corresponding the testing the response contents instructed and interrupt successfully disappearing of response contents, described and described AT instruction
Breath, is sent to the client of correspondence according to described corresponding relation.
A kind of simulative serial port test device, including:
Communication controler, process controller, document parser, memorizer,
Communication controler, the Modem commands language AT sent for receiving client instructs and sends
To process controller;The information from process controller received is sent to client;
Memorizer, is used for storing test data file;
Document parser, for reading and resolving each test data file prestored, obtains testing data literary composition
Test instruction in part;
Process controller, for confirming that whether described test instruction is the result coding information of active reporting
URC instructs, the most described URC instruction is sent to described communication controler, if it is not, then confirm
In the test instruction whether described AT instruction is included in described test data file, if comprising, then will be with
The response contents of the test instruction that described AT instruction is corresponding is sent to described communication controler, otherwise sends table
Show that the information that the match is successful is to described communication controler.
Alternatively, described document parser, specifically for being successively read each test data file prestored,
And resolve the test instruction obtaining in test data file, using described test instruction one by one as present node;
Described process controller, specifically for confirming that whether present node is the result coding letter of active reporting
Breath URC instruction, the most then be sent to described communication controler by described URC instruction, if it is not, then
Described AT instruction is mated with present node;If it fails to match, then the match is successful in transmission expression
Information gives described communication controler, if the match is successful, then will successfully work as prosthomere with described AT instructions match
The response contents of point is sent to described communication controler;
Or, described document parser, specifically for reading and resolving each test data file prestored,
Obtain the test instruction in test data file, then store described test instruction;
Whether described process controller, be active reporting specifically for confirming the test instruction of currently stored point
Result coding information URC instruction, the most then by described URC instruction be sent to described Control on Communication
Device, if it is not, then confirm whether described AT instruction is included in the test instruction of described currently stored point, if
Comprise, then the response contents of the test instruction corresponding with described AT instruction is sent to described Control on Communication
Device, otherwise sends the expression information that the match is successful to described communication controler.
Preferably, described process controller, it is additionally operable to performing: be sent to described by described URC instruction
Communication controler, will be sent to described logical with the response contents of the described successful present node of AT instructions match
Believe controller, the response contents of the test instruction corresponding with described AT instruction is sent to described Control on Communication
Before any one in device, require arrange and start intervalometer according to the delay of the present node of configuration,
After intervalometer overflows, described URC instruction is sent to described communication controler, or, overflow at intervalometer
Described Control on Communication will be sent to the response contents of the described successful present node of AT instructions match after going out
Device, or, after intervalometer overflows, the response contents of the test instruction corresponding with described AT instruction is sent
To described communication controler;
Described simulative serial port test device also includes: intervalometer, for entering according to the instruction of process controller
Row timing.
Preferably, described communication controler, it is additionally operable to receive in the interrupt requests from client, and general
Disconnected request is sent to process controller;
Process controller, receives, then before overflowing if being additionally operable to interrupt requests intervalometer after intervalometer starts
Stop intervalometer timing, and use interruption success message replace described in successfully work as with described AT instructions match
The response contents of front nodal point or the response contents of the described test instruction corresponding with described AT instruction of replacement
It is sent to described communication controler.
Preferably, described test data file is expandable mark language XML file;
Described simulative serial port test device also includes: text editor, for the XML literary composition in memorizer
Part is modified;Or,
The communication controler of described simulative serial port test device, is additionally operable to receive referring to AT from client
Make the XML file more fresh information that encapsulation format is different, and XML file more fresh information is sent to flow process
Controller;
Process controller, is additionally operable to update its preset XML specified of information updating according to described XML file
File.
Preferably, described communication controler includes: broadcasting equipment, instruction retransmission apparatus, response transmitter;
Instruction retransmission apparatus, for creating two or more eavesdropping target, after client terminal start-up
Search attachable client with polling mode, the information from client be sent to process controller,
The described information from client includes: in AT instruction, interrupt requests, XML file more fresh information
At least one;
Process controller, specifically for being sent to broadcasting equipment, by the message beyond URC by URC instruction
Being sent to response transmitter, the message beyond described URC includes: represent the information that the match is successful and
The survey that the response contents of the described successful present node of AT instructions match, described and described AT instruction is corresponding
At least one in the response contents of examination instruction, interruption success message;
Response transmitter, for setting up the corresponding relation between eavesdropping target and attachable client, and
The client of correspondence it is sent to according to the message beyond the described URC that described corresponding relation will receive;
Described broadcasting equipment, for using broadcast mode to be sent to each client the URC received instruction,
Corresponding URC instruction is screened by client.
As can be seen from the above technical solutions, the embodiment of the present invention has the advantage that employing simulation is wireless
Client is tested by the mode of network interface card, it may not be necessary to wait that hardware or base-band software exploitation are complete the most not
Must rely on it to support, therefore the exploitation of client can be debugged the most in time with debugging,
Thus improve whole development progress.
Detailed description of the invention
In order to make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing to this
Invention is described in further detail, it is clear that described embodiment is only that a part of the present invention is implemented
Example rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art exist
Do not make all other embodiments obtained under creative work premise, broadly fall into present invention protection
Scope.
Embodiments provide a kind of simulative serial port method of testing, as shown in Figures 2 and 3, this
The executive agent of bright embodiment is simulative serial port test device (simulator), including:
201: receive the Modem commands language AT instruction that client sends;
It is understandable that before performing 201, needs according to the communication mode arranged with client and visitor
Family end sets up communication connection;Above communication mode alternative is a lot, and the embodiment of the present invention is preferably used soft
Bus responder (D-Bus Method Reply) simulation wireless network card communicates with client.
D-Bus is a kind of IPC(Inter-Process Communication, interprocess communication) mechanism.
D-BUS support one to one with the peer to peer communication of multi-to-multi.When man-to-man Direct Communication, two
Application program links together.When the communication of multi-to-multi, this is accomplished by one and is D-BUS daemon
The role on (backstage) goes point to turn;When an application program messaging is to another one application program, disappear
Breath first arrives backstage, then be will send information to purpose application program by backstage.D-BUS serves as route in backstage
The role of device.D-Bus has and avoids transmitting information back and forth and allowing the characteristic of asynchronous operation.Thus while
It is to realize communication by socket (socket) between application program (Application) and Daemon
, but eliminate the circular wait of socket, it is ensured that the real-time high-efficiency of operation.D-Bus also provides for
The API(Application Programming Interface of packaging bottom layer specially good effect, application programming
Interface function) for analogue communication.
202: read and resolve each test data file prestored, the test obtained in test data file refers to
Order;
Alternatively, above-mentioned 202 specifically may is that and are successively read each test data file prestored, and solve
Analysis obtains the test instruction in test data file, instructs above-mentioned test one by one as present node;Also
Can be to read and resolve each test data file prestored, obtain the test instruction in test data file,
Then above-mentioned test instruction is stored;Mode as storage can use the various forms such as chained list, array,
This is not limited by the embodiment of the present invention.
Test data file is the file of storage test data, in embodiments of the present invention can be with XML
Illustrate as a example by (extensible markup language, extensible markup language) file.Storage is surveyed
The concrete form of file of examination data can have a lot, such as, can be TXT file (Text File, text
File), database file etc., this is not restricted by the embodiment of the present invention.
It should be noted that above-mentioned 201 and 202 each other do not have logic precedence, therefore with
The numbering of upper step should not be construed as in time and/or the precedence that there is logically execution.
203: confirm that whether above-mentioned test instruction is the result coding information URC instruction of active reporting, if
It is then above-mentioned URC instruction to be sent to above-mentioned client, if it is not, whether then confirm above-mentioned AT instruction
In the test instruction being included in above-mentioned test data file, if comprising, then will be corresponding with above-mentioned AT instruction
The response contents of test instruction be sent to above-mentioned client, otherwise send the information representing that the match is successful
To above-mentioned client.
The specific implementation of above-mentioned 203 at least the following two kinds, is respectively as follows:
It is successively read each test data file prestored, and the test that parsing obtains in test data file refers to
Order, instructs above-mentioned test one by one as present node;Confirm that whether present node is the knot of active reporting
Fruit coding information URC instruction, the most then be sent to above-mentioned client by above-mentioned URC instruction, if it is not,
Then above-mentioned AT instruction is mated with present node;If it fails to match, then send and represent that the match is successful
Information give above-mentioned client, if the match is successful, then will be with the above-mentioned successful present node of AT instructions match
Response contents be sent to above-mentioned client;
Or, read and resolve each test data file prestored, obtain the test in test data file
Instruction, then stores above-mentioned test instruction;Whether confirm that the test of currently stored point instructs is active reporting
Result coding information URC instruction, the most then by above-mentioned URC instruction be sent to above-mentioned client,
If it is not, then confirm whether above-mentioned AT instruction is included in the test instruction of above-mentioned currently stored point, if comprising,
Then the response contents of the test instruction corresponding with above-mentioned AT instruction is sent to above-mentioned client, otherwise sends
The expression information that the match is successful gives above-mentioned client.
The embodiment of the present invention uses the mode of simulation wireless network card to test client, it may not be necessary to etc.
Treat hardware or base-band software exploitation complete also need not rely on its support, therefore the exploitation of client with debugging can
To be debugged the most in time, thus improve whole development progress.
Further, the embodiment of the present invention additionally provides the response of AT instruction and the realization side of timeout treatment
Case, specific as follows: perform: by above-mentioned URC instruction be sent to above-mentioned client, will be with above-mentioned AT
The response contents of the successful present node of instructions match be sent to above-mentioned client, will with above-mentioned AT instruction right
The response contents of the test instruction answered also includes before being sent to any one in above-mentioned client:
Require arrange and start intervalometer according to the delay of the present node of configuration, will after intervalometer overflows
Above-mentioned URC instruction is sent to above-mentioned client, or, will instruct with above-mentioned AT after intervalometer overflows
The response contents of the present node that the match is successful is sent to above-mentioned client, or, after intervalometer overflows
The response contents of the test instruction corresponding with above-mentioned AT instruction is sent to above-mentioned client.
Further, the embodiment of the present invention additionally provides response and the Abort(interruption of AT instruction) process
Implementation, specific as follows: intervalometer start after intervalometer overflow before, if receiving from client
The interrupt requests of end, also includes:
Stop intervalometer timing, and it is above-mentioned successful with above-mentioned AT instructions match to use interruption success message to replace
The response contents of present node or replace the response that the corresponding test of above-mentioned and above-mentioned AT instruction instructs
Content is sent to above-mentioned client.
Introduction based on above example, the Row control file of AT can file based on XML format,
The primary key that it comprises can have a lot, following present several citing:
Unknow: in the node of the test case of XML file (namely in test instruction of XML file)
During the AT response not matched with the AT instruction received, respond this AT and instruct (unknow).Adopt
Advantage with above-mentioned keyword: because client may issue a lot of AT request, and as test and exploitation
Time, it is thus only necessary to it is concerned about the function of current operation, other unconcerned AT request can be ignored, and
Unknown designs for this exactly.
Timeout: if not defining AT to process the spilling time (second), return the most immediately.Actually used
Middle protocol stack may can cause AT response timeout because of certain reason, the timeout item in the embodiment of the present invention
Value then can be used to start intervalometer, after intervalometer overflows, just by the content of recv_hex (the most below
Introduce) it is sent to client, thus simulate the function of AT response timeout.
Type:AT instruction type.
Repeat:AT instruction repeats number of times, advantage: may be used for stress test.
Send_hex: from the AT command content of client, can use to use hexadecimal representation mode
In coupling customer end A T instruction.
The content (using hexadecimal representation mode) of recv_hex:AT response instruction or URC, by type
Value determines (0:URC instructs, non-zero: non-URC instructs).
Further, the embodiment of the present invention additionally provides the implementation that XML file updates, specific as follows:
Above-mentioned test data file is expandable mark language XML file;Said method also includes:
Accept the text editor amendment to XML file;Or, receive with AT instruction encapsulation format not
With XML file more fresh information, and according to above-mentioned XML file update information updating its specify preset
XML file.
More specifically, the embodiment of the present invention give XML file update time XML concrete form and
Its implementation, when in use XML file needs amendment, upgrading XML configuration file, can
Text editor is used directly to revise XML file;The present invention also supports that client remote upgrading XML joins
Put file, virtual with USB in order to be designed to | serial ports, flexible bus are unrelated (identical with AT instruction use
Resolution unit), the content that need to upgrade is used the encapsulation format of self-defined AT instruction pass to simulator,
Simulator AT receives unit and passes to the XML upgrade unit configuration literary composition to specifying numbering in parsing
Part is written over.Multiple XML file and update mode are identified by " No. " field.
The encapsulation format of the AT instruction of XML content, as shown in table 1 below:
Table 1
No.: (each XML file name comprises a unique numbering to the numbering of configuration XML file
Section).
F.C: function code.As F.C=1 represents upgrading XML file.
The content of data: renewal.
Further, the embodiment of the present invention gives and realizes simulative serial port test device (simulator)
Set up with multiple clients and be connected, the scheme of test, said method are provided for multiple clients, also include:
Create two or more eavesdropping target, search can connect with polling mode after client terminal start-up
Client, and set up the corresponding relation between eavesdropping target and attachable client;
Above-mentioned above-mentioned URC instruction is sent to above-mentioned client includes: above-mentioned URC instruction is used wide
Broadcast mode is sent to each client, client screen corresponding URC instruction;
The above-mentioned expression information that the match is successful, above-mentioned with the above-mentioned successful present node of AT instructions match
Corresponding the testing the response contents instructed and interrupt successfully disappearing of response contents, above-mentioned and above-mentioned AT instruction
Breath, is sent to the client of correspondence according to above-mentioned corresponding relation.
If setting up during the realization being connected at above the present embodiment simulator with multiple clients, use
D-Bus sets up the communication connection between simulator and multiple client, then the embodiment of the present invention then can be in order to
It is extended to a simulator by D-Bus mode and connects multiple clients, it is achieved a simulator realizes many
The test of individual different clients;It is beneficial to D-Bus self-characteristic (supporting multi-point, broadcast) realize
Multiple identical or different clients communicate with simulator.Simulator creates multiple monitoring when starting
(watch) object, when each client terminal start-up, goes to search attachable object with polling mode.When
Simulator end for the first time receives client D-Bus Method(program) request time, above-mentioned visitor can be read
The XML file present node content that family end is corresponding, it is also possible to preserved, for the response of AT instruction
Subsequent treatment is identical with single client;And URC type is indicated, simulator then can use signal
Broadcast mode sends, client signal as required filter and screening.
The embodiment of the present invention additionally provides a kind of simulative serial port test device, as shown in Figure 4, and including:
Communication controler 401, process controller 402, document parser 403, memorizer 404;
Communication controler 401, for being sent to client by the information from process controller 402 received
End;The Modem commands language AT receiving client transmission instructs and is sent to process controller 402;
Above communication mode alternative is a lot, and the embodiment of the present invention is preferably used flexible bus responder
(D-Bus Method Reply) simulation wireless network card communicates with client.D-Bus is a kind of IPC
(Inter-Process Communication, interprocess communication) mechanism.D-BUS supports one to one and many
To many peer to peer communications.When man-to-man Direct Communication, two application programs link together.Many
During to many communications, this is accomplished by one and cries D-BUS daemon(backstage) role go point to turn;One
When individual application program messaging is to another one application program, message first arrives backstage, then will letter by backstage
Breath is sent to purpose application program.D-BUS serves as on backstage the role of router.D-Bus has and avoids
Passback is passed information and allows the characteristic of asynchronous operation.Thus while at application program (Application) and
Realize communication by socket (socket) between Daemon, but eliminate the circulation of socket
Wait, it is ensured that the real-time high-efficiency of operation.D-Bus additionally provides the API of packaging bottom layer specially good effect
(Application Programming Interface, application programming interface function) makes for analogue communication
With.
Memorizer 404, is used for storing test data file;
Test data file is the file of storage test data, in embodiments of the present invention can be with XML
Illustrate as a example by (extensible markup language, extensible markup language) file.Storage is surveyed
Examination number.
Document parser 403, for reading and resolving each test data file prestored, obtains testing data
Test instruction in file;
Process controller 402, for confirming that whether above-mentioned test instruction is the result coding information of active reporting
URC instructs, the most above-mentioned URC instruction is sent to above-mentioned communication controler 401, if it is not, then
Confirm in the test instruction whether above-mentioned AT instruction is included in above-mentioned test data file, if comprising, then
The response contents of the test instruction corresponding with above-mentioned AT instruction is sent to above-mentioned communication controler 401, no
Then send the expression information that the match is successful to above-mentioned communication controler 401.
Above example, uses the mode of simulation wireless network card to test client, it may not be necessary to etc.
Treat hardware or base-band software exploitation complete also need not rely on its support, therefore the exploitation of client with debugging can
To be debugged the most in time, thus improve whole development progress.
Alternatively,
Above-mentioned document parser 403, specifically for being successively read each test data file prestored, and resolves
Obtain the test instruction in test data file, above-mentioned test is instructed one by one as present node;
Above-mentioned process controller 402, specifically for confirming that whether present node is the result coding of active reporting
Information URC instructs, the most above-mentioned URC instruction is sent to above-mentioned communication controler 401, if it is not,
Then above-mentioned AT instruction is mated with present node;If it fails to match, then send and represent that the match is successful
Information give above-mentioned communication controler 401, if the match is successful, then will be successful with above-mentioned AT instructions match
The response contents of present node is sent to above-mentioned communication controler 401;
Or, above-mentioned document parser 403, specifically for reading and resolving each test data file prestored,
Obtain the test instruction in test data file, then store above-mentioned test instruction;
Whether above-mentioned process controller 402, be in active specifically for confirming the test instruction of currently stored point
The result coding information URC instruction of report, the most then be sent to above-mentioned communication control by above-mentioned URC instruction
Device 401 processed, if it is not, then confirm whether above-mentioned AT instruction is included in the test instruction of above-mentioned currently stored point
In, if comprising, then the response contents of the test instruction corresponding with above-mentioned AT instruction is sent to above-mentioned communication
Controller 401, otherwise sends the expression information that the match is successful to above-mentioned communication controler 401.
Further, as shown in Figure 5:
Above-mentioned process controller 402, is additionally operable to performing: above-mentioned URC instruction is sent to above-mentioned communication
Controller 401, will be sent to above-mentioned logical with the response contents of the above-mentioned successful present node of AT instructions match
Believe controller 401, the response contents of the test instruction corresponding with above-mentioned AT instruction is sent to above-mentioned communication
Before any one in controller 401, require to arrange and start according to the delay of the present node of configuration
Intervalometer, is sent to above-mentioned communication controler 401 by above-mentioned URC instruction after intervalometer overflows, or,
To be sent to the response contents of the above-mentioned successful present node of AT instructions match after intervalometer overflows
State communication controler 401, or, by the test instruction corresponding with above-mentioned AT instruction after intervalometer overflows
Response contents be sent to above-mentioned communication controler 401;
Above-mentioned simulative serial port test device also includes: intervalometer 501, for according to process controller 402
Instruction carries out timing.
Further, above-mentioned communication controler 401, it is additionally operable to receive the interrupt requests from client, and
Interrupt requests is sent to process controller 402;
Process controller 402, overflows if being additionally operable to interrupt requests intervalometer 501 after intervalometer 501 starts
Before receive, then stop intervalometer 501 timing, and use interruption success message replace above-mentioned and above-mentioned AT refer to
Make the response contents of the present node that the match is successful or replace above-mentioned and above-mentioned AT to instruct corresponding test
The response contents of instruction is sent to above-mentioned communication controler 401.
Introduction based on above example, the Row control file of AT can file based on XML format,
The primary key that it comprises can have a lot, following present several citing:
Unknow: when the AT response not having coupling, the AT instruction of response.Use above-mentioned keyword
Advantage: because client may issue a lot of AT request, and during as test and exploitation, it is thus only necessary to close
The function of heart current operation, can ignore other unconcerned AT request, and unknown is exactly
Design for this.
Timeout: if not defining AT to process the spilling time (second), return the most immediately.Actually used
Middle protocol stack may can cause AT response timeout because of certain reason, the timeout item in the embodiment of the present invention
Value then can be used to start intervalometer, after intervalometer overflows, just by the content of recv_hex (the most below
Introduce) it is sent to client, thus simulate the function of AT response timeout.
Type:AT instruction type.
Repeat:AT repeats number of times, advantage: may be used for stress test.
Send_hex: from the AT content of client, can to use hexadecimal representation mode, for
Join the instruction of customer end A T.
The content (using hexadecimal representation mode) of recv_hex:AT response or URC, by type
Value determines (0:URC indicates, non-zero: non-URC instructs).
Further, as shown in Figure 6: above-mentioned test data file is expandable mark language XML file;
Above-mentioned simulative serial port test device also includes: text editor 601, in memorizer 404
XML file is modified;Or,
Above-mentioned simulative serial port test device communication controler 401, be additionally operable to receive from client with
The XML file more fresh information that AT instruction encapsulation format is different, and XML file more fresh information is sent
To process controller 402;
Process controller 402, be additionally operable to according to above-mentioned XML file update information updating its specify preset
XML file.
When in use XML file needs amendment, upgrading XML configuration file, text can be used
XML file directly revised by editing machine;The present invention also supports client remote upgrading XML configuration file,
In order to be designed to and interface USB | serial ports, flexible bus unrelated (resolution unit identical with AT instruction use),
The encapsulation format content that need to upgrade being used self-defined AT instruction passes to simulator, and simulator AT connects
Receive unit and pass to XML upgrade unit to specifying the configuration file numbered to be written in parsing.
Multiple XML file and update mode are identified by " No. " field.Concrete form can refer to table 1.
Preferably, as shown in Figure 7: above-mentioned communication controler 401 includes: broadcasting equipment 701, instruction forward
Device 702, response transmitter 703;
Instruction retransmission apparatus 702, for creating two or more eavesdropping target, at client terminal start-up
After with polling mode search attachable client, the information from client is sent to process controller
402, the above-mentioned information from client includes: AT instruction, interrupt requests, XML file more fresh information
In at least one;
Process controller 402, specifically for being sent to broadcasting equipment 701, beyond URC by URC instruction
Message be sent to response transmitter 703, the message beyond above-mentioned URC includes: represent the match is successful
Response contents, the above-mentioned and above-mentioned AT of information and the above-mentioned successful present node of AT instructions match refer to
At least one in the response contents of test instruction of order correspondence, interruption success message;
Response transmitter 703, for setting up the corresponding relation between eavesdropping target and attachable client,
And the message beyond the above-mentioned URC that will receive according to above-mentioned corresponding relation is sent to the client of correspondence;
Above-mentioned broadcasting equipment 701, for using broadcast mode to be sent to each client the URC received instruction
End, is screened corresponding URC instruction by client.
The embodiment of the present invention gives one group of applicating example, is further described previous embodiment, its
In, simulative serial port test device (simulator) uses flexible bus response with the communication mode of client agreement
Program is simulated, and test data file uses XML file.Refer to Fig. 8, it should be noted that this reality
Execute each unit in example to be combined according to its function and split further, this present invention is implemented
Example not limits, and below the function dividing mode in citing also should not be construed as to the embodiment of the present invention only
One limits.
Example 1: this example realizes AT instruction and reports with response, URC, specific as follows:
AT command reception processing unit, is used for using D-Bus Method Reply(flexible bus responder),
Receive and extract the AT from client to instruct, and issue AT and instruct AT flow control unit.
AT flow control unit, for working as prosthomere by XML parser unit from XML file reading
Dot information, if present node is URC instruction, then transmission URC instructs AT instruction response and processes list
Unit;Otherwise, after receiving the AT instruction that AT command reception processing unit issues, AT instruction is used
Instruct with the expection AT of the present node in current XML file and mate, if it fails to match, then make
It is delivered to AT instruction response processing unit by unknown content;If the match is successful, then XML is used to work as
Front nodal point recv_hex(AT response) response contents be delivered to AT instruction response processing unit;
XML parser unit, for being successively read the XML being pre-configured with from XML memory element
The information of the test data of file is (such as: Unknow, timeout, type, repeat, send_hex, recv_hex
Deng), the information the most currently read is present node (that is to say currently processed position), and at AT
Flow control unit correctly matches after the AT request of client, and mobile currently processed position is to next
In individual node or next XML file.So AT flow control unit then can be resolved by XML
Unit reads current node information, if URC is transmitted directly to AT instruction response processing unit, no
The instruction to be received mating such as then, if the match is successful, send response contents to AT instruction response at
Reason unit, otherwise, sends unknown to AT instruction response processing unit.
XML memory element, for storing the test case of single or multiple XML file, it is achieved XML
Being used in combination of file, can facilitate the Classification Management of test case, realize test case and reuse thus reduce
Test case write workload.
AT instruction response processing unit, for by from the response contents of AT flow control unit or URC,
D-Bus Method Reply is used to be sent to the client specified.So AT instruction response processing unit
If performing result particularly as follows: be URC instruction at present node, XML parser reads above-mentioned instruction
Content is also sent to AT flow control unit.AT flow control unit sends it to AT instruction response
Processing unit also uses D-Bus Method Reply that the content of URC is sent to the client specified.
Above example, uses the mode of simulation wireless network card to test client, it may not be necessary to etc.
Treat hardware or base-band software exploitation complete also need not rely on its support, therefore the exploitation of client with debugging can
To be debugged the most in time, thus improve whole development progress.
Example 2: this example realizes response and the timeout treatment of AT instruction on the basis of example 1 further,
Specific as follows:
AT command reception processing unit, is used for using D-Bus Method Reply receive and be extracted from
The AT instruction of client, and issue AT and instruct AT flow control unit.
AT flow control unit, for working as prosthomere by XML parser unit from XML file reading
Dot information, if present node is URC instruction, then controls AT time-out analogue unit and starts intervalometer;
Otherwise, after receiving the AT instruction that AT command reception processing unit issues, use AT instruction and work as
The expection AT instruction of the present node in front XML file is mated, if it fails to match, then uses
Unknown content is delivered to AT instruction response processing unit;If the match is successful, then control AT time-out mould
Intend unit starting intervalometer;
AT time-out analogue unit, according to the delay requirement of the present node of XML configuration file, it is fixed to start
Time device, after intervalometer overflows, perhaps URC in recv_hex is passed to AT instruction response and processes single
Unit.AT time-out analogue unit plays the transmission delay controlling recv_hex.
AT instruction response processing unit, for by from the response contents of AT time-out analogue unit or URC,
D-Bus Method Reply is used to be sent to the client specified.
XML parser unit, for being successively read the XML being pre-configured with from XML memory element
The information of the test data of file is (such as: Unknow, timeout, type, repeat, send_hex, recv_hex
Deng), the information the most currently read is present node (that is to say currently processed position), and at AT
Flow control unit correctly matches after the AT request of client, and mobile currently processed position is to next
In individual node or next XML file.
XML memory element, for storing the test case of single or multiple XML file, it is achieved XML
Being used in combination of file, can facilitate the Classification Management of test case, realize test case and reuse thus reduce
Test case write workload.
Example 3: this example realizes at response and the Abort of AT instruction on the basis of example 2 further
Reason, specific as follows:
AT command reception processing unit, is used for using D-Bus Method Reply receive and be extracted from
The AT instruction of client, and issue AT and instruct AT flow control unit.
AT flow control unit, after receiving the AT instruction that AT command reception processing unit issues,
Use AT instruction to instruct with the expection AT of the present node in current XML file to mate, if
Join unsuccessfully, then use unknown content to be delivered to AT instruction response processing unit;If the match is successful,
Then control AT time-out analogue unit and start intervalometer;
AT time-out analogue unit, according to the delay requirement of the present node of XML configuration file, it is fixed to start
Time device, when intervalometer overflow after, recv_hex content is passed to AT instruction response processing unit.AT
Time-out analogue unit plays the transmission delay controlling recv_hex.
Abort analogue unit, for during timeout treatment (i.e. intervalometer start after and intervalometer overflow
Before going out), if receiving the Abort interrupt requests (terminating AT instruction to perform) from client, then stop
AT intervalometer, and revise the content of former recv_hex for " OK ", and be delivered to AT instruction response and process
Unit.
AT instruction response processing unit, for by the information from Abort analogue unit, uses D-Bus
Method Reply is sent to the client specified.
XML parser unit, for being successively read the XML being pre-configured with from XML memory element
The information of the test data of file is (such as: Unknow, timeout, type, repeat, send_hex, recv_hex
Deng), the information the most currently read is present node (that is to say currently processed position), and at AT
Flow control unit correctly matches after the AT request of client, and mobile currently processed position is to next
In individual node or next XML file.
XML memory element, for storing the test case of single or multiple XML file, it is achieved XML
Being used in combination of file, can facilitate the Classification Management of test case, realize test case and reuse thus reduce
Test case write workload.
In above example, the content information of URC all can be used D-Bus by URC radio unit
Method Reply is sent to the client specified.
The embodiment of the present invention is also served as theme with the use flow process of XML file and is provided an embodiment, above-mentioned
Embodiment can realize simulative serial port test device (simulator) test simultaneously to multiple clients, tool
Body is as follows:
After simulator loads xml, current pointer is pointed to Article 1 " AT " node, now, first sentences
Whether disconnected type is equal to whether 0(is URC type);The most then recv_hex content is broadcast to visitor
Family end;If being not equal to the non-URC of 0(), then etc. the AT from client to be received asks, when AT please
After asking arrival, AT request is compared with the send_hex content under present node, if not mating,
The content then using unknown is sent to given client end and responds, if coupling, then uses recv_hex
Content be sent to given client end and respond;Then current pointer is moved to next " AT " node,
And repeat above operation until XML file is all completed.
In above-mentioned flow process, if adding time-out, then, after instructions match, carry out according to node delay information
Time delay, if receiving the AT instruction of abort during time delay, sends OK response, for URC,
Then after decision node response is for URC, directly initiate time delay, after time delay terminates, send URC.
Above example, uses the mode of simulation wireless network card to test client, it may not be necessary to etc.
Treat hardware or base-band software exploitation complete also need not rely on its support, therefore the exploitation of client with debugging can
To be debugged the most in time, thus improve whole development progress.It addition, add at time-out
Reason can effectively control the transmission of response message and postpone, and XML file centralized stores is then achieved XML
Being used in combination of file, can facilitate the Classification Management of test case, realize test case and reuse thus reduce
Test case write workload;Add and test while multiple clients, then can realize at multithreading
Reason, improves testing efficiency further.
It should be noted that in above-mentioned simulative serial port test device embodiment, included unit is only
Divide according to function logic, but be not limited to above-mentioned division, as long as being capable of corresponding
Function;It addition, the specific name of each functional unit is also only to facilitate mutually distinguish, not
For limiting the scope of the invention.
It addition, one of ordinary skill in the art will appreciate that realize whole in above-mentioned each method embodiment or
Part steps can be by program and completes to instruct relevant hardware, and corresponding program can be stored in one
In kind of computer-readable recording medium, storage medium mentioned above can be read only memory, disk or
CD etc..
These are only the present invention preferably detailed description of the invention, but protection scope of the present invention is not limited to
This, any those familiar with the art, can in the technical scope that the embodiment of the present invention discloses
The change readily occurred in or replacement, all should contain within protection scope of the present invention.Therefore, the present invention
Protection domain should above-mentioned be as the criterion with scope of the claims.