A kind of asynchronous call method and device based on usb equipment
A technology of equipment and main control device, which is applied in the field of communication, can solve problems such as low work efficiency, inability to perform other operations, blocking return response, etc., and achieve the effect of improving work efficiency
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Embodiment 1
[0031] Embodiment 1 of the present invention provides an asynchronous calling method based on a USB device, which is applied to a system including a host computer and a USB device, wherein the host computer includes a master control device and a communication library, and the method includes:
[0032] Step S1: The communication library receives the host computer command sent by the main control device, returns a successful reception message to the main control device, sends the host computer command to the USB device according to the device handle of the USB device, and receives the first response data returned by the USB device;
[0033] Step S2: The communication library judges whether the return code in the first response data is the seventh preset value, if yes, sets the query flag, and ends, otherwise executes step S3;
[0034] Step S3: the communication library returns the first response data to the main control device by calling the callback function, and ends;
[0035]...
Embodiment 2
[0051] Embodiment 2 of the present invention provides an asynchronous call method based on a USB device, such as Figure 1 to Figure 3 As shown, it is applied to a system including a host computer and a USB device, wherein the host computer includes a master control device and a communication library, and the communication library includes: a main thread and a query sub-thread;
[0052] The process of the main thread includes:
[0053] When the initialization interface of the communication library is called, the following steps are performed:
[0054] Step 101: the communication library enumerates the USB devices connected to the host computer, and obtains the device name and the length of the device name of the USB device;
[0055] Specifically, this step includes:
[0056] Step 101-1: The communication library establishes the context environment, judges whether the context environment is established successfully, if yes, obtains the context handle, and executes step 101-2, o...
Embodiment 3
[0131] Embodiment 3 of the present invention provides an asynchronous calling device based on a USB device, such as Figure 4 As shown, it includes: a first sending and receiving module 301, a first judging module 302, a setting module 303 and a first callback module 304;
[0132] The first sending and receiving module 301 is used to receive the host computer instruction sent by the main control device, return the reception success information to the main control device, send the host computer instruction to the USB device according to the device handle of the USB device, and receive the first instruction returned by the USB device. response data;
[0133] The first judging module 302 is used to judge whether the return code in the first response data is the seventh preset value after the first sending and receiving module 301 receives the first response data returned by the USB device;
[0134] The setting module 303 is used to set the query flag when the first judging modul...
PUM
Login to View More Abstract
Description
Claims
Application Information
Login to View More 


