WO2017101247A1 - 一种自助设备硬件管理方法和装置 - Google Patents

一种自助设备硬件管理方法和装置 Download PDF

Info

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
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Ceased
Application number
PCT/CN2016/081805
Other languages
English (en)
French (fr)
Inventor
熊飞
江清源
吴胜楠
黄三朋
陈明宇
李珂烨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GRG Banking Equipment Co Ltd
Original Assignee
GRG Banking Equipment Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by GRG Banking Equipment Co Ltd filed Critical GRG Banking Equipment Co Ltd
Publication of WO2017101247A1 publication Critical patent/WO2017101247A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation 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/5022Mechanisms to release resources
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/50Indexing scheme relating to G06F9/50
    • G06F2209/5013Request 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

本发明实施例公开了一种自助设备硬件管理方法,用于解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。本发明实施例方法包括:在运行应用程序时,获取所述应用程序所需调用的设备和端口;判断是否存在所述设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;所述进一步判断为:判断应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;根据所述应用程序和新建的实例控制设备。本发明实施例还提供一种自助设备硬件管理装置。

Description

一种自助设备硬件管理方法和装置
本申请要求于2015年12月18日提交中国专利局、申请号为201510967254.5、发明名称为“一种自助设备硬件管理方法和装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本发明涉及自助设备控制技术领域,尤其涉及一种自助设备硬件管理方法和装置。
背景技术
对自助终端设备模块的通信控制一般采用串口或USB进行,一个模块通常只会通过一条通信线路进行连接控制,这就导致了不同应用程序对设备的控制从物理上只能排他互斥地访问。而在实际的应用场景中,通常会有多个应用程序需要对同一模块进行控制,比如两个应用程序都需要控制机芯,其中一个应用程序进行出钞、另外一个应用程序进行获取机芯的设备状态,为了满足这种场景的需求,目前,国内外通常的做法是:为一个模块开发一个硬件设备控制DLL(动态链接库),不同应用程序分别加载该DLL的不同实例完成对设备的独占访问控制,当需要多个应用程序访问该设备时,需要一个应用程序完成控制后退出对设备链路的占用,然后由另一个应用程序获得设备链路的占用后进行控制。
这样的处理会存在如下问题:1、降低应用程序对设备控制的效率。两个应用需要不断地获取、释放链路,耗费链路资源,浪费处理时间。2、两个应用程序不能同时共存,降低用户对自助终端设备的体验。
发明内容
本发明实施例提供了一种自助设备硬件管理方法和装置,能够解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能 的应用场景无法实现,降低对设备硬件控制效率的技术问题。
本发明实施例提供的一种自助设备硬件管理方法,包括:
在运行应用程序时,获取所述应用程序所需调用的设备和端口;
判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;
所述进一步判断为:判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;
根据所述应用程序和新建的实例控制设备。
可选地,在根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;
在根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;
当所述应用程序退出控制所述设备时,对应实例的引用计数减1;
当实例的引用计数为0时,删除所述实例。
可选地,在根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。
可选地,实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;
当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。
可选地,当根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制所述设备工作。
本发明实施例提供的一种自助设备硬件管理装置,包括:
第一获取模块,用于在运行应用程序时,获取所述应用程序所需调用的设备和端口;
已有实例判断模块,用于判断是否存在已有实例调用所述所需调用的设备和端口;
第一控制模块,用于当所述已有实例判断模块的判断结果为是时,根据所述应用程序和所述已有实例控制设备;
端口占用判断模块,用于当所述已有实例判断模块的判断结果为否时,判断所述应用程序所需调用的端口是否被占用;
重分配模块,用于当所述端口占用判断模块的判断结果为是时,控制所述应用程序重新分配所需调用的端口;
新建实例模块,用于当所述端口占用判断模块的判断结果为否时,则根据所述应用程序所需调用的设备和端口新建一个实例;
第二控制模块,用于根据所述应用程序和新建的实例控制设备。
可选地,所述装置包括:
第一引用计数模块,用于在所述第一控制模块根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;
第二引用计数模块,用于在所述第二控制模块根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;
第三引用计数模块,用于当所述应用程序退出控制所述设备时,对应实例的引用计数减1;
实例删除模块,用于当实例的引用计数为0时,删除所述实例。
可选地,所述装置包括:
实例信息保存模块,用于在所述新建实例模块根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。
可选地,所述装置包括:
状态信息更新模块,用于实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;
状态信息获取模块,用于当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。
可选地,所述装置包括:
设备状态判断模块,用于当所述第一控制模块或所述第二控制模块根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态;
直接控制模块,用于当所述设备状态判断模块的判断结果为是时,则不进行设备的初始化操作,直接控制所述设备工作。
从以上技术方案可以看出,本发明实施例具有以下优点:
本发明实施例中,首先,在运行应用程序时,获取所述应用程序所需调用的设备和端口;然后,判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;接着进一步判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;最后,根据所述应用程序和新建的实例控制设备。在本发明实施例中,该自助设备硬件管理方法可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。
附图说明
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为本发明实施例中一种自助设备硬件管理方法一个实施例流程图;
图2为本发明实施例中一种自助设备硬件管理方法另一个实施例流程图;
图3为本发明实施例中一种自助设备硬件管理装置一个实施例结构图;
图4为本发明实施例中一种自助设备硬件管理装置另一个实施例结构 图。
具体实施方式
本发明实施例提供了一种自助设备硬件管理方法和装置,用于解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。
为使得本发明的发明目的、特征、优点能够更加的明显和易懂,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,下面所描述的实施例仅仅是本发明一部分实施例,而非全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。
请参阅图1,本发明实施例中一种自助设备硬件管理方法一个实施例包括:
101、在运行应用程序时,获取该应用程序所需调用的设备和端口;
首先,在运行应用程序时,可以获取该应用程序所需调用的设备和端口。
102、判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤103,若否,则执行步骤104;
在运行应用程序时,获取该应用程序所需调用的设备和端口之后,可以判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤103,若否,则执行步骤104。
103、根据该应用程序和该已有实例控制设备;
若判断得知存在已有实例调用该所需调用的设备和端口,则根据该应用程序和该已有实例控制设备。
104、判断该应用程序所需调用的端口是否被占用,若是,则执行步骤105,若否,则执行步骤106;
若判断得知不存在已有实例调用该所需调用的设备和端口,则进一步判断该应用程序所需调用的端口是否被占用,若是,则执行步骤105,若否,则执行步骤106。
105、控制该应用程序重新分配所需调用的端口;
若进一步判断得知该应用程序所需调用的端口被占用,则控制该应用程序重新分配所需调用的端口。
106、根据该应用程序所需调用的设备和端口新建一个实例;
若进一步判断得知该应用程序所需调用的端口未被占用,则根据该应用程序所需调用的设备和端口新建一个实例。
107、根据该应用程序和新建的实例控制设备。
在根据该应用程序所需调用的设备和端口新建一个实例之后,可以根据该应用程序和新建的实例控制设备。
本实施例中,首先,在运行应用程序时,获取该应用程序所需调用的设备和端口;然后,判断是否存在已有实例调用该所需调用的设备和端口,若是,则根据该应用程序和该已有实例控制设备,若否,则作进一步判断;接着进一步判断该应用程序所需调用的端口是否被占用,若是,则控制该应用程序重新分配所需调用的端口,若否,则根据该应用程序所需调用的设备和端口新建一个实例;最后,根据该应用程序和新建的实例控制设备。在本实施例中,该自助设备硬件管理方法可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。
为便于理解,下面对本发明实施例中的一种自助设备硬件管理方法进行详细描述,请参阅图2,本发明实施例中一种自助设备硬件管理方法另一个实施例包括:
201、在运行应用程序时,获取该应用程序所需调用的设备和端口;
首先,在运行应用程序时,获取该应用程序所需调用的设备和端口。可以理解的是,当应用程序需要调用设备硬件时,同时需要所需调用的设备,以及与该设备对应的端口。一般来说,端口由应用程序本身分配的。本实施例中,可以通过获取设备的设备名和端口的端口号来获知该应用程序所需调用的设备和端口。
202、判断是否存在已有实例调用该所需调用的设备和端口,若是,则执 行步骤203,若否,则执行步骤205;
在获取该应用程序所需调用的设备和端口之后,可以判断是否存在已有实例调用该所需调用的设备和端口,若是,则执行步骤203,若否,则执行步骤205。可以理解的是,系统在运行该应用程序之前,可能已经在运行另外的一个或多个应用程序,因此,系统中存在已有实例在调用某些设备和端口。当发现存在已有实例在调用该所需调用的设备和端口时,说明这个已有实例可以被该应用程序所调用,而无需浪费资源重新建立一个新的实例。
203、该已有实例的引用计数加1;
若判断得知存在已有实例调用该所需调用的设备和端口,则该已有实例的引用计数加1。需要说明的是,每个实例均可以包含“引用计数”这条属性,“引用计数”属性表明该实例目前被多少个应用程序所调用。例如,假设实例A的引用计数为2,则表示实例A目前正被2个应用程序调用。
204、根据该应用程序和该已有实例控制设备;
在该已有实例的引用计数加1之后,可以根据该应用程序和该已有实例控制设备。
205、判断该应用程序所需调用的端口是否被占用,若是,则执行步骤206,若否,则执行步骤207;
若判断得知不存在已有实例调用该所需调用的设备和端口,则进一步判断该应用程序所需调用的端口是否被占用,若是,则执行步骤206,若否,则执行步骤207。可以理解的是,当不存在已有实例调用该所需调用的设备和端口时,意味着需要为该应用程序新建一个实例,而若该端口被占用,则无法根据该端口来新建实例,因此需要判断该应用程序所需调用的端口是否被占用。
206、控制该应用程序重新分配所需调用的端口;
若判断得知该应用程序所需调用的端口被占用,则控制该应用程序重新分配所需调用的端口。
可以理解的是,若重新分配的端口未被占用,则可以进行新建实例;而若重新分配的端口仍被占用,则再重新分配,直到分配到的端口未被占用,然后进行新建实例。
207、根据该应用程序所需调用的设备和端口新建一个实例;
若判断得知该应用程序所需调用的端口未被占用,可以根据该应用程序所需调用的设备和端口新建一个实例。
208、将新建的实例的实例信息保存到预设的设备实例表中;
在根据该应用程序所需调用的设备和端口新建一个实例之后,可以将新建的实例的实例信息保存到预设的设备实例表中,该实例信息包括该新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。该设备实例表的表结构可以如下:
设备名 串口ID 实例 应用计数 设备状态信息
需要说明的是,每个实例的实例信息均保存到该设备实例表中,为保证设备实例表的实时有效性,可以实时获取设备的设备状态信息,并将该设备状态信息更新至该设备实例表;当需要获取该应用程序控制的设备的设备状态信息时,从该设备实例表中获取并返回该设备状态信息。
209、该新建的实例的引用计数加1;
在根据该应用程序和新建的实例控制设备之前,该新建的实例的引用计数加1。
210、根据该应用程序和新建的实例控制设备;
新建实例之后,可以根据该应用程序和新建的实例控制设备。
需要说明的是,当根据应用程序控制设备时,为提高操作执行的效率,可以根据获取到的该设备的设备状态信息判断该设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制该设备工作。无需每次控制设备工作前均进行初始化,降低了设备的磨损。
211、判断该应用程序是否退出控制该设备,若是,则执行步骤212,若否,则对应实例的引用计数保持不变;
在根据该应用程序和新建的实例控制设备之后,可以判断该应用程序是否退出控制该设备,若是,则执行步骤212,若否,则对应实例的引用计数保持不变。
212、对应实例的引用计数减1;
若判断得知该应用程序退出控制该设备,则对应实例的引用计数减1。
213、当实例的引用计数为0时,删除该实例。
当实例的引用计数为0时,删除该实例。可以理解的是,当实例的引用计数为0时,表明该实例目前未被任何应用程序所调用,因此,为了节省系统资源,可以删除该实例。
为便于理解,根据图2所描述的实施例,下面以三个实际应用场景对本发明实施例中的一种自助设备硬件管理方法进行描述:
场景一:正常情况:两个应用程序通过同一端口控制同一设备。
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,新建设备连接实例,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。表结构如下:
设备名 串口ID 实例 应用计数 设备状态信息
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开相同设备,设备管理器采用设备名+串口编号从1中设备实例表查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败,App2.exe需要重新设置新的串口ID或设备名后重新执行步骤3;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。在本例中,指定相同端口采用相同设备名,使用现有的实例,即共享相同实例。
4、第二个应用程序调用设备管理器的初始化(Init)命令,由于初始化命令物理操作比较耗时,设备管理器会获取设备当前的状态,如果属于正常状态,不对硬件设备进行物理初始化操作,直接返回成功。这样,即提高了命令执行的效率,又降低了设备的磨损。
5、例如,第一个应用程序调用设备管理器的出钞指令,设备管理器调用硬件动态库对设备进行出钞,并更新设备管理器中该设备实例对应的设备状态信息(如步骤1中表结构)。
6、第二个应用程序调用设备管理器的获取状态指令,设备管理器从设备实例表(即内存数据)中获取设备的状态信息直接返回,不用操作硬件设备,提高了获取设备状态信息的效率。同时,为了提高设备状态信息的及时性,设备管理器中会有一个状态查询线程定时获取设备的硬件状态,确保设备管理器内存中的状态是实时的。
7、运行完毕后,第一个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。
8、运行完毕后,第二个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。
场景二:两个应用程序通过同一端口控制不同的设备。
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开另一个不同设备,设备管理器采用设备名+串口编号查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败,App2.exe需要重新设置新的串口ID或设备名后重新执行步骤3;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。本例中,指定相同端口但是采用不同设备名,返回打开设备失败。
场景三:两个应用程序通过不同端口控制不同的设备。
1、第一个应用程序App1.exe调用设备管理器DeviceServie.exe指定端口(如串口COM2)打开设备,设备管理器调用硬件驱动库DevDriver.dll物理上打开设备端口,打开成功,新建设备连接实例,设备端口2被占用,设备管理器将该设备连接实例信息保存到设备实例表中,该实例的引用计数+1。
2、第一个应用程序调用设备管理器的初始化命令,设备管理器调用硬件驱动库物理上初始化设备,动作硬件,初始化成功。
3、第二个应用程序App2.exe调用设备管理的指定相同端口(如串口COM2)打开另一个不同设备,设备管理器采用设备名+串口编号查找是否存在该设备连接实例,如果存在,使用现有的实例。如果不存在,检查是否为相同端口,如果是相同端口,返回失败;如果是不同端口,新建一个设备连接实例,按照指定设备名+端口打开物理设备。本例中,指定不同端口采用不同设备名,新创建一个设备连接实例。
4、第二个应用程序调用设备管理器的初始化命令,由于在设备管理器中该请求对应的实例是第一次进行初始化操作,设备管理器调用硬件动态库的初始化命令完成对设备的初始化,有物理动作。
5、第一个应用程序调用设备管理器的出钞指令,设备管理器调用硬件动态库对设备进行出钞。
6、第二个应用程序调用设备管理器的获取状态指令,设备管理器在内存中获取设备的状态直接返回。
7、运行完毕后,第一个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。
8、运行完毕后,第二个应用程序调用设备管理器的关闭设备的命令。设备管理器逻辑上将所对应的设备连接实例的引用计数减1,直到该引用计数为0时才通过硬件驱动库物理上断开与设备的连接。
上面主要描述了一种自助设备硬件管理方法,下面将对一种自助设备硬件管理装置进行详细描述,请参阅图3,本发明实施例中一种自助设备硬件管理装置一个实施例包括:
第一获取模块301,用于在运行应用程序时,获取该应用程序所需调用 的设备和端口;
已有实例判断模块302,用于判断是否存在已有实例调用该所需调用的设备和端口;
第一控制模块303,用于当该已有实例判断模块302的判断结果为是时,根据该应用程序和该已有实例控制设备;
端口占用判断模块304,用于当该已有实例判断模块302的判断结果为否时,判断该应用程序所需调用的端口是否被占用;
重分配模块305,用于当该端口占用判断模块304的判断结果为是时,控制该应用程序重新分配所需调用的端口;
新建实例模块306,用于当该端口占用判断模块304的判断结果为否时,则根据该应用程序所需调用的设备和端口新建一个实例;
第二控制模块307,用于根据该应用程序和新建的实例控制设备。
本实施例中,首先,在运行应用程序时,第一获取模块301获取该应用程序所需调用的设备和端口;然后,已有实例判断模块302判断是否存在已有实例调用该所需调用的设备和端口;当该已有实例判断模块302的判断结果为是时,第一控制模块303根据该应用程序和该已有实例控制设备;当该已有实例判断模块302的判断结果为否时,端口占用判断模块304判断该应用程序所需调用的端口是否被占用;接着,当该端口占用判断模块304的判断结果为是时,重分配模块305控制该应用程序重新分配所需调用的端口;当该端口占用判断模块304的判断结果为否时,则新建实例模块306根据该应用程序所需调用的设备和端口新建一个实例;最后,第二控制模块307根据该应用程序和新建的实例控制设备。在本实施例中,该自助设备硬件管理装置可以解决现有技术无法实现两个应用程序同时共存,导致需要同时完成两个应用程序功能的应用场景无法实现,降低对设备硬件控制效率的技术问题。
为便于理解,下面对本发明实施例中的一种自助设备硬件管理装置进行详细描述,请参阅图4,本发明实施例中一种自助设备硬件管理装置另一个实施例包括:
第一获取模块401,用于在运行应用程序时,获取该应用程序所需调用 的设备和端口;
已有实例判断模块402,用于判断是否存在已有实例调用该所需调用的设备和端口;
第一控制模块403,用于当该已有实例判断模块402的判断结果为是时,根据该应用程序和该已有实例控制设备;
端口占用判断模块404,用于当该已有实例判断模块402的判断结果为否时,判断该应用程序所需调用的端口是否被占用;
重分配模块405,用于当该端口占用判断模块404的判断结果为是时,控制该应用程序重新分配所需调用的端口;
新建实例模块406,用于当该端口占用判断模块404的判断结果为否时,则根据该应用程序所需调用的设备和端口新建一个实例;
第二控制模块407,用于根据该应用程序和新建的实例控制设备。
本实施例中该装置可以包括:
第一引用计数模块408,用于在该第一控制模块403根据该应用程序和该已有实例控制设备之前,该已有实例的引用计数加1;
第二引用计数模块409,用于在该第二控制模块407根据该应用程序和新建的实例控制设备之前,该新建的实例的引用计数加1;
第三引用计数模块410,用于当该应用程序退出控制该设备时,对应实例的引用计数减1;
实例删除模块411,用于当实例的引用计数为0时,删除该实例。
本实施例中该装置可以包括:
实例信息保存模块412,用于在该新建实例模块406根据该应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,该实例信息包括该新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。
本实施例中该装置可以包括:
状态信息更新模块413,用于实时获取设备的设备状态信息,并将该设备状态信息更新至该设备实例表;
状态信息获取模块414,用于当需要获取该应用程序控制的设备的设备 状态信息时,从该设备实例表中获取并返回该设备状态信息。
本实施例中该装置可以包括:
设备状态判断模块415,用于当该第一控制模块403或该第二控制模块407根据应用程序控制设备时,根据获取到的该设备的设备状态信息判断该设备是否处于正常状态;
直接控制模块416,用于当该设备状态判断模块415的判断结果为是时,则不进行设备的初始化操作,直接控制该设备工作。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个 存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,以上实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims (10)

  1. 一种自助设备硬件管理方法,其特征在于,包括:
    在运行应用程序时,获取所述应用程序所需调用的设备和端口;
    判断是否存在已有实例调用所述所需调用的设备和端口,若是,则根据所述应用程序和所述已有实例控制设备,若否,则作进一步判断;
    所述进一步判断为:判断所述应用程序所需调用的端口是否被占用,若是,则控制所述应用程序重新分配所需调用的端口,若否,则根据所述应用程序所需调用的设备和端口新建一个实例;
    根据所述应用程序和新建的实例控制设备。
  2. 根据权利要求1所述的方法,其特征在于,在根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;
    在根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;
    当所述应用程序退出控制所述设备时,对应实例的引用计数减1;
    当实例的引用计数为0时,删除所述实例。
  3. 根据权利要求1所述的方法,其特征在于,在根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。
  4. 根据权利要求3所述的方法,其特征在于,实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;
    当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。
  5. 根据权利要求4所述的方法,其特征在于,当根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态,若是,则不进行设备的初始化操作,直接控制所述设备工作。
  6. 一种自助设备硬件管理装置,其特征在于,包括:
    第一获取模块,用于在运行应用程序时,获取所述应用程序所需调用的设备和端口;
    已有实例判断模块,用于判断是否存在已有实例调用所述所需调用的设备和端口;
    第一控制模块,用于当所述已有实例判断模块的判断结果为是时,根据所述应用程序和所述已有实例控制设备;
    端口占用判断模块,用于当所述已有实例判断模块的判断结果为否时,判断所述应用程序所需调用的端口是否被占用;
    重分配模块,用于当所述端口占用判断模块的判断结果为是时,控制所述应用程序重新分配所需调用的端口;
    新建实例模块,用于当所述端口占用判断模块的判断结果为否时,则根据所述应用程序所需调用的设备和端口新建一个实例;
    第二控制模块,用于根据所述应用程序和新建的实例控制设备。
  7. 根据权利要求6所述的装置,其特征在于,所述装置包括:
    第一引用计数模块,用于在所述第一控制模块根据所述应用程序和所述已有实例控制设备之前,所述已有实例的引用计数加1;
    第二引用计数模块,用于在所述第二控制模块根据所述应用程序和新建的实例控制设备之前,所述新建的实例的引用计数加1;
    第三引用计数模块,用于当所述应用程序退出控制所述设备时,对应实例的引用计数减1;
    实例删除模块,用于当实例的引用计数为0时,删除所述实例。
  8. 根据权利要求6所述的装置,其特征在于,所述装置包括:
    实例信息保存模块,用于在所述新建实例模块根据所述应用程序所需调用的设备和端口新建一个实例之后,将新建的实例的实例信息保存到预设的设备实例表中,所述实例信息包括所述新建的实例所调用设备的设备名、所调用端口的端口号、对应的引用计数和所调用设备的设备状态信息。
  9. 根据权利要求8所述的装置,其特征在于,所述装置包括:
    状态信息更新模块,用于实时获取设备的设备状态信息,并将所述设备状态信息更新至所述设备实例表;
    状态信息获取模块,用于当需要获取所述应用程序控制的设备的设备状态信息时,从所述设备实例表中获取并返回所述设备状态信息。
  10. 根据权利要求9所述的装置,其特征在于,所述装置包括:
    设备状态判断模块,用于当所述第一控制模块或所述第二控制模块根据应用程序控制设备时,根据获取到的所述设备的设备状态信息判断所述设备是否处于正常状态;
    直接控制模块,用于当所述设备状态判断模块的判断结果为是时,则不进行设备的初始化操作,直接控制所述设备工作。
