WO2016082551A1 - Twain协议的远程重定向方法、装置及系统 - Google Patents

Twain协议的远程重定向方法、装置及系统 Download PDF

Info

Publication number
WO2016082551A1
WO2016082551A1 PCT/CN2015/083287 CN2015083287W WO2016082551A1 WO 2016082551 A1 WO2016082551 A1 WO 2016082551A1 CN 2015083287 W CN2015083287 W CN 2015083287W WO 2016082551 A1 WO2016082551 A1 WO 2016082551A1
Authority
WO
WIPO (PCT)
Prior art keywords
data source
desktop computer
terminal
virtual desktop
image device
Prior art date
Application number
PCT/CN2015/083287
Other languages
English (en)
French (fr)
Inventor
李明灯
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Publication of WO2016082551A1 publication Critical patent/WO2016082551A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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/44Arrangements for executing specific programs

Definitions

  • the present invention relates to the field of communications, and in particular, to a remote redirection method, apparatus, and system for a Toolkit Without An Interesting Name (TWAIN) protocol.
  • TWAIN Toolkit Without An Interesting Name
  • USB Universal Serial Bus
  • FIG. 1 A schematic diagram of the architecture of the remote redirection mode of the USB image device is shown in FIG. 1 .
  • the USB universal driver, USB client, USB server, and virtual USB bus drive constitute the remote redirection frame body of the USB image device, which is responsible for completing the remote redirection mapping work of the USB image device, and the local terminal side scanner Wait for the USB image device to be mapped to the remote virtual desktop computer.
  • the user only needs to install the image device driver and the image device data source provided by the USB image device manufacturer in the remote virtual desktop computer, and then use the application supporting the TWAIN protocol to select the data source corresponding to the USB image device, and then from the USB.
  • a still image is acquired on the image device.
  • the above solution needs to map a USB image device such as a scanner on the local terminal side to a remote virtual desktop computer, and open the USB image device on the remote virtual desktop, which means that all the images are scanned from the USB image device.
  • a large amount of original image data is transmitted from the local terminal side to the remote virtual desktop computer through USB redirection, and the original image data is processed by the image device data source in the remote virtual desktop computer according to the user's parameter settings (such as image format conversion, image compression, etc.) and filtered, provided to the application, This inevitably consumes or wastes a considerable amount of bandwidth, and causes the application to acquire static images at a slow rate and with low efficiency;
  • the above solution only supports image devices of the USB interface type, and does not support image devices of the non-USB interface type.
  • the embodiment of the present invention provides a remote redirecting method, device, and system for the TWAIN protocol, to at least solve the problem of low efficiency, wasteful bandwidth, and poor versatility caused by the remote redirection method of the USB image device in the prior art. problem.
  • a remote redirection method for an unnamed toolkit TWAIN protocol comprising:
  • the remote virtual desktop computer acquires the instruction parameters specified by the TWAIN protocol delivered by the APP;
  • the remote virtual desktop computer sends a first message packet to the terminal, where the first message packet carries the instruction parameters specified by the TWAIN protocol;
  • the remote virtual desktop computer feeds back the operation result corresponding to the instruction parameter to the APP in a data format specified by the TWAIN protocol.
  • the remote virtual desktop computer acquires the instruction parameters specified by the TWAIN protocol delivered by the APP, including:
  • the remote virtual desktop computer loads the settings by using the HOOK API mechanism through the APP a virtual data source manager DSM inside the remote virtual desktop computer, wherein the virtual DSM is configured to redirect the instruction parameters specified by the TWAIN protocol to the terminal;
  • the remote virtual desktop computer invokes the virtual DSM through the APP, and obtains, by using the virtual DSM, the instruction parameters specified by the TWAIN protocol delivered by the APP.
  • the remote virtual desktop computer acquires the instruction parameters specified by the TWAIN protocol delivered by the APP, including:
  • the remote virtual desktop computer loads a DSM disposed inside the remote virtual desktop computer through the APP;
  • the remote virtual desktop computer calls the DSM, and loads the specified data source DS through the DSM;
  • the remote virtual desktop computer invokes the virtual DS through the DSM, and acquires the instruction parameters specified by the TWAIN protocol through the virtual DS.
  • the virtual DS is configured to redirect the instruction parameters specified by the TWAIN protocol to the terminal.
  • the method further includes:
  • the remote virtual desktop computer acquires information of at least one image device data source
  • the remote virtual desktop computer respectively creates a virtual DS corresponding to each image device data source in the at least one image device data source according to a preset rule and information of the at least one image device data source.
  • the remote virtual desktop computer is separately created according to the preset rule and the information of the at least one image device data source.
  • each image device data of the at least one image device data source After the virtual DS corresponding to the source, it also includes:
  • the remote virtual desktop computer establishes a mapping relationship between each image device data source of the at least one image device data source and a virtual DS corresponding thereto;
  • the remote virtual desktop computer invokes the virtual DS through the DSM, and acquires the instruction specified by the TWAIN protocol by using the virtual DS. After the parameter, the remote virtual desktop computer sends the first message packet to the terminal, and further includes:
  • the remote virtual desktop computer sends a first message packet to the terminal, where the first message packet carries the command parameters specified by the TWAIN protocol, including:
  • the remote virtual desktop computer sends a first message packet to the terminal, where the first message packet carries an instruction parameter specified by the TWAIN protocol and information of an image device data source corresponding to the specified data source.
  • a remote redirection method for the unnamed toolkit TWAIN protocol comprising:
  • the terminal When the user triggers the image acquisition operation through the TWAIN-enabled application APP in the remote virtual desktop, the terminal receives the first message packet sent by the remote virtual desktop computer, where the first message packet carries the instruction parameters specified by the TWAIN protocol;
  • the terminal performs an operation specified by the instruction parameter by using an image device data source set in the terminal according to the instruction parameter, and obtains an operation result corresponding to the instruction parameter;
  • the terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries an operation result corresponding to the instruction parameter.
  • the method further includes:
  • the terminal compresses an operation result corresponding to the instruction parameter by using a TWAIN client disposed inside the terminal;
  • the terminal sends a second message packet to the remote virtual desktop computer, and the second message packet carries the operation result corresponding to the instruction parameter, including:
  • the terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the compressed instruction parameter.
  • the first message packet further carries information of the data source of the image device
  • the terminal determines the image device data source disposed inside the terminal according to the information of the image device data source.
  • the terminal receives the remote virtual desktop computer to send Before the first message pack, it also includes:
  • the terminal When the terminal establishes a virtual channel with the remote virtual desktop computer, the terminal acquires information of at least one image device data source;
  • At least one virtual data source DS corresponding to the image device data source.
  • the terminal acquiring information of the at least one image device data source includes:
  • the terminal acquires information of the at least one image device data source by using at least one of the following manners:
  • a data source manager DSM loaded by the terminal, a DSM built in through the terminal, and a DS built in through the terminal.
  • a remote virtual desktop computer includes: an obtaining unit, a sending unit, a receiving unit, and a feedback unit;
  • the obtaining unit is configured to: when the user obtains an image operation by using an APP that supports the unnamed toolkit TWAIN protocol in the remote virtual desktop, acquiring an instruction parameter specified by the TWAIN protocol delivered by the APP;
  • the sending unit is configured to send a first message packet to the terminal, where the first message packet carries an instruction parameter specified by the TWAIN protocol;
  • the receiving unit is configured to receive a second message packet sent by the terminal, where the second message packet carries an operation result corresponding to the instruction parameter, where an operation result corresponding to the instruction parameter is set by The image device data source inside the terminal is processed;
  • the feedback unit is configured to feed back an operation result corresponding to the instruction parameter to the APP in a data format specified by the TWAIN protocol.
  • the acquiring unit includes: a calling module, a loading module;
  • the loading module is configured to load, by using the APP, a virtual data source manager DSM disposed inside the remote virtual desktop computer by using a HOOK API mechanism, where the virtual DSM is used to execute the instruction specified by the TWAIN protocol. Redirecting parameters to the terminal;
  • the calling module is configured to invoke the virtual DSM through the APP, by using the virtual
  • the intended DSM obtains the instruction parameters specified by the TWAIN protocol delivered by the APP.
  • the acquiring unit includes: a calling module, a loading module;
  • the loading module is configured to load, by using the APP, a DSM disposed inside the remote virtual desktop computer;
  • the calling module is configured to invoke the DSM, and load a specified data source DS through the DSM;
  • the calling module is further configured to: if the specified DS is a virtual DS set in the remote virtual desktop computer, invoke the virtual DS by using the DSM, and obtain the TWAIN protocol specified by the virtual DS.
  • An instruction parameter wherein the virtual DS is configured to redirect an instruction parameter specified by the TWAIN protocol to the terminal.
  • the remote virtual desktop computer further includes: a creating unit;
  • the obtaining unit further includes: an acquiring module;
  • the acquiring module is configured to acquire information of at least one image device data source when the terminal establishes a virtual channel with the remote virtual desktop computer;
  • the creating unit is configured to respectively create a virtual DS corresponding to each image device data source in the at least one image device data source according to a preset rule and information of the at least one image device data source.
  • the remote virtual desktop computer further includes: an establishing unit, a determining unit;
  • the establishing unit is further configured to create, according to the preset rule and the information of the at least one image device data source, the virtual data corresponding to each image device data source in the at least one image device data source. After DS, establishing each of the at least one image device data source a mapping relationship between the image device data source and its corresponding virtual DS;
  • the determining unit is configured to: when the specified DS is a virtual DS disposed inside the remote virtual desktop computer, the calling module invokes the virtual DS by using the DSM, and acquires the virtual DS by using the virtual DS After the instruction parameter specified by the TWAIN protocol, the sending unit sends a first message packet to the terminal, and before the first message packet carries the instruction parameter specified by the TWAIN protocol, determining the specified data according to the mapping relationship.
  • the sending unit is specifically configured to:
  • a fourth aspect provides a terminal, where the terminal includes: a receiving unit, an executing unit, and a sending unit;
  • the receiving unit is configured to receive a first message packet sent by the remote virtual desktop computer when the user triggers the acquiring image operation in the remote virtual desktop by using an application APP that supports the unnamed toolkit TWAIN protocol, where the first message packet is sent by the remote virtual desktop computer. Carrying the command parameters specified by the TWAIN protocol;
  • the executing unit is configured to perform an operation of specifying the instruction parameter by setting an image device data source inside the terminal according to the instruction parameter, in combination with the TWAIN protocol, and obtain an operation result corresponding to the instruction parameter.
  • the sending unit is configured to send a second message packet to the remote virtual desktop computer, where the second message packet carries an operation result corresponding to the instruction parameter.
  • the terminal further includes: a compression unit;
  • the compression unit is configured to compress the instruction parameter by using a TWAIN client disposed inside the terminal before the sending unit sends the second message packet to the remote virtual desktop computer The corresponding operation result of the number;
  • the sending unit is specifically configured to:
  • the terminal further includes: a determining unit;
  • the first message packet further carries information of an image device data source
  • the determining unit is configured to perform, according to the instruction parameter, in conjunction with the TWAIN protocol, an operation of specifying the instruction parameter by setting an image device data source inside the terminal, and obtaining the instruction Before the operation result corresponding to the parameter, the image device data source set inside the terminal is determined according to the information of the image device data source.
  • the terminal further includes: an acquiring unit;
  • the obtaining unit is configured to acquire information of at least one image device data source when the terminal establishes a virtual channel with the remote virtual desktop computer before the receiving unit receives the first message packet sent by the remote virtual desktop computer ;
  • the sending unit is further configured to send information of the at least one image device data source to the remote virtual desktop computer, where the remote virtual desktop computer creates a data source with the at least one image device according to a preset rule. Corresponding virtual DS.
  • the acquiring unit is specifically configured to:
  • a data source manager DSM loaded by the terminal, a DSM built in through the terminal, and a DS built in through the terminal.
  • the fifth aspect provides a remote redirection system of the unnamed toolkit TWAIN protocol, the system comprising the remote virtual desktop computer according to any one of the third aspects, and the terminal of any of the fourth aspect .
  • the embodiment of the present invention provides a remote redirecting method, apparatus, and system for the TWAIN protocol, including: when a user triggers an image acquisition operation through an TWAIN-compliant APP in a remote virtual desktop, the remote virtual desktop computer obtains the TWAIN protocol delivered by the APP.
  • the remote virtual desktop computer sends the first message packet to the terminal, the first message packet carries the command parameter specified by the TWAIN protocol; the remote virtual desktop computer receives the second message packet sent by the terminal, and the second message packet carries the command parameter corresponding
  • the operation result wherein the operation result corresponding to the instruction parameter is processed by the image device data source set in the terminal; the remote virtual desktop computer feeds back the operation result corresponding to the instruction parameter to the APP according to the data format specified by the TWAIN protocol.
  • the remote virtual desktop computer sends the command parameters specified by the TWAIN protocol delivered by the APP to the terminal, and the terminal is set in the terminal according to the TWAIN protocol.
  • the image device data source returns the result of the operation to the remote virtual desktop computer after performing the operation specified by the instruction parameter. That is, the embodiment of the present invention performs a corresponding operation by an image device data source set inside the terminal, such as opening an image device data source. Considering that most of the data is transmitted between the image device data source and the image device, the image device data source has the function of previewing and filtering.
  • the image device data source set inside the terminal it can be based on the terminal side.
  • the user's parameter settings, the original image data is filtered, and finally the image conforming to the preset rule is sent to the remote virtual desktop computer, without the need to scan all the originals from the USB image device as in the prior art.
  • the image data is transmitted from the local terminal side to the remote virtual desktop computer through USB redirection, and the original image data is processed by the image device data source in the remote virtual desktop computer according to the user's parameter settings (such as an image). Format conversion, image compression, etc.) and sieve After selection, it is provided to the application.
  • the data source is not necessarily related to a specific image device, and only needs to be a data source that satisfies the TWAIN protocol.
  • it may be a data source of an image device of a USB interface class that satisfies the TWAIN protocol, or a data source of an image device of a non-USB interface class that satisfies the TWAIN protocol, thereby avoiding remote redirection of a USB image device in the prior art.
  • the versatility caused by the method is poor, which improves the versatility of the TWAIN protocol remote redirection process.
  • the remote redirection method of the TWAIN protocol provided by the embodiment of the present invention can avoid the technical problems of low efficiency, wasteful bandwidth, and poor versatility caused by the remote redirection method of the USB image device in the prior art. Thereby, the work efficiency and versatility of the TWAIN protocol remote redirection process are improved, and the transmission bandwidth of the TWAIN protocol remote redirection process is saved.
  • FIG. 1 is a schematic structural diagram of a remote redirection method of an existing USB image device
  • FIG. 2 is a schematic diagram of a remote virtual desktop system according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of a remote virtual desktop system according to an embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a software architecture of a TWAIN protocol according to an embodiment of the present invention.
  • FIG. 5 is a schematic flowchart 1 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram 1 of a remote redirection system of a TWAIN protocol according to an embodiment of the present invention
  • FIG. 7 is a second schematic flowchart of a remote redirection method of a TWAIN protocol according to an embodiment of the present disclosure
  • FIG. 8 is a second schematic structural diagram of a remote redirection system of a TWAIN protocol according to an embodiment of the present disclosure
  • FIG. 9 is a schematic flowchart 3 of a remote redirection method of a TWAIN protocol according to an embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart 4 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention
  • FIG. 11 is a schematic flowchart 5 of a remote redirection method of a TWAIN protocol according to an embodiment of the present disclosure
  • FIG. 12 is a schematic diagram of a mapping relationship between a virtual data source and an image device data source according to an embodiment of the present invention.
  • FIG. 13 is a schematic flowchart 6 of a remote redirection method of a TWAIN protocol according to an embodiment of the present disclosure
  • FIG. 14 is a schematic flowchart 7 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention.
  • 15 is a schematic flowchart 8 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention.
  • FIG. 16 is a schematic diagram 1 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention.
  • FIG. 17 is a schematic diagram 2 of a remote redirection method of a TWAIN protocol according to an embodiment of the present invention.
  • FIG. 18 is a schematic structural diagram 1 of a remote virtual desktop computer according to an embodiment of the present invention.
  • FIG. 19 is a schematic structural diagram 2 of a remote virtual desktop computer according to an embodiment of the present disclosure.
  • 20 is a schematic structural diagram 3 of a remote virtual desktop computer according to an embodiment of the present invention.
  • FIG. 21 is a schematic structural diagram 4 of a remote virtual desktop computer according to an embodiment of the present disclosure.
  • FIG. 22 is a schematic structural diagram 1 of a terminal according to an embodiment of the present disclosure.
  • FIG. 23 is a schematic structural diagram 2 of a terminal according to an embodiment of the present disclosure.
  • FIG. 24 is a schematic structural diagram 3 of a terminal according to an embodiment of the present disclosure.
  • FIG. 25 is a schematic structural diagram 4 of a terminal according to an embodiment of the present disclosure.
  • FIG. 26 is a schematic structural diagram 5 of a remote virtual desktop computer according to an embodiment of the present disclosure.
  • FIG. 27 is a schematic structural diagram 5 of a terminal according to an embodiment of the present disclosure.
  • FIG. 28 is a schematic structural diagram of a remote redirection system of a TWAIN protocol according to an embodiment of the present invention.
  • Remote virtual desktop means that computing and storage resources are concentrated on the remote server side (usually the data center), and the remote virtual desktop interface is delivered to various local terminals through the remote desktop protocol (eg, thin client, desktop personal computer (Personal) Computer, referred to as PC), portable PC, portable device (Portable Device, PAD), smart phone, etc., can display various input and output devices of the local terminal (such as keyboard, mouse, USB). ) Peripherals, serial-parallel peripherals, headsets, microphones, etc.) are mapped to the remote virtual desktop computer.
  • the remote desktop protocol eg, thin client, desktop personal computer (Personal) Computer, referred to as PC), portable PC, portable device (Portable Device, PAD), smart phone, etc.
  • a general remote virtual desktop system is shown in FIG. 2: a remote data center is centralized with server resources and storage resources 100; a plurality of virtual machines (Virtual Machines, VMs) 120 are virtualized by the virtualization operating system 110, or no virtualization is required.
  • the technology directly uses the physical PC 121, installs the operating system 130 on these VMs or physical PCs, and delivers the interface of the remote virtual desktop to the local terminal 160 through the remote desktop protocol 150, and maps the input and output devices on the local terminal to The computer side of the remote virtual desktop.
  • the remote virtual desktop system architecture is shown in Figure 3: including terminal 170 (including various input and output devices, such as USB/serial parallel port peripherals, camera, display, headset, mouse and keyboard, etc.), desktop management system 171, remote virtual desktop computer 172 (such as: VM1, VM2, physical PC1, and physical PC2, etc.) is composed of three parts.
  • the desktop management system 171 includes three parts: desktop and application management, user management, and login management, and mainly manages the registration of the remote virtual desktop computer 172 and the terminal 170 and the management of the user login to the remote virtual desktop.
  • the composition is internally divided into different service implementations according to different functions, for example, USB/serial parallel port service client and server side interaction realize mapping redirection of various peripherals; display service client and server side interaction realize remote virtual desktop delivery to terminal
  • the audio service client and the server end interact to realize two-way audio mapping
  • the multimedia service client and the server end interact to realize the playback and recording of the multimedia service
  • the mouse and keyboard service client and the server end realize the mapping of the keyboard and the mouse to the remote virtual desktop.
  • TWAIN is a software protocol to obtain international standard static images from computer peripherals, provides a unified interface specification between software developers and hardware manufacturers, making TWAIN-compliant software protocol can be from a compatible by calling TWAIN protocol interfaces
  • the TWAIN protocol peripherals acquire static images without regard to the functional differences of peripherals, effectively avoiding incompatibilities between systems and devices.
  • Photoshop is a software that complies with the TWAIN protocol.
  • you can select different peripherals by clicking on the menu File
  • the software architecture of the TWAIN protocol is shown in FIG. 4, including an application (Application: APP), a Data Source Manager (DSM), and a Data Source (DS). among them,
  • APP refers to various applications that support the TWAIN protocol, such as Photoshop, WORD and other applications.
  • DSM Its default implementation is generally included in the TWAIN development kit provided by the TWAIN organization. It is responsible for negotiating and managing the interaction between APP and DS. It manages the interaction data and data transfer between the underlying data source and the top-level application. The bridge is also responsible for collecting and loading the image devices already installed in the local system as needed, such as the twain_32.dll that comes with 32-bit Windows. Is a DSM implementation.
  • DS Developed according to the TWAIN standard to perform image request, scan, transfer, etc.; if the DS is associated with a specific image device, it is usually included in the driver installation package of the device, such as a digital camera data source. According to the TWAIN specification, DS should be made into a dynamic link library, but its file extension cannot be .dll or .so, but should be changed to .ds and placed in the directory specified by the system (for example, the specified directory under 32-bit WINDOWS is C: ⁇ Windows ⁇ twain_32 ⁇ ).
  • the TWAIN software system works in three parts: APP, DSM, and DS to complete image request, scan, and transmission. These components can and can only communicate interactively through two interfaces (functions), which are DSM_Entry and DS_Entry.
  • the calling formats in the Windows environment are as follows:
  • TW_MEMREF pData // pointer to the data block
  • TW_MEMREF pData // pointer to the data block
  • the DG, DAT, and MSG parameters indicate a Triplets operation that the user wants to perform, which is essentially the instruction part of the instruction parameters specified by the TWAIN protocol; pOrigin indicates the object that initiated the Triplets operation; pDest indicates the object that receives the Triplets operation; pData is used to carry the object.
  • the request data and the response data corresponding to the operation of the Triplets are essentially the data portion of the instruction parameters specified by the TWAIN protocol.
  • Triplet operation For each Triplet operation, it consists of a combination of three parameters: DG, DAT, and MSG.
  • the pOrigin and pDest parameters use different values depending on the operation of the differentriplets.
  • the function After the function executes, it returns a value indicating whether the operation was successful. If the return value is TWRC_SUCCESS indicating that the operation was successful, TWRC_FAILURE indicates that the operation failed. Also depending on the type of Triplets operation, there will be other return values.
  • TWAIN protocol specification manual For specific information about the TWAIN protocol, refer to the TWAIN protocol specification manual. The present invention is only briefly described herein, and will not be further described herein.
  • the virtual DSM in the remote virtual desktop computer is a DSM that implements the DSM_Entry interface and meets the TWAIN specification. It can establish an interprocess communication channel (such as a NamedPipe pipeline) with the TWAIN server according to the actual situation of the context, and the terminal is performed by the TWAIN server and the terminal. Interaction.
  • an interprocess communication channel such as a NamedPipe pipeline
  • the virtual DS in the remote virtual desktop computer is a data source (such as hw_twain.ds) that implements the DS_Entry interface and meets the TWAIN specification, and is placed in the directory specified by the TWAIN protocol or its subdirectories (such as the 32-bit WINDOWS directory C: ⁇ Windows). ⁇ twain_32 ⁇ virtual ⁇ ).
  • the virtual DS can be identified by the DSM load and establish a communication channel with the TWAIN server (such as NamedPipe Pipeline), interact with the terminal through the TWAIN server.
  • the embodiment of the invention provides a remote redirection method of the TWAIN protocol, which is specifically applied to a remote virtual desktop computer. As shown in FIG. 5, the method includes:
  • the remote virtual desktop computer obtains the instruction parameter specified by the TWAIN protocol delivered by the APP.
  • the remote virtual desktop computer sends the first message packet to the terminal, where the first message packet carries the instruction parameters specified by the TWAIN protocol.
  • the remote virtual desktop computer receives the second message packet sent by the terminal, where the second message packet carries the operation result corresponding to the instruction parameter, wherein the operation result corresponding to the instruction parameter is obtained by processing the image device data source set in the terminal.
  • the remote virtual desktop computer may be a physical PC or a VM, which is not specifically limited in this embodiment of the present invention.
  • the instruction parameter specified by the TWAIN protocol is specifically composed of two parts corresponding to the instruction and the instruction, wherein the instruction may include:
  • DAT DAT_IDENTITY
  • MSG MSG_OPENDS
  • DG DG_IMAGE
  • DAT DAT_IMAGEMEMXFER
  • MSG MSG_GET
  • DG DG_IMAGE
  • DAT DAT_IMAGENATIVEXFER
  • MSG MSG_GET
  • DG DG_IMAGE
  • DAT DAT_IMAGEFILEXFER
  • MSG MSG_GET
  • DG DG_CONTROL
  • DAT DAT_USERINTERFACE
  • MSG MSG_DISABLEDS
  • DAT DAT_IDENTITY
  • MSG MSG_CLOSEDS
  • the converted equivalent instruction or data is used to package the message.
  • the TWAIN protocol closed data source The Triplets operation instruction is equivalent to the command code 100 to package the message; if the terminal receives the message packet with the command code of 100, it can know that the instruction is to close the data source Triplets operation instruction according to the preset rule, thereby restoring the original TWAIN.
  • the instruction specified by the protocol; correspondingly, the data corresponding to the instruction may also be equivalently converted, in particular, the data with the pointer, which must be converted, which is not specifically limited in the embodiment of the present invention.
  • the remote redirection system 60 of the TWAIN protocol shown in FIG. 6 is applied as an example for description.
  • the TWAIN protocol remote redirection system 60 includes a terminal 61 and a remote virtual desktop computer 62.
  • the terminal 61 includes: a TWAIN client 611, a DSM 612, and an image device data source 613.
  • the remote virtual desktop computer 62 includes a TWAIN server 621, an APP 622, a virtual DSM 623, and a local data source 624.
  • the image device data source 613 on the terminal 61 side maps the virtual image device data source 625 on the remote virtual desktop computer 62 side through the TWAIN redirection mapping.
  • the TWAIN client 611, the TWAIN server 621, and the virtual DSM 623 constitute the TWAIN redirection framework body of the embodiment of the present invention, and are responsible for completing the TWAIN protocol redirection mapping, and successfully mapping multiple image device data sources on the local terminal side to the remote device.
  • the remote virtual desktop computer obtains the instruction parameter specified by the TWAIN protocol delivered by the APP (step S501).
  • the remote virtual desktop computer invokes the virtual DSM through the APP, and obtains the command parameters specified by the TWAIN protocol delivered by the APP through the virtual DSM.
  • the remote virtual desktop computer loads the virtual DSM set in the remote virtual desktop computer through the APP through the HOOK API mechanism. Specifically, it may include:
  • the remote virtual desktop computer directly loads the virtual DSM set in the remote virtual desktop computer through the APP by using the HOOK application programming interface (API) mechanism;
  • API application programming interface
  • the remote virtual desktop computer uses the HOOK API mechanism to replace the DSM_Entry interface function address provided by the DSM with the DSM_Entry interface function address provided by the virtual DSM located inside the remote virtual desktop computer.
  • HOOK API technology can be used to intercept the loading of the DSM dynamic library, and to load the virtual DSM dynamic library; or still load the DSM dynamic library, but modify the DSM_Entry interface function address in the memory to provide the DSM_Entry interface function address provided by the virtual DSM.
  • the virtual DSM is taken over to take over the DSM function; all subsequent calls to the DSM_Entry interface function of the application are received and processed by the virtual DSM.
  • step S501b1 the remote virtual desktop computer invokes the virtual DSM through the APP, and obtains the instruction parameters specified by the TWAIN protocol delivered by the APP through the virtual DSM.
  • the remote virtual desktop computer invokes the DSM_Entry of the virtual DSM through the APP.
  • Interface The function of obtaining the command parameters specified by the TWAIN protocol delivered by the APP through the DSM_Entry interface function of the virtual DSM is not specifically limited in this embodiment of the present invention.
  • the DSM_Entry invoked by the remote virtual desktop computer through the APP is a DSM_Entry implementation of the virtual DSM, but this is transparent to the APP. That is, the APP does not know at all, that is, the APP does not need to make any modifications.
  • dynamic replacement ensures that the DSM_Entry function called by the APP is the DSM_Entry implementation of the virtual DSM, not the DSM_Entry implementation of the DSM.
  • the command parameters specified by the TWAIN protocol may also be packaged through the DSM_Entry interface function.
  • the first message packet is obtained, which is not specifically limited in the embodiment of the present invention.
  • the virtual DSM 623 in the embodiment of the present invention is a DSM that implements the DSM_Entry interface and satisfies the TWAIN specification, and can establish an inter-process communication (such as a NamedPipe pipeline) with the TWAIN server 621 according to the actual situation of the context, and deliver the APP622.
  • the relevant instruction parameters in the DSM_Entry interface function are packaged according to a certain message format, and then sent to the TWAIN client 611 through the TWAIN server 621; and the response message returned by the TWAIN server 621 can be unpacked and returned to the APP 622 to complete the entire process. Interaction.
  • This embodiment of the present invention does not specifically limit this.
  • the message header carries some information necessary for message routing, such as the process identifier of the process in which the virtual data source is located.
  • PID process IDentifier
  • SID Source Identifier
  • the SID can ensure that the message sent by the remote virtual desktop computer can be sent to the designated place, and the PID can ensure the response returned by the terminal and can be returned to the corresponding place.
  • the SID can be obtained by:
  • the APP When the user opens the TWAIN-compliant application APP in the remote virtual desktop, the APP sends the DSM command after the virtual DSM is loaded, and the virtual DSM forwards the open DSM instruction to the terminal for processing, and returns the corresponding terminal from the terminal side. The result can then be followed by other instructions to obtain detailed information (including SID values) of the data source on the terminal side to obtain a DS list. Therefore, on the APP, when the user selects a certain DS in the DS list, the APP obtains the SID corresponding to the DS or related detailed information corresponding to the DS, and the related detailed information corresponding to the DS includes the SID, and the SID may be Directly corresponds to a data source on the terminal side.
  • the TWAIN server 621 in the remote virtual desktop computer 62 in the embodiment of the present invention generally runs as a system service or a daemon; and can wait for the TWAIN client 611 to establish a virtual channel (eg, based on a transmission control protocol (Transmission Control). Protocol, abbreviation: TCP)/Internet Protocol (IP) connection, virtual channel based on desktop protocol, etc.; can wait for virtual DSM623 to establish inter-process communication channel (such as NamedPipe pipeline); can be under virtual DSM623
  • TCP Transmission Control
  • IP Internet Protocol
  • the sent TWAIN message packet is forwarded to the TWAIN client 611 for processing; the response result processed by the TWAIN client 611 can be forwarded to the corresponding virtual DSM 623 for processing.
  • This embodiment of the present invention does not specifically limit this.
  • the remote redirection system 80 of the TWAIN protocol as shown in FIG. 8 is taken as an example for description.
  • the TWAIN protocol remote redirection system 80 includes a terminal 81 and a remote virtual desktop computer 82.
  • the terminal 81 includes: a TWAIN client 811, a DSM 812, and an image device data source 813.
  • the remote virtual desktop computer 82 includes a TWAIN server 821, an APP 822, a DSM 823, a virtual data source 824, a local data source 825, and the like.
  • the image device data source 813 on the terminal 81 side maps the virtual data source 824 on the remote virtual desktop computer 82 side through the TWAIN redirection mapping.
  • the TWAIN client 811, the TWAIN server 821, and the virtual data source 824 constitute the TWAIN redirection framework body of the embodiment of the present invention, and are responsible for completing the TWAIN protocol redirection mapping, and successfully mapping multiple image device data sources on the local terminal side. Go to the virtual desktop system of the remote virtual desktop computer.
  • the remote virtual desktop computer acquires the instruction parameters specified by the TWAIN protocol delivered by the APP (step S501). Specifically, it may include:
  • the remote virtual desktop computer calls the DSM, and loads the designated DS through the DSM.
  • the remote virtual desktop computer invokes the virtual DS through the DSM, and obtains the instruction parameters specified by the TWAIN protocol through the virtual DS, wherein the virtual DS is used to specify the TWAIN protocol.
  • the command parameters are redirected to the terminal.
  • the remote virtual desktop computer loads the DSM set inside the remote virtual desktop computer through the APP.
  • step S501b2 the remote virtual desktop computer invokes the DSM, and loads the designated DS through the DSM.
  • the remote virtual desktop computer invokes the DSM_Entry interface function of the DSM, and loads the designated DS through the DSM_Entry interface function of the DSM; step S501c2
  • the medium and remote virtual desktop computer calls the virtual DS through the DSM, and obtains the instruction parameters specified by the TWAIN protocol through the virtual DS.
  • the remote virtual desktop computer calls the DS_Entry interface function of the virtual DS through the DSM_Entry interface function, and passes the DS_Entry interface of the virtual DS.
  • the function obtains the instruction parameters specified by the TWAIN protocol. This embodiment of the present invention does not specifically limit this.
  • the instruction parameter specified by the TWAIN protocol may be packaged through the DS_Entry interface function to obtain the first
  • the message packet is not specifically limited in this embodiment of the present invention.
  • the virtual data source 824 in the embodiment of the present invention implements a DS_Entry interface.
  • a data source that satisfies the TWAIN specification such as hw_twain.ds
  • the virtual data source 824 will be DSM Loading the identification and establishing a communication channel with the TWAIN server 824 (such as the NamedPipe pipeline); in addition, the virtual data source 824 can package the relevant instruction parameters in the DS_Entry interface function according to a certain message format according to the actual situation of the context, and then pass the TWAIN service.
  • the terminal 821 is sent to the TWAIN client 811, which is not specifically limited in this embodiment of the present invention.
  • the method may further include:
  • the remote virtual desktop computer acquires information of at least one image device data source.
  • the remote virtual desktop computer respectively creates a virtual data source corresponding to each image device data source in the at least one image device data source according to the preset rule and the information of the at least one image device data source.
  • the TWAIN server 821 obtains the number of the image device data sources 813 and the source information
  • the TWAIN client 811 may be remotely located.
  • the virtual desktop computer side dynamically virtualizes a plurality of virtual data sources 824, that is, in the data source directory specified by the TWAIN protocol, multiple data sources are created as virtual data sources in the remote virtual desktop computer as the terminal side image device data source 813. 824.
  • the virtual mode is based on the virtual data source 824 (such as hw_twain.ds) provided in the solution, and copies the generated virtual data sources (such as hw_twain_1.ds, hw_twain_2.ds, etc.) with different file names according to certain rules.
  • the implementation of these virtual data sources 824 is exactly the same, and will be searched and loaded by the DSM 823, and the inter-process communication channel will be established and interacted with the TWAIN server 821.
  • the inter-process communication is established with the TWAIN server 821.
  • the channel interacts with each other; and according to the TWAIN protocol, when APP822 opens/closes the DSM 823 or opens a data source, the DSM loads/unloads the data source (including each virtual data source 824) multiple times to obtain its data source information or perform Various operations, etc.; this causes the communication channel of the virtual data source 824 and the TWAIN server 821 to be established/closed multiple times; that is, the TWAIN server 821 cannot maintain a certain virtual data source and an image device according to the communication channel.
  • the virtual data source 824 and the TWAIN server 821 are required to cooperate to complete mapping of a virtual data source 824 to an image device data source 813. This mapping relationship is maintained during the operation of APP822 to solve the message packet routing problem.
  • the remote virtual desktop computer respectively creates a virtual data source corresponding to each image device data source in the at least one image device data source according to the preset rule and the information of the at least one image device data source (steps) After S506), it also includes:
  • the remote virtual desktop computer establishes a mapping relationship between each image device data source of the at least one image device data source and a virtual data source corresponding thereto.
  • the remote virtual desktop computer invokes the virtual DS through the DSM, and obtains the command parameters specified by the TWAIN protocol through the virtual DS (step S501c2), the remote virtual desktop computer sends the first The message packet is sent to the terminal, and before the first message packet carries the command parameter specified by the TWAIN protocol (step S502), the method may further include:
  • the remote virtual desktop computer determines, according to the mapping relationship, information of an image device data source corresponding to the specified data source.
  • the remote virtual desktop computer sends the first message packet to the terminal, where the first message packet carries the command parameters specified by the TWAIN protocol (step S502), and specifically includes:
  • the remote virtual desktop computer sends a first message packet to the terminal, where the first message packet carries the instruction parameter specified by the TWAIN protocol and the information of the image device data source corresponding to the specified data source.
  • the correspondence between the SID of each image device data source in at least one image device data source and the virtual data source identifier ( virtual Identifier, VID) of the virtual data source corresponding to each image device data source may be established.
  • the SID may be the same as the original data source identifier (ID) of the terminal side, or may be a value of a certain one-to-one relationship mapping, which is not specifically limited in the embodiment of the present invention.
  • the process ID of the process itself can be obtained through the operating system API as the PID of the process where the virtual data source resides; and the module name of the module can be obtained (such as hw_twain.ds).
  • the obtained module file is named hw_twain.ds, and the module file obtained by hw_twain_1.ds is named hw_twain_1.ds), which is directly used as the virtual data source identifier VID; or continues to extract the number from the module file name as the virtual data.
  • Source ID VID (if the number extracted by hw_twain.ds is 0, the number extracted by hw_twain_1.ds is 1); the subsequent ⁇ PID, VID> is used as the key information in the message header to communicate with the TWAIN server.
  • the TWAIN server internally constructs a routing table to persist the mapping relationship between the virtual data source and the image device data source, and distributes the request and response messages of each virtual data source according to the routing table.
  • the routing table can As shown in Table 1:
  • the routing table is a static routing table.
  • the TWAIN server 821 cooperates with the TWAIN client 811.
  • all APP processes have the same mapping between VID and SID (ID). Therefore, only the correspondence between ⁇ VID and SID> needs to be recorded in the routing table.
  • the routing table in the embodiment of the present invention may also be dynamically generated, that is, when the APP process communicates with the TWAIN server for the first time, the TWAIN server 821 newly assigns a corresponding to the PID and the VID in the routing table.
  • SID to ensure that each VID corresponds to the SID in the APP process corresponding to the PID.
  • the mapping relationship may be different in each APP process, and the number of records in the entire routing table is dynamically changed. Therefore, the correspondence between ⁇ PID, VID, and SID> needs to be recorded in the routing table. As shown in Table 2.
  • the TWAIN server 821 generally clears the manner in which the APP process is closed. Resources related to this process, such as clearing the routing records associated with this APP process in the routing table. This embodiment of the present invention does not specifically limit this.
  • the APP and the DSM communicate through the DSM_Entry interface function, and the DSM and the virtual data source communicate through the DS_Entry interface function, and the present invention implements This example does not specifically limit this.
  • the APP in the remote virtual desktop computer may also use the local data source, which is not specifically limited in this embodiment of the present invention.
  • the local data source on the remote virtual desktop computer side is not necessarily related to a specific image device, and only needs to be a data source that satisfies the TWAIN protocol. Whether the data source interacts with the USB image device or with a non-USB image device does not affect the remote redirection of the TWAIN protocol.
  • the data source can directly interact with the disk file to obtain image data from the image file, which is not specifically limited in the embodiment of the present invention.
  • the embodiment of the present invention provides a remote redirection method of the TWAIN protocol, which includes: when a user obtains an image operation by using an APP that supports the TWAIN protocol in a remote virtual desktop, the remote virtual desktop computer obtains an instruction specified by the TWAIN protocol delivered by the APP.
  • the remote virtual desktop computer sends the first message packet to the terminal, the first message packet carries the instruction parameter specified by the TWAIN protocol; the remote virtual desktop computer receives the second message packet sent by the terminal, and the second message packet carries the operation result corresponding to the instruction parameter.
  • the operation result corresponding to the instruction parameter is obtained by processing the image device data source disposed inside the terminal; the remote virtual desktop computer feeds back the operation result corresponding to the instruction parameter to the APP according to the data format specified by the TWAIN protocol.
  • the remote virtual desktop computer sends the command parameters specified by the TWAIN protocol delivered by the APP to the terminal, and the terminal is set in the terminal according to the TWAIN protocol.
  • the image device data source returns the result of the operation to the remote virtual desktop computer after performing the operation specified by the instruction parameter. That is, the embodiment of the present invention performs a corresponding operation by an image device data source set inside the terminal, such as opening an image device data source.
  • the image device data source has the function of previewing and filtering. Therefore, by performing the corresponding operation on the image device data source set inside the terminal, The original image data can be filtered on the terminal side according to the user's parameter settings, and finally the image conforming to the preset rule is sent to the remote virtual desktop computer, without requiring all the slave USB image devices as in the prior art.
  • a large amount of original image data obtained by scanning is transmitted from the local terminal side to the remote virtual desktop computer through USB redirection, and then the original image data is performed by the image device data source in the remote virtual desktop computer according to the user's parameter setting. Processing (such as image format conversion, image compression, etc.) and filtering are provided to the application.
  • the data source is not necessarily related to a specific image device, and only needs to be a data source that satisfies the TWAIN protocol.
  • it may be a data source of an image device of a USB interface class that satisfies the TWAIN protocol, or a data source of an image device of a non-USB interface class that satisfies the TWAIN protocol, thereby avoiding remote redirection of a USB image device in the prior art.
  • the versatility caused by the method is poor, which improves the versatility of the TWAIN protocol remote redirection process.
  • the remote redirection method of the TWAIN protocol provided by the embodiment of the present invention can avoid the technical problems of low efficiency, wasteful bandwidth, and poor versatility caused by the remote redirection method of the USB image device in the prior art. Thereby, the work efficiency and versatility of the TWAIN protocol remote redirection process are improved, and the transmission bandwidth of the TWAIN protocol remote redirection process is saved.
  • the embodiment of the present invention provides a remote redirection method of the TWAIN protocol, which is specifically applied to the terminal of the remote redirection system of the TWAIN protocol as shown in FIG. 6 or FIG. 8 .
  • the method includes:
  • the terminal performs an operation specified by the instruction parameter by using an image device data source set in the terminal according to the instruction parameter, in combination with the TWAIN protocol, and obtains an operation result corresponding to the instruction parameter.
  • the terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the instruction parameter.
  • command parameters specified by the TWAIN protocol may be specifically described in the first embodiment, and details are not described herein again.
  • step S1302 of the embodiment of the present invention the terminal performs an operation specified by the instruction parameter through the image device data source set in the terminal according to the instruction parameter and the TWAIN protocol, and obtains an operation result corresponding to the instruction parameter.
  • the TWAIN client on the terminal side can also separately process according to different meanings of the command parameters in the TWAIN protocol request, such as loading the DSM, accessing the corresponding image device data source through the DSM, and sending a specific TWAIN command to the image device data source to complete the image.
  • the request, the scanning, the transmission operation, and the like are not specifically limited in the embodiment of the present invention.
  • the method may further include:
  • S1304 The terminal compresses an operation result corresponding to the instruction parameter by using a TWAIN client set in the terminal.
  • Step S1303 specifically includes:
  • S1303a The terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the compressed instruction parameter.
  • the TWAIN client can also be extended and enhanced to support the processing of the still image data that has been processed from the image device data source according to the customized TWAIN redirection policy.
  • Loss or different levels of compression processing such as lossy compression processing and/or image format conversion, further reducing the amount of transmitted data, and then transmitting to the remote virtual desktop computer side, by the virtual DSM623 on the remote virtual desktop computer 62 side as shown in FIG. 6 or
  • the virtual data source 824 on the side of the remote virtual desktop computer 82 as shown in FIG. 8 is correspondingly decompressed and fed back to the APP. In this way, the transmission bandwidth of the TWAIN protocol remote redirection process can be further saved.
  • the first message packet may further carry the information of the data source of the image device, and the terminal performs the operation specified by the instruction parameter according to the instruction parameter and the TWAIN protocol by setting the image device data source inside the terminal.
  • the method may further include:
  • the terminal determines an image device data source set inside the terminal according to the information of the image device data source.
  • the SID of the image device data source may be carried in the first message packet, where the SID may be the same as the original data source ID of the terminal side, or may be a certain value after mapping the one-to-one relationship.
  • the embodiment of the invention is not specifically limited thereto.
  • the message header carries some information necessary for message routing. Therefore, in the embodiment of the present invention, the first message packet may include other information in addition to the SID, which is not specifically limited in the embodiment of the present invention.
  • one possible message routing information is ⁇ PID, SID>, that is, the first message packet can carry the SID of the image device data source and the virtual data.
  • the PID of the process in which the source is located wherein the SID is to ensure that the sent message can be sent to a specified place, and the PID is used to ensure that the response returned by the terminal can be returned to the corresponding place, which is not specifically limited in the embodiment of the present invention.
  • one possible message routing information is ⁇ PID, VID, SID>, that is, the first message packet can carry an image device.
  • the SID is to ensure that the sent message can be sent to the specified place.
  • the PID and VID are used to ensure the response returned by the terminal. The embodiment of the present invention does not specifically limit this.
  • the method before the terminal receives the first message packet sent by the remote virtual desktop computer (step S1301), the method further includes:
  • the terminal When the terminal establishes a virtual channel with the remote virtual desktop computer, the terminal acquires information of at least one image device data source.
  • the terminal sends information of the at least one image device data source to the remote virtual desktop computer, and the remote virtual desktop computer creates the virtual data corresponding to the at least one image device data source according to the preset rule and the information of the at least one image device data source. source.
  • the TWAIN client when the terminal establishes a virtual channel with the remote virtual desktop computer, the TWAIN client may be triggered to perform image device data source traversal, so that the terminal acquires information of at least one image device data source.
  • the terminal may acquire information of the at least one image device data source by using at least one of the following manners:
  • the embodiment of the present invention does not specifically limit the DSM that is loaded by the terminal, the DSM that is built in the terminal, and the DS that is built in the terminal.
  • the TWAIN client on the terminal side may not need to load the data source manager and/or the image device data source, but may have some necessary functions of the data source manager and/or the image device data source. This embodiment of the present invention does not specifically limit this.
  • the main function of DSM is to search and load the data source with the extension ds in the specified directory according to the TWAIN protocol, and then call its DS_Entry interface to obtain the relevant information in the data source.
  • the TWAIN client may not load the DSM, but directly into the directory, search and load the data source, and then call its DS_Entry interface to perform support interaction with the data source. This is equivalent to The TWAIN client itself has some of the necessary features of the Data Source Manager.
  • the directory searched by the TWAIN client may be a directory and a subdirectory specified in the TWAIN protocol, and may be other.
  • the data source searched and loaded by the TWAIN client may be ds or may be other, in the embodiment of the present invention. This is not specifically limited.
  • the data source of the image device on the terminal side is not necessarily related to a specific image device, and only needs to be a data source that satisfies the TWAIN protocol. Whether the data source interacts with the USB image device or with a non-USB image device does not affect the remote redirection of the TWAIN protocol.
  • the data source can directly interact with the disk file to obtain image data from the image file, which is not specifically limited in the embodiment of the present invention.
  • the embodiment of the present invention provides a remote redirection method of the TWAIN protocol, including: when a user triggers an image operation by using an TWAIN-compliant APP in a remote virtual desktop, the terminal receives the first message packet sent by the remote virtual desktop computer, A message packet carries the instruction parameters specified by the TWAIN protocol; the terminal performs the operation specified by the instruction parameter by setting the image device data source inside the terminal according to the instruction parameter, and obtains the operation result corresponding to the instruction parameter; the terminal sends the second The message packet is sent to the remote virtual desktop computer, and the second message packet carries the operation result corresponding to the instruction parameter.
  • the command parameter parameter is specified by the image device data source set in the terminal.
  • the terminal After the operation, the terminal returns the operation result to the remote virtual desktop computer, and the remote virtual desktop computer feeds back the operation result corresponding to the instruction parameter to the APP in the data format specified by the TWAIN protocol. That is, the embodiment of the present invention performs a corresponding operation by an image device data source set inside the terminal, such as opening an image device data source. Considering that most of the data is transmitted between the image device data source and the image device, the image device data source has the function of previewing and filtering.
  • the image device data source set inside the terminal it can be based on the terminal side.
  • User parameter Setting processing the original image data (such as image format conversion, image compression, etc.) and filtering, and finally sending the image conforming to the preset rule to the remote virtual desktop computer, without the need to All of the large amount of original image data scanned from the USB image device is transmitted from the local terminal side to the remote virtual desktop computer through USB redirection, and then the image device data source in the remote virtual desktop computer is set according to the user's parameters.
  • the raw image data is processed (such as image format conversion, image compression, etc.) and filtered, and then provided to the application.
  • the data source is not necessarily related to a specific image device, and only needs to be a data source that satisfies the TWAIN protocol.
  • it may be a data source of an image device of a USB interface class that satisfies the TWAIN protocol, or a data source of an image device of a non-USB interface class that satisfies the TWAIN protocol, thereby avoiding remote redirection of a USB image device in the prior art.
  • the versatility caused by the method is poor, which improves the versatility of the TWAIN protocol remote redirection process.
  • the remote redirection method of the TWAIN protocol provided by the embodiment of the present invention can avoid the technical problems of low efficiency, wasteful bandwidth, and poor versatility caused by the remote redirection method of the USB image device in the prior art. Thereby, the work efficiency and versatility of the TWAIN protocol remote redirection process are improved, and the transmission bandwidth of the TWAIN protocol remote redirection process is saved.
  • the embodiment of the present invention provides a remote redirection method of the TWAIN protocol, which is specifically illustrated in the remote redirection system 60 of the TWAIN protocol as shown in FIG. 6. As shown in FIG. 16, the method includes:
  • the virtual DSM is used to redirect the command parameters specified by the TWAIN protocol to the terminal.
  • the remote virtual desktop computer invokes the virtual DSM through the APP, and obtains the instruction parameters specified by the TWAIN protocol through the virtual DSM.
  • the remote virtual desktop computer sends the first message packet to the terminal, where the first message packet carries the instruction parameters specified by the TWAIN protocol.
  • the terminal receives the first message packet.
  • S1605 The terminal performs an operation specified by the instruction parameter by using an image device data source set in the terminal according to the instruction parameter, in combination with the TWAIN protocol, and obtains an operation result corresponding to the instruction parameter.
  • S1607 The terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the compressed instruction parameter.
  • a remote redirection method of the TWAIN protocol is provided in the embodiment of the present invention.
  • the remote redirection system 80 of the TWAIN protocol shown in FIG. 8 is used as an example. As shown in FIG. 17, the method includes:
  • the remote virtual desktop computer respectively creates a virtual data source corresponding to each image device data source in the at least one image device data source according to the preset rule and the information of the at least one image device data source.
  • the remote virtual desktop computer invokes the DSM and loads the specified data source through the DSM.
  • the remote virtual desktop computer invokes the virtual DS through the DSM, and obtains the instruction parameters specified by the TWAIN protocol through the virtual DS.
  • the virtual DS is used to redirect the command parameters specified by the TWAIN protocol to the terminal.
  • the remote virtual desktop computer sends a first message packet to the terminal, where the first message packet carries the instruction parameters specified by the TWAIN protocol.
  • S1707 The terminal receives the first message packet.
  • S1708 The terminal performs an operation specified by the instruction parameter by using an image device data source set in the terminal according to the instruction parameter, in combination with the TWAIN protocol, and obtains an operation result corresponding to the instruction parameter.
  • S1710 The terminal sends a second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the compressed instruction parameter.
  • the remote virtual desktop computer receives the second message packet.
  • the embodiment of the present invention provides a remote virtual desktop computer 1800.
  • the remote virtual desktop computer 1800 includes an obtaining unit 1802, a sending unit 1803, a receiving unit 1804, and a feedback unit 1805.
  • the obtaining unit 1802 is configured to: when the user triggers the image acquisition operation by using the TWAIN-enabled application APP in the remote virtual desktop, and acquires the instruction parameter specified by the TWAIN protocol delivered by the APP.
  • the sending unit 1803 is configured to send a first message packet to the terminal, where the first message packet carries the instruction parameter specified by the TWAIN protocol.
  • the receiving unit 1804 is configured to receive a second message packet sent by the terminal, where the second message packet carries an operation result corresponding to the instruction parameter, where an operation result corresponding to the instruction parameter is set by The image device data source inside the terminal is processed.
  • the feedback unit 1805 is configured to feed back an operation result corresponding to the instruction parameter to the APP in a data format specified by the TWAIN protocol.
  • the obtaining unit 1802 includes: a calling module 1802a and a loading module 1802b.
  • the loading module 1802b is configured to load the device by using the HOOK API mechanism through the APP.
  • a virtual data source manager DSM disposed within the remote virtual desktop computer, wherein the virtual DSM is configured to redirect the instruction parameters specified by the TWAIN protocol to the terminal.
  • the calling module 1802a is configured to invoke the virtual DSM by using the APP, and obtain, by using the virtual DSM, an instruction parameter specified by the TWAIN protocol delivered by the APP.
  • the loading module 1802b is configured to load, by using the APP, a DSM disposed inside the remote virtual desktop computer;
  • the calling module 1802a is configured to invoke the DSM, and load the specified data source DS through the DSM;
  • the calling module 1802a is further configured to: if the designated DS is a virtual DS set in the remote virtual desktop computer, invoke the virtual DS by using the DSM, and obtain the TWAIN protocol requirement by using the virtual DS.
  • the instruction parameter, wherein the virtual DS is used to redirect the instruction parameters specified by the TWAIN protocol to the terminal.
  • the remote virtual desktop computer 1800 further includes: a creating unit 1806.
  • the obtaining unit 1802 further includes: an obtaining module 1802c.
  • the obtaining module 1802c is configured to acquire information of at least one image device data source when the terminal establishes a virtual channel with the remote virtual desktop computer 1800.
  • the creating unit 1806 is configured to respectively create a virtual DS corresponding to each image device data source in the at least one image device data source according to a preset rule and information of the at least one image device data source.
  • the remote virtual desktop computer 1800 further includes: an establishing unit 1807, and a determining unit 1808.
  • the establishing unit 1807 is configured to create, in the at least one image device data source, the creation unit 1806 according to the preset rule and the information of the at least one image device data source. After the virtual DS corresponding to each image device data source, a mapping relationship between each image device data source of the at least one image device data source and a virtual DS corresponding thereto is established.
  • the determining unit 1808 if the designated DS is a virtual DS disposed inside the remote virtual desktop computer, the calling module 1802a invokes the virtual DS through the DSM, and acquires the virtual DS through the virtual DS.
  • the sending unit 1803 sends a first message packet to the terminal, and before the first message packet carries the instruction parameter specified by the TWAIN protocol, determining the design according to the mapping relationship. Information about the image device data source corresponding to the data source.
  • the sending unit 1803 is specifically configured to:
  • the method for remotely redirecting the TWAIN protocol by using the remote virtual desktop computer 1800 can be referred to the description of the first embodiment or the third embodiment, and details are not described herein again.
  • the remote virtual desktop computer 1800 of the present embodiment can be used to perform the foregoing method. Therefore, the technical effects that can be obtained can also be referred to the description in the foregoing embodiments, and details are not described herein again.
  • the embodiment of the present invention provides a terminal 2200.
  • the terminal 2200 includes: a receiving unit 2201, an executing unit 2202, and a sending unit 2203.
  • the receiving unit 2201 is configured to receive a first message packet sent by the remote virtual desktop computer when the user triggers the image acquisition operation by using the TWAIN protocol-enabled application APP in the remote virtual desktop, where the first message packet carries the TWAIN protocol Instruction parameters.
  • the executing unit 2202 is configured to perform, according to the instruction parameter, the operation specified by the instruction parameter by setting an image device data source inside the terminal according to the TWAIN protocol, and obtain an operation corresponding to the instruction parameter. result.
  • the sending unit 2203 is configured to send a second message packet to the remote virtual desktop computer, where the second message packet carries an operation result corresponding to the instruction parameter.
  • the terminal 2200 further includes: a compression unit 2204.
  • the compression unit 2204 is configured to compress an operation result corresponding to the instruction parameter by a TWAIN client disposed inside the terminal before the sending unit 2203 sends the second message packet to the remote virtual desktop computer.
  • the sending unit 2203 is specifically configured to:
  • the terminal 2200 further includes a determining unit 2205.
  • the first message packet also carries information of an image device data source.
  • the determining unit 2205 is configured to perform, according to the instruction parameter, the TWAIN protocol according to the instruction parameter, an operation of specifying the instruction parameter by setting an image device data source inside the terminal, and obtaining the Before the operation result corresponding to the instruction parameter, the image device data source set inside the terminal is determined according to the information of the image device data source.
  • the terminal 2200 further includes: an obtaining unit 2206.
  • the obtaining unit 2206 is configured to acquire at least one image device data when the terminal 2200 establishes a virtual channel with the remote virtual desktop computer before the receiving unit 2201 receives the first message packet sent by the remote virtual desktop computer. Source information.
  • the sending unit 2203 is further configured to send information of the at least one image device data source to the remote virtual desktop computer, where the remote virtual desktop computer creates data with the at least one image device according to a preset rule.
  • the virtual data source corresponding to the source.
  • the obtaining unit 2205 is specifically configured to:
  • the terminal 2200 acquires the at least one image by using at least one of the following manners Device data source information:
  • the data source manager DSM loaded by the terminal 2200, the DSM built in the terminal 2200, and the DS built in the terminal 2200.
  • the method for performing the remote redirection of the TWAIN protocol by the terminal 2200 may refer to the description of the second embodiment or the third embodiment, and details are not described herein again.
  • the terminal 2200 of the present embodiment can be used to perform the foregoing method. Therefore, the technical effects that can be obtained can also be referred to the description in the foregoing embodiment, and details are not described herein again.
  • the embodiment of the present invention provides a remote virtual desktop computer 2600, as shown in FIG. 26, including at least one processor 2602 (for example, a central processing unit (CPU)), at least one network interface 2605, or other communication interface. And a memory 2606, and at least one communication bus 2603.
  • processor 2602 for example, a central processing unit (CPU)
  • network interface 2605 for example, a USB interface
  • memory 2606 for example, a hard disk drive, or other communication interface.
  • the at least one communication bus 2603 is configured to implement connection communication between the processor 2602, at least one network interface 2605 or other communication interface, and the memory 2606.
  • the processor 2602 is configured to execute an executable module, such as a computer program, stored in the memory 2606.
  • the memory 2606 may include a high-speed random access memory (RAM), a read-only memory (ROM), and may also include a non-volatile memory, such as At least one disk storage.
  • RAM random access memory
  • ROM read-only memory
  • non-volatile memory such as At least one disk storage.
  • the communication connection between the remote virtual desktop computer 2600 and at least one other device may be implemented by at least one network interface 2605 (which may be wired or wireless), such as the Internet, a wide area network, a local network, a metropolitan area network, or the like.
  • network interface 2605 which may be wired or wireless
  • the Internet such as the Internet, a wide area network, a local network, a metropolitan area network, or the like.
  • the memory 2606 stores a program 26061, and the program 26061 can be executed by the processor 2602.
  • the program 26061 includes:
  • the operation result corresponding to the instruction parameter is fed back to the APP in a data format specified by the TWAIN protocol.
  • the acquiring the instruction parameters specified by the TWAIN protocol delivered by the APP includes:
  • a virtual data source manager DSM disposed inside the remote virtual desktop computer by using a HOOK API mechanism, wherein the virtual DSM is configured to redirect the instruction parameter specified by the TWAIN protocol to the terminal ;
  • the virtual DSM is invoked by the APP, and the instruction parameters specified by the TWAIN protocol delivered by the APP are obtained by the virtual DSM.
  • the acquiring the instruction parameters specified by the TWAIN protocol delivered by the APP includes:
  • the virtual DS is invoked by the DSM, and the instruction parameters specified by the TWAIN protocol are acquired by the virtual DS, where the virtual The DS is configured to redirect the instruction parameters specified by the TWAIN protocol to the terminal.
  • the method further includes:
  • the method further includes:
  • the virtual DS is invoked by the DSM, and the command parameters specified by the TWAIN protocol are obtained by the virtual DS, and then the first Before the message packet is sent to the terminal, the method further includes:
  • the method for remotely redirecting the TWAIN protocol by using the remote virtual desktop computer 2600 may refer to the description of the first embodiment or the third embodiment, and details are not described herein again.
  • the remote virtual desktop computer 2600 of the present embodiment can be used to perform the foregoing method. Therefore, the technical effects can be obtained by referring to the description in the foregoing embodiments, and details are not described herein again.
  • the embodiment of the present invention provides a terminal 2700, as shown in FIG. 27, including at least one processor 2702 (for example, a CPU), at least one network interface 2705 or other communication interface, a memory 2706, and at least one communication bus 2703.
  • processor 2702 for example, a CPU
  • network interface 2705 or other communication interface for example, a USB interface
  • memory 2706 for example, a USB interface
  • the at least one communication bus 2703 is configured to implement connection communication between the processor 2702, at least one network interface 2705 or other communication interface, and the memory 2706.
  • the processor 2702 is configured to execute executable modules, such as computer programs, stored in the memory 2706.
  • Memory 2706 may include RAM, ROM, and may also include non-volatile memory, such as at least one disk storage.
  • the communication connection between the remote virtual desktop computer 2700 and at least one other device is implemented by at least one network interface 2705 (which may be wired or wireless), and may use an Internet, a wide area network, a local network, a metropolitan area network, or the like.
  • the memory 2706 stores a program 27061, and the program 27061 can be executed by the processor 2702.
  • the program 27061 includes:
  • the method further includes:
  • the sending the second message packet to the remote virtual desktop computer, where the second message packet carries the operation result corresponding to the instruction parameter including:
  • the first message packet further carries information of an image device data source.
  • the method further includes :
  • the method further includes:
  • the terminal 2700 When the terminal 2700 establishes a virtual channel with the remote virtual desktop computer, information of at least one image device data source is acquired.
  • the acquiring information of the at least one image device data source includes:
  • a data source manager DSM loaded by the terminal, a DSM built in through the terminal, and a DS built in through the terminal.
  • the method for performing the remote redirection of the TWAIN protocol by the terminal 2700 can be referred to the description of the second embodiment or the third embodiment.
  • the terminal 2700 of the present embodiment can be used to perform the foregoing method. Therefore, the technical effects that can be obtained can also be referred to the description in the foregoing embodiment, and details are not described herein again.
  • the embodiment of the present invention provides a TWAIN protocol remote redirection system 2800.
  • the system includes the remote virtual desktop computer 1800 according to the fourth embodiment and the terminal 2200 according to the fifth embodiment.
  • the method for remotely redirecting the TWAIN protocol by the remote redirection system 2800 of the TWAIN protocol can be referred to the description of the third embodiment, which is not described in detail in the embodiment of the present invention.
  • the remote redirection system 2800 of the TWAIN protocol of the present embodiment can be used to perform the foregoing method. Therefore, the technical effects that can be obtained can also be referred to the description in the foregoing embodiment, and details are not described herein again.
  • the above described device is only illustrated by the division of the above functional modules. In practical applications, the above functions may be assigned differently according to needs.
  • the function module is completed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above.
  • the device and the unit described above refer to the corresponding process in the foregoing method embodiment, and details are not described herein again.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules or units is only a logical function division.
  • there may be another division manner for example, multiple units or components may be used.
  • Combinations 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 through some interface, device or unit.
  • the coupling or communication connection can be in 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 technical solution of the present invention which is essential or contributes 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 storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Facsimiles In General (AREA)

