CN103713934A - Method and system for application program visiting physical peripheral - Google Patents
Method and system for application program visiting physical peripheral Download PDFInfo
- Publication number
- CN103713934A CN103713934A CN201210376679.5A CN201210376679A CN103713934A CN 103713934 A CN103713934 A CN 103713934A CN 201210376679 A CN201210376679 A CN 201210376679A CN 103713934 A CN103713934 A CN 103713934A
- Authority
- CN
- China
- Prior art keywords
- access
- application program
- data
- physical
- server
- 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.)
- Pending
Links
Images
Landscapes
- Stored Programmes (AREA)
Abstract
The invention provides a method for application program visiting physical peripheral. The method includes simulating and generating device data of the physical peripheral to be visited by the application program, visiting the device data according to request information of the application visiting physical peripheral, and resending the device data returned during the visiting process back to the application program. The invention further provides a system for application program visiting physical peripheral. With the method and the system, dependency on the physical peripheral can be broke away during the application program visiting physical peripheral process, the method and the system have high operability, and can simulate any physical peripheral and physical peripheral states, so that the application program can acquire any needed physical peripheral information.
Description
Technical field
The present invention relates to access physics peripheral hardware technology, particularly relate to a kind of method and system of application program access physics peripheral hardware.
Background technology
At present, in the embedded software developing process of tape operation system, general operation system all can be unified encapsulation to driving access interface, when application program need to be accessed physics peripheral hardware, and the access of the various driving Interface realizations that need to provide by call operation system to external hardware.
For example, application program need to be obtained the state of physics peripheral hardware, application program is call driver access interface first, the information that need to access to driver transmission, driver directly carries out read operation (sometimes also need to write corresponding control information and just can carry out read operation) to specific physics peripheral hardware according to visit information, the data transmission that last driver obtains access, to application program, realizes the access of application program to bottom hardware physical equipment.
In above-mentioned technology, driver is that bottom hardware equipment is directly accessed, the hardware that the process of application program access physics peripheral hardware must depend on physics peripheral hardware exists, resulting data also must depend on the virtual condition of physics peripheral hardware simultaneously, to application program access physics peripheral hardware, brought great limitation like this, particularly in application programs, carry out in abnormality test, cause application program cannot obtain the abnormality data that current physics peripheral hardware can not provide.
Summary of the invention
Based on this, be necessary to depend critically upon for legacy application access physics peripheral hardware technology the problem of physics peripheral hardware, a kind of method and system of application program access physics peripheral hardware is provided.
A method for application program access physics peripheral hardware, comprises the steps:
The device data of the physics peripheral hardware that simulation generation application program need to be accessed;
According to the solicited message of described application program access physics peripheral hardware, access described device data;
The device data returning in described access process is back to described application program.
A system for application program access physics peripheral hardware, comprising:
Simulation virtual peripheral unit, for simulating the device data that generates the physics peripheral hardware that application program need to access;
Virtual peripheral addressed location, for accessing described device data according to the solicited message of described application program access physics peripheral hardware;
Return data resolution unit, is back to described application program for the device data that described access process is returned.
The method and system of above-mentioned application program access physics peripheral hardware, by simulation, generate the device data of physics peripheral hardware, the device data of the physical vlan peripheral hardware that application program generates simulation conducts interviews, obtain corresponding status information of equipment, in application program access physics peripheral hardware process, depart from the dependence to physics peripheral hardware completely, there is high operability, can simulate any physics peripheral hardware and physics peripheral hardware state thereof, make the physics peripheral hardware status information of any needs that application program can obtain.
Accompanying drawing explanation
Fig. 1 is the method flow diagram of the application program access physics peripheral hardware of an embodiment;
Fig. 2 is the process flow diagram of the access means data of an embodiment;
Fig. 3 is the application system of an embodiment and the structural representation of server inside;
Fig. 4 is the application program of application system of a preferred embodiment and the process flow diagram that server carries out data exchange processing process;
Fig. 5 is the application program of server of a preferred embodiment and the process flow diagram that application system is carried out data exchange processing process;
Fig. 6 is the structural representation that the application program of an embodiment is accessed the system of physics peripheral hardware;
Fig. 7 is the structural representation that the application program of a preferred embodiment is accessed the system of physics peripheral hardware.
Embodiment
Below in conjunction with accompanying drawing, the embodiment of the method for application program access physics peripheral hardware of the present invention is described in detail.
As shown in Figure 1, Fig. 1 shows the method flow diagram of the application program access physics peripheral hardware of an embodiment, mainly comprises the steps:
Step S1: the device data of the physics peripheral hardware that simulation generation application program need to be accessed;
In one embodiment, step S1 specifically comprises:
Set up one for the server of analog physical peripheral hardware, the physics peripheral hardware that need to access according to application program, in server, simulation generates the device data corresponding with this physics peripheral hardware.
In embedded software developing process, conventionally need to consider to process the abnormal conditions of various physics peripheral hardwares, by server, simulate the abnormality that produces desired various physics peripheral hardware faults, without actual physics peripheral hardware is modified as to corresponding abnormality, can in the treatment scheme of this type of fault, test software, greatly improve the testability of software.
It should be noted that, except utilizing above-mentioned server, can also there is the software of similar functions or the device data that hardware simulation generates physics peripheral hardware by other.
Step S2: access described device data according to the solicited message of described application program access physics peripheral hardware;
In one embodiment, as shown in Figure 2, Fig. 2 shows the process flow diagram of the access means data of an embodiment, specifically comprises the steps:
Step S201, resolves by the solicited message of driver application programs access physics peripheral hardware;
Particularly, the system function interface and the application program that by drive software, by operating system, are provided are mutual, and the application program accessing request information of receiving is resolved.
Step S202, according to the device data in the solicited message access services device after resolving;
As an embodiment, the process of access services device comprises the steps:
A, by the visit data in solicited message, according to the protocol format of setting, package;
Particularly, the visit data comprising in driving layer parsing acquisition solicited message by driver, communicates the protocol format setting between foundation and server, and visit data is packaged.
B, visit data bag group bag being obtained by communication interface are sent to server;
Wherein, communication interface, including but not limited to network interface, USB, serial ports etc., sends the response message of rear waiting for server.
C, in server, visit data bag is unpacked and resolved;
Particularly, server real-time listening communication interface, receives after visit data bag, according to the protocol format of setting, visit data bag is unpacked, and parses the visit information that comprises in visit data bag for replying accordingly.
D, according to the visit information in visit data bag, from device data, obtain corresponding reply data;
Particularly, server is stored in the content of local device data according to the content obtaining of visit data bag, and organizes the content of corresponding reply data.
E, the protocol format by reply data according to setting package.
F, reply data bag group bag being obtained by communication interface are sent to driver.
G, the reply data returning by driver reception server;
Particularly, the reply data bag being returned by driver reception server, unpacks to reply data bag, obtains the required device data of application program.
By the access to the device data of simulation generation, the information of the physics peripheral hardware of the required access of application program, reality all derives from the simulated data that server provides, for the various status informations (comprising failure exception situation) of needed physics peripheral hardware, only need to simulate and generate and can obtain in the application software of server.
Step S3: the device data returning in described access process is back to described application program;
In one embodiment, the process of step S3 specifically comprises:
The device data obtaining unpacking by driver is resolved, and obtains the required physics peripheral hardware status information of application program, by this physics peripheral hardware status information transmission to application program.
Utilize technology of the present invention, in embedded system, the driver access interface that the application program of application layer provides by call operation system, driver parses the association requests information of application program access driver, and by communication interface, sends to server end after solicited message is re-started to group bag according to the protocol format of setting.The packet that driver reception server end is responded simultaneously, making in this way the information of the physics peripheral hardware that application program obtains is to derive from the data that server end transmits, in the server end information of analog physical peripheral hardware easily, comprise the simulation of various abnormal informations and malfunction, without the physics peripheral hardware to actual, do corresponding change.
For the method for more clear application program access physics peripheral hardware of the present invention, below by an application example, set forth the main flow process of the method.
In this example, the server of setting up is realized by embedded system, and the device data of physics peripheral hardware is stored in server after generating by simulation.
As shown in Figure 3, Fig. 3 shows the application system of an embodiment and the structural representation of server inside, application system comprises: the first application program, first drives access interface, the first driver, first network DLL (dynamic link library) and the first communication interface, and server comprises: second communication interface, the second driver, second drive access interface, the second application program and storage unit.
Data interaction and processing procedure between above-mentioned application system and server specifically comprise the steps:
Step S301, the first driving access interface that the first application program is used operating system to provide, access the first driver;
Step S302, the first driver receive the first application program to the request of access of physics peripheral hardware after, resolve the first application program and need to access the solicited message that physics peripheral hardware is relevant and obtain visit data, according to the protocol format of setting, visit data is packaged;
Step S303, the first driver is by calling first network DLL (dynamic link library) by Packet Generation to the first communication interface;
Step S304, the first communication interface passes to the packet of receiving on network;
Step S305, packet through Internet Transmission to second communication interface;
Step S306, second communication interface receives packet;
Step S307, the second network port driving program receives the packet that network interface is received;
Step S308, the second application call second drives access interface to obtain packet, according to the protocol format of setting, packet is unpacked, and resolves visit data;
Step S309, the second application program is obtained the device data of the physics peripheral hardware in storage unit, according to the protocol format of setting, the device data obtaining is packaged, and obtains reply data bag;
Step S310, the second application call second drives interface to send reply data bag;
Step S311, reply data bag is delivered to the second driver by the second driving access interface;
Step S312, the second driver is received after data, calls second communication interface and sends reply data bag;
Step S313, reply data bag process Internet Transmission is to application system;
Step S314, application system receives reply data bag by the first communication interface;
Step S315, the first driver is received after reply data bag, reply data bag is unpacked and resolved;
Step S316, the first driver replies to the first called application program by the device data parsing;
Step S317, the first application program receives the device data that the first driver is responded, and completes the operation that data are set to physics peripheral hardware.
Between application system and server in data transfer, the first application program for application system, access after the first communication interface calling the first driver, accessing request information sends to server by the first communication interface, the status information of equipment of the physics peripheral hardware that application program is obtained is to derive from the virtual unit information that server provides, rather than the information of actual physics peripheral hardware, realized in the function that drives layer simulation virtual peripheral.
Application program and the server of setting forth the application system of a preferred embodiment below carry out data exchange processing process, as shown in Figure 4, specifically comprise the steps:
Step S401, the first application call first drives access interface, and access the first driver also sends setting formatted request information data to the first driver;
Step S402, the first driver receives after solicited message data, and it is resolved and obtains visit data, judges that whether data layout is correct, if step S401 is returned in format error simultaneously;
Step S403, the first driver adds self relevant information and agreement control relevant information at visit data, according to the protocol format of setting, packages;
Step S404, the packet that the first driver obtains group bag sends to server by the first communication interface, and whether monitoring simultaneously sends successful, if step S401 is returned in process of transmitting failure;
Step S405, the first driver enters the state of the reply data bag of waiting for server;
Step S406, judges that whether the first driver wait acknowledge packet procedures is overtime, if overtime, returns to step S401;
Step S407, unpacks if receive reply data Bao Ze, if step S401 is returned in data protocol format error;
Step S408, the first driver is resolved the data content of reply data bag, if data content information is not mated, returns to step S401;
Step S409, the data content that the first driver obtains parsing, is back to application program according to the data layout of setting.
Set forth application program and the application system of the server of a preferred embodiment below and carry out data exchange processing process, as shown in Figure 5, specifically comprise the steps:
Step S501, the second application program is monitored second communication interface and is waited for reception visit data bag;
Step S502, when receiving visit data bag, the second application program receives complete visit data bag by second communication interface;
Step S503, the second application program, according to the protocol format of setting, is unpacked and resolves the visit data bag receiving;
Step S504,, whether the protocol format of the second application program test access packet is correct, if mistake is returned to step S501;
Step S505, whether the data content information that the second application program judgement parses mates, if do not mate, returns to step S501;
Step S506, the second application program operates the application data in storage unit accordingly according to the data content of resolving, particularly, if current data content is that application data is upgraded for physics peripheral hardware information operating is set; If read physics peripheral hardware information operating, directly inquire about application data;
Step S507, the second application program is organized relevant reply data;
Step S508, the second application program adds the relevant informations such as agreement and control in reply data, and packages and obtain reply data bag;
Step S509, the second application program is sent to application system by reply data bag by second communication interface.
In addition, in to the design of the second application program of server, it is also conceivable that the support adding UI, various physics peripheral hardware information can show by interactive interface, supports, by interactive interface, physics peripheral hardware information is set.
By adopting the mentality of designing of UI interactive interface, make the test job of software can be more directly perceived, tester directly arranges physics peripheral hardware information at interactive interface, and does not need to be concerned about the realization of bottom.
Below in conjunction with accompanying drawing, the embodiment of the method correspondence system of application program access physics peripheral hardware of the present invention is described in detail.
As shown in Figure 6, Fig. 6 shows the structural representation of system of the application program access physics peripheral hardware of an embodiment, mainly comprises: simulation virtual peripheral unit 100, virtual peripheral addressed location 200 and return data resolution unit 300.
Wherein:
Simulation virtual peripheral unit 100 is for simulating the device data that generates the physics peripheral hardware that application program need to access;
Virtual peripheral addressed location 200 is for accessing described device data according to the solicited message of described application program access physics peripheral hardware;
Return data resolution unit 300 is back to described application program for the device data that described access process is returned.
As shown in Figure 7, Fig. 7 shows the structural representation of system of the application program access physics peripheral hardware of a preferred embodiment.
In one embodiment, simulation virtual peripheral unit 100 comprises:
Server is set up module 101, for setting up one for the server of analog physical peripheral hardware;
Physics peripheral hardware analog module 102, for the physics peripheral hardware that need to access according to application program, in described server, simulation generates the device data corresponding with this physics peripheral hardware.
In embedded software developing process, conventionally need to consider to process the abnormal conditions of various physics peripheral hardwares, by server, simulate the abnormality that produces desired various physics peripheral hardware faults, without actual physics peripheral hardware is modified as to corresponding abnormality, can in the treatment scheme of this type of fault, test software, greatly improve the testability of software.
It should be noted that, except utilizing above-mentioned server, can also there is the software of similar functions or the device data that hardware simulation generates physics peripheral hardware by other.
In one embodiment, virtual peripheral addressed location 200 comprises:
Solicited message parsing module 201, resolves for the solicited message of application programs access physics peripheral hardware;
Device data access modules 202, for the device data of server described in the described request message reference according to after resolving.
Device data access modules 202, in access means data procedures, is further used for:
By resolving the visit data of described request information acquisition, according to the protocol format of setting, package;
The visit data bag described group of bag being obtained by communication interface is sent to described server;
In described server, described visit data bag is unpacked and resolved;
Visit information according in described visit data bag obtains corresponding reply data from device data;
Described reply data is packaged according to the protocol format of setting;
The reply data bag described group of bag being obtained by communication interface is sent to described driver;
By driver, receive the reply data bag that described server returns, described reply data bag is unpacked and obtained the required device data of application program.
By the access to the device data of simulation generation, the information of the physics peripheral hardware of the required access of application program, reality all derives from the simulated data that server provides, for the various status informations (comprising failure exception situation) of needed physics peripheral hardware, only need to simulate and generate and can obtain in the application software of server.
In one embodiment, return data resolution unit 300 is further used for:
By driver, the described device data obtaining of unpacking is resolved, obtains the required physics peripheral hardware status information of application program, by this physics peripheral hardware status information transmission to described application program.
The method and system of the application program access physics peripheral hardware of comprehensive above-described embodiment, has following obvious feature and beneficial effect:
(1) there is high operability, can simulate the state of various physics peripheral hardwares and not need actual physics peripheral hardware to carry out any modification and adjustment; Also can simulate in system hardware environment and non-existent physics peripheral hardware simultaneously.
(2) in software debugging process, even if the physics peripheral hardware in system hardware environment cannot be used, can, by driving the access of layer simulation to this equipment, just can not have influence on the commissioning work of software yet yet, improve the efficiency of software commissioning, ensured the development progress of software.
(3) at Server development, go out the graphical interaction interface that support hardware peripheral hardware state shows, only need interactive interface to revise to arrange the information such as state, register value of hardware adaptor, just can simulate well various peripheral hardware abnormality, now whether the abnormality processing flow process of verifying software design reaches expection requirement easily.
(4) can erect easily standardized test platform, and provide standardization, batch testing application to support, at the handling procedure of server, support various test script application simultaneously.
The above embodiment has only expressed several embodiment of the present invention, and it describes comparatively concrete and detailed, but can not therefore be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that for the person of ordinary skill of the art, without departing from the inventive concept of the premise, can also make some distortion and improvement, these all belong to protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210376679.5A CN103713934A (en) | 2012-09-29 | 2012-09-29 | Method and system for application program visiting physical peripheral |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210376679.5A CN103713934A (en) | 2012-09-29 | 2012-09-29 | Method and system for application program visiting physical peripheral |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103713934A true CN103713934A (en) | 2014-04-09 |
Family
ID=50406937
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210376679.5A Pending CN103713934A (en) | 2012-09-29 | 2012-09-29 | Method and system for application program visiting physical peripheral |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103713934A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117270A (en) * | 2015-07-29 | 2015-12-02 | 百度在线网络技术(北京)有限公司 | Sensor simulation method and apparatus |
CN107807545A (en) * | 2016-09-08 | 2018-03-16 | 北京京东尚科信息技术有限公司 | The adjustment method and device of a kind of remote control terminal |
CN113157382A (en) * | 2020-12-16 | 2021-07-23 | 建信金融科技有限责任公司 | Virtual drive-based equipment calling method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101635715A (en) * | 2009-05-31 | 2010-01-27 | 北京飞天诚信科技有限公司 | Method and system for improving network application safety |
CN102354298A (en) * | 2011-07-27 | 2012-02-15 | 哈尔滨工业大学 | Software testing automation framework (STAF)-based fault injection automation testing platform and method for high-end fault-tolerant computer |
US20120054553A1 (en) * | 2010-09-01 | 2012-03-01 | International Business Machines Corporation | Fault localization using condition modeling and return value modeling |
CN102662843A (en) * | 2012-04-11 | 2012-09-12 | 贵州航天风华精密设备有限公司 | Software testing method capable of simulating abnormality of spacecraft equipment |
-
2012
- 2012-09-29 CN CN201210376679.5A patent/CN103713934A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101635715A (en) * | 2009-05-31 | 2010-01-27 | 北京飞天诚信科技有限公司 | Method and system for improving network application safety |
US20120054553A1 (en) * | 2010-09-01 | 2012-03-01 | International Business Machines Corporation | Fault localization using condition modeling and return value modeling |
CN102354298A (en) * | 2011-07-27 | 2012-02-15 | 哈尔滨工业大学 | Software testing automation framework (STAF)-based fault injection automation testing platform and method for high-end fault-tolerant computer |
CN102662843A (en) * | 2012-04-11 | 2012-09-12 | 贵州航天风华精密设备有限公司 | Software testing method capable of simulating abnormality of spacecraft equipment |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105117270A (en) * | 2015-07-29 | 2015-12-02 | 百度在线网络技术(北京)有限公司 | Sensor simulation method and apparatus |
CN105117270B (en) * | 2015-07-29 | 2019-04-12 | 百度在线网络技术(北京)有限公司 | A kind of method and apparatus for analog sensor |
CN107807545A (en) * | 2016-09-08 | 2018-03-16 | 北京京东尚科信息技术有限公司 | The adjustment method and device of a kind of remote control terminal |
CN113157382A (en) * | 2020-12-16 | 2021-07-23 | 建信金融科技有限责任公司 | Virtual drive-based equipment calling method and device |
CN113157382B (en) * | 2020-12-16 | 2023-03-28 | 建信金融科技有限责任公司 | Virtual drive-based equipment calling method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109039824B (en) | Automatic test system and method for wireless remote communication protocol of vehicle-mounted terminal | |
CN103178996A (en) | Distributed packet-switching chip model verification system and method | |
CN113342583A (en) | Chip verification system, method, device, equipment and storage medium | |
US20080229150A1 (en) | Address translation system for use in a simulation environment | |
CN116028292B (en) | Simulation verification system and method for remote direct memory access simulation verification | |
US20150193332A1 (en) | Systems and methods for regulatory compliance with qualified systems | |
CN110071822A (en) | A kind of test device and test method for 5G core-network infrastructure | |
CN111355632A (en) | SIPP-based performance test method and device, computer equipment and storage medium | |
CN108664385A (en) | A kind of test method and device of application programming interface | |
CN116681013A (en) | Simulation verification method, platform, device, equipment and medium of network chip | |
WO2008113706A2 (en) | Address translation system for use in a simulation environment | |
CN110489245A (en) | Fault filling method and system based on remote procedure call | |
CN117061371A (en) | Testing method and system for energy products | |
CN117041111A (en) | Vehicle cloud function test method and device, electronic equipment and storage medium | |
CN103713934A (en) | Method and system for application program visiting physical peripheral | |
CN112838938B (en) | Test system of Internet of things platform | |
US7873498B2 (en) | Remote hardware inspection system and method | |
TW201321765A (en) | Automatic test system of communication device | |
CN107229567A (en) | A kind of IPMI firmwares automatization test system | |
CN117130933A (en) | Baffle service method, system, equipment and storage medium | |
CN107368425A (en) | A kind of openstack method of testings | |
AU2011217727B2 (en) | Co-design of a testbench and driver of a device | |
CN117130865A (en) | A sensor parameter configuration method, device, equipment and readable storage medium | |
CN109086200A (en) | A kind of validity test frame based on the modification of Android virtual machine | |
US20050251564A1 (en) | Remote instrument control by multiple clients |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20140409 |
|
RJ01 | Rejection of invention patent application after publication |