Unlock instant, AI-driven research and patent intelligence for your innovation.

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

Active Publication Date: 2018-09-25
FEITIAN TECHNOLOGIES
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Therefore, in this communication method, after the upper computer sends instructions to the USB device, it can only block and wait for the USB device to finish processing and return a response, and cannot perform other operations. The upper computer has poor flexibility and low work efficiency.

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A kind of asynchronous call method and device based on usb equipment
  • A kind of asynchronous call method and device based on usb equipment
  • A kind of asynchronous call method and device based on usb equipment

Examples

Experimental program
Comparison scheme
Effect test

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...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The present invention discloses a USB device based asynchronous calling method and apparatus. The method comprises: S1: receiving an upper computer instruction sent by a master control apparatus, returning information of successful reception to the master control apparatus, sending the upper computer instruction to a device, and receiving first response data; S2: determining whether a return code is a seventh preset value, and if yes, setting a query identifier, or otherwise executing S3; and S3: by calling a callback function, returning the first response data to the master control apparatus, and ending. The method further comprises: A1: determining whether the query identifier is set, and if yes, executing A2, or otherwise returning to A1; A2: sending a query instruction to the device, and receiving second response data; A3: determining the return code, and if the return code is a sixth preset value, resetting the query identifier, and executing A4, and if the return code is a fifth preset value, returning to A1, and if the return code is one other value, executing A4; and A4: by calling the callback function, returning the second response data to the master control apparatus, and returning to A1.

Description

technical field [0001] The invention relates to the communication field, in particular to an asynchronous calling method and device based on a USB device. Background technique [0002] In the prior art, the communication mode between the upper computer and the USB device is synchronous communication. After the upper computer sends an instruction to the USB device, it waits to receive the response returned by the USB device. able to continue with other operations. Therefore, in this communication mode, after the upper computer sends instructions to the USB device, it can only block and wait for the USB device to finish processing and return a response, and cannot perform other operations. The upper computer has poor flexibility and low work efficiency. Contents of the invention [0003] The purpose of the present invention is in order to overcome the deficiencies in the prior art, provide a kind of asynchronous call method and device based on USB equipment, increase commun...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F13/10
CPCG06F13/102G06F2213/0042
Inventor 陆舟于华章
Owner FEITIAN TECHNOLOGIES