Abstract

一种TWAIN协议的远程重定向方法、装置及系统,以至少解决现有技术中采用USB图像设备的远程重定向方式所导致的效率较低、带宽浪费、通用性较差的问题。包括:当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数(S501);远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数(S502);远程虚拟桌面计算机接收终端发送的第二消息包,第二消息包携带指令参数对应的操作结果,其中,指令参数对应的操作结果是由设置在终端内部的图像设备数据源处理得到的(S503);远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP(S504)。本方法、装置及系统适用于通信领域。

Description

TWAIN协议的远程重定向方法、装置及系统 技术领域
本发明涉及通信领域,尤其涉及无注名工具包(Toolkit Without An Interesting Name,简称:TWAIN)协议的远程重定向方法、装置及系统。
背景技术
现有技术中,在远程虚拟桌面环境中,若远程虚拟桌面需要使用本地终端侧的扫描仪等通用串行总线(Universal Serial Bus,简称:USB)图像设备来获取静态图像,一般采用USB图像设备的远程重定向方式进行获取。
USB图像设备的远程重定向方式的架构示意图如图1所示。其中,USB通用驱动、USB客户端、USB服务端、虚拟USB总线驱动四部分构成USB图像设备的远程重定向框架主体,负责完成USB图像设备的远程重定向映射工作,将本地终端侧的扫描仪等USB图像设备映射到远程虚拟桌面计算机中。用户仅需在远程虚拟桌面计算机中,安装该USB图像设备厂商提供的图像设备驱动以及图像设备数据源,即可使用支持TWAIN协议的应用程序,选择该USB图像设备对应的数据源,进而从USB图像设备上获取静态图像。
然而,在实现上述USB图像设备的远程重定向的过程中,至少存在如下问题:
第一,上述方案需要将本地终端侧的扫描仪等USB图像设备映射到远程虚拟桌面计算机中,在远程虚拟桌面上打开该USB图像设备,这也就意味着所有从USB图像设备上扫描得到的大量原始图像数据,全部原样地通过USB重定向从本地终端侧传输到远程虚拟桌面计算机中,再由远程虚拟桌面计算机中的图像设备数据源根据用户的参数设置,对原始图像数据进行加工处理(如图像格式转换、图像压缩等等)与筛选后,提供给应用程序, 这不可避免的占用或浪费了相当多的带宽,并且导致应用程序获取静态图像的速度很慢,效率较低;
第二,上述方案仅支持USB接口类的图像设备,不支持非USB接口类的图像设备。
发明内容
本发明的实施例提供TWAIN协议的远程重定向方法、装置及系统,以至少解决现有技术中采用USB图像设备的远程重定向方式所导致的效率较低、带宽浪费、通用性较差的技术问题。
为达到上述目的,本发明的实施例采用如下技术方案:
第一方面,提供一种无注名工具包TWAIN协议的远程重定向方法,所述方法包括:
当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数;
所述远程虚拟桌面计算机发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数;
所述远程虚拟桌面计算机接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的;
所述远程虚拟桌面计算机以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
在第一方面第一种可能的实现方式中,结合第一方面,所述远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数,包括:
所述远程虚拟桌面计算机通过所述APP,采用HOOK API机制加载设置 在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端;
所述远程虚拟桌面计算机通过所述APP,调用所述虚拟DSM,通过所述虚拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
在第一方面第二种可能的实现方式中,结合第一方面,所述远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数,包括:
所述远程虚拟桌面计算机通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
所述远程虚拟桌面计算机调用所述DSM,并通过所述DSM加载指定数据源DS;
若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述远程虚拟桌面计算机通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
在第一方面第三种可能的实现方式中,结合第一方面第二种可能的实现方式,所述方法还包括:
当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,所述远程虚拟桌面计算机获取至少一个图像设备数据源的信息;
所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
在第一方面第四种可能的实现方式中,结合第一方面第三种可能的实现方式,在所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据 源对应的虚拟DS之后,还包括:
所述远程虚拟桌面计算机建立所述至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟DS的映射关系;
在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述远程虚拟桌面计算机通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,所述远程虚拟桌面计算机发送第一消息包给所述终端之前,还包括:
所述远程虚拟桌面计算机根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息;
所述远程虚拟桌面计算机发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数,包括:
所述远程虚拟桌面计算机发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设备数据源的信息。
第二方面,提供一种无注名工具包TWAIN协议的远程重定向方法,所述方法包括:
当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,终端接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数;
所述终端根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果;
所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
在第二方面第一种可能的实现方式中,结合第二方面,在所述终端发送第二消息包给所述远程虚拟桌面计算机之前,还包括:
所述终端通过设置在所述终端内部的TWAIN客户端压缩所述指令参数对应的操作结果;
所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果,包括:
所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
在第二方面第二种可能的实现方式中,结合第二方面或第二方面第一种可能的实现方式,所述第一消息包还携带所述图像设备数据源的信息;
在所述终端根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,还包括:
所述终端根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
在第二方面第三种可能的实现方式中,结合第二方面或第二方面第一种可能的实现方式或第二方面第二种可能的实现方式,在所述终端接收远程虚拟桌面计算机发送的第一消息包之前,还包括:
当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,所述终端获取至少一个图像设备数据源的信息;
所述终端发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,创建出与所述至少一个图像设备数据源对应的虚拟数据源DS。
在第二方面第四种可能的实现方式中,结合第二方面第三种可能的实现方式,所述终端获取至少一个图像设备数据源的信息,包括:
所述终端通过下述方式中的至少一个方式获取所述至少一个图像设备数据源的信息:
通过所述终端加载的数据源管理器DSM、通过所述终端内置的DSM、以及通过所述终端内置的DS。
第三方面,提供一种远程虚拟桌面计算机,所述远程虚拟桌面计算机包括:获取单元、发送单元、接收单元、反馈单元;
所述获取单元,用于当用户在远程虚拟桌面中通过支持无注名工具包TWAIN协议的APP触发获取图像操作时,获取所述APP下发的TWAIN协议规定的指令参数;
所述发送单元,用于发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数;
所述接收单元,用于接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的;
所述反馈单元,用于以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
在第三方面第一种可能的实现方式中,结合第三方面,所述获取单元包括:调用模块、加载模块;
所述加载模块,用于通过所述APP,采用HOOK API机制加载设置在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端;
所述调用模块,用于通过所述APP,调用所述虚拟DSM,通过所述虚 拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
在第三方面第二种可能的实现方式中,结合第三方面,所述获取单元包括:调用模块、加载模块;
所述加载模块,用于通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
所述调用模块,用于调用所述DSM,并通过所述DSM加载指定数据源DS;
所述调用模块,还用于若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
在第三方面第三种可能的实现方式中,结合第三方面第二种可能的实现方式,所述远程虚拟桌面计算机还包括:创建单元;
所述获取单元还包括:获取模块;
所述获取模块,用于当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息;
所述创建单元,用于根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
在第三方面第四种可能的实现方式中,结合第三方面第三种可能的实现方式,所述远程虚拟桌面计算机还包括:建立单元、确定单元;
所述建立单元,还用于在所述创建单元根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS之后,建立所述至少一个图像设备数据源中每个 图像设备数据源和与其对应的虚拟DS的映射关系;
所述确定单元,用于在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述调用模块通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,所述发送单元发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数之前,根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息;
所述发送单元具体用于:
发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设备数据源的信息。
第四方面,提供一种终端,所述终端包括:接收单元、执行单元、发送单元;
所述接收单元,用于当用户在远程虚拟桌面中通过支持无注名工具包TWAIN协议的应用APP触发获取图像操作时,接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数;
所述执行单元,用于根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果;
所述发送单元,用于发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
在第四方面第一种可能的实现方式中,结合第四方面,所述终端还包括:压缩单元;
所述压缩单元,用于在所述发送单元发送第二消息包给所述远程虚拟桌面计算机之前,通过设置在所述终端内部的TWAIN客户端压缩所述指令参 数对应的操作结果;
所述发送单元具体用于:
发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
在第四方面第二种可能的实现方式中,结合第四方面或第四方面第一种可能的实现方式,所述终端还包括:确定单元;
所述第一消息包还携带图像设备数据源的信息;
所述确定单元,用于在所述执行单元根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
在第四方面第三种可能的实现方式中,结合第四方面或第四方面第一种可能的实现方式或第四方面第二种可能的实现方式,所述终端还包括:获取单元;
所述获取单元,用于在所述接收单元接收远程虚拟桌面计算机发送的第一消息包之前,当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息;
所述发送单元,还用于发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则,创建出与所述至少一个图像设备数据源对应的虚拟DS。
在第四方面第四种可能的实现方式中,结合第四方面第三种可能的实现方式,所述获取单元具体用于:
通过下述方式中的至少一个方式获取所述至少一个图像设备数据源的信息:
通过所述终端加载的数据源管理器DSM、通过所述终端内置的DSM、以及通过所述终端内置的DS。
第五方面,提供一种无注名工具包TWAIN协议的远程重定向系统,所述系统包括如第三方面任一项所述的远程虚拟桌面计算机以及如第四方面任一项所述的终端。
本发明的实施例提供TWAIN协议的远程重定向方法、装置及系统,包括:当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数;远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数;远程虚拟桌面计算机接收终端发送的第二消息包,第二消息包携带指令参数对应的操作结果,其中,指令参数对应的操作结果是由设置在终端内部的图像设备数据源处理得到的;远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。基于上述方案,由于本发明实施例在进行TWAIN协议的远程重定向时,由远程虚拟桌面计算机将APP下发的TWAIN协议规定的指令参数发送给终端,由终端根据TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作后返回操作结果给远程虚拟桌面计算机。即,本发明实施例通过设置在终端内部的图像设备数据源执行相应的操作,比如打开图像设备数据源。考虑到大部分数据在图像设备数据源与图像设备之间传输,图像设备数据源有预览、筛选的功能,因此通过设置在终端内部的图像设备数据源执行相应的操作,就可以在终端侧根据用户的参数设置,对原始图像数据进行筛选,最终将符合预设规则的图像发送至远程虚拟桌面计算机,而不需要如现有技术中一样,需要将所有从USB图像设备上扫描得到的大量原始图像数据,全部原样地通过USB重定向从本地终端侧传输到远程虚拟桌面计算机中,再由远程虚拟桌面计算机中的图像设备数据源根据用户的参数设置,对原始图像数据进行加工处理(如图像格式转换、图像压缩等等)与筛 选后,提供给应用程序。因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的带宽浪费以及效率较低的问题,从而节省了TWAIN协议远程重定向过程的传输带宽,并且提高了TWAIN协议远程重定向过程的工作效率。另一方面,本发明实施例提供的TWAIN协议的远程重定向方法中,数据源不一定与具体的图像设备相关,只需要是满足TWAIN协议的数据源即可。比如可以是满足TWAIN协议的USB接口类的图像设备的数据源,也可以是满足TWAIN协议的非USB接口类的图像设备的数据源,因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的通用性较差的问题,从而提高TWAIN协议远程重定向过程的通用性。
综上,本发明实施例提供的TWAIN协议的远程重定向方法,能够避免现有技术中采用USB图像设备的远程重定向方式所导致的效率较低、带宽浪费、通用性较差的技术问题,从而提高了TWAIN协议远程重定向过程的工作效率和通用性,并且节省了TWAIN协议远程重定向过程的传输带宽。
附图说明
图1为一种现有的USB图像设备的远程重定向方式的架构示意图;
图2为本发明实施例提供的一种远程虚拟桌面系统示意图;
图3为本发明实施例提供的一种远程虚拟桌面系统架构示意图;
图4为本发明实施例提供的一种TWAIN协议的软件体系结构示意图;
图5为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图一;
图6为本发明实施例提供的TWAIN协议的远程重定向系统架构示意图一;
图7为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图二;
图8为本发明实施例提供的TWAIN协议的远程重定向系统架构示意图二;
图9为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图三;
图10为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图四;
图11为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图五;
图12为本发明实施例提供的一种虚拟数据源与图像设备数据源映射关系原理示意图;
图13为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图六;
图14为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图七;
图15为本发明实施例提供的TWAIN协议的远程重定向方法流程示意图八;
图16为本发明实施例提供的TWAIN协议的远程重定向方法交互示意图一;
图17为本发明实施例提供的TWAIN协议的远程重定向方法交互示意图二;
图18为本发明实施例提供的远程虚拟桌面计算机的结构示意图一;
图19为本发明实施例提供的远程虚拟桌面计算机的结构示意图二;
图20为本发明实施例提供的远程虚拟桌面计算机的结构示意图三;
图21为本发明实施例提供的远程虚拟桌面计算机的结构示意图四;
图22为本发明实施例提供的终端的结构示意图一;
图23为本发明实施例提供的终端的结构示意图二;
图24为本发明实施例提供的终端的结构示意图三;
图25为本发明实施例提供的终端的结构示意图四;
图26为本发明实施例提供的远程虚拟桌面计算机的结构示意图五;
图27为本发明实施例提供的终端的结构示意图五;
图28为本发明实施例提供的一种TWAIN协议的远程重定向系统结构示意图。
具体实施方式
为了下述各实施例的描述清楚简洁,首先给出几个简要介绍:
第一、远程虚拟桌面
远程虚拟桌面是指计算和存储资源集中在远程服务器端(一般为数据中心),通过远程桌面协议将远程虚拟桌面的界面投递到本地的各种终端(如:瘦客户机,台式个人计算机(Personal Computer,简称:PC)、便携PC、移动终端便携式设备(Portable Device,简称:PAD)、智能手机等)上显示出来,同时能把本地终端的各种输入输出设备(如:键盘,鼠标,USB)外设,串并口外设,耳机和麦克风等)映射到远程虚拟桌面计算机端。
一般的远程虚拟桌面系统如图2所示:远程数据中心集中了服务器资源和存储资源100;通过虚拟化操作系统110虚拟出多个虚拟机(Virtual Machine,简称:VM)120,或者无需虚拟化技术直接使用物理PC121,在这些VM或者物理PC上安装操作系统130,并通过远程桌面协议150将远程虚拟桌面的界面投递在本地终端160上显示出来,同时把本地终端上的输入输出设备映射到远程虚拟桌面的计算机端。
远程虚拟桌面系统架构如图3所示:包括终端170(包括各种输入输出设备,如USB/串并口外设、摄像头、显示器、耳麦、键鼠等)、桌面管理系统171、远程虚拟桌面计算机172(比如:VM1、VM2、物理PC1、以及物理PC2等)三部分组成。其中,桌面管理系统171包括桌面和应用管理、用户管理和登录管理三部分,主要是管理远程虚拟桌面计算机172和终端170的注册以及用户登录远程虚拟桌面的管理。远程桌面协议由客户端和服务端 组成,内部根据不同功能划分为不同的服务实现,例如USB/串并口服务客户端和服务器端交互实现各种外设的映射重定向;显示服务客户端和服务器端交互实现远程虚拟桌面投递到终端显示器;音频服务客户端和服务器端交互实现双向音频映射;多媒体服务客户端和服务器端交互实现多媒体服务的播放和录制;键鼠服务客户端和服务器端实现键盘与鼠标映射到远程虚拟桌面。
第二、TWAIN协议
TWAIN协议是应用软件从计算机外设获取静态图像的国际标准,为 开发商和硬件设备生产厂商之间提供了统一的接口规范,使得符合TWAIN协议的软件通过调用TWAIN协议接口就能从兼容TWAIN协议的外设上获取静态图像,而不必考虑外设的功能差别,有效地避免系统及设备之间的不兼容问题。
比如,Photoshop是一款符合TWAIN协议要求的软件。在Photoshop中,通过点击菜单File|Select...可以选择不同的外设,然后点击菜单File|Acquire...弹出相应外设的TWAIN界面对话框,通过这个对话框可以设置图像的各种参数并获取图像。
TWAIN协议的软件体系结构如图4所示,包括应用(Application,简称:APP)、数据源管理器(Data Source Manager,简称:DSM)以及数据源(Data Source,简称:DS)。其中,
APP:指支持TWAIN协议的各种应用,比如Photoshop、WORD等应用。
DSM:其默认实现一般包含在由TWAIN组织提供的TWAIN开发工具包中,它负责协商和管理APP和DS之间的交互通讯,是管理底层数据源与顶层应用之间的交互数据和数据传递的桥梁,还负责收集并根据需要加载本地系统中已经安装的图像设备,如32位Windows下自带的twain_32.dll就 是一个DSM的实现。
DS:按照TWAIN标准开发,用来完成图像的请求、扫描、传输等功能;如果DS与具体图像设备有关,一般会包含在该设备的驱动程序安装包中,如数码相机数据源。根据TWAIN规范,DS应该做成一个动态链接库,不过它的文件扩展名不能为.dll或.so,而应该改为.ds,放在系统指定的目录中(如32位WINDOWS下指定目录为C:\Windows\twain_32\)。
TWAIN软件系统由APP、DSM、DS三部分协同工作,完成图像的请求、扫描、传输。这几个组成部分之间可以并且仅可以通过两个接口(函数)进行交互通信,它们是DSM_Entry及DS_Entry。其在Windows环境下的调用格式分别如下:
TW_UINT16FAR PASCAL DSM_Entry(
pTW_IDENTITY pOrigin,//指向操作发起者的指针
pTW_IDENTITY pDest,  //指向目标对象的指针
TW_UINT32    DG,     //Triplets操作的DG参数:DG_xxxx
TW_UINT16    DAT,    //Triplets操作的DAT参数:DAT_xxxx
TW_UINT16    MSG,    //Triplets操作的MSG参数:MSG_xxxx
TW_MEMREF     pData   //指向数据块的指针
);
TW_UINT16 FAR PASCAL DS_Entry(
pTW_IDENTITY pOrigin,//指向操作发起者的指针
TW_UINT32    DG,     //Triplets操作的DG参数:DG_xxxx
TW_UINT16    DAT,    //Triplets操作的DAT参数:DAT_xxxx
TW_UINT16    MSG,    //Triplets操作的MSG参数:MSG_xxxx
TW_MEMREF    pData    //指向数据块的指针
);
其中DG、DAT、MSG参数表示一个用户想执行的Triplets操作,实质上为TWAIN协议规定的指令参数中的指令部分;pOrigin表示发起Triplets操作的对象;pDest表示接收Triplets操作的对象;pData用于携带传递与Triplets操作相对应的请求数据以及响应数据,实质上为TWAIN协议规定的指令参数中的数据部分。
对于每个Triplets操作,都是由DG、DAT、MSG三个参数组合构成的。pOrigin、pDest参数会根据不同的Triplets操作,而使用不同的值。
函数执行后会返回一个值来表示操作是否成功。如果返回值为TWRC_SUCCESS表示操作成功,TWRC_FAILURE表示操作失败。同样根据Triplets操作的类型不同,还会有其他的返回值。
关于TWAIN协议的具体信息可参考TWAIN协议规范说明手册,本发明在此仅作简要说明,对此不再一一赘述。
第三、远程虚拟桌面计算机中的虚拟DSM:
远程虚拟桌面计算机中的虚拟DSM是一个实现了DSM_Entry接口,满足TWAIN规范的DSM;能根据上下文实际情况,与TWAIN服务端建立进程间通信通道(如NamedPipe管道等),通过TWAIN服务端与终端进行交互。
第四、远程虚拟桌面计算机中的虚拟DS:
远程虚拟桌面计算机中的虚拟DS是一个实现了DS_Entry接口,满足TWAIN规范的数据源(如hw_twain.ds),放在TWAIN协议指定的目录或其子目录中(如32位WINDOWS目录C:\Windows\twain_32\virtual\)。该虚拟DS可以被DSM加载识别,并与TWAIN服务端建立通信通道(如NamedPipe 管道),通过TWAIN服务端与终端进行交互。
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
实施例一、
本发明实施例提供一种TWAIN协议的远程重定向方法,具体应用于远程虚拟桌面计算机中,如图5所示,方法包括:
S501、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数。
S502、远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数。
S503、远程虚拟桌面计算机接收终端发送的第二消息包,第二消息包携带指令参数对应的操作结果,其中,指令参数对应的操作结果是由设置在终端内部的图像设备数据源处理得到的。
S504、远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。
具体的,如图2所示,本发明实施例中,远程虚拟桌面计算机具体可以是物理PC,也可以是VM,本发明实施例对此不作具体限定。
具体的,如具体实施方式前序部分所示,本发明实施例中,TWAIN协议规定的指令参数具体由指令和指令对应的数据两部分构成,其中,指令可以包括:
1、打开指定数据源Triplets操作
OPEN DS:DG=DG_CONTROL,DAT=DAT_IDENTITY,MSG=MSG_OPENDS
2、显示数据源图像获取对话框界面Triplets操作
ENABLE DS:DG=DG_CONTROL,DAT=DAT_USERINTERFACE,MSG=MSG_ENABLEDS
3、通过如下方式之一获取图像数据
方式一:MEM传输图像Triplets操作:
DG=DG_IMAGE,DAT=DAT_IMAGEMEMXFER,MSG=MSG_GET
方式二:NATIVE传输图像Triplets操作:
DG=DG_IMAGE,DAT=DAT_IMAGENATIVEXFER,MSG=MSG_GET
方式三:FILE传输图像Triplets操作:
DG=DG_IMAGE,DAT=DAT_IMAGEFILEXFER,MSG=MSG_GET
4、关闭数据源图像获取对话框界面Triplets操作
DISABLE DS:DG=DG_CONTROL,DAT=DAT_USERINTERFACE,MSG=MSG_DISABLEDS
5、关闭数据源Triplets操作
CLOSE DS:DG=DG_CONTROL,DAT=DAT_IDENTITY,MSG=MSG_CLOSEDS
本领域普通技术人员容易理解,用户通过APP触发获取图像操作,会下发许多条指令,上述仅是列举了一些比较常见的有代表性的指令,当然,还可能存在其它的指令,本发明实施例对此不作具体限定。
需要说明的是,远程虚拟桌面计算机获取的APP下发的TWAIN协议规定的指令参数之后,可以不完全按照TWAIN协议指令来打包消息,而是使用转换后的等价指令或数据来打包消息。比如将TWAIN协议的关闭数据源 Triplets操作指令等价于命令码100的方式来打包消息;这样终端接收到命令码为100的消息包,即可根据预设规则知道此指令是关闭数据源Triplets操作指令,进而还原出原来的TWAIN协议规定的指令;相应的,指令对应的数据,也可以等价转换,特别是带有指针的数据,必须经过转换,本发明实施例对此不作具体限定。
一种可能的实现方式中,以该方法应用在如图6所示的TWAIN协议的远程重定向系统60为例进行说明。如图6所示,该TWAIN协议的远程重定向系统60包括终端61和远程虚拟桌面计算机62。其中,终端61包括:TWAIN客户端611、DSM612、图像设备数据源613;远程虚拟桌面计算机62包括:TWAIN服务端621、APP622、虚拟DSM623、本地数据源624。其中,终端61侧的图像设备数据源613通过TWAIN重定向映射在远程虚拟桌面计算机62侧映射出虚拟图像设备数据源625。TWAIN客户端611、TWAIN服务端621、虚拟DSM623三部分构成本发明实施例TWAIN重定向框架主体,负责完成TWAIN协议的重定向映射,将本地终端侧的多个图像设备数据源,成功映射到远程虚拟桌面计算机的虚拟桌面系统中。
如图7所示,该实现方式中,当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数(步骤S501)具体可以包括:
S501a1、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机通过APP,采用HOOK API机制加载设置在远程虚拟桌面计算机内部的虚拟DSM,其中,虚拟DSM用于将TWAIN协议规定的指令参数重定向至终端。
S501b1、远程虚拟桌面计算机通过APP,调用虚拟DSM,通过虚拟DSM获取APP下发的TWAIN协议规定的指令参数。
需要说明的是,由于DSM本身是一个动态库(如twain_32.dll),由APP 动态加载。因此,为了实现APP加载的DSM具体为设置在远程虚拟桌面计算机内部的虚拟DSM,则在步骤S501a1中,远程虚拟桌面计算机通过APP,采用HOOK API机制加载设置在远程虚拟桌面计算机内部的虚拟DSM,具体可以包括:
远程虚拟桌面计算机通过APP,采用HOOK应用程序编程接口(Application Programming Interface,简称:API)机制直接加载设置在远程虚拟桌面计算机内部的虚拟DSM;
或者,
远程虚拟桌面计算机通过APP,采用HOOK API机制将DSM提供的DSM_Entry接口函数地址替换为设置在远程虚拟桌面计算机内部的虚拟DSM提供的DSM_Entry接口函数地址。
即,可以采用HOOK API技术来拦截DSM动态库的加载,改成加载虚拟DSM动态库;或仍加载DSM动态库,但在内存中修改其DSM_Entry接口函数地址为虚拟DSM提供的DSM_Entry接口函数地址,达到虚拟DSM接管DSM功能的目的;后续应用程序所有DSM_Entry接口函数的调用,都会被虚拟DSM所接收并处理。
需要说明的是,上述仅是示例性的提供两种远程虚拟桌面计算机通过APP,采用HOOK API机制加载设置在远程虚拟桌面计算机内部的虚拟DSM的具体实现方式,当然还可能存在其它可能的实现方式,例如,由于DSM本身对应一个dll文件,因此,一种最简单的方式是,虚拟DSM也实现成一个dll文件,其文件名与DSM的文件名一样,进而直接覆盖掉,这属于静态替换,本发明实施例对此不作具体限定。
需要说明的是,步骤S501b1中远程虚拟桌面计算机通过APP,调用虚拟DSM,通过虚拟DSM获取APP下发的TWAIN协议规定的指令参数,实质上是,远程虚拟桌面计算机通过APP,调用虚拟DSM的DSM_Entry接口 函数,通过虚拟DSM的DSM_Entry接口函数获取APP下发的TWAIN协议规定的指令参数,本发明实施例对此不作具体限定。
需要说明的是,该实现方式中,虽然APP加载的DSM具体为虚拟DSM,远程虚拟桌面计算机通过APP调用的DSM_Entry是虚拟DSM的DSM_Entry实现,但这对APP来说,是透明的。即,APP完全不知道,也就是APP不用做任何修改。而使用HOOK API方式,在APP运行过程中,动态替换,确保了APP调用的DSM_Entry函数是虚拟DSM的DSM_Entry实现,而不是DSM的DSM_Entry实现。
需要说明的是,在远程虚拟桌面计算机通过APP,调用虚拟DSM,通过虚拟DSM获取APP下发的TWAIN协议规定的指令参数(步骤S501b1)之后,还可以通过DSM_Entry接口函数打包TWAIN协议规定的指令参数,获得第一消息包,本发明实施例对此不作具体限定。
即,本发明实施例中的虚拟DSM623是一个实现了DSM_Entry接口,满足TWAIN规范的DSM,能根据上下文实际情况,与TWAIN服务端621建立进程间通信(如NamedPipe管道等),把APP622下发的DSM_Entry接口函数中的相关指令参数按照一定消息格式打包,然后通过TWAIN服务端621发送给TWAIN客户端611;并且能够将TWAIN服务端621返回的响应消息,解包处理后返回给APP622,完成整个过程的交互。本发明实施例对此不作具体限定。
本领域普通技术人员容易理解,第一消息包在终端61与远程虚拟桌面计算机62之间进行传递时,其消息头中会带有一些消息路由必要的信息,比如虚拟数据源所在进程的进程标识符(Process IDentifier简称:PID)和虚拟数据源对应的图像设备数据源的原始数据源标识(Source Identifier,简称:SID)。其中,SID可以保证远程虚拟桌面计算机所发送的消息能发送到指定的地方,PID可以保证终端返回的响应,能返回至相应的地方。本发明实施 例对此不作具体限定。其中,具体可通过如下方式获得该SID:
当用户在远程虚拟桌面中打开支持TWAIN协议的应用APP时,APP在加载虚拟DSM后,会下发打开DSM指令,虚拟DSM会将该打开DSM指令转发给终端处理,并从终端侧返回相应的结果;然后APP还可以下发其它的指令,获取终端侧的数据源的详细信息(包括SID值),得到DS列表。因此,在APP上,当用户选中DS列表中的某一DS时,APP就获取到了该DS对应的SID或该DS对应的相关详细信息,该DS对应的相关详细信息中包含SID,该SID可直接对应终端侧的某一数据源。
需要说明的是,本发明实施例中的远程虚拟桌面计算机62中的TWAIN服务端621一般作为系统服务或守护进程运行;可以等待TWAIN客户端611来建立虚拟通道(如基于传输控制协议(Transmission Control Protocol,简称:TCP)/网络协议(InternetProtocol,简称:IP)的连接、基于桌面协议的虚拟通道等);可以等待虚拟DSM623来建立进程间通信通道(如NamedPipe管道等);可以把虚拟DSM623下发的TWAIN消息包转发给TWAIN客户端611处理;可以把TWAIN客户端611处理的响应结果,路由转发给对应的虚拟DSM623处理。本发明实施例对此不作具体限定。
另一种可能的实现方式中,以如图8所示的TWAIN协议的远程重定向系统80为例进行说明。如图8所示,该TWAIN协议的远程重定向系统80包括终端81和远程虚拟桌面计算机82。其中,终端81包括:TWAIN客户端811、DSM812、图像设备数据源813;远程虚拟桌面计算机82包括:TWAIN服务端821、APP822、DSM823、虚拟数据源824、本地数据源825等。其中,终端81侧的图像设备数据源813通过TWAIN重定向映射在远程虚拟桌面计算机82侧映射出虚拟数据源824。TWAIN客户端811、TWAIN服务端821、虚拟数据源824三部分构成本发明实施例TWAIN重定向框架主体,负责完成TWAIN协议的重定向映射,将本地终端侧的多个图像设备数据源,成功映射到远程虚拟桌面计算机的虚拟桌面系统中。
如图9所示,该实现方式中,当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数(步骤S501),具体可以包括:
S501a2、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机通过APP,加载设置在远程虚拟桌面计算机内部的DSM。
S501b2、远程虚拟桌面计算机调用DSM,并通过DSM加载指定DS。
S501c2、若指定DS为设置在远程虚拟桌面计算机内部的虚拟DS,远程虚拟桌面计算机通过DSM调用虚拟DS,并通过虚拟DS获取TWAIN协议规定的指令参数,其中,虚拟DS用于将TWAIN协议规定的指令参数重定向至终端。
具体的,该实现方式中,远程虚拟桌面计算机通过APP,加载设置在远程虚拟桌面计算机内部的DSM。
需要说明的是,步骤S501b2中远程虚拟桌面计算机调用DSM,并通过DSM加载指定DS,实质上是,远程虚拟桌面计算机调用DSM的DSM_Entry接口函数,并通过DSM的DSM_Entry接口函数加载指定DS;步骤S501c2中远程虚拟桌面计算机通过DSM调用虚拟DS,并通过虚拟DS获取TWAIN协议规定的指令参数,实质上是,远程虚拟桌面计算机通过DSM_Entry接口函数调用虚拟DS的DS_Entry接口函数,并通过虚拟DS的DS_Entry接口函数获取TWAIN协议规定的指令参数。本发明实施例对此不作具体限定。
需要说明的是,在远程虚拟桌面计算机通过DSM调用虚拟DS,并通过虚拟DS获取TWAIN协议规定的指令参数(步骤S501c2)之后,还可以通过DS_Entry接口函数打包TWAIN协议规定的指令参数,获得第一消息包,本发明实施例对此不作具体限定。
即,本发明实施例中的虚拟数据源824是一个实现了DS_Entry接口, 满足TWAIN规范的数据源(如hw_twain.ds),放在TWAIN协议指定的目录或其子目录中(如32位WINDOWS目录C:\Windows\twain_32\virtual\);该虚拟数据源824会被DSM加载识别,并与TWAIN服务端824建立通信通道(如NamedPipe管道);另外,该虚拟数据源824能根据上下文实际情况,把DS_Entry接口函数中的相关指令参数按一定消息格式打包,然后通过TWAIN服务端821发送给TWAIN客户端811,本发明实施例对此不作具体限定。
进一步的,如图10所示,该实现方式中,还可以包括:
S505、当终端与远程虚拟桌面计算机建立虚拟通道时,远程虚拟桌面计算机获取至少一个图像设备数据源的信息。
S506、远程虚拟桌面计算机根据预设规则和至少一个图像设备数据源的信息,分别创建出至少一个图像设备数据源中每个图像设备数据源对应的虚拟数据源。
需要说明的是,在本地终端81侧,可能存在多个图像设备数据源813,TWAIN服务端821通过TWAIN客户端811获取这些图像设备数据源813的个数及各据源信息后,可以在远程虚拟桌面计算机侧动态虚拟出多个虚拟数据源824,即在TWAIN协议规定的数据源目录中,创建出多个数据源,作为终端侧图像设备数据源813在远程虚拟桌面计算机中的虚拟数据源824。其虚拟方式是基于方案中提供的虚拟数据源824(如hw_twain.ds),按照一定规则拷贝生成的不同文件名的虚拟数据源(如hw_twain_1.ds、hw_twain_2.ds等)。这些虚拟数据源824的实现是完全一模一样的,且都会被DSM823搜索到并加载访问,都会与TWAIN服务端821建立进程间通信通道并进行交互。
进一步的,该实现方式中,由于虚拟数据源824的实现完全一样,且都会被DSM823搜索到并加载访问,都会与TWAIN服务端821建立进程间通 信通道并进行交互;并且根据TWAIN协议,APP822打开/关闭DSM823或打开某一数据源时,DSM会多次加载/卸载数据源(含各个虚拟数据源824),以获取其数据源信息或进行各种操作等;这就导致虚拟数据源824与TWAIN服务端821的通信通道会多次建立/关闭;也就导致TWAIN服务端821无法根据通信通道来维护某一虚拟数据源与某一图像设备数据源的映射关系,因此本发明实施例中,还需要虚拟数据源824与TWAIN服务端821进行一定的配合,来完成某一虚拟数据源824到某一图像设备数据源813的映射,并在APP822运行期间一直保持这种映射关系,解决消息包路由问题。
基于以上问题,本发明实施例中,提供一种具体的实现方式以解决该问题。即,如图11所示,在远程虚拟桌面计算机根据预设规则和至少一个图像设备数据源的信息,分别创建出至少一个图像设备数据源中每个图像设备数据源对应的虚拟数据源(步骤S506)之后,还包括:
S507、远程虚拟桌面计算机建立至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟数据源的映射关系。
在若指定DS为设置在远程虚拟桌面计算机内部的虚拟DS,远程虚拟桌面计算机通过DSM调用虚拟DS,并通过虚拟DS获取TWAIN协议规定的指令参数(步骤S501c2)之后,远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数之前(步骤S502)之前,还可以包括:
S508、远程虚拟桌面计算机根据映射关系,确定指定数据源对应的图像设备数据源的信息。
远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数(步骤S502),具体包括:
S502a、远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数和指定数据源对应的图像设备数据源的信息。
示例性的,可以建立至少一个图像设备数据源中每个图像设备数据源的SID与每个图像设备数据源对应的虚拟数据源的虚拟数据源标识符(virtual Identifier,简称:VID)的对应关系,其中,此SID可与终端侧的原始数据源标识(Identifier,简称:ID)相同,也可以是某种一对一关系映射后的某个值,本发明实施例对此不作具体限定。
如图12所示,在虚拟数据源实现时,能通过操作系统API,获取自己所在进程的进程标识,作为该虚拟数据源所在进程的PID;并且可以获取自己的模块文件名(如hw_twain.ds获取的模块文件名为hw_twain.ds,hw_twain_1.ds获取的模块文件名为hw_twain_1.ds),直接以此作为该虚拟数据源标识VID;或继续从该模块文件名中,提取编号作为该虚拟数据源标识VID(如hw_twain.ds提取的编号为0,hw_twain_1.ds提取的编号为1);后续以此<PID、VID>作为关键信息放在消息头中,与TWAIN服务端进行通信。
TWAIN服务端内部会构造一张路由表,来持久保存虚拟数据源与图像设备数据源的映射关系,并据此路由表分发各虚拟数据源的请求及响应消息,示例性的,该路由表可以如表一所示:
表一
VID SID(ID)
0 M
1 N
…… ……
需要说明的是,上述路由表为静态路由表,一般在终端与远程虚拟桌面计算机建立虚拟通道时,由TWAIN服务端821与TWAIN客户端811配合完成。此种方式下,所有APP进程,其VID与SID(ID)映射关系相同,因此,路由表中只需要记录〈VID、SID〉的对应关系即可。
当然,本发明实施例中的路由表也可以是动态生成的,即在APP进程第一次与TWAIN服务端通信时,由TWAIN服务端821在路由表中,新分配一个与PID,VID对应的SID,以确保在此PID对应的APP进程中,各VID与SID一一对应。此种方式下,各个APP进程中,其映射关系可能不同,整个路由表中的记录条数是动态变化的,因此,路由表中需要记录〈PID、VID、SID〉的对应关系。如表二所示。
表二
PID VID SID(ID)
A 0 M
A 1 N
…… …… ……
需要说明的是,上述仅是示例性的给出了两种路由表的具体实现,当然,还可能存在其它的实现方式,本发明实施例对如何构建路由表以及路由表的具体形式不作具体限定。
需要说明的是,由于TWAIN服务端需确保某应用程序运行期间,虚拟数据源与图像设备数据源的映射关系不变化,因此,TWAIN服务端821一般通过监控APP进程是否关闭的方式,来及时清除与此进程相关的资源,如清除路由表中与此APP进程相关的路由记录。本发明实施例对此不作具体限定。
需要说明的是,如具体实施方式前序部分所述,根据TWAIN协议的规定,APP与DSM之间通过DSM_Entry接口函数进行通信,DSM与虚拟数据源之间通过DS_Entry接口函数进行通信,本发明实施例对此不作具体限定。
本领域普通技术人员容易理解,上述仅是示例性的提供两种不同场景下TWAIN协议的远程重定向方法,当然,还可能存在其它的实现方式,本发 明实施例对此不作具体限定。
需要说明的是,本发明实施例中,远程虚拟桌面计算机中的APP还可以选择使用本地数据源,本发明实施例对此不作具体限定。
需要说明的是,本发明实施例中,远程虚拟桌面计算机侧的本地数据源可以有多个,本发明实施例对此不作具体限定。
需要说明的是,本发明实施例中,远程虚拟桌面计算机侧的本地数据源不一定与具体的图像设备相关,只需要是满足TWAIN协议的数据源即可。至于该数据源是与USB图像设备交互,还是与非USB图像设备交互,均不影响TWAIN协议的远程重定向。甚至,该数据源可以直接与磁盘文件交互,从图片文件中获取图像数据,本发明实施例对此不作具体限定。
本发明实施例提供一种TWAIN协议的远程重定向方法,包括:当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机获取APP下发的TWAIN协议规定的指令参数;远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数;远程虚拟桌面计算机接收终端发送的第二消息包,第二消息包携带指令参数对应的操作结果,其中,指令参数对应的操作结果是由设置在终端内部的图像设备数据源处理得到的;远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。基于上述方案,由于本发明实施例在进行TWAIN协议的远程重定向时,由远程虚拟桌面计算机将APP下发的TWAIN协议规定的指令参数发送给终端,由终端根据TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作后返回操作结果给远程虚拟桌面计算机。即,本发明实施例通过设置在终端内部的图像设备数据源执行相应的操作,比如打开图像设备数据源。考虑到大部分数据在图像设备数据源与图像设备之间传输,图像设备数据源有预览、筛选的功能,因此通过设置在终端内部的图像设备数据源执行相应的操作,就 可以在终端侧根据用户的参数设置,对原始图像数据进行筛选,最终将符合预设规则的图像发送至远程虚拟桌面计算机,而不需要如现有技术中一样,需要将所有从USB图像设备上扫描得到的大量原始图像数据,全部原样地通过USB重定向从本地终端侧传输到远程虚拟桌面计算机中,再由远程虚拟桌面计算机中的图像设备数据源根据用户的参数设置,对原始图像数据进行加工处理(如图像格式转换、图像压缩等等)与筛选后,提供给应用程序。因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的带宽浪费以及效率较低的问题,从而节省了TWAIN协议远程重定向过程的传输带宽,并且提高了TWAIN协议远程重定向过程的工作效率。另一方面,本发明实施例提供的TWAIN协议的远程重定向方法中,数据源不一定与具体的图像设备相关,只需要是满足TWAIN协议的数据源即可。比如可以是满足TWAIN协议的USB接口类的图像设备的数据源,也可以是满足TWAIN协议的非USB接口类的图像设备的数据源,因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的通用性较差的问题,从而提高TWAIN协议远程重定向过程的通用性。
综上,本发明实施例提供的TWAIN协议的远程重定向方法,能够避免现有技术中采用USB图像设备的远程重定向方式所导致的效率较低、带宽浪费、通用性较差的技术问题,从而提高了TWAIN协议远程重定向过程的工作效率和通用性,并且节省了TWAIN协议远程重定向过程的传输带宽。
实施例二、
本发明实施例提供一种TWAIN协议的远程重定向方法,具体应用于如图6或图8所示的TWAIN协议的远程重定向系统的终端中,如图13所示,方法包括:
S1301、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时时,终端接收远程虚拟桌面计算机发送的第一消息包,第一消 息包携带TWAIN协议规定的指令参数。
S1302、终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果。
S1303、终端发送第二消息包给远程虚拟桌面计算机,第二消息包携带指令参数对应的操作结果。
具体的,本发明实施例中,TWAIN协议规定的指令参数具体可参考实施例一的描述,本发明实施例在此不再赘述。
具体的,本发明实施例步骤S1302中,终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果。
当然,终端侧的TWAIN客户端也可以根据TWAIN协议请求中指令参数的不同含义分别进行处理,如加载DSM、通过DSM访问对应图像设备数据源、向图像设备数据源发送具体的TWAIN指令,完成图像的请求、扫描、传输操作等等,本发明实施例对此不作具体限定。
进一步的,如图14所示,本发明实施例中,在步骤S1303之前,还可以包括:
S1304、终端通过设置在终端内部的TWAIN客户端压缩指令参数对应的操作结果。
步骤S1303具体可以包括:
S1303a、终端发送第二消息包给远程虚拟桌面计算机,第二消息包携带压缩后的指令参数对应的操作结果。
即,TWAIN客户端还可以扩展增强,支持根据用户定制的TWAIN重定向策略,对从图像设备数据源中获取的已经加工过的静态图像数据再进行无 损或不同级别的有损压缩处理和/或图像格式转换等压缩处理,进一步减少传输数据量后,传送至远程虚拟桌面计算机侧,由如6所示的远程虚拟桌面计算机62侧的虚拟DSM623或如8所示的远程虚拟桌面计算机82侧的虚拟数据源824进行相应的解压缩后反馈给APP。如此,可以进一步节省TWAIN协议远程重定向过程的传输带宽。
进一步的,本发明实施中,第一消息包中还可以携带图像设备数据源的信息,在终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果(步骤S1302)之前,还可以包括:
终端根据图像设备数据源的信息,确定设置在终端内部的图像设备数据源。
示例性的,第一消息包中可以携带图像设备数据源的SID,其中,此SID可与终端侧的原始数据源ID相同,也可以是某种一对一关系映射后的某个值,本发明实施例对此不作具体限定。
本领域普通技术人员容易理解,消息包在终端与远程虚拟桌面计算机之间进行传递时,其消息头中会携带一些消息路由必要的信息。因此,本发明实施例中,第一消息包中除可以包含SID之外,还可能包含其它的信息,本发明实施例对此不作具体限定。
示例性的,在如图6所示的TWAIN协议的远程重定向系统中,一种可能的消息路由信息为〈PID、SID〉,即第一消息包可以携带图像设备数据源的SID以及虚拟数据源所在进程的PID,其中,SID是为了保证所发送的消息,能送到指定的地方,PID是为了保证终端返回的响应,能回到相应的地方,本发明实施例对此不作具体限定。
示例性的,在如图8所示的TWAIN协议的远程重定向系统中,一种可能的消息路由信息为〈PID、VID、SID〉,即第一消息包可以携带图像设备 数据源的SID、虚拟数据源所在进程的PID、以及虚拟数据源的VID,其中,SID是为了保证所发送的消息,能送到指定的地方,PID和VID是为了保证终端返回的响应,能回到相应的地方,本发明实施例对此不作具体限定。
进一步的,如图15所示,本发明实施例中,在终端接收远程虚拟桌面计算机发送的第一消息包(步骤S1301)之前,还包括:
S1305、当终端与远程虚拟桌面计算机建立虚拟通道时,终端获取至少一个图像设备数据源的信息。
S1306、终端发送至少一个图像设备数据源的信息给远程虚拟桌面计算机,由远程虚拟桌面计算机根据预设规则和至少一个图像设备数据源的信息,创建出与至少一个图像设备数据源对应的虚拟数据源。
具体的,本发明实施例中,在终端与远程虚拟桌面计算机建立虚拟通道时,可能触发TWAIN客户端进行图像设备数据源遍历,使得终端获取至少一个图像设备数据源的信息。其中,终端可通过下述方式中的至少一个方式获取至少一个图像设备数据源的信息:
通过终端加载的DSM、通过终端内置的DSM、以及通过终端内置的DS,本发明实施例对此不作具体限定。
即,本发明实施例中,终端侧的TWAIN客户端可以不用加载数据源管理器和/或图像设备数据源,而是本身可以具备数据源管理器和/或图像设备数据源的一些必要功能,本发明实施例对此不作具体限定。
需要说明的是,通常,DSM的主要功能是按照TWAIN协议规定的方式,到指定目录中,搜索并加载扩展名为ds的数据源,然后调用其DS_Entry接口,获取数据源中的相关信息,后续作为上层应用(如TWAIN应用软件或TWAIN客户端)与下层数据源的桥梁,进行交互及消息转发。本发明实施例中,TWAIN客户端可以不加载DSM,而是直接到指目录中,搜索并加载数据源,然后调用其DS_Entry接口,与数据源进行支持交互。这就相当于, TWAIN客户端本身就具有数据源管理器的一些必要功能了。其中,TWAIN客户端搜索的目录可能是TWAIN协议中规定的目录及子目录,也可能为其它;TWAIN客户端搜索并加载的数据源的扩展名可能为ds,也可能为其它,本发明实施例对此不作具体限定。
需要说明的是,本发明实施例中,终端侧的图像设备数据源可以有多个,本发明实施例对此不作具体限定。
需要说明的是,本发明实施例中,终端侧的图像设备数据源不一定与具体的图像设备相关,只需要是满足TWAIN协议的数据源即可。至于该数据源是与USB图像设备交互,还是与非USB图像设备交互,均不影响TWAIN协议的远程重定向。甚至,该数据源可以直接与磁盘文件交互,从图片文件中获取图像数据,本发明实施例对此不作具体限定。
本发明实施例提供一种TWAIN协议的远程重定向方法,包括:当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,终端接收远程虚拟桌面计算机发送的第一消息包,第一消息包携带TWAIN协议规定的指令参数;终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果;终端发送第二消息包给远程虚拟桌面计算机,第二消息包携带指令参数对应的操作结果。基于上述方案,由于本发明实施例在进行TWAIN协议的远程重定向时,由终端侧接收远程虚拟桌面计算机发送的TWAIN协议的指令参数后,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,最后由终端返回操作结果给远程虚拟桌面计算机,由远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。即,本发明实施例通过设置在终端内部的图像设备数据源执行相应的操作,比如打开图像设备数据源。考虑到大部分数据在图像设备数据源与图像设备之间传输,图像设备数据源有预览、筛选的功能,因此通过设置在终端内部的图像设备数据源执行相应的操作,就可以在终端侧根据用户的参数 设置,对原始图像数据进行加工处理(如图像格式转换、图像压缩等等)与筛选,最终将符合预设规则的图像发送至远程虚拟桌面计算机,而不需要如现有技术中一样,需要将所有从USB图像设备上扫描得到的大量原始图像数据,全部原样地通过USB重定向从本地终端侧传输到远程虚拟桌面计算机中,再由远程虚拟桌面计算机中的图像设备数据源根据用户的参数设置,对原始图像数据进行加工处理(如图像格式转换、图像压缩等等)与筛选后,提供给应用程序。因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的带宽浪费以及效率较低的问题,从而节省了TWAIN协议远程重定向过程的传输带宽,并且提高了TWAIN协议远程重定向过程的工作效率。另一方面,本发明实施例提供的TWAIN协议的远程重定向方法中,数据源不一定与具体的图像设备相关,只需要是满足TWAIN协议的数据源即可。比如可以是满足TWAIN协议的USB接口类的图像设备的数据源,也可以是满足TWAIN协议的非USB接口类的图像设备的数据源,因此可以避免现有技术中采用USB图像设备的远程重定向方式所导致的通用性较差的问题,从而提高TWAIN协议远程重定向过程的通用性。
综上,本发明实施例提供的TWAIN协议的远程重定向方法,能够避免现有技术中采用USB图像设备的远程重定向方式所导致的效率较低、带宽浪费、通用性较差的技术问题,从而提高了TWAIN协议远程重定向过程的工作效率和通用性,并且节省了TWAIN协议远程重定向过程的传输带宽。
实施例三、
本发明实施例提供一种TWAIN协议的远程重定向方法,具体在如图6所示的TWAIN协议的远程重定向系统60为例进行说明,如图16所示,方法包括:
S1601、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机通过APP,采用HOOK API机制加载设 置在远程虚拟桌面计算机内部的虚拟DSM。
其中,虚拟DSM用于将TWAIN协议规定的指令参数重定向至终端
S1602、远程虚拟桌面计算机通过APP,调用虚拟DSM,并通过虚拟DSM获取TWAIN协议规定的指令参数。
S1603、远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数。
S1604、终端接收第一消息包。
S1605、终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果。
S1606、终端压缩指令参数对应的操作结果。
S1607、终端发送第二消息包给远程虚拟桌面计算机,第二消息包携带压缩后的指令参数对应的操作结果。
S1608、远程虚拟桌面计算机接收第二消息包。
S1609、远程虚拟桌面计算机对压缩后的指令参数对应的操作结果进行解压缩,获得指令参数对应的操作结果。
S1610、远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。
其中,远程虚拟桌面计算机侧与终端侧的具体实现可参考实施例一的描述,本发明实施例在此不再赘述。
可选的,本发明还实施例提供一种TWAIN协议的远程重定向方法,具体在如图8所示的TWAIN协议的远程重定向系统80为例进行说明,如图17所示,方法包括:
S1701、当终端与远程虚拟桌面计算机建立虚拟通道时,远程虚拟桌面计算机获取至少一个图像设备数据源的信息。
S1702、远程虚拟桌面计算机根据预设规则和至少一个图像设备数据源的信息,分别创建出至少一个图像设备数据源中每个图像设备数据源对应的虚拟数据源。
S1703、当用户在远程虚拟桌面中通过支持TWAIN协议的APP触发获取图像操作时,远程虚拟桌面计算机通过APP加载设置在远程虚拟桌面计算机内部的DSM。
S1704、远程虚拟桌面计算机调用DSM,并通过DSM加载指定数据源。
S1705、若指定DS为设置在远程虚拟桌面计算机内部的虚拟DS,远程虚拟桌面计算机通过DSM调用虚拟DS,并通过虚拟DS获取TWAIN协议规定的指令参数。
其中,虚拟DS用于将TWAIN协议规定的指令参数重定向至终端。
S1706、远程虚拟桌面计算机发送第一消息包给终端,第一消息包携带TWAIN协议规定的指令参数。
S1707、终端接收第一消息包。
S1708、终端根据指令参数,结合TWAIN协议,通过设置在终端内部的图像设备数据源执行指令参数指定的操作,并获得指令参数对应的操作结果。
S1709、终端压缩指令参数对应的操作结果。
S1710、终端发送第二消息包给远程虚拟桌面计算机,第二消息包携带压缩后的指令参数对应的操作结果。
S1711、远程虚拟桌面计算机接收第二消息包。
S1712、远程虚拟桌面计算机对压缩后的指令参数对应的操作结果进行 解压缩,获得指令参数对应的操作结果。
S1713、远程虚拟桌面计算机以TWAIN协议规定的数据格式,将指令参数对应的操作结果反馈给APP。
其中,远程虚拟桌面计算机侧与终端侧的具体实现可参考实施例一的描述,本发明实施例在此不再赘述。
由于本实施例是对上述实施例的具体描述,其所能达到的技术效果也可以参照上述描述,此处不再赘述。
实施例四、
本发明实施例提供一种远程虚拟桌面计算机1800,如图18所示,所述远程虚拟桌面计算机1800包括:获取单元1802、发送单元1803、接收单元1804、反馈单元1805。
所述获取单元1802,用于当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作,获取所述APP下发的TWAIN协议规定的指令参数。
所述发送单元1803,用于发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数。
所述接收单元1804,用于接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的。
所述反馈单元1805,用于以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
一种可能的实现方式中,如图19所示,所述获取单元1802包括:调用模块1802a、加载模块1802b。
所述加载模块1802b,用于通过所述APP,采用HOOK API机制加载设 置在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端。
所述调用模块1802a,用于通过所述APP,调用所述虚拟DSM,通过所述虚拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
另一种可能的实现方式中,所述加载模块1802b,用于通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
所述调用模块1802a,用于调用所述DSM,并通过所述DSM加载指定数据源DS;
所述调用模块1802a,还用于若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
进一步的,如图20所示,所述远程虚拟桌面计算机1800还包括:创建单元1806。
所述获取单元1802还包括:获取模块1802c。
所述获取模块1802c,用于当所述终端与所述远程虚拟桌面计算机1800建立虚拟通道时,获取至少一个图像设备数据源的信息。
所述创建单元1806,用于根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
进一步的,如图21所示,所述远程虚拟桌面计算机1800还包括:建立单元1807、确定单元1808。
所述建立单元1807,用于在所述创建单元1806根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中 每个图像设备数据源对应的虚拟DS之后,建立所述至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟DS的映射关系。
所述确定单元1808,在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述调用模块1802a通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,所述发送单元1803发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数之前,根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息。
所述发送单元1803具体用于:
发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设备数据源的信息。
具体的,通过远程虚拟桌面计算机1800进行TWAIN协议的远程重定向方法可参考实施例一或实施例三的描述,本发明实施例对此不再赘述。
由于本实施例的远程虚拟桌面计算机1800能够用于执行上述方法,因此,其所能获得的技术效果也可以参照上述实施例中的描述,此处不再赘述。
实施例五、
本发明实施例提供一种终端2200,具体如图22所示,所述终端2200包括:接收单元2201、执行单元2202、发送单元2203。
所述接收单元2201,用于当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时时,接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数。
所述执行单元2202,用于根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果。
所述发送单元2203,用于发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
进一步的,如图23所示,所述终端2200还包括:压缩单元2204。
所述压缩单元2204,用于在所述发送单元2203发送第二消息包给所述远程虚拟桌面计算机之前,通过设置在所述终端内部的TWAIN客户端压缩所述指令参数对应的操作结果。
所述发送单元2203具体用于:
发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
进一步的,如图24所示,所述终端2200还包括确定单元2205。
所述第一消息包还携带图像设备数据源的信息。
所述确定单元2205,用于在所述执行单元2202根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
进一步的,如图25所示,所述终端2200还包括:获取单元2206。
所述获取单元2206,用于在所述接收单元2201接收远程虚拟桌面计算机发送的第一消息包之前,当所述终端2200与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息。
所述发送单元2203,还用于发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则,创建出与所述至少一个图像设备数据源对应的虚拟数据源。
优选的,所述获取单元2205具体用于:
所述终端2200通过下述方式中的至少一个方式获取所述至少一个图像 设备数据源的信息:
通过所述终端2200加载的数据源管理器DSM、通过所述终端2200内置的DSM、以及通过所述终端2200内置的DS。
具体的,通过终端2200进行TWAIN协议的远程重定向方法可参考实施例二或实施例三的描述,本发明实施例对此不再赘述。
由于本实施例的终端2200能够用于执行上述方法,因此,其所能获得的技术效果也可以参照上述实施例中的描述,此处不再赘述。
实施例六、
本发明实施例提供一种远程虚拟桌面计算机2600,如图26所示,包括至少一个处理器2602(例如中央处理器(Central Processing Unit,简称:CPU))、至少一个网络接口2605或者其他通信接口、存储器2606、和至少一个通信总线2603。
其中,至少一个通信总线2603用于实现处理器2602、至少一个网络接口2605或者其他通信接口、和存储器2606之间的连接通信。
处理器2602用于执行存储器2606中存储的可执行模块,例如计算机程序。
存储器2606可能包含高速随机存取存储器(Random Access Memory,简称:RAM)、只读存储器(Read-Only Memory,简称:ROM),也可能还包括非不稳定的存储器(non-volatile memory),例如至少一个磁盘存储器。
通过至少一个网络接口2605(可以是有线或者无线)实现该远程虚拟桌面计算机2600与至少一个其他装置之间的通信连接,可以使用互联网,广域网,本地网,城域网等。
在一些实施方式中,存储器2606存储了程序26061,程序26061可以被处理器2602执行,程序26061包括:
当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,获取所述APP下发的TWAIN协议规定的指令参数;
发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数;
接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的;
以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
一种可能的实现方式中,所述获取所述APP下发的TWAIN协议规定的指令参数,包括:
通过所述APP,采用HOOK API机制加载设置在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端;
通过所述APP,调用所述虚拟DSM,通过所述虚拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
另一种可能的实现方式中,所述获取所述APP下发的TWAIN协议规定的指令参数,包括:
通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
调用所述DSM,并通过所述DSM加载指定数据源DS;
若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
进一步的,所述方法还包括:
当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息;
根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
进一步的,在所述根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS之后,还包括:
建立所述至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟DS的映射关系;
在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,发送第一消息包给所述终端之前,还包括:
根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息;
发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数,包括:
发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设备数据源的信息。
具体的,通过远程虚拟桌面计算机2600进行TWAIN协议的远程重定向方法可参考实施例一或实施例三的描述,本发明实施例对此不再赘述。
由于本实施例的远程虚拟桌面计算机2600能够用于执行上述方法,因此,其所能获得的技术效果也可以参照上述实施例中的描述,此处不再赘述。
实施例七、
本发明实施例提供一种终端2700,如图27所示,包括至少一个处理器2702(例如CPU)、至少一个网络接口2705或者其他通信接口、存储器2706、和至少一个通信总线2703。
其中,至少一个通信总线2703用于实现处理器2702、至少一个网络接口2705或者其他通信接口、和存储器2706之间的连接通信。
处理器2702用于执行存储器2706中存储的可执行模块,例如计算机程序。
存储器2706可能包含RAM、ROM,也可能还包括非不稳定的存储器,例如至少一个磁盘存储器。
通过至少一个网络接口2705(可以是有线或者无线)实现该远程虚拟桌面计算机2700与至少一个其他装置之间的通信连接,可以使用互联网,广域网,本地网,城域网等。
在一些实施方式中,存储器2706存储了程序27061,程序27061可以被处理器2702执行,程序27061包括:
当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数;
根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果;
发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
进一步的,在所述发送第二消息包给所述远程虚拟桌面计算机之前,还包括:
通过设置在所述终端内部的TWAIN客户端压缩所述指令参数对应的操作结果;
所述发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果,包括:
发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
进一步的,所述第一消息包还携带图像设备数据源的信息。
在所述根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,还包括:
根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
进一步的,在所述接收远程虚拟桌面计算机发送的第一消息包之前,还包括:
当所述终端2700与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息。
发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则,创建出与所述至少一个图像设备数据源对应的虚拟数据源。
优选的,所述获取至少一个图像设备数据源的信息,包括:
通过下述方式中的至少一个方式获取所述至少一个图像设备数据源的信息:
通过所述终端加载的数据源管理器DSM、通过所述终端内置的DSM、以及通过所述终端内置的DS。
具体的,通过终端2700进行TWAIN协议的远程重定向方法可参考实施例二或实施例三的描述,本发明实施例对此不再赘述。
由于本实施例的终端2700能够用于执行上述方法,因此,其所能获得的技术效果也可以参照上述实施例中的描述,此处不再赘述。
实施例八、
本发明实施例提供一种TWAIN协议的远程重定向系统2800,如图28所示,所述系统包括实施例四所述的远程虚拟桌面计算机1800以及如实施例五所述的终端2200。
具体的,通过TWAIN协议的远程重定向系统2800进行TWAIN协议的远程重定向方法可参考实施例三的描述,本发明实施例对此不再赘述。
由于本实施例的TWAIN协议的远程重定向系统2800能够用于执行上述方法,因此,其所能获得的技术效果也可以参照上述实施例中的描述,此处不再赘述。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的装置,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能模块完成,即将装置的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间 接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)或处理器执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。

