WO2017101247A1 - Self-service equipment hardware management method and device - Google Patents
Self-service equipment hardware management method and device Download PDFInfo
- Publication number
- WO2017101247A1 WO2017101247A1 PCT/CN2016/081805 CN2016081805W WO2017101247A1 WO 2017101247 A1 WO2017101247 A1 WO 2017101247A1 CN 2016081805 W CN2016081805 W CN 2016081805W WO 2017101247 A1 WO2017101247 A1 WO 2017101247A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- instance
- application
- port
- module
- control
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5022—Mechanisms to release resources
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2209/00—Indexing scheme relating to G06F9/00
- G06F2209/50—Indexing scheme relating to G06F9/50
- G06F2209/5013—Request control
Definitions
- the present invention relates to the field of self-service device control technologies, and in particular, to a self-service device hardware management method and apparatus.
- the communication control of the self-service terminal device module is generally performed by serial port or USB.
- One module usually only performs connection control through one communication line, which causes the control of the device by different applications to be physically exclusive and exclusive access.
- DLL dynamic link library
- Such a process has the following problems: 1. Reduce the efficiency of the application to device control. Both applications need to continuously acquire and release links, consume link resources, and waste processing time. 2. The two applications cannot coexist at the same time, reducing the user's experience with the self-service terminal device.
- the embodiment of the invention provides a self-service device hardware management method and device, which can solve the problem that the two technologies cannot coexist at the same time in the prior art, and the two application functions need to be completed at the same time.
- the application scenario cannot be implemented, and the technical problem of controlling the hardware control efficiency of the device is reduced.
- the determining is further: determining whether the port required to be called by the application is occupied, and if so, controlling the application to re-allocate the port to be called, and if not, the device to be invoked according to the application And create a new instance of the port;
- the device is controlled according to the application and the newly created instance.
- the reference count of the existing instance is incremented by 1 before the device is controlled according to the application and the existing instance;
- the reference count of the newly created instance is incremented by 1 before the device is controlled according to the application and the newly created instance;
- the reference count of the corresponding instance is decremented by one
- the instance information of the newly created instance is saved in a preset device instance table, where the instance information includes the newly created instance.
- the device state information is obtained and returned from the device instance table.
- the device when the device is controlled according to the application, whether the device is in a normal state is determined according to the acquired device state information of the device, and if yes, the device is not initialized, and the device is directly controlled to work.
- a first obtaining module configured to acquire a device and a port that the application needs to call when the application is running
- An instance judgment module is configured to determine whether there is a device and a port that the existing instance calls the required call;
- a first control module configured to: when the judgment result of the existing instance judgment module is YES, control the device according to the application program and the existing instance;
- a port occupancy judging module configured to determine, when the judgment result of the existing instance judging module is negative, whether the port that the application program needs to be called is occupied;
- a redistribution module configured to: when the judgment result of the port occupation judging module is yes, control the application to reallocate a port to be called;
- the new instance module is configured to: when the judgment result of the port occupation judgment module is negative, create an instance according to the device and port to be invoked by the application;
- a second control module configured to control the device according to the application and the newly created instance.
- the device comprises:
- a first reference counting module configured to add a reference count of the existing instance by 1 before the first control module controls the device according to the application and the existing instance;
- a second reference counting module configured to add a reference count of the newly created instance by 1 before the second control module controls the device according to the application and the newly created instance;
- a third reference counting module configured to: when the application exits and control the device, the reference count of the corresponding instance is decreased by 1;
- the instance delete module is configured to delete the instance when the reference count of the instance is 0.
- the device comprises:
- An instance information saving module configured to save the instance information of the newly created instance to a preset device instance table after the newly created instance module creates an instance according to the device and the port that is to be invoked by the application, the instance
- the information includes the device name of the device invoked by the newly created instance, the port number of the called port, the corresponding reference count, and the device status information of the called device.
- the device comprises:
- a status information update module configured to acquire device status information of the device in real time, and update the device status information to the device instance table
- the status information obtaining module is configured to acquire and return the device status information from the device instance table when the device status information of the device controlled by the application is required to be acquired.
- the device comprises:
- a device status determining module configured to determine, according to the acquired device state information of the device, whether the device is in a normal state when the first control module or the second control module controls the device according to the application program;
- the direct control module is configured to: when the judgment result of the device state judging module is YES, perform an initialization operation of the device, and directly control the working of the device.
- the device and the port that are required to be called by the application are acquired; then, it is determined whether there is an existing instance calling the device and the port that is required to be called, and if so, according to The application and the existing instance control device, if not, make further determination; then further determine whether the port that the application needs to call is occupied, and if so, control the application to reallocate the required call Port, if not, create an instance based on the device and port that the application needs to call; finally, control the device based on the application and the newly created instance.
- the hardware management method of the self-service device can solve the problem that the existing technology cannot realize the simultaneous coexistence of two applications, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the technology for reducing the hardware control efficiency of the device is reduced. problem.
- FIG. 1 is a flowchart of an embodiment of a self-service device hardware management method according to an embodiment of the present invention
- FIG. 2 is a flowchart of another embodiment of a self-service device hardware management method according to an embodiment of the present invention
- FIG. 3 is a structural diagram of an embodiment of a self-service device hardware management apparatus according to an embodiment of the present invention.
- FIG. 4 is a structural diagram of another embodiment of a self-service device hardware management apparatus according to an embodiment of the present invention.
- the embodiments of the present invention provide a self-service device hardware management method and device, which are used to solve the problem that the two technologies cannot coexist at the same time in the prior art, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the device hardware is reduced. Technical issues that control efficiency.
- an embodiment of a self-service device hardware management method includes:
- step 102 judging whether there is an existing instance to call the device and port to be called, if yes, proceed to step 103, and if not, proceed to step 104;
- step 103 After running the application, after obtaining the device and port that the application needs to call, it can be determined whether there is an existing instance calling the device and port that is required to be called. If yes, step 103 is performed, and if not, step 104 is performed. .
- the device is controlled according to the application and the existing instance.
- step 104 determines whether the port required to be called by the application is occupied, and if so, step 105 is performed, and if not, step 106 is performed;
- step 105 If it is determined that there is no device and port that the existing instance calls the required call, it is further determined whether the port that the application needs to call is occupied. If yes, step 105 is performed, and if no, step 106 is performed.
- the application is controlled to reallocate the port to be called.
- the device and the port that the application needs to be called are acquired; then, it is determined whether there is an existing instance calling the device and port that is required to be called, and if so, according to the application And the existing instance control device, if not, make further judgment; then further determine whether the port that the application needs to call is occupied, and if so, control the application to re-allocate the port to be called, if not, then Create an instance based on the device and port that the application needs to call; finally, control the device based on the application and the newly created instance.
- the hardware management method of the self-service device can solve the problem that the two technologies cannot coexist at the same time in the prior art, and the application scenario that needs to complete the two application functions at the same time cannot be implemented, and the technical problem of reducing the hardware control efficiency of the device is reduced. .
- FIG. 2 another embodiment of the self-service device hardware management method in the embodiment of the present invention includes:
- the device and port that the application needs to call when you run the application, get the device and port that the application needs to call. It can be understood that when the application needs to call the device hardware, it needs both the device to be called and the port corresponding to the device. In general, the port is assigned by the application itself. In this embodiment, the device name and port number of the device can be obtained to obtain the device and port that the application needs to invoke.
- Step 202 Determine whether an existing instance calls the device and port that are required to be called, and if yes, execute Step 203, if no, step 205 is performed;
- step 203 After obtaining the device and port that the application needs to call, it can be determined whether there is an existing instance calling the device and port that is required to be called. If yes, step 203 is performed, and if not, step 205 is performed. It can be understood that the system may already be running another application or applications before running the application, so there are existing instances in the system that call certain devices and ports. When it is found that there is an existing instance calling the device and port of the required call, it indicates that the existing instance can be called by the application without wasting resources to re-establish a new instance.
- the reference count of the existing instance is increased by one;
- the reference count of the existing instance is incremented by one.
- each instance can contain the "reference count” attribute, and the "reference count” attribute indicates how many applications are currently called by the instance. For example, assuming that the reference count for instance A is 2, it means that instance A is currently being called by 2 applications.
- the device can be controlled according to the application and the existing instance.
- step 205 determine whether the port required to be called by the application is occupied, and if so, proceed to step 206, and if not, proceed to step 207;
- step 206 it is further determined whether the port that the application needs to call is occupied. If yes, step 206 is performed, and if no, step 207 is performed. It can be understood that when there is no device and port that the existing instance calls the required call, it means that an instance needs to be created for the application, and if the port is occupied, the instance cannot be created according to the port, so Need to determine if the port that the application needs to call is occupied.
- the application is controlled to reallocate the port to be called.
- reassigned port is not occupied, a new instance can be created; if the reassigned port is still occupied, it is re-allocated until the assigned port is not occupied, and then a new instance is created.
- an instance can be created according to the device and port that the application needs to call.
- the instance information of the newly created instance may be saved to a preset device instance table, where the instance information includes the device name of the device invoked by the newly created instance.
- the port number of the called port, the corresponding reference count, and the device status information of the called device can be as follows:
- the instance information of each instance is saved in the device instance table.
- the device status information of the device can be obtained in real time, and the device status information is updated to the device instance. Table; when the device status information of the device controlled by the application needs to be obtained, the device status information is obtained and returned from the device instance table.
- the reference count for this newly created instance is incremented by one before the device is controlled according to the application and the newly created instance.
- the device when the device is controlled according to the application, in order to improve the efficiency of the operation, the device may be determined according to the obtained device state information of the device, and if so, the device is not initialized. Control the device to work. There is no need to initialize the device before each control device, which reduces the wear and tear of the device.
- step 211 Determine whether the application exits and control the device. If yes, execute step 212. If not, the reference count of the corresponding instance remains unchanged.
- step 212 After controlling the device according to the application and the newly created instance, it can be determined whether the application exits and controls the device, and if so, step 212 is performed, and if not, the reference count of the corresponding instance remains unchanged.
- the reference count of the corresponding instance is decreased by 1;
- the reference count of the corresponding instance is decremented by one.
- the instance When the instance's reference count is 0, the instance is deleted. It can be understood that when the reference count of the instance is 0, it indicates that the instance is not currently called by any application, so in order to save system resources, the instance can be deleted.
- Scenario 1 Normal: Two applications control the same device through the same port.
- the first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device.
- the device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device is successfully opened.
- the device port 2 is occupied, and the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1.
- the table structure is as follows:
- the first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
- the second application App2.exe calls the same port specified by the device management (such as serial COM2) to open the same device.
- the device manager uses the device name + serial port number to find out whether the device connection instance exists in the device instance table. Exist, use an existing instance. If it does not exist, check whether it is the same port. If it is the same port, it will fail. App2.exe needs to reset the new serial port ID or device name and then re-execute step 3. If it is a different port, create a new device connection instance and follow the specified
- the device name + port opens the physical device. In this example, specify the same port with the same device name, use the existing instance, that is, share the same instance.
- the second application invokes the device manager initialization (Init) command. Since the physical operation of the initialization command is time consuming, the device manager obtains the current state of the device. If it is in a normal state, the hardware device is not physically initialized. Return directly to success. In this way, the efficiency of command execution is improved, and the wear of the device is reduced.
- the first application calls the device manager's cash-out instruction, and the device manager calls the hardware dynamic library to issue the banknotes, and updates the device state information corresponding to the device instance in the device manager (as in step 1). Table Structure).
- the second application invokes the acquisition status command of the device manager, and the device manager directly returns the status information of the device from the device instance table (ie, the memory data), without operating the hardware device, improving the efficiency of acquiring the device state information. .
- a status query thread periodically acquires the hardware status of the device in the device manager, ensuring that the status in the device manager memory is real-time.
- the first application calls the device manager's command to shut down the device.
- the device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
- the second application invokes the device manager's command to shut down the device.
- the device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
- Scenario 2 Two applications control different devices through the same port.
- the first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device.
- the device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device port 2 is opened successfully. Occupied, the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1.
- the first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
- the second application App2.exe calls the specified port of the device management (such as serial port COM2) to open another different device.
- the device manager uses the device name + serial port number to find out whether the device connection instance exists. If it exists, the current use Some examples. If it does not exist, check whether it is the same port. If it is the same port, it will fail. App2.exe needs to reset the new serial port ID or device name and then re-execute step 3. If it is a different port, create a new device connection instance and follow the specified
- the device name + port opens the physical device. In this example, specifying the same port but using a different device name fails to return to open the device.
- Scenario 3 Two applications control different devices through different ports.
- the first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device.
- the device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device is successfully opened.
- the device port 2 is occupied, and the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1.
- the first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
- the second application App2.exe calls the specified port of the device management (such as serial port COM2) to open another different device.
- the device manager uses the device name + serial port number to find out whether the device connection instance exists. If it exists, the current use Some examples. If it does not exist, check whether it is the same port. If it is the same port, it will fail. If it is a different port, create a new device connection instance and open the physical device according to the specified device name + port. In this example, you specify a different device with a different device name and create a new device connection instance.
- the second application invokes the initialization command of the device manager. Since the instance corresponding to the request in the device manager is the first initialization operation, the device manager invokes the initialization command of the hardware dynamic library to complete the initialization of the device. There are physical actions.
- the first application calls the device manager's cash-out instruction, and the device manager calls the hardware dynamic library to issue the money to the device.
- the second application invokes the device manager's get state command, and the device manager returns the state of the device in memory.
- the first application calls the device manager's command to shut down the device.
- the device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
- the second application invokes the device manager's command to shut down the device.
- the device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
- an embodiment of the self-service device hardware management device in the embodiment of the present invention includes:
- a first obtaining module 301 configured to acquire a required call of the application when the application is run Devices and ports;
- the existing instance determining module 302 is configured to determine whether there is an existing instance calling the device and the port that is required to be called;
- the first control module 303 is configured to: when the judgment result of the existing instance determination module 302 is YES, control the device according to the application program and the existing instance;
- the port occupancy judging module 304 is configured to: when the judgment result of the existing instance judging module 302 is negative, determine whether the port that the application program needs to be called is occupied;
- the redistribution module 305 is configured to, when the result of the determination by the port occupancy determining module 304 is YES, control the application to re-allocate the port to be called;
- the new instance module 306 is configured to: when the judgment result of the port occupation determining module 304 is negative, create an instance according to the device and port that the application needs to invoke;
- the second control module 307 is configured to control the device according to the application and the newly created instance.
- the first obtaining module 301 acquires the device and port that the application needs to call; then, the existing instance determining module 302 determines whether there is an existing instance calling the required call.
- the device and the port when the judgment result of the existing instance judging module 302 is YES, the first control module 303 controls the device according to the application program and the existing instance; when the judgment result of the existing instance judging module 302 is no
- the port occupancy determining module 304 determines whether the port to be called by the application is occupied; then, when the result of the port occupancy determining module 304 is YES, the redistribution module 305 controls the application to reallocate the port to be called.
- the new instance module 306 creates an instance according to the device and port that the application needs to call; finally, the second control module 307 according to the application and the newly created instance. controlling device.
- the self-service device hardware management device can solve the technical problem that the existing technology cannot realize the simultaneous coexistence of two applications, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the control efficiency of the device hardware is reduced. .
- FIG. 4 another embodiment of the self-service device hardware management device in the embodiment of the present invention includes:
- a first obtaining module 401 configured to acquire a required call of the application when the application is run Devices and ports;
- the existing instance determining module 402 is configured to determine whether there is an existing instance calling the device and the port that is required to be called;
- the first control module 403 is configured to: when the judgment result of the existing instance determination module 402 is YES, control the device according to the application program and the existing instance;
- the port occupancy judging module 404 is configured to determine, when the judgment result of the existing instance judging module 402 is negative, whether the port to be called by the application program is occupied;
- the redistribution module 405 is configured to, when the result of the determination by the port occupancy determining module 404 is YES, control the application to reallocate the port to be called;
- the new instance module 406 is configured to: when the judgment result of the port occupation determining module 404 is negative, create an instance according to the device and port that the application needs to invoke;
- the second control module 407 is configured to control the device according to the application and the newly created instance.
- the first reference counting module 408 is configured to: before the first control module 403 controls the device according to the application and the existing instance, the reference count of the existing instance is incremented by one;
- a second reference counting module 409 configured to add a reference count of the newly created instance by 1 before the second control module 407 controls the device according to the application and the newly created instance;
- the third reference counting module 410 is configured to: when the application exits and control the device, the reference count of the corresponding instance is decreased by 1;
- the instance deletion module 411 is configured to delete the instance when the reference count of the instance is 0.
- the instance information saving module 412 is configured to save the instance information of the newly created instance to a preset device instance table after the new instance module 406 creates an instance according to the device and the port that the application needs to invoke, and the instance information is The device name of the device called by the newly created instance, the port number of the called port, the corresponding reference count, and the device status information of the called device.
- the status information update module 413 is configured to acquire device status information of the device in real time, and update the device status information to the device instance table.
- a status information obtaining module 414 configured to acquire a device of the device controlled by the application When the status information is obtained, the device status information is obtained and returned from the device instance table.
- the device status determining module 415 is configured to determine, according to the acquired device state information of the device, whether the device is in a normal state when the first control module 403 or the second control module 407 controls the device according to the application program;
- the direct control module 416 is configured to: when the determination result of the device status determination module 415 is YES, the initialization operation of the device is not performed, and the device is directly controlled to work.
- the disclosed system, apparatus, and method may be implemented in other manners.
- the device embodiments described above are merely illustrative.
- the division of the unit is only a logical function division.
- there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
- the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
- the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
- each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
- the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
- the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
- the storage medium includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
- the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Stored Programmes (AREA)
Abstract
An embodiment of the present invention discloses a method for self-service equipment hardware management for solving the inability of the prior art to allow two application programs to coexist further resulting in an inability to accomplish an application scenario requiring simultaneous completion of functions by two application programs. The method thereby alleviates the technical problem of poor control efficiency of equipment hardware control. The embodiment of the present invention comprises: when an application program is running, acquire an equipment and a port required for use by the application program; determine whether the equipment and the port exists, if so, then control the equipment on the basis of the application program and an existing instance, and if not, then make a further determination; the further determination determines whether the port required for use by the application program has been occupied, if so, then control the application program to reassign the port required for use, and if not, then establish a new instance on the basis of the equipment and the port required for use by the application program; and control the equipment on the basis of the application program and the new instance. The embodiment of the present invention also provides a self-service equipment hardware management device.
Description
本申请要求于2015年12月18日提交中国专利局、申请号为201510967254.5、发明名称为“一种自助设备硬件管理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201510967254.5, entitled "A Self-Service Hardware Management Method and Apparatus", filed on December 18, 2015, the entire contents of which are incorporated herein by reference. In the application.
本发明涉及自助设备控制技术领域,尤其涉及一种自助设备硬件管理方法和装置。The present invention relates to the field of self-service device control technologies, and in particular, to a self-service device hardware management method and apparatus.
对自助终端设备模块的通信控制一般采用串口或USB进行,一个模块通常只会通过一条通信线路进行连接控制,这就导致了不同应用程序对设备的控制从物理上只能排他互斥地访问。而在实际的应用场景中,通常会有多个应用程序需要对同一模块进行控制,比如两个应用程序都需要控制机芯,其中一个应用程序进行出钞、另外一个应用程序进行获取机芯的设备状态,为了满足这种场景的需求,目前,国内外通常的做法是:为一个模块开发一个硬件设备控制DLL(动态链接库),不同应用程序分别加载该DLL的不同实例完成对设备的独占访问控制,当需要多个应用程序访问该设备时,需要一个应用程序完成控制后退出对设备链路的占用,然后由另一个应用程序获得设备链路的占用后进行控制。The communication control of the self-service terminal device module is generally performed by serial port or USB. One module usually only performs connection control through one communication line, which causes the control of the device by different applications to be physically exclusive and exclusive access. In actual application scenarios, there are usually multiple applications that need to control the same module. For example, two applications need to control the movement, one of which is used to issue money and another application to obtain the movement. Device status, in order to meet the needs of this scenario, at present, the common practice at home and abroad is to develop a hardware device control DLL (dynamic link library) for a module, different applications respectively load different instances of the DLL to complete the exclusive use of the device Access control, when multiple applications are required to access the device, an application is required to complete control and then exit the occupation of the device link, and then another application obtains the occupation of the device link.
这样的处理会存在如下问题:1、降低应用程序对设备控制的效率。两个应用需要不断地获取、释放链路,耗费链路资源,浪费处理时间。2、两个应用程序不能同时共存,降低用户对自助终端设备的体验。Such a process has the following problems: 1. Reduce the efficiency of the application to device control. Both applications need to continuously acquire and release links, consume link resources, and waste processing time. 2. The two applications cannot coexist at the same time, reducing the user's experience with the self-service terminal device.
发明内容Summary of the invention
本发明实施例提供了一种自助设备硬件管理方法和装置,能够解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能
的应用场景无法实现,降低对设备硬件控制效率的技术问题。The embodiment of the invention provides a self-service device hardware management method and device, which can solve the problem that the two technologies cannot coexist at the same time in the prior art, and the two application functions need to be completed at the same time.
The application scenario cannot be implemented, and the technical problem of controlling the hardware control efficiency of the device is reduced.
本发明实施例提供的一种自助设备硬件管理方法,包括:A self-service device hardware management method provided by an embodiment of the present invention includes:
在运行应用程序时,获取所述应用程序所需调用的设备和端口;Get the device and port that the application needs to call when running the application;
判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;Determining whether there is a device and a port that the existing instance calls the required call, and if so, controlling the device according to the application and the existing instance, if not, making further judgment;
所述进一步判断为:判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;The determining is further: determining whether the port required to be called by the application is occupied, and if so, controlling the application to re-allocate the port to be called, and if not, the device to be invoked according to the application And create a new instance of the port;
根据所述应用程序和新建的实例控制设备。The device is controlled according to the application and the newly created instance.
可选地,在根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;Optionally, the reference count of the existing instance is incremented by 1 before the device is controlled according to the application and the existing instance;
在根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;The reference count of the newly created instance is incremented by 1 before the device is controlled according to the application and the newly created instance;
当所述应用程序退出控制所述设备时,对应实例的引用计数减1;When the application exits controlling the device, the reference count of the corresponding instance is decremented by one;
当实例的引用计数为0时,删除所述实例。When the instance's reference count is 0, the instance is deleted.
可选地,在根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。Optionally, after the new device is created according to the device and the port that is to be invoked by the application, the instance information of the newly created instance is saved in a preset device instance table, where the instance information includes the newly created instance. The device name of the calling device, the port number of the called port, the corresponding reference count, and the device status information of the called device.
可选地,实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;Optionally, acquiring device state information of the device in real time, and updating the device state information to the device instance table;
当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。When it is required to acquire device state information of the device controlled by the application, the device state information is obtained and returned from the device instance table.
可选地,当根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制所述设备工作。Optionally, when the device is controlled according to the application, whether the device is in a normal state is determined according to the acquired device state information of the device, and if yes, the device is not initialized, and the device is directly controlled to work.
本发明实施例提供的一种自助设备硬件管理装置,包括:A self-service device hardware management device provided by the embodiment of the invention includes:
第一获取模块,用于在运行应用程序时,获取所述应用程序所需调用的设备和端口;
a first obtaining module, configured to acquire a device and a port that the application needs to call when the application is running;
已有实例判断模块,用于判断是否存在已有实例调用所述所需调用的设备和端口;An instance judgment module is configured to determine whether there is a device and a port that the existing instance calls the required call;
第一控制模块,用于当所述已有实例判断模块的判断结果为是时,根据所述应用程序和所述已有实例控制设备;a first control module, configured to: when the judgment result of the existing instance judgment module is YES, control the device according to the application program and the existing instance;
端口占用判断模块,用于当所述已有实例判断模块的判断结果为否时,判断所述应用程序所需调用的端口是否被占用;a port occupancy judging module, configured to determine, when the judgment result of the existing instance judging module is negative, whether the port that the application program needs to be called is occupied;
重分配模块,用于当所述端口占用判断模块的判断结果为是时,控制所述应用程序重新分配所需调用的端口;a redistribution module, configured to: when the judgment result of the port occupation judging module is yes, control the application to reallocate a port to be called;
新建实例模块,用于当所述端口占用判断模块的判断结果为否时,则根据所述应用程序所需调用的设备和端口新建一个实例;The new instance module is configured to: when the judgment result of the port occupation judgment module is negative, create an instance according to the device and port to be invoked by the application;
第二控制模块,用于根据所述应用程序和新建的实例控制设备。And a second control module, configured to control the device according to the application and the newly created instance.
可选地,所述装置包括:Optionally, the device comprises:
第一引用计数模块,用于在所述第一控制模块根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;a first reference counting module, configured to add a reference count of the existing instance by 1 before the first control module controls the device according to the application and the existing instance;
第二引用计数模块,用于在所述第二控制模块根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;a second reference counting module, configured to add a reference count of the newly created instance by 1 before the second control module controls the device according to the application and the newly created instance;
第三引用计数模块,用于当所述应用程序退出控制所述设备时,对应实例的引用计数减1;a third reference counting module, configured to: when the application exits and control the device, the reference count of the corresponding instance is decreased by 1;
实例删除模块,用于当实例的引用计数为0时,删除所述实例。The instance delete module is configured to delete the instance when the reference count of the instance is 0.
可选地,所述装置包括:Optionally, the device comprises:
实例信息保存模块,用于在所述新建实例模块根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。An instance information saving module, configured to save the instance information of the newly created instance to a preset device instance table after the newly created instance module creates an instance according to the device and the port that is to be invoked by the application, the instance The information includes the device name of the device invoked by the newly created instance, the port number of the called port, the corresponding reference count, and the device status information of the called device.
可选地,所述装置包括:Optionally, the device comprises:
状态信息更新模块,用于实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;a status information update module, configured to acquire device status information of the device in real time, and update the device status information to the device instance table;
状态信息获取模块,用于当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。
The status information obtaining module is configured to acquire and return the device status information from the device instance table when the device status information of the device controlled by the application is required to be acquired.
可选地,所述装置包括:Optionally, the device comprises:
设备状态判断模块,用于当所述第一控制模块或所述第二控制模块根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态;a device status determining module, configured to determine, according to the acquired device state information of the device, whether the device is in a normal state when the first control module or the second control module controls the device according to the application program;
直接控制模块,用于当所述设备状态判断模块的判断结果为是时,则不进行设备的初始化操作,直接控制所述设备工作。The direct control module is configured to: when the judgment result of the device state judging module is YES, perform an initialization operation of the device, and directly control the working of the device.
从以上技术方案可以看出,本发明实施例具有以下优点:It can be seen from the above technical solutions that the embodiments of the present invention have the following advantages:
本发明实施例中,首先,在运行应用程序时,获取所述应用程序所需调用的设备和端口;然后,判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;接着进一步判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;最后,根据所述应用程序和新建的实例控制设备。在本发明实施例中,该自助设备硬件管理方法可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。In the embodiment of the present invention, first, when the application is running, the device and the port that are required to be called by the application are acquired; then, it is determined whether there is an existing instance calling the device and the port that is required to be called, and if so, according to The application and the existing instance control device, if not, make further determination; then further determine whether the port that the application needs to call is occupied, and if so, control the application to reallocate the required call Port, if not, create an instance based on the device and port that the application needs to call; finally, control the device based on the application and the newly created instance. In the embodiment of the present invention, the hardware management method of the self-service device can solve the problem that the existing technology cannot realize the simultaneous coexistence of two applications, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the technology for reducing the hardware control efficiency of the device is reduced. problem.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the description of the prior art will be briefly described below. Obviously, the drawings in the following description are Some embodiments of the present invention may also be used to obtain other drawings based on these drawings without departing from the art.
图1为本发明实施例中一种自助设备硬件管理方法一个实施例流程图;1 is a flowchart of an embodiment of a self-service device hardware management method according to an embodiment of the present invention;
图2为本发明实施例中一种自助设备硬件管理方法另一个实施例流程图;2 is a flowchart of another embodiment of a self-service device hardware management method according to an embodiment of the present invention;
图3为本发明实施例中一种自助设备硬件管理装置一个实施例结构图;3 is a structural diagram of an embodiment of a self-service device hardware management apparatus according to an embodiment of the present invention;
图4为本发明实施例中一种自助设备硬件管理装置另一个实施例结构
图。4 is a structural diagram of another embodiment of a self-service device hardware management apparatus according to an embodiment of the present invention;
Figure.
本发明实施例提供了一种自助设备硬件管理方法和装置,用于解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。The embodiments of the present invention provide a self-service device hardware management method and device, which are used to solve the problem that the two technologies cannot coexist at the same time in the prior art, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the device hardware is reduced. Technical issues that control efficiency.
为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而非全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the object, the features and the advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only a part of the embodiments of the invention, and not all of the embodiments. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
请参阅图1,本发明实施例中一种自助设备硬件管理方法一个实施例包括:Referring to FIG. 1, an embodiment of a self-service device hardware management method according to an embodiment of the present invention includes:
101、在运行应用程序时,获取该应用程序所需调用的设备和端口;101. When running the application, obtain the device and port that the application needs to call;
首先,在运行应用程序时,可以获取该应用程序所需调用的设备和端口。First, when you run the application, you can get the devices and ports that the application needs to call.
102、判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤103,若否,则执行步骤104;102, judging whether there is an existing instance to call the device and port to be called, if yes, proceed to step 103, and if not, proceed to step 104;
在运行应用程序时,获取该应用程序所需调用的设备和端口之后,可以判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤103,若否,则执行步骤104。After running the application, after obtaining the device and port that the application needs to call, it can be determined whether there is an existing instance calling the device and port that is required to be called. If yes, step 103 is performed, and if not, step 104 is performed. .
103、根据该应用程序和该已有实例控制设备;103. Control the device according to the application and the existing instance;
若判断得知存在已有实例调用该所需调用的设备和端口,则根据该应用程序和该已有实例控制设备。If it is determined that there is an existing instance calling the device and port to be called, the device is controlled according to the application and the existing instance.
104、判断该应用程序所需调用的端口是否被占用,若是,则执行步骤105,若否,则执行步骤106;104, determine whether the port required to be called by the application is occupied, and if so, step 105 is performed, and if not, step 106 is performed;
若判断得知不存在已有实例调用该所需调用的设备和端口,则进一步判断该应用程序所需调用的端口是否被占用,若是,则执行步骤105,若否,则执行步骤106。
If it is determined that there is no device and port that the existing instance calls the required call, it is further determined whether the port that the application needs to call is occupied. If yes, step 105 is performed, and if no, step 106 is performed.
105、控制该应用程序重新分配所需调用的端口;105. Control the application to reallocate the port to be called;
若进一步判断得知该应用程序所需调用的端口被占用,则控制该应用程序重新分配所需调用的端口。If it is further determined that the port that the application needs to call is occupied, then the application is controlled to reallocate the port to be called.
106、根据该应用程序所需调用的设备和端口新建一个实例;106. Create an instance according to the device and port that the application needs to call;
若进一步判断得知该应用程序所需调用的端口未被占用,则根据该应用程序所需调用的设备和端口新建一个实例。If it is further determined that the port that the application needs to call is not occupied, a new instance is created according to the device and port that the application needs to call.
107、根据该应用程序和新建的实例控制设备。107. Control the device according to the application and the newly created instance.
在根据该应用程序所需调用的设备和端口新建一个实例之后,可以根据该应用程序和新建的实例控制设备。After you create a new instance of the device and port that you want to invoke based on the application, you can control the device based on the application and the newly created instance.
本实施例中,首先,在运行应用程序时,获取该应用程序所需调用的设备和端口;然后,判断是否存在已有实例调用该所需调用的设备和端口,若是,则根据该应用程序和该已有实例控制设备,若否,则作进一步判断;接着进一步判断该应用程序所需调用的端口是否被占用,若是,则控制该应用程序重新分配所需调用的端口,若否,则根据该应用程序所需调用的设备和端口新建一个实例;最后,根据该应用程序和新建的实例控制设备。在本实施例中,该自助设备硬件管理方法可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。In this embodiment, first, when the application is running, the device and the port that the application needs to be called are acquired; then, it is determined whether there is an existing instance calling the device and port that is required to be called, and if so, according to the application And the existing instance control device, if not, make further judgment; then further determine whether the port that the application needs to call is occupied, and if so, control the application to re-allocate the port to be called, if not, then Create an instance based on the device and port that the application needs to call; finally, control the device based on the application and the newly created instance. In this embodiment, the hardware management method of the self-service device can solve the problem that the two technologies cannot coexist at the same time in the prior art, and the application scenario that needs to complete the two application functions at the same time cannot be implemented, and the technical problem of reducing the hardware control efficiency of the device is reduced. .
为便于理解,下面对本发明实施例中的一种自助设备硬件管理方法进行详细描述,请参阅图2,本发明实施例中一种自助设备硬件管理方法另一个实施例包括:For ease of understanding, a self-service device hardware management method in the embodiment of the present invention is described in detail below. Referring to FIG. 2, another embodiment of the self-service device hardware management method in the embodiment of the present invention includes:
201、在运行应用程序时,获取该应用程序所需调用的设备和端口;201. When running the application, obtain the device and port that the application needs to call;
首先,在运行应用程序时,获取该应用程序所需调用的设备和端口。可以理解的是,当应用程序需要调用设备硬件时,同时需要所需调用的设备,以及与该设备对应的端口。一般来说,端口由应用程序本身分配的。本实施例中,可以通过获取设备的设备名和端口的端口号来获知该应用程序所需调用的设备和端口。First, when you run the application, get the device and port that the application needs to call. It can be understood that when the application needs to call the device hardware, it needs both the device to be called and the port corresponding to the device. In general, the port is assigned by the application itself. In this embodiment, the device name and port number of the device can be obtained to obtain the device and port that the application needs to invoke.
202、判断是否存在已有实例调用该所需调用的设备和端口,若是,则执
行步骤203,若否,则执行步骤205;202. Determine whether an existing instance calls the device and port that are required to be called, and if yes, execute
Step 203, if no, step 205 is performed;
在获取该应用程序所需调用的设备和端口之后,可以判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤203,若否,则执行步骤205。可以理解的是,系统在运行该应用程序之前,可能已经在运行另外的一个或多个应用程序,因此,系统中存在已有实例在调用某些设备和端口。当发现存在已有实例在调用该所需调用的设备和端口时,说明这个已有实例可以被该应用程序所调用,而无需浪费资源重新建立一个新的实例。After obtaining the device and port that the application needs to call, it can be determined whether there is an existing instance calling the device and port that is required to be called. If yes, step 203 is performed, and if not, step 205 is performed. It can be understood that the system may already be running another application or applications before running the application, so there are existing instances in the system that call certain devices and ports. When it is found that there is an existing instance calling the device and port of the required call, it indicates that the existing instance can be called by the application without wasting resources to re-establish a new instance.
203、该已有实例的引用计数加1;203. The reference count of the existing instance is increased by one;
若判断得知存在已有实例调用该所需调用的设备和端口,则该已有实例的引用计数加1。需要说明的是,每个实例均可以包含“引用计数”这条属性,“引用计数”属性表明该实例目前被多少个应用程序所调用。例如,假设实例A的引用计数为2,则表示实例A目前正被2个应用程序调用。If it is determined that there is an existing instance calling the device and port of the required call, the reference count of the existing instance is incremented by one. It should be noted that each instance can contain the "reference count" attribute, and the "reference count" attribute indicates how many applications are currently called by the instance. For example, assuming that the reference count for instance A is 2, it means that instance A is currently being called by 2 applications.
204、根据该应用程序和该已有实例控制设备;204. Control the device according to the application and the existing instance;
在该已有实例的引用计数加1之后,可以根据该应用程序和该已有实例控制设备。After the reference count of the existing instance is incremented by one, the device can be controlled according to the application and the existing instance.
205、判断该应用程序所需调用的端口是否被占用,若是,则执行步骤206,若否,则执行步骤207;205, determine whether the port required to be called by the application is occupied, and if so, proceed to step 206, and if not, proceed to step 207;
若判断得知不存在已有实例调用该所需调用的设备和端口,则进一步判断该应用程序所需调用的端口是否被占用,若是,则执行步骤206,若否,则执行步骤207。可以理解的是,当不存在已有实例调用该所需调用的设备和端口时,意味着需要为该应用程序新建一个实例,而若该端口被占用,则无法根据该端口来新建实例,因此需要判断该应用程序所需调用的端口是否被占用。If it is determined that there is no device and port that the existing instance calls the required call, it is further determined whether the port that the application needs to call is occupied. If yes, step 206 is performed, and if no, step 207 is performed. It can be understood that when there is no device and port that the existing instance calls the required call, it means that an instance needs to be created for the application, and if the port is occupied, the instance cannot be created according to the port, so Need to determine if the port that the application needs to call is occupied.
206、控制该应用程序重新分配所需调用的端口;206. Control the application to reallocate the port to be called;
若判断得知该应用程序所需调用的端口被占用,则控制该应用程序重新分配所需调用的端口。If it is determined that the port that the application needs to call is occupied, then the application is controlled to reallocate the port to be called.
可以理解的是,若重新分配的端口未被占用,则可以进行新建实例;而若重新分配的端口仍被占用,则再重新分配,直到分配到的端口未被占用,然后进行新建实例。
It can be understood that if the reassigned port is not occupied, a new instance can be created; if the reassigned port is still occupied, it is re-allocated until the assigned port is not occupied, and then a new instance is created.
207、根据该应用程序所需调用的设备和端口新建一个实例;207. Create an instance according to the device and port that the application needs to invoke;
若判断得知该应用程序所需调用的端口未被占用,可以根据该应用程序所需调用的设备和端口新建一个实例。If it is determined that the port that the application needs to call is not occupied, an instance can be created according to the device and port that the application needs to call.
208、将新建的实例的实例信息保存到预设的设备实例表中;208. Save the instance information of the newly created instance to a preset device instance table.
在根据该应用程序所需调用的设备和端口新建一个实例之后,可以将新建的实例的实例信息保存到预设的设备实例表中,该实例信息包括该新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。该设备实例表的表结构可以如下:After creating an instance of the device and the port to be invoked according to the application, the instance information of the newly created instance may be saved to a preset device instance table, where the instance information includes the device name of the device invoked by the newly created instance. The port number of the called port, the corresponding reference count, and the device status information of the called device. The table structure of the device instance table can be as follows:
设备名Equipment name | 串口IDSerial port ID | 实例Instance | 应用计数Application count | 设备状态信息Device status information |
需要说明的是,每个实例的实例信息均保存到该设备实例表中,为保证设备实例表的实时有效性,可以实时获取设备的设备状态信息,并将该设备状态信息更新至该设备实例表;当需要获取该应用程序控制的设备的设备状态信息时,从该设备实例表中获取并返回该设备状态信息。It should be noted that the instance information of each instance is saved in the device instance table. To ensure the real-time validity of the device instance table, the device status information of the device can be obtained in real time, and the device status information is updated to the device instance. Table; when the device status information of the device controlled by the application needs to be obtained, the device status information is obtained and returned from the device instance table.
209、该新建的实例的引用计数加1;209. The reference count of the newly created instance is increased by one;
在根据该应用程序和新建的实例控制设备之前,该新建的实例的引用计数加1。The reference count for this newly created instance is incremented by one before the device is controlled according to the application and the newly created instance.
210、根据该应用程序和新建的实例控制设备;210. Control the device according to the application and the newly created instance;
新建实例之后,可以根据该应用程序和新建的实例控制设备。After you create a new instance, you can control the device based on the application and the newly created instance.
需要说明的是,当根据应用程序控制设备时,为提高操作执行的效率,可以根据获取到的该设备的设备状态信息判断该设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制该设备工作。无需每次控制设备工作前均进行初始化,降低了设备的磨损。It should be noted that, when the device is controlled according to the application, in order to improve the efficiency of the operation, the device may be determined according to the obtained device state information of the device, and if so, the device is not initialized. Control the device to work. There is no need to initialize the device before each control device, which reduces the wear and tear of the device.
211、判断该应用程序是否退出控制该设备,若是,则执行步骤212,若否,则对应实例的引用计数保持不变;211. Determine whether the application exits and control the device. If yes, execute step 212. If not, the reference count of the corresponding instance remains unchanged.
在根据该应用程序和新建的实例控制设备之后,可以判断该应用程序是否退出控制该设备,若是,则执行步骤212,若否,则对应实例的引用计数保持不变。
After controlling the device according to the application and the newly created instance, it can be determined whether the application exits and controls the device, and if so, step 212 is performed, and if not, the reference count of the corresponding instance remains unchanged.
212、对应实例的引用计数减1;212, the reference count of the corresponding instance is decreased by 1;
若判断得知该应用程序退出控制该设备,则对应实例的引用计数减1。If it is determined that the application exits the control of the device, the reference count of the corresponding instance is decremented by one.
213、当实例的引用计数为0时,删除该实例。213. When the reference count of the instance is 0, the instance is deleted.
当实例的引用计数为0时,删除该实例。可以理解的是,当实例的引用计数为0时,表明该实例目前未被任何应用程序所调用,因此,为了节省系统资源,可以删除该实例。When the instance's reference count is 0, the instance is deleted. It can be understood that when the reference count of the instance is 0, it indicates that the instance is not currently called by any application, so in order to save system resources, the instance can be deleted.
为便于理解,根据图2所描述的实施例,下面以三个实际应用场景对本发明实施例中的一种自助设备硬件管理方法进行描述:For ease of understanding, according to the embodiment described in FIG. 2, a self-service device hardware management method in the embodiment of the present invention is described in three practical application scenarios:
场景一:正常情况:两个应用程序通过同一端口控制同一设备。Scenario 1: Normal: Two applications control the same device through the same port.
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,新建设备连接实例,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。表结构如下:1. The first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device. The device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device is successfully opened. The device port 2 is occupied, and the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1. The table structure is as follows:
设备名Equipment name | 串口IDSerial port ID | 实例Instance | 应用计数Application count | 设备状态信息Device status information |
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。2. The first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开相同设备,设备管理器采用设备名+串口编号从1中设备实例表查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败,App2.exe需要重新设置新的串口ID或设备名后重新执行步骤3;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。在本例中,指定相同端口采用相同设备名,使用现有的实例,即共享相同实例。3. The second application App2.exe calls the same port specified by the device management (such as serial COM2) to open the same device. The device manager uses the device name + serial port number to find out whether the device connection instance exists in the device instance table. Exist, use an existing instance. If it does not exist, check whether it is the same port. If it is the same port, it will fail. App2.exe needs to reset the new serial port ID or device name and then re-execute step 3. If it is a different port, create a new device connection instance and follow the specified The device name + port opens the physical device. In this example, specify the same port with the same device name, use the existing instance, that is, share the same instance.
4、第二个应用程序调用设备管理器的初始化(Init)命令,由于初始化命令物理操作比较耗时,设备管理器会获取设备当前的状态,如果属于正常状态,不对硬件设备进行物理初始化操作,直接返回成功。这样,即提高了命令执行的效率,又降低了设备的磨损。
4. The second application invokes the device manager initialization (Init) command. Since the physical operation of the initialization command is time consuming, the device manager obtains the current state of the device. If it is in a normal state, the hardware device is not physically initialized. Return directly to success. In this way, the efficiency of command execution is improved, and the wear of the device is reduced.
5、例如,第一个应用程序调用设备管理器的出钞指令,设备管理器调用硬件动态库对设备进行出钞,并更新设备管理器中该设备实例对应的设备状态信息(如步骤1中表结构)。5. For example, the first application calls the device manager's cash-out instruction, and the device manager calls the hardware dynamic library to issue the banknotes, and updates the device state information corresponding to the device instance in the device manager (as in step 1). Table Structure).
6、第二个应用程序调用设备管理器的获取状态指令,设备管理器从设备实例表(即内存数据)中获取设备的状态信息直接返回,不用操作硬件设备,提高了获取设备状态信息的效率。同时,为了提高设备状态信息的及时性,设备管理器中会有一个状态查询线程定时获取设备的硬件状态,确保设备管理器内存中的状态是实时的。6. The second application invokes the acquisition status command of the device manager, and the device manager directly returns the status information of the device from the device instance table (ie, the memory data), without operating the hardware device, improving the efficiency of acquiring the device state information. . At the same time, in order to improve the timeliness of the device status information, a status query thread periodically acquires the hardware status of the device in the device manager, ensuring that the status in the device manager memory is real-time.
7、运行完毕后,第一个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。7. After the run is complete, the first application calls the device manager's command to shut down the device. The device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
8、运行完毕后,第二个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。8. After the run is complete, the second application invokes the device manager's command to shut down the device. The device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
场景二:两个应用程序通过同一端口控制不同的设备。Scenario 2: Two applications control different devices through the same port.
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。1. The first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device. The device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device port 2 is opened successfully. Occupied, the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1.
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。2. The first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开另一个不同设备,设备管理器采用设备名+串口编号查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败,App2.exe需要重新设置新的串口ID或设备名后重新执行步骤3;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。本例中,指定相同端口但是采用不同设备名,返回打开设备失败。3. The second application App2.exe calls the specified port of the device management (such as serial port COM2) to open another different device. The device manager uses the device name + serial port number to find out whether the device connection instance exists. If it exists, the current use Some examples. If it does not exist, check whether it is the same port. If it is the same port, it will fail. App2.exe needs to reset the new serial port ID or device name and then re-execute step 3. If it is a different port, create a new device connection instance and follow the specified The device name + port opens the physical device. In this example, specifying the same port but using a different device name fails to return to open the device.
场景三:两个应用程序通过不同端口控制不同的设备。
Scenario 3: Two applications control different devices through different ports.
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,新建设备连接实例,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。1. The first application App1.exe calls the device manager DeviceServie.exe to specify the port (such as serial port COM2) to open the device. The device manager calls the hardware driver library DevDriver.dll to physically open the device port, and the device is successfully opened. The device port 2 is occupied, and the device manager saves the device connection instance information to the device instance table, and the reference count of the instance is +1.
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。2. The first application calls the initialization command of the device manager, and the device manager calls the hardware driver library to physically initialize the device, and the action hardware is initialized successfully.
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开另一个不同设备,设备管理器采用设备名+串口编号查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。本例中,指定不同端口采用不同设备名,新创建一个设备连接实例。3. The second application App2.exe calls the specified port of the device management (such as serial port COM2) to open another different device. The device manager uses the device name + serial port number to find out whether the device connection instance exists. If it exists, the current use Some examples. If it does not exist, check whether it is the same port. If it is the same port, it will fail. If it is a different port, create a new device connection instance and open the physical device according to the specified device name + port. In this example, you specify a different device with a different device name and create a new device connection instance.
4、第二个应用程序调用设备管理器的初始化命令,由于在设备管理器中该请求对应的实例是第一次进行初始化操作,设备管理器调用硬件动态库的初始化命令完成对设备的初始化,有物理动作。4. The second application invokes the initialization command of the device manager. Since the instance corresponding to the request in the device manager is the first initialization operation, the device manager invokes the initialization command of the hardware dynamic library to complete the initialization of the device. There are physical actions.
5、第一个应用程序调用设备管理器的出钞指令,设备管理器调用硬件动态库对设备进行出钞。5. The first application calls the device manager's cash-out instruction, and the device manager calls the hardware dynamic library to issue the money to the device.
6、第二个应用程序调用设备管理器的获取状态指令,设备管理器在内存中获取设备的状态直接返回。6. The second application invokes the device manager's get state command, and the device manager returns the state of the device in memory.
7、运行完毕后,第一个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。7. After the run is complete, the first application calls the device manager's command to shut down the device. The device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
8、运行完毕后,第二个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。8. After the run is complete, the second application invokes the device manager's command to shut down the device. The device manager logically decrements the reference count of the corresponding device connection instance by one until the reference count is 0 to physically disconnect the device through the hardware driver library.
上面主要描述了一种自助设备硬件管理方法,下面将对一种自助设备硬件管理装置进行详细描述,请参阅图3,本发明实施例中一种自助设备硬件管理装置一个实施例包括:The above describes a hardware management method for the self-service device. A self-service device hardware management device is described in detail below. Referring to FIG. 3, an embodiment of the self-service device hardware management device in the embodiment of the present invention includes:
第一获取模块301,用于在运行应用程序时,获取该应用程序所需调用
的设备和端口;a first obtaining module 301, configured to acquire a required call of the application when the application is run
Devices and ports;
已有实例判断模块302,用于判断是否存在已有实例调用该所需调用的设备和端口;The existing instance determining module 302 is configured to determine whether there is an existing instance calling the device and the port that is required to be called;
第一控制模块303,用于当该已有实例判断模块302的判断结果为是时,根据该应用程序和该已有实例控制设备;The first control module 303 is configured to: when the judgment result of the existing instance determination module 302 is YES, control the device according to the application program and the existing instance;
端口占用判断模块304,用于当该已有实例判断模块302的判断结果为否时,判断该应用程序所需调用的端口是否被占用;The port occupancy judging module 304 is configured to: when the judgment result of the existing instance judging module 302 is negative, determine whether the port that the application program needs to be called is occupied;
重分配模块305,用于当该端口占用判断模块304的判断结果为是时,控制该应用程序重新分配所需调用的端口;The redistribution module 305 is configured to, when the result of the determination by the port occupancy determining module 304 is YES, control the application to re-allocate the port to be called;
新建实例模块306,用于当该端口占用判断模块304的判断结果为否时,则根据该应用程序所需调用的设备和端口新建一个实例;The new instance module 306 is configured to: when the judgment result of the port occupation determining module 304 is negative, create an instance according to the device and port that the application needs to invoke;
第二控制模块307,用于根据该应用程序和新建的实例控制设备。The second control module 307 is configured to control the device according to the application and the newly created instance.
本实施例中,首先,在运行应用程序时,第一获取模块301获取该应用程序所需调用的设备和端口;然后,已有实例判断模块302判断是否存在已有实例调用该所需调用的设备和端口;当该已有实例判断模块302的判断结果为是时,第一控制模块303根据该应用程序和该已有实例控制设备;当该已有实例判断模块302的判断结果为否时,端口占用判断模块304判断该应用程序所需调用的端口是否被占用;接着,当该端口占用判断模块304的判断结果为是时,重分配模块305控制该应用程序重新分配所需调用的端口;当该端口占用判断模块304的判断结果为否时,则新建实例模块306根据该应用程序所需调用的设备和端口新建一个实例;最后,第二控制模块307根据该应用程序和新建的实例控制设备。在本实施例中,该自助设备硬件管理装置可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。In this embodiment, first, when the application is running, the first obtaining module 301 acquires the device and port that the application needs to call; then, the existing instance determining module 302 determines whether there is an existing instance calling the required call. The device and the port; when the judgment result of the existing instance judging module 302 is YES, the first control module 303 controls the device according to the application program and the existing instance; when the judgment result of the existing instance judging module 302 is no The port occupancy determining module 304 determines whether the port to be called by the application is occupied; then, when the result of the port occupancy determining module 304 is YES, the redistribution module 305 controls the application to reallocate the port to be called. When the judgment result of the port occupation judging module 304 is no, the new instance module 306 creates an instance according to the device and port that the application needs to call; finally, the second control module 307 according to the application and the newly created instance. controlling device. In this embodiment, the self-service device hardware management device can solve the technical problem that the existing technology cannot realize the simultaneous coexistence of two applications, and the application scenario that needs to complete two application functions at the same time cannot be implemented, and the control efficiency of the device hardware is reduced. .
为便于理解,下面对本发明实施例中的一种自助设备硬件管理装置进行详细描述,请参阅图4,本发明实施例中一种自助设备硬件管理装置另一个实施例包括:For ease of understanding, a self-service device hardware management device in the embodiment of the present invention is described in detail below. Referring to FIG. 4, another embodiment of the self-service device hardware management device in the embodiment of the present invention includes:
第一获取模块401,用于在运行应用程序时,获取该应用程序所需调用
的设备和端口;a first obtaining module 401, configured to acquire a required call of the application when the application is run
Devices and ports;
已有实例判断模块402,用于判断是否存在已有实例调用该所需调用的设备和端口;The existing instance determining module 402 is configured to determine whether there is an existing instance calling the device and the port that is required to be called;
第一控制模块403,用于当该已有实例判断模块402的判断结果为是时,根据该应用程序和该已有实例控制设备;The first control module 403 is configured to: when the judgment result of the existing instance determination module 402 is YES, control the device according to the application program and the existing instance;
端口占用判断模块404,用于当该已有实例判断模块402的判断结果为否时,判断该应用程序所需调用的端口是否被占用;The port occupancy judging module 404 is configured to determine, when the judgment result of the existing instance judging module 402 is negative, whether the port to be called by the application program is occupied;
重分配模块405,用于当该端口占用判断模块404的判断结果为是时,控制该应用程序重新分配所需调用的端口;The redistribution module 405 is configured to, when the result of the determination by the port occupancy determining module 404 is YES, control the application to reallocate the port to be called;
新建实例模块406,用于当该端口占用判断模块404的判断结果为否时,则根据该应用程序所需调用的设备和端口新建一个实例;The new instance module 406 is configured to: when the judgment result of the port occupation determining module 404 is negative, create an instance according to the device and port that the application needs to invoke;
第二控制模块407,用于根据该应用程序和新建的实例控制设备。The second control module 407 is configured to control the device according to the application and the newly created instance.
本实施例中该装置可以包括:The device in this embodiment may include:
第一引用计数模块408,用于在该第一控制模块403根据该应用程序和该已有实例控制设备之前,该已有实例的引用计数加1;The first reference counting module 408 is configured to: before the first control module 403 controls the device according to the application and the existing instance, the reference count of the existing instance is incremented by one;
第二引用计数模块409,用于在该第二控制模块407根据该应用程序和新建的实例控制设备之前,该新建的实例的引用计数加1;a second reference counting module 409, configured to add a reference count of the newly created instance by 1 before the second control module 407 controls the device according to the application and the newly created instance;
第三引用计数模块410,用于当该应用程序退出控制该设备时,对应实例的引用计数减1;The third reference counting module 410 is configured to: when the application exits and control the device, the reference count of the corresponding instance is decreased by 1;
实例删除模块411,用于当实例的引用计数为0时,删除该实例。The instance deletion module 411 is configured to delete the instance when the reference count of the instance is 0.
本实施例中该装置可以包括:The device in this embodiment may include:
实例信息保存模块412,用于在该新建实例模块406根据该应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,该实例信息包括该新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。The instance information saving module 412 is configured to save the instance information of the newly created instance to a preset device instance table after the new instance module 406 creates an instance according to the device and the port that the application needs to invoke, and the instance information is The device name of the device called by the newly created instance, the port number of the called port, the corresponding reference count, and the device status information of the called device.
本实施例中该装置可以包括:The device in this embodiment may include:
状态信息更新模块413,用于实时获取设备的设备状态信息,并将该设备状态信息更新至该设备实例表;The status information update module 413 is configured to acquire device status information of the device in real time, and update the device status information to the device instance table.
状态信息获取模块414,用于当需要获取该应用程序控制的设备的设备
状态信息时,从该设备实例表中获取并返回该设备状态信息。a status information obtaining module 414, configured to acquire a device of the device controlled by the application
When the status information is obtained, the device status information is obtained and returned from the device instance table.
本实施例中该装置可以包括:The device in this embodiment may include:
设备状态判断模块415,用于当该第一控制模块403或该第二控制模块407根据应用程序控制设备时,根据获取到的该设备的设备状态信息判断该设备是否处于正常状态;The device status determining module 415 is configured to determine, according to the acquired device state information of the device, whether the device is in a normal state when the first control module 403 or the second control module 407 controls the device according to the application program;
直接控制模块416,用于当该设备状态判断模块415的判断结果为是时,则不进行设备的初始化操作,直接控制该设备工作。The direct control module 416 is configured to: when the determination result of the device status determination module 415 is YES, the initialization operation of the device is not performed, and the device is directly controlled to work.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。A person skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the system, the device and the unit described above can refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided by the present application, it should be understood that the disclosed system, apparatus, and method may be implemented in other manners. For example, the device embodiments described above are merely illustrative. For example, the division of the unit is only a logical function division. In actual implementation, there may be another division manner, for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个
存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may contribute to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a software product.
The storage medium includes instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。
The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to be limiting; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that The technical solutions described in the embodiments are modified, or the equivalents of the technical features are replaced by the equivalents of the technical solutions of the embodiments of the present invention.
Claims (10)
- 一种自助设备硬件管理方法,其特征在于,包括:A self-service device hardware management method, comprising:在运行应用程序时,获取所述应用程序所需调用的设备和端口;Get the device and port that the application needs to call when running the application;判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;Determining whether there is a device and a port that the existing instance calls the required call, and if so, controlling the device according to the application and the existing instance, if not, making further judgment;所述进一步判断为:判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;The determining is further: determining whether the port required to be called by the application is occupied, and if so, controlling the application to re-allocate the port to be called, and if not, the device to be invoked according to the application And create a new instance of the port;根据所述应用程序和新建的实例控制设备。The device is controlled according to the application and the newly created instance.
- 根据权利要求1所述的方法,其特征在于,在根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;The method according to claim 1, wherein the reference count of the existing instance is incremented by one before the device is controlled according to the application and the existing instance;在根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;The reference count of the newly created instance is incremented by 1 before the device is controlled according to the application and the newly created instance;当所述应用程序退出控制所述设备时,对应实例的引用计数减1;When the application exits controlling the device, the reference count of the corresponding instance is decremented by one;当实例的引用计数为0时,删除所述实例。When the instance's reference count is 0, the instance is deleted.
- 根据权利要求1所述的方法,其特征在于,在根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。The method of claim 1, wherein the instance information of the newly created instance is saved to a preset device instance table after the new device is created according to the device and the port that is called by the application, The instance information includes a device name of the device invoked by the newly created instance, a port number of the called port, a corresponding reference count, and device state information of the called device.
- 根据权利要求3所述的方法,其特征在于,实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;The method according to claim 3, wherein the device status information of the device is acquired in real time, and the device status information is updated to the device instance table;当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。When it is required to acquire device state information of the device controlled by the application, the device state information is obtained and returned from the device instance table.
- 根据权利要求4所述的方法,其特征在于,当根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制所述设备工作。The method according to claim 4, wherein when the device is controlled according to the application, it is determined whether the device is in a normal state according to the acquired device state information of the device, and if so, the device is not initialized. Directly control the operation of the device.
- 一种自助设备硬件管理装置,其特征在于,包括:A self-service device hardware management device, comprising:第一获取模块,用于在运行应用程序时,获取所述应用程序所需调用的设备和端口; a first obtaining module, configured to acquire a device and a port that the application needs to call when the application is running;已有实例判断模块,用于判断是否存在已有实例调用所述所需调用的设备和端口;An instance judgment module is configured to determine whether there is a device and a port that the existing instance calls the required call;第一控制模块,用于当所述已有实例判断模块的判断结果为是时,根据所述应用程序和所述已有实例控制设备;a first control module, configured to: when the judgment result of the existing instance judgment module is YES, control the device according to the application program and the existing instance;端口占用判断模块,用于当所述已有实例判断模块的判断结果为否时,判断所述应用程序所需调用的端口是否被占用;a port occupancy judging module, configured to determine, when the judgment result of the existing instance judging module is negative, whether the port that the application program needs to be called is occupied;重分配模块,用于当所述端口占用判断模块的判断结果为是时,控制所述应用程序重新分配所需调用的端口;a redistribution module, configured to: when the judgment result of the port occupation judging module is yes, control the application to reallocate a port to be called;新建实例模块,用于当所述端口占用判断模块的判断结果为否时,则根据所述应用程序所需调用的设备和端口新建一个实例;The new instance module is configured to: when the judgment result of the port occupation judgment module is negative, create an instance according to the device and port to be invoked by the application;第二控制模块,用于根据所述应用程序和新建的实例控制设备。And a second control module, configured to control the device according to the application and the newly created instance.
- 根据权利要求6所述的装置,其特征在于,所述装置包括:The device of claim 6 wherein said device comprises:第一引用计数模块,用于在所述第一控制模块根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;a first reference counting module, configured to add a reference count of the existing instance by 1 before the first control module controls the device according to the application and the existing instance;第二引用计数模块,用于在所述第二控制模块根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;a second reference counting module, configured to add a reference count of the newly created instance by 1 before the second control module controls the device according to the application and the newly created instance;第三引用计数模块,用于当所述应用程序退出控制所述设备时,对应实例的引用计数减1;a third reference counting module, configured to: when the application exits and control the device, the reference count of the corresponding instance is decreased by 1;实例删除模块,用于当实例的引用计数为0时,删除所述实例。The instance delete module is configured to delete the instance when the reference count of the instance is 0.
- 根据权利要求6所述的装置,其特征在于,所述装置包括:The device of claim 6 wherein said device comprises:实例信息保存模块,用于在所述新建实例模块根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。An instance information saving module, configured to save the instance information of the newly created instance to a preset device instance table after the newly created instance module creates an instance according to the device and the port that is to be invoked by the application, the instance The information includes the device name of the device invoked by the newly created instance, the port number of the called port, the corresponding reference count, and the device status information of the called device.
- 根据权利要求8所述的装置,其特征在于,所述装置包括:The device of claim 8 wherein said device comprises:状态信息更新模块,用于实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;a status information update module, configured to acquire device status information of the device in real time, and update the device status information to the device instance table;状态信息获取模块,用于当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。 The status information obtaining module is configured to acquire and return the device status information from the device instance table when the device status information of the device controlled by the application is required to be acquired.
- 根据权利要求9所述的装置,其特征在于,所述装置包括:The device of claim 9 wherein said device comprises:设备状态判断模块,用于当所述第一控制模块或所述第二控制模块根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态;a device status determining module, configured to determine, according to the acquired device state information of the device, whether the device is in a normal state when the first control module or the second control module controls the device according to the application program;直接控制模块,用于当所述设备状态判断模块的判断结果为是时,则不进行设备的初始化操作,直接控制所述设备工作。 The direct control module is configured to: when the judgment result of the device state judging module is YES, perform an initialization operation of the device, and directly control the working of the device.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510967254.5 | 2015-12-18 | ||
CN201510967254.5A CN105426253A (en) | 2015-12-18 | 2015-12-18 | Hardware management method and device for self-service equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2017101247A1 true WO2017101247A1 (en) | 2017-06-22 |
Family
ID=55504477
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2016/081805 WO2017101247A1 (en) | 2015-12-18 | 2016-05-12 | Self-service equipment hardware management method and device |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN105426253A (en) |
WO (1) | WO2017101247A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113965917A (en) * | 2021-10-19 | 2022-01-21 | 深圳市元征科技股份有限公司 | Communication method, device and terminal equipment |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105426253A (en) * | 2015-12-18 | 2016-03-23 | 广州广电运通金融电子股份有限公司 | Hardware management method and device for self-service equipment |
CN106354608B (en) * | 2016-09-30 | 2019-08-23 | 北京海誉动想科技股份有限公司 | The device and method of electronic equipment hardware requests registration management |
US10552194B2 (en) * | 2017-10-23 | 2020-02-04 | Microsoft Technology Licensing, Llc | Virtualization operations for directly assigned devices |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1312503A (en) * | 1999-11-10 | 2001-09-12 | 罗技电子股份有限公司 | Control for multiple input equipments |
US6389487B1 (en) * | 1998-02-10 | 2002-05-14 | Gateway, Inc. | Control of video device by multiplexing accesses among multiple applications requesting access based on visibility on single display and via system of window visibility rules |
CN1405680A (en) * | 2001-06-15 | 2003-03-26 | 罗技欧洲公司 | Multi-example input device control |
CN105426253A (en) * | 2015-12-18 | 2016-03-23 | 广州广电运通金融电子股份有限公司 | Hardware management method and device for self-service equipment |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7120697B2 (en) * | 2001-05-22 | 2006-10-10 | International Business Machines Corporation | Methods, systems and computer program products for port assignments of multiple application instances using the same source IP address |
US8166175B2 (en) * | 2005-09-12 | 2012-04-24 | Microsoft Corporation | Sharing a port with multiple processes |
GB0614547D0 (en) * | 2006-07-21 | 2006-08-30 | Sony Service Ct Europe Nv | Demodulator device |
US8849972B2 (en) * | 2008-11-25 | 2014-09-30 | Polycom, Inc. | Method and system for dispatching received sessions between a plurality of instances of an application using the same IP port |
CN102693159B (en) * | 2012-05-09 | 2015-07-01 | 上海晨思电子科技有限公司 | Method and device for controlling hardware equipment based on user mode multitask |
-
2015
- 2015-12-18 CN CN201510967254.5A patent/CN105426253A/en active Pending
-
2016
- 2016-05-12 WO PCT/CN2016/081805 patent/WO2017101247A1/en active Application Filing
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6389487B1 (en) * | 1998-02-10 | 2002-05-14 | Gateway, Inc. | Control of video device by multiplexing accesses among multiple applications requesting access based on visibility on single display and via system of window visibility rules |
CN1312503A (en) * | 1999-11-10 | 2001-09-12 | 罗技电子股份有限公司 | Control for multiple input equipments |
CN1405680A (en) * | 2001-06-15 | 2003-03-26 | 罗技欧洲公司 | Multi-example input device control |
CN105426253A (en) * | 2015-12-18 | 2016-03-23 | 广州广电运通金融电子股份有限公司 | Hardware management method and device for self-service equipment |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113965917A (en) * | 2021-10-19 | 2022-01-21 | 深圳市元征科技股份有限公司 | Communication method, device and terminal equipment |
CN113965917B (en) * | 2021-10-19 | 2024-04-02 | 深圳市元征科技股份有限公司 | Communication method, device and terminal equipment |
Also Published As
Publication number | Publication date |
---|---|
CN105426253A (en) | 2016-03-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8887157B2 (en) | System and method for managing virtual machine states by restoring previously saved states based on a virtual machine application's request active with the virtual machine | |
WO2016090976A1 (en) | Mobile terminal and resource management method thereof | |
WO2017101247A1 (en) | Self-service equipment hardware management method and device | |
US9161239B2 (en) | Network access point management | |
CN107291456B (en) | Multi-screen display control method and system | |
US20140047256A1 (en) | Terminal device and method for operating the same | |
JP2017520853A (en) | Numerical control system based on virtual host device | |
WO2017177695A1 (en) | Method and system for development and integration of application in numerical control system | |
WO2019047441A1 (en) | Communication optimization method and system | |
US20220222111A1 (en) | Deep learning framework scheduling | |
CN107015972B (en) | Method, device and system for migrating machine room services | |
RU2705009C2 (en) | Handwritten input handler with low delay time | |
EP3737038A1 (en) | Method and device for configuring base station | |
CN116800616A (en) | Management method and related device of virtualized network equipment | |
WO2021169264A1 (en) | Automatic scheduling method and apparatus for database access layer middleware | |
US20160234258A1 (en) | Minimizing productivity loss in a collaborative sharing environment | |
WO2018112772A1 (en) | Method and apparatus for operating another operating system and electronic device | |
US10248459B2 (en) | Operating system support for game mode | |
CN109462663A (en) | A kind of method, voice interactive system and storage medium that limitation system resource occupies | |
CN104572283B (en) | A kind of method suspended with recovering the operation of MPI concurrent applications | |
US8978042B2 (en) | Method and system for maintaining game functionality for a plurality of game instances running on a computer system | |
CN107729122A (en) | A kind of virtual machine management method and device | |
CN113254168B (en) | Operation method, device, equipment and storage medium of block chain system | |
US11138024B2 (en) | Multiple independent lifecycle states | |
CN115129469B (en) | Cross-process communication method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16874312 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 16874312 Country of ref document: EP Kind code of ref document: A1 |