Embodiment
In order to make the purpose , technical scheme and advantage of the present invention be clearer, it is right below in conjunction with drawings and ExamplesThe present invention is further elaborated, it will be appreciated that and the specific embodiments described herein are merely illustrative of the present invention, andIt is not used in the restriction present invention.
The present invention provides a kind of multi-touch method based on acceptance of the bid kylin operating system, wherein, as depicted in figs. 1 and 2,The multi-touch method based on acceptance of the bid kylin operating system comprises the following steps:
S1, multi-point touch drive module is incorporated into the kernel of acceptance of the bid kylin operating system, for receiving the original of touch screenBeginning data, and according to Raw Data Generation event queue file.
As shown in Figure 3 and Figure 4, the step S1 include it is following step by step:
S11, the registration of drive module and related initial work are completed in system kernel;
S12, the discovery of completion equipment and the mounting operation of correlation when multi-touch device connects main frame;
The initial data that S13, order caching multi-touch device are sent, and using chained list realize ping-pong orThe data buffer storage of FIFO modes;
Initial data in S14, parsing caching, multi-point touch event data, main thing are write into event queue filePart type includes contact information event and synchronizing information event.
Wherein, the contact information event mainly includes:
Contact Tracking Recognition ABS_MT_TRACKING_ID
Contact transverse direction absolute coordinate ABS_MT_POSITION_X
Contact longitudinal direction absolute coordinate ABS_MT_POSITION_Y
Instrument contact head of district's axle ABS_MT_WIDTH_MAJOR
Instrument contact area short axle ABS_MT_WIDTH_MINOR
Contact head of district's axle ABS_MT_TOUCH_MAJOR
Contact area short axle ABS_MT_TOUCH_MINOR
Contact force value ABS_MT_PRESSURE
The synchronizing information event mainly includes:
Contact information synchronous event SYN_MT_REPORT
Contact frame synchronization event SYN_REPORT
According to upper type complete multi-point touch drive module source code design after need to add multi-point touch drive moduleIt is downloaded in system.The mode of loading multi-point touch drive module has two kinds:A kind of mode can be directly incorporated into kernel with systemLoaded during startup;If not getting the bid kylin operating system nucleus source code, generation drive module can also be compiled, is then opened in systemLoaded after dynamic using script or station command line mode.
Integration events queue file parses mould in S2, the heart code in Qt application platform graphical user interface modulesBlock, for completing the parsing to event queue file data in operating system client layer.
Wherein, as shown in Figure 5 and Figure 6, the step S2 include it is following step by step:
S21, the initialization for completing multiple spot event information caching and system relevant parameter;
S22, event queue file is traveled through under present systems, multi-point touch event queue file is identified, to the more of identificationPoint touch event queue file defines groove association and signal;
S23, when multi-point touch event queue file has data renewal, groove function by Qt platforms call complete multi-point touchThe parsing of data.
Specifically, traveling through event queue file under present systems, multi-point touch event queue file is identified;If finding,Groove association and signal are then defined, groove function corresponding to the association of its bracket groove is used to reading and parsing multi-point touch event data, signalPredominantly detect corresponding event queue file whether there is new data;After completing groove association and signal definition and binding, solution to be received is waitedNew data is analysed, once corresponding multi-point touch event queue file has data renewal, groove function can be called by Qt platforms automatically, completeInto the parsing of multi-point touch data, the data parsed will be put into the data structure of buffering, treat that mould is transmitted in the parsing of multiple spot eventBlock is for further processing.
The parsing of multiple spot event is integrated in S3, the heart code in Qt application platform graphical user interface modules and transmits mouldBlock, for completing the judgement of multiple spot event in operating system client layer and being communicated up function.
Wherein, as shown in fig. 7, the step S3 include it is following step by step:
S31, contact relevant parameter is resolved, such as the conversion of coordinate, pixel coordinate is converted to from absolute coordinate, orContact force clearing etc..
Specifically, including coordinates transformation method in the contact relevant parameter computation, main completion contact is absoluteConversion of the coordinate to pixel coordinate, algorithmic formula are as follows:
Wherein, X and Y is respectively the abscissa value and ordinate value of current contact pixel coordinate, abs_x and abs_y are oughtThe abscissa value and ordinate value of preceding physical coordinates, max_x and min_x are respectively the maximum and minimum of contact physics abscissaValue, max_y and min_y are respectively the maximum and minimum value of contact physics abscissa, and scale_x and scale_y is respectively to work asThe abscissa value and ordinate value of front contact pixel coordinate.
Include contact force value-based algorithm in the relevant parameter computation of contact, the main resolving for completing contact force value.Specific algorithm is:If bottom hardware provides contact force value, driving will pass through contact force value event (ABS_MT_PRESSURE) transmit;If value driving does not provide, resolved with following algorithm:
Wherein Pressure is contact force value, touch_major is contact head of district axle, width_major instrumentsContact head of district's axle.
S32, the judgement for completing contacts status, it is main to include pressing, be static, be mobile and leave.
Specifically, as shown in figure 8, the step S32 include it is following step by step:
S321, initialization contact buffer queue;
S322, in buffer queue travel through contact Tracking Recognition number;
S323, when not having inside buffer queue the traversal to obtain the identifier, new contact information is added into contact cachingQueue, and contacts status is set to and pressed, contact information renewal identifier set;
S324, when there is no inside buffer queue the traversal to obtain the identifier, comparison touch points coordinate whether with original coordinateIt is identical, if it is different, contacts status is set into movement, update coordinate information, contact information renewal identifier set;If phaseTogether, contacts status is set to static, contact information renewal identifier set;
S325, when being judged as that down state is sentenced or after the completion of the dynamic judgement of contact, synchronizing signal is received, if receivedContact information synchronous event, then the Tracking Recognition number of contact in buffer queue is traveled through again, if receiving contact frame synchronization thingPart, then contact information renewal identifier is detected, if it find that there is the contact of non-set, the contacts status is set to and left.
S326, by the information transfers such as all current contact coordinates and state to Qt upper stratas, by all leave statesContact is deleted from the buffer queue of contact, and all contact information renewal identifiers are resetted, and then traversal caches team againThe Tracking Recognition number of contact in row.
S33, the multiple spot event information to upper layer application transmission present frame.
According to the above-mentioned multi-touch method based on acceptance of the bid kylin operating system, the present invention also provides a kind of based on acceptance of the bid QiThe multi-touch system of unicorn operating system, the multi-touch system based on acceptance of the bid kylin operating system drive including multi-point touchDynamic model block, event queue document analysis module and multiple spot event parsing transfer module;
The multi-point touch drive module is incorporated into the kernel of acceptance of the bid kylin operating system, for receiving the original of touch screenBeginning data, and according to Raw Data Generation event queue file;
The event queue document analysis module is integrated in the heart code in Qt application platform graphical user interface modulesIn, for completing the parsing to event queue file data in operating system client layer;
The multiple spot event parsing transfer module is integrated in the heart code in Qt application platform graphical user interface modulesIn, for completing the judgement of multiple spot event in operating system client layer and being communicated up function.
Integrated specifically, event queue document analysis module and multiple spot event are parsed into transfer module the two block codesThe method being incorporated into the heart code in Qt development platform graphical user interface modules is as follows:The first step, complete setting for source codeMeter, the program segment that multi-point touch event is parsed and the parsing of multiple spot event is transmitted will be parsed and be integrated into source code;Second step, to correlationMakefile files and Qt development platform project files modify, then recompilate Qt development platform graphical user interfaceModule;3rd step, Qt is installed, completes the ring of platform graphical user interface dynamic link library file, library file and introductory pathThe renewal of border variable.
Wherein, the multi-point touch drive module includes following functions unit:
Drive module registering unit, for the registration that drive module is completed in system kernel and related initial chemical industryMake;
Operating unit is mounted, for completing the discovery of equipment and the mounting of correlation when multi-touch device connects main frameOperation;
Data buffer storage unit, the initial data sent for order caching multi-touch device, and it is real using chained listThe data buffer storage of existing ping-pong or FIFO modes.
Event queue file generating unit, for parsing the initial data in caching, write into event queue file morePoint touch event data.
Wherein, the event queue document analysis module includes following functions unit:
Initialization unit, for completing the initialization of multiple spot event information caching and system relevant parameter;
Multiple spot recognition unit, for traveling through event queue file, identification multi-point touch event queue text under present systemsPart, to the multi-point touch event queue document definition groove association of identification and signal;
Data resolution unit, for when multi-point touch event queue file has data renewal, groove function to be adjusted by Qt platformsWith the parsing for completing multi-point touch data.
Wherein, the multiple spot event parsing transfer module includes following functions unit:
Parameter calculation unit, for being resolved to contact relevant parameter;
Condition adjudgement unit, for completing the judgement of contacts status;
Data transfer unit, for sending the multiple spot event information of present frame to upper layer application.
Specifically, the condition adjudgement unit includes following functions subelement:
Queue initialization subelement, for initializing contact buffer queue;
Contact subelement is traveled through, for traveling through the Tracking Recognition number of contact in buffer queue;
Down state judgment sub-unit, during for not having traversal to obtain the identifier inside buffer queue, new is touchedPoint information adds contact buffer queue, and contacts status is set to and pressed, contact information renewal identifier set;
Contact dynamic judgment sub-unit, during for there is no traversal to obtain the identifier inside buffer queue, comparison touch pointsWhether coordinate is identical with original coordinate, if it is different, contacts status is set into movement, updates coordinate information, contact information renewalIdentifier set;If identical, contacts status is set to static, contact information renewal identifier set;
Leave state judgment sub-unit, for when being judged as that down state is sentenced or after the completion of the dynamic judgement of contact, receivingSynchronizing signal, if receiving contact information synchronous event, the Tracking Recognition number of contact in buffer queue is traveled through again, ifContact frame synchronization event is received, then contact information renewal identifier is detected, if it find that having the contact of non-set, by the contactState, which is set to, to be left.
Multi-touch method and system of the present invention based on acceptance of the bid kylin operating system, can make application developer notWith being concerned about low level development platform and driving the variation of layer, it need to only use Qt multi-point touch associated user graphic interface progress straightExploitation is connect, realizes multi-point touch function under kylin operating system of getting the bid, while reduce multi-point touch application developmentDifficulty, and improve the transplantability of multi-point touch application program.
Apparatus above embodiment is one-to-one, the simple part of device embodiment with embodiment of the method, real referring to methodApply example.
Each embodiment is described by the way of progressive in this specification, what each embodiment stressed be and otherThe difference of embodiment, between each embodiment identical similar portion mutually referring to.
Professional further appreciates that, with reference to the unit of each example of the embodiments described herein descriptionAnd algorithm steps, can be realized with electronic hardware, computer software or the combination of the two, in order to clearly demonstrate hardware andThe interchangeability of software, the composition and step of each example are generally described according to feature in the above description.ThisA little functions are performed with hardware or software mode actually, application-specific and design constraint depending on technical scheme.SpeciallyIndustry technical staff can realize described function using distinct methods to each specific application, but this realization is notThe scope of the present invention should be exceeded.
Directly it can be held with reference to the step of method or algorithm that the embodiments described herein describes with hardware, processorCapable software module, or the two combination are implemented.Software module can be placed in random access memory, internal memory, read-only storage,Institute is public in electrically programmable ROM, electrically erasable ROM, register, hard disk, moveable magnetic disc, CD-ROM or technical fieldIn the storage medium for any other forms known.
Embodiments of the invention are described above in conjunction with accompanying drawing, but the invention is not limited in above-mentioned specificEmbodiment, above-mentioned embodiment is only schematical, rather than restricted, one of ordinary skill in the artUnder the enlightenment of the present invention, in the case of present inventive concept and scope of the claimed protection is not departed from, it can also make a lotForm, these are belonged within the protection of the present invention.