Claims (21)

  1. 一种无注名工具包TWAIN协议的远程重定向方法,其特征在于,所述方法包括:
    当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数;
    所述远程虚拟桌面计算机发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数;
    所述远程虚拟桌面计算机接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的;
    所述远程虚拟桌面计算机以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
  2. 根据权利要求1所述的方法,其特征在于,所述远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数,包括:
    所述远程虚拟桌面计算机通过所述APP,采用HOOK API机制加载设置在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端;
    所述远程虚拟桌面计算机通过所述APP,调用所述虚拟DSM,通过所述虚拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
  3. 根据权利要求1所述的方法,其特征在于,所述远程虚拟桌面计算机获取所述APP下发的TWAIN协议规定的指令参数,包括:
    所述远程虚拟桌面计算机通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
    所述远程虚拟桌面计算机调用所述DSM,并通过所述DSM加载指定数据源DS;
    若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述远程虚拟桌面计算机通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:
    当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,所述远程虚拟桌面计算机获取至少一个图像设备数据源的信息;
    所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
  5. 根据权利要求4所述的方法,其特征在于,在所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS之后,还包括:
    所述远程虚拟桌面计算机建立所述至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟DS的映射关系;
    在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述远程虚拟桌面计算机通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,所述远程虚拟桌面计算机发送第一消息包给所述终端之前,还包括:
    所述远程虚拟桌面计算机根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息;
    所述远程虚拟桌面计算机发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数,包括:
    所述远程虚拟桌面计算机发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设 备数据源的信息。
  6. 一种无注名工具包TWAIN协议的远程重定向方法,其特征在于,所述方法包括:
    当用户在远程虚拟桌面中通过支持TWAIN协议的应用APP触发获取图像操作时,终端接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数;
    所述终端根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果;
    所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
  7. 根据权利要求6所述的方法,其特征在于,在所述终端发送第二消息包给所述远程虚拟桌面计算机之前,还包括:
    所述终端通过设置在所述终端内部的TWAIN客户端压缩所述指令参数对应的操作结果;
    所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果,包括:
    所述终端发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
  8. 根据权利要求6或7所述的方法,其特征在于,所述第一消息包还携带所述图像设备数据源的信息;
    在所述终端根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,还包括:
    所述终端根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
  9. 根据权利要求6-8任一项所述的方法,其特征在于,在所述终端接收远程虚拟桌面计算机发送的第一消息包之前,还包括:
    当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,所述终端获取至少一个图像设备数据源的信息;
    所述终端发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则和所述至少一个图像设备数据源的信息,创建出与所述至少一个图像设备数据源对应的虚拟数据源DS。
  10. 根据权利要求9所述的方法,其特征在于,所述终端获取至少一个图像设备数据源的信息,包括:
    所述终端通过下述方式中的至少一个方式获取所述至少一个图像设备数据源的信息:
    通过所述终端加载的数据源管理器DSM、通过所述终端内置的DSM、以及通过所述终端内置的DS。
  11. 一种远程虚拟桌面计算机,其特征在于,所述远程虚拟桌面计算机包括:获取单元、发送单元、接收单元、反馈单元;
    所述获取单元,用于当用户在远程虚拟桌面中通过支持无注名工具包TWAIN协议的APP触发获取图像操作时,获取所述APP下发的TWAIN协议规定的指令参数;
    所述发送单元,用于发送第一消息包给终端,所述第一消息包携带所述TWAIN协议规定的指令参数;
    所述接收单元,用于接收所述终端发送的第二消息包,所述第二消息包携带所述指令参数对应的操作结果,其中,所述指令参数对应的操作结果是由设置在所述终端内部的图像设备数据源处理得到的;
    所述反馈单元,用于以所述TWAIN协议规定的数据格式,将所述指令参数对应的操作结果反馈给所述APP。
  12. 根据权利要求11所述的远程虚拟桌面计算机,其特征在于,所述获取单元包括:调用模块、加载模块;
    所述加载模块,用于通过所述APP,采用HOOK API机制加载设置在所述远程虚拟桌面计算机内部的虚拟数据源管理器DSM,其中,所述虚拟DSM用于将所述TWAIN协议规定的指令参数重定向至所述终端;
    所述调用模块,用于通过所述APP,调用所述虚拟DSM,通过所述虚拟DSM获取所述APP下发的TWAIN协议规定的指令参数。
  13. 根据权利要求11所述的远程虚拟桌面计算机,其特征在于,所述获取单元包括:调用模块、加载模块;
    所述加载模块,用于通过所述APP,加载设置在所述远程虚拟桌面计算机内部的DSM;
    所述调用模块,用于调用所述DSM,并通过所述DSM加载指定数据源DS;
    所述调用模块,还用于若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数,其中,所述虚拟DS用于将所述TWAIN协议规定的指令参数重定向至所述终端。
  14. 根据权利要求13所述的远程虚拟桌面计算机,其特征在于,所述远程虚拟桌面计算机还包括:创建单元;
    所述获取单元还包括:获取模块;
    所述获取模块,用于当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息;
    所述创建单元,用于根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS。
  15. 根据权利要求14所述的远程虚拟桌面计算机,其特征在于,所述 远程虚拟桌面计算机还包括:建立单元、确定单元;
    所述建立单元,还用于在所述创建单元根据预设规则和所述至少一个图像设备数据源的信息,分别创建出所述至少一个图像设备数据源中每个图像设备数据源对应的虚拟DS之后,建立所述至少一个图像设备数据源中每个图像设备数据源和与其对应的虚拟DS的映射关系;
    所述确定单元,用于在若所述指定DS为设置在所述远程虚拟桌面计算机内部的虚拟DS,所述调用模块通过所述DSM调用所述虚拟DS,并通过所述虚拟DS获取所述TWAIN协议规定的指令参数之后,所述发送单元发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数之前,根据所述映射关系,确定所述指定数据源对应的图像设备数据源的信息;
    所述发送单元具体用于:
    发送第一消息包给所述终端,所述第一消息包携带所述TWAIN协议规定的指令参数和所述指定数据源对应的图像设备数据源的信息。
  16. 一种终端,其特征在于,所述终端包括:接收单元、执行单元、发送单元;
    所述接收单元,用于当用户在远程虚拟桌面中通过支持无注名工具包TWAIN协议的应用APP触发获取图像操作时,接收远程虚拟桌面计算机发送的第一消息包,所述第一消息包携带TWAIN协议规定的指令参数;
    所述执行单元,用于根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果;
    所述发送单元,用于发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带所述指令参数对应的操作结果。
  17. 根据权利要求16所述的终端,其特征在于,所述终端还包括:压缩单元;
    所述压缩单元,用于在所述发送单元发送第二消息包给所述远程虚拟桌面计算机之前,通过设置在所述终端内部的TWAIN客户端压缩所述指令参数对应的操作结果;
    所述发送单元具体用于:
    发送第二消息包给所述远程虚拟桌面计算机,所述第二消息包携带压缩后的所述指令参数对应的操作结果。
  18. 根据权利要求16或17所述的终端,其特征在于,所述终端还包括:确定单元;
    所述第一消息包还携带图像设备数据源的信息;
    所述确定单元,用于在所述执行单元根据所述指令参数,结合所述TWAIN协议,通过设置在所述终端内部的图像设备数据源执行所述指令参数指定的操作,并获得所述指令参数对应的操作结果之前,根据所述图像设备数据源的信息,确定所述设置在所述终端内部的图像设备数据源。
  19. 根据权利要求16-18任一项所述的终端,其特征在于,所述终端还包括:获取单元;
    所述获取单元,用于在所述接收单元接收远程虚拟桌面计算机发送的第一消息包之前,当所述终端与所述远程虚拟桌面计算机建立虚拟通道时,获取至少一个图像设备数据源的信息;
    所述发送单元,还用于发送所述至少一个图像设备数据源的信息给所述远程虚拟桌面计算机,由所述远程虚拟桌面计算机根据预设规则,创建出与所述至少一个图像设备数据源对应的虚拟DS。
  20. 根据权利要求19所述的终端,其特征在于,所述获取单元具体用于:
    通过下述方式中的至少一个方式获取所述至少一个图像设备数据源的信息:
    通过所述终端加载的数据源管理器DSM、通过所述终端内置的DSM、 以及通过所述终端内置的DS。
  21. 一种无注名工具包TWAIN协议的远程重定向系统,其特征在于,所述系统包括如权利要求11-15任一项所述的远程虚拟桌面计算机以及如权利要求16-20任一项所述的终端。
