/// <summary> /// A helper method that wraps up a list of contacts into multitouch reports before sending them out. /// </summary> /// <param name="lContacts">The list of contacts to send.</param> private void sendContacts(List <HidContactInfo> lContacts) { // Create a new report. MultiTouchReport pReport = new MultiTouchReport((byte)lContacts.Count, true); int iProcessedContacts = 0; // For each contact to send. foreach (HidContactInfo pContact in lContacts) { // Update the timestamp and increment the report contact index. pContact.Timestamp = DateTime.Now; ++iProcessedContacts; // Add the contact to the report. pReport.addContact(pContact); // If we have finished processing all the contacts. if (lContacts.Count - iProcessedContacts == 0) { // Ship the report out. this.sendReport(pReport); } // Otherwise if we have reached the maxiumum contacts per report count. else if (iProcessedContacts % MultiTouchReport.MaxContactsPerReport == 0) { // Ship out what we have already. this.sendReport(pReport); // Create a new report and mark it as a second report. pReport = null;//new MultiTouchReport((byte)lContacts.Count, false); } } }
/// <summary> /// This is called internally to ship out a report. /// </summary> /// <param name="report"></param> private void sendReport(MultiTouchReport pReport) { // Prime the data for sending. pReport.prepareData(); // Ship it out! this.pDevice.WriteReport(pReport, null); }
/// <summary> /// This is called internally to ship out a report. /// </summary> /// <param name="report"></param> private void sendReport(MultiTouchReport pReport) { // Prime the data for sending. pReport.prepareData(); // Ship it out! this.pDevice.WriteReport(pReport,null); }
/// <summary> /// A helper method that wraps up a list of contacts into multitouch reports before sending them out. /// </summary> /// <param name="lContacts">The list of contacts to send.</param> private void sendContacts(List<HidContactInfo> lContacts) { // Create a new report. MultiTouchReport pReport = new MultiTouchReport((byte)lContacts.Count, true); int iProcessedContacts = 0; // For each contact to send. foreach (HidContactInfo pContact in lContacts) { // Update the timestamp and increment the report contact index. pContact.Timestamp = DateTime.Now; ++iProcessedContacts; // Add the contact to the report. pReport.addContact(pContact); // If we have finished processing all the contacts. if (lContacts.Count - iProcessedContacts == 0) { // Ship the report out. this.sendReport(pReport); } // Otherwise if we have reached the maxiumum contacts per report count. else if (iProcessedContacts % MultiTouchReport.MaxContactsPerReport == 0) { // Ship out what we have already. this.sendReport(pReport); // Create a new report and mark it as a second report. pReport = null;//new MultiTouchReport((byte)lContacts.Count, false); } } }