PCT/CN2016/081805 2015-12-18 2016-05-12 一种自助设备硬件管理方法和装置 Ceased WO2017101247A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510967254.5A CN105426253A (zh) 2015-12-18 2015-12-18 一种自助设备硬件管理方法和装置
CN201510967254.5 2015-12-18

Publications (1)

Publication Number Publication Date
WO2017101247A1 true WO2017101247A1 (zh) 2017-06-22

Family

ID=55504477

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/081805 Ceased WO2017101247A1 (zh) 2015-12-18 2016-05-12 一种自助设备硬件管理方法和装置

Country Status (2)

Country Link
CN (1) CN105426253A (zh)
WO (1) WO2017101247A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965917A (zh) * 2021-10-19 2022-01-21 深圳市元征科技股份有限公司 通信方法、装置及终端设备

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105426253A (zh) * 2015-12-18 2016-03-23 广州广电运通金融电子股份有限公司 一种自助设备硬件管理方法和装置
CN106354608B (zh) * 2016-09-30 2019-08-23 北京海誉动想科技股份有限公司 电子设备硬件请求注册管理的装置及方法
US10552194B2 (en) * 2017-10-23 2020-02-04 Microsoft Technology Licensing, Llc Virtualization operations for directly assigned devices
CN115185596B (zh) * 2022-06-14 2026-03-20 贵阳叁玖互联网医疗有限公司 一种基于县域医联体的系统部署方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1312503A (zh) * 1999-11-10 2001-09-12 罗技电子股份有限公司 多例输入设备控制
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 (zh) * 2001-06-15 2003-03-26 罗技欧洲公司 多实例输入设备控制
CN105426253A (zh) * 2015-12-18 2016-03-23 广州广电运通金融电子股份有限公司 一种自助设备硬件管理方法和装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
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 (zh) * 2012-05-09 2015-07-01 上海晨思电子科技有限公司 基于用户模式多任务下控制硬件设备的方法及其装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
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 (zh) * 1999-11-10 2001-09-12 罗技电子股份有限公司 多例输入设备控制
CN1405680A (zh) * 2001-06-15 2003-03-26 罗技欧洲公司 多实例输入设备控制
CN105426253A (zh) * 2015-12-18 2016-03-23 广州广电运通金融电子股份有限公司 一种自助设备硬件管理方法和装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113965917A (zh) * 2021-10-19 2022-01-21 深圳市元征科技股份有限公司 通信方法、装置及终端设备
CN113965917B (zh) * 2021-10-19 2024-04-02 深圳市元征科技股份有限公司 通信方法、装置及终端设备