PCT/CN2015/083287 2014-11-28 2015-07-03 Twain协议的远程重定向方法、装置及系统 WO2016082551A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410708341.4 2014-11-28
CN201410708341.4A CN105700864A (zh) 2014-11-28 2014-11-28 Twain协议的远程重定向方法、装置及系统

Publications (1)

Publication Number Publication Date
WO2016082551A1 true WO2016082551A1 (zh) 2016-06-02

Family

ID=56073528

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/083287 WO2016082551A1 (zh) 2014-11-28 2015-07-03 Twain协议的远程重定向方法、装置及系统

Country Status (2)

Country Link
CN (1) CN105700864A (zh)
WO (1) WO2016082551A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643936A (zh) * 2017-10-26 2018-01-30 上海金途信息科技有限公司 一种基于qemu摄像头设备的图像类外设数据重定向系统
CN112311943A (zh) * 2019-08-01 2021-02-02 深信服科技股份有限公司 一种数据扫描优化方法、装置、系统及相关组件
CN117319592A (zh) * 2023-12-01 2023-12-29 银河麒麟软件(长沙)有限公司 一种云桌面摄像头重定向方法、系统及介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107229409A (zh) * 2017-05-24 2017-10-03 中兴通讯股份有限公司 远程虚拟桌面系统的操作方法及装置
CN107888594A (zh) * 2017-11-15 2018-04-06 北京易讯通信息技术股份有限公司 一种虚拟桌面环境中的高清图像采集设备重定向方法
CN109769092A (zh) * 2019-03-05 2019-05-17 山东浪潮通软信息科技有限公司 一种设备可扩展的影像处理方法
CN114201249A (zh) * 2020-09-17 2022-03-18 中兴通讯股份有限公司 视频设备重定向方法、客户端、虚拟机桌面及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030101289A1 (en) * 2001-11-29 2003-05-29 Samsung Electronics Co., Ltd. Method and system of network image scanning
CN1704916A (zh) * 2004-06-03 2005-12-07 三星电子株式会社 外部存储装置、图像获取装置及控制驱动程序方法和系统
CN102694936A (zh) * 2011-03-21 2012-09-26 山东新北洋信息技术股份有限公司 复合扫描设备的控制方法及装置、复合扫描系统
CN102752281A (zh) * 2012-05-28 2012-10-24 福建升腾资讯有限公司 Twain协议的远程重定向方法及系统
CN103685508A (zh) * 2013-08-28 2014-03-26 东方证券股份有限公司 基于云桌面平台低带宽模式下的视频图文传输调用方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6003093A (en) * 1996-12-19 1999-12-14 Canon Kabushiki Kaisha Architecture for image processing application
CN1290030C (zh) * 2003-05-30 2006-12-13 致伸科技股份有限公司 Twain网络图像传输系统及其方法
CN102340513A (zh) * 2010-07-15 2012-02-01 江苏国光信息产业股份有限公司 基于WinCE系统在远程桌面方式下实现扫描的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030101289A1 (en) * 2001-11-29 2003-05-29 Samsung Electronics Co., Ltd. Method and system of network image scanning
CN1704916A (zh) * 2004-06-03 2005-12-07 三星电子株式会社 外部存储装置、图像获取装置及控制驱动程序方法和系统
CN102694936A (zh) * 2011-03-21 2012-09-26 山东新北洋信息技术股份有限公司 复合扫描设备的控制方法及装置、复合扫描系统
CN102752281A (zh) * 2012-05-28 2012-10-24 福建升腾资讯有限公司 Twain协议的远程重定向方法及系统
CN103685508A (zh) * 2013-08-28 2014-03-26 东方证券股份有限公司 基于云桌面平台低带宽模式下的视频图文传输调用方法

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107643936A (zh) * 2017-10-26 2018-01-30 上海金途信息科技有限公司 一种基于qemu摄像头设备的图像类外设数据重定向系统
CN112311943A (zh) * 2019-08-01 2021-02-02 深信服科技股份有限公司 一种数据扫描优化方法、装置、系统及相关组件
CN112311943B (zh) * 2019-08-01 2023-02-03 深信服科技股份有限公司 一种数据扫描优化方法、装置、系统及相关组件
CN117319592A (zh) * 2023-12-01 2023-12-29 银河麒麟软件(长沙)有限公司 一种云桌面摄像头重定向方法、系统及介质
CN117319592B (zh) * 2023-12-01 2024-03-26 银河麒麟软件(长沙)有限公司 一种云桌面摄像头重定向方法、系统及介质

Also Published As

Publication number Publication date
CN105700864A (zh) 2016-06-22

Similar Documents

Publication Publication Date Title
WO2016082551A1 (zh) Twain协议的远程重定向方法、装置及系统
US10884792B2 (en) Client live migration for a virtual machine
US10341251B2 (en) Method and system for securely transmitting volumes into cloud
US9183025B2 (en) Systems and algorithm for interfacing with a virtualized computing service over a network using a lightweight client
US9203883B2 (en) Systems and methods for a client-side remote presentation of a multimedia stream
US11452151B2 (en) Application function implementation method and electronic device
US11099865B2 (en) Auditing clipboard operations in virtual desktop environments
US9591081B2 (en) Virtual desktop access using wireless devices
US10530881B2 (en) Redirecting scanners and printers over a WAN
WO2017128710A1 (zh) 一种端口重定向的方法、服务器和系统
CN107580011B (zh) 一种数据共享方法及桌面云服务端
US10908970B1 (en) Data interface for secure analytic data system integration
US10834164B2 (en) Virtualizing audio and video devices using synchronous A/V streaming
CN105472197B (zh) 图像处理系统、方法和装置
US20240022670A1 (en) Scanning preview method in scanner redirection
US10360172B1 (en) Decoupled peripheral devices
CN113590236A (zh) 一种服务器及微服务声明式接口超时配置方法
WO2023078444A1 (zh) 一种公有云系统及其相关方法
CN116661955B (zh) 硬件访问方法、装置、电子设备及存储介质
CN113543364A (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: 15862628

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: 15862628

Country of ref document: EP

Kind code of ref document: A1