Also Published As

Publication number Publication date
CN105426253A (zh) 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
WO2017101247A1 (zh) 一种自助设备硬件管理方法和装置
WO2016090976A1 (zh) 移动终端及其资源管理方法
CN105955827B (zh) 处理器计算资源的分配方法及装置
WO2015070705A1 (zh) 一种业务流程调度的计算机设备、方法和装置
CN113835887B (zh) 显存的分配方法、装置、电子设备及可读存储介质
US20220222111A1 (en) Deep learning framework scheduling
WO2019047441A1 (zh) 一种通信优化方法及系统
US20200059498A1 (en) Minimizing productivity loss in a collaborative sharing environment
JP2017531844A (ja) リアル・タイム・プロビジョニングのための動的更新ストリーム
US20200351155A1 (en) Base station configuration method and apparatus
WO2017041650A1 (zh) 用于扩展分布式一致性服务的方法和设备
CN105468429A (zh) 一种高效虚拟化集群管理方法和集群节点
WO2021169264A1 (zh) 数据库接入层中间件的自动调度方法和装置
US11080086B1 (en) Reactive transaction management
CN115580645B (zh) 一种服务切换方法、装置、电子设备和存储介质
CN105094947B (zh) 一种虚拟计算资源的配额管理方法及系统
CN109522111B (zh) 异构生态系统的调用方法、装置、电子设备及存储介质
CN110874256B (zh) 一种计算集群更新系统、方法及装置
WO2026066339A1 (zh) 界面显示控制方法、电子设备、车辆、介质及产品
CN113986558A (zh) 应用处理方法及装置
CN111382141A (zh) 主从架构配置方法、装置、设备以及计算机可读存储介质
CN109462663A (zh) 一种限制系统资源占用的方法、语音交互系统及存储介质
US8978042B2 (en) Method and system for maintaining game functionality for a plurality of game instances running on a computer system
CN101587448B (zh) 一种中断处理方法和装置

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